@kai-chat/desktop 0.0.1 → 0.0.3

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.
@@ -0,0 +1,290 @@
1
+ var zC=Object.defineProperty;var gv=t=>{throw TypeError(t)};var DC=(t,r,a)=>r in t?zC(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var $t=(t,r,a)=>DC(t,typeof r!="symbol"?r+"":r,a),Uh=(t,r,a)=>r.has(t)||gv("Cannot "+a);var q=(t,r,a)=>(Uh(t,r,"read from private field"),a?a.call(t):r.get(t)),De=(t,r,a)=>r.has(t)?gv("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(t):r.set(t,a),Se=(t,r,a,l)=>(Uh(t,r,"write to private field"),l?l.call(t,a):r.set(t,a),a),et=(t,r,a)=>(Uh(t,r,"access private method"),a);var Sc=(t,r,a,l)=>({set _(o){Se(t,r,o,a)},get _(){return q(t,r,l)}});(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function ep(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qh={exports:{}},to={};/**
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 yv;function _C(){if(yv)return to;yv=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(l,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var m in o)m!=="key"&&(u[m]=o[m])}else u=o;return o=u.ref,{$$typeof:t,type:l,key:d,ref:o!==void 0?o:null,props:u}}return to.Fragment=r,to.jsx=a,to.jsxs=a,to}var xv;function LC(){return xv||(xv=1,qh.exports=_C()),qh.exports}var c=LC(),Hh={exports:{}},Ue={};/**
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 bv;function UC(){if(bv)return Ue;bv=1;var t=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),w=Symbol.iterator;function C(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,k={};function A(D,ae,he){this.props=D,this.context=ae,this.refs=k,this.updater=he||T}A.prototype.isReactComponent={},A.prototype.setState=function(D,ae){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,ae,"setState")},A.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function M(){}M.prototype=A.prototype;function F(D,ae,he){this.props=D,this.context=ae,this.refs=k,this.updater=he||T}var Q=F.prototype=new M;Q.constructor=F,E(Q,A.prototype),Q.isPureReactComponent=!0;var j=Array.isArray;function L(){}var $={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function z(D,ae,he){var xe=he.ref;return{$$typeof:t,type:D,key:ae,ref:xe!==void 0?xe:null,props:he}}function le(D,ae){return z(D.type,ae,D.props)}function I(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function ee(D){var ae={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(he){return ae[he]})}var ie=/\/+/g;function re(D,ae){return typeof D=="object"&&D!==null&&D.key!=null?ee(""+D.key):ae.toString(36)}function Z(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(L,L):(D.status="pending",D.then(function(ae){D.status==="pending"&&(D.status="fulfilled",D.value=ae)},function(ae){D.status==="pending"&&(D.status="rejected",D.reason=ae)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ce(D,ae,he,xe,Oe){var Me=typeof D;(Me==="undefined"||Me==="boolean")&&(D=null);var Le=!1;if(D===null)Le=!0;else switch(Me){case"bigint":case"string":case"number":Le=!0;break;case"object":switch(D.$$typeof){case t:case r:Le=!0;break;case x:return Le=D._init,ce(Le(D._payload),ae,he,xe,Oe)}}if(Le)return Oe=Oe(D),Le=xe===""?"."+re(D,0):xe,j(Oe)?(he="",Le!=null&&(he=Le.replace(ie,"$&/")+"/"),ce(Oe,ae,he,"",function(Tt){return Tt})):Oe!=null&&(I(Oe)&&(Oe=le(Oe,he+(Oe.key==null||D&&D.key===Oe.key?"":(""+Oe.key).replace(ie,"$&/")+"/")+Le)),ae.push(Oe)),1;Le=0;var ye=xe===""?".":xe+":";if(j(D))for(var je=0;je<D.length;je++)xe=D[je],Me=ye+re(xe,je),Le+=ce(xe,ae,he,Me,Oe);else if(je=C(D),typeof je=="function")for(D=je.call(D),je=0;!(xe=D.next()).done;)xe=xe.value,Me=ye+re(xe,je++),Le+=ce(xe,ae,he,Me,Oe);else if(Me==="object"){if(typeof D.then=="function")return ce(Z(D),ae,he,xe,Oe);throw ae=String(D),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return Le}function me(D,ae,he){if(D==null)return D;var xe=[],Oe=0;return ce(D,xe,"","",function(Me){return ae.call(he,Me,Oe++)}),xe}function Re(D){if(D._status===-1){var ae=D._result,he=ae();he.then(function(xe){(D._status===0||D._status===-1)&&(D._status=1,D._result=xe,he.status===void 0&&(he.status="fulfilled",he.value=xe))},function(xe){(D._status===0||D._status===-1)&&(D._status=2,D._result=xe,he.status===void 0&&(he.status="rejected",he.reason=xe))}),D._status===-1&&(D._status=0,D._result=he)}if(D._status===1)return D._result.default;throw D._result}var O=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function Be(D){var ae=$.T,he={};he.types=ae!==null?ae.types:null,$.T=he;try{var xe=D(),Oe=$.S;Oe!==null&&Oe(he,xe),typeof xe=="object"&&xe!==null&&typeof xe.then=="function"&&xe.then(L,O)}catch(Me){O(Me)}finally{ae!==null&&he.types!==null&&(ae.types=he.types),$.T=ae}}function lt(D){var ae=$.T;if(ae!==null){var he=ae.types;he===null?ae.types=[D]:he.indexOf(D)===-1&&he.push(D)}else Be(lt.bind(null,D))}var _={map:me,forEach:function(D,ae,he){me(D,function(){ae.apply(this,arguments)},he)},count:function(D){var ae=0;return me(D,function(){ae++}),ae},toArray:function(D){return me(D,function(ae){return ae})||[]},only:function(D){if(!I(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ue.Activity=g,Ue.Children=_,Ue.Component=A,Ue.Fragment=a,Ue.Profiler=o,Ue.PureComponent=F,Ue.StrictMode=l,Ue.Suspense=p,Ue.ViewTransition=b,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(D){return $.H.useMemoCache(D)}},Ue.addTransitionType=lt,Ue.cache=function(D){return function(){return D.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(D,ae,he){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var xe=E({},D.props),Oe=D.key;if(ae!=null)for(Me in ae.key!==void 0&&(Oe=""+ae.key),ae)!W.call(ae,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&ae.ref===void 0||(xe[Me]=ae[Me]);var Me=arguments.length-2;if(Me===1)xe.children=he;else if(1<Me){for(var Le=Array(Me),ye=0;ye<Me;ye++)Le[ye]=arguments[ye+2];xe.children=Le}return z(D.type,Oe,xe)},Ue.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:u,_context:D},D},Ue.createElement=function(D,ae,he){var xe,Oe={},Me=null;if(ae!=null)for(xe in ae.key!==void 0&&(Me=""+ae.key),ae)W.call(ae,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(Oe[xe]=ae[xe]);var Le=arguments.length-2;if(Le===1)Oe.children=he;else if(1<Le){for(var ye=Array(Le),je=0;je<Le;je++)ye[je]=arguments[je+2];Oe.children=ye}if(D&&D.defaultProps)for(xe in Le=D.defaultProps,Le)Oe[xe]===void 0&&(Oe[xe]=Le[xe]);return z(D,Me,Oe)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(D){return{$$typeof:m,render:D}},Ue.isValidElement=I,Ue.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:Re}},Ue.memo=function(D,ae){return{$$typeof:y,type:D,compare:ae===void 0?null:ae}},Ue.startTransition=Be,Ue.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ue.use=function(D){return $.H.use(D)},Ue.useActionState=function(D,ae,he){return $.H.useActionState(D,ae,he)},Ue.useCallback=function(D,ae){return $.H.useCallback(D,ae)},Ue.useContext=function(D){return $.H.useContext(D)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(D,ae){return $.H.useDeferredValue(D,ae)},Ue.useEffect=function(D,ae){return $.H.useEffect(D,ae)},Ue.useEffectEvent=function(D){return $.H.useEffectEvent(D)},Ue.useId=function(){return $.H.useId()},Ue.useImperativeHandle=function(D,ae,he){return $.H.useImperativeHandle(D,ae,he)},Ue.useInsertionEffect=function(D,ae){return $.H.useInsertionEffect(D,ae)},Ue.useLayoutEffect=function(D,ae){return $.H.useLayoutEffect(D,ae)},Ue.useMemo=function(D,ae){return $.H.useMemo(D,ae)},Ue.useOptimistic=function(D,ae){return $.H.useOptimistic(D,ae)},Ue.useReducer=function(D,ae,he){return $.H.useReducer(D,ae,he)},Ue.useRef=function(D){return $.H.useRef(D)},Ue.useState=function(D){return $.H.useState(D)},Ue.useSyncExternalStore=function(D,ae,he){return $.H.useSyncExternalStore(D,ae,he)},Ue.useTransition=function(){return $.H.useTransition()},Ue.version="19.3.0",Ue}var vv;function tp(){return vv||(vv=1,Hh.exports=UC()),Hh.exports}var S=tp();const po=ep(S);var Bh={exports:{}},no={},Ih={exports:{}},Fh={};/**
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 wv;function qC(){return wv||(wv=1,(function(t){function r(Z,ce){var me=Z.length;Z.push(ce);e:for(;0<me;){var Re=me-1>>>1,O=Z[Re];if(0<o(O,ce))Z[Re]=ce,Z[me]=O,me=Re;else break e}}function a(Z){return Z.length===0?null:Z[0]}function l(Z){if(Z.length===0)return null;var ce=Z[0],me=Z.pop();if(me!==ce){Z[0]=me;e:for(var Re=0,O=Z.length,Be=O>>>1;Re<Be;){var lt=2*(Re+1)-1,_=Z[lt],D=lt+1,ae=Z[D];if(0>o(_,me))D<O&&0>o(ae,_)?(Z[Re]=ae,Z[D]=me,Re=D):(Z[Re]=_,Z[lt]=me,Re=lt);else if(D<O&&0>o(ae,me))Z[Re]=ae,Z[D]=me,Re=D;else break e}}return ce}function o(Z,ce){var me=Z.sortIndex-ce.sortIndex;return me!==0?me:Z.id-ce.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,m=d.now();t.unstable_now=function(){return d.now()-m}}var p=[],y=[],x=1,g=null,b=3,w=!1,C=!1,T=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function F(Z){for(var ce=a(y);ce!==null;){if(ce.callback===null)l(y);else if(ce.startTime<=Z)l(y),ce.sortIndex=ce.expirationTime,r(p,ce);else break;ce=a(y)}}function Q(Z){if(T=!1,F(Z),!C)if(a(p)!==null)C=!0,j||(j=!0,I());else{var ce=a(y);ce!==null&&re(Q,ce.startTime-Z)}}var j=!1,L=-1,$=5,W=-1;function z(){return E?!0:!(t.unstable_now()-W<$)}function le(){if(E=!1,j){var Z=t.unstable_now();W=Z;var ce=!0;try{e:{C=!1,T&&(T=!1,A(L),L=-1),w=!0;var me=b;try{t:{for(F(Z),g=a(p);g!==null&&!(g.expirationTime>Z&&z());){var Re=g.callback;if(typeof Re=="function"){g.callback=null,b=g.priorityLevel;var O=Re(g.expirationTime<=Z);if(Z=t.unstable_now(),typeof O=="function"){g.callback=O,F(Z),ce=!0;break t}g===a(p)&&l(p),F(Z)}else l(p);g=a(p)}if(g!==null)ce=!0;else{var Be=a(y);Be!==null&&re(Q,Be.startTime-Z),ce=!1}}break e}finally{g=null,b=me,w=!1}ce=void 0}}finally{ce?I():j=!1}}}var I;if(typeof M=="function")I=function(){M(le)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,ie=ee.port2;ee.port1.onmessage=le,I=function(){ie.postMessage(null)}}else I=function(){k(le,0)};function re(Z,ce){L=k(function(){Z(t.unstable_now())},ce)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(Z){Z.callback=null},t.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<Z?Math.floor(1e3/Z):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(Z){switch(b){case 1:case 2:case 3:var ce=3;break;default:ce=b}var me=b;b=ce;try{return Z()}finally{b=me}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(Z,ce){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var me=b;b=Z;try{return ce()}finally{b=me}},t.unstable_scheduleCallback=function(Z,ce,me){var Re=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Re+me:Re):me=Re,Z){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=me+O,Z={id:x++,callback:ce,priorityLevel:Z,startTime:me,expirationTime:O,sortIndex:-1},me>Re?(Z.sortIndex=me,r(y,Z),a(p)===null&&Z===a(y)&&(T?(A(L),L=-1):T=!0,re(Q,me-Re))):(Z.sortIndex=O,r(p,Z),C||w||(C=!0,j||(j=!0,I()))),Z},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(Z){var ce=b;return function(){var me=b;b=ce;try{return Z.apply(this,arguments)}finally{b=me}}}})(Fh)),Fh}var Sv;function HC(){return Sv||(Sv=1,Ih.exports=qC()),Ih.exports}var Ph={exports:{}},cn={};/**
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 Nv;function BC(){if(Nv)return cn;Nv=1;var t=tp();function r(x){var g="https://react.dev/errors/"+x;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)g+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var l={d:{f:a,r:function(){throw Error(r(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal"),u=Symbol.for("react.recoverable"),d=Symbol.for("react.optimistic_key");function m(x,g,b){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:w==null?null:w===d?d:""+w,children:x,containerInfo:g,implementation:b}}var p=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(x,g){if(x==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,cn.browser=function(x){return{$$typeof:u,_reason:x}},cn.createPortal=function(x,g){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(r(299));return m(x,g,null,b)},cn.flushSync=function(x){var g=p.T,b=l.p;try{if(p.T=null,l.p=2,x)return x()}finally{p.T=g,l.p=b,l.d.f()}},cn.preconnect=function(x,g){typeof x=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(x,g))},cn.prefetchDNS=function(x){typeof x=="string"&&l.d.D(x)},cn.preinit=function(x,g){if(typeof x=="string"&&g&&typeof g.as=="string"){var b=g.as,w=y(b,g.crossOrigin),C=typeof g.integrity=="string"?g.integrity:void 0,T=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;b==="style"?l.d.S(x,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:w,integrity:C,fetchPriority:T}):b==="script"&&l.d.X(x,{crossOrigin:w,integrity:C,fetchPriority:T,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},cn.preinitModule=function(x,g){if(typeof x=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var b=y(g.as,g.crossOrigin);l.d.M(x,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0})}}else g==null&&l.d.M(x)},cn.preload=function(x,g){if(typeof x=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var b=g.as,w=y(b,g.crossOrigin);l.d.L(x,b,{crossOrigin:w,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},cn.preloadModule=function(x,g){if(typeof x=="string")if(g){var b=y(g.as,g.crossOrigin);l.d.m(x,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0})}else l.d.m(x)},cn.requestFormReset=function(x){l.d.r(x)},cn.unstable_batchedUpdates=function(x,g){return x(g)},cn.useFormState=function(x,g,b){return p.H.useFormState(x,g,b)},cn.useFormStatus=function(){return p.H.useHostTransitionStatus()},cn.version="19.3.0",cn}var Cv;function IC(){if(Cv)return Ph.exports;Cv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Ph.exports=BC(),Ph.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 kv;function FC(){if(kv)return no;kv=1;var t=HC(),r=tp(),a=IC();function l(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){for(var n=e,i=n;i&&!i.alternate;)n=i,(n.flags&4098)!==0&&(e=n.return),i=n.return;for(;n.return;)n=n.return;return n.tag===3?e:null}function d(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(l(188))}function y(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(l(188));return n!==e?null:e}for(var i=e,s=n;;){var f=i.return;if(f===null)break;var h=f.alternate;if(h===null){if(s=f.return,s!==null){i=s;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===i)return p(f),e;if(h===s)return p(f),n;h=h.sibling}throw Error(l(188))}if(i.return!==s.return)i=f,s=h;else{for(var v=!1,N=f.child;N;){if(N===i){v=!0,i=f,s=h;break}if(N===s){v=!0,s=f,i=h;break}N=N.sibling}if(!v){for(N=h.child;N;){if(N===i){v=!0,i=h,s=f;break}if(N===s){v=!0,s=h,i=f;break}N=N.sibling}if(!v)throw Error(l(189))}}if(i.alternate!==s)throw Error(l(190))}if(i.tag!==3)throw Error(l(188));return i.stateNode.current===i?e:n}function x(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=x(e),n!==null)return n;e=e.sibling}return null}function g(e,n,i,s,f,h){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&i(e,s,f,h)||(e.tag!==22||e.memoizedState===null)&&(n||e.tag!==5&&e.tag!==27)&&g(e.child,n,i,s,f,h))return!0;e=e.sibling}return!1}function b(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function w(e){var n=!1;for(e=e.return;e!==null&&(e.tag===4&&(n=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return n}function C(e){var n=[null,null],i=b(e);return i===null||T(n,e,i.child,{foundSelf:!1}),n}function T(e,n,i,s){for(;i!==null;){if(i===n)s.foundSelf=!0;else if(i.tag===5||i.tag===27||i.tag===6){if(s.foundSelf)return e[1]=i,!0;e[0]=i}else if((i.tag!==22||i.memoizedState===null)&&T(e,n,i.child,s))return!0;i=i.sibling}return!1}function E(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(l(559))}}var k=null,A=null;function M(e,n,i){return e===i?!0:e===n?(k=e,!0):!1}function F(e,n,i){return e===i?(A=e,!1):e===n?(A!==null&&(k=e),!0):!1}function Q(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function j(e,n,i){for(var s=0,f=e;f;f=i(f))s++;f=0;for(var h=n;h;h=i(h))f++;for(;0<s-f;)e=i(e),s--;for(;0<f-s;)n=i(n),f--;for(;s--;){if(e===n||n!==null&&e===n.alternate)return e;e=i(e),n=i(n)}return null}var L=Object.assign,$=Symbol.for("react.element"),W=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),le=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),ee=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),re=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),me=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),Be=Symbol.for("react.activity"),lt=Symbol.for("react.legacy_hidden"),_=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),ae=Symbol.for("react.recoverable"),he=Symbol.iterator;function xe(e){return e===null||typeof e!="object"?null:(e=he&&e[he]||e["@@iterator"],typeof e=="function"?e:null)}var Oe=Symbol.for("react.client.reference");function Me(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Oe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case le:return"Fragment";case ee:return"Profiler";case I:return"StrictMode";case ce:return"Suspense";case me:return"SuspenseList";case Be:return"Activity";case D:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case z:return"Portal";case re:return e.displayName||"Context";case ie:return(e._context.displayName||"Context")+".Consumer";case Z:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return n=e.displayName||null,n!==null?n:Me(e.type)||"Memo";case O:n=e._payload,e=e._init;try{return Me(e(n))}catch{}}return null}var Le=Array.isArray,ye=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,je=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Tt={pending:!1,data:null,method:null,action:null},Ke=[],se=-1;function He(e){return{current:e}}function rt(e){0>se||(e.current=Ke[se],Ke[se]=null,se--)}function Qe(e,n){se++,Ke[se]=e.current,e.current=n}var pt=He(null),zt=He(null),Ct=He(null),fe=He(null);function ge(e,n){switch(Qe(Ct,n),Qe(zt,e),Qe(pt,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?kb(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=kb(n),e=jb(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}rt(pt),Qe(pt,e)}function oe(){rt(pt),rt(zt),rt(Ct)}function It(e){var n=e.memoizedState;n!==null&&(Ml._currentValue=n.memoizedState,Qe(fe,e)),n=pt.current;var i=jb(n,e.type);n!==i&&(Qe(zt,e),Qe(pt,i))}function J(e){zt.current===e&&(rt(pt),rt(zt)),fe.current===e&&(rt(fe),Ml._currentValue=Tt)}var K,be;function Te(e){if(K===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);K=n&&n[1]||"",be=-1<i.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+K+e+be}var Ye=!1;function nn(e,n){if(!e||Ye)return"";Ye=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(pe){var B=pe}Reflect.construct(e,[],ne)}else{try{ne.call()}catch(pe){B=pe}ne=!1;try{var G=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),ne=!0,new e}finally{ne&&(G!==void 0?Object.defineProperty(e.prototype,"props",G):delete e.prototype.props)}}}else{try{throw Error()}catch(pe){B=pe}(ne=e())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(pe){if(pe&&B&&typeof pe.stack=="string")return[pe.stack,B.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=s.DetermineComponentFrameRoot(),v=h[0],N=h[1];if(v&&N){var R=v.split(`
44
+ `),Y=N.split(`
45
+ `);for(f=s=0;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;for(;f<Y.length&&!Y[f].includes("DetermineComponentFrameRoot");)f++;if(s===R.length||f===Y.length)for(s=R.length-1,f=Y.length-1;1<=s&&0<=f&&R[s]!==Y[f];)f--;for(;1<=s&&0<=f;s--,f--)if(R[s]!==Y[f]){if(s!==1||f!==1)do if(s--,f--,0>f||R[s]!==Y[f]){var X=`
46
+ `+R[s].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=s&&0<=f);break}}}finally{Ye=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Te(i):""}function Jn(e,n){switch(e.tag){case 26:case 27:case 5:return Te(e.type);case 16:return Te("Lazy");case 13:return e.child!==n&&n!==null?Te("Suspense Fallback"):Te("Suspense");case 19:return Te("SuspenseList");case 0:case 15:return nn(e.type,!1);case 11:return nn(e.type.render,!1);case 1:return nn(e.type,!0);case 31:return Te("Activity");case 30:return Te("ViewTransition");default:return""}}function kn(e){try{var n="",i=null;do n+=Jn(e,i),i=e,e=e.return;while(e);return n}catch(s){return`
47
+ Error generating stack: `+s.message+`
48
+ `+s.stack}}var fr=Object.prototype.hasOwnProperty,hr=t.unstable_scheduleCallback,Ft=t.unstable_cancelCallback,mr=t.unstable_shouldYield,jn=t.unstable_requestPaint,H=t.unstable_now,ve=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,ct=t.unstable_NormalPriority,Un=t.unstable_LowPriority,Ce=t.unstable_IdlePriority,Ht=t.log,PS=t.unstable_setDisableYieldValue,os=null,qn=null;function ha(e){if(typeof Ht=="function"&&PS(e),qn&&typeof qn.setStrictMode=="function")try{qn.setStrictMode(os,e)}catch{}}var Hn=Math.clz32?Math.clz32:VS,QS=Math.log,YS=Math.LN2;function VS(e){return e>>>=0,e===0?32:31-(QS(e)/YS|0)|0}var $o=256,Zo=262144,Jo=4194304;function ti(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Wo(e,n,i){var s=e.pendingLanes;if(s===0)return 0;var f=0,h=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~h,s!==0?f=ti(s):(v&=N,v!==0?f=ti(v):i||(i=N&~e,i!==0&&(f=ti(i))))):(N=s&~h,N!==0?f=ti(N):v!==0?f=ti(v):i||(i=s&~e,i!==0&&(f=ti(i)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,i=n&-n,h>=i||h===32&&(i&4194048)!==0)?n:f}function us(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Zp(e,n){(n&8)!==0&&(n|=n&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=n;0<i;){var s=31-Hn(i),f=1<<s;n|=e[s],i&=~f}return n}function GS(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Jp(){var e=Jo;return Jo<<=1,(Jo&62914560)===0&&(Jo=4194304),e}function ud(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function cs(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function KS(e,n,i,s,f,h){var v=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var N=e.entanglements,R=e.expirationTimes,Y=e.hiddenUpdates;for(i=v&~i;0<i;){var X=31-Hn(i),ne=1<<X;N[X]=0,R[X]=-1;var B=Y[X];if(B!==null)for(Y[X]=null,X=0;X<B.length;X++){var G=B[X];G!==null&&(G.lane&=-536870913)}i&=~ne}s!==0&&Wp(e,s,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(v&~n))}function Wp(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-Hn(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function eg(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var s=31-Hn(i),f=1<<s;f&n|e[s]&n&&(e[s]|=n),i&=~f}}function tg(e,n){var i=n&-n;return i=(i&42)!==0?1:cd(i),(i&(e.suspendedLanes|n))!==0?0:i}function cd(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function dd(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ng(){var e=je.p;return e!==0?e:(e=window.event,e===void 0?32:uv(e.type))}function rg(e,n){var i=je.p;try{return je.p=e,n()}finally{je.p=i}}var Qr=Math.random().toString(36).slice(2),rn="__reactFiber$"+Qr,En="__reactProps$"+Qr,Vi="__reactContainer$"+Qr,ag="__reactEvents$"+Qr,XS="__reactListeners$"+Qr,$S="__reactHandles$"+Qr,ig="__reactResources$"+Qr,ds="__reactMarker$"+Qr,eu="__reactLoad$"+Qr;function tu(e){delete e[rn],delete e[En],delete e[XS],delete e[$S]}function ni(e){var n;if(n=e[rn])return n;for(var i=e.parentNode;i;){if(n=i[Vi]||i[rn]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=Pb(e);e!==null;){if(i=e[rn])return i;e=Pb(e)}return n}e=i,i=e.parentNode}return null}function Gi(e){if(e=e[rn]||e[Vi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function fs(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(l(33))}function Ki(e){var n=e[ig];return n||(n=e[ig]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Jt(e){e[ds]=!0}function lg(e){e[eu]=void 0}var sg=new Set,og={};function ri(e,n){Xi(e,n),Xi(e+"Capture",n)}function Xi(e,n){for(og[e]=n,e=0;e<n.length;e++)sg.add(n[e])}var ZS=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]*$"),ug={},cg={};function JS(e){return fr.call(cg,e)?!0:fr.call(ug,e)?!1:ZS.test(e)?cg[e]=!0:(ug[e]=!0,!1)}var st=!1;function dg(){var e=st;return st=!1,e}function nu(e,n,i){if(JS(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,i)}}function ru(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,i)}}function Yr(e,n,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,s)}}function Bn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fg(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function WS(e,n,i){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(v){i=""+v,h.call(this,v)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(v){i=""+v},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function fd(e){if(!e._valueTracker){var n=fg(e)?"checked":"value";e._valueTracker=WS(e,n,""+e[n])}}function hg(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),s="";return e&&(s=fg(e)?e.checked?"true":"false":e.value),e=s,e!==i?(n.setValue(e),!0):!1}var eN=/[\n"\\]/g;function Wn(e){return e.replace(eN,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function hd(e,n,i,s,f,h,v,N){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),n!=null?v==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Bn(n)):e.value!==""+Bn(n)&&(e.value=""+Bn(n)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),n!=null?v==="number"&&e.value==n?md(e,Bn(e.value)):md(e,Bn(n)):i!=null?md(e,Bn(i)):s!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Bn(N):e.removeAttribute("name")}function mg(e,n,i,s,f,h,v,N){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||i!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){fd(e);return}i=i!=null?""+Bn(i):"",n=n!=null?""+Bn(n):i,N||n===e.value||(e.value=n),e.defaultValue=n}s=s??f,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),fd(e)}function md(e,n){e.defaultValue!==""+n&&(e.defaultValue=""+n)}function $i(e,n,i,s){if(e=e.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<e.length;i++)f=n.hasOwnProperty("$"+e[i].value),e[i].selected!==f&&(e[i].selected=f),f&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Bn(i),n=null,f=0;f<e.length;f++){if(e[f].value===i){e[f].selected=!0,s&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function pg(e,n,i){if(n!=null&&(n=""+Bn(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Bn(i):""}function gg(e,n,i,s){if(n==null){if(s!=null){if(i!=null)throw Error(l(92));if(Le(s)){if(1<s.length)throw Error(l(93));s=s[0]}i=s}i==null&&(i=""),n=i}i=Bn(n),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),fd(e)}function Zi(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var tN=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 yg(e,n,i){var s=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,i):typeof i!="number"||i===0||tN.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function xg(e,n,i){if(n!=null&&typeof n!="object")throw Error(l(62));if(e=e.style,i!=null){for(var s in i)!i.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="",st=!0);for(var f in n)s=n[f],n.hasOwnProperty(f)&&i[f]!==s&&(yg(e,f,s),st=!0)}else for(var h in n)n.hasOwnProperty(h)&&yg(e,h,n[h])}function pd(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var nN=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"],["maskType","mask-type"],["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"]]),rN=/^[\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 au(e){return rN.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Er(){}var gd=null;function yd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ji=null,Wi=null;function bg(e){var n=Gi(e);if(n&&(e=n.stateNode)){var i=e[En]||null;e:switch(e=n.stateNode,n.type){case"input":if(hd(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Wn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var s=i[n];if(s!==e&&s.form===e.form){var f=s[En]||null;if(!f)throw Error(l(90));hd(s,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<i.length;n++)s=i[n],s.form===e.form&&hg(s)}break e;case"textarea":pg(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&$i(e,!!i.multiple,n,!1)}}}var xd=!1;function vg(e,n,i){if(xd)return e(n,i);xd=!0;try{var s=e(n);return s}finally{if(xd=!1,(Ji!==null||Wi!==null)&&(ac(),Ji&&(n=Ji,e=Wi,Wi=Ji=null,bg(n),e)))for(n=0;n<e.length;n++)bg(e[n])}}function hs(e,n){var i=e.stateNode;if(i===null)return null;var s=i[En]||null;if(s===null)return null;i=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(l(231,n,typeof i));return i}var Vr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bd=!1;if(Vr)try{var ms={};Object.defineProperty(ms,"passive",{get:function(){bd=!0}}),window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{bd=!1}var ma=null,vd=null,iu=null;function wg(){if(iu)return iu;var e,n=vd,i=n.length,s,f="value"in ma?ma.value:ma.textContent,h=f.length;for(e=0;e<i&&n[e]===f[e];e++);var v=i-e;for(s=1;s<=v&&n[i-s]===f[h-s];s++);return iu=f.slice(e,1<s?1-s:void 0)}function lu(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function su(){return!0}function Sg(){return!1}function yn(e){function n(i,s,f,h,v){this._reactName=i,this._targetInst=f,this.type=s,this.nativeEvent=h,this.target=v,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(i=e[N],this[N]=i?i(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?su:Sg,this.isPropagationStopped=Sg,this}return L(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=su)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=su)},persist:function(){},isPersistent:su}),n}var pa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ou=yn(pa),ps=L({},pa,{view:0,detail:0}),aN=yn(ps),wd,Sd,gs,uu=L({},ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cd,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==gs&&(gs&&e.type==="mousemove"?(wd=e.screenX-gs.screenX,Sd=e.screenY-gs.screenY):Sd=wd=0,gs=e),wd)},movementY:function(e){return"movementY"in e?e.movementY:Sd}}),Ng=yn(uu),iN=L({},uu,{dataTransfer:0}),lN=yn(iN),sN=L({},ps,{relatedTarget:0}),Nd=yn(sN),oN=L({},pa,{animationName:0,elapsedTime:0,pseudoElement:0}),uN=yn(oN),cN=L({},pa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),dN=yn(cN),fN=L({},pa,{data:0}),Cg=yn(fN),hN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mN={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"},pN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gN(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=pN[e])?!!n[e]:!1}function Cd(){return gN}var yN=L({},ps,{key:function(e){if(e.key){var n=hN[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=lu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?mN[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cd,charCode:function(e){return e.type==="keypress"?lu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?lu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xN=yn(yN),bN=L({},uu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kg=yn(bN),vN=L({},pa,{submitter:0}),wN=yn(vN),SN=L({},ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cd}),NN=yn(SN),CN=L({},pa,{propertyName:0,elapsedTime:0,pseudoElement:0}),kN=yn(CN),jN=L({},uu,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),EN=yn(jN),TN=L({},pa,{newState:0,oldState:0,source:0}),AN=yn(TN),ON=[9,13,27,32],kd=Vr&&"CompositionEvent"in window,ys=null;Vr&&"documentMode"in document&&(ys=document.documentMode);var RN=Vr&&"TextEvent"in window&&!ys,jg=Vr&&(!kd||ys&&8<ys&&11>=ys),Eg=" ",Tg=!1;function Ag(e,n){switch(e){case"keyup":return ON.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Og(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var el=!1;function MN(e,n){switch(e){case"compositionend":return Og(n);case"keypress":return n.which!==32?null:(Tg=!0,Eg);case"textInput":return e=n.data,e===Eg&&Tg?null:e;default:return null}}function zN(e,n){if(el)return e==="compositionend"||!kd&&Ag(e,n)?(e=wg(),iu=vd=ma=null,el=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return jg&&n.locale!=="ko"?null:n.data;default:return null}}var DN={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 Rg(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!DN[e.type]:n==="textarea"}function Mg(e,n,i,s){Ji?Wi?Wi.push(s):Wi=[s]:Ji=s,n=cc(n,"onChange"),0<n.length&&(i=new ou("onChange","change",null,i,s),e.push({event:i,listeners:n}))}var xs=null,bs=null;function _N(e){bb(e,0)}function cu(e){var n=fs(e);if(hg(n))return e}function zg(e,n){if(e==="change")return n}var Dg=!1;if(Vr){var jd;if(Vr){var Ed="oninput"in document;if(!Ed){var _g=document.createElement("div");_g.setAttribute("oninput","return;"),Ed=typeof _g.oninput=="function"}jd=Ed}else jd=!1;Dg=jd&&(!document.documentMode||9<document.documentMode)}function Lg(){xs&&(xs.detachEvent("onpropertychange",Ug),bs=xs=null)}function Ug(e){if(e.propertyName==="value"&&cu(bs)){var n=[];Mg(n,bs,e,yd(e)),vg(_N,n)}}function LN(e,n,i){e==="focusin"?(Lg(),xs=n,bs=i,xs.attachEvent("onpropertychange",Ug)):e==="focusout"&&Lg()}function UN(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return cu(bs)}function qN(e,n){if(e==="click")return cu(n)}function HN(e,n){if(e==="input"||e==="change")return cu(n)}function BN(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var In=typeof Object.is=="function"?Object.is:BN;function vs(e,n){if(In(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),s=Object.keys(n);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var f=i[s];if(!fr.call(n,f)||!In(e[f],n[f]))return!1}return!0}function Td(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function qg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hg(e,n){var i=qg(e);e=0;for(var s;i;){if(i.nodeType===3){if(s=e+i.textContent.length,e<=n&&s>=n)return{node:i,offset:n-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=qg(i)}}function Bg(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Bg(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Ig(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Td(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=Td(e.document)}return n}function Ad(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var IN=Vr&&"documentMode"in document&&11>=document.documentMode,tl=null,Od=null,ws=null,Rd=!1;function Fg(e,n,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Rd||tl==null||tl!==Td(s)||(s=tl,"selectionStart"in s&&Ad(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ws&&vs(ws,s)||(ws=s,s=cc(Od,"onSelect"),0<s.length&&(n=new ou("onSelect","select",null,n,i),e.push({event:n,listeners:s}),n.target=tl)))}function ai(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var nl={animationend:ai("Animation","AnimationEnd"),animationiteration:ai("Animation","AnimationIteration"),animationstart:ai("Animation","AnimationStart"),transitionrun:ai("Transition","TransitionRun"),transitionstart:ai("Transition","TransitionStart"),transitioncancel:ai("Transition","TransitionCancel"),transitionend:ai("Transition","TransitionEnd")},Md={},Pg={};Vr&&(Pg=document.createElement("div").style,"AnimationEvent"in window||(delete nl.animationend.animation,delete nl.animationiteration.animation,delete nl.animationstart.animation),"TransitionEvent"in window||delete nl.transitionend.transition);function ii(e){if(Md[e])return Md[e];if(!nl[e])return e;var n=nl[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in Pg)return Md[e]=n[i];return e}var Qg=ii("animationend"),Yg=ii("animationiteration"),Vg=ii("animationstart"),FN=ii("transitionrun"),PN=ii("transitionstart"),QN=ii("transitioncancel"),Gg=ii("transitionend"),Kg=new Map,zd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");zd.push("scrollEnd");function pr(e,n){Kg.set(e,n),ri(n,[e])}var YN=0;function Gr(e,n){if(e.name!=null&&e.name!=="auto")return e.name;if(n.autoName!==null)return n.autoName;e=br.identifierPrefix;var i=YN++;return e="_"+e+"t_"+i.toString(32)+"_",n.autoName=e}function Xg(e){if(e==null||typeof e=="string")return e;var n=null,i=Sl;if(i!==null)for(var s=0;s<i.length;s++){var f=e[i[s]];if(f!=null){if(f==="none")return"none";n=n==null?f:n+(" "+f)}}return n??e.default}function Kr(e,n){return e=Xg(e),n=Xg(n),n==null?e==="auto"?null:e:n==="auto"?null:n}var du=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},er=[],rl=0,Dd=0;function fu(){for(var e=rl,n=Dd=rl=0;n<e;){var i=er[n];er[n++]=null;var s=er[n];er[n++]=null;var f=er[n];er[n++]=null;var h=er[n];if(er[n++]=null,s!==null&&f!==null){var v=s.pending;v===null?f.next=f:(f.next=v.next,v.next=f),s.pending=f}h!==0&&$g(i,f,h)}}function hu(e,n,i,s){er[rl++]=e,er[rl++]=n,er[rl++]=i,er[rl++]=s,Dd|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function _d(e,n,i,s){return hu(e,n,i,s),mu(e)}function li(e,n){return hu(e,null,null,n),mu(e)}function $g(e,n,i){e.lanes|=i;var s=e.alternate;s!==null&&(s.lanes|=i);for(var f=!1,h=e.return;h!==null;)h.childLanes|=i,s=h.alternate,s!==null&&(s.childLanes|=i),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Hn(i),e=h.hiddenUpdates,s=e[f],s===null?e[f]=[n]:s.push(n),n.lane=i|536870912),h):null}function mu(e){if(50<Ps)throw Ps=0,rc=null,Error(l(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var al={};function VN(e,n,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tn(e,n,i,s){return new VN(e,n,i,s)}function Ld(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xr(e,n){var i=e.alternate;return i===null?(i=Tn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&1206910976,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Zg(e,n){e.flags&=1206910978;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function pu(e,n,i,s,f,h){var v=0;if(s=e,typeof s=="function")Ld(s)&&(v=1);else if(typeof s=="string")v=vC(e,i,pt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(s){case Be:return e=Tn(31,i,n,f),e.elementType=Be,e.lanes=h,e;case le:return si(i.children,f,h,n);case I:v=8,f|=24;break;case ee:return e=Tn(12,i,n,f|2),e.elementType=ee,e.lanes=h,e;case ce:return e=Tn(13,i,n,f),e.elementType=ce,e.lanes=h,e;case me:return e=Tn(19,i,n,f),e.elementType=me,e.lanes=h,e;case lt:case D:return e=f|32,e=Tn(30,i,n,e),e.elementType=D,e.lanes=h,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case re:v=10;break e;case ie:v=9;break e;case Z:v=11;break e;case Re:v=14;break e;case O:v=16,s=null;break e}v=29,i=Error(l(130,e===null?"null":typeof e,"")),s=null}return n=Tn(v,i,n,f),n.elementType=e,n.type=s,n.lanes=h,n}function si(e,n,i,s){return e=Tn(7,e,s,n),e.lanes=i,e}function Ud(e,n,i){return e=Tn(6,e,null,n),e.lanes=i,e}function Jg(e){var n=Tn(18,null,null,0);return n.stateNode=e,n}function qd(e,n,i){return n=Tn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Wg=new WeakMap;function tr(e,n){if(typeof e=="object"&&e!==null){var i=Wg.get(e);return i!==void 0?i:(n={value:e,source:n,stack:kn(n)},Wg.set(e,n),n)}return{value:e,source:n,stack:kn(n)}}var il=[],ll=0,gu=null,Ss=0,nr=[],rr=0,ga=null,Tr=1,Ar="";function $r(e,n){il[ll++]=Ss,il[ll++]=gu,gu=e,Ss=n}function ey(e,n,i){nr[rr++]=Tr,nr[rr++]=Ar,nr[rr++]=ga,ga=e;var s=Tr;e=Ar;var f=32-Hn(s)-1;s&=~(1<<f),i+=1;var h=32-Hn(n)+f;if(30<h){var v=f-f%5;h=(s&(1<<v)-1).toString(32),s>>=v,f-=v,Tr=1<<32-Hn(n)+f|i<<f|s,Ar=h+e}else Tr=1<<h|i<<f|s,Ar=e}function yu(e){e.return!==null&&($r(e,1),ey(e,1,0))}function Hd(e){for(;e===gu;)gu=il[--ll],il[ll]=null,Ss=il[--ll],il[ll]=null;for(;e===ga;)ga=nr[--rr],nr[rr]=null,Ar=nr[--rr],nr[rr]=null,Tr=nr[--rr],nr[rr]=null}function ty(e,n){nr[rr++]=Tr,nr[rr++]=Ar,nr[rr++]=ga,Tr=n.id,Ar=n.overflow,ga=e}var Wt=null,kt=null,Ve=!1,ya=null,ar=!1,Bd=Error(l(519));function xa(e){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ns(tr(n,e)),Bd}function ny(e){var n=e.stateNode,i=e.type,s=e.memoizedProps;switch(n[rn]=e,n[En]=s,i){case"dialog":$e("cancel",n),$e("close",n);break;case"iframe":case"object":case"embed":$e("load",n);break;case"video":case"audio":for(i=0;i<Ys.length;i++)$e(Ys[i],n);break;case"source":$e("error",n);break;case"img":case"image":case"link":$e("error",n),$e("load",n);break;case"details":$e("toggle",n);break;case"input":$e("invalid",n),mg(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":$e("invalid",n);break;case"textarea":$e("invalid",n),gg(n,s.value,s.defaultValue,s.children)}i=s.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||s.suppressHydrationWarning===!0||Nb(n.textContent,i)?(s.popover!=null&&($e("beforetoggle",n),$e("toggle",n)),s.onScroll!=null&&$e("scroll",n),s.onScrollEnd!=null&&$e("scrollend",n),s.onClick!=null&&(n.onclick=Er),n=!0):n=!1,n||xa(e,!0)}function xu(e){for(Wt=e.return;Wt;)switch(Wt.tag){case 5:case 31:case 13:ar=!1;return;case 27:case 3:ar=!0;return;default:Wt=Wt.return}}function sl(e){if(e!==Wt)return!1;if(!Ve)return xu(e),Ve=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||yh(e.type,e.memoizedProps)),i=!i),i&&kt&&xa(e),xu(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));kt=Fb(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));kt=Fb(e)}else n===27?(n=kt,Da(e.type)?(e=jh,jh=null,kt=e):kt=n):kt=Wt?lr(e.stateNode.nextSibling):null;return!0}function oi(){kt=Wt=null,Ve=!1}function Id(){var e=ya;return e!==null&&(Rn===null?Rn=e:Rn.push.apply(Rn,e),ya=null),e}function Ns(e){ya===null?ya=[e]:ya.push(e)}var Fd=He(null),ui=null,Zr=null;function ba(e,n,i){Qe(Fd,n._currentValue),n._currentValue=i}function Jr(e){e._currentValue=Fd.current,rt(Fd)}function bu(e,n,i){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===i)break;e=e.return}}function Pd(e,n,i,s){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var v=f.child;h=h.firstContext;e:for(;h!==null;){var N=h;h=f;for(var R=0;R<n.length;R++)if(N.context===n[R]){h.lanes|=i,N=h.alternate,N!==null&&(N.lanes|=i),bu(h.return,i,e),s||(v=null);break e}h=N.next}}else if(f.tag===18){if(v=f.return,v===null)throw Error(l(341));v.lanes|=i,h=v.alternate,h!==null&&(h.lanes|=i),bu(v,i,e),v=null}else f.tag===13&&f.memoizedState!==null&&f.memoizedState.dehydrated===null?(f.lanes|=i,v=f.alternate,v!==null&&(v.lanes|=i),bu(f.return,i,e),v=f.child,v=v!==null?v.sibling:null):v=f.child;if(v!==null)v.return=f;else for(v=f;v!==null;){if(v===e){v=null;break}if(f=v.sibling,f!==null){f.return=v.return,v=f;break}v=v.return}f=v}}function ci(e,n,i,s){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var v=f.alternate;if(v===null)throw Error(l(387));if(v=v.memoizedProps,v!==null){var N=f.type;In(f.pendingProps.value,v.value)||(e!==null?e.push(N):e=[N])}}else if(f===fe.current){if(v=f.alternate,v===null)throw Error(l(387));v.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Ml):e=[Ml])}f=f.return}return e!==null&&Pd(n,e,i,s),n.flags|=262144,e!==null}function vu(e){for(e=e.firstContext;e!==null;){if(!In(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function di(e){ui=e,Zr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function an(e){return ry(ui,e)}function wu(e,n){return ui===null&&di(e),ry(e,n)}function ry(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},Zr===null){if(e===null)throw Error(l(308));Zr=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Zr=Zr.next=n;return i}var GN=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},KN=t.unstable_scheduleCallback,XN=t.unstable_NormalPriority,Pt={$$typeof:re,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qd(){return{controller:new GN,data:new Map,refCount:0}}function Cs(e){e.refCount--,e.refCount===0&&KN(XN,function(){e.controller.abort()})}function ay(e,n){if((e.pendingLanes&4194048)!==0){var i=e.transitionTypes;for(i===null&&(i=e.transitionTypes=[]),e=0;e<n.length;e++){var s=n[e];i.indexOf(s)===-1&&i.push(s)}}}var ks=null;function $N(e){var n=e.transitionTypes;return e.transitionTypes=null,n}var js=null,Yd=0,fi=0,ol=null;function ZN(e,n){if(js===null){var i=js=[];Yd=0,fi=oh(),ol={status:"pending",value:void 0,then:function(s){i.push(s)}}}return Yd++,n.then(iy,iy),n}function iy(){if(--Yd===0&&(ks=null,js!==null)){ol!==null&&(ol.status="fulfilled");var e=js;js=null,fi=0,ol=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function JN(e,n){var i=[],s={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var f=0;f<i.length;f++)(0,i[f])(n)},function(f){for(s.status="rejected",s.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),s}var ly=ye.S;ye.S=function(e,n){if(Jx=H(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&ZN(e,n),ks!==null)for(var i=jl;i!==null;)ay(i,ks),i=i.next;if(i=e.types,i!==null){for(var s=jl;s!==null;)ay(s,i),s=s.next;if(fi!==0){s=ks,s===null&&(s=ks=[]);for(var f=0;f<i.length;f++){var h=i[f];s.indexOf(h)===-1&&s.push(h)}}}ly!==null&&ly(e,n)};var hi=He(null);function Vd(){var e=hi.current;return e!==null?e:wt.pooledCache}function Su(e,n){n===null?Qe(hi,hi.current):Qe(hi,n.pool)}function sy(){var e=Vd();return e===null?null:{parent:Pt._currentValue,pool:e}}var ul=Error(l(460)),Gd=Error(l(474)),Nu=Error(l(542)),Cu={then:function(){}};function oy(e){return e=e.status,e==="fulfilled"||e==="rejected"}function uy(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(Er,Er),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,dy(e),e===void 0&&!("reason"in n)?Error(l(600)):e;default:if(typeof n.status=="string")n.then(Er,Er);else{if(e=wt,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=s}},function(s){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,dy(e),e}throw pi=n,ul}}function mi(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(pi=i,ul):i}}var pi=null;function cy(){if(pi===null)throw Error(l(459));var e=pi;return pi=null,e}function dy(e){if(e===ul||e===Nu)throw Error(l(483))}var cl=null,Es=0;function ku(e){var n=Es;return Es+=1,cl===null&&(cl=[]),uy(cl,e,n)}function va(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function ju(e,n){throw n.$$typeof===$?Error(l(525)):(e=Object.prototype.toString.call(n),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function fy(e){function n(P,U){if(e){var V=P.deletions;V===null?(P.deletions=[U],P.flags|=16):V.push(U)}}function i(P,U){if(!e)return null;for(;U!==null;)n(P,U),U=U.sibling;return null}function s(P){for(var U=new Map;P!==null;)P.key===null?U.set(P.index,P):U.set(P.key,P),P=P.sibling;return U}function f(P,U){return P=Xr(P,U),P.index=0,P.sibling=null,P}function h(P,U,V){return P.index=V,e?(V=P.alternate,V!==null?(V=V.index,V<U?(P.flags|=2,U):V):(P.flags|=134217730,U)):(P.flags|=1048576,U)}function v(P){return e&&P.alternate===null&&(P.flags|=134217730),P}function N(P,U,V,te){return U===null||U.tag!==6?(U=Ud(V,P.mode,te),U.return=P,U):(U=f(U,V),U.return=P,U)}function R(P,U,V,te){var Ne=V.type;return Ne===le?(P=X(P,U,V.props.children,te,V.key),va(P,V),P):U!==null&&(U.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===O&&mi(Ne)===U.type)?(U=f(U,V.props),va(U,V),U.return=P,U):(U=pu(V.type,V.key,V.props,null,P.mode,te),va(U,V),U.return=P,U)}function Y(P,U,V,te){return U===null||U.tag!==4||U.stateNode.containerInfo!==V.containerInfo||U.stateNode.implementation!==V.implementation?(U=qd(V,P.mode,te),U.return=P,U):(U=f(U,V.children||[]),U.return=P,U)}function X(P,U,V,te,Ne){return U===null||U.tag!==7?(U=si(V,P.mode,te,Ne),U.return=P,U):(U=f(U,V),U.return=P,U)}function ne(P,U,V){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=Ud(""+U,P.mode,V),U.return=P,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case W:return V=pu(U.type,U.key,U.props,null,P.mode,V),va(V,U),V.return=P,V;case z:return U=qd(U,P.mode,V),U.return=P,U;case O:return U=mi(U),ne(P,U,V)}if(Le(U)||xe(U))return U=si(U,P.mode,V,null),U.return=P,U;if(typeof U.then=="function")return ne(P,ku(U),V);if(U.$$typeof===re)return ne(P,wu(P,U),V);ju(P,U)}return null}function B(P,U,V,te){var Ne=U!==null?U.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Ne!==null?null:N(P,U,""+V,te);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case W:return V.key===Ne?R(P,U,V,te):null;case z:return V.key===Ne?Y(P,U,V,te):null;case O:return V=mi(V),B(P,U,V,te)}if(Le(V)||xe(V))return Ne!==null?null:X(P,U,V,te,null);if(typeof V.then=="function")return B(P,U,ku(V),te);if(V.$$typeof===re)return B(P,U,wu(P,V),te);ju(P,V)}return null}function G(P,U,V,te,Ne){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return P=P.get(V)||null,N(U,P,""+te,Ne);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case W:return P=P.get(te.key===null?V:te.key)||null,R(U,P,te,Ne);case z:return P=P.get(te.key===null?V:te.key)||null,Y(U,P,te,Ne);case O:return te=mi(te),G(P,U,V,te,Ne)}if(Le(te)||xe(te))return P=P.get(V)||null,X(U,P,te,Ne,null);if(typeof te.then=="function")return G(P,U,V,ku(te),Ne);if(te.$$typeof===re)return G(P,U,V,wu(U,te),Ne);ju(U,te)}return null}function pe(P,U,V,te){for(var Ne=null,We=null,Ae=U,_e=U=0,Vt=null;Ae!==null&&_e<V.length;_e++){Ae.index>_e?(Vt=Ae,Ae=null):Vt=Ae.sibling;var at=B(P,Ae,V[_e],te);if(at===null){Ae===null&&(Ae=Vt);break}e&&Ae&&at.alternate===null&&n(P,Ae),U=h(at,U,_e),We===null?Ne=at:We.sibling=at,We=at,Ae=Vt}if(_e===V.length)return i(P,Ae),Ve&&$r(P,_e),Ne;if(Ae===null){for(;_e<V.length;_e++)Ae=ne(P,V[_e],te),Ae!==null&&(U=h(Ae,U,_e),We===null?Ne=Ae:We.sibling=Ae,We=Ae);return Ve&&$r(P,_e),Ne}for(Ae=s(Ae);_e<V.length;_e++)Vt=G(Ae,P,_e,V[_e],te),Vt!==null&&(e&&(at=Vt.alternate,at!==null&&Ae.delete(at.key===null?_e:at.key)),U=h(Vt,U,_e),We===null?Ne=Vt:We.sibling=Vt,We=Vt);return e&&Ae.forEach(function(Ha){return n(P,Ha)}),Ve&&$r(P,_e),Ne}function ke(P,U,V,te){if(V==null)throw Error(l(151));for(var Ne=null,We=null,Ae=U,_e=U=0,Vt=null,at=V.next();Ae!==null&&!at.done;_e++,at=V.next()){Ae.index>_e?(Vt=Ae,Ae=null):Vt=Ae.sibling;var Ha=B(P,Ae,at.value,te);if(Ha===null){Ae===null&&(Ae=Vt);break}e&&Ae&&Ha.alternate===null&&n(P,Ae),U=h(Ha,U,_e),We===null?Ne=Ha:We.sibling=Ha,We=Ha,Ae=Vt}if(at.done)return i(P,Ae),Ve&&$r(P,_e),Ne;if(Ae===null){for(;!at.done;_e++,at=V.next())at=ne(P,at.value,te),at!==null&&(U=h(at,U,_e),We===null?Ne=at:We.sibling=at,We=at);return Ve&&$r(P,_e),Ne}for(Ae=s(Ae);!at.done;_e++,at=V.next())at=G(Ae,P,_e,at.value,te),at!==null&&(e&&(Vt=at.alternate,Vt!==null&&Ae.delete(Vt.key===null?_e:Vt.key)),U=h(at,U,_e),We===null?Ne=at:We.sibling=at,We=at);return e&&Ae.forEach(function(MC){return n(P,MC)}),Ve&&$r(P,_e),Ne}function Fe(P,U,V,te){if(typeof V=="object"&&V!==null&&V.type===le&&V.key===null&&V.props.ref===void 0&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case W:e:{for(var Ne=V.key;U!==null;){if(U.key===Ne){if(Ne=V.type,Ne===le){if(U.tag===7){i(P,U.sibling),te=f(U,V.props.children),va(te,V),te.return=P,P=te;break e}}else if(U.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===O&&mi(Ne)===U.type){i(P,U.sibling),te=f(U,V.props),va(te,V),te.return=P,P=te;break e}i(P,U);break}else n(P,U);U=U.sibling}V.type===le?(te=si(V.props.children,P.mode,te,V.key),va(te,V),te.return=P,P=te):(te=pu(V.type,V.key,V.props,null,P.mode,te),va(te,V),te.return=P,P=te)}return v(P);case z:e:{for(Ne=V.key;U!==null;){if(U.key===Ne)if(U.tag===4&&U.stateNode.containerInfo===V.containerInfo&&U.stateNode.implementation===V.implementation){i(P,U.sibling),te=f(U,V.children||[]),te.return=P,P=te;break e}else{i(P,U);break}else n(P,U);U=U.sibling}te=qd(V,P.mode,te),te.return=P,P=te}return v(P);case O:return V=mi(V),Fe(P,U,V,te)}if(Le(V))return pe(P,U,V,te);if(xe(V)){if(Ne=xe(V),typeof Ne!="function")throw Error(l(150));return V=Ne.call(V),ke(P,U,V,te)}if(typeof V.then=="function")return Fe(P,U,ku(V),te);if(V.$$typeof===re)return Fe(P,U,wu(P,V),te);ju(P,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,U!==null&&U.tag===6?(i(P,U.sibling),te=f(U,V),te.return=P,P=te):(i(P,U),te=Ud(V,P.mode,te),te.return=P,P=te),v(P)):i(P,U)}return function(P,U,V,te){try{Es=0;var Ne=Fe(P,U,V,te);return cl=null,Ne}catch(Ae){if(Ae===ul||Ae===Nu)throw Ae;var We=Tn(29,Ae,null,P.mode);return We.lanes=te,We.return=P,We}finally{}}}var gi=fy(!0),hy=fy(!1),wa=!1;function Kd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Sa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Na(e,n,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(dt&2)!==0){var f=s.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),s.pending=n,n=mu(e),$g(e,null,i),n}return hu(e,s,n,i),mu(e)}function Ts(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,i|=s,n.lanes=i,eg(e,i)}}function $d(e,n){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var f=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var v={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};h===null?f=h=v:h=h.next=v,i=i.next}while(i!==null);h===null?f=h=n:h=h.next=n}else f=h=n;i={baseState:s.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:s.shared,callbacks:s.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Zd=!1;function As(){if(Zd){var e=ol;if(e!==null)throw e}}function Os(e,n,i,s){Zd=!1;var f=e.updateQueue;wa=!1;var h=f.firstBaseUpdate,v=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var R=N,Y=R.next;R.next=null,v===null?h=Y:v.next=Y,v=R;var X=e.alternate;X!==null&&(X=X.updateQueue,N=X.lastBaseUpdate,N!==v&&(N===null?X.firstBaseUpdate=Y:N.next=Y,X.lastBaseUpdate=R))}if(h!==null){var ne=f.baseState;v=0,X=Y=R=null,N=h;do{var B=N.lane&-536870913,G=B!==N.lane;if(G?(Je&B)===B:(s&B)===B){B!==0&&B===fi&&(Zd=!0),X!==null&&(X=X.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var pe=e,ke=N;B=n;var Fe=i;switch(ke.tag){case 1:if(pe=ke.payload,typeof pe=="function"){ne=pe.call(Fe,ne,B);break e}ne=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=ke.payload,B=typeof pe=="function"?pe.call(Fe,ne,B):pe,B==null)break e;ne=L({},ne,B);break e;case 2:wa=!0}}B=N.callback,B!==null&&(e.flags|=64,G&&(e.flags|=8192),G=f.callbacks,G===null?f.callbacks=[B]:G.push(B))}else G={lane:B,tag:N.tag,payload:N.payload,callback:N.callback,next:null},X===null?(Y=X=G,R=ne):X=X.next=G,v|=B;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;G=N,N=G.next,G.next=null,f.lastBaseUpdate=G,f.shared.pending=null}}while(!0);X===null&&(R=ne),f.baseState=R,f.firstBaseUpdate=Y,f.lastBaseUpdate=X,h===null&&(f.shared.lanes=0),Oa|=v,e.lanes=v,e.memoizedState=ne}}function my(e,n){if(typeof e!="function")throw Error(l(191,e));e.call(n)}function py(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)my(i[e],n)}var Ca=He(null),Eu=He(0);function gy(e,n){e=ra,Qe(Eu,e),Qe(Ca,n),ra=e|n.baseLanes}function Jd(){Qe(Eu,ra),Qe(Ca,Ca.current)}function Wd(){ra=Eu.current,rt(Ca),rt(Eu)}var ln=He(null),hn=null;function ka(e){var n=e.alternate;Qe(sn,sn.current&1),Qe(ln,e),hn===null&&(n===null||Ca.current!==null||n.memoizedState!==null)&&(hn=e)}function ef(e){Qe(sn,sn.current),Qe(ln,e),hn===null&&(hn=e)}function yy(e){e.tag===22?(Qe(sn,sn.current),Qe(ln,e),hn===null&&(hn=e)):ja()}function ja(){Qe(sn,sn.current),Qe(ln,ln.current)}function Fn(e){rt(ln),hn===e&&(hn=null),rt(sn)}var sn=He(0);function Rs(e,n){Qe(ln,ln.current),Qe(sn,n)}function tf(e){rt(sn),rt(ln),hn===e&&(hn=null)}function Tu(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Ch(i)||kh(i)))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!=="independent"){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Wr=0,Ie=null,vt=null,Qt=null,Au=!1,dl=!1,yi=!1,Ou=0,Ms=0,fl=null,WN=0;function Ut(){throw Error(l(321))}function nf(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!In(e[i],n[i]))return!1;return!0}function rf(e,n,i,s,f,h){return Wr=h,Ie=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,ye.H=e===null||e.memoizedState===null?ex:tx,yi=!1,h=i(s,f),yi=!1,dl&&(h=by(n,i,s,f)),xy(e),h}function xy(e){ye.H=Uu;var n=vt!==null&&vt.next!==null;if(Wr=0,Qt=vt=Ie=null,Au=!1,Ms=0,fl=null,n)throw Error(l(300));e===null||Yt||(e=e.dependencies,e!==null&&vu(e)&&(Yt=!0))}function by(e,n,i,s){Ie=e;var f=0;do{if(dl&&(fl=null),Ms=0,dl=!1,25<=f)throw Error(l(301));if(f+=1,Qt=vt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}ye.H=s2,h=n(i,s)}while(dl);return h}function e2(){var e=ye.H,n=e.useState()[0];return n=typeof n.then=="function"?zs(n):n,e=e.useState()[0],(vt!==null?vt.memoizedState:null)!==e&&(Ie.flags|=1024),n}function af(){var e=Ou!==0;return Ou=0,e}function lf(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function sf(e){if(Au){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Au=!1}Wr=0,Qt=vt=Ie=null,dl=!1,Ms=Ou=0,fl=null}function xn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Ie.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Bt(){if(vt===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var n=Qt===null?Ie.memoizedState:Qt.next;if(n!==null)Qt=n,vt=e;else{if(e===null)throw Ie.alternate===null?Error(l(467)):Error(l(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Qt===null?Ie.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function Ru(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zs(e){var n=Ms;return Ms+=1,fl===null&&(fl=[]),e=uy(fl,e,n),n=Ie,(Qt===null?n.memoizedState:Qt.next)===null&&(n=n.alternate,ye.H=n===null||n.memoizedState===null?ex:tx),e}function Mu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zs(e);if(e.$$typeof===ae)return;if(e.$$typeof===re)return an(e)}throw Error(l(438,String(e)))}function of(e){var n=null,i=Ie.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var s=Ie.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),i===null&&(i=Ru(),Ie.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),s=0;s<e;s++)i[s]=_;return n.index++,i}function ea(e,n){return typeof n=="function"?n(e):n}function zu(e){var n=Bt();return uf(n,vt,e)}function uf(e,n,i){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=i;var f=e.baseQueue,h=s.pending;if(h!==null){if(f!==null){var v=f.next;f.next=h.next,h.next=v}n.baseQueue=f=h,s.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var N=v=null,R=null,Y=n,X=!1;do{var ne=Y.lane&-536870913;if(ne!==Y.lane?(Je&ne)===ne:(Wr&ne)===ne){var B=Y.revertLane;if(B===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ne===fi&&(X=!0);else if((Wr&B)===B){Y=Y.next,B===fi&&(X=!0);continue}else ne={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},R===null?(N=R=ne,v=h):R=R.next=ne,Ie.lanes|=B,Oa|=B;ne=Y.action,yi&&i(h,ne),h=Y.hasEagerState?Y.eagerState:i(h,ne)}else B={lane:ne,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},R===null?(N=R=B,v=h):R=R.next=B,Ie.lanes|=ne,Oa|=ne;Y=Y.next}while(Y!==null&&Y!==n);if(R===null?v=h:R.next=N,!In(h,e.memoizedState)&&(Yt=!0,X&&(i=ol,i!==null)))throw i;e.memoizedState=h,e.baseState=v,e.baseQueue=R,s.lastRenderedState=h}return f===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function cf(e){var n=Bt(),i=n.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=e;var s=i.dispatch,f=i.pending,h=n.memoizedState;if(f!==null){i.pending=null;var v=f=f.next;do h=e(h,v.action),v=v.next;while(v!==f);In(h,n.memoizedState)||(Yt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,s]}function vy(e,n,i){var s=Ie,f=Bt(),h=Ve;if(h){if(i===void 0)throw Error(l(407));i=i()}else i=n();var v=!In((vt||f).memoizedState,i);if(v&&(f.memoizedState=i,Yt=!0),f=f.queue,hf(Ny.bind(null,s,f,e),[e]),e=f.getSnapshot!==n||v||Qt!==null&&(Qt.memoizedState.tag&1)!==0,hl(e?9:8,{destroy:void 0},Sy.bind(null,s,f,i,n),null),e){if(s.flags|=2048,wt===null)throw Error(l(349));h||(Wr&127)!==0||wy(s,n,i)}return i}function wy(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Ie.updateQueue,n===null?(n=Ru(),Ie.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Sy(e,n,i,s){n.value=i,n.getSnapshot=s,Cy(n)&&ky(e)}function Ny(e,n,i){return i(function(){Cy(n)&&ky(e)})}function Cy(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!In(e,i)}catch{return!0}}function ky(e){var n=li(e,2);n!==null&&Mn(n,e,2)}function df(e){var n=xn();if(typeof e=="function"){var i=e;if(e=i(),yi){ha(!0);try{i()}finally{ha(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},n}function jy(e,n,i,s){return e.baseState=i,uf(e,vt,typeof s=="function"?s:ea)}function t2(e,n,i,s,f){if(Lu(e))throw Error(l(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){h.listeners.push(v)}};ye.T!==null?i(!0):h.isTransition=!1,s(h),i=n.pending,i===null?(h.next=n.pending=h,Ey(n,h)):(h.next=i.next,n.pending=i.next=h)}}function Ey(e,n){var i=n.action,s=n.payload,f=e.state;if(n.isTransition){var h=ye.T,v={};v.types=h!==null?h.types:null,ye.T=v;try{var N=i(f,s),R=ye.S;R!==null&&R(v,N),Ty(e,n,N)}catch(Y){ff(e,n,Y)}finally{h!==null&&v.types!==null&&(h.types=v.types),ye.T=h}}else try{h=i(f,s),Ty(e,n,h)}catch(Y){ff(e,n,Y)}}function Ty(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){Ay(e,n,s)},function(s){return ff(e,n,s)}):Ay(e,n,i)}function Ay(e,n,i){n.status="fulfilled",n.value=i,Oy(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,Ey(e,i)))}function ff(e,n,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=i,Oy(n),n=n.next;while(n!==s)}e.action=null}function Oy(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ry(e,n){return n}function My(e,n){if(Ve){var i=wt.formState;if(i!==null){e:{var s=Ie;if(Ve){if(kt){t:{for(var f=kt,h=ar;f.nodeType!==8;){if(!h){f=null;break t}if(f=lr(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){kt=lr(f.nextSibling),s=f.data==="F!";break e}}xa(s)}s=!1}s&&(n=i[0])}}return i=xn(),i.memoizedState=i.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ry,lastRenderedState:n},i.queue=s,i=Zy.bind(null,Ie,s),s.dispatch=i,s=df(!1),h=xf.bind(null,Ie,!1,s.queue),s=xn(),f={state:n,dispatch:null,action:e,pending:null},s.queue=f,i=t2.bind(null,Ie,f,h,i),f.dispatch=i,s.memoizedState=e,[n,i,!1]}function zy(e){var n=Bt();return Dy(n,vt,e)}function Dy(e,n,i){if(n=uf(e,n,Ry)[0],e=zu(ea)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=zs(n)}catch(v){throw v===ul?Nu:v}else s=n;n=Bt();var f=n.queue,h=f.dispatch;return i!==n.memoizedState&&(Ie.flags|=2048,hl(9,{destroy:void 0},n2.bind(null,f,i),null)),[s,h,e]}function n2(e,n){e.action=n}function _y(e){var n=Bt(),i=vt;if(i!==null)return Dy(n,i,e);Bt(),n=n.memoizedState,i=Bt();var s=i.queue.dispatch;return i.memoizedState=e,[n,s,!1]}function hl(e,n,i,s){return e={tag:e,create:i,deps:s,inst:n,next:null},n=Ie.updateQueue,n===null&&(n=Ru(),Ie.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,n.lastEffect=e),e}function Ly(){return Bt().memoizedState}function Du(e,n,i,s){var f=xn();Ie.flags|=e,f.memoizedState=hl(1|n,{destroy:void 0},i,s===void 0?null:s)}function _u(e,n,i,s){var f=Bt();s=s===void 0?null:s;var h=f.memoizedState.inst;vt!==null&&s!==null&&nf(s,vt.memoizedState.deps)?f.memoizedState=hl(n,h,i,s):(Ie.flags|=e,f.memoizedState=hl(1|n,h,i,s))}function Uy(e,n){Du(8390656,8,e,n)}function hf(e,n){_u(2048,8,e,n)}function r2(e){Ie.flags|=4;var n=Ie.updateQueue;if(n===null)n=Ru(),Ie.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function qy(e){var n=Bt().memoizedState;return r2({ref:n,nextImpl:e}),function(){if((dt&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function Hy(e,n){return _u(4,2,e,n)}function By(e,n){return _u(4,4,e,n)}function Iy(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Fy(e,n,i){i=i!=null?i.concat([e]):null,_u(4,4,Iy.bind(null,n,e),i)}function mf(){}function Py(e,n){var i=Bt();n=n===void 0?null:n;var s=i.memoizedState;return n!==null&&nf(n,s[1])?s[0]:(i.memoizedState=[e,n],e)}function Qy(e,n){var i=Bt();n=n===void 0?null:n;var s=i.memoizedState;if(n!==null&&nf(n,s[1]))return s[0];if(s=e(),yi){ha(!0);try{e()}finally{ha(!1)}}return i.memoizedState=[s,n],s}function pf(e,n,i){return i===void 0||(Wr&1073741824)!==0&&(Je&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=eb(),Ie.lanes|=e,Oa|=e,i)}function Yy(e,n,i,s){return In(i,n)?i:Ca.current!==null?(e=pf(e,i,s),In(e,n)||(Yt=!0),e):(Wr&106)===0||(Wr&1073741824)!==0&&(Je&261930)===0?(Yt=!0,e.memoizedState=i):(e=eb(),Ie.lanes|=e,Oa|=e,n)}function Vy(e,n,i,s,f){var h=je.p;je.p=h!==0&&8>h?h:8;var v=ye.T,N={};N.types=v!==null?v.types:null,ye.T=N,xf(e,!1,n,i);try{var R=f(),Y=ye.S;if(Y!==null&&Y(N,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var X=JN(R,s);Ds(e,n,X,Vn(e))}else Ds(e,n,s,Vn(e))}catch(ne){Ds(e,n,{then:function(){},status:"rejected",reason:ne},Vn())}finally{je.p=h,v!==null&&N.types!==null&&(v.types=N.types),ye.T=v}}function a2(){}function gf(e,n,i,s){if(e.tag!==5)throw Error(l(476));var f=Gy(e).queue;Vy(e,f,n,Tt,i===null?a2:function(){return Ky(e),i(s)})}function Gy(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:Tt,baseState:Tt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:Tt},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Ky(e){var n=Gy(e);n.next===null&&(n=e.alternate.memoizedState),Ds(e,n.next.queue,{},Vn())}function yf(){return an(Ml)}function Xy(){return Bt().memoizedState}function $y(){return Bt().memoizedState}function i2(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Vn();e=Sa(i);var s=Na(n,e,i);s!==null&&(Mn(s,n,i),Ts(s,n,i)),n={cache:Qd()},e.payload=n;return}n=n.return}}function l2(e,n,i){var s=Vn();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Lu(e)?Jy(n,i):(i=_d(e,n,i,s),i!==null&&(Mn(i,e,s),Wy(i,n,s)))}function Zy(e,n,i){var s=Vn();Ds(e,n,i,s)}function Ds(e,n,i,s){var f={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Lu(e))Jy(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var v=n.lastRenderedState,N=h(v,i);if(f.hasEagerState=!0,f.eagerState=N,In(N,v))return hu(e,n,f,0),wt===null&&fu(),!1}catch{}finally{}if(i=_d(e,n,f,s),i!==null)return Mn(i,e,s),Wy(i,n,s),!0}return!1}function xf(e,n,i,s){if(s={lane:2,revertLane:oh(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Lu(e)){if(n)throw Error(l(479))}else n=_d(e,i,s,2),n!==null&&Mn(n,e,2)}function Lu(e){var n=e.alternate;return e===Ie||n!==null&&n===Ie}function Jy(e,n){dl=Au=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Wy(e,n,i){if((i&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,i|=s,n.lanes=i,eg(e,i)}}var Uu={readContext:an,use:Mu,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useLayoutEffect:Ut,useInsertionEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useSyncExternalStore:Ut,useId:Ut,useHostTransitionStatus:Ut,useFormState:Ut,useActionState:Ut,useOptimistic:Ut,useMemoCache:Ut,useCacheRefresh:Ut,useEffectEvent:Ut},ex={readContext:an,use:Mu,useCallback:function(e,n){return xn().memoizedState=[e,n===void 0?null:n],e},useContext:an,useEffect:Uy,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Du(4194308,4,Iy.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Du(4194308,4,e,n)},useInsertionEffect:function(e,n){Du(4,2,e,n)},useMemo:function(e,n){var i=xn();n=n===void 0?null:n;var s=e();if(yi){ha(!0);try{e()}finally{ha(!1)}}return i.memoizedState=[s,n],s},useReducer:function(e,n,i){var s=xn();if(i!==void 0){var f=i(n);if(yi){ha(!0);try{i(n)}finally{ha(!1)}}}else f=n;return s.memoizedState=s.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},s.queue=e,e=e.dispatch=l2.bind(null,Ie,e),[s.memoizedState,e]},useRef:function(e){var n=xn();return e={current:e},n.memoizedState=e},useState:function(e){e=df(e);var n=e.queue,i=Zy.bind(null,Ie,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:mf,useDeferredValue:function(e,n){var i=xn();return pf(i,e,n)},useTransition:function(){var e=df(!1);return e=Vy.bind(null,Ie,e.queue,!0,!1),xn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var s=Ie,f=xn();if(Ve){if(i===void 0)throw Error(l(407));i=i()}else{if(i=n(),wt===null)throw Error(l(349));(Je&127)!==0||wy(s,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,Uy(Ny.bind(null,s,h,e),[e]),s.flags|=2048,hl(9,{destroy:void 0},Sy.bind(null,s,h,i,n),null),i},useId:function(){var e=xn(),n=wt.identifierPrefix;if(Ve){var i=Ar,s=Tr;i=(s&~(1<<32-Hn(s)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Ou++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=WN++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:yf,useFormState:My,useActionState:My,useOptimistic:function(e){var n=xn();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=xf.bind(null,Ie,!0,i),i.dispatch=n,[e,n]},useMemoCache:of,useCacheRefresh:function(){return xn().memoizedState=i2.bind(null,Ie)},useEffectEvent:function(e){var n=xn(),i={impl:e};return n.memoizedState=i,function(){if((dt&2)!==0)throw Error(l(440));return i.impl.apply(void 0,arguments)}}},tx={readContext:an,use:Mu,useCallback:Py,useContext:an,useEffect:hf,useImperativeHandle:Fy,useInsertionEffect:Hy,useLayoutEffect:By,useMemo:Qy,useReducer:zu,useRef:Ly,useState:function(){return zu(ea)},useDebugValue:mf,useDeferredValue:function(e,n){var i=Bt();return Yy(i,vt.memoizedState,e,n)},useTransition:function(){var e=zu(ea)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:zs(e),n]},useSyncExternalStore:vy,useId:Xy,useHostTransitionStatus:yf,useFormState:zy,useActionState:zy,useOptimistic:function(e,n){var i=Bt();return jy(i,vt,e,n)},useMemoCache:of,useCacheRefresh:$y,useEffectEvent:qy},s2={readContext:an,use:Mu,useCallback:Py,useContext:an,useEffect:hf,useImperativeHandle:Fy,useInsertionEffect:Hy,useLayoutEffect:By,useMemo:Qy,useReducer:cf,useRef:Ly,useState:function(){return cf(ea)},useDebugValue:mf,useDeferredValue:function(e,n){var i=Bt();return vt===null?pf(i,e,n):Yy(i,vt.memoizedState,e,n)},useTransition:function(){var e=cf(ea)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:zs(e),n]},useSyncExternalStore:vy,useId:Xy,useHostTransitionStatus:yf,useFormState:_y,useActionState:_y,useOptimistic:function(e,n){var i=Bt();return vt!==null?jy(i,vt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:of,useCacheRefresh:$y,useEffectEvent:qy};function bf(e,n,i,s){n=e.memoizedState,i=i(s,n),i=i==null?n:L({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var vf={enqueueSetState:function(e,n,i){e=e._reactInternals;var s=Vn(),f=Sa(s);f.payload=n,i!=null&&(f.callback=i),n=Na(e,f,s),n!==null&&(Mn(n,e,s),Ts(n,e,s))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var s=Vn(),f=Sa(s);f.tag=1,f.payload=n,i!=null&&(f.callback=i),n=Na(e,f,s),n!==null&&(Mn(n,e,s),Ts(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Vn(),s=Sa(i);s.tag=2,n!=null&&(s.callback=n),n=Na(e,s,i),n!==null&&(Mn(n,e,i),Ts(n,e,i))}};function nx(e,n,i,s,f,h,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,h,v):n.prototype&&n.prototype.isPureReactComponent?!vs(i,s)||!vs(f,h):!0}function rx(e,n,i,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,s),n.state!==e&&vf.enqueueReplaceState(n,n.state,null)}function xi(e,n){var i=n;if("ref"in n){i={};for(var s in n)s!=="ref"&&(i[s]=n[s])}if(e=e.defaultProps){i===n&&(i=L({},i));for(var f in e)i[f]===void 0&&(i[f]=e[f])}return i}function ax(e){du(e)}function ix(e){console.error(e)}function lx(e){du(e)}function qu(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function sx(e,n,i){try{var s=e.onCaughtError;s(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function wf(e,n,i){return i=Sa(i),i.tag=3,i.payload={element:null},i.callback=function(){qu(e,n)},i}function ox(e){return e=Sa(e),e.tag=3,e}function ux(e,n,i,s){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var h=s.value;e.payload=function(){return f(h)},e.callback=function(){sx(n,i,s)}}var v=i.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){sx(n,i,s),typeof f!="function"&&(Ra===null?Ra=new Set([this]):Ra.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function o2(e,n,i,s,f){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=i.alternate,n!==null&&ci(n,i,f,!0),i=ln.current,i!==null){switch(i.tag){case 31:case 13:case 19:return hn===null?ic():i.alternate===null&&qt===0&&(qt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,s===Cu?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([s]):n.add(s),ih(e,s,f)),!1;case 22:return i.flags|=65536,s===Cu?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([s]):i.add(s)),ih(e,s,f)),!1}throw Error(l(435,i.tag))}return ih(e,s,f),ic(),!1}if(Ve)return n=ln.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,s!==Bd&&(e=Error(l(422),{cause:s}),Ns(tr(e,i)))):(s!==Bd&&(n=Error(l(423),{cause:s}),Ns(tr(n,i))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,s=tr(s,i),f=wf(e.stateNode,s,f),$d(e,f),qt!==4&&(qt=2)),!1;var h=Error(l(520),{cause:s});if(h=tr(h,i),Fs===null?Fs=[h]:Fs.push(h),qt!==4&&(qt=2),n===null)return!0;s=tr(s,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=f&-f,i.lanes|=e,e=wf(i.stateNode,s,e),$d(i,e),!1;case 1:if(n=i.type,h=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ra===null||!Ra.has(h))))return i.flags|=65536,f&=-f,i.lanes|=f,f=ox(f),ux(f,e,i,s),$d(i,f),!1;break;case 22:if(i.memoizedState!==null)return i.flags|=65536,!1}i=i.return}while(i!==null);return!1}var Sf=Error(l(461)),Yt=!1;function Xt(e,n,i,s){n.child=e===null?hy(n,null,i,s):gi(n,e.child,i,s)}function cx(e,n,i,s,f){i=i.render;var h=n.ref;if("ref"in s){var v={};for(var N in s)N!=="ref"&&(v[N]=s[N])}else v=s;return di(n),s=rf(e,n,i,v,h,f),N=af(),e!==null&&!Yt?(lf(e,n,f),ta(e,n,f)):(Ve&&N&&yu(n),n.flags|=1,Xt(e,n,s,f),n.child)}function dx(e,n,i,s,f){if(e===null){var h=i.type;return typeof h=="function"&&!Ld(h)&&h.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=h,fx(e,n,h,s,f)):(e=pu(i.type,null,s,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Of(e,f)){var v=h.memoizedProps;if(i=i.compare,i=i!==null?i:vs,i(v,s)&&e.ref===n.ref)return ta(e,n,f)}return n.flags|=1,e=Xr(h,s),e.ref=n.ref,e.return=n,n.child=e}function fx(e,n,i,s,f){if(e!==null){var h=e.memoizedProps;if(vs(h,s)&&e.ref===n.ref)if(Yt=!1,n.pendingProps=s=h,Of(e,f))(e.flags&131072)!==0&&(Yt=!0);else return n.lanes=e.lanes,ta(e,n,f)}return Nf(e,n,i,s,f)}function hx(e,n,i,s){var f=s.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|i:i,e!==null){for(s=n.child=e.child,f=0;s!==null;)f=f|s.lanes|s.childLanes,s=s.sibling;s=f&~h}else s=0,n.child=null;return mx(e,n,h,i,s)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Su(n,h!==null?h.cachePool:null),h!==null?gy(n,h):Jd(),yy(n);else return s=n.lanes=536870912,mx(e,n,h!==null?h.baseLanes|i:i,i,s)}else h!==null?(Su(n,h.cachePool),gy(n,h),ja(),n.memoizedState=null):(e!==null&&Su(n,null),Jd(),ja());return Xt(e,n,f,i),n.child}function _s(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function mx(e,n,i,s,f){var h=Vd();return h=h===null?null:{parent:Pt._currentValue,pool:h},n.memoizedState={baseLanes:i,cachePool:h},e!==null&&Su(n,null),Jd(),yy(n),e!==null&&ci(e,n,s,!0),n.childLanes=f,null}function Hu(e,n){return n=Bu({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function px(e,n,i){return gi(n,e.child,null,i),e=Hu(n,n.pendingProps),e.flags|=2,Fn(n),n.memoizedState=null,e}function u2(e,n,i){var s=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ve){if(s.mode==="hidden")return e=Hu(n,s),n.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},_s(null,e);if(ef(n),(e=kt)?(e=Ib(e,ar),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ga!==null?{id:Tr,overflow:Ar}:null,retryLane:536870912,hydrationErrors:null},i=Jg(e),i.return=n,n.child=i,Wt=n,kt=null)):e=null,e===null)throw xa(n);return n.lanes=536870912,null}return Hu(n,s)}var h=e.memoizedState;if(h!==null){var v=h.dehydrated;if(ef(n),f)if(n.flags&256)n.flags&=-257,n=px(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(l(558));else if(Yt||ci(e,n,i,!1),f=(i&e.childLanes)!==0,Yt||f){if(Ca.current===null){if(s=wt,s!==null&&(v=tg(s,i),v!==0&&v!==h.retryLane))throw h.retryLane=v,li(e,v),Mn(s,e,v),Sf;ic()}n=px(e,n,i)}else e=h.treeContext,kt=lr(v.nextSibling),Wt=n,Ve=!0,ya=null,ar=!1,e!==null&&ty(n,e),n=Hu(n,s),n.flags|=134221824;return n}return e=Xr(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function ml(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(l(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function Nf(e,n,i,s,f){return di(n),i=rf(e,n,i,s,void 0,f),s=af(),e!==null&&!Yt?(lf(e,n,f),ta(e,n,f)):(Ve&&s&&yu(n),n.flags|=1,Xt(e,n,i,f),n.child)}function gx(e,n,i,s,f,h){return di(n),n.updateQueue=null,i=by(n,s,i,f),xy(e),s=af(),e!==null&&!Yt?(lf(e,n,h),ta(e,n,h)):(Ve&&s&&yu(n),n.flags|=1,Xt(e,n,i,h),n.child)}function yx(e,n,i,s,f){if(di(n),n.stateNode===null){var h=al,v=i.contextType;typeof v=="object"&&v!==null&&(h=an(v)),h=new i(s,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=vf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=s,h.state=n.memoizedState,h.refs={},Kd(n),v=i.contextType,h.context=typeof v=="object"&&v!==null?an(v):al,h.state=n.memoizedState,v=i.getDerivedStateFromProps,typeof v=="function"&&(bf(n,i,v,s),h.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(v=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),v!==h.state&&vf.enqueueReplaceState(h,h.state,null),Os(n,s,h,f),As(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){h=n.stateNode;var N=n.memoizedProps,R=xi(i,N);h.props=R;var Y=h.context,X=i.contextType;v=al,typeof X=="object"&&X!==null&&(v=an(X));var ne=i.getDerivedStateFromProps;X=typeof ne=="function"||typeof h.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,X||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(N||Y!==v)&&rx(n,h,s,v),wa=!1;var B=n.memoizedState;h.state=B,Os(n,s,h,f),As(),Y=n.memoizedState,N||B!==Y||wa?(typeof ne=="function"&&(bf(n,i,ne,s),Y=n.memoizedState),(R=wa||nx(n,i,R,s,B,Y,v))?(X||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=Y),h.props=s,h.state=Y,h.context=v,s=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{h=n.stateNode,Xd(e,n),v=n.memoizedProps,X=xi(i,v),h.props=X,ne=n.pendingProps,B=h.context,Y=i.contextType,R=al,typeof Y=="object"&&Y!==null&&(R=an(Y)),N=i.getDerivedStateFromProps,(Y=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==ne||B!==R)&&rx(n,h,s,R),wa=!1,B=n.memoizedState,h.state=B,Os(n,s,h,f),As();var G=n.memoizedState;v!==ne||B!==G||wa||e!==null&&e.dependencies!==null&&vu(e.dependencies)?(typeof N=="function"&&(bf(n,i,N,s),G=n.memoizedState),(X=wa||nx(n,i,X,s,B,G,R)||e!==null&&e.dependencies!==null&&vu(e.dependencies))?(Y||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(s,G,R),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(s,G,R)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&B===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&B===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=G),h.props=s,h.state=G,h.context=R,s=X):(typeof h.componentDidUpdate!="function"||v===e.memoizedProps&&B===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&B===e.memoizedState||(n.flags|=1024),s=!1)}return h=s,ml(e,n),s=(n.flags&128)!==0,h||s?(h=n.stateNode,i=s&&typeof i.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&s?(n.child=gi(n,e.child,null,f),n.child=gi(n,null,i,f)):Xt(e,n,i,f),n.memoizedState=h.state,e=n.child):e=ta(e,n,f),e}function xx(e,n,i,s){return oi(),n.flags|=256,Xt(e,n,i,s),n.child}var Cf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function kf(e){return{baseLanes:e,cachePool:sy()}}function jf(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=Yn),e}function bx(e,n,i){var s=n.pendingProps,f=!1,h=(n.flags&128)!==0,v;if((v=h)||(v=e!==null&&e.memoizedState===null?!1:(sn.current&2)!==0),v&&(f=!0,n.flags&=-129),v=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ve){if(f?ka(n):ja(),(e=kt)?(e=Ib(e,ar),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ga!==null?{id:Tr,overflow:Ar}:null,retryLane:536870912,hydrationErrors:null},i=Jg(e),i.return=n,n.child=i,Wt=n,kt=null)):e=null,e===null)throw xa(n);return kh(e)?n.lanes=32:n.lanes=536870912,null}return h=s.children,s=s.fallback,f?(ja(),f=n.mode,h=Bu({mode:"hidden",children:h},f),s=si(s,f,i,null),h.return=n,s.return=n,h.sibling=s,n.child=h,s=n.child,s.memoizedState=kf(i),s.childLanes=jf(e,v,i),n.memoizedState=Cf,_s(null,s)):(ka(n),Ef(n,h))}var N=e.memoizedState;if(N!==null){var R=N.dehydrated;if(R!==null)return c2(e,n,h,v,s,R,N,i)}return f?(ja(),f=s.fallback,h=n.mode,N=e.child,R=N.sibling,s=Xr(N,{mode:"hidden",children:s.children}),s.subtreeFlags=N.subtreeFlags&1206910976,R!==null?f=Xr(R,f):(f=si(f,h,i,null),f.flags|=2),f.return=n,s.return=n,s.sibling=f,n.child=s,_s(null,s),s=n.child,f=e.child.memoizedState,f===null?f=kf(i):(h=f.cachePool,h!==null?(N=Pt._currentValue,h=h.parent!==N?{parent:N,pool:N}:h):h=sy(),f={baseLanes:f.baseLanes|i,cachePool:h}),s.memoizedState=f,s.childLanes=jf(e,v,i),n.memoizedState=Cf,_s(e.child,s)):(ka(n),i=e.child,e=i.sibling,i=Xr(i,{mode:"visible",children:s.children}),i.return=n,i.sibling=null,e!==null&&(v=n.deletions,v===null?(n.deletions=[e],n.flags|=16):v.push(e)),n.child=i,n.memoizedState=null,i)}function Ef(e,n){return n=Bu({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Bu(e,n){return e=Tn(22,e,null,n),e.lanes=0,e}function Iu(e,n,i){return gi(n,e.child,null,i),e=Ef(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function c2(e,n,i,s,f,h,v,N){if(i)return n.flags&256?(ka(n),n.flags&=-257,Iu(e,n,N)):n.memoizedState!==null?(ja(),n.child=e.child,n.flags|=128,null):(ja(),h=f.fallback,v=n.mode,f=Bu({mode:"visible",children:f.children},v),h=si(h,v,N,null),h.flags|=2,f.return=n,h.return=n,f.sibling=h,n.child=f,gi(n,e.child,null,N),f=n.child,f.memoizedState=kf(N),f.childLanes=jf(e,s,N),n.memoizedState=Cf,_s(null,f));if(ka(n),kh(h)){if(s=h.nextSibling&&h.nextSibling.dataset,s)var R=s.dgst;return s=R,s!==""&&(f=Error(l(419)),f.stack="",f.digest=s,Ns({value:f,source:null,stack:null})),Iu(e,n,N)}if(Yt||ci(e,n,N,!1),s=(N&e.childLanes)!==0,Yt||s){if(Ca.current!==null)return Iu(e,n,N);if(s=wt,s!==null&&(f=tg(s,N),f!==0&&f!==v.retryLane))throw v.retryLane=f,li(e,f),Mn(s,e,f),Sf;return Ch(h)||ic(),Iu(e,n,N)}return Ch(h)?(n.flags|=192,n.child=e.child,null):(e=v.treeContext,kt=lr(h.nextSibling),Wt=n,Ve=!0,ya=null,ar=!1,e!==null&&ty(n,e),n=Ef(n,f.children),n.flags|=134221824,n)}function vx(e,n,i){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),bu(e.return,n,i)}function wx(e){for(var n=null;e!==null;){var i=e.alternate;i!==null&&Tu(i)===null&&(n=e),e=e.sibling}return n}function Fu(e,n,i,s,f,h){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:f,treeForkCount:h}:(v.isBackwards=n,v.rendering=null,v.renderingStartTime=0,v.last=s,v.tail=i,v.tailMode=f,v.treeForkCount=h)}function Tf(e){var n=e.child;for(e.child=null;n!==null;){var i=n.sibling;n.sibling=e.child,e.child=n,n=i}}function Af(e,n,i){var s=n.pendingProps,f=s.revealOrder,h=s.tail;s=s.children;var v=sn.current;if(n.flags&128)return Rs(n,v),null;var N=(v&2)!==0;if(N?(v=v&1|2,n.flags|=128):v&=1,Rs(n,v),f==="backwards"&&e!==null?(Tf(e),Xt(e,n,s,i),Tf(e)):Xt(e,n,s,i),s=Ve?Ss:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vx(e,i,n);else if(e.tag===19)vx(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"backwards":i=wx(n.child),i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null,Tf(n)),Fu(n,!0,f,null,h,s);break;case"unstable_legacy-backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Tu(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}Fu(n,!0,i,null,h,s);break;case"together":Fu(n,!1,null,null,void 0,s);break;case"independent":n.memoizedState=null;break;default:i=wx(n.child),i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),Fu(n,!1,f,i,h,s)}return n.child}function Sx(e,n,i){var s=n.pendingProps;return ba(n,n.type,s.value),Xt(e,n,s.children,i),n.child}function ta(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Oa|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(ci(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(l(153));if(n.child!==null){for(e=n.child,i=Xr(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Xr(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function Of(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&vu(e)))}function d2(e,n,i){switch(n.tag){case 3:ge(n,n.stateNode.containerInfo),ba(n,Pt,e.memoizedState.cache),oi();break;case 27:case 5:It(n);break;case 4:ge(n,n.stateNode.containerInfo);break;case 10:ba(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,ef(n),null;break;case 13:var s=n.memoizedState;if(s!==null){if(s.dehydrated!==null)return ka(n),n.flags|=128,null;s=ci(e,n,i,!1);var f=n.child.childLanes;return s||(i&f)!==0?bx(e,n,i):(ka(n),e=ta(e,n,i),e!==null?e.sibling:null)}ka(n);break;case 19:if(n.flags&128)return Af(e,n,i);if(f=(e.flags&128)!==0,s=(i&n.childLanes)!==0,s||(ci(e,n,i,!1),s=(i&n.childLanes)!==0),f){if(s)return Af(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Rs(n,sn.current),s)break;return null;case 22:return n.lanes=0,hx(e,n,i,n.pendingProps);case 24:ba(n,Pt,e.memoizedState.cache)}return ta(e,n,i)}function Nx(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Yt=!0;else{if(!Of(e,i)&&(n.flags&128)===0)return Yt=!1,d2(e,n,i);Yt=(e.flags&131072)!==0}else Yt=!1,Ve&&(n.flags&1048576)!==0&&ey(n,Ss,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=mi(n.elementType),n.type=e,typeof e=="function")Ld(e)?(s=xi(e,s),n.tag=1,n=yx(null,n,e,s,i)):(n.tag=0,n=Nf(null,n,e,s,i));else{if(e!=null){var f=e.$$typeof;if(f===Z){n.tag=11,n=cx(null,n,e,s,i);break e}else if(f===Re){n.tag=14,n=dx(null,n,e,s,i);break e}else if(f===re){n.tag=10,n.type=e,n=Sx(null,n,i);break e}}throw n=Me(e)||e,Error(l(306,n,""))}}return n;case 0:return Nf(e,n,n.type,n.pendingProps,i);case 1:return s=n.type,f=xi(s,n.pendingProps),yx(e,n,s,f,i);case 3:e:{if(ge(n,n.stateNode.containerInfo),e===null)throw Error(l(387));s=n.pendingProps;var h=n.memoizedState;f=h.element,Xd(e,n),Os(n,s,null,i);var v=n.memoizedState;if(s=v.cache,ba(n,Pt,s),s!==h.cache&&Pd(n,[Pt],i,!0),As(),s=v.element,h.isDehydrated)if(h={element:s,isDehydrated:!1,cache:v.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=xx(e,n,s,i);break e}else if(s!==f){f=tr(Error(l(424)),n),Ns(f),n=xx(e,n,s,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(kt=lr(e.firstChild),Wt=n,Ve=!0,ya=null,ar=!0,i=hy(n,null,s,i),n.child=i;i;)i.flags=i.flags&-3|134221824,i=i.sibling}else{if(oi(),s===f){n=ta(e,n,i);break e}Xt(e,n,s,i)}n=n.child}return n;case 26:return ml(e,n),e===null?(i=Kb(n.type,null,n.pendingProps,null))?n.memoizedState=i:Ve||(n.stateNode=Eb(n.type,n.pendingProps,Ct.current,n)):n.memoizedState=Kb(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return It(n),e===null&&Ve&&(s=n.stateNode=Qb(n.type,n.pendingProps,Ct.current),Wt=n,ar=!0,f=kt,Da(n.type)?(jh=f,kt=lr(s.firstChild)):kt=f),Xt(e,n,n.pendingProps.children,i),ml(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ve&&((f=s=kt)&&(s=iC(s,n.type,n.pendingProps,ar),s!==null?(n.stateNode=s,Wt=n,kt=lr(s.firstChild),ar=!1,f=!0):f=!1),f||xa(n)),It(n),f=n.type,h=n.pendingProps,v=e!==null?e.memoizedProps:null,s=h.children,yh(f,h)?s=null:v!==null&&yh(f,v)&&(n.flags|=32),n.memoizedState!==null&&(f=rf(e,n,e2,null,null,i),Ml._currentValue=f),ml(e,n),Xt(e,n,s,i),n.child;case 6:return e===null&&Ve&&((e=i=kt)&&(i=lC(i,n.pendingProps,ar),i!==null?(n.stateNode=i,Wt=n,kt=null,e=!0):e=!1),e||xa(n)),null;case 13:return bx(e,n,i);case 4:return ge(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=gi(n,null,s,i):Xt(e,n,s,i),n.child;case 11:return cx(e,n,n.type,n.pendingProps,i);case 7:return s=n.pendingProps,ml(e,n),Xt(e,n,s,i),n.child;case 8:return Xt(e,n,n.pendingProps.children,i),n.child;case 12:return Xt(e,n,n.pendingProps.children,i),n.child;case 10:return Sx(e,n,i);case 9:return f=n.type._context,s=n.pendingProps.children,di(n),f=an(f),s=s(f),n.flags|=1,Xt(e,n,s,i),n.child;case 14:return dx(e,n,n.type,n.pendingProps,i);case 15:return fx(e,n,n.type,n.pendingProps,i);case 19:return Af(e,n,i);case 31:return u2(e,n,i);case 22:return hx(e,n,i,n.pendingProps);case 24:return di(n),s=an(Pt),e===null?(f=Vd(),f===null&&(f=wt,h=Qd(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=i),f=h),n.memoizedState={parent:s,cache:f},Kd(n),ba(n,Pt,f)):((e.lanes&i)!==0&&(Xd(e,n),Os(n,null,null,i),As()),f=e.memoizedState,h=n.memoizedState,f.parent!==s?(f={parent:s,cache:s},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),ba(n,Pt,s)):(s=h.cache,ba(n,Pt,s),s!==f.cache&&Pd(n,[Pt],i,!0))),Xt(e,n,n.pendingProps.children,i),n.child;case 30:return n.stateNode===null&&(n.stateNode={autoName:null,paired:null,clones:null,ref:null}),s=n.pendingProps,s.name!=null&&s.name!=="auto"?n.flags|=e===null?18882560:18874368:Ve&&yu(n),e!==null&&e.memoizedProps.name!==s.name?n.flags|=4194816:ml(e,n),Xt(e,n,s.children,i),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function na(e){e.flags|=4}function Rf(e,n,i,s,f){var h;if((h=(e.mode&32)!==0)&&(h=i===null?Jb(n,s):Jb(n,s)&&(s.src!==i.src||s.srcSet!==i.srcSet)),h){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(ab())e.flags|=8192;else throw pi=Cu,Gd}else e.flags&=-16777217}function Cx(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Wb(n))if(ab())e.flags|=8192;else throw pi=Cu,Gd}function Pu(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Jp():536870912,e.lanes|=n,bl|=n)}function Ls(e,n){if(!Ve)switch(e.tailMode){case"visible":break;case"collapsed":for(var i=e.tail,s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null;break;default:for(n=e.tail,i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null}}function jt(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(n)for(var f=e.child;f!==null;)i|=f.lanes|f.childLanes,s|=f.subtreeFlags&1206910976,s|=f.flags&1206910976,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)i|=f.lanes|f.childLanes,s|=f.subtreeFlags,s|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=s,e.childLanes=i,n}function f2(e,n,i){var s=n.pendingProps;switch(Hd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(n),null;case 1:return jt(n),null;case 3:return i=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Jr(Pt),oe(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(sl(n)?na(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Id())),jt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(na(n),h!==null?(jt(n),Cx(n,h)):(jt(n),Rf(n,f,null,s,i))):h?h!==e.memoizedState?(na(n),jt(n),Cx(n,h)):(jt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&na(n),jt(n),Rf(n,f,e,s,i)),null;case 27:if(J(n),i=Ct.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&na(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return jt(n),n.subtreeFlags&=-33554433,null}e=pt.current,sl(n)?ny(n):(e=Qb(f,s,i),n.stateNode=e,na(n))}return jt(n),n.subtreeFlags&=-33554433,null;case 5:if(J(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&na(n);else{if(!s){if(n.stateNode===null)throw Error(l(166));return jt(n),n.subtreeFlags&=-33554433,null}if(h=pt.current,sl(n))ny(n);else{var v=Gs(Ct.current);switch(h){case 1:h=v.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=v.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=v.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=v.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=v.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof s.is=="string"?v.createElement("select",{is:s.is}):v.createElement("select"),s.multiple?h.multiple=!0:s.size&&(h.size=s.size);break;default:h=typeof s.is=="string"?v.createElement(f,{is:s.is}):v.createElement(f)}}h[rn]=n,h[En]=s;e:for(v=n.child;v!==null;){if(v.tag===5||v.tag===6)h.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===n)break e;for(;v.sibling===null;){if(v.return===null||v.return===n)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}n.stateNode=h;e:switch(un(h,f,s),f){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&na(n)}}return jt(n),n.subtreeFlags&=-33554433,Rf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&na(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(l(166));if(e=Ct.current,sl(n)){if(e=n.stateNode,i=n.memoizedProps,s=null,f=Wt,f!==null)switch(f.tag){case 27:case 5:s=f.memoizedProps}e[rn]=n,e=!!(e.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||Nb(e.nodeValue,i)),e||xa(n,!0)}else e=Gs(e).createTextNode(s),e[rn]=n,n.stateNode=e}return jt(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(s=sl(n),i!==null){if(e===null){if(!s)throw Error(l(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[rn]=n}else oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),e=!1}else i=Id(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(Fn(n),n):(Fn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return jt(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=sl(n),s!==null&&s.dehydrated!==null){if(e===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[rn]=n}else oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),f=!1}else f=Id(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Fn(n),n):(Fn(n),null)}return Fn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=s!==null,e=e!==null&&e.memoizedState!==null,i&&(s=n.child,f=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(f=s.alternate.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==f&&(s.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),Pu(n,n.updateQueue),jt(n),null);case 4:return oe(),e===null&&fh(n.stateNode.containerInfo),n.flags|=67108864,jt(n),null;case 10:return Jr(n.type),jt(n),null;case 19:if(tf(n),s=n.memoizedState,s===null)return jt(n),null;if(f=(n.flags&128)!==0,h=s.rendering,h===null)if(f)Ls(s,!1);else{if(qt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Tu(e),h!==null){for(n.flags|=128,Ls(s,!1),e=h.updateQueue,n.updateQueue=e,Pu(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)Zg(i,e),i=i.sibling;return Rs(n,sn.current&1|2),Ve&&$r(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&H()>tc&&(n.flags|=128,f=!0,Ls(s,!1),n.lanes=4194304)}else{if(!f)if(e=Tu(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Pu(n,e),Ls(s,!0),s.tail===null&&s.tailMode!=="collapsed"&&s.tailMode!=="visible"&&!h.alternate&&!Ve)return jt(n),null}else 2*H()-s.renderingStartTime>tc&&i!==536870912&&(n.flags|=128,f=!0,Ls(s,!1),n.lanes=4194304);s.isBackwards?(h.sibling=n.child,n.child=h):(e=s.last,e!==null?e.sibling=h:n.child=h,s.last=h)}if(s.tail!==null){e=s.tail;e:{for(i=e;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return s.rendering=e,s.tail=e.sibling,s.renderingStartTime=H(),e.sibling=null,h=sn.current,h=f?h&1|2:h&1,s.tailMode==="visible"||s.tailMode==="collapsed"||!i||Ve?Rs(n,h):(i=h,Qe(ln,n),Qe(sn,i),hn===null&&(hn=n)),Ve&&$r(n,s.treeForkCount),e}return jt(n),null;case 22:case 23:return Fn(n),Wd(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(i&536870912)!==0&&(n.flags&128)===0&&(jt(n),n.subtreeFlags&6&&(n.flags|=8192)):jt(n),i=n.updateQueue,i!==null&&Pu(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==i&&(n.flags|=2048),e!==null&&rt(hi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Jr(Pt),jt(n),null;case 25:return null;case 30:return n.flags|=33554432,jt(n),null}throw Error(l(156,n.tag))}function h2(e,n){switch(Hd(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Jr(Pt),oe(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return J(n),null;case 31:if(n.memoizedState!==null){if(Fn(n),n.alternate===null)throw Error(l(340));oi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Fn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(l(340));oi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return tf(n),e=n.flags,e&65536?(n.flags=e&-65537|128,e=n.memoizedState,e!==null&&(e.rendering=null,e.tail=null),n.flags|=4,n):null;case 4:return oe(),null;case 10:return Jr(n.type),null;case 22:case 23:return Fn(n),Wd(),e!==null&&rt(hi),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Jr(Pt),null;case 25:return null;default:return null}}function kx(e,n){switch(Hd(n),n.tag){case 3:Jr(Pt),oe();break;case 26:case 27:case 5:J(n);break;case 4:oe();break;case 31:n.memoizedState!==null&&Fn(n);break;case 13:Fn(n);break;case 19:tf(n);break;case 10:Jr(n.type);break;case 22:case 23:Fn(n),Wd(),e!==null&&rt(hi);break;case 24:Jr(Pt)}}function Us(e,n){try{var i=n.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var f=s.next;i=f;do{if((i.tag&e)===e){s=void 0;var h=i.create,v=i.inst;s=h(),v.destroy=s}i=i.next}while(i!==f)}}catch(N){yt(n,n.return,N)}}function Ea(e,n,i){try{var s=n.updateQueue,f=s!==null?s.lastEffect:null;if(f!==null){var h=f.next;s=h;do{if((s.tag&e)===e){var v=s.inst,N=v.destroy;if(N!==void 0){v.destroy=void 0,f=n;var R=i,Y=N;try{Y()}catch(X){yt(f,R,X)}}}s=s.next}while(s!==h)}}catch(X){yt(n,n.return,X)}}function jx(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{py(n,i)}catch(s){yt(e,e.return,s)}}}function Ex(e,n,i){i.props=xi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){yt(e,n,s)}}function Or(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:var f=e.stateNode,h=Gr(e.memoizedProps,f);(f.ref===null||f.ref.name!==h)&&(f.ref=Db(h)),s=f.ref;break;case 7:if(e.stateNode===null){var v=new Gn(e);g(e.child,!1,rC,v,void 0,void 0),e.stateNode=v}s=e.stateNode;break;default:s=e.stateNode}typeof i=="function"?e.refCleanup=i(s):i.current=s}}catch(N){yt(e,n,N)}}function on(e,n){var i=e.ref,s=e.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(f){yt(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){yt(e,n,f)}else i.current=null}function Qu(e,n){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&n!==null)for(var i=0;i<n.length;i++)Bb(e.stateNode,n[i])}function Tx(e){for(var n=e.return;n!==null&&(zf(n)&&Bb(e.stateNode,n.stateNode),!Mf(n));)n=n.return}function qs(e){for(var n=e.return;n!==null&&(zf(n)&&aC(e.stateNode,n.stateNode),!Mf(n));)n=n.return}function Mf(e){return e.tag===5||e.tag===3||e.tag===27}function zf(e){return e&&e.tag===7&&e.stateNode!==null}function Df(e){var n=e.type,i=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(f){yt(e,e.return,f)}}function _f(e,n,i){try{var s=e.stateNode;H2(s,e.type,i,n),s[En]=n}catch(f){yt(e,e.return,f)}}function Ax(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Da(e.type)||e.tag===4}function Lf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ax(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Da(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Uf(e,n,i,s){var f=e.tag;if(f===5||f===6)f=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(f,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(f),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Er)),Qu(e,s),st=!0;else if(f!==4&&(f===27&&(Qu(e,s),s=null,Da(e.type)&&(i=e.stateNode,n=null)),e=e.child,e!==null))for(Uf(e,n,i,s),e=e.sibling;e!==null;)Uf(e,n,i,s),e=e.sibling}function Yu(e,n,i,s){var f=e.tag;if(f===5||f===6)f=e.stateNode,n?i.insertBefore(f,n):i.appendChild(f),Qu(e,s),st=!0;else if(f!==4&&(f===27&&(Qu(e,s),s=null,Da(e.type)&&(i=e.stateNode)),e=e.child,e!==null))for(Yu(e,n,i,s),e=e.sibling;e!==null;)Yu(e,n,i,s),e=e.sibling}function Ox(e){var n=e.stateNode,i=e.memoizedProps;try{for(var s=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);un(n,s,i),n[rn]=e,n[En]=i}catch(h){yt(e,e.return,h)}}var Vu=!1,Pn=null;function Rx(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(Vu=!0)}var Rr=null;function Mx(){var e=Rr;return Rr=null,e}var An=0;function pl(e,n,i,s,f){return An=0,zx(e.child,n,i,s,f)}function zx(e,n,i,s,f){for(var h=!1;e!==null;){if(e.tag===5){var v=e.stateNode;if(s!==null){var N=vh(v);s.push(N),N.view&&(h=!0)}else h||vh(v).view&&(h=!0);Vu=!0,Mb(v,An===0?n:n+"_"+An,i),An++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&f||zx(e.child,n,i,s,f)&&(h=!0));e=e.sibling}return h}function Mr(e,n){for(;e!==null;)e.tag===5?zb(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&n||Mr(e.child,n)),e=e.sibling}function Gu(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Gu(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var n=e.memoizedProps;if(n.name==null||n.name==="auto")throw Error(l(544));var i=n.name;n=Kr(n.default,n.share),n!=="none"&&(pl(e,i,n,null,!1)||Mr(e.child,!1))}e=e.sibling}}function qf(e,n){if(e.tag===30){var i=e.stateNode,s=e.memoizedProps,f=Gr(s,i),h=Kr(s.default,i.paired?s.share:s.enter);h!=="none"?pl(e,f,h,null,!1)?(Gu(e),i.paired||n||Nl(e,s.onEnter)):Mr(e.child,!1):Gu(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)qf(e,n),e=e.sibling;else Gu(e)}function Hf(e){if(Pn!==null&&Pn.size!==0){var n=Pn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var i=e.memoizedProps,s=i.name;if(s!=null&&s!=="auto"){var f=n.get(s);if(f!==void 0){var h=Kr(i.default,i.share);if(h!=="none"&&(pl(e,s,h,null,!1)?(h=e.stateNode,f.paired=h,h.paired=f,Nl(e,i.onShare)):Mr(e.child,!1)),n.delete(s),n.size===0)break}}}Hf(e)}e=e.sibling}}}function Bf(e){if(e.tag===30){var n=e.memoizedProps,i=Gr(n,e.stateNode),s=Pn!==null?Pn.get(i):void 0,f=Kr(n.default,s!==void 0?n.share:n.exit);f!=="none"&&(pl(e,i,f,null,!1)?s!==void 0?(f=e.stateNode,s.paired=f,f.paired=s,Pn.delete(i),Nl(e,n.onShare)):Nl(e,n.onExit):Mr(e.child,!1)),Pn!==null&&Hf(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Bf(e),e=e.sibling;else Pn!==null&&Hf(e)}function Dx(e){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,i=Gr(n,e.stateNode);n=Kr(n.default,n.update),e.flags&=-5,n!=="none"&&pl(e,i,n,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Dx(e);e=e.sibling}}function If(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.stateNode;n.paired!==null&&(n.paired=null,Mr(e.child,!1))}If(e)}e=e.sibling}}function Ku(e){if(e.tag===30)e.stateNode.paired=null,Mr(e.child,!1),If(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Ku(e),e=e.sibling;else If(e)}function _x(e){for(e=e.child;e!==null;)e.tag===30?Mr(e.child,!1):(e.subtreeFlags&33554432)!==0&&_x(e),e=e.sibling}function Ff(e,n,i,s,f,h,v){for(var N=!1;n!==null;){if(n.tag===5){var R=n.stateNode;if(h!==null&&An<h.length){var Y=h[An],X=vh(R);(Y.view||X.view)&&(N=!0);var ne;if(ne=(e.flags&4)===0)if(X.clip)ne=!0;else{ne=Y.rect;var B=X.rect;ne=ne.y!==B.y||ne.x!==B.x||ne.height!==B.height||ne.width!==B.width}ne&&(e.flags|=4),X.abs?X=!Y.abs:(Y=Y.rect,X=X.rect,X=Y.height!==X.height||Y.width!==X.width),X&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Mb(R,An===0?i:i+"_"+An,f),N&&(e.flags&4)!==0||(Rr===null&&(Rr=[]),Rr.push(R,An===0?s:s+"_"+An,n.memoizedProps)),An++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&v?e.flags|=n.flags&32:Ff(e,n.child,i,s,f,h,v)&&(N=!0));n=n.sibling}return N}function Lx(e,n){for(e=e.child;e!==null;){if(e.tag===30){var i=e.memoizedProps,s=e.stateNode,f=Gr(i,s),h=Kr(i.default,i.update),v;v=e.memoizedState,e.memoizedState=null,s=e;var N=e.child;An=0,f=Ff(s,N,f,f,h,v,!1),(e.flags&4)!==0&&f&&Nl(e,i.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Lx(e);e=e.sibling}}var en=!1,ht=!1,zr=!1,Pf=!1,Ux=typeof WeakSet=="function"?WeakSet:Set,tn=null,Dr=!1,Hs=!1,Xu=!1,Qf=!1;function m2(e,n,i){if(e=e.containerInfo,ph=zl,e=Ig(e),Ad(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var f=s.getSelection&&s.getSelection();if(f&&f.rangeCount!==0){s=f.anchorNode;var h=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{s.nodeType,v.nodeType}catch{s=null;break e}var N=0,R=-1,Y=-1,X=0,ne=0,B=e,G=null;t:for(;;){for(var pe;B!==s||h!==0&&B.nodeType!==3||(R=N+h),B!==v||f!==0&&B.nodeType!==3||(Y=N+f),B.nodeType===3&&(N+=B.nodeValue.length),(pe=B.firstChild)!==null;)G=B,B=pe;for(;;){if(B===e)break t;if(G===s&&++X===h&&(R=N),G===v&&++ne===f&&(Y=N),(pe=B.nextSibling)!==null)break;B=G,G=B.parentNode}B=pe}s=R===-1||Y===-1?null:{start:R,end:Y}}else s=null}s=s||{start:0,end:0}}else s=null;for(gh={focusedElem:e,selectionRange:s},zl=!1,i=(i&335544064)===i,tn=n,n=i?9270:1024;tn!==null;){if(e=tn,i&&(s=e.deletions,s!==null))for(h=0;h<s.length;h++)i&&Bf(s[h]);if(e.alternate===null&&(e.flags&2)!==0)i&&Rx(e),$u(i);else{if(e.tag===22){if(s=e.alternate,e.memoizedState!==null){s!==null&&s.memoizedState===null&&i&&Bf(s),$u(i);continue}else if(s!==null&&s.memoizedState!==null){i&&Rx(e),$u(i);continue}}s=e.child,(e.subtreeFlags&n)!==0&&s!==null?(s.return=e,tn=s):(i&&Dx(e),$u(i))}}Pn=null}function $u(e){for(;tn!==null;){var n=tn,i=e,s=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 15:break;case 1:if((f&1024)!==0&&s!==null){i=void 0,f=s.memoizedProps,s=s.memoizedState;var h=n.stateNode;try{var v=xi(n.type,f);i=h.getSnapshotBeforeUpdate(v,s),h.__reactInternalSnapshotBeforeUpdate=i}catch(N){yt(n,n.return,N)}}break;case 3:if((f&1024)!==0){if(s=n.stateNode.containerInfo,i=s.nodeType,i===9)Nh(s);else if(i===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Nh(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:i&&s!==null&&(i=Gr(s.memoizedProps,s.stateNode),f=n.memoizedProps,f=Kr(f.default,f.update),f!=="none"&&pl(s,i,f,s.memoizedState=[],!0));break;default:if((f&1024)!==0)throw Error(l(163))}if(s=n.sibling,s!==null){s.return=n.return,tn=s;break}tn=n.return}}function qx(e,n,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:_r(e,i),s&4&&Us(5,i);break;case 1:if(_r(e,i),s&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(v){yt(i,i.return,v)}else{var f=xi(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(v){yt(i,i.return,v)}}s&64&&jx(i),s&512&&Or(i,i.return);break;case 3:if(_r(e,i),s&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{py(e,n)}catch(v){yt(i,i.return,v)}}break;case 27:n===null&&s&4&&Ox(i);case 26:case 5:_r(e,i),n===null&&s&4&&Df(i),s&512&&Or(i,i.return);break;case 12:_r(e,i);break;case 31:_r(e,i),s&4&&Fx(e,i);break;case 13:_r(e,i),s&4&&Px(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=j2.bind(null,i),sC(e,i))));break;case 22:if(s=i.memoizedState!==null||en,!s){var h=n!==null&&n.memoizedState!==null||ht;n=en,f=ht,en=s,(ht=h)&&!f?(s=2,(i.subtreeFlags&8772)!==0&&(s|=1),xr(e,i,s)):_r(e,i),en=n,ht=f}break;case 30:_r(e,i),s&512&&Or(i,i.return);break;case 7:s&512&&Or(i,i.return);default:_r(e,i)}}function Yf(e,n){for(e=e.child;e!==null;)Hx(e,n),e=e.sibling}function Hx(e,n){switch(e.tag){case 5:case 26:try{var i=e.stateNode;if(n){var s=i.style;typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"}else{var f=e.stateNode,h=e.memoizedProps.style,v=h!=null&&h.hasOwnProperty("display")?h.display:null;f.style.display=v==null||typeof v=="boolean"?"":(""+v).trim()}}catch(R){yt(e,e.return,R)}Vf(e,n);break;case 6:try{e.stateNode.nodeValue=n?"":e.memoizedProps,st=!0}catch(R){yt(e,e.return,R)}break;case 18:try{var N=e.stateNode;n?Rb(N,!0):Rb(e.stateNode,!1)}catch(R){yt(e,e.return,R)}break;case 22:case 23:e.memoizedState===null&&Yf(e,n);break;default:Yf(e,n)}}function Vf(e,n){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var i=e,s=n;switch(i.tag){case 4:Hx(i,s);break e;case 22:i.memoizedState===null&&Vf(i,s);break e;default:Vf(i,s)}}e=e.sibling}}function Bx(e){var n=e.alternate;n!==null&&(e.alternate=null,Bx(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&tu(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var At=null,On=!1;function gr(e,n,i){for(i=i.child;i!==null;)Ix(e,n,i),i=i.sibling}function Ix(e,n,i){if(qn&&typeof qn.onCommitFiberUnmount=="function")try{qn.onCommitFiberUnmount(os,i)}catch{}switch(i.tag){case 26:ht||on(i,n),gr(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&!ht&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ht||on(i,n),qs(i);var s=At,f=On;Da(i.type)&&(At=i.stateNode,On=!1),gr(e,n,i),Yb(i.stateNode,i.type,i.memoizedProps),At=s,On=f;break;case 5:ht||on(i,n),qs(i);case 6:if(i.tag===6&&qs(i),s=At,f=On,At=null,gr(e,n,i),At=s,On=f,At!==null)if(On)try{(At.nodeType===9?At.body:At.nodeName==="HTML"?At.ownerDocument.body:At).removeChild(i.stateNode),st=!0}catch(h){yt(i,n,h)}else try{At.removeChild(i.stateNode),st=!0}catch(h){yt(i,n,h)}break;case 18:At!==null&&(On?(e=At,Ob(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Dl(e)):Ob(At,i.stateNode));break;case 4:s=At,f=On,At=i.stateNode.containerInfo,On=!0,gr(e,n,i),At=s,On=f;break;case 0:case 11:case 14:case 15:Ea(2,i,n),ht||Ea(4,i,n),gr(e,n,i);break;case 1:ht||(on(i,n),s=i.stateNode,typeof s.componentWillUnmount=="function"&&Ex(i,n,s)),gr(e,n,i);break;case 21:gr(e,n,i);break;case 22:ht=(s=ht)||i.memoizedState!==null,gr(e,n,i),ht=s;break;case 30:on(i,n),gr(e,n,i);break;case 7:ht||on(i,n),gr(e,n,i);break;default:gr(e,n,i)}}function Fx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Dl(e)}catch(i){yt(n,n.return,i)}}}function Px(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Dl(e)}catch(i){yt(n,n.return,i)}}function p2(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Ux),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Ux),n;default:throw Error(l(435,e.tag))}}function Zu(e,n){var i=p2(e);n.forEach(function(s){if(!i.has(s)){i.add(s);var f=E2.bind(null,e,s);s.then(f,f)}})}function bn(e,n,i){var s=n.deletions;if(s!==null)for(var f=0;f<s.length;f++){var h=s[f],v=e,N=n,R=N;e:for(;R!==null;){switch(R.tag){case 27:if(Da(R.type)){At=R.stateNode,On=!1;break e}break;case 5:At=R.stateNode,On=!1;break e;case 3:case 4:At=R.stateNode.containerInfo,On=!0;break e}R=R.return}if(At===null)throw Error(l(160));Ix(v,N,h),At=null,On=!1,v=h.alternate,v!==null&&(v.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Qx(n,e,i),n=n.sibling}var yr=null;function Qx(e,n,i){var s=e.alternate,f=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(f&4&&(s=e.updateQueue,s=s!==null?s.events:null,s!==null))for(var h=0;h<s.length;h++){var v=s[h];v.ref.impl=v.nextImpl}bn(n,e,i),vn(e),f&4&&(Ea(3,e,e.return),Us(3,e),Ea(5,e,e.return));break;case 1:bn(n,e,i),vn(e),f&512&&(ht||s===null||on(s,s.return)),f&64&&en&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?n:i.concat(n))));break;case 26:if(h=yr,bn(n,e,i),vn(e),f&512&&(ht||s===null||on(s,s.return)),f&4)if(f=s!==null?s.memoizedState:null,i=e.memoizedState,s===null)if(i===null)if(e.stateNode===null)if(en)e.stateNode=Eb(e.type,e.memoizedProps,n.containerInfo,e);else{e:{n=e.type,i=e.memoizedProps,f=h.ownerDocument||h;t:switch(n){case"title":s=f.getElementsByTagName("title")[0],(!s||s[ds]||s[rn]||s.namespaceURI==="http://www.w3.org/2000/svg"||s.hasAttribute("itemprop"))&&(s=f.createElement(n),f.head.insertBefore(s,f.querySelector("head > title"))),un(s,n,i),s[rn]=e,Jt(s),n=s;break e;case"link":if(h=Zb("link","href",f).get(n+(i.href||""))){for(v=0;v<h.length;v++)if(s=h[v],s.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&s.getAttribute("rel")===(i.rel==null?null:i.rel)&&s.getAttribute("title")===(i.title==null?null:i.title)&&s.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){h.splice(v,1);break t}}s=f.createElement(n),un(s,n,i),f.head.appendChild(s);break;case"meta":if(h=Zb("meta","content",f).get(n+(i.content||""))){for(v=0;v<h.length;v++)if(s=h[v],s.getAttribute("content")===(i.content==null?null:""+i.content)&&s.getAttribute("name")===(i.name==null?null:i.name)&&s.getAttribute("property")===(i.property==null?null:i.property)&&s.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&s.getAttribute("charset")===(i.charSet==null?null:i.charSet)){h.splice(v,1);break t}}s=f.createElement(n),un(s,n,i),f.head.appendChild(s);break;default:throw Error(l(468,n))}s[rn]=e,Jt(s),n=s}e.stateNode=n}else en||Oh(h,e.type,e.stateNode);else e.stateNode=$b(h,i,e.memoizedProps);else f!==i?(f===null?(n=s.stateNode,n===null||ht||n.parentNode.removeChild(n)):f.count--,i===null?en||Oh(h,e.type,e.stateNode):$b(h,i,e.memoizedProps)):i===null&&e.stateNode!==null&&_f(e,e.memoizedProps,s.memoizedProps);break;case 27:bn(n,e,i),vn(e),f&512&&(ht||s===null||on(s,s.return)),s!==null&&f&4&&_f(e,e.memoizedProps,s.memoizedProps);break;case 5:if(h=zr,zr=!1,bn(n,e,i),zr=h,vn(e),f&512&&(ht||s===null||on(s,s.return)),e.flags&32){n=e.stateNode;try{Zi(n,""),st=!0}catch(X){yt(e,e.return,X)}}f&4&&e.stateNode!=null&&(n=e.memoizedProps,_f(e,n,s!==null?s.memoizedProps:n)),f&1024&&(Pf=!0);break;case 6:if(bn(n,e,i),vn(e),f&4){if(e.stateNode===null)throw Error(l(162));n=e.memoizedProps,i=e.stateNode;try{i.nodeValue=n,st=!0}catch(X){yt(e,e.return,X)}}break;case 3:if(st=!1,fc=null,h=yr,yr=Ks(n.containerInfo),bn(n,e,i),yr=h,vn(e),f&4&&s!==null&&s.memoizedState.isDehydrated)try{Dl(n.containerInfo)}catch(X){yt(e,e.return,X)}Pf&&(Pf=!1,Yx(e)),st=!1;break;case 4:f=zr,zr=en,s=dg(),h=yr,yr=Ks(e.stateNode.containerInfo),bn(n,e,i),vn(e),yr=h,st&&Hs&&(Xu=!0),st=s,zr=f;break;case 12:bn(n,e,i),vn(e);break;case 31:bn(n,e,i),vn(e),f&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Zu(e,n)));break;case 13:bn(n,e,i),vn(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(ec=H()),f&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Zu(e,n)));break;case 22:h=e.memoizedState!==null,v=s!==null&&s.memoizedState!==null;var N=en,R=ht,Y=zr;en=N||h,zr=Y||h,ht=R||v,bn(n,e,i),ht=R,zr=Y,en=N,vn(e),f&8192&&(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,!h||s===null||v||en||ht||(n=v||ht,i=en,s=ht,en=h||en,ht=n,Ta(e,2),en=i,ht=s),!h&&zr||Yf(e,h)),f&4&&(n=e.updateQueue,n!==null&&(i=n.retryQueue,i!==null&&(n.retryQueue=null,Zu(e,i))));break;case 19:bn(n,e,i),vn(e),f&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Zu(e,n)));break;case 30:f&512&&(ht||s===null||on(s,s.return)),f=dg(),h=Hs,v=(i&335544064)===i,N=e.memoizedProps,Hs=v&&Kr(N.default,N.update)!=="none",bn(n,e,i),vn(e),v&&s!==null&&st&&(e.flags|=4),Hs=h,st=f;break;case 21:break;case 7:f&512&&(ht||s===null||on(s,s.return)),s&&s.stateNode!==null&&(s.stateNode._fragmentFiber=e);default:bn(n,e,i),vn(e)}}function vn(e){var n=e.flags;if(n&2){try{for(var i,s=e.return;s!==null;){if(Ax(s)){i=s;break}s=s.return}s=null;for(var f=e.return;f!==null;){if(zf(f)){var h=f.stateNode;s===null?s=[h]:s.push(h)}if(Mf(f))break;f=f.return}var v=s;if(i==null)throw Error(l(160));switch(i.tag){case 27:var N=i.stateNode,R=Lf(e);Yu(e,R,N,v);break;case 5:var Y=i.stateNode;i.flags&32&&(Zi(Y,""),i.flags&=-33);var X=Lf(e);Yu(e,X,Y,v);break;case 3:case 4:var ne=i.stateNode.containerInfo,B=Lf(e);Uf(e,B,ne,v);break;default:throw Error(l(161))}}catch(G){yt(e,e.return,G)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Yx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Yx(n),n.tag===5&&n.flags&1024&&(n=n.stateNode,zl=!0,n.reset(),zl=!1),e=e.sibling}}function gl(e,n){if(n.subtreeFlags&9270)for(n=n.child;n!==null;)Vx(n,e),n=n.sibling;else Lx(n)}function Vx(e,n){var i=e.alternate;if(i===null)qf(e,!1);else switch(e.tag){case 3:if(Qf=Dr=!1,Mx(),gl(n,e),!Dr&&!Xu){if(e=Rr,e!==null)for(var s=0;s<e.length;s+=3){i=e[s];var f=e[s+1];zb(i,e[s+2]),i=i.ownerDocument.documentElement,i!==null&&i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+f+")"})}e=n.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Qf=!0}Rr=null;break;case 5:gl(n,e);break;case 4:s=Dr,Dr=!1,gl(n,e),Dr&&(Xu=!0),Dr=s;break;case 22:e.memoizedState===null&&(i.memoizedState!==null?qf(e,!1):gl(n,e));break;case 30:s=Dr,f=Mx(),Dr=!1,gl(n,e),Dr&&(e.flags|=4);var h=e.memoizedProps,v=e.stateNode;n=Gr(h,v),v=Gr(i.memoizedProps,v);var N=Kr(h.default,h.update);N==="none"?n=!1:(h=i.memoizedState,i.memoizedState=null,i=e.child,An=0,n=Ff(e,i,n,v,N,h,!0),An!==(h===null?0:h.length)&&(e.flags|=32)),(e.flags&4)!==0&&n?(Nl(e,e.memoizedProps.onUpdate),Rr=f):f!==null&&(f.push.apply(f,Rr),Rr=f),Dr=(e.flags&32)!==0?!0:s;break;default:gl(n,e)}}function _r(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)qx(e,n.alternate,n),n=n.sibling}function Ta(e,n){for(e=e.child;e!==null;){var i=e,s=n;switch(i.tag){case 0:case 11:case 14:case 15:Ea(4,i,i.return),Ta(i,s);break;case 1:on(i,i.return);var f=i.stateNode;typeof f.componentWillUnmount=="function"&&Ex(i,i.return,f),Ta(i,s);break;case 27:(s&2)!==0&&Yb(i.stateNode,i.type,i.memoizedProps);case 5:on(i,i.return),i.tag!==5&&i.tag!==27||qs(i),Ta(i,s);break;case 6:qs(i);break;case 26:on(i,i.return),f=i.stateNode,i.memoizedState!==null||f===null||ht||f.parentNode.removeChild(f),Ta(i,s);break;case 22:i.memoizedState===null&&Ta(i,s);break;case 30:on(i,i.return),Ta(i,s);break;case 7:on(i,i.return);default:Ta(i,s)}e=e.sibling}}function xr(e,n,i){for(i=(n.subtreeFlags&8772)!==0?i:i&-2,n=n.child;n!==null;){var s=n.alternate,f=e,h=n,v=h.flags,N=(i&1)!==0;switch(h.tag){case 0:case 11:case 15:xr(f,h,i),Us(4,h);break;case 1:if(xr(f,h,i),s=h,f=s.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(X){yt(s,s.return,X)}if(s=h,f=s.updateQueue,f!==null){var R=s.stateNode;try{var Y=f.shared.hiddenCallbacks;if(Y!==null)for(f.shared.hiddenCallbacks=null,f=0;f<Y.length;f++)my(Y[f],R)}catch(X){yt(s,s.return,X)}}N&&v&64&&jx(h),Or(h,h.return);break;case 27:(i&2)!==0&&Ox(h);case 5:h.tag!==5&&h.tag!==27||Tx(h),xr(f,h,i),N&&s===null&&v&4&&Df(h),Or(h,h.return);break;case 6:Tx(h);break;case 26:R=h.stateNode,h.memoizedState!==null||R===null||en||Oh(Ks(R.ownerDocument),h.type,R),xr(f,h,i),N&&s===null&&v&4&&Df(h),Or(h,h.return);break;case 12:xr(f,h,i);break;case 31:xr(f,h,i),N&&v&4&&Fx(f,h);break;case 13:xr(f,h,i),N&&v&4&&Px(f,h);break;case 22:h.memoizedState===null&&xr(f,h,i),Or(h,h.return);break;case 30:xr(f,h,i),Or(h,h.return);break;case 7:Or(h,h.return);default:xr(f,h,i)}n=n.sibling}}function Gf(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&Cs(i))}function Kf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Cs(e))}function ir(e,n,i,s){var f=(i&335544064)===i;if(n.subtreeFlags&(f?10262:10256))for(n=n.child;n!==null;)Gx(e,n,i,s),n=n.sibling;else f&&_x(n)}function Gx(e,n,i,s){var f=(i&335544064)===i;f&&n.alternate===null&&n.return!==null&&n.return.alternate!==null&&Ku(n);var h=n.flags;switch(n.tag){case 0:case 11:case 15:ir(e,n,i,s),h&2048&&Us(9,n);break;case 1:ir(e,n,i,s);break;case 3:ir(e,n,i,s),f&&Qf&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),h&2048&&(h=null,n.alternate!==null&&(h=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==h&&(n.refCount++,h!=null&&Cs(h)));break;case 12:if(h&2048){ir(e,n,i,s),h=n.stateNode;try{var v=n.memoizedProps,N=v.id,R=v.onPostCommit;typeof R=="function"&&R(N,n.alternate===null?"mount":"update",h.passiveEffectDuration,-0)}catch(Y){yt(n,n.return,Y)}}else ir(e,n,i,s);break;case 31:ir(e,n,i,s);break;case 13:ir(e,n,i,s);break;case 23:break;case 22:v=n.stateNode,N=n.alternate,n.memoizedState!==null?(f&&N!==null&&N.memoizedState===null&&Ku(N),v._visibility&2?ir(e,n,i,s):Bs(e,n)):(f&&N!==null&&N.memoizedState!==null&&Ku(n),v._visibility&2?ir(e,n,i,s):(v._visibility|=2,yl(e,n,i,s,(n.subtreeFlags&10256)!==0||!1))),h&2048&&Gf(N,n);break;case 24:ir(e,n,i,s),h&2048&&Kf(n.alternate,n);break;case 30:f&&(h=n.alternate,h!==null&&(Mr(h.child,!0),Mr(n.child,!0))),ir(e,n,i,s);break;default:ir(e,n,i,s)}}function yl(e,n,i,s,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,v=n,N=i,R=s,Y=v.flags;switch(v.tag){case 0:case 11:case 15:yl(h,v,N,R,f),Us(8,v);break;case 23:break;case 22:var X=v.stateNode;v.memoizedState!==null?X._visibility&2?yl(h,v,N,R,f):Bs(h,v):(X._visibility|=2,yl(h,v,N,R,f)),f&&Y&2048&&Gf(v.alternate,v);break;case 24:yl(h,v,N,R,f),f&&Y&2048&&Kf(v.alternate,v);break;default:yl(h,v,N,R,f)}n=n.sibling}}function Bs(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,s=n,f=s.flags;switch(s.tag){case 22:Bs(i,s),f&2048&&Gf(s.alternate,s);break;case 24:Bs(i,s),f&2048&&Kf(s.alternate,s);break;default:Bs(i,s)}n=n.sibling}}var bi=8192;function vi(e,n,i){if(e.subtreeFlags&bi)for(e=e.child;e!==null;)Kx(e,n,i),e=e.sibling}function Kx(e,n,i){switch(e.tag){case 26:vi(e,n,i),e.flags&bi&&(e.memoizedState!==null?wC(i,yr,e.memoizedState,e.memoizedProps):(e=e.stateNode,(n&335544128)===n&&tv(i,e)));break;case 5:vi(e,n,i),e.flags&bi&&(e=e.stateNode,(n&335544128)===n&&tv(i,e));break;case 3:case 4:var s=yr;yr=Ks(e.stateNode.containerInfo),vi(e,n,i),yr=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=bi,bi=16777216,vi(e,n,i),bi=s):vi(e,n,i));break;case 30:if((e.flags&bi)!==0&&(s=e.memoizedProps.name,s!=null&&s!=="auto")){var f=e.stateNode;f.paired=null,Pn===null&&(Pn=new Map),Pn.set(s,f)}vi(e,n,i);break;default:vi(e,n,i)}}function Xx(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Is(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var s=n[i];tn=s,Zx(s,e)}Xx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$x(e),e=e.sibling}function $x(e){switch(e.tag){case 0:case 11:case 15:Is(e),e.flags&2048&&Ea(9,e,e.return);break;case 3:Is(e);break;case 12:Is(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Ju(e)):Is(e);break;default:Is(e)}}function Ju(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var s=n[i];tn=s,Zx(s,e)}Xx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ea(8,n,n.return),Ju(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,Ju(n));break;default:Ju(n)}e=e.sibling}}function Zx(e,n){for(;tn!==null;){var i=tn;switch(i.tag){case 0:case 11:case 15:Ea(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var s=i.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Cs(i.memoizedState.cache)}if(s=i.child,s!==null)s.return=i,tn=s;else e:for(i=e;tn!==null;){s=tn;var f=s.sibling,h=s.return;if(Bx(s),s===i){tn=null;break e}if(f!==null){f.return=h,tn=f;break e}tn=h}}}var g2={getCacheForType:function(e){var n=an(Pt),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return an(Pt).controller.signal}},y2=typeof WeakMap=="function"?WeakMap:Map,dt=0,wt=null,Xe=null,Je=0,gt=0,Qn=null,Aa=!1,xl=!1,Xf=!1,ra=0,qt=0,Oa=0,wi=0,Wu=0,Yn=0,bl=0,Fs=null,Rn=null,$f=!1,ec=0,Jx=0,tc=1/0,nc=null,Ra=null,Dt=0,br=null,Si=null,Lr=0,Zf=0,Jf=null,Wx=null,vl=null,wl=null,Sl=null,Ps=0,rc=null;function Vn(){return(dt&2)!==0&&Je!==0?Je&-Je:ye.T!==null?oh():ng()}function eb(){if(Yn===0)if((Je&536870912)===0||Ve){var e=Zo;Zo<<=1,(Zo&3932160)===0&&(Zo=262144),Yn=e}else Yn=536870912;return e=ln.current,e!==null&&(e.flags|=32),Yn}function Nl(e,n){if(n!=null){var i=e.stateNode,s=i.ref;s===null&&(s=i.ref=Db(Gr(e.memoizedProps,i))),wl===null&&(wl=[]),wl.push(n.bind(null,s))}}function Mn(e,n,i){(e===wt&&(gt===2||gt===9)||e.cancelPendingCommit!==null)&&(Cl(e,0),Ma(e,Je,Yn,!1)),cs(e,i),((dt&2)===0||e!==wt)&&(e===wt&&((dt&2)===0&&(wi|=i),qt===4&&Ma(e,Je,Yn,!1)),Ur(e))}function tb(e,n,i){if((dt&6)!==0)throw Error(l(327));var s=!i&&(n&127)===0&&(n&e.expiredLanes)===0||us(e,n),f=s?v2(e,n):eh(e,n,!0),h=s;do{if(f===0){xl&&!s&&Ma(e,n,0,!1);break}else{if(i=e.current.alternate,h&&!x2(i)){f=eh(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){n=v;e:{var N=e;f=Fs;var R=N.current.memoizedState.isDehydrated;if(R&&(Cl(N,v).flags|=256),v=eh(N,v,!1),v!==2&&v!==6){if(Xf&&!R){N.errorRecoveryDisabledLanes|=h,wi|=h,f=4;break e}h=Rn,Rn=f,h!==null&&(Rn===null?Rn=h:Rn.push.apply(Rn,h))}f=v}if(h=!1,f!==2)continue}}if(f===1){Cl(e,0),Ma(e,n,0,!0);break}e:{switch(s=e,h=f,h){case 0:case 1:throw Error(l(345));case 4:if((n&4194048)!==n&&(n&62914560)!==n)break;case 6:Ma(s,n,Yn,!Aa);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=ec+300-H(),10<f)){if(Ma(s,n,Yn,!Aa),Wo(s,0,!0)!==0)break e;Lr=n,s.timeoutHandle=bh(nb.bind(null,s,i,Rn,nc,$f,n,Yn,wi,bl,Aa,h,"Throttled",-0,0),f);break e}nb(s,i,Rn,nc,$f,n,Yn,wi,bl,Aa,h,null,-0,0)}}break}while(!0);Ur(e)}function nb(e,n,i,s,f,h,v,N,R,Y,X,ne,B,G){e.timeoutHandle=-1;var pe=n.subtreeFlags,ke=(h&335544064)===h;if(ne=null,(ke||pe&8192||(pe&16785408)===16785408)&&(ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Er},Pn=null,Kx(n,h,ne),ke&&(pe=ne,ke=e.containerInfo,ke=(ke.nodeType===9?ke:ke.ownerDocument).__reactViewTransition,ke!=null&&(pe.count++,pe.waitingForViewTransition=!0,pe=Zs.bind(pe),ke.finished.then(pe,pe))),pe=(h&62914560)===h?ec-H():(h&4194048)===h?Jx-H():0,pe=SC(ne,pe),pe!==null)){Lr=h,e.cancelPendingCommit=pe(cb.bind(null,e,n,h,i,s,f,v,N,R,Y,X,ne,null,B,G)),Ma(e,h,v,!Y);return}cb(e,n,h,i,s,f,v,N,R,Y,X,ne)}function x2(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var s=0;s<i.length;s++){var f=i[s],h=f.getSnapshot;f=f.value;try{if(!In(h(),f))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ma(e,n,i,s){n=Zp(e,n),n&=~Wu,n&=~wi,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var f=n;0<f;){var h=31-Hn(f),v=1<<h;s[h]=-1,f&=~v}i!==0&&Wp(e,i,n)}function ac(){return(dt&6)===0?(Qs(0),!1):!0}function Wf(){if(Xe!==null){if(gt===0)var e=Xe.return;else e=Xe,Zr=ui=null,sf(e),cl=null,Es=0,e=Xe;for(;e!==null;)kx(e.alternate,e),e=e.return;Xe=null}}function Cl(e,n){var i=e.timeoutHandle;return i!==-1&&(e.timeoutHandle=-1,F2(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Lr=0,Wf(),wt=e,Xe=i=Xr(e.current,null),Je=n,gt=0,Qn=null,Aa=!1,xl=us(e,n),Xf=!1,bl=Yn=Wu=wi=Oa=qt=0,Rn=Fs=null,$f=!1,ra=Zp(e,n),fu(),i}function rb(e,n){Ie=null,ye.H=Uu,n===ul||n===Nu?(n=cy(),gt=3):n===Gd?(n=cy(),gt=4):gt=n===Sf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Qn=n,Xe===null&&(qt=1,qu(e,tr(n,e.current)))}function ab(){var e=ln.current;return e===null?!0:(Je&4194048)===Je?hn===null:(Je&62914560)===Je||(Je&536870912)!==0?e===hn:!1}function ib(){var e=ye.H;return ye.H=Uu,e===null?Uu:e}function lb(){var e=ye.A;return ye.A=g2,e}function ic(){qt=4,Aa||(Je&4194048)!==Je&&ln.current!==null||(xl=!0),(Oa&134217727)===0&&(wi&134217727)===0||wt===null||Ma(wt,Je,Yn,!1)}function eh(e,n,i){var s=dt;dt|=2;var f=ib(),h=lb();(wt!==e||Je!==n)&&(nc=null,Cl(e,n)),n=!1;var v=qt;e:do try{if(gt!==0&&Xe!==null){var N=Xe,R=Qn;switch(gt){case 8:Wf(),v=6;break e;case 3:case 2:case 9:case 6:ln.current===null&&(n=!0);var Y=gt;if(gt=0,Qn=null,kl(e,N,R,Y),i&&xl){v=0;break e}break;default:Y=gt,gt=0,Qn=null,kl(e,N,R,Y)}}b2(),v=qt;break}catch(X){rb(e,X)}while(!0);return n&&e.shellSuspendCounter++,Zr=ui=null,dt=s,ye.H=f,ye.A=h,Xe===null&&(wt=null,Je=0,fu()),v}function b2(){for(;Xe!==null;)sb(Xe)}function v2(e,n){var i=dt;dt|=2;var s=ib(),f=lb();wt!==e||Je!==n?(nc=null,tc=H()+500,Cl(e,n)):xl=us(e,n);e:do try{if(gt!==0&&Xe!==null){n=Xe;var h=Qn;t:switch(gt){case 1:gt=0,Qn=null,kl(e,n,h,1);break;case 2:case 9:if(oy(h)){gt=0,Qn=null,ob(n);break}n=function(){gt!==2&&gt!==9||wt!==e||(gt=7),Ur(e)},h.then(n,n);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:oy(h)?(gt=0,Qn=null,ob(n)):(gt=0,Qn=null,kl(e,n,h,7));break;case 5:var v=null;switch(Xe.tag){case 26:v=Xe.memoizedState;case 5:case 27:var N=Xe;if(v?Wb(v):N.stateNode.complete){gt=0,Qn=null;var R=N.sibling;if(R!==null)Xe=R;else{var Y=N.return;Y!==null?(Xe=Y,lc(Y)):Xe=null}break t}}gt=0,Qn=null,kl(e,n,h,5);break;case 6:gt=0,Qn=null,kl(e,n,h,6);break;case 8:Wf(),qt=6;break e;default:throw Error(l(462))}}w2();break}catch(X){rb(e,X)}while(!0);return Zr=ui=null,ye.H=s,ye.A=f,dt=i,Xe!==null?0:(wt=null,Je=0,fu(),qt)}function w2(){for(;Xe!==null&&!mr();)sb(Xe)}function sb(e){var n=Nx(e.alternate,e,ra);e.memoizedProps=e.pendingProps,n===null?lc(e):Xe=n}function ob(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=gx(i,n,n.pendingProps,n.type,void 0,Je);break;case 11:n=gx(i,n,n.pendingProps,n.type.render,n.ref,Je);break;case 5:sf(n);var s=n;s===Wt&&(Ve?(xu(s),s.tag===5&&s.stateNode!=null&&(kt=s.stateNode)):(xu(s),Ve=!0));default:kx(i,n),n=Xe=Zg(n,ra),n=Nx(i,n,ra)}e.memoizedProps=e.pendingProps,n===null?lc(e):Xe=n}function kl(e,n,i,s){Zr=ui=null,sf(n),cl=null,Es=0;var f=n.return;try{if(o2(e,f,n,i,Je)){qt=1,qu(e,tr(i,e.current)),Xe=null;return}}catch(h){if(f!==null)throw Xe=f,h;qt=1,qu(e,tr(i,e.current)),Xe=null;return}n.flags&32768?(Ve||s===1?e=!0:xl||(Je&536870912)!==0?e=!1:(Aa=e=!0,(s===2||s===9||s===3||s===6)&&(s=ln.current,s!==null&&s.tag===13&&(s.flags|=16384))),ub(n,e)):lc(n)}function lc(e){var n=e;do{if((n.flags&32768)!==0){ub(n,Aa);return}e=n.return;var i=f2(n.alternate,n,ra);if(i!==null){Xe=i;return}if(n=n.sibling,n!==null){Xe=n;return}Xe=n=e}while(n!==null);qt===0&&(qt=5)}function ub(e,n){do{var i=h2(e.alternate,e);if(i!==null){i.flags&=32767,Xe=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Xe=e;return}Xe=e=i}while(e!==null);qt=6,Xe=null}function cb(e,n,i,s,f,h,v,N,R,Y,X,ne){e.cancelPendingCommit=null;do sc();while(Dt!==0);if((dt&6)!==0)throw Error(l(327));if(n!==null){if(n===e.current)throw Error(l(177));e===wt&&(Xe=wt=null,Je=0),Si=n,br=e,Lr=i,Jf=f,Wx=s,S2(e,n,i,v,N,R,ne)}}function S2(e,n,i,s,f,h,v){var N=n.lanes|n.childLanes;if(Zf=N,N|=Dd,KS(e,i,N,s,f,h),wl=null,(i&335544064)===i?(Sl=$N(e),s=10262):(Sl=null,s=10256),(n.subtreeFlags&s)!==0||(n.flags&s)!==0?(e.callbackNode=null,e.callbackPriority=0,T2(ct,function(){return ah(),null})):(e.callbackNode=null,e.callbackPriority=0),Vu=!1,s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=ye.T,ye.T=null,f=je.p,je.p=2,h=dt,dt|=4;try{m2(e,n,i)}finally{dt=h,je.p=f,ye.T=s}}Dt=1,Vu?vl=K2(v,e.containerInfo,Sl,th,nh,C2,rh,ah,N2):(th(),nh(),rh())}function N2(e){if(Dt!==0){var n=br.onRecoverableError;n(e,{componentStack:null})}}function C2(){Dt===3&&(Dt=0,Vx(Si,br),Dt=4)}function th(){if(Dt===1){Dt=0;var e=br,n=Si,i=Lr,s=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||s){s=ye.T,ye.T=null;var f=je.p;je.p=2;var h=dt;dt|=4;try{Hs=Xu=!1,Qx(n,e,i),i=gh;var v=Ig(e.containerInfo),N=i.focusedElem,R=i.selectionRange;if(v!==N&&N&&N.ownerDocument&&Bg(N.ownerDocument.documentElement,N)){if(R!==null&&Ad(N)){var Y=R.start,X=R.end;if(X===void 0&&(X=Y),"selectionStart"in N)N.selectionStart=Y,N.selectionEnd=Math.min(X,N.value.length);else{var ne=N.ownerDocument||document,B=ne&&ne.defaultView||window;if(B.getSelection){var G=B.getSelection(),pe=N.textContent.length,ke=Math.min(R.start,pe),Fe=R.end===void 0?ke:Math.min(R.end,pe);!G.extend&&ke>Fe&&(v=Fe,Fe=ke,ke=v);var P=Hg(N,ke),U=Hg(N,Fe);if(P&&U&&(G.rangeCount!==1||G.anchorNode!==P.node||G.anchorOffset!==P.offset||G.focusNode!==U.node||G.focusOffset!==U.offset)){var V=ne.createRange();V.setStart(P.node,P.offset),G.removeAllRanges(),ke>Fe?(G.addRange(V),G.extend(U.node,U.offset)):(V.setEnd(U.node,U.offset),G.addRange(V))}}}}for(ne=[],G=N;G=G.parentNode;)G.nodeType===1&&ne.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ne.length;N++){var te=ne[N];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}zl=!!ph,gh=ph=null}finally{dt=h,je.p=f,ye.T=s}}e.current=n,Dt=2}}function nh(){if(Dt===2){Dt=0;var e=br,n=Si,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=ye.T,ye.T=null;var s=je.p;je.p=2;var f=dt;dt|=4;try{qx(e,n.alternate,n)}finally{dt=f,je.p=s,ye.T=i}}Dt=3}}function rh(){if(Dt===4||Dt===3){Dt=0;var e=vl;vl=null,jn();var n=br,i=Si,s=Lr,f=Wx,h=(s&335544064)===s?10262:10256;if((i.subtreeFlags&h)!==0||(i.flags&h)!==0?Dt=5:(Dt=0,Si=br=null,db(n,n.pendingLanes)),h=n.pendingLanes,h===0&&(Ra=null),dd(s),i=i.stateNode,qn&&typeof qn.onCommitFiberRoot=="function")try{qn.onCommitFiberRoot(os,i,void 0,(i.current.flags&128)===128)}catch{}if(f!==null){i=ye.T,h=je.p,je.p=2,ye.T=null;try{for(var v=n.onRecoverableError,N=0;N<f.length;N++){var R=f[N];v(R.value,{componentStack:R.stack})}}finally{ye.T=i,je.p=h}}if(f=wl,v=Sl,Sl=null,f!==null&&(wl=null,v===null&&(v=[]),e!==null))for(R=0;R<f.length;R++)i=(0,f[R])(v),i!==void 0&&e.finished.finally(i);(Lr&3)!==0&&sc(),Ur(n),h=n.pendingLanes,(s&261930)!==0&&(h&42)!==0?n===rc?Ps++:(Ps=0,rc=n):(Ps=0,rc=null),Qs(0)}}function db(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Cs(n)))}function sc(){return vl!==null&&(vl.skipTransition(),vl=null),th(),nh(),rh(),ah()}function ah(){if(Dt!==5)return!1;var e=br,n=Zf;Zf=0;var i=dd(Lr),s=ye.T,f=je.p;try{je.p=32>i?32:i,ye.T=null,i=Jf,Jf=null;var h=br,v=Lr;if(Dt=0,Si=br=null,Lr=0,(dt&6)!==0)throw Error(l(331));var N=dt;if(dt|=4,$x(h.current),Gx(h,h.current,v,i),dt=N,Qs(0,!1),qn&&typeof qn.onPostCommitFiberRoot=="function")try{qn.onPostCommitFiberRoot(os,h)}catch{}return!0}finally{je.p=f,ye.T=s,db(e,n)}}function fb(e,n,i){n=tr(i,n),n=wf(e.stateNode,n,2),e=Na(e,n,2),e!==null&&(cs(e,2),Ur(e))}function yt(e,n,i){if(e.tag===3)fb(e,e,i);else for(;n!==null;){if(n.tag===3){fb(n,e,i);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ra===null||!Ra.has(s))){e=tr(i,e),i=ox(2),s=Na(n,i,2),s!==null&&(ux(i,s,n,e),cs(s,2),Ur(s));break}}n=n.return}}function ih(e,n,i){var s=e.pingCache;if(s===null){s=e.pingCache=new y2;var f=new Set;s.set(n,f)}else f=s.get(n),f===void 0&&(f=new Set,s.set(n,f));f.has(i)||(Xf=!0,f.add(i),e=k2.bind(null,e,n,i),n.then(e,e))}function k2(e,n,i){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,wt===e&&(Je&i)===i&&((qt===4||qt===3&&(Je&62914560)===Je&&300>H()-ec)&&(dt&2)===0?Cl(e,0):Wu|=i,bl===Je&&(bl=0)),Ur(e)}function hb(e,n){n===0&&(n=Jp()),e=li(e,n),e!==null&&(cs(e,n),Ur(e))}function j2(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),hb(e,i)}function E2(e,n){var i=0;switch(e.tag){case 31:case 13:var s=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(n),hb(e,i)}function T2(e,n){return hr(e,n)}var jl=null,El=null,lh=!1,oc=!1,sh=!1,za=0;function Ur(e){e!==El&&e.next===null&&(El===null?jl=El=e:El=El.next=e),oc=!0,lh||(lh=!0,O2())}function Qs(e,n){if(!sh&&oc){sh=!0;do for(var i=!1,s=jl;s!==null;){if(e!==0){var f=s.pendingLanes;if(f===0)var h=0;else{var v=s.suspendedLanes,N=s.pingedLanes;h=(1<<31-Hn(42|e)+1)-1,h&=f&~(v&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,yb(s,h))}else h=Je,h=Wo(s,s===wt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(h&3)===0||us(s,h)||(i=!0,yb(s,h));s=s.next}while(i);sh=!1}}function A2(){mb()}function mb(){oc=lh=!1;var e=0;za!==0&&I2()&&(e=za);for(var n=H(),i=null,s=jl;s!==null;){var f=s.next,h=pb(s,n);h===0?(s.next=null,i===null?jl=f:i.next=f,f===null&&(El=i)):(i=s,(e!==0||(h&3)!==0)&&(oc=!0)),s=f}Dt!==0&&Dt!==5||Qs(e),za!==0&&(za=0)}function pb(e,n){for(var i=e.suspendedLanes,s=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var v=31-Hn(h),N=1<<v,R=f[v];R===-1?((N&i)===0||(N&s)!==0)&&(f[v]=GS(N,n)):R<=n&&(e.expiredLanes|=N),h&=~N}if(n=wt,i=Je,i=Wo(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===n&&(gt===2||gt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ft(s),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||us(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(s!==null&&Ft(s),dd(i)){case 2:case 8:i=Ee;break;case 32:i=ct;break;case 268435456:i=Ce;break;default:i=ct}return s=gb.bind(null,e),i=hr(i,s),e.callbackPriority=n,e.callbackNode=i,n}return s!==null&&s!==null&&Ft(s),e.callbackPriority=2,e.callbackNode=null,2}function gb(e,n){if(Dt!==0&&Dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(sc()&&e.callbackNode!==i)return null;var s=Je;return s=Wo(e,e===wt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(tb(e,s,n),pb(e,H()),e.callbackNode!=null&&e.callbackNode===i?gb.bind(null,e):null)}function yb(e,n){if(sc())return null;tb(e,n,!0)}function O2(){P2(function(){(dt&6)!==0?hr(we,A2):mb()})}function oh(){if(za===0){var e=fi;e===0&&(e=$o,$o<<=1,($o&261888)===0&&($o=256)),za=e}return za}function xb(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:au(e)}function R2(e,n,i,s,f){if(n==="submit"&&i&&i.stateNode===f){var h=xb((f[En]||null).action),v=s.submitter;v&&(n=(n=v[En]||null)?xb(n.formAction):v.getAttribute("formAction"),n!==null&&(h=n,v=null));var N=new ou("action","action",null,s,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(za!==0){var R=new FormData(f,v);gf(i,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(N.preventDefault(),R=new FormData(f,v),gf(i,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var uh=0;uh<zd.length;uh++){var ch=zd[uh],M2=ch.toLowerCase(),z2=ch[0].toUpperCase()+ch.slice(1);pr(M2,"on"+z2)}pr(Qg,"onAnimationEnd"),pr(Yg,"onAnimationIteration"),pr(Vg,"onAnimationStart"),pr("dblclick","onDoubleClick"),pr("focusin","onFocus"),pr("focusout","onBlur"),pr(FN,"onTransitionRun"),pr(PN,"onTransitionStart"),pr(QN,"onTransitionCancel"),pr(Gg,"onTransitionEnd"),Xi("onMouseEnter",["mouseout","mouseover"]),Xi("onMouseLeave",["mouseout","mouseover"]),Xi("onPointerEnter",["pointerout","pointerover"]),Xi("onPointerLeave",["pointerout","pointerover"]),ri("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ri("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ri("onBeforeInput",["compositionend","keypress","textInput","paste"]),ri("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ri("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ri("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ys="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(" "),D2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ys));function bb(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],f=s.event;s=s.listeners;e:{var h=void 0;if(n)for(var v=s.length-1;0<=v;v--){var N=s[v],R=N.instance,Y=N.currentTarget;if(N=N.listener,R!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=Y;try{h(f)}catch(X){du(X)}f.currentTarget=null,h=R}else for(v=0;v<s.length;v++){if(N=s[v],R=N.instance,Y=N.currentTarget,N=N.listener,R!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=Y;try{h(f)}catch(X){du(X)}f.currentTarget=null,h=R}}}}function $e(e,n){var i=n[ag];i===void 0&&(i=n[ag]=new Set);var s=e+"__bubble";i.has(s)||(vb(n,e,2,!1),i.add(s))}function dh(e,n,i){var s=0;n&&(s|=4),vb(i,e,s,n)}var uc="_reactListening"+Math.random().toString(36).slice(2);function fh(e){if(!e[uc]){e[uc]=!0,sg.forEach(function(i){i!=="selectionchange"&&(D2.has(i)||dh(i,!1,e),dh(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[uc]||(n[uc]=!0,dh("selectionchange",!1,n))}}function vb(e,n,i,s){switch(uv(n)){case 2:var f=jC;break;case 8:f=EC;break;default:f=Mh}i=f.bind(null,n,i,e),f=void 0,!bd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),s?f!==void 0?e.addEventListener(n,i,{capture:!0,passive:f}):e.addEventListener(n,i,!0):f!==void 0?e.addEventListener(n,i,{passive:f}):e.addEventListener(n,i,!1)}function hh(e,n,i,s,f){var h=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var v=s.tag;if(v===3||v===4){var N=s.stateNode.containerInfo;if(N===f)break;if(v===4)for(v=s.return;v!==null;){var R=v.tag;if((R===3||R===4)&&v.stateNode.containerInfo===f)return;v=v.return}for(;N!==null;){if(v=ni(N),v===null)return;if(R=v.tag,R===5||R===6||R===26||R===27){s=h=v;continue e}N=N.parentNode}}s=s.return}vg(function(){var Y=h,X=yd(i),ne=[];e:{var B=Kg.get(e);if(B!==void 0){var G=ou,pe=e;switch(e){case"keypress":if(lu(i)===0)break e;case"keydown":case"keyup":G=xN;break;case"focusin":pe="focus",G=Nd;break;case"focusout":pe="blur",G=Nd;break;case"beforeblur":case"afterblur":G=Nd;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":G=Ng;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=lN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=NN;break;case Qg:case Yg:case Vg:G=uN;break;case Gg:G=kN;break;case"scroll":case"scrollend":G=aN;break;case"wheel":G=EN;break;case"copy":case"cut":case"paste":G=dN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=kg;break;case"submit":G=wN;break;case"toggle":case"beforetoggle":G=AN}var ke=(n&4)!==0,Fe=!ke&&(e==="scroll"||e==="scrollend"),P=ke?B!==null?B+"Capture":null:B;ke=[];for(var U=Y,V;U!==null;){var te=U;if(V=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||V===null||P===null||(te=hs(U,P),te!=null&&ke.push(Vs(U,te,V))),Fe)break;U=U.return}0<ke.length&&(B=new G(B,pe,null,i,X),ne.push({event:B,listeners:ke}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",B=e==="mouseout"||e==="pointerout",G&&i!==gd&&(pe=i.relatedTarget||i.fromElement)&&(ni(pe)||pe[Vi]))break e;(B||G)&&(pe=X.window===X?X:(G=X.ownerDocument)?G.defaultView||G.parentWindow:window,B?(G=i.relatedTarget||i.toElement,B=Y,G=G?ni(G):null,G!==null&&(Fe=u(G),ke=G.tag,G!==Fe||ke!==5&&ke!==27&&ke!==6)&&(G=null)):(B=null,G=Y),B!==G&&(ke=Ng,te="onMouseLeave",P="onMouseEnter",U="mouse",(e==="pointerout"||e==="pointerover")&&(ke=kg,te="onPointerLeave",P="onPointerEnter",U="pointer"),Fe=B==null?pe:fs(B),V=G==null?pe:fs(G),pe=new ke(te,U+"leave",B,i,X),pe.target=Fe,pe.relatedTarget=V,te=null,ni(X)===Y&&(ke=new ke(P,U+"enter",G,i,X),ke.target=V,ke.relatedTarget=Fe,te=ke),Fe=te,ke=B&&G?j(B,G,_2):null,B!==null&&wb(ne,pe,B,ke,!1),G!==null&&Fe!==null&&wb(ne,Fe,G,ke,!0)))}e:{if(B=Y?fs(Y):window,G=B.nodeName&&B.nodeName.toLowerCase(),G==="select"||G==="input"&&B.type==="file")var Ne=zg;else if(Rg(B))if(Dg)Ne=HN;else{Ne=UN;var We=LN}else G=B.nodeName,!G||G.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?Y&&pd(Y.elementType)&&(Ne=zg):Ne=qN;if(Ne&&(Ne=Ne(e,Y))){Mg(ne,Ne,i,X);break e}We&&We(e,B,Y)}switch(We=Y?fs(Y):window,e){case"focusin":(Rg(We)||We.contentEditable==="true")&&(tl=We,Od=Y,ws=null);break;case"focusout":ws=Od=tl=null;break;case"mousedown":Rd=!0;break;case"contextmenu":case"mouseup":case"dragend":Rd=!1,Fg(ne,i,X);break;case"selectionchange":if(IN)break;case"keydown":case"keyup":Fg(ne,i,X)}var Ae;if(kd)e:{switch(e){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else el?Ag(e,i)&&(_e="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(_e="onCompositionStart");_e&&(jg&&i.locale!=="ko"&&(el||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&el&&(Ae=wg()):(ma=X,vd="value"in ma?ma.value:ma.textContent,el=!0)),We=cc(Y,_e),0<We.length&&(_e=new Cg(_e,e,null,i,X),ne.push({event:_e,listeners:We}),Ae?_e.data=Ae:(Ae=Og(i),Ae!==null&&(_e.data=Ae)))),(Ae=RN?MN(e,i):zN(e,i))&&(_e=cc(Y,"onBeforeInput"),0<_e.length&&(We=new Cg("onBeforeInput","beforeinput",null,i,X),ne.push({event:We,listeners:_e}),We.data=Ae)),R2(ne,e,Y,i,X)}bb(ne,n)})}function Vs(e,n,i){return{instance:e,listener:n,currentTarget:i}}function cc(e,n){for(var i=n+"Capture",s=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=hs(e,i),f!=null&&s.unshift(Vs(e,f,h)),f=hs(e,n),f!=null&&s.push(Vs(e,f,h))),e.tag===3)return s;e=e.return}return[]}function _2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function wb(e,n,i,s,f){for(var h=n._reactName,v=[];i!==null&&i!==s;){var N=i,R=N.alternate,Y=N.stateNode;if(N=N.tag,R!==null&&R===s)break;N!==5&&N!==26&&N!==27||Y===null||(R=Y,f?(Y=hs(i,h),Y!=null&&v.unshift(Vs(i,Y,R))):f||(Y=hs(i,h),Y!=null&&v.push(Vs(i,Y,R)))),i=i.return}v.length!==0&&e.push({event:n,listeners:v})}var L2=/\r\n?/g,U2=/\u0000|\uFFFD/g;function Sb(e){return(typeof e=="string"?e:""+e).replace(L2,`
49
+ `).replace(U2,"")}function Nb(e,n){return n=Sb(n),Sb(e)===n}function xt(e,n,i,s,f,h){switch(i){case"children":if(typeof s=="string")n==="body"||n==="textarea"&&s===""||Zi(e,s);else if(typeof s=="number"||typeof s=="bigint")n!=="body"&&Zi(e,""+s);else return;break;case"className":ru(e,"class",s);break;case"tabIndex":ru(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ru(e,i,s);break;case"style":xg(e,s,h);return;case"data":if(n!=="object"){ru(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=au(s),e.setAttribute(i,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(i,"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 h=="function"&&(i==="formAction"?(n!=="input"&&xt(e,n,"name",f.name,f,null),xt(e,n,"formEncType",f.formEncType,f,null),xt(e,n,"formMethod",f.formMethod,f,null),xt(e,n,"formTarget",f.formTarget,f,null)):(xt(e,n,"encType",f.encType,f,null),xt(e,n,"method",f.method,f,null),xt(e,n,"target",f.target,f,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=au(s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=Er);return;case"onScroll":s!=null&&$e("scroll",e);return;case"onScrollEnd":s!=null&&$e("scrollend",e);return;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(i=s.__html,i!=null){if(f.children!=null)throw Error(l(60));(h!=null?h.__html:void 0)!==i&&(e.innerHTML=i)}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}i=au(s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,s):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":s===!0?e.setAttribute(i,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,s):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(i,s):e.removeAttribute(i);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(i):e.setAttribute(i,s);break;case"popover":$e("beforetoggle",e),$e("toggle",e),nu(e,"popover",s);break;case"xlinkActuate":Yr(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Yr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Yr(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Yr(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Yr(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Yr(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Yr(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Yr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Yr(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":nu(e,"is",s);break;case"innerText":case"textContent":return;default:if(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")i=nN.get(i)||i,nu(e,i,s);else return}st=!0}function mh(e,n,i,s,f,h){switch(i){case"style":xg(e,s,h);return;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(i=s.__html,i!=null){if(f.children!=null)throw Error(l(60));(h!=null?h.__html:void 0)!==i&&(e.innerHTML=i)}}break;case"children":if(typeof s=="string")Zi(e,s);else if(typeof s=="number"||typeof s=="bigint")Zi(e,""+s);else return;break;case"onScroll":s!=null&&$e("scroll",e);return;case"onScrollEnd":s!=null&&$e("scrollend",e);return;case"onClick":s!=null&&(e.onclick=Er);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!og.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),h=i.slice(2,f?i.length-7:void 0),n=e[En]||null,n=n!=null?n[i]:null,typeof n=="function"&&e.removeEventListener(h,n,f),typeof s=="function")){typeof n!="function"&&n!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(h,s,f);break e}st=!0,i in e?e[i]=s:s===!0?e.setAttribute(i,""):nu(e,i,s)}return}st=!0}function un(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$e("error",e),$e("load",e);var s=!1,f=!1,h;for(h in i)if(i.hasOwnProperty(h)){var v=i[h];if(v!=null)switch(h){case"src":s=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:xt(e,n,h,v,i,null)}}f&&xt(e,n,"srcSet",i.srcSet,i,null),s&&xt(e,n,"src",i.src,i,null);return;case"input":$e("invalid",e);var N=h=v=f=null,R=null,Y=null;for(s in i)if(i.hasOwnProperty(s)){var X=i[s];if(X!=null)switch(s){case"name":f=X;break;case"type":v=X;break;case"checked":R=X;break;case"defaultChecked":Y=X;break;case"value":h=X;break;case"defaultValue":N=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(l(137,n));break;default:xt(e,n,s,X,i,null)}}mg(e,h,N,R,Y,v,f,!1);return;case"select":$e("invalid",e),s=v=h=null;for(f in i)if(i.hasOwnProperty(f)&&(N=i[f],N!=null))switch(f){case"value":h=N;break;case"defaultValue":v=N;break;case"multiple":s=N;default:xt(e,n,f,N,i,null)}n=h,i=v,e.multiple=!!s,n!=null?$i(e,!!s,n,!1):i!=null&&$i(e,!!s,i,!0);return;case"textarea":$e("invalid",e),h=f=s=null;for(v in i)if(i.hasOwnProperty(v)&&(N=i[v],N!=null))switch(v){case"value":s=N;break;case"defaultValue":f=N;break;case"children":h=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(l(91));break;default:xt(e,n,v,N,i,null)}gg(e,s,f,h);return;case"option":for(R in i)if(i.hasOwnProperty(R)&&(s=i[R],s!=null))switch(R){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:xt(e,n,R,s,i,null)}return;case"dialog":$e("beforetoggle",e),$e("toggle",e),$e("cancel",e),$e("close",e);break;case"iframe":case"object":$e("load",e);break;case"video":case"audio":for(s=0;s<Ys.length;s++)$e(Ys[s],e);break;case"image":$e("error",e),$e("load",e);break;case"details":$e("toggle",e);break;case"embed":case"source":case"link":$e("error",e),$e("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in i)if(i.hasOwnProperty(Y)&&(s=i[Y],s!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:xt(e,n,Y,s,i,null)}return;default:if(pd(n)){for(X in i)i.hasOwnProperty(X)&&(s=i[X],s!==void 0&&mh(e,n,X,s,i,void 0));return}}for(N in i)i.hasOwnProperty(N)&&(s=i[N],s!=null&&xt(e,n,N,s,i,null))}var q2={};function H2(e,n,i,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,v=null,N=null,R=null,Y=null,X=null;for(G in i){var ne=i[G];if(i.hasOwnProperty(G)&&ne!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":R=ne;default:s.hasOwnProperty(G)||xt(e,n,G,null,s,ne)}}for(var B in s){var G=s[B];if(ne=i[B],s.hasOwnProperty(B)&&(G!=null||ne!=null))switch(B){case"type":G!==ne&&(st=!0),h=G;break;case"name":G!==ne&&(st=!0),f=G;break;case"checked":G!==ne&&(st=!0),Y=G;break;case"defaultChecked":G!==ne&&(st=!0),X=G;break;case"value":G!==ne&&(st=!0),v=G;break;case"defaultValue":G!==ne&&(st=!0),N=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(l(137,n));break;default:G!==ne&&xt(e,n,B,G,s,ne)}}hd(e,v,N,R,Y,X,h,f);return;case"select":G=v=N=B=null;for(h in i)if(R=i[h],i.hasOwnProperty(h)&&R!=null)switch(h){case"value":break;case"multiple":G=R;default:s.hasOwnProperty(h)||xt(e,n,h,null,s,R)}for(f in s)if(h=s[f],R=i[f],s.hasOwnProperty(f)&&(h!=null||R!=null))switch(f){case"value":h!==R&&(st=!0),B=h;break;case"defaultValue":h!==R&&(st=!0),N=h;break;case"multiple":h!==R&&(st=!0),v=h;default:h!==R&&xt(e,n,f,h,s,R)}n=N,i=v,s=G,B!=null?$i(e,!!i,B,!1):!!s!=!!i&&(n!=null?$i(e,!!i,n,!0):$i(e,!!i,i?[]:"",!1));return;case"textarea":G=B=null;for(N in i)if(f=i[N],i.hasOwnProperty(N)&&f!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:xt(e,n,N,null,s,f)}for(v in s)if(f=s[v],h=i[v],s.hasOwnProperty(v)&&(f!=null||h!=null))switch(v){case"value":f!==h&&(st=!0),B=f;break;case"defaultValue":f!==h&&(st=!0),G=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==h&&xt(e,n,v,f,s,h)}pg(e,B,G);return;case"option":for(var pe in i)if(B=i[pe],i.hasOwnProperty(pe)&&B!=null&&!s.hasOwnProperty(pe))switch(pe){case"selected":e.selected=!1;break;default:xt(e,n,pe,null,s,B)}for(R in s)if(B=s[R],G=i[R],s.hasOwnProperty(R)&&B!==G&&(B!=null||G!=null))switch(R){case"selected":B!==G&&(st=!0),e.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:xt(e,n,R,B,s,G)}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 i)B=i[ke],i.hasOwnProperty(ke)&&B!=null&&!s.hasOwnProperty(ke)&&xt(e,n,ke,null,s,B);for(Y in s)if(B=s[Y],G=i[Y],s.hasOwnProperty(Y)&&B!==G&&(B!=null||G!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(l(137,n));break;default:xt(e,n,Y,B,s,G)}return;default:if(pd(n)){for(var Fe in i)B=i[Fe],i.hasOwnProperty(Fe)&&B!==void 0&&!s.hasOwnProperty(Fe)&&mh(e,n,Fe,void 0,s,B);for(X in s)B=s[X],G=i[X],!s.hasOwnProperty(X)||B===G||B===void 0&&G===void 0||mh(e,n,X,B,s,G);return}}for(var P in i)B=i[P],i.hasOwnProperty(P)&&B!=null&&!s.hasOwnProperty(P)&&xt(e,n,P,null,s,B);for(ne in s)B=s[ne],G=i[ne],!s.hasOwnProperty(ne)||B===G||B==null&&G==null||xt(e,n,ne,B,s,G)}function Cb(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function B2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),s=0;s<i.length;s++){var f=i[s],h=f.transferSize,v=f.initiatorType,N=f.duration;if(h&&N&&Cb(v)){for(v=0,N=f.responseEnd,s+=1;s<i.length;s++){var R=i[s],Y=R.startTime;if(Y>N)break;var X=R.transferSize,ne=R.initiatorType;X&&Cb(ne)&&(R=R.responseEnd,v+=X*(R<N?1:(N-Y)/(R-Y)))}if(--s,n+=8*(h+v)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ph=null,gh=null;function Gs(e){return e.nodeType===9?e:e.ownerDocument}function kb(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jb(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Eb(e,n,i,s){return i=Gs(i).createElement(e),i[rn]=s,i[En]=n,un(i,e,n),Jt(i),i}function yh(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var xh=null;function I2(){var e=window.event;return e&&e.type==="popstate"?e===xh?!1:(xh=e,!0):(xh=null,!1)}var bh=typeof setTimeout=="function"?setTimeout:void 0,F2=typeof clearTimeout=="function"?clearTimeout:void 0,Tb=typeof Promise=="function"?Promise:void 0,Ab=typeof requestAnimationFrame=="function"?requestAnimationFrame:bh,P2=typeof queueMicrotask=="function"?queueMicrotask:typeof Tb<"u"?function(e){return Tb.resolve(null).then(e).catch(Q2)}:bh;function Q2(e){setTimeout(function(){throw e})}function Da(e){return e==="head"}function Ob(e,n){var i=n,s=0;do{var f=i.nextSibling;if(e.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(s===0){e.removeChild(f),Dl(n);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")Eh(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Eh(i);for(var h=i.firstChild;h;){var v=h.nextSibling,N=h.nodeName;h[ds]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=v}}else i==="body"&&Eh(e.ownerDocument.body);i=f}while(i);Dl(n)}function Rb(e,n){var i=e;e=0;do{var s=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=s}while(i)}function Mb(e,n,i){if(n=CSS.escape(n)!==n?"r-"+btoa(n).replace(/=/g,""):n,e.style.viewTransitionName=n,i!=null&&(e.style.viewTransitionClass=i),i=getComputedStyle(e),i.display==="inline"){if(n=e.getClientRects(),n.length===1)var s=1;else for(var f=s=0;f<n.length;f++){var h=n[f];0<h.width&&0<h.height&&s++}s===1&&(e=e.style,e.display=n.length===1?"inline-block":"block",e.marginTop="-"+i.paddingTop,e.marginBottom="-"+i.paddingBottom)}}function zb(e,n){e=e.style,n=n.style;var i=n!=null?n.hasOwnProperty("viewTransitionName")?n.viewTransitionName:n.hasOwnProperty("view-transition-name")?n["view-transition-name"]:null:null;e.viewTransitionName=i==null||typeof i=="boolean"?"":(""+i).trim(),i=n!=null?n.hasOwnProperty("viewTransitionClass")?n.viewTransitionClass:n.hasOwnProperty("view-transition-class")?n["view-transition-class"]:null:null,e.viewTransitionClass=i==null||typeof i=="boolean"?"":(""+i).trim(),e.display==="inline-block"&&(n==null?e.display=e.margin="":(i=n.display,e.display=i==null||typeof i=="boolean"?"":i,i=n.margin,i!=null?e.margin=i:(i=n.hasOwnProperty("marginTop")?n.marginTop:n["margin-top"],e.marginTop=i==null||typeof i=="boolean"?"":i,n=n.hasOwnProperty("marginBottom")?n.marginBottom:n["margin-bottom"],e.marginBottom=n==null||typeof n=="boolean"?"":n)))}function Y2(e,n,i){return i=i.ownerDocument.defaultView,{rect:e,abs:n.position==="absolute"||n.position==="fixed",clip:n.clipPath!=="none"||n.overflow!=="visible"||n.filter!=="none"||n.mask!=="none"||n.mask!=="none"||n.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=i.innerHeight&&e.left<=i.innerWidth}}function vh(e){var n=e.getBoundingClientRect(),i=getComputedStyle(e);return Y2(n,i,e)}function V2(e){return e.documentElement.clientHeight}function G2(e){this.addEventListener("load",e),this.addEventListener("error",e)}function K2(e,n,i,s,f,h,v,N,R){var Y=n.nodeType===9?n:n.ownerDocument;try{var X=Y.startViewTransition({update:function(){var B=Y.defaultView,G=B.navigation&&B.navigation.transition,pe=Y.fonts.status;s();var ke=[];if(pe==="loaded"&&(V2(Y),Y.fonts.status==="loading"&&ke.push(Y.fonts.ready)),pe=ke.length,e!==null)for(var Fe=e.suspenseyImages,P=0,U=0;U<Fe.length;U++){var V=Fe[U];if(!V.complete){var te=V.getBoundingClientRect();if(0<te.bottom&&0<te.right&&te.top<B.innerHeight&&te.left<B.innerWidth){if(P+=ev(V),P>hc){ke.length=pe;break}V=new Promise(G2.bind(V)),ke.push(V)}}}if(0<ke.length)return B=Promise.race([Promise.all(ke),new Promise(function(Ne){return setTimeout(Ne,500)})]).then(f,f),(G?Promise.allSettled([G.finished,B]):B).then(h,h);if(f(),G)return G.finished.then(h,h);h()},types:i});Y.__reactViewTransition=X;var ne=[];return X.ready.then(function(){for(var B=Y.documentElement.getAnimations({subtree:!0}),G=0;G<B.length;G++){var pe=B[G],ke=pe.effect,Fe=ke.pseudoElement;if(Fe!=null&&Fe.startsWith("::view-transition")){ne.push(pe),pe=ke.getKeyframes();for(var P=Fe=void 0,U=!0,V=0;V<pe.length;V++){var te=pe[V],Ne=te.width;if(Fe===void 0)Fe=Ne;else if(Fe!==Ne){U=!1;break}if(Ne=te.height,P===void 0)P=Ne;else if(P!==Ne){U=!1;break}delete te.width,delete te.height,te.transform==="none"&&delete te.transform}U&&Fe!==void 0&&P!==void 0&&(ke.setKeyframes(pe),U=getComputedStyle(ke.target,ke.pseudoElement),U.width!==Fe||U.height!==P)&&(U=pe[0],U.width=Fe,U.height=P,U=pe[pe.length-1],U.width=Fe,U.height=P,ke.setKeyframes(pe))}}v()},function(B){Y.__reactViewTransition===X&&(Y.__reactViewTransition=null);try{if(typeof B=="object"&&B!==null)switch(B.name){case"InvalidStateError":(B.message==="View transition was skipped because document visibility state is hidden."||B.message==="Skipping view transition because document visibility state has become hidden."||B.message==="Skipping view transition because viewport size changed."||B.message==="Transition was aborted because of invalid state")&&(B=null)}B!==null&&R(B)}finally{s(),f(),v()}}),X.finished.finally(function(){for(var B=0;B<ne.length;B++)ne[B].cancel();Y.__reactViewTransition===X&&(Y.__reactViewTransition=null),N()}),X}catch{return s(),f(),v(),null}}function Ni(e,n){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+n+")"}Ni.prototype.animate=function(e,n){return n=typeof n=="number"?{duration:n}:L({},n),n.pseudoElement=this._selector,this._scope.animate(e,n)},Ni.prototype.getAnimations=function(){for(var e=this._scope,n=this._selector,i=e.getAnimations({subtree:!0}),s=[],f=0;f<i.length;f++){var h=i[f].effect;h!==null&&h.target===e&&h.pseudoElement===n&&s.push(i[f])}return s},Ni.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Db(e){return{name:e,group:new Ni("group",e),imagePair:new Ni("image-pair",e),old:new Ni("old",e),new:new Ni("new",e)}}function Gn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Gn.prototype.addEventListener=function(e,n,i){var s=null,f=null;if(!(i!=null&&typeof i!="boolean"&&(s=i.signal||null,s!==null&&s.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var h=this._eventListeners;if(Lb(h,e,n,i)===-1){var v=this,N=n;i!=null&&typeof i!="boolean"&&i.once===!0&&(N=function(R){v.removeEventListener(e,n,i),typeof n=="function"?n.call(this,R):n.handleEvent(R)}),s!==null&&(f=v.removeEventListener.bind(v,e,n,i),s.addEventListener("abort",f,{once:!0}),f=s.removeEventListener.bind(s,"abort",f)),s=Tl(i),h.push({type:e,listener:n,optionsOrUseCapture:i,attachedListener:N,cleanup:f}),g(this._fragmentFiber.child,!1,X2,e,N,s)}this._eventListeners=h}};function X2(e,n,i,s){return E(e).addEventListener(n,i,s),!1}Gn.prototype.removeEventListener=function(e,n,i){var s=this._eventListeners;if(s!==null&&(n=Lb(s,e,n,i),n!==-1)){var f=s[n];i=f.attachedListener;var h=f.cleanup;f=Tl(f.optionsOrUseCapture),g(this._fragmentFiber.child,!1,$2,e,i,f),s.splice(n,1),h!==null&&h()}};function $2(e,n,i,s){return E(e).removeEventListener(n,i,s),!1}function Tl(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function _b(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Lb(e,n,i,s){if(e.length===0)return-1;s=_b(s);for(var f=0;f<e.length;f++){var h=e[f];if(h.type===n&&h.listener===i&&_b(h.optionsOrUseCapture)===s)return f}return-1}Gn.prototype.dispatchEvent=function(e){var n=b(this._fragmentFiber);if(n===null)return!0;n=E(n);var i=this._eventListeners;if(i!==null&&0<i.length||!e.bubbles){var s=n.nodeType===9?n.createComment(""):document.createTextNode("");if(i)for(var f=0;f<i.length;f++){var h=i[f];s.addEventListener(h.type,h.attachedListener,Tl(h.optionsOrUseCapture))}if(n.appendChild(s),e=s.dispatchEvent(e),i)for(f=0;f<i.length;f++)h=i[f],s.removeEventListener(h.type,h.attachedListener,Tl(h.optionsOrUseCapture));return n.removeChild(s),e}return n.dispatchEvent(e)},Gn.prototype.focus=function(e){g(this._fragmentFiber.child,!0,Ub,e,void 0,void 0)};function Ub(e,n){return e.tag===6?!1:(e=E(e),oC(e,n))}Gn.prototype.focusLast=function(e){var n=[];g(this._fragmentFiber.child,!0,wh,n,void 0,void 0);for(var i=n.length-1;0<=i&&!Ub(n[i],e);i--);};function wh(e,n){return n.push(e),!1}Gn.prototype.blur=function(){var e=b(this._fragmentFiber);e!==null&&(e=E(e),e=Gs(e).activeElement,e!==null&&g(this._fragmentFiber.child,!1,Z2,e,void 0,void 0))};function Z2(e,n){return e.tag===6?!1:(e=E(e),e===n||e.contains(n)?(n.blur(),!0):!1)}Gn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),g(this._fragmentFiber.child,!1,J2,e,void 0,void 0)};function J2(e,n){return e.tag===6||(e=E(e),n.observe(e)),!1}Gn.prototype.unobserveUsing=function(e){var n=this._observers;if(n!==null&&n.has(e)){n.delete(e),g(this._fragmentFiber.child,!1,W2,e,void 0,void 0);for(var i=n=0;i<vr.length;i++){var s=vr[i];s.fragmentInstance===this&&s.observer===e?e.unobserve(s.instance):vr[n++]=s}vr.length=n}};function W2(e,n){return e.tag===6||(e=E(e),n.unobserve(e)),!1}var vr=[],Sh=!1;function eC(e,n,i){vr.push({fragmentInstance:e,observer:n,instance:i}),Sh||(Sh=!0,uC(function(){Sh=!1;var s=vr;vr=[];for(var f=0;f<s.length;f++){var h=s[f];h.observer.unobserve(h.instance)}}))}Gn.prototype.getClientRects=function(){var e=[];return g(this._fragmentFiber.child,!1,tC,e,void 0,void 0),e};function tC(e,n){if(e.tag===6){e=e.stateNode;var i=e.ownerDocument.createRange();i.selectNodeContents(e),n.push.apply(n,i.getClientRects())}else e=E(e),n.push.apply(n,e.getClientRects());return!1}Gn.prototype.getRootNode=function(e){var n=b(this._fragmentFiber);return n===null?this:E(n).getRootNode(e)},Gn.prototype.compareDocumentPosition=function(e){var n=b(this._fragmentFiber);if(n===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var i=[];g(this._fragmentFiber.child,!1,wh,i,void 0,void 0);var s=E(n);if(i.length===0){if(i=s,w(this._fragmentFiber)){e:{for(n=this._fragmentFiber.return;n!==null;){if(n.tag===4){n=n.stateNode.containerInfo;break e}if(n.tag===3||n.tag===5||n.tag===27)break;n=n.return}n=null}n!=null&&(i=n)}n=this._fragmentFiber;var f=s=i.compareDocumentPosition(e);return i===e?f=Node.DOCUMENT_POSITION_CONTAINS:s&Node.DOCUMENT_POSITION_CONTAINED_BY&&(i=C(n)[1],i===null?f=Node.DOCUMENT_POSITION_PRECEDING:(e=E(i).compareDocumentPosition(e),f=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),f|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}n=E(i[0]),f=E(i[i.length-1]);var h=w(this._fragmentFiber)?n.parentElement:s;if(h==null)return Node.DOCUMENT_POSITION_DISCONNECTED;s=h.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY,h=h.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_CONTAINED_BY;var v=n.compareDocumentPosition(e),N=f.compareDocumentPosition(e),R=v&Node.DOCUMENT_POSITION_CONTAINED_BY||N&Node.DOCUMENT_POSITION_CONTAINED_BY;return N=s&&h&&v&Node.DOCUMENT_POSITION_FOLLOWING&&N&Node.DOCUMENT_POSITION_PRECEDING,n=s&&n===e||h&&f===e||R||N?Node.DOCUMENT_POSITION_CONTAINED_BY:!s&&n===e||!h&&f===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:v,n&Node.DOCUMENT_POSITION_DISCONNECTED||n&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||nC(n,this._fragmentFiber,i[0],i[i.length-1],e)?n:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function nC(e,n,i,s,f){var h=ni(f);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(i=!!h)e:{for(;h!==null;){if(h.tag===7&&(h===n||h.alternate===n)){i=!0;break e}h=h.return}i=!1}return i}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(h===null)return h=f.ownerDocument,f===h||f===h.documentElement||f===h.body;e:{for(h=n,n=b(n);h!==null;){if(!(h.tag!==5&&h.tag!==3&&h.tag!==27||h!==n&&h.alternate!==n)){h=!0;break e}h=h.return}h=!1}return h}return e&Node.DOCUMENT_POSITION_PRECEDING?((n=!!h)&&!(n=h===i)&&(n=j(i,h,Q),n===null?n=!1:(g(n,!0,M,h,i),h=k,k=null,n=h!==null)),n):e&Node.DOCUMENT_POSITION_FOLLOWING?((n=!!h)&&!(n=h===s)&&(n=j(s,h,Q),n===null?n=!1:(g(n,!0,F,h,s),h=k,A=k=null,n=h!==null)),n):!1}function qb(e,n){var i=e.ownerDocument.createRange();i.selectNodeContents(e),e=i.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,n?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Gn.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(l(566));var n=[];g(this._fragmentFiber.child,!1,wh,n,void 0,void 0);var i=e!==!1;if(n.length===0){var s=C(this._fragmentFiber);if(s=i?s[1]||s[0]||b(this._fragmentFiber):s[0]||s[1],s===null)return;if(s.tag===6){e=E(s),qb(e,i);return}if(s=E(s),s.nodeType!==9){if(s.nodeType===11){i="host"in s?s.host:null,i!==null&&i.scrollIntoView(e);return}s.scrollIntoView(e)}}for(s=i?n.length-1:0;s!==(i?-1:n.length);){var f=n[s];f.tag===6?(f=E(f),qb(f,i)):E(f).scrollIntoView(e),s+=i?-1:1}};function rC(e,n){return e=E(e),Hb(e,n),!1}function Hb(e,n){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(n)}function Bb(e,n){var i=n._eventListeners;if(i!==null)for(var s=0;s<i.length;s++){var f=i[s];e.addEventListener(f.type,f.attachedListener,Tl(f.optionsOrUseCapture))}e.nodeType!==3&&(i=n._observers,i!==null&&i.forEach(function(h){for(var v=0,N=0;N<vr.length;N++){var R=vr[N];(R.fragmentInstance!==n||R.observer!==h||R.instance!==e)&&(vr[v++]=R)}vr.length=v,h.observe(e)}),Hb(e,n))}function aC(e,n){var i=n._eventListeners;if(i!==null)for(var s=0;s<i.length;s++){var f=i[s];e.removeEventListener(f.type,f.attachedListener,Tl(f.optionsOrUseCapture))}e.nodeType!==3&&(i=n._observers,i!==null&&i.forEach(function(h){typeof h.rootMargin=="string"?eC(n,h,e):h.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(n))}function Nh(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Nh(i),tu(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function iC(e,n,i,s){for(;e.nodeType===1;){var f=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ds])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=lr(e.nextSibling),e===null)break}return null}function lC(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=lr(e.nextSibling),e===null))return null;return e}function Ib(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=lr(e.nextSibling),e===null))return null;return e}function Ch(e){return e.data==="$?"||e.data==="$~"}function kh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function sC(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var s=function(){n(),i.removeEventListener("DOMContentLoaded",s)};i.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function lr(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var jh=null;function Fb(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return lr(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function Pb(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function oC(e,n){function i(){s=!0}if(e.ownerDocument.activeElement===e)return!0;var s=!1;try{e.ownerDocument.addEventListener("focus",i,!0),(e.focus||HTMLElement.prototype.focus).call(e,n)}finally{e.ownerDocument.removeEventListener("focus",i,!0)}return s}function uC(e){Ab(function(){Ab(function(n){return e(n)})})}function Qb(e,n,i){switch(n=Gs(i),e){case"html":if(e=n.documentElement,!e)throw Error(l(452));return e;case"head":if(e=n.head,!e)throw Error(l(453));return e;case"body":if(e=n.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Yb(e,n,i){for(var s in i){var f=i[s];i.hasOwnProperty(s)&&f!=null&&xt(e,n,s,null,q2,f)}i.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Er&&(e.onclick=null),tu(e)}function Eh(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);tu(e)}var sr=new Map,Vb=new Set;function Ks(e){if(typeof e.getRootNode=="function"){var n=e.getRootNode();if(n.nodeType===9||n.nodeType===11)return n}return e.nodeType===9?e:e.ownerDocument}var aa=je.d;je.d={f:cC,r:dC,D:fC,C:hC,L:mC,m:pC,X:yC,S:gC,M:xC};function cC(){var e=aa.f(),n=ac();return e||n}function dC(e){var n=Gi(e);n!==null&&n.tag===5&&n.type==="form"?Ky(n):aa.r(e)}var Al=typeof document>"u"?null:document;function Gb(e,n,i){var s=Al;if(s&&typeof n=="string"&&n){var f=Wn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),Vb.has(f)||(Vb.add(f),e={rel:e,crossOrigin:i,href:n},s.querySelector(f)===null&&(n=s.createElement("link"),un(n,"link",e),Jt(n),s.head.appendChild(n)))}}function fC(e){aa.D(e),Gb("dns-prefetch",e,null)}function hC(e,n){aa.C(e,n),Gb("preconnect",e,n)}function mC(e,n,i){aa.L(e,n,i);var s=Al;if(s&&e&&n){var f='link[rel="preload"][as="'+Wn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+Wn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+Wn(i.imageSizes)+'"]')):f+='[href="'+Wn(e)+'"]';var h=f;switch(n){case"style":h=Ol(e);break;case"script":h=Rl(e)}if(!(sr.has(h)||(e=L({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),sr.set(h,e),s.querySelector(f)!==null||n==="style"&&s.querySelector(Xs(h))||n==="script"&&s.querySelector($s(h))))){var v=s.createElement("link");un(v,"link",e),n==="style"&&(v[eu]=!0,v.onload=v.onerror=function(){lg(v)}),Jt(v),s.head.appendChild(v)}}}function pC(e,n){aa.m(e,n);var i=Al;if(i&&e){var s=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Wn(s)+'"][href="'+Wn(e)+'"]',h=f;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Rl(e)}if(!sr.has(h)&&(e=L({rel:"modulepreload",href:e},n),sr.set(h,e),i.querySelector(f)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector($s(h)))return}s=i.createElement("link"),un(s,"link",e),Jt(s),i.head.appendChild(s)}}}function gC(e,n,i){aa.S(e,n,i);var s=Al;if(s&&e){var f=Ki(s).hoistableStyles,h=Ol(e);n=n||"default";var v=f.get(h);if(!v){var N={loading:0,preload:null};if(v=s.querySelector(Xs(h)))N.loading=5;else{e=L({rel:"stylesheet",href:e,"data-precedence":n},i),(i=sr.get(h))&&Th(e,i);var R=v=s.createElement("link");Jt(R),un(R,"link",e),R._p=new Promise(function(Y,X){R.onload=Y,R.onerror=X}),R.addEventListener("load",function(){N.loading|=1}),R.addEventListener("error",function(){N.loading|=2}),N.loading|=4,dc(v,n,s)}v={type:"stylesheet",instance:v,count:1,state:N},f.set(h,v)}}}function yC(e,n){aa.X(e,n);var i=Al;if(i&&e){var s=Ki(i).hoistableScripts,f=Rl(e),h=s.get(f);h||(h=i.querySelector($s(f)),h||(e=L({src:e,async:!0},n),(n=sr.get(f))&&Ah(e,n),h=i.createElement("script"),Jt(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},s.set(f,h))}}function xC(e,n){aa.M(e,n);var i=Al;if(i&&e){var s=Ki(i).hoistableScripts,f=Rl(e),h=s.get(f);h||(h=i.querySelector($s(f)),h||(e=L({src:e,async:!0,type:"module"},n),(n=sr.get(f))&&Ah(e,n),h=i.createElement("script"),Jt(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},s.set(f,h))}}function Kb(e,n,i,s){var f=(f=Ct.current)?Ks(f):null;if(!f)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=Ol(i.href),n=Ki(f).hoistableStyles,s=n.get(i),s||(s={type:"style",instance:null,count:0,state:null},n.set(i,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Ol(i.href);var h=Ki(f).hoistableStyles,v=h.get(e);if(v||(f=f.ownerDocument||f,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,v),(h=f.querySelector(Xs(e)))?h._p||(v.instance=h,v.state.loading=5):(h=sr.get(e),h||(h={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},sr.set(e,h)),bC(f,e,h,v.state))),n&&s===null)throw Error(l(528,""));return v}if(n&&s!==null)throw Error(l(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(i=Rl(i),n=Ki(f).hoistableScripts,s=n.get(i),s||(s={type:"script",instance:null,count:0,state:null},n.set(i,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Ol(e){return'href="'+Wn(e)+'"'}function Xs(e){return'link[rel="stylesheet"]['+e+"]"}function Xb(e){return L({},e,{"data-precedence":e.precedence,precedence:null})}function bC(e,n,i,s){if(n=e.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[eu]!==!0){s.loading=1;return}}else n=e.createElement("link"),n[eu]=!0,n.onload=n.onerror=lg.bind(null,n),un(n,"link",i),Jt(n),e.head.appendChild(n);s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2})}function Rl(e){return'[src="'+Wn(e)+'"]'}function $s(e){return"script[async]"+e}function $b(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Wn(i.href)+'"]');if(s)return n.instance=s,Jt(s),s;var f=L({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Jt(s),un(s,"style",f),dc(s,i.precedence,e),n.instance=s;case"stylesheet":f=Ol(i.href);var h=e.querySelector(Xs(f));if(h)return n.state.loading|=4,n.instance=h,Jt(h),h;s=Xb(i),(f=sr.get(f))&&Th(s,f),h=(e.ownerDocument||e).createElement("link"),Jt(h);var v=h;return v._p=new Promise(function(N,R){v.onload=N,v.onerror=R}),un(h,"link",s),n.state.loading|=4,dc(h,i.precedence,e),n.instance=h;case"script":return h=Rl(i.src),(f=e.querySelector($s(h)))?(n.instance=f,Jt(f),f):(s=i,(f=sr.get(h))&&(s=L({},i),Ah(s,f)),e=e.ownerDocument||e,f=e.createElement("script"),Jt(f),un(f,"link",s),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,dc(s,i.precedence,e));return n.instance}function dc(e,n,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=s.length?s[s.length-1]:null,h=f,v=0;v<s.length;v++){var N=s[v];if(N.dataset.precedence===n)h=N;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function Th(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Ah(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var fc=null;function Zb(e,n,i){if(fc===null){var s=new Map,f=fc=new Map;f.set(i,s)}else f=fc,s=f.get(i),s||(s=new Map,f.set(i,s));if(s.has(e))return s;for(s.set(e,null),i=i.getElementsByTagName(e),f=0;f<i.length;f++){var h=i[f];if(!(h[ds]||h[rn]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var v=h.getAttribute(n)||"";v=e+v;var N=s.get(v);N?N.push(h):s.set(v,[h])}}return s}function Oh(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function vC(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Jb(e,n){return e==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function Wb(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ev(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function tv(e,n){typeof n.decode=="function"&&(e.imgCount++,n.complete||(e.imgBytes+=ev(n),e.suspenseyImages.push(n)),e=NC.bind(e),n.decode().then(e,e))}function wC(e,n,i,s){if(i.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=Ol(s.href),h=n.querySelector(Xs(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Zs.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=h,Jt(h);return}h=n.ownerDocument||n,s=Xb(s),(f=sr.get(f))&&Th(s,f),h=h.createElement("link"),Jt(h);var v=h;v._p=new Promise(function(N,R){v.onload=N,v.onerror=R}),un(h,"link",s),i.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Zs.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var hc=0;function SC(e,n){return e.stylesheets&&e.count===0&&pc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&pc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&hc===0&&(hc=62500*B2());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&pc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>hc?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(f)}}:null}function nv(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)pc(e,e.stylesheets);else if(e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}}}function Zs(){this.count--,nv(this)}function NC(){this.imgCount--,nv(this)}var mc=null;function pc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,mc=new Map,n.forEach(CC,e),mc=null,Zs.call(e))}function CC(e,n){if(!(n.state.loading&4)){var i=mc.get(e);if(i)var s=i.get(null);else{i=new Map,mc.set(e,i);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var v=f[h];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(i.set(v.dataset.precedence,v),s=v)}s&&i.set(null,s)}f=n.instance,v=f.getAttribute("data-precedence"),h=i.get(v)||s,h===s&&i.set(null,f),i.set(v,f),this.count++,s=Zs.bind(this),f.addEventListener("load",s),f.addEventListener("error",s),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Ml={$$typeof:re,Provider:null,Consumer:null,_currentValue:Tt,_currentValue2:Tt,_threadCount:0};function kC(e,n,i,s,f,h,v,N,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ud(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ud(0),this.hiddenUpdates=ud(null),this.identifierPrefix=s,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.transitionTypes=null,this.incompleteTransitions=new Map}function rv(e,n,i,s,f,h,v,N,R,Y,X,ne){return e=new kC(e,n,i,v,R,Y,X,ne,N),n=1,h===!0&&(n|=24),h=Tn(3,null,null,n),e.current=h,h.stateNode=e,n=Qd(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:s,isDehydrated:i,cache:n},Kd(h),e}function av(e){return e?(e=al,e):al}function iv(e,n,i,s,f,h){f=av(f),s.context===null?s.context=f:s.pendingContext=f,s=Sa(n),s.payload={element:i},h=h===void 0?null:h,h!==null&&(s.callback=h),i=Na(e,s,n),i!==null&&(Mn(i,e,n),Ts(i,e,n))}function lv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Rh(e,n){lv(e,n),(e=e.alternate)&&lv(e,n)}function sv(e){if(e.tag===13||e.tag===31){var n=li(e,67108864);n!==null&&Mn(n,e,67108864),Rh(e,67108864)}}function ov(e){if(e.tag===13||e.tag===31){var n=Vn();n=cd(n);var i=li(e,n);i!==null&&Mn(i,e,n),Rh(e,n)}}var zl=!0;function jC(e,n,i,s){var f=ye.T;ye.T=null;var h=je.p;try{je.p=2,Mh(e,n,i,s)}finally{je.p=h,ye.T=f}}function EC(e,n,i,s){var f=ye.T;ye.T=null;var h=je.p;try{je.p=8,Mh(e,n,i,s)}finally{je.p=h,ye.T=f}}function Mh(e,n,i,s){if(zl){var f=zh(s);if(f===null)hh(e,n,s,gc,i),cv(e,s);else if(AC(f,e,n,i,s))s.stopPropagation();else if(cv(e,s),n&4&&-1<TC.indexOf(e)){for(;f!==null;){var h=Gi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=ti(h.pendingLanes);if(v!==0){var N=h;for(N.pendingLanes|=2,N.entangledLanes|=2;v;){var R=1<<31-Hn(v);N.entanglements[1]|=R,v&=~R}Ur(h),(dt&6)===0&&(tc=H()+500,Qs(0))}}break;case 31:case 13:N=li(h,2),N!==null&&Mn(N,h,2),ac(),Rh(h,2)}if(h=zh(s),h===null&&hh(e,n,s,gc,i),h===f)break;f=h}f!==null&&s.stopPropagation()}else hh(e,n,s,null,i)}}function zh(e){return e=yd(e),Dh(e)}var gc=null;function Dh(e){if(gc=null,e=ni(e),e!==null){var n=u(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=d(n),e!==null)return e;e=null}else if(i===31){if(e=m(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return gc=e,null}function uv(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ve()){case we:return 2;case Ee:return 8;case ct:case Un:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var _h=!1,_a=null,La=null,Ua=null,Js=new Map,Ws=new Map,qa=[],TC="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 cv(e,n){switch(e){case"focusin":case"focusout":_a=null;break;case"dragenter":case"dragleave":La=null;break;case"mouseover":case"mouseout":Ua=null;break;case"pointerover":case"pointerout":Js.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ws.delete(n.pointerId)}}function eo(e,n,i,s,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:s,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Gi(n),n!==null&&sv(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function AC(e,n,i,s,f){switch(n){case"focusin":return _a=eo(_a,e,n,i,s,f),!0;case"dragenter":return La=eo(La,e,n,i,s,f),!0;case"mouseover":return Ua=eo(Ua,e,n,i,s,f),!0;case"pointerover":var h=f.pointerId;return Js.set(h,eo(Js.get(h)||null,e,n,i,s,f)),!0;case"gotpointercapture":return h=f.pointerId,Ws.set(h,eo(Ws.get(h)||null,e,n,i,s,f)),!0}return!1}function dv(e){var n=ni(e.target);if(n!==null){var i=u(n);if(i!==null){if(n=i.tag,n===13){if(n=d(i),n!==null){e.blockedOn=n,rg(e.priority,function(){ov(i)});return}}else if(n===31){if(n=m(i),n!==null){e.blockedOn=n,rg(e.priority,function(){ov(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=zh(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);gd=s,i.target.dispatchEvent(s),gd=null}else return n=Gi(i),n!==null&&sv(n),e.blockedOn=i,!1;n.shift()}return!0}function fv(e,n,i){yc(e)&&i.delete(n)}function OC(){_h=!1,_a!==null&&yc(_a)&&(_a=null),La!==null&&yc(La)&&(La=null),Ua!==null&&yc(Ua)&&(Ua=null),Js.forEach(fv),Ws.forEach(fv)}function xc(e,n){e.blockedOn===n&&(e.blockedOn=null,_h||(_h=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,OC)))}var bc=null;function hv(e){bc!==e&&(bc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){bc===e&&(bc=null);for(var n=0;n<e.length;n+=3){var i=e[n],s=e[n+1],f=e[n+2];if(typeof s!="function"){if(Dh(s||i)===null)continue;break}var h=Gi(i);h!==null&&(e.splice(n,3),n-=3,gf(h,{pending:!0,data:f,method:i.method,action:s},s,f))}}))}function Dl(e){function n(R){return xc(R,e)}_a!==null&&xc(_a,e),La!==null&&xc(La,e),Ua!==null&&xc(Ua,e),Js.forEach(n),Ws.forEach(n);for(var i=0;i<qa.length;i++){var s=qa[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<qa.length&&(i=qa[0],i.blockedOn===null);)dv(i),i.blockedOn===null&&qa.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(s=0;s<i.length;s+=3){var f=i[s],h=i[s+1],v=f[En]||null;if(typeof h=="function")v||hv(i);else if(v){var N=null;if(h&&h.hasAttribute("formAction")){if(f=h,v=h[En]||null)N=v.formAction;else if(Dh(f)!==null)continue}else N=v.action;typeof N=="function"?i[s+1]=N:(i.splice(s,3),s-=3),hv(i)}}}function mv(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(v){return f=v})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),s||setTimeout(i,20)}function i(){if(!s&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Lh(e){this._internalRoot=e}vc.prototype.render=Lh.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(l(409));var i=n.current,s=Vn();iv(i,s,e,n,null,null)},vc.prototype.unmount=Lh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;iv(e.current,2,null,e,null,null),ac(),n[Vi]=null}};function vc(e){this._internalRoot=e}vc.prototype.unstable_scheduleHydration=function(e){if(e){var n=ng();e={blockedOn:null,target:e,priority:n};for(var i=0;i<qa.length&&n!==0&&n<qa[i].priority;i++);qa.splice(i,0,e),i===0&&dv(e)}};var pv=r.version;if(pv!=="19.3.0")throw Error(l(527,pv,"19.3.0"));je.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=y(n),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var RC={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ye,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wc.isDisabled&&wc.supportsFiber)try{os=wc.inject(RC),qn=wc}catch{}}return no.createRoot=function(e,n){if(!o(e))throw Error(l(299));var i=!1,s="",f=ax,h=ix,v=lx;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(v=n.onRecoverableError)),n=rv(e,1,!1,null,null,i,s,null,f,h,v,mv),e[Vi]=n.current,fh(e),new Lh(n)},no.hydrateRoot=function(e,n,i){if(!o(e))throw Error(l(299));var s=!1,f="",h=ax,v=ix,N=lx,R=null;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(N=i.onRecoverableError),i.formState!==void 0&&(R=i.formState)),n=rv(e,1,!0,n,i??null,s,f,R,h,v,N,mv),n.context=av(null),i=n.current,s=Vn(),s=cd(s),f=Sa(s),f.callback=null,Na(i,f,s),i=s,n.current.lanes=i,cs(n,i),Ur(n),e[Vi]=n.current,fh(e),new vc(n)},no.version="19.3.0",no}var jv;function PC(){if(jv)return Bh.exports;jv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(r){console.error(r)}}return t(),Bh.exports=FC(),Bh.exports}var QC=PC();/**
50
+ * react-router v7.18.4
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 np=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,d1=/^[\\/]{2}/;function YC(t,r){return r+t.replace(/\\/g,"/")}var Ev="popstate";function Tv(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function VC(t={}){function r(o,u){let{pathname:d="/",search:m="",hash:p=""}=Fi(o.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Sm("",{pathname:d,search:m,hash:p},u.state&&u.state.usr||null,u.state&&u.state.key||"default")}function a(o,u){let d=o.document.querySelector("base"),m="";if(d&&d.getAttribute("href")){let p=o.location.href,y=p.indexOf("#");m=y===-1?p:p.slice(0,y)}return m+"#"+(typeof u=="string"?u:Hi(u))}function l(o,u){cr(o.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(u)})`)}return KC(r,a,l,t)}function Rt(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function cr(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function GC(){return Math.random().toString(36).substring(2,10)}function Av(t,r){return{usr:t.state,key:t.key,idx:r,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Sm(t,r,a=null,l,o){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof r=="string"?Fi(r):r,state:a,key:r&&r.key||l||GC(),mask:o}}function Hi({pathname:t="/",search:r="",hash:a=""}){return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(t+=a.charAt(0)==="#"?a:"#"+a),t}function Fi(t){let r={};if(t){let a=t.indexOf("#");a>=0&&(r.hash=t.substring(a),t=t.substring(0,a));let l=t.indexOf("?");l>=0&&(r.search=t.substring(l),t=t.substring(0,l)),t&&(r.pathname=t)}return r}function KC(t,r,a,l={}){let{window:o=document.defaultView,v5Compat:u=!1}=l,d=o.history,m="POP",p=null,y=x();y==null&&(y=0,d.replaceState({...d.state,idx:y},""));function x(){return(d.state||{idx:null}).idx}function g(){m="POP";let E=x(),k=E==null?null:E-y;y=E,p&&p({action:m,location:T.location,delta:k})}function b(E,k){m="PUSH";let A=Tv(E)?E:Sm(T.location,E,k);a&&a(A,E),y=x()+1;let M=Av(A,y),F=T.createHref(A.mask||A);try{d.pushState(M,"",F)}catch(Q){if(Q instanceof DOMException&&Q.name==="DataCloneError")throw Q;o.location.assign(F)}u&&p&&p({action:m,location:T.location,delta:1})}function w(E,k){m="REPLACE";let A=Tv(E)?E:Sm(T.location,E,k);a&&a(A,E),y=x();let M=Av(A,y),F=T.createHref(A.mask||A);d.replaceState(M,"",F),u&&p&&p({action:m,location:T.location,delta:0})}function C(E){return XC(o,E)}let T={get action(){return m},get location(){return t(o,d)},listen(E){if(p)throw new Error("A history only accepts one active listener");return o.addEventListener(Ev,g),p=E,()=>{o.removeEventListener(Ev,g),p=null}},createHref(E){return r(o,E)},createURL:C,encodeLocation(E){let k=C(E);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:b,replace:w,go(E){return d.go(E)}};return T}function XC(t,r,a=!1){let l="http://localhost";t&&(l=t.location.origin!=="null"?t.location.origin:t.location.href),Rt(l,"No window.location.(origin|href) available to create URL");let o=typeof r=="string"?r:Hi(r);return o=o.replace(/ $/,"%20"),!a&&d1.test(o)&&(o=l+o),new URL(o,l)}function f1(t,r,a="/"){return $C(t,r,a,!1)}function $C(t,r,a,l,o){let u=typeof r=="string"?Fi(r):r,d=ua(u.pathname||"/",a);if(d==null)return null;let m=ZC(t),p=null,y=ok(d);for(let x=0;p==null&&x<m.length;++x)p=sk(m[x],y,l);return p}function ZC(t){let r=h1(t);return JC(r),r}function h1(t,r=[],a=[],l="",o=!1){let u=(d,m,p=o,y)=>{let x={relativePath:y===void 0?d.path||"":y,caseSensitive:d.caseSensitive===!0,childrenIndex:m,route:d};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(l)&&p)return;Rt(x.relativePath.startsWith(l),`Absolute route path "${x.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(l.length)}let g=Nr([l,x.relativePath]),b=a.concat(x);d.children&&d.children.length>0&&(Rt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),h1(d.children,r,b,g,p)),!(d.path==null&&!d.index)&&r.push({path:g,score:ik(g,d.index),routesMeta:b.map((w,C)=>{let[T,E]=g1(w.relativePath,w.caseSensitive,C===b.length-1);return{...w,matcher:T,compiledParams:E}})})};return t.forEach((d,m)=>{var p;if(d.path===""||!((p=d.path)!=null&&p.includes("?")))u(d,m);else for(let y of m1(d.path))u(d,m,!0,y)}),r}function m1(t){let r=t.split("/");if(r.length===0)return[];let[a,...l]=r,o=a.endsWith("?"),u=a.replace(/\?$/,"");if(l.length===0)return o?[u,""]:[u];let d=m1(l.join("/")),m=[];return m.push(...d.map(p=>p===""?u:[u,p].join("/"))),o&&m.push(...d),m.map(p=>t.startsWith("/")&&p===""?"/":p)}function JC(t){t.sort((r,a)=>r.score!==a.score?a.score-r.score:lk(r.routesMeta.map(l=>l.childrenIndex),a.routesMeta.map(l=>l.childrenIndex)))}var WC=/^:[\w-]+$/,ek=3,tk=2,nk=1,rk=10,ak=-2,Ov=t=>t==="*";function ik(t,r){let a=t.split("/"),l=a.length;return a.some(Ov)&&(l+=ak),r&&(l+=tk),a.filter(o=>!Ov(o)).reduce((o,u)=>o+(WC.test(u)?ek:u===""?nk:rk),l)}function lk(t,r){return t.length===r.length&&t.slice(0,-1).every((l,o)=>l===r[o])?t[t.length-1]-r[r.length-1]:0}function sk(t,r,a=!1){let{routesMeta:l}=t,o={},u="/",d=[];for(let m=0;m<l.length;++m){let p=l[m],y=m===l.length-1,x=u==="/"?r:r.slice(u.length)||"/",g={path:p.relativePath,caseSensitive:p.caseSensitive,end:y},b=p.matcher&&p.compiledParams?p1(g,x,p.matcher,p.compiledParams):_c(g,x),w=p.route;if(!b&&y&&a&&!l[l.length-1].route.index&&(b=_c({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},x)),!b)return null;Object.assign(o,b.params),d.push({params:o,pathname:Nr([u,b.pathname]),pathnameBase:dk(Nr([u,b.pathnameBase])),route:w}),b.pathnameBase!=="/"&&(u=Nr([u,b.pathnameBase]))}return d}function _c(t,r){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[a,l]=g1(t.path,t.caseSensitive,t.end);return p1(t,r,a,l)}function p1(t,r,a,l){let o=r.match(a);if(!o)return null;let u=o[0],d=Wl(u,1),m=o.slice(1);return{params:l.reduce((y,{paramName:x,isOptional:g},b)=>{if(x==="*"){let C=m[b]||"";d=Wl(u.slice(0,u.length-C.length),1)}const w=m[b];return g&&!w?y[x]=void 0:y[x]=(w||"").replace(/%2F/g,"/"),y},{}),pathname:u,pathnameBase:d,pattern:t}}function g1(t,r=!1,a=!0){cr(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let l=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,m,p,y,x)=>{if(l.push({paramName:m,isOptional:p!=null}),p){let g=x.charAt(y+d.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(l.push({paramName:"*"}),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,r?void 0:"i"),l]}function ok(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return cr(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),t}}function ua(t,r){if(r==="/")return t;if(!t.toLowerCase().startsWith(r.toLowerCase()))return null;let a=r.endsWith("/")?r.length-1:r.length,l=t.charAt(a);return l&&l!=="/"?null:t.slice(a)||"/"}function uk(t,r="/"){let{pathname:a,search:l="",hash:o=""}=typeof t=="string"?Fi(t):t,u;return a?(a=y1(a),a.startsWith("/")||a.startsWith("\\")?u=Rv(a.substring(1),"/"):u=Rv(a,r)):u=r,{pathname:u,search:fk(l),hash:hk(o)}}function Rv(t,r){let a=Wl(r).split("/");return t.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function Qh(t,r,a,l){return`Cannot include a '${t}' character in a manually specified \`to.${r}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ck(t){return t.filter((r,a)=>a===0||r.route.path&&r.route.path.length>0)}function rp(t){let r=ck(t);return r.map((a,l)=>l===r.length-1?a.pathname:a.pathnameBase)}function Qc(t,r,a,l=!1){let o;typeof t=="string"?o=Fi(t):(o={...t},Rt(!o.pathname||!o.pathname.includes("?"),Qh("?","pathname","search",o)),Rt(!o.pathname||!o.pathname.includes("#"),Qh("#","pathname","hash",o)),Rt(!o.search||!o.search.includes("#"),Qh("#","search","hash",o)));let u=t===""||o.pathname==="",d=u?"/":o.pathname,m;if(d==null)m=a;else{let g=r.length-1;if(!l&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),g-=1;o.pathname=b.join("/")}m=g>=0?r[g]:"/"}let p=uk(o,m),y=d&&d!=="/"&&d.endsWith("/"),x=(u||d===".")&&a.endsWith("/");return!p.pathname.endsWith("/")&&(y||x)&&(p.pathname+="/"),p}var y1=t=>t.replace(/[\\/]{2,}/g,"/"),Nr=t=>y1(t.join("/"));function Wl(t,r=0){let a=t.length;for(;a>r&&t.charCodeAt(a-1)===47;)a--;return a===t.length?t:t.slice(0,a)}var dk=t=>Wl(t).replace(/^\/*/,"/"),fk=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,hk=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,mk=class{constructor(t,r,a,l=!1){this.status=t,this.statusText=r||"",this.internal=l,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function pk(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function gk(t){let r=t.map(a=>a.route.path).filter(Boolean);return Nr(r)||"/"}var x1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function b1(t,r){let a=t;if(typeof a!="string"||!np.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let l=a,o=!1;if(x1)try{let u=new URL(window.location.href),d=d1.test(a)?new URL(YC(a,u.protocol)):new URL(a),m=ua(d.pathname,r);d.origin===u.origin&&m!=null?a=m+d.search+d.hash:o=!0}catch{cr(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:o,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Mv=new URL("http://localhost");function ap(t){if(t.createURL)return t.createURL("/");try{return new URL(t.createHref("/"),Mv)}catch{return Mv}}function Yh(t,r){return t.origin===r.origin&&(t.origin!=="null"||t.protocol===r.protocol&&t.host===r.host)}function yk(t,r){if(t.startsWith("//"))return!0;let a=r.protocol.toLowerCase();return t.toLowerCase().startsWith(a)?r.host===""||t.slice(a.length).startsWith("//"):!1}function ip(t,r,a,l){let o=null;try{o=t==null?null:new URL(t,a)}catch{}let u=new URL(r,a),d=o!=null&&!Yh(o,a),m=!Yh(u,a);if(l==="reject"){if(d||m)throw new Error("External navigation is not allowed")}else if(m&&(o==null||!yk(t,o)||!Yh(o,u)))throw new Error("External navigation is not allowed")}var v1=["POST","PUT","PATCH","DELETE"];new Set(v1);var xk=["GET",...v1];new Set(xk);var bk=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function vk(t){try{return bk.includes(new URL(t).protocol)}catch{return!1}}var rs=S.createContext(null);rs.displayName="DataRouter";var Yc=S.createContext(null);Yc.displayName="DataRouterState";var w1=S.createContext(!1);function wk(){return S.useContext(w1)}var S1=S.createContext({isTransitioning:!1});S1.displayName="ViewTransition";var Sk=S.createContext(new Map);Sk.displayName="Fetchers";var Nk=S.createContext(null);Nk.displayName="Await";var Zn=S.createContext(null);Zn.displayName="Navigation";var Uo=S.createContext(null);Uo.displayName="Location";var dr=S.createContext({outlet:null,matches:[],isDataRoute:!1});dr.displayName="Route";var lp=S.createContext(null);lp.displayName="RouteError";var N1="REACT_ROUTER_ERROR",Ck="REDIRECT",kk="ROUTE_ERROR_RESPONSE";function jk(t){if(t.startsWith(`${N1}:${Ck}:{`))try{let r=JSON.parse(t.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function Ek(t){if(t.startsWith(`${N1}:${kk}:{`))try{let r=JSON.parse(t.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new mk(r.status,r.statusText,r.data)}catch{}}function Tk(t,{relative:r}={}){Rt(as(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:l}=S.useContext(Zn),{hash:o,pathname:u,search:d}=qo(t,{relative:r}),m=u;return a!=="/"&&(m=u==="/"?a:Nr([a,u])),l.createHref({pathname:m,search:d,hash:o})}function as(){return S.useContext(Uo)!=null}function kr(){return Rt(as(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(Uo).location}var C1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function k1(t){S.useContext(Zn).static||S.useLayoutEffect(t)}function sp(){let{isDataRoute:t}=S.useContext(dr);return t?Pk():Ak()}function Ak(){Rt(as(),"useNavigate() may be used only in the context of a <Router> component.");let t=S.useContext(rs),{basename:r,navigator:a}=S.useContext(Zn),{matches:l}=S.useContext(dr),{pathname:o}=kr(),u=JSON.stringify(rp(l)),d=S.useRef(!1);return k1(()=>{d.current=!0}),S.useCallback((p,y={})=>{if(cr(d.current,C1),!d.current)return;if(typeof p=="number"){a.go(p);return}let x=Qc(p,JSON.parse(u),o,y.relative==="path");t==null&&r!=="/"&&(x.pathname=x.pathname==="/"?r:Nr([r,x.pathname])),ip(typeof p=="string"?p:Hi(p),a.createHref(x),ap(a),"reject"),(y.replace?a.replace:a.push)(x,y.state,y)},[r,a,u,o,t])}var Ok=S.createContext(null);function Rk(t){let r=S.useContext(dr).outlet;return S.useMemo(()=>r&&S.createElement(Ok.Provider,{value:t},r),[r,t])}function j1(){let{matches:t}=S.useContext(dr),r=t[t.length-1];return(r==null?void 0:r.params)??{}}function qo(t,{relative:r}={}){let{matches:a}=S.useContext(dr),{pathname:l}=kr(),o=JSON.stringify(rp(a));return S.useMemo(()=>Qc(t,JSON.parse(o),l,r==="path"),[t,o,l,r])}function Mk(t,r){return E1(t,r)}function E1(t,r,a){var E;Rt(as(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=S.useContext(Zn),{matches:o}=S.useContext(dr),u=o[o.length-1],d=u?u.params:{},m=u?u.pathname:"/",p=u?u.pathnameBase:"/",y=u&&u.route;{let k=y&&y.path||"";A1(m,!y||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${k}">) 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="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let x=kr(),g;if(r){let k=typeof r=="string"?Fi(r):r;Rt(p==="/"||((E=k.pathname)==null?void 0:E.startsWith(p)),`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 "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=x;let b=g.pathname||"/",w=b;if(p!=="/"){let k=p.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=a&&a.state.matches.length?a.state.matches.map(k=>Object.assign(k,{route:a.manifest[k.route.id]||k.route})):f1(t,{pathname:w});cr(y||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),cr(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.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 T=Uk(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},d,k.params),pathname:Nr([p,l.encodeLocation?l.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:Nr([p,l.encodeLocation?l.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,a);return r&&T?S.createElement(Uo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},T):T}function zk(){let t=Fk(),r=pk(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,l="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:u},"ErrorBoundary")," or"," ",S.createElement("code",{style:u},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},r),a?S.createElement("pre",{style:o},a):null,d)}var Dk=S.createElement(zk,null),T1=class extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){this.props.onError?this.props.onError(t,r):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const a=Ek(t.digest);a&&(t=a)}let r=t!==void 0?S.createElement(dr.Provider,{value:this.props.routeContext},S.createElement(lp.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?S.createElement(_k,{error:t},r):r}};T1.contextType=w1;var Vh=new WeakMap;function _k({children:t,error:r}){let{basename:a,navigator:l}=S.useContext(Zn);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=jk(r.digest);if(o){let u=Vh.get(r);if(u)throw u;let d=b1(o.location,a),m=d.absoluteURL||d.to;if(ip(o.location,m,ap(l),"allow-explicit"),vk(m))throw new Error("Invalid redirect location");if(x1&&!Vh.get(r))if(d.isExternal||o.reloadDocument)window.location.href=m;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:o.replace}));throw Vh.set(r,p),p}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${m}`})}}return t}function Lk({routeContext:t,match:r,children:a}){let l=S.useContext(rs);return l&&l.static&&l.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=r.route.id),S.createElement(dr.Provider,{value:t},a)}function Uk(t,r=[],a){let l=a==null?void 0:a.state;if(t==null){if(!l)return null;if(l.errors)t=l.matches;else if(r.length===0&&!l.initialized&&l.matches.length>0)t=l.matches;else return null}let o=t,u=l==null?void 0:l.errors;if(u!=null){let x=o.findIndex(g=>g.route.id&&(u==null?void 0:u[g.route.id])!==void 0);Rt(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),o=o.slice(0,Math.min(o.length,x+1))}let d=!1,m=-1;if(a&&l){d=l.renderFallback;for(let x=0;x<o.length;x++){let g=o[x];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(m=x),g.route.id){let{loaderData:b,errors:w}=l,C=g.route.loader&&!b.hasOwnProperty(g.route.id)&&(!w||w[g.route.id]===void 0);if(g.route.lazy||C){a.isStatic&&(d=!0),m>=0?o=o.slice(0,m+1):o=[o[0]];break}}}}let p=a==null?void 0:a.onError,y=l&&p?(x,g)=>{var b,w;p(x,{location:l.location,params:((w=(b=l.matches)==null?void 0:b[0])==null?void 0:w.params)??{},pattern:gk(l.matches),errorInfo:g})}:void 0;return o.reduceRight((x,g,b)=>{let w,C=!1,T=null,E=null;l&&(w=u&&g.route.id?u[g.route.id]:void 0,T=g.route.errorElement||Dk,d&&(m<0&&b===0?(A1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,E=null):m===b&&(C=!0,E=g.route.hydrateFallbackElement||null)));let k=r.concat(o.slice(0,b+1)),A=()=>{let M;return w?M=T:C?M=E:g.route.Component?M=S.createElement(g.route.Component,null):g.route.element?M=g.route.element:M=x,S.createElement(Lk,{match:g,routeContext:{outlet:x,matches:k,isDataRoute:l!=null},children:M})};return l&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?S.createElement(T1,{location:l.location,revalidation:l.revalidation,component:T,error:w,children:A(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:y}):A()},null)}function op(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function qk(t){let r=S.useContext(rs);return Rt(r,op(t)),r}function Hk(t){let r=S.useContext(Yc);return Rt(r,op(t)),r}function Bk(t){let r=S.useContext(dr);return Rt(r,op(t)),r}function up(t){let r=Bk(t),a=r.matches[r.matches.length-1];return Rt(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function Ik(){return up("useRouteId")}function Fk(){var l;let t=S.useContext(lp),r=Hk("useRouteError"),a=up("useRouteError");return t!==void 0?t:(l=r.errors)==null?void 0:l[a]}function Pk(){let{router:t}=qk("useNavigate"),r=up("useNavigate"),a=S.useRef(!1);return k1(()=>{a.current=!0}),S.useCallback(async(o,u={})=>{cr(a.current,C1),a.current&&(typeof o=="number"?await t.navigate(o):await t.navigate(o,{fromRouteId:r,...u}))},[t,r])}var zv={};function A1(t,r,a){!r&&!zv[t]&&(zv[t]=!0,cr(!1,a))}S.memo(Qk);function Qk({routes:t,manifest:r,future:a,state:l,isStatic:o,onError:u}){return E1(t,void 0,{manifest:r,state:l,isStatic:o,onError:u})}function Yk({to:t,replace:r,state:a,relative:l}){Rt(as(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:u}=S.useContext(Zn);cr(!o,"<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:d}=S.useContext(dr),{pathname:m}=kr(),p=sp(),y=Qc(t,rp(d),m,l==="path");ip(typeof t=="string"?t:Hi(t),u.createHref(y),ap(u),"reject");let x=JSON.stringify(y);return S.useEffect(()=>{p(JSON.parse(x),{replace:r,state:a,relative:l})},[p,x,l,r,a]),null}function Vk(t){return Rk(t.context)}function Gt(t){Rt(!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 Gk({basename:t="/",children:r=null,location:a,navigationType:l="POP",navigator:o,static:u=!1,useTransitions:d}){Rt(!as(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=t.replace(/^\/*/,"/"),p=S.useMemo(()=>({basename:m,navigator:o,static:u,useTransitions:d,future:{}}),[m,o,u,d]);typeof a=="string"&&(a=Fi(a));let{pathname:y="/",search:x="",hash:g="",state:b=null,key:w="default",mask:C}=a,T=S.useMemo(()=>{let E=ua(y,m);return E==null?null:{location:{pathname:E,search:x,hash:g,state:b,key:w,mask:C},navigationType:l}},[m,y,x,g,b,w,l,C]);return cr(T!=null,`<Router basename="${m}"> is not able to match the URL "${y}${x}${g}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:S.createElement(Zn.Provider,{value:p},S.createElement(Uo.Provider,{children:r,value:T}))}function Kk({children:t,location:r}){return Mk(Nm(t),r)}function Nm(t,r=[]){let a=[];return S.Children.forEach(t,(l,o)=>{if(!S.isValidElement(l))return;let u=[...r,o];if(l.type===S.Fragment){a.push.apply(a,Nm(l.props.children,u));return}Rt(l.type===Gt,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Rt(!l.props.index||!l.props.children,"An index route cannot have child routes.");let d={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(d.children=Nm(l.props.children,u)),a.push(d)}),a}var Mc="get",zc="application/x-www-form-urlencoded";function Vc(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Xk(t){return Vc(t)&&t.tagName.toLowerCase()==="button"}function $k(t){return Vc(t)&&t.tagName.toLowerCase()==="form"}function Zk(t){return Vc(t)&&t.tagName.toLowerCase()==="input"}function Jk(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Wk(t,r){return t.button===0&&(!r||r==="_self")&&!Jk(t)}var Nc=null;function ej(){if(Nc===null)try{new FormData(document.createElement("form"),0),Nc=!1}catch{Nc=!0}return Nc}var tj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Gh(t){return t!=null&&!tj.has(t)?(cr(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zc}"`),null):t}function nj(t,r){let a,l,o,u,d;if($k(t)){let m=t.getAttribute("action");l=m?ua(m,r):null,a=t.getAttribute("method")||Mc,o=Gh(t.getAttribute("enctype"))||zc,u=new FormData(t)}else if(Xk(t)||Zk(t)&&(t.type==="submit"||t.type==="image")){let m=t.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=t.getAttribute("formaction")||m.getAttribute("action");if(l=p?ua(p,r):null,a=t.getAttribute("formmethod")||m.getAttribute("method")||Mc,o=Gh(t.getAttribute("formenctype"))||Gh(m.getAttribute("enctype"))||zc,u=new FormData(m,t),!ej()){let{name:y,type:x,value:g}=t;if(x==="image"){let b=y?`${y}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else y&&u.append(y,g)}}else{if(Vc(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Mc,l=null,o=zc,d=t}return u&&o==="text/plain"&&(d=u,u=void 0),{action:l,method:a.toLowerCase(),encType:o,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function cp(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function O1(t,r,a,l){let o=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return a?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${l}`:o.pathname=`${o.pathname}.${l}`:o.pathname==="/"?o.pathname=`_root.${l}`:r&&ua(o.pathname,r)==="/"?o.pathname=`${Wl(r)}/_root.${l}`:o.pathname=`${Wl(o.pathname)}.${l}`,o}async function rj(t,r){if(t.id in r)return r[t.id];try{let a=await import(t.module);return r[t.id]=a,a}catch(a){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function aj(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function ij(t,r,a){let l=await Promise.all(t.map(async o=>{let u=r.routes[o.route.id];if(u){let d=await rj(u,a);return d.links?d.links():[]}return[]}));return uj(l.flat(1).filter(aj).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Dv(t,r,a,l,o,u){let d=(p,y)=>a[y]?p.route.id!==a[y].route.id:!0,m=(p,y)=>{var x;return a[y].pathname!==p.pathname||((x=a[y].route.path)==null?void 0:x.endsWith("*"))&&a[y].params["*"]!==p.params["*"]};return u==="assets"?r.filter((p,y)=>d(p,y)||m(p,y)):u==="data"?r.filter((p,y)=>{var g;let x=l.routes[p.route.id];if(!x||!x.hasLoader)return!1;if(d(p,y)||m(p,y))return!0;if(p.route.shouldRevalidate){let b=p.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=a[0])==null?void 0:g.params)||{},nextUrl:new URL(t,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function lj(t,r,{includeHydrateFallback:a}={}){return sj(t.map(l=>{let o=r.routes[l.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function sj(t){return[...new Set(t)]}function oj(t){let r={},a=Object.keys(t).sort();for(let l of a)r[l]=t[l];return r}function uj(t,r){let a=new Set;return new Set(r),t.reduce((l,o)=>{let u=JSON.stringify(oj(o));return a.has(u)||(a.add(u),l.push({key:u,link:o})),l},[])}function dp(){let t=S.useContext(rs);return cp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function cj(){let t=S.useContext(Yc);return cp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var fp=S.createContext(void 0);fp.displayName="FrameworkContext";function Gc(){let t=S.useContext(fp);return cp(t,"You must render this element inside a <HydratedRouter> element"),t}function dj(t,r){let a=S.useContext(fp),[l,o]=S.useState(!1),[u,d]=S.useState(!1),{onFocus:m,onBlur:p,onMouseEnter:y,onMouseLeave:x,onTouchStart:g}=r,b=S.useRef(null);S.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let T=k=>{k.forEach(A=>{d(A.isIntersecting)})},E=new IntersectionObserver(T,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[t]),S.useEffect(()=>{if(l){let T=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(T)}}},[l]);let w=()=>{o(!0)},C=()=>{o(!1),d(!1)};return a?t!=="intent"?[u,b,{}]:[u,b,{onFocus:ro(m,w),onBlur:ro(p,C),onMouseEnter:ro(y,w),onMouseLeave:ro(x,C),onTouchStart:ro(g,w)}]:[!1,b,{}]}function ro(t,r){return a=>{t&&t(a),a.defaultPrevented||r(a)}}function fj({page:t,...r}){let a=wk(),{nonce:l}=Gc(),{router:o}=dp(),u=S.useMemo(()=>f1(o.routes,t,o.basename),[o.routes,t,o.basename]);return u?(r.nonce==null&&l&&(r={...r,nonce:l}),a?S.createElement(mj,{page:t,matches:u,...r}):S.createElement(pj,{page:t,matches:u,...r})):null}function hj(t){let{manifest:r,routeModules:a}=Gc(),[l,o]=S.useState([]);return S.useEffect(()=>{let u=!1;return ij(t,r,a).then(d=>{u||o(d)}),()=>{u=!0}},[t,r,a]),l}function mj({page:t,matches:r,...a}){let l=kr(),{future:o}=Gc(),{basename:u}=dp(),d=S.useMemo(()=>{if(t===l.pathname+l.search+l.hash)return[];let m=O1(t,u,o.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,y=[];for(let x of r)typeof x.route.shouldRevalidate=="function"?p=!0:y.push(x.route.id);return p&&y.length>0&&m.searchParams.set("_routes",y.join(",")),[m.pathname+m.search]},[u,o.v8_trailingSlashAwareDataRequests,t,l,r]);return S.createElement(S.Fragment,null,d.map(m=>S.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...a})))}function pj({page:t,matches:r,...a}){let l=kr(),{future:o,manifest:u,routeModules:d}=Gc(),{basename:m}=dp(),{loaderData:p,matches:y}=cj(),x=S.useMemo(()=>Dv(t,r,y,u,l,"data"),[t,r,y,u,l]),g=S.useMemo(()=>Dv(t,r,y,u,l,"assets"),[t,r,y,u,l]),b=S.useMemo(()=>{if(t===l.pathname+l.search+l.hash)return[];let T=new Set,E=!1;if(r.forEach(A=>{var F;let M=u.routes[A.route.id];!M||!M.hasLoader||(!x.some(Q=>Q.route.id===A.route.id)&&A.route.id in p&&((F=d[A.route.id])!=null&&F.shouldRevalidate)||M.hasClientLoader?E=!0:T.add(A.route.id))}),T.size===0)return[];let k=O1(t,m,o.v8_trailingSlashAwareDataRequests,"data");return E&&T.size>0&&k.searchParams.set("_routes",r.filter(A=>T.has(A.route.id)).map(A=>A.route.id).join(",")),[k.pathname+k.search]},[m,o.v8_trailingSlashAwareDataRequests,p,l,u,x,r,t,d]),w=S.useMemo(()=>lj(g,u),[g,u]),C=hj(g);return S.createElement(S.Fragment,null,b.map(T=>S.createElement("link",{key:T,rel:"prefetch",as:"fetch",href:T,...a})),w.map(T=>S.createElement("link",{key:T,rel:"modulepreload",href:T,...a})),C.map(({key:T,link:E})=>S.createElement("link",{key:T,nonce:a.nonce,...E,crossOrigin:E.crossOrigin??a.crossOrigin})))}function gj(...t){return r=>{t.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var yj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{yj&&(window.__reactRouterVersion="7.18.4")}catch{}function xj({basename:t,children:r,useTransitions:a,window:l}){let o=S.useRef();o.current==null&&(o.current=VC({window:l,v5Compat:!0}));let u=o.current,[d,m]=S.useState({action:u.action,location:u.location}),p=S.useCallback(y=>{a===!1?m(y):S.startTransition(()=>m(y))},[a]);return S.useLayoutEffect(()=>u.listen(p),[u,p]),S.createElement(Gk,{basename:t,children:r,location:d.location,navigationType:d.action,navigator:u,useTransitions:a})}var Kc=S.forwardRef(function({onClick:r,discover:a="render",prefetch:l="none",relative:o,reloadDocument:u,replace:d,mask:m,state:p,target:y,to:x,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:w,...C},T){let{basename:E,navigator:k,useTransitions:A}=S.useContext(Zn),M=typeof x=="string"&&np.test(x),F=b1(x,E);x=F.to;let Q=Tk(x,{relative:o}),j=kr(),L=null;if(m){let re=Qc(m,[],j.mask?j.mask.pathname:"/",!0);E!=="/"&&(re.pathname=re.pathname==="/"?E:Nr([E,re.pathname])),L=k.createHref(re)}let[$,W,z]=dj(l,C),le=Sj(x,{replace:d,mask:m,state:p,target:y,preventScrollReset:g,relative:o,viewTransition:b,defaultShouldRevalidate:w,useTransitions:A});function I(re){r&&r(re),re.defaultPrevented||le(re)}let ee=!(F.isExternal||u),ie=S.createElement("a",{...C,...z,href:(ee?L:void 0)||F.absoluteURL||Q,onClick:ee?I:r,ref:gj(T,W),target:y,"data-discover":!M&&a==="render"?"true":void 0});return $&&!M?S.createElement(S.Fragment,null,ie,S.createElement(fj,{page:Q})):ie});Kc.displayName="Link";var bj=S.forwardRef(function({"aria-current":r="page",caseSensitive:a=!1,className:l="",end:o=!1,style:u,to:d,viewTransition:m,children:p,...y},x){let g=qo(d,{relative:y.relative}),b=kr(),w=S.useContext(Yc),{navigator:C,basename:T}=S.useContext(Zn),E=w!=null&&Ej(g)&&m===!0,k=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,A=b.pathname,M=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;a||(A=A.toLowerCase(),M=M?M.toLowerCase():null,k=k.toLowerCase()),M&&T&&(M=ua(M,T)||M);const F=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let Q=A===k||!o&&A.startsWith(k)&&A.charAt(F)==="/",j=M!=null&&(M===k||!o&&M.startsWith(k)&&M.charAt(k.length)==="/"),L={isActive:Q,isPending:j,isTransitioning:E},$=Q?r:void 0,W;typeof l=="function"?W=l(L):W=[l,Q?"active":null,j?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let z=typeof u=="function"?u(L):u;return S.createElement(Kc,{...y,"aria-current":$,className:W,ref:x,style:z,to:d,viewTransition:m},typeof p=="function"?p(L):p)});bj.displayName="NavLink";var vj=S.forwardRef(({discover:t="render",fetcherKey:r,navigate:a,reloadDocument:l,replace:o,state:u,method:d=Mc,action:m,onSubmit:p,relative:y,preventScrollReset:x,viewTransition:g,defaultShouldRevalidate:b,...w},C)=>{let{useTransitions:T}=S.useContext(Zn),E=kj(),k=jj(m,{relative:y}),A=d.toLowerCase()==="get"?"get":"post",M=typeof m=="string"&&np.test(m),F=Q=>{if(p&&p(Q),Q.defaultPrevented)return;Q.preventDefault();let j=Q.nativeEvent.submitter,L=(j==null?void 0:j.getAttribute("formmethod"))||d,$=()=>E(j||Q.currentTarget,{fetcherKey:r,method:L,navigate:a,replace:o,state:u,relative:y,preventScrollReset:x,viewTransition:g,defaultShouldRevalidate:b});T&&a!==!1?S.startTransition(()=>$()):$()};return S.createElement("form",{ref:C,method:A,action:k,onSubmit:l?p:F,...w,"data-discover":!M&&t==="render"?"true":void 0})});vj.displayName="Form";function wj(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function R1(t){let r=S.useContext(rs);return Rt(r,wj(t)),r}function Sj(t,{target:r,replace:a,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:m,defaultShouldRevalidate:p,useTransitions:y}={}){let x=sp(),g=kr(),b=qo(t,{relative:d});return S.useCallback(w=>{if(Wk(w,r)){w.preventDefault();let C=a!==void 0?a:Hi(g)===Hi(b),T=()=>x(t,{replace:C,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:m,defaultShouldRevalidate:p});y?S.startTransition(()=>T()):T()}},[g,x,b,a,l,o,r,t,u,d,m,p,y])}var Nj=0,Cj=()=>`__${String(++Nj)}__`;function kj(){let{router:t}=R1("useSubmit"),{basename:r}=S.useContext(Zn),a=Ik(),l=t.fetch,o=t.navigate;return S.useCallback(async(u,d={})=>{let{action:m,method:p,encType:y,formData:x,body:g}=nj(u,r);if(d.navigate===!1){let b=d.fetcherKey||Cj();await l(b,a,d.action||m,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:x,body:g,formMethod:d.method||p,formEncType:d.encType||y,flushSync:d.flushSync})}else await o(d.action||m,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:x,body:g,formMethod:d.method||p,formEncType:d.encType||y,replace:d.replace,state:d.state,fromRouteId:a,flushSync:d.flushSync,viewTransition:d.viewTransition})},[l,o,r,a])}function jj(t,{relative:r}={}){let{basename:a}=S.useContext(Zn),l=S.useContext(dr);Rt(l,"useFormAction must be used inside a RouteContext");let[o]=l.matches.slice(-1),u={...qo(t||".",{relative:r})},d=kr();if(t==null){u.search=d.search;let m=new URLSearchParams(u.search),p=m.getAll("index");if(p.some(x=>x==="")){m.delete("index"),p.filter(g=>g).forEach(g=>m.append("index",g));let x=m.toString();u.search=x?`?${x}`:""}}return(!t||t===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(u.pathname=u.pathname==="/"?a:Nr([a,u.pathname])),Hi(u)}function Ej(t,{relative:r}={}){let a=S.useContext(S1);Rt(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=R1("useViewTransitionState"),o=qo(t,{relative:r});if(!a.isTransitioning)return!1;let u=ua(a.currentLocation.pathname,l)||a.currentLocation.pathname,d=ua(a.nextLocation.pathname,l)||a.nextLocation.pathname;return _c(o.pathname,d)!=null||_c(o.pathname,u)!=null}const M1=S.createContext(void 0),Mt=t=>{const r=S.useContext(M1);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},Tj=({client:t,children:r})=>(S.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),c.jsx(M1.Provider,{value:t,children:r})),Aj={setTimeout:(t,r)=>setTimeout(t,r),clearTimeout:t=>clearTimeout(t),setInterval:(t,r)=>setInterval(t,r),clearInterval:t=>clearInterval(t)};var Ya,Wm,t1,Oj=(t1=class{constructor(){De(this,Ya,Aj);De(this,Wm,!1)}setTimeoutProvider(t){Se(this,Ya,t)}setTimeout(t,r){return q(this,Ya).setTimeout(t,r)}clearTimeout(t){q(this,Ya).clearTimeout(t)}setInterval(t,r){return q(this,Ya).setInterval(t,r)}clearInterval(t){q(this,Ya).clearInterval(t)}},Ya=new WeakMap,Wm=new WeakMap,t1);const Ti=new Oj;function Rj(t){setTimeout(t,0)}const Mj=typeof window>"u"||"Deno"in globalThis;function Dn(){}function zj(t,r){return typeof t=="function"?t(r):t}function z1(t){return typeof t=="number"&&t>=0&&t!==1/0}function D1(t,r){return Math.max(t+(r||0)-Date.now(),0)}function Ot(t,r){return typeof t=="function"?t(r):t}function _v(t,r){const{type:a="all",exact:l,fetchStatus:o,predicate:u,queryKey:d,stale:m}=t;if(d){if(l){if(r.queryHash!==hp(d,r.options))return!1}else if(!es(r.queryKey,d))return!1}if(a!=="all"){const p=r.isActive();if(a==="active"&&!p||a==="inactive"&&p)return!1}return!(typeof m=="boolean"&&r.isStale()!==m||o&&o!==r.state.fetchStatus||u&&!u(r))}function Lv(t,r){const{exact:a,status:l,predicate:o,mutationKey:u}=t;if(u){if(!r.options.mutationKey)return!1;if(a){if(wo(r.options.mutationKey)!==wo(u))return!1}else if(!es(r.options.mutationKey,u))return!1}return!(l&&r.state.status!==l||o&&!o(r))}function hp(t,r){return((r==null?void 0:r.queryKeyHashFn)||wo)(t)}function wo(t){return JSON.stringify(t,(r,a)=>Cm(a)?Object.keys(a).sort().reduce((l,o)=>(l[o]=a[o],l),{}):a)}function es(t,r){if(t===r)return!0;if(typeof t!=typeof r)return!1;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(Array.isArray(t)&&Array.isArray(r)){if(r.length>t.length)return!1;for(let l=0;l<r.length;l++)if(!es(t[l],r[l]))return!1;return!0}const a=Object.keys(r);for(const l of a)if(!es(t[l],r[l]))return!1;return!0}return!1}const Dj=Object.prototype.hasOwnProperty;function _1(t,r,a=0){if(t===r)return t;if(a>500)return r;const l=Uv(t)&&Uv(r);if(!l&&!(Cm(t)&&Cm(r)))return r;const o=(l?t:Object.keys(t)).length,u=l?r:Object.keys(r),d=u.length,m=l?new Array(d):{};let p=0;for(let y=0;y<d;y++){const x=l?y:u[y],g=t[x],b=r[x];if(g===b){m[x]=g,(l?y<o:Dj.call(t,x))&&p++;continue}if(g===null||b===null||typeof g!="object"||typeof b!="object"){m[x]=b;continue}const w=_1(g,b,a+1);m[x]=w,w===g&&p++}return o===d&&p===o?t:m}function Kh(t,r){if(!r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const a in t)if(t[a]!==r[a])return!1;return!0}function Uv(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Cm(t){if(!qv(t))return!1;const r=Object.getPrototypeOf(t),a=r==null?void 0:r.constructor;if(a===void 0)return!0;if(typeof a!="function")return!1;const l=a.prototype;return!(!qv(l)||!l.hasOwnProperty("isPrototypeOf")||r!==Object.prototype)}function qv(t){return Object.prototype.toString.call(t)==="[object Object]"}function _j(t){return new Promise(r=>{Ti.setTimeout(r,t)})}function km(t,r,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,r):a.structuralSharing!==!1?_1(t,r):r}function Lj(t,r,a=0){const l=[...t,r];return a&&l.length>a?l.slice(1):l}function Uj(t,r,a=0){const l=[r,...t];return a&&l.length>a?l.slice(0,-1):l}const mp=Symbol();function L1(t,r){return!t.queryFn&&(r!=null&&r.initialPromise)?()=>r.initialPromise:!t.queryFn||t.queryFn===mp?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function U1(t,r){return typeof t=="function"?t(...r):!!t}function qj(t,r,a){let l=!1,o;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(o??(o=r()),l||(l=!0,o.aborted?a():o.addEventListener("abort",a,{once:!0})),o)}),t}let Hj=()=>Mj;const pp=()=>Hj();var Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ai,Va,Bl,n1,Bj=(n1=class extends Ho{constructor(){super();De(this,Ai);De(this,Va);De(this,Bl);Se(this,Bl,r=>{if(typeof window<"u"&&window.addEventListener){const a=()=>r();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){q(this,Va)||this.setEventListener(q(this,Bl))}onUnsubscribe(){var r;this.hasListeners()||((r=q(this,Va))==null||r.call(this),Se(this,Va,void 0))}setEventListener(r){var a;Se(this,Bl,r),(a=q(this,Va))==null||a.call(this),Se(this,Va,r(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(r){q(this,Ai)!==r&&(Se(this,Ai,r),this.onFocus())}onFocus(){const r=this.isFocused();this.listeners.forEach(a=>{a(r)})}isFocused(){var r;return typeof q(this,Ai)=="boolean"?q(this,Ai):((r=globalThis.document)==null?void 0:r.visibilityState)!=="hidden"}},Ai=new WeakMap,Va=new WeakMap,Bl=new WeakMap,n1);const gp=new Bj,Ij=Rj;function Fj(){let t=[],r=0,a=m=>{m()},l=m=>{m()},o=Ij;const u=m=>{r?t.push(m):o(()=>{a(m)})},d=()=>{const m=t;t=[],m.length&&o(()=>{l(()=>{m.forEach(p=>{a(p)})})})};return{batch:m=>{let p;r++;try{p=m()}finally{r--,r||d()}return p},batchCalls:m=>(...p)=>{u(()=>{m(...p)})},schedule:u,setNotifyFunction:m=>{a=m},setBatchNotifyFunction:m=>{l=m},setScheduler:m=>{o=m}}}const fn=Fj();var Il,Ga,Fl,r1,Pj=(r1=class extends Ho{constructor(){super();De(this,Il,!0);De(this,Ga);De(this,Fl);Se(this,Fl,r=>{if(typeof window<"u"&&window.addEventListener){const a=()=>r(!0),l=()=>r(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",l)}}})}onSubscribe(){q(this,Ga)||this.setEventListener(q(this,Fl))}onUnsubscribe(){var r;this.hasListeners()||((r=q(this,Ga))==null||r.call(this),Se(this,Ga,void 0))}setEventListener(r){var a;Se(this,Fl,r),(a=q(this,Ga))==null||a.call(this),Se(this,Ga,r(this.setOnline.bind(this)))}setOnline(r){q(this,Il)!==r&&(Se(this,Il,r),this.listeners.forEach(a=>{a(r)}))}isOnline(){return q(this,Il)}},Il=new WeakMap,Ga=new WeakMap,Fl=new WeakMap,r1);const Lc=new Pj;function Qj(t){return Math.min(1e3*2**t,3e4)}function q1(t){return(t??"online")==="online"?Lc.isOnline():!0}var jm=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function H1(t){let r=!1,a=0,l,o="pending",u,d;const m=new Promise((A,M)=>{u=A,d=M});m.catch(Dn);const p=()=>o!=="pending",y=A=>{var M;if(!p()){const F=new jm(A);T(F),(M=t.onCancel)==null||M.call(t,F)}},x=()=>{r=!0},g=()=>{r=!1},b=()=>gp.isFocused()&&(t.networkMode==="always"||Lc.isOnline())&&t.canRun(),w=()=>q1(t.networkMode)&&t.canRun(),C=A=>{p()||(l==null||l(),o="resolved",u(A))},T=A=>{p()||(l==null||l(),o="rejected",d(A))},E=()=>new Promise(A=>{var M;l=F=>{(p()||b())&&A(F)},(M=t.onPause)==null||M.call(t)}).then(()=>{var A;l=void 0,p()||(A=t.onContinue)==null||A.call(t)}),k=()=>{if(p())return;let A;const M=a===0?t.initialPromise:void 0;try{A=M??t.fn()}catch(F){A=Promise.reject(F)}Promise.resolve(A).then(C).catch(F=>{var W;if(p())return;const Q=t.retry??(pp()?0:3),j=t.retryDelay??Qj,L=typeof j=="function"?j(a,F):j,$=Q===!0||typeof Q=="number"&&a<Q||typeof Q=="function"&&Q(a,F);if(r||!$){T(F);return}a++,(W=t.onFail)==null||W.call(t,a,F),_j(L).then(()=>b()?void 0:E()).then(()=>{r?T(F):k()})})};return{promise:m,status:()=>o,cancel:y,continue:()=>(l==null||l(),m),cancelRetry:x,continueRetry:g,canStart:w,start:()=>(w()?k():E().then(k),m)}}var Oi,a1,B1=(a1=class{constructor(){De(this,Oi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),z1(this.gcTime)&&Se(this,Oi,Ti.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(pp()?1/0:3e5))}clearGcTimeout(){q(this,Oi)!==void 0&&(Ti.clearTimeout(q(this,Oi)),Se(this,Oi,void 0))}},Oi=new WeakMap,a1);function Yj(t){return{onFetch:(r,a)=>{var x,g,b,w,C;const l=r.options,o=(b=(g=(x=r.fetchOptions)==null?void 0:x.meta)==null?void 0:g.fetchMore)==null?void 0:b.direction,u=((w=r.state.data)==null?void 0:w.pages)||[],d=((C=r.state.data)==null?void 0:C.pageParams)||[];let m={pages:[],pageParams:[]},p=0;const y=async()=>{let T=!1;const E=M=>{qj(M,()=>r.signal,()=>T=!0)},k=L1(r.options,r.fetchOptions),A=async(M,F,Q)=>{if(T)return Promise.reject(r.signal.reason);if(F==null&&M.pages.length)return Promise.resolve(M);const L=(()=>{const le={client:r.client,queryKey:r.queryKey,pageParam:F,direction:Q?"backward":"forward",meta:r.options.meta};return E(le),le})(),$=await k(L),{maxPages:W}=r.options,z=Q?Uj:Lj;return{pages:z(M.pages,$,W),pageParams:z(M.pageParams,F,W)}};if(o&&u.length){const M=o==="backward",F=M?Vj:Hv,Q={pages:u,pageParams:d};m=await A(Q,F(l,Q),M)}else{const M=t??u.length;do{const F=p===0?d[0]??l.initialPageParam:Hv(l,m);if(p>0&&F==null)break;m=await A(m,F),p++}while(p<M)}return m};r.options.persister?r.fetchFn=()=>{var T,E;return(E=(T=r.options).persister)==null?void 0:E.call(T,y,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},a)}:r.fetchFn=y}}}function Hv(t,{pages:r,pageParams:a}){const l=r.length-1;return r.length>0?t.getNextPageParam(r[l],r,a[l],a):void 0}function Vj(t,{pages:r,pageParams:a}){var l;return r.length>0?(l=t.getPreviousPageParam)==null?void 0:l.call(t,r[0],r,a[0],a):void 0}var Pl,Ri,Ql,or,Mi,Zt,Mo,zi,wr,la,i1,Gj=(i1=class extends B1{constructor(r){super();De(this,wr);De(this,Pl);De(this,Ri);De(this,Ql);De(this,or);De(this,Mi);De(this,Zt);De(this,Mo);De(this,zi);Se(this,zi,!1),Se(this,Mo,r.defaultOptions),this.setOptions(r.options),this.observers=[],Se(this,Mi,r.client),Se(this,or,q(this,Mi).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,Se(this,Ri,Iv(this.options)),this.state=r.state??q(this,Ri),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return q(this,Pl)}get promise(){var r;return(r=q(this,Zt))==null?void 0:r.promise}setOptions(r){if(this.options={...q(this,Mo),...r},r!=null&&r._type&&Se(this,Pl,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=Iv(this.options);a.data!==void 0&&(this.setState(Bv(a.data,a.dataUpdatedAt)),Se(this,Ri,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&q(this,or).remove(this)}setData(r,a){const l=km(this.state.data,r,this.options);return et(this,wr,la).call(this,{data:l,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),l}setState(r){et(this,wr,la).call(this,{type:"setState",state:r})}cancel(r){var l,o;const a=(l=q(this,Zt))==null?void 0:l.promise;return(o=q(this,Zt))==null||o.cancel(r),a?a.then(Dn).catch(Dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return q(this,Ri)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(r=>Ot(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mp||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(r=>Ot(r.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(r=>r.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){return this.state.data===void 0?!0:r==="static"?!1:this.state.isInvalidated?!0:!D1(this.state.dataUpdatedAt,r)}onFocus(){var r,a;(r=this.observers.find(l=>l.shouldFetchOnWindowFocus()))==null||r.refetch({cancelRefetch:!1}),(a=q(this,Zt))==null||a.continue()}onOnline(){var r,a;(r=this.observers.find(l=>l.shouldFetchOnReconnect()))==null||r.refetch({cancelRefetch:!1}),(a=q(this,Zt))==null||a.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),q(this,or).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){const a=this.observers.indexOf(r);a!==-1&&(this.observers.splice(a,1),this.observers.length||(q(this,Zt)&&(q(this,zi)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?q(this,Zt).cancel({revert:!0}):q(this,Zt).cancelRetry()),this.scheduleGc()),q(this,or).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||et(this,wr,la).call(this,{type:"invalidate"})}async fetch(r,a){var y,x,g,b,w,C,T,E,k,A,M,F;if(this.state.fetchStatus!=="idle"&&((y=q(this,Zt))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(q(this,Zt))return q(this,Zt).continueRetry(),q(this,Zt).promise}if(r&&this.setOptions(r),!this.options.queryFn){const Q=this.observers.find(j=>j.options.queryFn);Q&&this.setOptions(Q.options)}const l=new AbortController,o=Q=>{Object.defineProperty(Q,"signal",{enumerable:!0,get:()=>(Se(this,zi,!0),l.signal)})},u=()=>{const Q=L1(this.options,a),L=(()=>{const $={client:q(this,Mi),queryKey:this.queryKey,meta:this.meta};return o($),$})();return Se(this,zi,!1),this.options.persister?this.options.persister(Q,L,this):Q(L)},m=(()=>{const Q={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:q(this,Mi),state:this.state,fetchFn:u};return o(Q),Q})();(x=q(this,Pl)==="infinite"?Yj(this.options.pages):this.options.behavior)==null||x.onFetch(m,this),Se(this,Ql,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=m.fetchOptions)==null?void 0:g.meta))&&et(this,wr,la).call(this,{type:"fetch",meta:(b=m.fetchOptions)==null?void 0:b.meta});const p=Se(this,Zt,H1({initialPromise:a==null?void 0:a.initialPromise,fn:m.fetchFn,onCancel:Q=>{Q instanceof jm&&Q.revert&&this.setState({...q(this,Ql),fetchStatus:"idle"}),l.abort()},onFail:(Q,j)=>{et(this,wr,la).call(this,{type:"failed",failureCount:Q,error:j})},onPause:()=>{et(this,wr,la).call(this,{type:"pause"})},onContinue:()=>{et(this,wr,la).call(this,{type:"continue"})},retry:m.options.retry,retryDelay:m.options.retryDelay,networkMode:m.options.networkMode,canRun:()=>!0}));try{const Q=await p.start();if(Q===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(Q),(C=(w=q(this,or).config).onSuccess)==null||C.call(w,Q,this),(E=(T=q(this,or).config).onSettled)==null||E.call(T,Q,this.state.error,this),Q}catch(Q){if(Q instanceof jm){if(Q.silent)return q(this,Zt).promise;if(Q.revert){if(this.state.data===void 0)throw Q;return this.state.data}}throw et(this,wr,la).call(this,{type:"error",error:Q}),(A=(k=q(this,or).config).onError)==null||A.call(k,Q,this),(F=(M=q(this,or).config).onSettled)==null||F.call(M,this.state.data,Q,this),Q}finally{q(this,Zt)===p&&Se(this,Zt,void 0),this.scheduleGc()}}},Pl=new WeakMap,Ri=new WeakMap,Ql=new WeakMap,or=new WeakMap,Mi=new WeakMap,Zt=new WeakMap,Mo=new WeakMap,zi=new WeakMap,wr=new WeakSet,la=function(r){const a=l=>{switch(r.type){case"failed":return{...l,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...I1(l.data,this.options),fetchMeta:r.meta??null};case"success":const o={...l,...Bv(r.data,r.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,Ql,r.manual?o:void 0),o;case"error":const u=r.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...r.state}}};this.state=a(this.state),fn.batch(()=>{this.observers.slice().forEach(l=>{l.onQueryUpdate()}),q(this,or).notify({query:this,type:"updated",action:r})})},i1);function I1(t,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:q1(r.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Bv(t,r){return{data:t,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Iv(t){const r=typeof t.initialData=="function"?t.initialData():t.initialData,a=r!==void 0,l=a?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:a?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var wn,tt,zo,Sn,Di,Yl,sa,Do,Vl,Gl,_i,Li,Ka,Kl,ft,go,Em,Tm,Am,Om,Rm,Mm,zm,Dm,l1,Kj=(l1=class extends Ho{constructor(r,a){super();De(this,ft);De(this,wn);De(this,tt);De(this,zo);De(this,Sn);De(this,Di);De(this,Yl);De(this,sa);De(this,Do);De(this,Vl);De(this,Gl);De(this,_i);De(this,Li);De(this,Ka);De(this,Kl,new Set);this.options=a,Se(this,wn,r),Se(this,sa,null),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(q(this,tt).addObserver(this),Fv(q(this,tt),this.options)?et(this,ft,go).call(this):this.updateResult(),et(this,ft,Rm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _m(q(this,tt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _m(q(this,tt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,et(this,ft,Mm).call(this),et(this,ft,zm).call(this),q(this,tt).removeObserver(this)}setOptions(r){const a=this.options,l=q(this,tt);if(this.options=q(this,wn).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ot(this.options.enabled,q(this,tt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");et(this,ft,Dm).call(this),q(this,tt).setOptions(this.options),a._defaulted&&!Kh(this.options,a)&&q(this,wn).getQueryCache().notify({type:"observerOptionsUpdated",query:q(this,tt),observer:this});const o=this.hasListeners();o&&Pv(q(this,tt),l,this.options,a)&&et(this,ft,go).call(this),this.updateResult(),o&&(q(this,tt)!==l||Ot(this.options.enabled,q(this,tt))!==Ot(a.enabled,q(this,tt))||Ot(this.options.staleTime,q(this,tt))!==Ot(a.staleTime,q(this,tt)))&&et(this,ft,Tm).call(this);const u=et(this,ft,Am).call(this);o&&(q(this,tt)!==l||Ot(this.options.enabled,q(this,tt))!==Ot(a.enabled,q(this,tt))||u!==q(this,Ka))&&et(this,ft,Om).call(this,u)}getOptimisticResult(r){const a=q(this,wn).getQueryCache().build(q(this,wn),r),l=this.createResult(a,r);return Kh(this.getCurrentResult(),l)||(Se(this,Sn,l),Se(this,Yl,this.options),Se(this,Di,q(this,tt).state)),l}getCurrentResult(){return q(this,Sn)}trackResult(r,a){return new Proxy(r,{get:(l,o)=>(this.trackProp(o),a==null||a(o),Reflect.get(l,o))})}trackProp(r){q(this,Kl).add(r)}getCurrentQuery(){return q(this,tt)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){const a=q(this,wn).defaultQueryOptions(r),l=q(this,wn).getQueryCache().build(q(this,wn),a);let o=()=>{},u;const d=new Promise(m=>{u=m,o=q(this,wn).getQueryCache().subscribe(p=>{p.type==="updated"&&p.query.queryHash===l.queryHash&&l.state.data!==void 0&&(o(),m(this.createResult(l,a)))})});return Promise.race([l.fetch().then(()=>{const m=this.createResult(l,a);return u==null||u(m),m}).finally(()=>{o()}),d])}fetch(r){return et(this,ft,go).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),q(this,Sn)))}createResult(r,a){var j;const l=q(this,tt),o=this.options,u=q(this,Sn),d=q(this,Di),m=q(this,Yl),p=r!==l?r.state:q(this,zo),{state:y}=r;let x={...y},g=!1,b;if(a._optimisticResults){const L=this.hasListeners(),$=!L&&Fv(r,a),W=L&&Pv(r,l,a,o);($||W)&&(x={...x,...I1(y.data,r.options)}),a._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:w,errorUpdatedAt:C,status:T}=x;b=x.data;let E=!1;if(a.placeholderData!==void 0&&b===void 0&&T==="pending"){let L;u!=null&&u.isPlaceholderData&&a.placeholderData===(m==null?void 0:m.placeholderData)?(L=u.data,E=!0):L=typeof a.placeholderData=="function"?a.placeholderData((j=q(this,Gl))==null?void 0:j.state.data,q(this,Gl)):a.placeholderData,L!==void 0&&(T="success",b=km(u==null?void 0:u.data,L,a),g=!0)}if(a.select&&b!==void 0&&!E)if(u&&b===(d==null?void 0:d.data)&&a.select===q(this,Do))b=q(this,Vl);else try{Se(this,Do,a.select),b=a.select(b),b=km(u==null?void 0:u.data,b,a),Se(this,Vl,b),Se(this,sa,null)}catch(L){Se(this,sa,L)}else b===void 0&&Se(this,sa,null);q(this,sa)&&(w=q(this,sa),b=q(this,Vl),C=Date.now(),T="error",g=!1);const k=x.fetchStatus==="fetching",A=T==="pending",M=T==="error",F=A&&k,Q=b!==void 0;return{status:T,fetchStatus:x.fetchStatus,isPending:A,isSuccess:T==="success",isError:M,isInitialLoading:F,isLoading:F,data:b,dataUpdatedAt:x.dataUpdatedAt,error:w,errorUpdatedAt:C,failureCount:x.fetchFailureCount,failureReason:x.fetchFailureReason,errorUpdateCount:x.errorUpdateCount,isFetched:r.isFetched(),isFetchedAfterMount:x.dataUpdateCount>p.dataUpdateCount||x.errorUpdateCount>p.errorUpdateCount,isFetching:k,isRefetching:k&&!A,isLoadingError:M&&!Q,isPaused:x.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:M&&Q,isStale:yp(r,a),refetch:this.refetch,isEnabled:Ot(a.enabled,r)!==!1}}updateResult(){const r=q(this,Sn),a=this.createResult(q(this,tt),this.options);if(Se(this,Di,q(this,tt).state),Se(this,Yl,this.options),q(this,Di).data!==void 0&&Se(this,Gl,q(this,tt)),Kh(a,r))return;Se(this,Sn,a);const o=(()=>{if(!r)return!0;const{notifyOnChangeProps:u}=this.options,d=typeof u=="function"?u():u;if(d==="all"||!d&&!q(this,Kl).size)return!0;const m=new Set(d??q(this,Kl));return this.options.throwOnError&&m.add("error"),Object.keys(q(this,Sn)).some(p=>{const y=p;return q(this,Sn)[y]!==r[y]&&m.has(y)})})();fn.batch(()=>{o&&this.listeners.forEach(u=>{u(q(this,Sn))}),q(this,wn).getQueryCache().notify({query:q(this,tt),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&et(this,ft,Rm).call(this)}},wn=new WeakMap,tt=new WeakMap,zo=new WeakMap,Sn=new WeakMap,Di=new WeakMap,Yl=new WeakMap,sa=new WeakMap,Do=new WeakMap,Vl=new WeakMap,Gl=new WeakMap,_i=new WeakMap,Li=new WeakMap,Ka=new WeakMap,Kl=new WeakMap,ft=new WeakSet,go=function(r){et(this,ft,Dm).call(this);let a=q(this,tt).fetch(this.options,r);return r!=null&&r.throwOnError||(a=a.catch(Dn)),a},Em=function(r){return!pp()&&Ot(this.options.enabled,q(this,tt))!==!1&&z1(r)},Tm=function(){et(this,ft,Mm).call(this);const r=Ot(this.options.staleTime,q(this,tt));if(q(this,Sn).isStale||!et(this,ft,Em).call(this,r))return;const a=D1(q(this,Sn).dataUpdatedAt,r)+1;Se(this,_i,Ti.setTimeout(()=>{q(this,Sn).isStale||this.updateResult()},a))},Am=function(){return Ot(this.options.refetchInterval,q(this,tt))??!1},Om=function(r){et(this,ft,zm).call(this),Se(this,Ka,r),!(q(this,Ka)===0||!et(this,ft,Em).call(this,q(this,Ka)))&&Se(this,Li,Ti.setInterval(()=>{(this.options.refetchIntervalInBackground||gp.isFocused())&&et(this,ft,go).call(this)},q(this,Ka)))},Rm=function(){et(this,ft,Tm).call(this),et(this,ft,Om).call(this,et(this,ft,Am).call(this))},Mm=function(){q(this,_i)!==void 0&&(Ti.clearTimeout(q(this,_i)),Se(this,_i,void 0))},zm=function(){q(this,Li)!==void 0&&(Ti.clearInterval(q(this,Li)),Se(this,Li,void 0))},Dm=function(){const r=q(this,wn).getQueryCache().build(q(this,wn),this.options);if(r===q(this,tt))return;const a=q(this,tt);Se(this,tt,r),Se(this,zo,r.state),this.hasListeners()&&(a==null||a.removeObserver(this),r.addObserver(this))},l1);function Xj(t,r){return Ot(r.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Ot(r.retryOnMount,t)===!1)}function Fv(t,r){return Xj(t,r)||t.state.data!==void 0&&_m(t,r,r.refetchOnMount)}function _m(t,r,a){if(Ot(r.enabled,t)!==!1&&Ot(r.staleTime,t)!=="static"){const l=Ot(a,t);return l==="always"||l!==!1&&yp(t,r)}return!1}function Pv(t,r,a,l){return(t!==r||Ot(l.enabled,t)===!1)&&(!a.suspense||t.state.status!=="error")&&yp(t,a)}function yp(t,r){return Ot(r.enabled,t)!==!1&&t.isStaleByTime(Ot(r.staleTime,t))}var _o,Hr,mn,Ui,Br,Qa,s1,$j=(s1=class extends B1{constructor(r){super();De(this,Br);De(this,_o);De(this,Hr);De(this,mn);De(this,Ui);Se(this,_o,r.client),this.mutationId=r.mutationId,Se(this,mn,r.mutationCache),Se(this,Hr,[]),this.state=r.state||Zj(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){q(this,Hr).includes(r)||(q(this,Hr).push(r),this.clearGcTimeout(),q(this,mn).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){Se(this,Hr,q(this,Hr).filter(a=>a!==r)),this.scheduleGc(),q(this,mn).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){q(this,Hr).length||(this.state.status==="pending"?this.scheduleGc():q(this,mn).remove(this))}continue(){var r;return((r=q(this,Ui))==null?void 0:r.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(r){var m,p,y,x,g,b,w,C,T,E,k,A,M,F,Q,j,L,$;const a=()=>{et(this,Br,Qa).call(this,{type:"continue"})},l={client:q(this,_o),meta:this.options.meta,mutationKey:this.options.mutationKey},o=Se(this,Ui,H1({fn:()=>this.options.mutationFn?this.options.mutationFn(r,l):Promise.reject(new Error("No mutationFn found")),onFail:(W,z)=>{et(this,Br,Qa).call(this,{type:"failed",failureCount:W,error:z})},onPause:()=>{et(this,Br,Qa).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>q(this,mn).canRun(this)})),u=this.state.status==="pending",d=!o.canStart();try{if(u)a();else{et(this,Br,Qa).call(this,{type:"pending",variables:r,isPaused:d}),q(this,mn).config.onMutate&&await q(this,mn).config.onMutate(r,this,l);const z=await((p=(m=this.options).onMutate)==null?void 0:p.call(m,r,l));z!==this.state.context&&et(this,Br,Qa).call(this,{type:"pending",context:z,variables:r,isPaused:d})}const W=await o.start();return await((x=(y=q(this,mn).config).onSuccess)==null?void 0:x.call(y,W,r,this.state.context,this,l)),await((b=(g=this.options).onSuccess)==null?void 0:b.call(g,W,r,this.state.context,l)),await((C=(w=q(this,mn).config).onSettled)==null?void 0:C.call(w,W,null,this.state.variables,this.state.context,this,l)),await((E=(T=this.options).onSettled)==null?void 0:E.call(T,W,null,r,this.state.context,l)),et(this,Br,Qa).call(this,{type:"success",data:W}),W}catch(W){try{await((A=(k=q(this,mn).config).onError)==null?void 0:A.call(k,W,r,this.state.context,this,l))}catch(z){Promise.reject(z)}try{await((F=(M=this.options).onError)==null?void 0:F.call(M,W,r,this.state.context,l))}catch(z){Promise.reject(z)}try{await((j=(Q=q(this,mn).config).onSettled)==null?void 0:j.call(Q,void 0,W,this.state.variables,this.state.context,this,l))}catch(z){Promise.reject(z)}try{await(($=(L=this.options).onSettled)==null?void 0:$.call(L,void 0,W,r,this.state.context,l))}catch(z){Promise.reject(z)}throw et(this,Br,Qa).call(this,{type:"error",error:W}),W}finally{q(this,Ui)===o&&Se(this,Ui,void 0),q(this,mn).runNext(this)}}},_o=new WeakMap,Hr=new WeakMap,mn=new WeakMap,Ui=new WeakMap,Br=new WeakSet,Qa=function(r){const a=l=>{switch(r.type){case"failed":return{...l,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...l,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:r.error,failureCount:l.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=a(this.state),fn.batch(()=>{q(this,Hr).forEach(l=>{l.onMutationUpdate(r)}),q(this,mn).notify({mutation:this,type:"updated",action:r})})},s1);function Zj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var oa,Sr,Lo,o1,Jj=(o1=class extends Ho{constructor(r={}){super();De(this,oa);De(this,Sr);De(this,Lo);this.config=r,Se(this,oa,new Set),Se(this,Sr,new Map),Se(this,Lo,0)}build(r,a,l){const o=new $j({client:r,mutationCache:this,mutationId:++Sc(this,Lo)._,options:r.defaultMutationOptions(a),state:l});return this.add(o),o}add(r){q(this,oa).add(r);const a=Cc(r);if(typeof a=="string"){const l=q(this,Sr).get(a);l?l.push(r):q(this,Sr).set(a,[r])}this.notify({type:"added",mutation:r})}remove(r){if(q(this,oa).delete(r)){const a=Cc(r);if(typeof a=="string"){const l=q(this,Sr).get(a);if(l)if(l.length>1){const o=l.indexOf(r);o!==-1&&l.splice(o,1)}else l[0]===r&&q(this,Sr).delete(a)}}this.notify({type:"removed",mutation:r})}canRun(r){var l;const a=Cc(r);if(typeof a=="string"){const o=(l=q(this,Sr).get(a))==null?void 0:l.find(u=>u.state.status==="pending");return!o||o===r}else return!0}runNext(r){var l,o;const a=Cc(r);return typeof a=="string"?((o=(l=q(this,Sr).get(a))==null?void 0:l.find(u=>u!==r&&u.state.isPaused))==null?void 0:o.continue())??Promise.resolve():Promise.resolve()}clear(){fn.batch(()=>{q(this,oa).forEach(r=>{this.notify({type:"removed",mutation:r})}),q(this,oa).clear(),q(this,Sr).clear()})}getAll(){return Array.from(q(this,oa))}find(r){const a={exact:!0,...r};return this.getAll().find(l=>Lv(a,l))}findAll(r={}){return this.getAll().filter(a=>Lv(r,a))}notify(r){fn.batch(()=>{this.listeners.forEach(a=>{a(r)})})}resumePausedMutations(){const r=this.getAll().filter(a=>a.state.isPaused);return fn.batch(()=>Promise.all(r.map(a=>a.continue().catch(Dn))))}},oa=new WeakMap,Sr=new WeakMap,Lo=new WeakMap,o1);function Cc(t){var r;return(r=t.options.scope)==null?void 0:r.id}var Ir,u1,Wj=(u1=class extends Ho{constructor(r={}){super();De(this,Ir);this.config=r,Se(this,Ir,new Map)}build(r,a,l){const o=a.queryKey,u=a.queryHash??hp(o,a);let d=this.get(u);return d||(d=new Gj({client:r,queryKey:o,queryHash:u,options:r.defaultQueryOptions(a),state:l,defaultOptions:r.getQueryDefaults(o)}),this.add(d)),d}add(r){q(this,Ir).has(r.queryHash)||(q(this,Ir).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){const a=q(this,Ir).get(r.queryHash);a&&(r.destroy(),a===r&&q(this,Ir).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){fn.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return q(this,Ir).get(r)}getAll(){return[...q(this,Ir).values()]}find(r){const a={exact:!0,...r};return this.getAll().find(l=>_v(a,l))}findAll(r={}){const a=this.getAll();return Object.keys(r).length>0?a.filter(l=>_v(r,l)):a}notify(r){fn.batch(()=>{this.listeners.forEach(a=>{a(r)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},Ir=new WeakMap,u1),_t,Xa,$a,Xl,$l,Za,Zl,Jl,c1,eE=(c1=class{constructor(t={}){De(this,_t);De(this,Xa);De(this,$a);De(this,Xl);De(this,$l);De(this,Za);De(this,Zl);De(this,Jl);Se(this,_t,t.queryCache||new Wj),Se(this,Xa,t.mutationCache||new Jj),Se(this,$a,t.defaultOptions||{}),Se(this,Xl,new Map),Se(this,$l,new Map),Se(this,Za,0)}mount(){Sc(this,Za)._++,q(this,Za)===1&&(Se(this,Zl,gp.subscribe(async t=>{t&&(await this.resumePausedMutations(),q(this,_t).onFocus())})),Se(this,Jl,Lc.subscribe(async t=>{t&&(await this.resumePausedMutations(),q(this,_t).onOnline())})))}unmount(){var t,r;Sc(this,Za)._--,q(this,Za)===0&&((t=q(this,Zl))==null||t.call(this),Se(this,Zl,void 0),(r=q(this,Jl))==null||r.call(this),Se(this,Jl,void 0))}isFetching(t){return q(this,_t).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return q(this,Xa).findAll({...t,status:"pending"}).length}getQueryData(t){var a;const r=this.defaultQueryOptions({queryKey:t});return(a=q(this,_t).get(r.queryHash))==null?void 0:a.state.data}ensureQueryData(t){const r=this.defaultQueryOptions(t),a=q(this,_t).build(this,r),l=a.state.data;return l===void 0?this.fetchQuery(t):(t.revalidateIfStale&&a.isStaleByTime(Ot(r.staleTime,a))&&this.prefetchQuery(r),Promise.resolve(l))}getQueriesData(t){return q(this,_t).findAll(t).map(({queryKey:r,state:a})=>[r,a.data])}setQueryData(t,r,a){var d;const l=this.defaultQueryOptions({queryKey:t}),o=(d=q(this,_t).get(l.queryHash))==null?void 0:d.state.data,u=zj(r,o);if(u!==void 0)return q(this,_t).build(this,l).setData(u,{...a,manual:!0})}setQueriesData(t,r,a){return fn.batch(()=>q(this,_t).findAll(t).map(({queryKey:l})=>[l,this.setQueryData(l,r,a)]))}getQueryState(t){var a;const r=this.defaultQueryOptions({queryKey:t});return(a=q(this,_t).get(r.queryHash))==null?void 0:a.state}removeQueries(t){const r=q(this,_t);fn.batch(()=>{r.findAll(t).forEach(a=>{r.remove(a)})})}resetQueries(t,r){const a=q(this,_t);return fn.batch(()=>{const l=a.findAll(t),o=new Set(l);return l.forEach(u=>{u.reset()}),this.refetchQueries({type:"active",predicate:u=>o.has(u)},r)})}cancelQueries(t,r={}){const a={revert:!0,...r},l=fn.batch(()=>q(this,_t).findAll(t).map(o=>o.cancel(a)));return Promise.all(l).then(Dn).catch(Dn)}invalidateQueries(t,r={}){return fn.batch(()=>(q(this,_t).findAll(t).forEach(a=>{a.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},r)))}refetchQueries(t,r={}){const a={...r,cancelRefetch:r.cancelRefetch??!0},l=fn.batch(()=>q(this,_t).findAll(t).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let u=o.fetch(void 0,a);return a.throwOnError||(u=u.catch(Dn)),o.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(Dn)}async query(t){const r=this.defaultQueryOptions(t);r.retry===void 0&&(r.retry=!1);const a=q(this,_t).build(this,r),l=a.isStaleByTime(Ot(r.staleTime,a))?await a.fetch(r):a.state.data,o=r.select;return o?o(l):l}fetchQuery(t){const r=this.defaultQueryOptions(t);r.retry===void 0&&(r.retry=!1);const a=q(this,_t).build(this,r);return a.isStaleByTime(Ot(r.staleTime,a))?a.fetch(r):Promise.resolve(a.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Dn).catch(Dn)}infiniteQuery(t){return t._type="infinite",this.query(t)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Dn).catch(Dn)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return Lc.isOnline()?q(this,Xa).resumePausedMutations():Promise.resolve()}getQueryCache(){return q(this,_t)}getMutationCache(){return q(this,Xa)}getDefaultOptions(){return q(this,$a)}setDefaultOptions(t){Se(this,$a,t)}setQueryDefaults(t,r){q(this,Xl).set(wo(t),{queryKey:t,defaultOptions:r})}getQueryDefaults(t){const r=[...q(this,Xl).values()],a={};return r.forEach(l=>{es(t,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(t,r){q(this,$l).set(wo(t),{mutationKey:t,defaultOptions:r})}getMutationDefaults(t){const r=[...q(this,$l).values()],a={};return r.forEach(l=>{es(t,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(t){if(t._defaulted)return t;const r={...q(this,$a).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return r.queryHash||(r.queryHash=hp(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===mp&&(r.enabled=!1),r}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...q(this,$a).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){q(this,_t).clear(),q(this,Xa).clear()}},_t=new WeakMap,Xa=new WeakMap,$a=new WeakMap,Xl=new WeakMap,$l=new WeakMap,Za=new WeakMap,Zl=new WeakMap,Jl=new WeakMap,c1);const F1=S.createContext(!1),tE=()=>S.useContext(F1);F1.Provider;function nE(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const rE=S.createContext(nE()),aE=()=>S.useContext(rE),iE=(t,r,a)=>{const l=a!=null&&a.state.error&&typeof t.throwOnError=="function"?U1(t.throwOnError,[a.state.error,a]):t.throwOnError;(t.suspense||l)&&(r.isReset()||(t.retryOnMount=!1))},lE=t=>{S.useEffect(()=>{t.clearReset()},[t])},sE=({result:t,errorResetBoundary:r,throwOnError:a,query:l,suspense:o})=>t.isError&&!r.isReset()&&!t.isFetching&&l&&(o&&t.data===void 0||U1(a,[t.error,l])),oE=t=>{if(t.suspense){const a=o=>o==="static"?o:Math.max(o??1e3,1e3),l=t.staleTime;t.staleTime=typeof l=="function"?(...o)=>a(l(...o)):a(l),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},uE=(t,r)=>(t==null?void 0:t.suspense)&&r.isPending,cE=(t,r,a)=>r.fetchOptimistic(t).catch(()=>{a.clearReset()});function dE(t,r,a){const l=tE(),o=aE(),u=Mt(),d=u.defaultQueryOptions(t),m=u.getQueryCache().get(d.queryHash),p=t.subscribed!==!1;d._optimisticResults=l?"isRestoring":p?"optimistic":void 0,oE(d),iE(d,o,m),lE(o);const[y]=S.useState(()=>new r(u,d)),x=y.getOptimisticResult(d),g=!l&&p;if(S.useSyncExternalStore(S.useCallback(b=>{const w=g?y.subscribe(fn.batchCalls(b)):Dn;return y.updateResult(),w},[y,g]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(d)},[d,y]),uE(d,x))throw cE(d,y,o);if(sE({result:x,errorResetBoundary:o,throwOnError:d.throwOnError,query:m,suspense:d.suspense}))throw x.error;return d.notifyOnChangeProps?x:y.trackResult(x)}function Cn(t,r){return dE(t,Kj)}const Qv=t=>{let r;const a=new Set,l=(y,x)=>{const g=typeof y=="function"?y(r):y;if(!Object.is(g,r)){const b=r;r=x??(typeof g!="object"||g===null)?g:Object.assign({},r,g),a.forEach(w=>w(r,b))}},o=()=>r,m={setState:l,getState:o,getInitialState:()=>p,subscribe:y=>(a.add(y),()=>a.delete(y))},p=r=t(l,o,m);return m},fE=(t=>t?Qv(t):Qv),hE=t=>t;function mE(t,r=hE){const a=po.useSyncExternalStore(t.subscribe,po.useCallback(()=>r(t.getState()),[t,r]),po.useCallback(()=>r(t.getInitialState()),[t,r]));return po.useDebugValue(a),a}const Yv=t=>{const r=fE(t),a=l=>mE(r,l);return Object.assign(a,r),a},Wa=(t=>t?Yv(t):Yv),yo={theme:"light",highContrast:!1,fontSize:"normal"},P1=["light","dark"],Q1=["small","normal","big"],xp="kai_appearance";function pE(){try{const t=JSON.parse(localStorage.getItem(xp)??"null");return!t||typeof t!="object"?yo:{theme:P1.includes(t.theme)?t.theme:yo.theme,highContrast:t.highContrast===!0,fontSize:Q1.includes(t.fontSize)?t.fontSize:yo.fontSize}}catch{return yo}}function gE(t){try{localStorage.setItem(xp,JSON.stringify(t))}catch{}}function Vv(t,r=document.documentElement){r.classList.toggle("dark",t.theme==="dark"),r.classList.toggle("high-contrast",t.highContrast),r.dataset.fontSize=t.fontSize,r.style.colorScheme=t.theme}`${JSON.stringify(xp)}`;const So=Wa((t,r)=>({appearance:yo,hydrate:()=>{const a=pE();Vv(a),t({appearance:a})},update:a=>{const l={...r().appearance,...a};Vv(l),gE(l),t({appearance:l})}})),Xc="kai_access_token",bp="kai_refresh_token";function No(){return typeof window>"u"?null:localStorage.getItem(Xc)}function yE(){return typeof window>"u"?null:localStorage.getItem(bp)}function $c(t,r){typeof window>"u"||(localStorage.setItem(Xc,t),localStorage.setItem(bp,r))}function xE(t){typeof window>"u"||localStorage.setItem(Xc,t)}function bE(){typeof window>"u"||(localStorage.removeItem(Xc),localStorage.removeItem(bp))}function Bo(t){return{id:t.id,email:t.email,displayName:t.displayName,avatarUrl:t.avatarUrl,orgId:t.orgId,orgName:t.orgName,orgTheme:t.orgTheme??null,orgRole:t.orgRole,isPlatformAdmin:t.isPlatformAdmin,mustChangePassword:t.mustChangePassword,...t.mfaPending?{mfaPending:t.mfaPending}:{}}}function vp(t){return!!t&&(t.isPlatformAdmin||t.orgRole==="owner"||t.orgRole==="admin")}function Zc(t){return!!t&&t.orgRole!=="chatter"}const mt=Wa(t=>({user:null,setUser:r=>t({user:r}),logout:()=>{bE(),t({user:null})}})),Y1=/^#[0-9a-f]{6}$/i;function vE(t){if(typeof t!="string"||!Y1.test(t))return null;const r=parseInt(t.slice(1,3),16)/255,a=parseInt(t.slice(3,5),16)/255,l=parseInt(t.slice(5,7),16)/255,o=Math.max(r,a,l),u=Math.min(r,a,l),d=(o+u)/2,m=o-u;let p=0,y=0;return m!==0&&(y=m/(1-Math.abs(2*d-1)),o===r?p=(a-l)/m%6:o===a?p=(l-r)/m+2:p=(r-a)/m+4,p*=60,p<0&&(p+=360)),`${Math.round(p)} ${Math.round(y*100)}% ${Math.round(d*100)}%`}const V1=[["background",["--background"]],["foreground",["--foreground"]],["primary",["--primary","--ring"]],["primaryForeground",["--primary-foreground"]],["accent",["--accent"]],["card",["--card","--popover"]],["border",["--border","--input"]]],wE=[...V1.flatMap(([,t])=>t),"--app-gradient"];function SE(t=document.documentElement){for(const r of wE)t.style.removeProperty(r)}function NE(t){if(!t)return null;const r=[t.from,t.via,t.to].filter(l=>l!==void 0),a=t.angle;return r.length<2||!r.every(l=>Y1.test(l))||typeof a!="number"||!Number.isFinite(a)?null:`linear-gradient(${Math.min(360,Math.max(0,a))}deg, ${r.join(", ")})`}function CE(t,r,a,l=document.documentElement){if(SE(l),!t||a)return;const o=t[r];if(!o)return;for(const[d,m]of V1){const p=o[d]?vE(o[d]):null;if(p)for(const y of m)l.style.setProperty(y,p)}const u=NE(o.gradient);u&&l.style.setProperty("--app-gradient",u)}function kE(){const t=mt(l=>{var o;return((o=l.user)==null?void 0:o.orgTheme)??null}),r=So(l=>l.appearance.theme),a=So(l=>l.appearance.highContrast);return S.useEffect(()=>{CE(t,r,a)},[t,r,a]),null}const jE=new eE({defaultOptions:{queries:{staleTime:3e4,retry:1}}});function EE({children:t}){return S.useEffect(()=>{So.getState().hydrate()},[]),c.jsxs(Tj,{client:jE,children:[c.jsx(kE,{}),t]})}function _n(){const t=sp(),r=S.useRef(t);return r.current=t,S.useMemo(()=>({push:a=>r.current(a),replace:a=>r.current(a,{replace:!0}),back:()=>r.current(-1),forward:()=>r.current(1),refresh:()=>{},prefetch:a=>{}}),[])}function Io(){return kr().pathname}/**
61
+ * @license lucide-react v0.468.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 TE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),G1=(...t)=>t.filter((r,a,l)=>!!r&&r.trim()!==""&&l.indexOf(r)===a).join(" ").trim();/**
66
+ * @license lucide-react v0.468.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
+ */var AE={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"};/**
71
+ * @license lucide-react v0.468.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 OE=S.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:a=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:d,...m},p)=>S.createElement("svg",{ref:p,...AE,width:r,height:r,stroke:t,strokeWidth:l?Number(a)*24/Number(r):a,className:G1("lucide",o),...m},[...d.map(([y,x])=>S.createElement(y,x)),...Array.isArray(u)?u:[u]]));/**
76
+ * @license lucide-react v0.468.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 nt=(t,r)=>{const a=S.forwardRef(({className:l,...o},u)=>S.createElement(OE,{ref:u,iconNode:r,className:G1(`lucide-${TE(t)}`,l),...o}));return a.displayName=`${t}`,a};/**
81
+ * @license lucide-react v0.468.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const RE=nt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
86
+ * @license lucide-react v0.468.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 Fo=nt("Bot",[["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"}]]);/**
91
+ * @license lucide-react v0.468.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 ME=nt("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
96
+ * @license lucide-react v0.468.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 K1=nt("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
101
+ * @license lucide-react v0.468.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 zE=nt("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
106
+ * @license lucide-react v0.468.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 DE=nt("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/**
111
+ * @license lucide-react v0.468.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 X1=nt("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/**
116
+ * @license lucide-react v0.468.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 _E=nt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
121
+ * @license lucide-react v0.468.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 LE=nt("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
126
+ * @license lucide-react v0.468.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 UE=nt("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
131
+ * @license lucide-react v0.468.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 qE=nt("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
136
+ * @license lucide-react v0.468.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 $1=nt("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/**
141
+ * @license lucide-react v0.468.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 HE=nt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
146
+ * @license lucide-react v0.468.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 BE=nt("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
151
+ * @license lucide-react v0.468.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 IE=nt("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
156
+ * @license lucide-react v0.468.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 FE=nt("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
161
+ * @license lucide-react v0.468.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 PE=nt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
166
+ * @license lucide-react v0.468.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 QE=nt("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
171
+ * @license lucide-react v0.468.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 YE=nt("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
176
+ * @license lucide-react v0.468.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 VE=nt("Pencil",[["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"}]]);/**
181
+ * @license lucide-react v0.468.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 Z1=nt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
186
+ * @license lucide-react v0.468.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 GE=nt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
191
+ * @license lucide-react v0.468.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 J1=nt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
196
+ * @license lucide-react v0.468.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 Jc=nt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
201
+ * @license lucide-react v0.468.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 KE=nt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
206
+ * @license lucide-react v0.468.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 W1=nt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
211
+ * @license lucide-react v0.468.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 XE=nt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
216
+ * @license lucide-react v0.468.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 $E=nt("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
221
+ * @license lucide-react v0.468.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 wp=nt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
226
+ * @license lucide-react v0.468.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 ew=nt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
231
+ * @license lucide-react v0.468.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 Sp=nt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
236
+ * @license lucide-react v0.468.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 ZE=nt("UserPlus",[["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"}]]);/**
241
+ * @license lucide-react v0.468.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 Wc=nt("Users",[["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"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
246
+ * @license lucide-react v0.468.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 JE=nt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
251
+ * @license lucide-react v0.468.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 tw=nt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),nw="kai_server_url",WE="https://kai-chat.eutima.ch",Lm=()=>WE;function ts(){try{return localStorage.getItem(nw)||Lm()}catch{return Lm()}}function eT(t){let r=t.trim().replace(/\/+$/,"");r&&!/^https?:\/\//i.test(r)&&(r=`http://${r}`),localStorage.setItem(nw,r||Lm())}const tT=ts;function nT(){return ts().replace(/^http/,"ws")}class rw extends Error{constructor(r,a){super(`API Error ${r}: ${a}`),this.status=r,this.name="ApiError"}}class Um extends Error{constructor(){super("Your session has expired. Please sign in again."),this.name="SessionExpiredError"}}let Xh=null;const rT=new Set(["/api/auth/login","/api/auth/refresh","/api/auth/set-password"]);function aw(){return Xh??(Xh=(async()=>{const t=yE();if(!t)throw mt.getState().logout(),new Um;let r;try{r=await ue.auth.refresh({refreshToken:t})}catch(a){throw a instanceof rw&&(a.status===400||a.status===401)?(mt.getState().logout(),new Um):a}return xE(r.accessToken),r.accessToken})().finally(()=>{Xh=null})),Xh}class aT{constructor(){$t(this,"auth",{changePassword:r=>this.request("/api/auth/change-password",{method:"POST",body:JSON.stringify(r)}),login:r=>this.request("/api/auth/login",{method:"POST",body:JSON.stringify(r)}),refresh:r=>this.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(r)}),me:()=>this.request("/api/auth/me"),updateMe:r=>this.request("/api/auth/me",{method:"PATCH",body:JSON.stringify(r)}),logout:()=>this.request("/api/auth/logout",{method:"POST"}),setPassword:r=>this.request("/api/auth/set-password",{method:"POST",body:JSON.stringify(r)}),mfa:{setup:()=>this.request("/api/auth/mfa/setup",{method:"POST"}),confirm:r=>this.request("/api/auth/mfa/confirm",{method:"POST",body:JSON.stringify(r)}),verify:r=>this.request("/api/auth/mfa/verify",{method:"POST",body:JSON.stringify(r)})}});$t(this,"mcp",{list:r=>this.request(`/api/mcp-servers${r!=null&&r.accessibleOnly?"?accessibleOnly=true":""}`),create:r=>this.request("/api/mcp-servers",{method:"POST",body:JSON.stringify(r)}),update:(r,a)=>this.request(`/api/mcp-servers/${r}`,{method:"PATCH",body:JSON.stringify(a)}),delete:r=>this.request(`/api/mcp-servers/${r}`,{method:"DELETE"}),test:r=>this.request("/api/mcp-servers/test",{method:"POST",body:JSON.stringify(r)}),oauthDiscover:r=>this.request("/api/mcp-servers/oauth/discover",{method:"POST",body:JSON.stringify(r)}),bind:(r,a)=>this.request(`/api/agents/${r}/mcp`,{method:"POST",body:JSON.stringify(a)}),unbind:(r,a)=>this.request(`/api/agents/${r}/mcp/${a}`,{method:"DELETE"}),oauthConnect:r=>this.request(`/api/mcp-servers/${r}/oauth/connect`,{method:"POST"}),oauthDisconnect:r=>this.request(`/api/mcp-servers/${r}/oauth`,{method:"DELETE"})});$t(this,"schedules",{list:()=>this.request("/api/schedules"),create:r=>this.request("/api/schedules",{method:"POST",body:JSON.stringify(r)}),update:(r,a)=>this.request(`/api/schedules/${r}`,{method:"PATCH",body:JSON.stringify(a)}),delete:r=>this.request(`/api/schedules/${r}`,{method:"DELETE"})});$t(this,"admin",{orgs:{list:()=>this.request("/api/admin/orgs"),create:r=>this.request("/api/admin/orgs",{method:"POST",body:JSON.stringify({name:r})}),update:(r,a)=>this.request(`/api/admin/orgs/${r}`,{method:"PATCH",body:JSON.stringify({name:a})}),delete:r=>this.request(`/api/admin/orgs/${r}`,{method:"DELETE"})},orgTheme:{get:r=>this.request(`/api/admin/orgs/${r}/theme`),update:(r,a)=>this.request(`/api/admin/orgs/${r}/theme`,{method:"PUT",body:JSON.stringify({theme:a})})},mcp:{list:r=>this.request(`/api/admin/orgs/${r}/mcp-servers`),create:(r,a)=>this.request(`/api/admin/orgs/${r}/mcp-servers`,{method:"POST",body:JSON.stringify(a)}),update:(r,a,l)=>this.request(`/api/admin/orgs/${r}/mcp-servers/${a}`,{method:"PATCH",body:JSON.stringify(l)}),delete:(r,a)=>this.request(`/api/admin/orgs/${r}/mcp-servers/${a}`,{method:"DELETE"}),test:(r,a)=>this.request(`/api/admin/orgs/${r}/mcp-servers/test`,{method:"POST",body:JSON.stringify(a)}),oauthDiscover:(r,a)=>this.request(`/api/admin/orgs/${r}/mcp-servers/oauth/discover`,{method:"POST",body:JSON.stringify(a)})},llm:{config:r=>this.request(`/api/admin/orgs/${r}/llm`),testProvider:(r,a)=>this.request(`/api/admin/orgs/${r}/llm/providers/test`,{method:"POST",body:JSON.stringify(a)}),createProvider:(r,a)=>this.request(`/api/admin/orgs/${r}/llm/providers`,{method:"POST",body:JSON.stringify(a)}),updateProvider:(r,a,l)=>this.request(`/api/admin/orgs/${r}/llm/providers/${a}`,{method:"PATCH",body:JSON.stringify(l)}),deleteProvider:(r,a)=>this.request(`/api/admin/orgs/${r}/llm/providers/${a}`,{method:"DELETE"}),createModel:(r,a)=>this.request(`/api/admin/orgs/${r}/llm/models`,{method:"POST",body:JSON.stringify(a)}),updateModel:(r,a,l)=>this.request(`/api/admin/orgs/${r}/llm/models/${a}`,{method:"PATCH",body:JSON.stringify(l)}),deleteModel:(r,a)=>this.request(`/api/admin/orgs/${r}/llm/models/${a}`,{method:"DELETE"}),testModel:(r,a)=>this.request(`/api/admin/orgs/${r}/llm/models/${a}/test`,{method:"POST"})},users:{list:r=>this.request(`/api/admin/users${r?`?orgId=${encodeURIComponent(r)}`:""}`),create:r=>this.request("/api/admin/users",{method:"POST",body:JSON.stringify(r)}),sendPasswordLink:r=>this.request(`/api/admin/users/${r}/password-link`,{method:"POST"}),setMfaRequired:(r,a)=>this.request(`/api/admin/users/${r}/mfa`,{method:"PATCH",body:JSON.stringify(a)}),resetMfa:r=>this.request(`/api/admin/users/${r}/mfa/reset`,{method:"POST"}),update:(r,a)=>this.request(`/api/admin/users/${r}`,{method:"PATCH",body:JSON.stringify(a)}),delete:r=>this.request(`/api/admin/users/${r}`,{method:"DELETE"})}});$t(this,"llm",{models:()=>this.request("/api/llm/models")});$t(this,"conversations",{list:()=>this.request("/api/conversations"),create:r=>this.request("/api/conversations",{method:"POST",body:JSON.stringify(r)}),get:r=>this.request(`/api/conversations/${r}`),delete:r=>this.request(`/api/conversations/${r}`,{method:"DELETE"}),clear:r=>this.request(`/api/conversations/${r}/clear`,{method:"POST"}),rename:(r,a)=>{const l={title:a};return this.request(`/api/conversations/${r}`,{method:"PATCH",body:JSON.stringify(l)})},markRead:r=>this.request(`/api/conversations/${r}/read`,{method:"POST"}),messages:(r,a)=>{const l=a?`?cursor=${encodeURIComponent(a)}`:"";return this.request(`/api/conversations/${r}/messages${l}`)},sendMessage:(r,a)=>this.request(`/api/conversations/${r}/messages`,{method:"POST",body:JSON.stringify(a)}),startExecution:r=>this.request(`/api/conversations/${r}/executions`,{method:"POST"}),addParticipants:(r,a)=>{const l={userIds:a};return this.request(`/api/conversations/${r}/participants`,{method:"POST",body:JSON.stringify(l)})},forward:(r,a)=>this.request(`/api/conversations/${r}/forward`,{method:"POST",body:JSON.stringify(a)}),uploadAttachment:(r,a)=>{const l=new FormData;return l.append("file",a,a.name),this.request(`/api/conversations/${r}/attachments`,{method:"POST",body:l})}});$t(this,"attachments",{blob:r=>this.request(`/api/attachments/${r}`,{},"blob"),delete:r=>this.request(`/api/attachments/${r}`,{method:"DELETE"})});$t(this,"orgs",{members:r=>this.request(`/api/orgs/${r}/members`)});$t(this,"transcription",{status:()=>this.request("/api/transcription"),transcribe:r=>{const a=new FormData;return a.append("file",r,"recording"),this.request("/api/transcription",{method:"POST",body:a})}});$t(this,"agents",{list:()=>this.request("/api/agents"),create:r=>this.request("/api/agents",{method:"POST",body:JSON.stringify(r)}),get:r=>this.request(`/api/agents/${r}`),update:(r,a)=>this.request(`/api/agents/${r}`,{method:"PATCH",body:JSON.stringify(a)}),delete:r=>this.request(`/api/agents/${r}`,{method:"DELETE"}),share:(r,a)=>this.request(`/api/agents/${r}/share`,{method:"POST",body:JSON.stringify(a)}),export:r=>this.request(`/api/agents/${r}/export`),import:r=>this.request("/api/agents/import",{method:"POST",body:JSON.stringify(r)}),skills:{create:(r,a)=>this.request(`/api/agents/${r}/skills`,{method:"POST",body:JSON.stringify(a)}),update:(r,a,l)=>this.request(`/api/agents/${r}/skills/${a}`,{method:"PATCH",body:JSON.stringify(l)}),delete:(r,a)=>this.request(`/api/agents/${r}/skills/${a}`,{method:"DELETE"})},rules:{create:(r,a)=>this.request(`/api/agents/${r}/rules`,{method:"POST",body:JSON.stringify(a)}),update:(r,a,l)=>this.request(`/api/agents/${r}/rules/${a}`,{method:"PATCH",body:JSON.stringify(l)}),delete:(r,a)=>this.request(`/api/agents/${r}/rules/${a}`,{method:"DELETE"})},hooks:{create:(r,a)=>this.request(`/api/agents/${r}/hooks`,{method:"POST",body:JSON.stringify(a)}),update:(r,a,l)=>this.request(`/api/agents/${r}/hooks/${a}`,{method:"PATCH",body:JSON.stringify(l)}),delete:(r,a)=>this.request(`/api/agents/${r}/hooks/${a}`,{method:"DELETE"})}});$t(this,"executions",{get:r=>this.request(`/api/executions/${r}`),cancel:r=>this.request(`/api/executions/${r}`,{method:"DELETE"}),respondToApproval:(r,a,l)=>this.request(`/api/executions/${r}/approvals/${a}/respond`,{method:"POST",body:JSON.stringify(l)})})}async request(r,a={},l="json",o=!1){const u=No(),d={...a.body!=null&&!(a.body instanceof FormData)?{"Content-Type":"application/json"}:{},...a.headers};u&&(d.Authorization=`Bearer ${u}`);const m=await fetch(`${tT()}${r}`,{...a,headers:d});if(m.status===401&&u&&!o&&!rT.has(r)){let p=null;try{p=await aw()}catch{}if(p!=null)return this.request(r,a,l,!0)}if(!m.ok){let p=m.statusText;try{const y=await m.json();p=y.message??y.error??p}catch{}throw new rw(m.status,p)}if(m.status!==204)return l==="blob"?m.blob():m.json()}}const ue=new aT,$h=1e3,iT=3e4,lT=1008;class sT{constructor(){$t(this,"ws",null);$t(this,"handlers",new Map);$t(this,"reconnectTimer",null);$t(this,"reconnectDelay",$h);$t(this,"token",null);$t(this,"shouldReconnect",!1);$t(this,"statusHandlers",new Set)}onStatusChange(r){return this.statusHandlers.add(r),()=>this.statusHandlers.delete(r)}emitStatus(r){this.statusHandlers.forEach(a=>a(r))}connect(r){this.token=r,this.shouldReconnect=!0,this.reconnectDelay=$h,this.openConnection()}openConnection(){this.ws&&(this.ws.onclose=null,this.ws.close());const r=`${nT()}/ws?token=${encodeURIComponent(this.token)}`;this.ws=new WebSocket(r),this.ws.onopen=()=>{this.reconnectDelay=$h,this.emitStatus("connected")},this.ws.onmessage=a=>{try{const l=JSON.parse(a.data),o=this.handlers.get(l.type);o&&o.forEach(u=>u(l.payload,l))}catch{}},this.ws.onclose=a=>{if(this.ws=null,!this.shouldReconnect){this.emitStatus("disconnected");return}this.emitStatus("reconnecting"),(a==null?void 0:a.code)===lT?this.renewToken():this.scheduleReconnect()},this.ws.onerror=()=>{}}async renewToken(){try{this.token=await aw()}catch(r){if(r instanceof Um){this.shouldReconnect=!1,this.emitStatus("disconnected");return}}this.shouldReconnect&&this.scheduleReconnect()}scheduleReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.shouldReconnect&&(this.openConnection(),this.reconnectDelay=Math.min(this.reconnectDelay*2,iT))},this.reconnectDelay)}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.onclose=null,this.ws.close(),this.ws=null),this.emitStatus("disconnected")}send(r){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(r))}on(r,a){return this.handlers.has(r)||this.handlers.set(r,new Set),this.handlers.get(r).add(a),()=>{var l;(l=this.handlers.get(r))==null||l.delete(a)}}}const Ge=new sT,Po=Wa(t=>({status:"disconnected",setStatus:r=>t({status:r})})),Co=Wa(t=>({isSidebarOpen:!1,openSidebar:()=>t({isSidebarOpen:!0}),closeSidebar:()=>t({isSidebarOpen:!1}),toggleSidebar:()=>t(r=>({isSidebarOpen:!r.isSidebarOpen}))}));function oT(){const t=window.AudioContext??window.webkitAudioContext;if(t)try{const r=new t,a=r.currentTime;[880,1320].forEach((l,o)=>{const u=a+o*.12,d=r.createOscillator(),m=r.createGain();d.type="sine",d.frequency.value=l,m.gain.setValueAtTime(0,u),m.gain.linearRampToValueAtTime(.2,u+.01),m.gain.exponentialRampToValueAtTime(1e-4,u+.3),d.connect(m).connect(r.destination),d.start(u),d.stop(u+.35)}),setTimeout(()=>void r.close(),700)}catch{}}function iw(){return typeof window<"u"&&"Notification"in window}function uT(){!iw()||Notification.permission!=="default"||Notification.requestPermission()}function cT(t,r){if(!(!iw()||Notification.permission!=="granted"))try{const a=new Notification(`New message from: ${t??"Someone"}`,{body:"Click to open the conversation",tag:"kai-new-message"});a.onclick=()=>{window.focus(),r(),a.close()}}catch{}}function dT(t){var m;const r=mt(p=>{var y;return(y=p.user)==null?void 0:y.id}),a=S.useRef(r);a.current=r;const l=_n(),o=Io(),u=(m=o==null?void 0:o.match(/^\/conversations\/([^/]+)/))==null?void 0:m[1],d=S.useRef(u);d.current=u,S.useEffect(()=>{t&&uT()},[t]),S.useEffect(()=>{if(t)return Ge.on("chat.message",p=>{const y=p;y.streaming||y.senderType==="user"&&y.senderId===a.current||(y.conversationId!==d.current&&oT(),document.hasFocus()||cT(y.senderName,()=>l.push(`/conversations/${y.conversationId}`)))})},[t,l])}function Xn({href:t,prefetch:r,scroll:a,...l}){return c.jsx(Kc,{to:t,...l})}function Np(){return Cn({queryKey:["conversations"],queryFn:()=>ue.conversations.list()})}function fT(t){return Cn({queryKey:["conversations",t],queryFn:()=>ue.conversations.get(t),enabled:!!t})}function lw(t,r){t.setQueryData(["conversations"],a=>a&&{...a,conversations:a.conversations.filter(l=>l.id!==r)}),t.removeQueries({queryKey:["conversations",r]}),t.invalidateQueries({queryKey:["conversations"],exact:!0})}function ql(t,r){if(t.title)return t.title;if(t.type==="human"){const a=t.participants.filter(l=>l.userId!==r&&l.name).map(l=>l.name);if(a.length>0)return a.join(", ")}if(t.type==="agent"){const a=t.participants.find(l=>l.agentId&&l.name);if(a)return a.name}return"Untitled conversation"}function hT(t,r){const a=t.type==="agent"?t.participants.find(l=>l.agentId):t.type==="human"?t.participants.find(l=>l.userId&&l.userId!==r):void 0;return a?{name:a.name??"?",avatarUrl:a.avatarUrl??null}:{name:"KAI",avatarUrl:null}}function sw(t){var r,a,l="";if(typeof t=="string"||typeof t=="number")l+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(r=0;r<o;r++)t[r]&&(a=sw(t[r]))&&(l&&(l+=" "),l+=a)}else for(a in t)t[a]&&(l&&(l+=" "),l+=a);return l}function Qo(){for(var t,r,a=0,l="",o=arguments.length;a<o;a++)(t=arguments[a])&&(r=sw(t))&&(l&&(l+=" "),l+=r);return l}const Cp="-",mT=t=>{const r=gT(t),{conflictingClassGroups:a,conflictingClassGroupModifiers:l}=t;return{getClassGroupId:d=>{const m=d.split(Cp);return m[0]===""&&m.length!==1&&m.shift(),ow(m,r)||pT(d)},getConflictingClassGroupIds:(d,m)=>{const p=a[d]||[];return m&&l[d]?[...p,...l[d]]:p}}},ow=(t,r)=>{var d;if(t.length===0)return r.classGroupId;const a=t[0],l=r.nextPart.get(a),o=l?ow(t.slice(1),l):void 0;if(o)return o;if(r.validators.length===0)return;const u=t.join(Cp);return(d=r.validators.find(({validator:m})=>m(u)))==null?void 0:d.classGroupId},Gv=/^\[(.+)\]$/,pT=t=>{if(Gv.test(t)){const r=Gv.exec(t)[1],a=r==null?void 0:r.substring(0,r.indexOf(":"));if(a)return"arbitrary.."+a}},gT=t=>{const{theme:r,prefix:a}=t,l={nextPart:new Map,validators:[]};return xT(Object.entries(t.classGroups),a).forEach(([u,d])=>{qm(d,l,u,r)}),l},qm=(t,r,a,l)=>{t.forEach(o=>{if(typeof o=="string"){const u=o===""?r:Kv(r,o);u.classGroupId=a;return}if(typeof o=="function"){if(yT(o)){qm(o(l),r,a,l);return}r.validators.push({validator:o,classGroupId:a});return}Object.entries(o).forEach(([u,d])=>{qm(d,Kv(r,u),a,l)})})},Kv=(t,r)=>{let a=t;return r.split(Cp).forEach(l=>{a.nextPart.has(l)||a.nextPart.set(l,{nextPart:new Map,validators:[]}),a=a.nextPart.get(l)}),a},yT=t=>t.isThemeGetter,xT=(t,r)=>r?t.map(([a,l])=>{const o=l.map(u=>typeof u=="string"?r+u:typeof u=="object"?Object.fromEntries(Object.entries(u).map(([d,m])=>[r+d,m])):u);return[a,o]}):t,bT=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,a=new Map,l=new Map;const o=(u,d)=>{a.set(u,d),r++,r>t&&(r=0,l=a,a=new Map)};return{get(u){let d=a.get(u);if(d!==void 0)return d;if((d=l.get(u))!==void 0)return o(u,d),d},set(u,d){a.has(u)?a.set(u,d):o(u,d)}}},uw="!",vT=t=>{const{separator:r,experimentalParseClassName:a}=t,l=r.length===1,o=r[0],u=r.length,d=m=>{const p=[];let y=0,x=0,g;for(let E=0;E<m.length;E++){let k=m[E];if(y===0){if(k===o&&(l||m.slice(E,E+u)===r)){p.push(m.slice(x,E)),x=E+u;continue}if(k==="/"){g=E;continue}}k==="["?y++:k==="]"&&y--}const b=p.length===0?m:m.substring(x),w=b.startsWith(uw),C=w?b.substring(1):b,T=g&&g>x?g-x:void 0;return{modifiers:p,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:T}};return a?m=>a({className:m,parseClassName:d}):d},wT=t=>{if(t.length<=1)return t;const r=[];let a=[];return t.forEach(l=>{l[0]==="["?(r.push(...a.sort(),l),a=[]):a.push(l)}),r.push(...a.sort()),r},ST=t=>({cache:bT(t.cacheSize),parseClassName:vT(t),...mT(t)}),NT=/\s+/,CT=(t,r)=>{const{parseClassName:a,getClassGroupId:l,getConflictingClassGroupIds:o}=r,u=[],d=t.trim().split(NT);let m="";for(let p=d.length-1;p>=0;p-=1){const y=d[p],{modifiers:x,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:w}=a(y);let C=!!w,T=l(C?b.substring(0,w):b);if(!T){if(!C){m=y+(m.length>0?" "+m:m);continue}if(T=l(b),!T){m=y+(m.length>0?" "+m:m);continue}C=!1}const E=wT(x).join(":"),k=g?E+uw:E,A=k+T;if(u.includes(A))continue;u.push(A);const M=o(T,C);for(let F=0;F<M.length;++F){const Q=M[F];u.push(k+Q)}m=y+(m.length>0?" "+m:m)}return m};function kT(){let t=0,r,a,l="";for(;t<arguments.length;)(r=arguments[t++])&&(a=cw(r))&&(l&&(l+=" "),l+=a);return l}const cw=t=>{if(typeof t=="string")return t;let r,a="";for(let l=0;l<t.length;l++)t[l]&&(r=cw(t[l]))&&(a&&(a+=" "),a+=r);return a};function jT(t,...r){let a,l,o,u=d;function d(p){const y=r.reduce((x,g)=>g(x),t());return a=ST(y),l=a.cache.get,o=a.cache.set,u=m,m(p)}function m(p){const y=l(p);if(y)return y;const x=CT(p,a);return o(p,x),x}return function(){return u(kT.apply(null,arguments))}}const Et=t=>{const r=a=>a[t]||[];return r.isThemeGetter=!0,r},dw=/^\[(?:([a-z-]+):)?(.+)\]$/i,ET=/^\d+\/\d+$/,TT=new Set(["px","full","screen"]),AT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OT=/\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$/,RT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ia=t=>Hl(t)||TT.has(t)||ET.test(t),Ba=t=>is(t,"length",IT),Hl=t=>!!t&&!Number.isNaN(Number(t)),Zh=t=>is(t,"number",Hl),ao=t=>!!t&&Number.isInteger(Number(t)),DT=t=>t.endsWith("%")&&Hl(t.slice(0,-1)),Pe=t=>dw.test(t),Ia=t=>AT.test(t),_T=new Set(["length","size","percentage"]),LT=t=>is(t,_T,fw),UT=t=>is(t,"position",fw),qT=new Set(["image","url"]),HT=t=>is(t,qT,PT),BT=t=>is(t,"",FT),io=()=>!0,is=(t,r,a)=>{const l=dw.exec(t);return l?l[1]?typeof r=="string"?l[1]===r:r.has(l[1]):a(l[2]):!1},IT=t=>OT.test(t)&&!RT.test(t),fw=()=>!1,FT=t=>MT.test(t),PT=t=>zT.test(t),QT=()=>{const t=Et("colors"),r=Et("spacing"),a=Et("blur"),l=Et("brightness"),o=Et("borderColor"),u=Et("borderRadius"),d=Et("borderSpacing"),m=Et("borderWidth"),p=Et("contrast"),y=Et("grayscale"),x=Et("hueRotate"),g=Et("invert"),b=Et("gap"),w=Et("gradientColorStops"),C=Et("gradientColorStopPositions"),T=Et("inset"),E=Et("margin"),k=Et("opacity"),A=Et("padding"),M=Et("saturate"),F=Et("scale"),Q=Et("sepia"),j=Et("skew"),L=Et("space"),$=Et("translate"),W=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],le=()=>["auto",Pe,r],I=()=>[Pe,r],ee=()=>["",ia,Ba],ie=()=>["auto",Hl,Pe],re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Z=()=>["solid","dashed","dotted","double","none"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>["start","end","center","between","around","evenly","stretch"],Re=()=>["","0",Pe],O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Be=()=>[Hl,Pe];return{cacheSize:500,separator:":",theme:{colors:[io],spacing:[ia,Ba],blur:["none","",Ia,Pe],brightness:Be(),borderColor:[t],borderRadius:["none","","full",Ia,Pe],borderSpacing:I(),borderWidth:ee(),contrast:Be(),grayscale:Re(),hueRotate:Be(),invert:Re(),gap:I(),gradientColorStops:[t],gradientColorStopPositions:[DT,Ba],inset:le(),margin:le(),opacity:Be(),padding:I(),saturate:Be(),scale:Be(),sepia:Re(),skew:Be(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",Pe]}],container:["container"],columns:[{columns:[Ia]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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"],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:[...re(),Pe]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[T]}],"inset-x":[{"inset-x":[T]}],"inset-y":[{"inset-y":[T]}],start:[{start:[T]}],end:[{end:[T]}],top:[{top:[T]}],right:[{right:[T]}],bottom:[{bottom:[T]}],left:[{left:[T]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ao,Pe]}],basis:[{basis:le()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Pe]}],grow:[{grow:Re()}],shrink:[{shrink:Re()}],order:[{order:["first","last","none",ao,Pe]}],"grid-cols":[{"grid-cols":[io]}],"col-start-end":[{col:["auto",{span:["full",ao,Pe]},Pe]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[io]}],"row-start-end":[{row:["auto",{span:[ao,Pe]},Pe]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Pe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Pe]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...me()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...me(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...me(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[E]}],mx:[{mx:[E]}],my:[{my:[E]}],ms:[{ms:[E]}],me:[{me:[E]}],mt:[{mt:[E]}],mr:[{mr:[E]}],mb:[{mb:[E]}],ml:[{ml:[E]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Pe,r]}],"min-w":[{"min-w":[Pe,r,"min","max","fit"]}],"max-w":[{"max-w":[Pe,r,"none","full","min","max","fit","prose",{screen:[Ia]},Ia]}],h:[{h:[Pe,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Pe,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Pe,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Pe,r,"auto","min","max","fit"]}],"font-size":[{text:["base",Ia,Ba]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Zh]}],"font-family":[{font:[io]}],"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:["tighter","tight","normal","wide","wider","widest",Pe]}],"line-clamp":[{"line-clamp":["none",Hl,Zh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ia,Pe]}],"list-image":[{"list-image":["none",Pe]}],"list-style-type":[{list:["none","disc","decimal",Pe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ia,Ba]}],"underline-offset":[{"underline-offset":["auto",ia,Pe]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...re(),UT]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",LT]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},HT]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[w]}],"gradient-via":[{via:[w]}],"gradient-to":[{to:[w]}],rounded:[{rounded:[u]}],"rounded-s":[{"rounded-s":[u]}],"rounded-e":[{"rounded-e":[u]}],"rounded-t":[{"rounded-t":[u]}],"rounded-r":[{"rounded-r":[u]}],"rounded-b":[{"rounded-b":[u]}],"rounded-l":[{"rounded-l":[u]}],"rounded-ss":[{"rounded-ss":[u]}],"rounded-se":[{"rounded-se":[u]}],"rounded-ee":[{"rounded-ee":[u]}],"rounded-es":[{"rounded-es":[u]}],"rounded-tl":[{"rounded-tl":[u]}],"rounded-tr":[{"rounded-tr":[u]}],"rounded-br":[{"rounded-br":[u]}],"rounded-bl":[{"rounded-bl":[u]}],"border-w":[{border:[m]}],"border-w-x":[{"border-x":[m]}],"border-w-y":[{"border-y":[m]}],"border-w-s":[{"border-s":[m]}],"border-w-e":[{"border-e":[m]}],"border-w-t":[{"border-t":[m]}],"border-w-r":[{"border-r":[m]}],"border-w-b":[{"border-b":[m]}],"border-w-l":[{"border-l":[m]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...Z(),"hidden"]}],"divide-x":[{"divide-x":[m]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[m]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:Z()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...Z()]}],"outline-offset":[{"outline-offset":[ia,Pe]}],"outline-w":[{outline:[ia,Ba]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[ia,Ba]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ia,BT]}],"shadow-color":[{shadow:[io]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ce(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ce()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[l]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",Ia,Pe]}],grayscale:[{grayscale:[y]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[g]}],saturate:[{saturate:[M]}],sepia:[{sepia:[Q]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[l]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[M]}],"backdrop-sepia":[{"backdrop-sepia":[Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Pe]}],duration:[{duration:Be()}],ease:[{ease:["linear","in","out","in-out",Pe]}],delay:[{delay:Be()}],animate:[{animate:["none","spin","ping","pulse","bounce",Pe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[ao,Pe]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Pe]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],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",Pe]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",Pe]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ia,Ba,Zh]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},Yo=jT(QT);function Xv(...t){return Yo(Qo(t))}function ed({name:t,avatarUrl:r,className:a="w-7 h-7 text-xs"}){const[l,o]=S.useState(!1);return S.useEffect(()=>o(!1),[r]),r&&!l?c.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",onError:()=>o(!0),className:Xv("rounded-full object-cover shrink-0",a)}):c.jsx("div",{className:Xv("rounded-full bg-muted flex items-center justify-center font-semibold shrink-0",a),"aria-hidden":"true",children:(t??"K").charAt(0).toUpperCase()})}function ca(t,r){const a=t.trim().toLowerCase();return a===""?!0:r.some(l=>(l??"").toLowerCase().includes(a))}function hw({conversation:t,onClose:r}){const a=_n(),l=Io(),o=Mt(),[u,d]=S.useState(!1),[m,p]=S.useState(""),y=t.title??"Untitled conversation";async function x(){d(!0),p("");try{await ue.conversations.delete(t.id),lw(o,t.id),r(),l===`/conversations/${t.id}`&&a.replace("/")}catch(g){p(g instanceof Error?g.message:"Failed to delete conversation"),d(!1)}}return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",role:"dialog","aria-modal":"true","aria-labelledby":"delete-conversation-title",children:c.jsxs("div",{className:"w-96 rounded-lg border bg-card p-6 shadow-lg",children:[c.jsx("h2",{id:"delete-conversation-title",className:"text-base font-semibold mb-2",children:"Delete conversation?"}),c.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["“",c.jsx("span",{className:"text-foreground",children:y}),"” and all of its messages and agent activity will be permanently deleted for everyone in it. This can't be undone."]}),m&&c.jsx("p",{className:"text-xs text-destructive mb-3",children:m}),c.jsxs("div",{className:"flex gap-2 justify-end",children:[c.jsx("button",{onClick:r,disabled:u,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),c.jsx("button",{onClick:x,disabled:u,autoFocus:!0,className:"px-3 py-1.5 text-sm rounded-md bg-destructive text-destructive-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:u?"Deleting...":"Delete"})]})]})})}const kp=Wa((t,r)=>({executions:{},init:(a,l)=>t(o=>({executions:{...o.executions,[a]:{executionId:a,conversationId:l,status:"running",steps:[],pendingApproval:null}}})),setStatus:(a,l,o)=>t(u=>{const d=u.executions[a];if(!d)return u;const{error:m,...p}=d;return{executions:{...u.executions,[a]:{...p,status:l,...o?{error:o}:{}}}}}),addStep:(a,l)=>t(o=>{const u=o.executions[a];return u?{executions:{...o.executions,[a]:{...u,steps:[...u.steps,l]}}}:o}),setPendingApproval:(a,l)=>t(o=>{const u=o.executions[a];return u?{executions:{...o.executions,[a]:{...u,pendingApproval:l}}}:o}),clear:a=>t(l=>{const o={...l.executions};return delete o[a],{executions:o}}),clearConversation:a=>t(l=>{const o={...l.executions};for(const[u,d]of Object.entries(o))d.conversationId===a&&delete o[u];return{executions:o}}),getByConversation:a=>{const l=r();return Object.values(l.executions).filter(o=>o.conversationId===a).at(-1)}}));function mw({conversation:t,onClose:r}){const a=Mt(),l=kp(x=>x.clearConversation),[o,u]=S.useState(!1),[d,m]=S.useState(""),p=t.title??"Untitled conversation";async function y(){u(!0),m("");try{await ue.conversations.clear(t.id),l(t.id),await a.invalidateQueries({queryKey:["conversations",t.id,"messages"]}),await a.invalidateQueries({queryKey:["conversations"]}),r()}catch(x){m(x instanceof Error?x.message:"Failed to clear conversation"),u(!1)}}return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",role:"dialog","aria-modal":"true","aria-labelledby":"clear-conversation-title",children:c.jsxs("div",{className:"w-96 rounded-lg border bg-card p-6 shadow-lg",children:[c.jsx("h2",{id:"clear-conversation-title",className:"text-base font-semibold mb-2",children:"Clear chat?"}),c.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Every message and agent activity in “",c.jsx("span",{className:"text-foreground",children:p}),"” is permanently removed for everyone in it, and the agent starts fresh with no memory of it. This can't be undone."]}),d&&c.jsx("p",{className:"text-xs text-destructive mb-3",children:d}),c.jsxs("div",{className:"flex gap-2 justify-end",children:[c.jsx("button",{onClick:r,disabled:o,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),c.jsx("button",{onClick:y,disabled:o,autoFocus:!0,className:"px-3 py-1.5 text-sm rounded-md bg-destructive text-destructive-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:o?"Clearing...":"Clear chat"})]})]})})}function Bi({value:t,onChange:r,placeholder:a="Search…",className:l,...o}){return c.jsxs("div",{className:"relative",children:[c.jsx(Jc,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),c.jsx("input",{type:"search",value:t,onChange:u=>r(u.target.value),placeholder:a,className:`w-full pl-8 pr-3 py-1.5 text-sm rounded-md border bg-background focus:outline-none focus:ring-2 focus:ring-ring ${l??""}`,...o})]})}function Jh(...t){return Yo(Qo(t))}const $v={human:"Human",llm:"AI",agent:"Agent"},YT={human:Wc,llm:wp,agent:Fo},VT={human:"bg-blue-100 text-blue-700",llm:"bg-purple-100 text-purple-700",agent:"bg-green-100 text-green-700"};function GT(){const{data:t,isLoading:r,isError:a}=Np(),l=Io(),o=_n(),u=Mt(),d=mt(E=>{var k;return(k=E.user)==null?void 0:k.id}),m=Co(E=>E.closeSidebar),[p,y]=S.useState(null),[x,g]=S.useState(null),[b,w]=S.useState("");if(S.useEffect(()=>Ge.on("conversation.deleted",E=>{const{conversationId:k}=E;lw(u,k),y(A=>(A==null?void 0:A.id)===k?null:A),l===`/conversations/${k}`&&o.replace("/")}),[u,o,l]),S.useEffect(()=>Ge.on("conversation.updated",()=>{u.invalidateQueries({queryKey:["conversations"]})}),[u]),r)return c.jsx("div",{className:"px-2 py-4 text-xs text-muted-foreground",children:"Loading conversations..."});if(a)return c.jsx("div",{className:"px-2 py-4 text-xs text-destructive",children:"Failed to load conversations."});const C=(t==null?void 0:t.conversations)??[];if(C.length===0)return c.jsx("div",{className:"px-2 py-4 text-xs text-muted-foreground",children:"No conversations yet."});const T=C.filter(E=>ca(b,[ql(E,d)]));return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-2 pb-2",children:c.jsx(Bi,{value:b,onChange:w,placeholder:"Search chats…","aria-label":"Search chats"})}),T.length===0&&c.jsxs("div",{className:"px-2 py-4 text-xs text-muted-foreground",children:["No chats match “",b.trim(),"”."]}),c.jsx("nav",{className:"flex flex-col gap-0.5",children:T.map(E=>{const k=l===`/conversations/${E.id}`,A=ql(E,d),M=hT(E,d),F=YT[E.type];return c.jsxs("div",{className:"group relative",children:[c.jsxs(Xn,{href:`/conversations/${E.id}`,onClick:m,className:Jh("flex items-center gap-2 px-2 py-2 rounded-md text-sm transition-colors hover:bg-accent",E.canDelete&&"pr-16 md:pr-2 md:group-hover:pr-16 md:group-focus-within:pr-16",k&&"bg-accent font-medium"),children:[c.jsx(ed,{name:M.name,avatarUrl:M.avatarUrl,className:"w-6 h-6 text-[11px]"}),c.jsx("span",{className:Jh("shrink-0 text-[10px] font-semibold px-1.5 py-0.5 rounded",VT[E.type]??"bg-muted text-muted-foreground"),children:F?c.jsx(F,{size:12,role:"img","aria-label":$v[E.type]??E.type}):$v[E.type]??E.type}),c.jsx("span",{className:Jh("truncate",E.unread&&!k&&"font-semibold"),children:A})]}),E.canDelete&&c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:()=>g({id:E.id,title:A}),className:"absolute right-8 top-1/2 -translate-y-1/2 p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-background opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 transition-opacity",title:"Clear chat","aria-label":`Clear ${A}`,children:c.jsx(J1,{size:14})}),c.jsx("button",{onClick:()=>y({id:E.id,title:A}),className:"absolute right-1 top-1/2 -translate-y-1/2 p-1.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-background opacity-100 md:opacity-0 md:group-hover:opacity-100 focus:opacity-100 transition-opacity",title:"Delete conversation","aria-label":`Delete ${A}`,children:c.jsx(Sp,{size:14})})]})]},E.id)})}),p&&c.jsx(hw,{conversation:p,onClose:()=>y(null)}),x&&c.jsx(mw,{conversation:x,onClose:()=>g(null)})]})}function KT(){return c.jsxs(Kc,{to:"/settings",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx($1,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Device settings"})]})}function jp(t={}){return Cn({queryKey:["mcp-servers",t.accessibleOnly??!1],queryFn:()=>ue.mcp.list(t)})}function pw(){const{data:t}=jp({accessibleOnly:!0});return((t==null?void 0:t.servers)??[]).filter(r=>r.authType==="oauth"&&!r.connected).length}function Ep({label:t,size:r=14}){return c.jsx(zE,{role:"img","aria-label":t,size:r,className:"shrink-0 text-destructive"})}function Pi(){return Cn({queryKey:["agents"],queryFn:()=>ue.agents.list()})}function gw(t){return Cn({queryKey:["agents",t],queryFn:()=>ue.agents.get(t),enabled:!!t})}function yw(){const t=mt(r=>{var a;return(a=r.user)==null?void 0:a.orgId});return Cn({queryKey:["org-members",t],queryFn:()=>ue.orgs.members(t),enabled:!!t,staleTime:3e4})}function Tp({exclude:t,selected:r,onChange:a}){const{data:l,isLoading:o,isError:u}=yw(),[d,m]=S.useState("");if(o)return c.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading people..."});if(u)return c.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Could not load the people of your organization."});const p=((l==null?void 0:l.members)??[]).filter(b=>!t.includes(b.userId));if(p.length===0)return c.jsx("p",{className:"text-xs text-muted-foreground",children:"There is nobody else in your organization to add."});const y=d.trim().toLowerCase(),x=p.filter(b=>y===""||b.displayName.toLowerCase().includes(y)||b.email.toLowerCase().includes(y));function g(b){a(r.includes(b)?r.filter(w=>w!==b):[...r,b])}return c.jsxs("div",{children:[p.length>6&&c.jsx("input",{type:"search","aria-label":"Search people",placeholder:"Search people…",value:d,onChange:b=>m(b.target.value),className:"w-full mb-2 px-3 py-1.5 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring"}),c.jsxs("ul",{"aria-label":"People",className:"max-h-48 overflow-y-auto rounded-md border divide-y",children:[x.map(b=>c.jsx("li",{children:c.jsxs("label",{className:"flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-accent",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:r.includes(b.userId),onChange:()=>g(b.userId)}),c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block text-sm truncate",children:b.displayName}),c.jsx("span",{className:"block text-xs text-muted-foreground truncate",children:b.email})]})]})},b.userId)),x.length===0&&c.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Nobody matches."})]}),r.length>0&&c.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[r.length," selected"]})]})}function xw({onClose:t,initialType:r="llm"}){const a=_n(),l=Mt(),[o,u]=S.useState(r),[d,m]=S.useState(""),[p,y]=S.useState([]),x=mt(j=>j.user),[g,b]=S.useState(!1),[w,C]=S.useState(""),{data:T,isLoading:E}=Pi(),k=(T==null?void 0:T.agents)??[],A=o==="agent",M=o==="human",F=!g&&(!A||d!=="")&&(!M||p.length>0);async function Q(){if(F){b(!0),C("");try{const j=await ue.conversations.create({type:o,...A?{agentId:d}:{},...M?{participantUserIds:p}:{}});await l.invalidateQueries({queryKey:["conversations"]}),t(),a.push(`/conversations/${j.id}`)}catch(j){C(j instanceof Error?j.message:"Failed to create conversation"),b(!1)}}}return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:c.jsxs("div",{className:"w-96 max-w-[90vw] max-h-[85vh] overflow-y-auto rounded-lg border bg-card p-6 shadow-lg",children:[c.jsx("h2",{className:"text-base font-semibold mb-4",children:"New Conversation"}),c.jsx("div",{className:"space-y-2 mb-4",children:["human","llm","agent"].map(j=>c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("input",{type:"radio",name:"type",value:j,checked:o===j,onChange:()=>u(j),className:"accent-primary"}),c.jsx("span",{className:"text-sm capitalize",children:j==="llm"?"AI Chat":j==="human"?"Human Chat":"Agent Chat"})]},j))}),M&&c.jsxs("div",{className:"mb-4",children:[c.jsx("p",{className:"block text-sm font-medium mb-1",children:"Who is in it?"}),c.jsx(Tp,{exclude:x?[x.id]:[],selected:p,onChange:y})]}),A&&c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"new-chat-agent",children:"Agent"}),E?c.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading agents..."}):k.length===0?c.jsx("p",{className:"text-xs text-muted-foreground",children:x&&Zc(x)?c.jsxs(c.Fragment,{children:["You have no agents yet."," ",c.jsx(Xn,{href:"/agents/new",onClick:t,className:"text-foreground font-medium hover:underline",children:"Create one"})," ","to start an agent chat."]}):"There are no agents you can use yet. Ask an admin to share one with you."}):c.jsxs("select",{id:"new-chat-agent",value:d,onChange:j=>m(j.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx("option",{value:"",children:"Select an agent…"}),k.map(j=>c.jsx("option",{value:j.id,children:j.name},j.id))]})]}),w&&c.jsx("p",{className:"text-xs text-destructive mb-3",children:w}),c.jsxs("div",{className:"flex gap-2 justify-end",children:[c.jsx("button",{onClick:t,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent transition-colors",children:"Cancel"}),c.jsx("button",{onClick:Q,disabled:!F,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:g?"Creating...":"Create"})]})]})})}const ko=Wa(t=>({open:!1,openPalette:()=>t({open:!0}),closePalette:()=>t({open:!1}),togglePalette:()=>t(r=>({open:!r.open}))}));function XT(){const t=mt(x=>x.user),r=pw(),a=mt(x=>x.logout),l=_n(),[o,u]=S.useState(!1),d=Co(x=>x.isSidebarOpen),m=Co(x=>x.closeSidebar),p=ko(x=>x.openPalette);function y(){Ge.disconnect(),a(),l.push("/login")}return c.jsxs(c.Fragment,{children:[d&&c.jsx("div",{"data-testid":"sidebar-backdrop",className:"fixed inset-0 z-30 bg-black/50 md:hidden",onClick:m,"aria-hidden":"true"}),c.jsxs("aside",{"data-open":d,className:`flex flex-col border-r bg-background h-dvh w-64 max-w-[85vw] fixed inset-y-0 left-0 z-40 transition-transform md:static md:inset-auto md:z-auto md:translate-x-0 md:max-w-none ${d?"translate-x-0":"-translate-x-full"}`,children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-4 border-b",children:[c.jsxs("div",{className:"flex items-baseline gap-1.5 min-w-0",children:[c.jsx("span",{className:"font-bold text-lg tracking-tight",children:"KAI"}),(t==null?void 0:t.orgName)&&c.jsxs("span",{className:"text-sm text-muted-foreground truncate",title:t.orgName,children:["- ",t.orgName]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>u(!0),className:"text-xs px-2 py-1 rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity",title:"New Chat",children:"+ New"}),c.jsx("button",{onClick:()=>{m(),p()},className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors","aria-label":"Search and commands",title:"Search and commands (Ctrl+K)",children:c.jsx(Jc,{size:16})}),c.jsx("button",{onClick:m,className:"p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors md:hidden","aria-label":"Close menu",children:c.jsx(tw,{size:18})})]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:c.jsx(GT,{})}),c.jsxs("div",{className:"border-t px-2 py-2 space-y-1",onClick:m,children:[c.jsxs(Xn,{href:"/agents",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(Fo,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Agents"})]}),c.jsxs(Xn,{href:"/schedules",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(K1,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Schedules"})]}),c.jsxs(Xn,{href:"/settings/general",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(W1,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Settings"}),r>0&&c.jsx(Ep,{label:"Integrations to connect"})]}),vp(t)&&c.jsxs(Xn,{href:"/admin",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(XE,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Admin"})]}),c.jsx(KT,{}),t&&c.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",onClick:x=>x.stopPropagation(),children:[c.jsx(ed,{name:t.displayName,avatarUrl:t.avatarUrl}),c.jsx("span",{className:"text-sm truncate flex-1",children:t.displayName}),c.jsx("button",{onClick:y,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Log out","aria-label":"Log out",children:c.jsx(BE,{size:16})})]})]})]}),o&&c.jsx(xw,{onClose:()=>u(!1)})]})}const $T=[{id:"device-settings",label:"Device settings",href:"/settings",icon:$1,keywords:["file access","folders","claude code","browser"],visible:()=>!0}],kc=()=>!0,Wh=t=>vp(t),ZT=[{id:"agents",label:"Agents",href:"/agents",icon:Fo,keywords:["assistants"],visible:kc},{id:"new-agent",label:"New agent",href:"/agents/new",icon:GE,keywords:["create agent"],visible:t=>t!==null&&Zc(t)},{id:"schedules",label:"Schedules",href:"/schedules",icon:K1,keywords:["cron","recurring"],visible:kc},{id:"settings",label:"Settings",href:"/settings/general",icon:W1,keywords:["profile","password","appearance","theme"],visible:kc},{id:"integrations",label:"Settings: Integrations",href:"/settings/integrations",icon:Z1,keywords:["connect","oauth"],visible:kc},{id:"admin-users",label:"Admin: Users",href:"/admin/users",icon:Wc,keywords:["people","accounts","roles"],visible:Wh},{id:"admin-orgs",label:"Admin: Organizations",href:"/admin/organizations",icon:ME,keywords:["orgs"],visible:t=>(t==null?void 0:t.isPlatformAdmin)===!0},{id:"admin-llm",label:"Admin: AI models",href:"/admin/llm",icon:_E,keywords:["llm","providers"],visible:Wh},{id:"admin-mcp",label:"Admin: MCP servers",href:"/admin/mcp",icon:KE,keywords:["tools"],visible:Wh},{id:"admin-theme",label:"Admin: Theme",href:"/admin/theme",icon:QE,keywords:["branding","colors","gradient","background"],visible:t=>t!==null&&(t.isPlatformAdmin||t.orgRole==="owner")},...$T];function JT(t){return ZT.filter(r=>r.visible(t))}function jc(t,r){return t.split(/\s+/).filter(Boolean).every(a=>ca(a,r))}const WT={human:Wc,llm:wp,agent:Fo},eA={human:"Person",llm:"AI",agent:"Agent"};function tA(){const t=ko(a=>a.open),r=ko(a=>a.togglePalette);return S.useEffect(()=>{function a(l){(l.ctrlKey||l.metaKey)&&!l.altKey&&!l.shiftKey&&l.key.toLowerCase()==="k"&&(l.preventDefault(),r())}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),t?c.jsx(nA,{}):null}function nA(){const t=_n(),r=Mt(),a=mt(j=>j.user),l=ko(j=>j.closePalette),{data:o}=Np(),{data:u}=Pi(),{data:d}=yw(),[m,p]=S.useState(""),[y,x]=S.useState(0),[g,b]=S.useState(!1),[w,C]=S.useState(""),[T,E]=S.useState(!1),k=S.useRef(null);S.useEffect(()=>{var j;(j=k.current)==null||j.focus()},[]);async function A(j){b(!0),C("");try{const L=await ue.conversations.create(j);await r.invalidateQueries({queryKey:["conversations"]}),l(),t.push(`/conversations/${L.id}`)}catch(L){C(L instanceof Error?L.message:"Failed to create conversation"),b(!1)}}const M=S.useMemo(()=>{const j=m.trim(),L=j===""?5:8,$=ee=>()=>{l(),t.push(ee)},W=((o==null?void 0:o.conversations)??[]).map(ee=>({c:ee,title:ql(ee,a==null?void 0:a.id)})).filter(({title:ee})=>ca(j,[ee])).slice(0,L).map(({c:ee,title:ie})=>({key:`chat-${ee.id}`,group:"Chats",label:ie,hint:eA[ee.type],icon:WT[ee.type],run:$(`/conversations/${ee.id}`)})),z=JT(a).filter(ee=>jc(j,[ee.label,...ee.keywords])).map(ee=>({key:`nav-${ee.id}`,group:"Go to",label:ee.label,icon:ee.icon,run:$(ee.href)})),le=[],I=(...ee)=>jc(j,["new chat","new conversation",...ee]);if(I("ai","llm","New AI chat")&&le.push({key:"new-llm",group:"New chat",label:"New AI chat",icon:wp,run:()=>A({type:"llm"})}),I("group","people","human","New chat with people")&&le.push({key:"new-group",group:"New chat",label:"New chat with people…",icon:FE,run:()=>E(!0)}),j!==""){for(const ee of((u==null?void 0:u.agents)??[]).filter(ie=>jc(j,[ie.name,ie.description,"agent"])).slice(0,L))le.push({key:`new-agent-${ee.id}`,group:"New chat",label:`Chat with agent ${ee.name}`,icon:Fo,run:()=>A({type:"agent",agentId:ee.id})});for(const ee of((d==null?void 0:d.members)??[]).filter(ie=>ie.userId!==(a==null?void 0:a.id)&&jc(j,[ie.displayName,ie.email])).slice(0,L))le.push({key:`new-human-${ee.userId}`,group:"New chat",label:`Chat with ${ee.displayName}`,hint:ee.email,icon:Wc,run:()=>A({type:"human",participantUserIds:[ee.userId]})})}return[...W,...z,...le]},[m,o,u,d,a]),F=Math.min(y,Math.max(M.length-1,0));S.useEffect(()=>{var j,L;(L=(j=document.getElementById(`palette-opt-${F}`))==null?void 0:j.scrollIntoView)==null||L.call(j,{block:"nearest"})},[F]);function Q(j){if(j.key==="Escape")j.preventDefault(),j.nativeEvent.stopPropagation(),l();else if(j.key==="ArrowDown")j.preventDefault(),x(M.length===0?0:(F+1)%M.length);else if(j.key==="ArrowUp")j.preventDefault(),x(M.length===0?0:(F-1+M.length)%M.length);else if(j.key==="Enter"){j.preventDefault();const L=M[F];L&&!g&&L.run()}}return T?c.jsx(xw,{onClose:()=>{E(!1),l()},initialType:"human"}):c.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/40 px-4 pt-[15vh]",onMouseDown:j=>{j.target===j.currentTarget&&l()},children:c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Command palette",onKeyDown:Q,className:"w-full max-w-xl overflow-hidden rounded-lg border bg-card shadow-lg",children:[c.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[c.jsx(Jc,{size:16,className:"shrink-0 text-muted-foreground"}),c.jsx("input",{ref:k,role:"combobox","aria-expanded":"true","aria-controls":"palette-list","aria-activedescendant":M.length>0?`palette-opt-${F}`:void 0,"aria-label":"Search chats, pages and actions",value:m,onChange:j=>{p(j.target.value),x(0)},placeholder:"Search chats, pages, agents and people…",className:"w-full bg-transparent py-3 text-sm focus:outline-none"})]}),c.jsxs("ul",{id:"palette-list",role:"listbox","aria-label":"Results",className:"max-h-[50vh] overflow-y-auto py-1",children:[M.length===0&&c.jsx("li",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No results"}),M.map((j,L)=>{const $=j.icon,W=L===0||M[L-1].group!==j.group;return c.jsxs("li",{role:"presentation",children:[W&&c.jsx("div",{className:"px-3 pb-1 pt-2 text-xs font-medium text-muted-foreground",children:j.group}),c.jsxs("div",{id:`palette-opt-${L}`,role:"option","aria-selected":L===F,onMouseMove:()=>x(L),onClick:()=>!g&&void j.run(),className:`mx-1 flex cursor-pointer items-center gap-2 rounded-md px-2 py-2 text-sm ${L===F?"bg-accent":""}`,children:[c.jsx($,{size:16,className:"shrink-0 text-muted-foreground"}),c.jsx("span",{className:"truncate",children:j.label}),j.hint&&c.jsx("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground",children:j.hint})]})]},j.key)})]}),w&&c.jsx("p",{role:"alert",className:"border-t px-3 py-2 text-xs text-destructive",children:w})]})})}function rA({children:t}){const r=_n(),a=mt(m=>m.setUser),l=Po(m=>m.setStatus),[o,u]=S.useState(!1);dT(o),S.useEffect(()=>{let m=null;const p=No();if(!p){r.push("/login");return}return ue.auth.me().then(y=>{if(a(Bo(y)),y.mustChangePassword){r.replace("/change-password");return}if(y.mfaPending){r.replace("/mfa");return}m=Ge.onStatusChange(l),Ge.connect(No()??p),u(!0)}).catch(()=>{r.push("/login")}),()=>{m==null||m()}},[r,a,l]);const d=mt(m=>m.user!==null);return S.useEffect(()=>{o&&!d&&(Ge.disconnect(),r.replace("/login"))},[o,d,r]),o?c.jsxs("div",{className:"flex h-dvh overflow-hidden flex-col md:flex-row",children:[c.jsx(aA,{}),c.jsx(XT,{}),c.jsx("main",{className:"flex-1 overflow-hidden min-w-0",children:t}),c.jsx(tA,{})]}):c.jsx("div",{className:"min-h-dvh flex items-center justify-center",children:c.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function aA(){const t=Co(l=>l.toggleSidebar),r=mt(l=>{var o;return(o=l.user)==null?void 0:o.orgName}),a=ko(l=>l.openPalette);return c.jsxs("div",{className:"md:hidden flex items-center gap-2 border-b px-3 py-2 shrink-0",children:[c.jsx("button",{onClick:t,className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors","aria-label":"Open menu",children:c.jsx(IE,{size:20})}),c.jsx("span",{className:"font-bold text-base tracking-tight",children:"KAI"}),r&&c.jsxs("span",{className:"text-sm text-muted-foreground truncate",children:["- ",r]}),c.jsx("button",{onClick:a,className:"ml-auto p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors","aria-label":"Search and commands",children:c.jsx(Jc,{size:20})})]})}function iA(){const t=_n(),{data:r,isLoading:a}=Np();S.useEffect(()=>{!a&&r&&r.conversations.length>0&&t.replace(`/conversations/${r.conversations[0].id}`)},[r,a,t]);async function l(){try{const o=await ue.conversations.create({type:"llm"});t.push(`/conversations/${o.id}`)}catch(o){console.error("Failed to create conversation",o)}}return a?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading..."})}):c.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[c.jsx("p",{className:"text-muted-foreground text-sm",children:"No conversations yet."}),c.jsx("button",{onClick:l,className:"px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity",children:"New Chat"})]})}const lA={private:"Private",org:"Organization",selected:"Selected"},sA={private:"bg-muted text-muted-foreground",org:"bg-blue-100 text-blue-700",selected:"bg-purple-100 text-purple-700"};function oA({agent:t}){const r=_n(),a=Mt();async function l(){try{const o=await ue.conversations.create({type:"agent",agentId:t.id});await a.invalidateQueries({queryKey:["conversations"]}),r.push(`/conversations/${o.id}`)}catch(o){console.error("Failed to create agent conversation",o)}}return c.jsxs("div",{className:"border rounded-lg p-4 bg-card hover:border-ring transition-colors",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"font-semibold text-sm truncate",children:t.name}),t.description&&c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:t.description})]}),c.jsx("span",{className:`shrink-0 text-[10px] font-semibold px-2 py-0.5 rounded-full ${sA[t.visibility]??"bg-muted text-muted-foreground"}`,children:lA[t.visibility]??t.visibility})]}),c.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[t.capabilities.length," capabilities"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:l,className:"px-3 py-1.5 text-xs rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Chat"}),c.jsx(Xn,{href:`/agents/${t.id}/edit`,className:"px-3 py-1.5 text-xs rounded-md border hover:bg-accent transition-colors",children:"Edit"})]})]})}function uA(){const{data:t,isLoading:r,isError:a}=Pi(),l=Zc(mt(p=>p.user)),[o,u]=S.useState(""),d=(t==null?void 0:t.agents)??[],m=d.filter(p=>ca(o,[p.name,p.description]));return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"border-b px-6 py-4 flex items-center justify-between shrink-0",children:[c.jsx("h1",{className:"text-lg font-semibold",children:"Agents"}),l&&c.jsx(Xn,{href:"/agents/new",className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Create Agent"})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:[r&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading agents..."}),a&&c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load agents."}),!r&&!a&&c.jsx(c.Fragment,{children:d.length===0?c.jsxs("div",{className:"text-center py-16",children:[c.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:l?"No agents yet. Create one to get started.":"No agents yet."}),l&&c.jsx(Xn,{href:"/agents/new",className:"px-4 py-2 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Create Agent"})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"max-w-sm mb-4",children:c.jsx(Bi,{value:o,onChange:u,placeholder:"Search agents…","aria-label":"Search agents"})}),m.length===0?c.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No agents match “",o.trim(),"”."]}):c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:m.map(p=>c.jsx(oA,{agent:p},p.id))})]})})]})]})}const bw=6048e5,cA=864e5,Zv=Symbol.for("constructDateFrom");function Ja(t,r){return typeof t=="function"?t(r):t&&typeof t=="object"&&Zv in t?t[Zv](r):t instanceof Date?new t.constructor(r):new Date(r)}function jr(t,r){return Ja(r||t,t)}let dA={};function td(){return dA}function jo(t,r){var m,p,y,x;const a=td(),l=(r==null?void 0:r.weekStartsOn)??((p=(m=r==null?void 0:r.locale)==null?void 0:m.options)==null?void 0:p.weekStartsOn)??a.weekStartsOn??((x=(y=a.locale)==null?void 0:y.options)==null?void 0:x.weekStartsOn)??0,o=jr(t,r==null?void 0:r.in),u=o.getDay(),d=(u<l?7:0)+u-l;return o.setDate(o.getDate()-d),o.setHours(0,0,0,0),o}function Uc(t,r){return jo(t,{...r,weekStartsOn:1})}function vw(t,r){const a=jr(t,r==null?void 0:r.in),l=a.getFullYear(),o=Ja(a,0);o.setFullYear(l+1,0,4),o.setHours(0,0,0,0);const u=Uc(o),d=Ja(a,0);d.setFullYear(l,0,4),d.setHours(0,0,0,0);const m=Uc(d);return a.getTime()>=u.getTime()?l+1:a.getTime()>=m.getTime()?l:l-1}function Jv(t){const r=jr(t),a=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return a.setUTCFullYear(r.getFullYear()),+t-+a}function fA(t,...r){const a=Ja.bind(null,r.find(l=>typeof l=="object"));return r.map(a)}function Wv(t,r){const a=jr(t,r==null?void 0:r.in);return a.setHours(0,0,0,0),a}function hA(t,r,a){const[l,o]=fA(a==null?void 0:a.in,t,r),u=Wv(l),d=Wv(o),m=+u-Jv(u),p=+d-Jv(d);return Math.round((m-p)/cA)}function mA(t,r){const a=vw(t,r),l=Ja(t,0);return l.setFullYear(a,0,4),l.setHours(0,0,0,0),Uc(l)}function pA(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function gA(t){return!(!pA(t)&&typeof t!="number"||isNaN(+jr(t)))}function yA(t,r){const a=jr(t,r==null?void 0:r.in);return a.setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a}const xA={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},bA=(t,r,a)=>{let l;const o=xA[t];return typeof o=="string"?l=o:r===1?l=o.one:l=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+l:l+" ago":l};function em(t){return(r={})=>{const a=r.width?String(r.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const vA={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wA={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},SA={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},NA={date:em({formats:vA,defaultWidth:"full"}),time:em({formats:wA,defaultWidth:"full"}),dateTime:em({formats:SA,defaultWidth:"full"})},CA={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},kA=(t,r,a,l)=>CA[t];function lo(t){return(r,a)=>{const l=a!=null&&a.context?String(a.context):"standalone";let o;if(l==="formatting"&&t.formattingValues){const d=t.defaultFormattingWidth||t.defaultWidth,m=a!=null&&a.width?String(a.width):d;o=t.formattingValues[m]||t.formattingValues[d]}else{const d=t.defaultWidth,m=a!=null&&a.width?String(a.width):t.defaultWidth;o=t.values[m]||t.values[d]}const u=t.argumentCallback?t.argumentCallback(r):r;return o[u]}}const jA={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},EA={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},TA={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},AA={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},OA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},RA={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},MA=(t,r)=>{const a=Number(t),l=a%100;if(l>20||l<10)switch(l%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},zA={ordinalNumber:MA,era:lo({values:jA,defaultWidth:"wide"}),quarter:lo({values:EA,defaultWidth:"wide",argumentCallback:t=>t-1}),month:lo({values:TA,defaultWidth:"wide"}),day:lo({values:AA,defaultWidth:"wide"}),dayPeriod:lo({values:OA,defaultWidth:"wide",formattingValues:RA,defaultFormattingWidth:"wide"})};function so(t){return(r,a={})=>{const l=a.width,o=l&&t.matchPatterns[l]||t.matchPatterns[t.defaultMatchWidth],u=r.match(o);if(!u)return null;const d=u[0],m=l&&t.parsePatterns[l]||t.parsePatterns[t.defaultParseWidth],p=Array.isArray(m)?_A(m,g=>g.test(d)):DA(m,g=>g.test(d));let y;y=t.valueCallback?t.valueCallback(p):p,y=a.valueCallback?a.valueCallback(y):y;const x=r.slice(d.length);return{value:y,rest:x}}}function DA(t,r){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r(t[a]))return a}function _A(t,r){for(let a=0;a<t.length;a++)if(r(t[a]))return a}function LA(t){return(r,a={})=>{const l=r.match(t.matchPattern);if(!l)return null;const o=l[0],u=r.match(t.parsePattern);if(!u)return null;let d=t.valueCallback?t.valueCallback(u[0]):u[0];d=a.valueCallback?a.valueCallback(d):d;const m=r.slice(o.length);return{value:d,rest:m}}}const UA=/^(\d+)(th|st|nd|rd)?/i,qA=/\d+/i,HA={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},BA={any:[/^b/i,/^(a|c)/i]},IA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},FA={any:[/1/i,/2/i,/3/i,/4/i]},PA={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},QA={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},YA={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},VA={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},GA={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},KA={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},XA={ordinalNumber:LA({matchPattern:UA,parsePattern:qA,valueCallback:t=>parseInt(t,10)}),era:so({matchPatterns:HA,defaultMatchWidth:"wide",parsePatterns:BA,defaultParseWidth:"any"}),quarter:so({matchPatterns:IA,defaultMatchWidth:"wide",parsePatterns:FA,defaultParseWidth:"any",valueCallback:t=>t+1}),month:so({matchPatterns:PA,defaultMatchWidth:"wide",parsePatterns:QA,defaultParseWidth:"any"}),day:so({matchPatterns:YA,defaultMatchWidth:"wide",parsePatterns:VA,defaultParseWidth:"any"}),dayPeriod:so({matchPatterns:GA,defaultMatchWidth:"any",parsePatterns:KA,defaultParseWidth:"any"})},$A={code:"en-US",formatDistance:bA,formatLong:NA,formatRelative:kA,localize:zA,match:XA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ZA(t,r){const a=jr(t,r==null?void 0:r.in);return hA(a,yA(a))+1}function JA(t,r){const a=jr(t,r==null?void 0:r.in),l=+Uc(a)-+mA(a);return Math.round(l/bw)+1}function ww(t,r){var x,g,b,w;const a=jr(t,r==null?void 0:r.in),l=a.getFullYear(),o=td(),u=(r==null?void 0:r.firstWeekContainsDate)??((g=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:g.firstWeekContainsDate)??o.firstWeekContainsDate??((w=(b=o.locale)==null?void 0:b.options)==null?void 0:w.firstWeekContainsDate)??1,d=Ja((r==null?void 0:r.in)||t,0);d.setFullYear(l+1,0,u),d.setHours(0,0,0,0);const m=jo(d,r),p=Ja((r==null?void 0:r.in)||t,0);p.setFullYear(l,0,u),p.setHours(0,0,0,0);const y=jo(p,r);return+a>=+m?l+1:+a>=+y?l:l-1}function WA(t,r){var m,p,y,x;const a=td(),l=(r==null?void 0:r.firstWeekContainsDate)??((p=(m=r==null?void 0:r.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??a.firstWeekContainsDate??((x=(y=a.locale)==null?void 0:y.options)==null?void 0:x.firstWeekContainsDate)??1,o=ww(t,r),u=Ja((r==null?void 0:r.in)||t,0);return u.setFullYear(o,0,l),u.setHours(0,0,0,0),jo(u,r)}function e3(t,r){const a=jr(t,r==null?void 0:r.in),l=+jo(a,r)-+WA(a,r);return Math.round(l/bw)+1}function bt(t,r){const a=t<0?"-":"",l=Math.abs(t).toString().padStart(r,"0");return a+l}const Fa={y(t,r){const a=t.getFullYear(),l=a>0?a:1-a;return bt(r==="yy"?l%100:l,r.length)},M(t,r){const a=t.getMonth();return r==="M"?String(a+1):bt(a+1,2)},d(t,r){return bt(t.getDate(),r.length)},a(t,r){const a=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h(t,r){return bt(t.getHours()%12||12,r.length)},H(t,r){return bt(t.getHours(),r.length)},m(t,r){return bt(t.getMinutes(),r.length)},s(t,r){return bt(t.getSeconds(),r.length)},S(t,r){const a=r.length,l=t.getMilliseconds(),o=Math.trunc(l*Math.pow(10,a-3));return bt(o,r.length)}},_l={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},e0={G:function(t,r,a){const l=t.getFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(l,{width:"abbreviated"});case"GGGGG":return a.era(l,{width:"narrow"});case"GGGG":default:return a.era(l,{width:"wide"})}},y:function(t,r,a){if(r==="yo"){const l=t.getFullYear(),o=l>0?l:1-l;return a.ordinalNumber(o,{unit:"year"})}return Fa.y(t,r)},Y:function(t,r,a,l){const o=ww(t,l),u=o>0?o:1-o;if(r==="YY"){const d=u%100;return bt(d,2)}return r==="Yo"?a.ordinalNumber(u,{unit:"year"}):bt(u,r.length)},R:function(t,r){const a=vw(t);return bt(a,r.length)},u:function(t,r){const a=t.getFullYear();return bt(a,r.length)},Q:function(t,r,a){const l=Math.ceil((t.getMonth()+1)/3);switch(r){case"Q":return String(l);case"QQ":return bt(l,2);case"Qo":return a.ordinalNumber(l,{unit:"quarter"});case"QQQ":return a.quarter(l,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(l,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(l,{width:"wide",context:"formatting"})}},q:function(t,r,a){const l=Math.ceil((t.getMonth()+1)/3);switch(r){case"q":return String(l);case"qq":return bt(l,2);case"qo":return a.ordinalNumber(l,{unit:"quarter"});case"qqq":return a.quarter(l,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(l,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(l,{width:"wide",context:"standalone"})}},M:function(t,r,a){const l=t.getMonth();switch(r){case"M":case"MM":return Fa.M(t,r);case"Mo":return a.ordinalNumber(l+1,{unit:"month"});case"MMM":return a.month(l,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(l,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(l,{width:"wide",context:"formatting"})}},L:function(t,r,a){const l=t.getMonth();switch(r){case"L":return String(l+1);case"LL":return bt(l+1,2);case"Lo":return a.ordinalNumber(l+1,{unit:"month"});case"LLL":return a.month(l,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(l,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(l,{width:"wide",context:"standalone"})}},w:function(t,r,a,l){const o=e3(t,l);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):bt(o,r.length)},I:function(t,r,a){const l=JA(t);return r==="Io"?a.ordinalNumber(l,{unit:"week"}):bt(l,r.length)},d:function(t,r,a){return r==="do"?a.ordinalNumber(t.getDate(),{unit:"date"}):Fa.d(t,r)},D:function(t,r,a){const l=ZA(t);return r==="Do"?a.ordinalNumber(l,{unit:"dayOfYear"}):bt(l,r.length)},E:function(t,r,a){const l=t.getDay();switch(r){case"E":case"EE":case"EEE":return a.day(l,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(l,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(l,{width:"short",context:"formatting"});case"EEEE":default:return a.day(l,{width:"wide",context:"formatting"})}},e:function(t,r,a,l){const o=t.getDay(),u=(o-l.weekStartsOn+8)%7||7;switch(r){case"e":return String(u);case"ee":return bt(u,2);case"eo":return a.ordinalNumber(u,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(t,r,a,l){const o=t.getDay(),u=(o-l.weekStartsOn+8)%7||7;switch(r){case"c":return String(u);case"cc":return bt(u,r.length);case"co":return a.ordinalNumber(u,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(t,r,a){const l=t.getDay(),o=l===0?7:l;switch(r){case"i":return String(o);case"ii":return bt(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(l,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(l,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(l,{width:"short",context:"formatting"});case"iiii":default:return a.day(l,{width:"wide",context:"formatting"})}},a:function(t,r,a){const o=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,r,a){const l=t.getHours();let o;switch(l===12?o=_l.noon:l===0?o=_l.midnight:o=l/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,r,a){const l=t.getHours();let o;switch(l>=17?o=_l.evening:l>=12?o=_l.afternoon:l>=4?o=_l.morning:o=_l.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,r,a){if(r==="ho"){let l=t.getHours()%12;return l===0&&(l=12),a.ordinalNumber(l,{unit:"hour"})}return Fa.h(t,r)},H:function(t,r,a){return r==="Ho"?a.ordinalNumber(t.getHours(),{unit:"hour"}):Fa.H(t,r)},K:function(t,r,a){const l=t.getHours()%12;return r==="Ko"?a.ordinalNumber(l,{unit:"hour"}):bt(l,r.length)},k:function(t,r,a){let l=t.getHours();return l===0&&(l=24),r==="ko"?a.ordinalNumber(l,{unit:"hour"}):bt(l,r.length)},m:function(t,r,a){return r==="mo"?a.ordinalNumber(t.getMinutes(),{unit:"minute"}):Fa.m(t,r)},s:function(t,r,a){return r==="so"?a.ordinalNumber(t.getSeconds(),{unit:"second"}):Fa.s(t,r)},S:function(t,r){return Fa.S(t,r)},X:function(t,r,a){const l=t.getTimezoneOffset();if(l===0)return"Z";switch(r){case"X":return n0(l);case"XXXX":case"XX":return ki(l);case"XXXXX":case"XXX":default:return ki(l,":")}},x:function(t,r,a){const l=t.getTimezoneOffset();switch(r){case"x":return n0(l);case"xxxx":case"xx":return ki(l);case"xxxxx":case"xxx":default:return ki(l,":")}},O:function(t,r,a){const l=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+t0(l,":");case"OOOO":default:return"GMT"+ki(l,":")}},z:function(t,r,a){const l=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+t0(l,":");case"zzzz":default:return"GMT"+ki(l,":")}},t:function(t,r,a){const l=Math.trunc(+t/1e3);return bt(l,r.length)},T:function(t,r,a){return bt(+t,r.length)}};function t0(t,r=""){const a=t>0?"-":"+",l=Math.abs(t),o=Math.trunc(l/60),u=l%60;return u===0?a+String(o):a+String(o)+r+bt(u,2)}function n0(t,r){return t%60===0?(t>0?"-":"+")+bt(Math.abs(t)/60,2):ki(t,r)}function ki(t,r=""){const a=t>0?"-":"+",l=Math.abs(t),o=bt(Math.trunc(l/60),2),u=bt(l%60,2);return a+o+r+u}const r0=(t,r)=>{switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},Sw=(t,r)=>{switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},t3=(t,r)=>{const a=t.match(/(P+)(p+)?/)||[],l=a[1],o=a[2];if(!o)return r0(t,r);let u;switch(l){case"P":u=r.dateTime({width:"short"});break;case"PP":u=r.dateTime({width:"medium"});break;case"PPP":u=r.dateTime({width:"long"});break;case"PPPP":default:u=r.dateTime({width:"full"});break}return u.replace("{{date}}",r0(l,r)).replace("{{time}}",Sw(o,r))},n3={p:Sw,P:t3},r3=/^D+$/,a3=/^Y+$/,i3=["D","DD","YY","YYYY"];function l3(t){return r3.test(t)}function s3(t){return a3.test(t)}function o3(t,r,a){const l=u3(t,r,a);if(console.warn(l),i3.includes(t))throw new RangeError(l)}function u3(t,r,a){const l=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${l} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const c3=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,d3=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,f3=/^'([^]*?)'?$/,h3=/''/g,m3=/[a-zA-Z]/;function Eo(t,r,a){var x,g,b,w;const l=td(),o=l.locale??$A,u=l.firstWeekContainsDate??((g=(x=l.locale)==null?void 0:x.options)==null?void 0:g.firstWeekContainsDate)??1,d=l.weekStartsOn??((w=(b=l.locale)==null?void 0:b.options)==null?void 0:w.weekStartsOn)??0,m=jr(t,a==null?void 0:a.in);if(!gA(m))throw new RangeError("Invalid time value");let p=r.match(d3).map(C=>{const T=C[0];if(T==="p"||T==="P"){const E=n3[T];return E(C,o.formatLong)}return C}).join("").match(c3).map(C=>{if(C==="''")return{isToken:!1,value:"'"};const T=C[0];if(T==="'")return{isToken:!1,value:p3(C)};if(e0[T])return{isToken:!0,value:C};if(T.match(m3))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");return{isToken:!1,value:C}});o.localize.preprocessor&&(p=o.localize.preprocessor(m,p));const y={firstWeekContainsDate:u,weekStartsOn:d,locale:o};return p.map(C=>{if(!C.isToken)return C.value;const T=C.value;(s3(T)||l3(T))&&o3(T,r,String(t));const E=e0[T[0]];return E(m,T,o.localize,y)}).join("")}function p3(t){const r=t.match(f3);return r?r[1].replace(h3,"'"):t}function Ap(t){const{data:r}=gw(t??"");return!t||!r?[]:r.skills}function g3(){return Cn({queryKey:["schedules"],queryFn:()=>ue.schedules.list()})}function y3(t){const r=/^\/([a-zA-Z0-9_-]*)$/.exec(t);return r?r[1]:null}function x3(t,r){const a=r.toLowerCase();return t.filter(l=>l.name.toLowerCase().startsWith(a)).sort((l,o)=>l.name.localeCompare(o.name))}function Nw(t,r,a){const[l,o]=S.useState(!1),[u,d]=S.useState(0);S.useEffect(()=>{o(!1),d(0)},[t]);const m=t!==null&&!l&&r.length>0;function p(x){a(x),o(!0)}function y(x){return m?x.key==="ArrowDown"?(x.preventDefault(),d(g=>(g+1)%r.length),!0):x.key==="ArrowUp"?(x.preventDefault(),d(g=>(g-1+r.length)%r.length),!0):x.key==="Enter"||x.key==="Tab"?(x.preventDefault(),p(r[u]),!0):x.key==="Escape"?(x.preventDefault(),o(!0),!0):!1:!1}return{open:m,matches:r,activeIndex:u,choose:p,onKeyDown:y}}function Op(t,r,a){const l=y3(t),o=l!==null?x3(a,l):[];return Nw(l,o,u=>r(`/${u.name} `))}function Rp({id:t,matches:r,activeIndex:a,onChoose:l}){return c.jsx("ul",{id:t,role:"listbox","aria-label":"Skills",className:"absolute bottom-full left-0 z-10 mb-1 max-h-48 w-72 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md",children:r.map((o,u)=>c.jsxs("li",{role:"option","aria-selected":u===a,onMouseDown:d=>{d.preventDefault(),l(o)},className:`cursor-pointer px-3 py-1.5 text-sm ${u===a?"bg-accent":""}`,children:[c.jsxs("div",{className:"font-medium",children:["/",o.name]}),o.description&&c.jsx("div",{className:"truncate text-xs text-muted-foreground",children:o.description})]},o.id))})}function da({title:t,onClose:r,children:a,width:l="w-96"}){return S.useEffect(()=>{function o(u){u.key==="Escape"&&r()}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r]),c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",role:"dialog","aria-modal":"true","aria-label":t,children:c.jsxs("div",{className:`${l} max-w-[90vw] max-h-[90vh] overflow-y-auto rounded-lg border bg-card p-6 shadow-lg`,children:[c.jsx("h2",{className:"text-base font-semibold mb-4",children:t}),a]})})}const ut="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";function ot({label:t,htmlFor:r,hint:a,children:l}){return c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:r,children:t}),l,a&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a})]})}function Qi({onCancel:t,submitLabel:r,busy:a,disabled:l,destructive:o,onSubmit:u}){return c.jsxs("div",{className:"flex gap-2 justify-end pt-2",children:[c.jsx("button",{type:"button",onClick:t,disabled:a,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),c.jsx("button",{type:u?"button":"submit",...u?{onClick:u}:{},disabled:a||l,className:`px-3 py-1.5 text-sm rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity ${o?"bg-destructive text-destructive-foreground":"bg-primary text-primary-foreground"}`,children:a?"Saving...":r})]})}function Fr({title:t,message:r,confirmLabel:a,destructive:l=!0,onConfirm:o,onClose:u}){return c.jsx(b3,{title:t,message:r,confirmLabel:a,destructive:l,onConfirm:o,onClose:u})}function b3({title:t,message:r,confirmLabel:a,destructive:l,onConfirm:o,onClose:u}){const[d,m]=S.useState(!1),[p,y]=S.useState("");async function x(){m(!0),y("");try{await o(),u()}catch(g){y(g instanceof Error?g.message:"Something went wrong"),m(!1)}}return c.jsxs(da,{title:t,onClose:u,children:[c.jsx("div",{className:"text-sm text-muted-foreground mb-4",children:r}),p&&c.jsx("p",{className:"text-xs text-destructive mb-3",children:p}),c.jsx(Qi,{onCancel:u,submitLabel:a,busy:d,destructive:l,onSubmit:x})]})}function a0({schedule:t,onClose:r}){const a=Mt(),{data:l,isLoading:o}=Pi(),u=(l==null?void 0:l.agents)??[],[d,m]=S.useState((t==null?void 0:t.agentId)??""),[p,y]=S.useState((t==null?void 0:t.name)??""),[x,g]=S.useState((t==null?void 0:t.prompt)??""),[b,w]=S.useState((t==null?void 0:t.cronExpression)??""),[C,T]=S.useState(!1),[E,k]=S.useState(""),A=Ap(d||void 0),M=Op(x,g,A),F=S.useRef(null);function Q(L){M.choose(L),requestAnimationFrame(()=>{const $=F.current;$&&$.setSelectionRange($.value.length,$.value.length)})}async function j(L){if(L.preventDefault(),!!d){T(!0),k("");try{t?await ue.schedules.update(t.id,{name:p,prompt:x,cronExpression:b}):await ue.schedules.create({agentId:d,name:p,prompt:x,cronExpression:b}),await a.invalidateQueries({queryKey:["schedules"]}),r()}catch($){k($ instanceof Error?$.message:`Failed to ${t?"save":"create"} schedule`),T(!1)}}}return c.jsx(da,{title:t?"Edit schedule":"New schedule",onClose:r,width:"w-[28rem]",children:c.jsxs("form",{onSubmit:j,className:"space-y-4",children:[c.jsx(ot,{label:"Agent",htmlFor:"schedule-agent",children:t?c.jsx("p",{id:"schedule-agent",className:`${ut} bg-muted text-muted-foreground`,children:t.agentName}):o?c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading agents..."}):c.jsxs("select",{id:"schedule-agent",required:!0,className:ut,value:d,onChange:L=>m(L.target.value),autoFocus:!0,children:[c.jsx("option",{value:"",children:"Select an agent…"}),u.map(L=>c.jsx("option",{value:L.id,children:L.name},L.id))]})}),c.jsx(ot,{label:"Name",htmlFor:"schedule-name",children:c.jsx("input",{id:"schedule-name",required:!0,className:ut,value:p,onChange:L=>y(L.target.value),placeholder:"Check for new emails",autoFocus:!!t})}),c.jsx(ot,{label:"Prompt",htmlFor:"schedule-prompt",hint:"Sent to the agent every time it runs. Type / for its skills.",children:c.jsxs("div",{className:"relative",children:[M.open&&c.jsx(Rp,{id:"schedule-prompt-skill-autocomplete",matches:M.matches,activeIndex:M.activeIndex,onChoose:Q}),c.jsx("textarea",{ref:F,id:"schedule-prompt",required:!0,rows:3,className:ut,value:x,onChange:L=>g(L.target.value),onKeyDown:L=>{M.onKeyDown(L)},placeholder:"Check for new emails and propose an answer."})]})}),c.jsx(ot,{label:"Cron expression",htmlFor:"schedule-cron",hint:"Standard 5-field cron, e.g. */30 * * * * for every 30 minutes. At most once every 5 minutes.",children:c.jsx("input",{id:"schedule-cron",required:!0,spellCheck:!1,className:`${ut} font-mono`,value:b,onChange:L=>w(L.target.value),placeholder:"*/30 * * * *"})}),E&&c.jsx("p",{className:"text-xs text-destructive",children:E}),c.jsx(Qi,{onCancel:r,submitLabel:t?"Save":"Create",busy:C,disabled:!d})]})})}function v3(){const t=Mt(),{data:r,isLoading:a,isError:l}=g3(),[o,u]=S.useState(!1),[d,m]=S.useState(null),[p,y]=S.useState(null),x=(r==null?void 0:r.schedules)??[];async function g(b){await ue.schedules.update(b.id,{enabled:!b.enabled}),await t.invalidateQueries({queryKey:["schedules"]})}return c.jsxs("div",{className:"max-w-4xl p-6",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-lg font-semibold",children:"Schedules"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Let an agent run on its own, on a recurring cron schedule. Each schedule gets its own chat, so you can see everything it did."})]}),c.jsx("button",{onClick:()=>u(!0),className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity whitespace-nowrap shrink-0",children:"New schedule"})]}),a&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),l&&c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load schedules."}),!a&&!l&&x.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:"No schedules yet."}),x.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsx("table",{className:"w-full text-sm border rounded-md",children:c.jsx("tbody",{className:"divide-y",children:x.map(b=>c.jsxs("tr",{children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[b.name,!b.enabled&&c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Paused"})]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[b.agentName," · ",c.jsx("span",{className:"font-mono",children:b.cronExpression})]}),c.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[b.enabled?`Next run ${Eo(new Date(b.nextRunAt),"d MMM HH:mm")}`:"Paused",b.lastRunAt&&` · last ran ${Eo(new Date(b.lastRunAt),"d MMM HH:mm")}`]})]}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap align-top",children:[c.jsx(Xn,{href:`/conversations/${b.conversationId}`,className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors inline-block",children:"Open chat"}),c.jsx("button",{onClick:()=>void g(b),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:b.enabled?"Pause":"Resume"}),c.jsx("button",{onClick:()=>m(b),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>y(b),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},b.id))})})}),o&&c.jsx(a0,{onClose:()=>u(!1)}),d&&c.jsx(a0,{schedule:d,onClose:()=>m(null)}),p&&c.jsx(Fr,{title:"Delete schedule?",message:c.jsxs(c.Fragment,{children:["“",p.name,"” will stop running. Its chat and everything it already did are kept."]}),confirmLabel:"Delete",onConfirm:async()=>{await ue.schedules.delete(p.id),await t.invalidateQueries({queryKey:["schedules"]})},onClose:()=>y(null)})]})}function w3(){return c.jsx(v3,{})}const S3=[{href:"/settings/general",label:"General",icon:$E},{href:"/settings/integrations",label:"Integrations",icon:Z1}];function Cw({children:t}){const r=Io(),a=pw();return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"border-b px-6 pt-4 shrink-0",children:[c.jsx("h1",{className:"text-lg font-semibold mb-3",children:"Settings"}),c.jsx("nav",{className:"flex gap-0 overflow-x-auto",children:S3.map(l=>{const o=r===l.href,u=l.icon;return c.jsxs(Xn,{href:l.href,className:`shrink-0 flex items-center gap-2 px-4 py-2 text-sm border-b-2 transition-colors ${o?"border-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[c.jsx(u,{size:14,className:"shrink-0"}),l.label,l.href==="/settings/integrations"&&a>0&&c.jsx(Ep,{label:"Not connected"})]},l.href)})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:t})]})}const tm=8,nm="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";function N3(){const t=mt(C=>C.setUser),[r,a]=S.useState(""),[l,o]=S.useState(""),[u,d]=S.useState(""),[m,p]=S.useState(""),[y,x]=S.useState(!1),[g,b]=S.useState(!1);async function w(C){if(C.preventDefault(),p(""),x(!1),l.length<tm){p(`The new password must be at least ${tm} characters.`);return}if(l!==u){p("The new passwords do not match.");return}b(!0);try{const T=await ue.auth.changePassword({currentPassword:r,newPassword:l});$c(T.accessToken,T.refreshToken),t(Bo(T.user)),a(""),o(""),d(""),x(!0)}catch(T){p(T instanceof Error?T.message:"Failed to change password")}finally{b(!1)}}return c.jsxs("section",{className:"space-y-4 border-t pt-6",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-sm font-semibold",children:"Password"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Changing it signs you out on your other devices."})]}),c.jsxs("form",{onSubmit:w,className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"current-password",children:"Current password"}),c.jsx("input",{id:"current-password",type:"password",required:!0,autoComplete:"current-password",value:r,onChange:C=>a(C.target.value),className:nm})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"new-password",children:"New password"}),c.jsx("input",{id:"new-password",type:"password",required:!0,minLength:tm,autoComplete:"new-password",value:l,onChange:C=>o(C.target.value),className:nm})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"confirm-password",children:"Confirm new password"}),c.jsx("input",{id:"confirm-password",type:"password",required:!0,autoComplete:"new-password",value:u,onChange:C=>d(C.target.value),className:nm})]}),m&&c.jsx("p",{className:"text-xs text-destructive",children:m}),y&&!m&&c.jsx("p",{className:"text-xs text-muted-foreground",children:"Password changed."}),c.jsx("button",{type:"submit",disabled:g,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:g?"Saving…":"Change password"})]})]})}const C3={light:"Light",dark:"Dark"},k3={small:"Small",normal:"Normal",big:"Big"};function j3(){const t=So(a=>a.appearance),r=So(a=>a.update);return c.jsxs("section",{className:"space-y-4 border-t pt-6",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-sm font-semibold",children:"Appearance"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Applies at once and is remembered on this device."})]}),c.jsxs("fieldset",{children:[c.jsx("legend",{className:"block text-sm font-medium mb-1",children:"Theme"}),c.jsx("div",{className:"flex gap-4",children:P1.map(a=>c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"radio",name:"theme",className:"accent-primary",checked:t.theme===a,onChange:()=>r({theme:a})}),C3[a]]},a))})]}),c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:t.highContrast,onChange:a=>r({highContrast:a.target.checked})}),"High contrast"]}),c.jsxs("fieldset",{children:[c.jsx("legend",{className:"block text-sm font-medium mb-1",children:"Text size"}),c.jsx("div",{className:"flex gap-4",children:Q1.map(a=>c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"radio",name:"font-size",className:"accent-primary",checked:t.fontSize===a,onChange:()=>r({fontSize:a})}),k3[a]]},a))})]})]})}const E3="https://www.npmjs.com/package/@kai-chat/desktop",i0="npx @kai-chat/desktop";function T3(){const[t,r]=S.useState(!1),[a,l]=S.useState(!1);async function o(){try{await navigator.clipboard.writeText(i0),l(!0)}catch{l(!1)}}return S.useEffect(()=>{r(!("kai"in window))},[]),t?c.jsxs("section",{className:"space-y-2 border-t pt-6",children:[c.jsx("h2",{className:"text-sm font-semibold",children:"Use KAI-Chat locally"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"The KAI desktop app lets agents work with files, screenshots and a browser on your own computer."}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"To start it, run this command in a terminal. Node.js has to be installed on your computer."}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"rounded bg-muted px-2 py-1 text-sm",children:i0}),c.jsx("button",{type:"button",onClick:o,className:"text-sm underline",children:a?"Copied":"Copy"})]}),c.jsx("a",{href:E3,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline",children:"Get the desktop app on npm"})]}):null}function A3(){const t=mt(g=>g.user),r=mt(g=>g.setUser),[a,l]=S.useState((t==null?void 0:t.avatarUrl)??""),[o,u]=S.useState(!1),[d,m]=S.useState(""),[p,y]=S.useState(!1);async function x(){u(!0),m(""),y(!1);try{const g=await ue.auth.updateMe({avatarUrl:a.trim()||null});r(g),y(!0)}catch(g){m(g instanceof Error?g.message:"Failed to save")}finally{u(!1)}}return c.jsxs("div",{className:"max-w-md space-y-6",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Your own profile picture, shown next to your messages."}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(ed,{name:t==null?void 0:t.displayName,avatarUrl:a||null,className:"w-14 h-14 text-lg"}),c.jsxs("div",{className:"flex-1",children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"my-avatar-url",children:"Avatar URL"}),c.jsx("input",{id:"my-avatar-url",type:"url",value:a,onChange:g=>{l(g.target.value),y(!1)},placeholder:"https://...",className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring"})]})]}),d&&c.jsx("p",{className:"text-xs text-destructive",children:d}),p&&!d&&c.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved."}),c.jsx("button",{onClick:()=>void x(),disabled:o,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:o?"Saving…":"Save"})]}),c.jsx(j3,{}),c.jsx(T3,{}),c.jsx(N3,{})]})}function O3(){return c.jsx(Cw,{children:c.jsx(A3,{})})}function kw(t,r){const a=setInterval(()=>{t.closed&&(clearInterval(a),r())},500),l=setTimeout(()=>clearInterval(a),600*1e3);return()=>{clearInterval(a),clearTimeout(l)}}function R3(){const t=Mt(),{data:r,isLoading:a,isError:l}=jp({accessibleOnly:!0}),[o,u]=S.useState({}),[d,m]=S.useState({}),p=S.useRef(null);S.useEffect(()=>()=>{var b;return(b=p.current)==null?void 0:b.call(p)},[]);const y=((r==null?void 0:r.servers)??[]).filter(b=>b.authType==="oauth");async function x(b){var w;u(C=>({...C,[b]:!0})),m(C=>({...C,[b]:""}));try{const{authorizationUrl:C}=await ue.mcp.oauthConnect(b),T=window.open(C,"kai-oauth-connect","width=500,height=700");if(!T){m(E=>({...E,[b]:"Your browser blocked the pop-up. Allow pop-ups for this site and try again."})),u(E=>({...E,[b]:!1}));return}(w=p.current)==null||w.call(p),p.current=kw(T,()=>{u(E=>({...E,[b]:!1})),t.invalidateQueries({queryKey:["mcp-servers"]})})}catch(C){m(T=>({...T,[b]:C instanceof Error?C.message:"Could not start the connection"})),u(T=>({...T,[b]:!1}))}}async function g(b){u(w=>({...w,[b]:!0})),m(w=>({...w,[b]:""}));try{await ue.mcp.oauthDisconnect(b),await t.invalidateQueries({queryKey:["mcp-servers"]})}catch(w){m(C=>({...C,[b]:w instanceof Error?w.message:"Could not disconnect"}))}finally{u(w=>({...w,[b]:!1}))}}return c.jsxs("div",{className:"max-w-2xl p-6",children:[c.jsx("h1",{className:"text-lg font-semibold",children:"Integrations"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1 mb-4",children:"Some tool servers need your own account connected before an agent can use them on your behalf. A connection is yours alone: nobody else sees or uses your credentials."}),a&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),l&&c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load integrations."}),!a&&!l&&y.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:"There is nothing to connect yet. An admin adds OAuth-authenticated tool servers in Admin > MCP servers."}),y.length>0&&c.jsx("ul",{className:"divide-y border rounded-md",children:y.map(b=>c.jsxs("li",{className:"px-4 py-3 flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"font-medium flex items-center gap-2",children:[b.name,c.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${b.connected?"bg-green-100 text-green-800":"bg-muted text-muted-foreground"}`,children:b.connected?"Connected":"Not connected"}),!b.connected&&c.jsx(Ep,{label:"Not connected"})]}),b.description&&c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:b.description}),d[b.id]&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:d[b.id]})]}),c.jsx("button",{onClick:()=>void(b.connected?g(b.id):x(b.id)),disabled:o[b.id],className:`px-3 py-1.5 text-sm rounded-md whitespace-nowrap shrink-0 transition-colors disabled:opacity-50 ${b.connected?"border hover:bg-accent":"bg-primary text-primary-foreground hover:opacity-90"}`,children:o[b.id]?"Working…":b.connected?"Disconnect":"Connect"})]},b.id))})]})}function M3(){return c.jsx(Cw,{children:c.jsx(R3,{})})}function z3(){return Cn({queryKey:["llm-models"],queryFn:()=>ue.llm.models(),staleTime:6e4})}function D3(...t){return Yo(Qo(t))}const _3=["filesystem.list","filesystem.read","filesystem.write","screen.capture","browser.read","browser.interact"],L3={"filesystem.list":"List the files in a folder","filesystem.read":"Read files","filesystem.write":"Create and change files","screen.capture":"Take a screenshot of your screen","browser.read":"Open web pages in a KAI browser window on your computer, read them and take screenshots","browser.interact":"Also click and type in those pages, which can submit forms"},U3=["before_tool_call","after_tool_call","before_agent_response","after_agent_response","on_agent_error"],q3=["Identity","Instructions","Capabilities","Rules","Skills","Hooks","Tools","Review","Sharing"];function jw({mode:t,agent:r}){var Ft,mr,jn;const a=_n(),l=Mt(),o=S.useRef(null),u=mt(H=>H.user),[d,m]=S.useState("Identity"),[p,y]=S.useState(!1),[x,g]=S.useState(""),[b,w]=S.useState(!1),[C,T]=S.useState((r==null?void 0:r.name)??""),[E,k]=S.useState((r==null?void 0:r.description)??""),[A,M]=S.useState((r==null?void 0:r.avatarUrl)??""),{data:F}=z3(),[Q,j]=S.useState((r==null?void 0:r.llmModelId)??""),[L,$]=S.useState((r==null?void 0:r.autoLocalClaudeModelId)??""),W=(F==null?void 0:F.models.filter(H=>H.isLocalClaude))??[],{data:z}=Pi(),le=((z==null?void 0:z.agents)??[]).filter(H=>H.id!==(r==null?void 0:r.id)),[I,ee]=S.useState((r==null?void 0:r.reviewAgentId)??""),[ie,re]=S.useState((r==null?void 0:r.reviewPrompt)??""),[Z,ce]=S.useState((r==null?void 0:r.reviewMaxRounds)??3),[me,Re]=S.useState((r==null?void 0:r.finalReviewAgentId)??""),[O,Be]=S.useState((r==null?void 0:r.instructions)??""),[lt,_]=S.useState((r==null?void 0:r.capabilities)??[]),[D,ae]=S.useState(((Ft=r==null?void 0:r.rules)==null?void 0:Ft.map(H=>({id:H.id,name:H.name,description:H.description,enforcement:H.enforcement,conditionType:H.condition.type,conditionToolName:H.condition.toolName??""})))??[]),[he,xe]=S.useState(((mr=r==null?void 0:r.skills)==null?void 0:mr.map(H=>({id:H.id,name:H.name,description:H.description,content:H.content})))??[]),[Oe,Me]=S.useState(((jn=r==null?void 0:r.hooks)==null?void 0:jn.map(H=>({id:H.id,event:H.event,name:H.name,handlerUrl:H.handlerUrl,enabled:H.enabled})))??[]),{data:Le,isLoading:ye}=jp(),je=(Le==null?void 0:Le.servers)??[],[Tt,Ke]=S.useState(()=>Object.fromEntries(((r==null?void 0:r.mcpBindings)??[]).map(H=>[H.mcpServerId,{enabled:!0,all:H.enabledTools.length===0,tools:H.enabledTools}])));function se(H){return Tt[H]??{enabled:!1,all:!0,tools:[]}}function He(H,ve){Ke(we=>({...we,[H]:{...se(H),...ve}}))}const[rt,Qe]=S.useState((r==null?void 0:r.visibility)??"private");function pt(H){_(ve=>ve.includes(H)?ve.filter(we=>we!==H):[...ve,H])}function zt(){ae(H=>[...H,{name:"",description:"",enforcement:"prompt_only",conditionType:"always"}])}function Ct(H,ve){ae(we=>we.map((Ee,ct)=>ct===H?{...Ee,...ve}:Ee))}function fe(H){ae(ve=>ve.filter((we,Ee)=>Ee!==H))}function ge(){xe(H=>[...H,{name:"",description:"",content:""}])}function oe(H,ve){xe(we=>we.map((Ee,ct)=>ct===H?{...Ee,...ve}:Ee))}function It(H){xe(ve=>ve.filter((we,Ee)=>Ee!==H))}function J(){Me(H=>[...H,{event:"before_tool_call",name:"",handlerUrl:"",enabled:!0}])}function K(H,ve){Me(we=>we.map((Ee,ct)=>ct===H?{...Ee,...ve}:Ee))}function be(H){Me(ve=>ve.filter((we,Ee)=>Ee!==H))}const Te=F==null?void 0:F.models.find(H=>H.id===F.defaultModelId);async function Ye(){if(!C.trim()){m("Identity"),g("Agent name is required");return}const H=je.find(ve=>{const we=se(ve.id);return we.enabled&&!we.all&&we.tools.length===0});if(H){m("Tools"),g(`Choose at least one tool for "${H.name}", or let the agent use all of its tools.`);return}y(!0),g("");try{const ve={name:C.trim(),description:E.trim(),avatarUrl:A.trim()||null,instructions:O.trim(),llmModelId:Q||null,autoLocalClaudeModelId:L||null,reviewAgentId:I||null,reviewPrompt:ie.trim(),reviewMaxRounds:Z,finalReviewAgentId:me||null,visibility:rt,capabilities:lt};if(t==="create"){const we=await ue.agents.create(ve);for(const Ee of he)Ee.name&&await ue.agents.skills.create(we.id,{name:Ee.name,description:Ee.description,content:Ee.content});for(const Ee of D)Ee.name&&await ue.agents.rules.create(we.id,{name:Ee.name,description:Ee.description,enforcement:Ee.enforcement,condition:{type:Ee.conditionType,toolName:Ee.conditionToolName||void 0}});for(const Ee of Oe)Ee.name&&Ee.handlerUrl&&await ue.agents.hooks.create(we.id,{event:Ee.event,name:Ee.name,handlerUrl:Ee.handlerUrl,enabled:Ee.enabled});await Jn(we.id,[]),await l.invalidateQueries({queryKey:["agents"]}),a.push("/agents")}else r&&(await ue.agents.update(r.id,ve),await nn(r),await Jn(r.id,r.mcpBindings),await l.invalidateQueries({queryKey:["agents"]}),await l.invalidateQueries({queryKey:["agents",r.id]}),a.push("/agents"))}catch(ve){g(ve instanceof Error?ve.message:"Save failed"),y(!1)}}async function nn(H){const ve=Ce=>({name:Ce.name,description:Ce.description,enforcement:Ce.enforcement,condition:{type:Ce.conditionType,toolName:Ce.conditionToolName||void 0}}),we=(Ce,Ht)=>JSON.stringify(Ce)===JSON.stringify(Ht),Ee=new Map(H.skills.map(Ce=>[Ce.id,{name:Ce.name,description:Ce.description,content:Ce.content}])),ct=new Map(H.rules.map(Ce=>[Ce.id,ve({name:Ce.name,description:Ce.description,enforcement:Ce.enforcement,conditionType:Ce.condition.type,conditionToolName:Ce.condition.toolName??""})])),Un=new Map(H.hooks.map(Ce=>[Ce.id,{event:Ce.event,name:Ce.name,handlerUrl:Ce.handlerUrl,enabled:Ce.enabled}]));for(const Ce of Ee.keys())he.some(Ht=>Ht.id===Ce)||await ue.agents.skills.delete(H.id,Ce);for(const Ce of ct.keys())D.some(Ht=>Ht.id===Ce)||await ue.agents.rules.delete(H.id,Ce);for(const Ce of Un.keys())Oe.some(Ht=>Ht.id===Ce)||await ue.agents.hooks.delete(H.id,Ce);for(const Ce of he){if(!Ce.name)continue;const Ht={name:Ce.name,description:Ce.description,content:Ce.content};Ce.id?we(Ht,Ee.get(Ce.id))||await ue.agents.skills.update(H.id,Ce.id,Ht):await ue.agents.skills.create(H.id,Ht)}for(const Ce of D){if(!Ce.name)continue;const Ht=ve(Ce);Ce.id?we(Ht,ct.get(Ce.id))||await ue.agents.rules.update(H.id,Ce.id,Ht):await ue.agents.rules.create(H.id,Ht)}for(const Ce of Oe){if(!Ce.name||!Ce.handlerUrl)continue;const Ht={event:Ce.event,name:Ce.name,handlerUrl:Ce.handlerUrl,enabled:Ce.enabled};Ce.id?we(Ht,Un.get(Ce.id))||await ue.agents.hooks.update(H.id,Ce.id,Ht):await ue.agents.hooks.create(H.id,Ht)}}async function Jn(H,ve){for(const we of je){const Ee=se(we.id),ct=ve.find(Un=>Un.mcpServerId===we.id);if(Ee.enabled){const Un=Ee.all?[]:Ee.tools;ct&&JSON.stringify([...ct.enabledTools].sort())===JSON.stringify([...Un].sort())||await ue.mcp.bind(H,{mcpServerId:we.id,enabledTools:Un})}else ct&&await ue.mcp.unbind(H,ct.id)}}async function kn(){if(r&&confirm(`Delete agent "${r.name}"? This cannot be undone.`)){w(!0);try{await ue.agents.delete(r.id),await l.invalidateQueries({queryKey:["agents"]}),a.push("/agents")}catch(H){g(H instanceof Error?H.message:"Delete failed"),w(!1)}}}async function fr(){if(r)try{const H=await ue.agents.export(r.id),ve=new Blob([JSON.stringify(H,null,2)],{type:"application/json"}),we=URL.createObjectURL(ve),Ee=document.createElement("a");Ee.href=we,Ee.download=`${r.name.replace(/\s+/g,"-")}-export.json`,Ee.click(),URL.revokeObjectURL(we)}catch(H){g(H instanceof Error?H.message:"Export failed")}}async function hr(H){var we;const ve=(we=H.target.files)==null?void 0:we[0];if(ve){try{const Ee=await ve.text(),ct=JSON.parse(Ee),Un=await ue.agents.import(ct);await l.invalidateQueries({queryKey:["agents"]}),a.push(`/agents/${Un.id}/edit`)}catch(Ee){g(Ee instanceof Error?Ee.message:"Import failed")}H.target.value=""}}return t==="create"&&u!==null&&!Zc(u)?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Your role only allows chatting, not creating agents."})}):c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsx("div",{className:"border-b px-6 py-4 shrink-0",children:c.jsx("h1",{className:"text-lg font-semibold",children:t==="create"?"New Agent":`Edit: ${(r==null?void 0:r.name)??""}`})}),c.jsx("div",{className:"border-b px-6 flex gap-0 shrink-0 overflow-x-auto",children:q3.map(H=>c.jsx("button",{onClick:()=>m(H),className:D3("px-4 py-2.5 text-sm border-b-2 transition-colors whitespace-nowrap",d===H?"border-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground"),children:H},H))}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:[d==="Identity"&&c.jsxs("div",{className:"space-y-4 max-w-lg",children:[c.jsxs("div",{children:[c.jsxs("label",{className:"block text-sm font-medium mb-1",children:["Name ",c.jsx("span",{className:"text-destructive",children:"*"})]}),c.jsx("input",{type:"text",value:C,onChange:H=>T(H.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"My Agent"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",children:"Description"}),c.jsx("textarea",{value:E,onChange:H=>k(H.target.value),rows:3,className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring resize-none",placeholder:"What does this agent do?"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",children:"Avatar URL"}),c.jsx("input",{type:"url",value:A,onChange:H=>M(H.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"https://..."})]}),c.jsxs("div",{className:"pt-2 border-t",children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"agent-model",children:"AI model"}),c.jsxs("select",{id:"agent-model",value:Q,onChange:H=>j(H.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsxs("option",{value:"",children:["Organization default",Te?` (${Te.label})`:""]}),F==null?void 0:F.models.map(H=>c.jsxs("option",{value:H.id,children:[H.label," — ",H.providerName]},H.id))]}),F&&F.models.length===0&&c.jsx("p",{className:"text-xs text-destructive mt-1",children:"Your organization has no AI models yet. Ask an admin to add one, or this agent can't run."})]}),W.length>0&&c.jsxs("div",{className:"pt-2 border-t",children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"agent-auto-local-claude",children:"Automatically use Local Claude Code when available"}),c.jsxs("select",{id:"agent-auto-local-claude",value:L,onChange:H=>$(H.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx("option",{value:"",children:"Off"}),W.map(H=>c.jsx("option",{value:H.id,children:H.label},H.id))]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Whenever the person chatting has their KAI desktop app connected with Claude Code turned on, this agent runs there instead of its model above; otherwise it uses its model above as normal."})]})]}),d==="Instructions"&&c.jsxs("div",{className:"max-w-2xl",children:[c.jsx("label",{className:"block text-sm font-medium mb-2",children:"System Prompt"}),c.jsx("textarea",{value:O,onChange:H=>Be(H.target.value),rows:20,className:"w-full px-3 py-2 rounded-md border bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring resize-none",placeholder:"You are a helpful assistant..."})]}),d==="Capabilities"&&c.jsxs("div",{className:"max-w-md space-y-3",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Select which capabilities this agent may use. Which folders it may use is set in the desktop app under Settings > File access."}),_3.map(H=>c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:lt.includes(H),onChange:()=>pt(H),className:"rounded border accent-primary"}),c.jsxs("span",{children:[c.jsx("span",{className:"text-sm font-mono",children:H}),c.jsx("span",{className:"block text-xs text-muted-foreground",children:L3[H]})]})]},H))]}),d==="Rules"&&c.jsxs("div",{className:"max-w-2xl space-y-4",children:[D.map((H,ve)=>c.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("span",{className:"text-sm font-medium",children:["Rule ",ve+1]}),c.jsx("button",{onClick:()=>fe(ve),className:"text-xs text-destructive hover:underline",children:"Remove"})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Name"}),c.jsx("input",{type:"text",value:H.name,onChange:we=>Ct(ve,{name:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Enforcement"}),c.jsxs("select",{value:H.enforcement,onChange:we=>Ct(ve,{enforcement:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring",children:[c.jsx("option",{value:"prompt_only",children:"Prompt only"}),c.jsx("option",{value:"approval_required",children:"Approval required"}),c.jsx("option",{value:"block",children:"Block"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Description"}),c.jsx("input",{type:"text",value:H.description,onChange:we=>Ct(ve,{description:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Condition Type"}),c.jsxs("select",{value:H.conditionType,onChange:we=>Ct(ve,{conditionType:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring",children:[c.jsx("option",{value:"always",children:"Always"}),c.jsx("option",{value:"tool_call",children:"Tool call"})]})]}),H.conditionType==="tool_call"&&c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Tool Name"}),c.jsx("input",{type:"text",value:H.conditionToolName??"",onChange:we=>Ct(ve,{conditionToolName:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"filesystem.write"})]})]})]},ve)),c.jsx("button",{onClick:zt,className:"text-sm text-muted-foreground hover:text-foreground border rounded-md px-3 py-2 w-full hover:bg-accent transition-colors",children:"+ Add Rule"})]}),d==="Skills"&&c.jsxs("div",{className:"max-w-2xl space-y-4",children:[he.map((H,ve)=>c.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("span",{className:"text-sm font-medium",children:["Skill ",ve+1]}),c.jsx("button",{onClick:()=>It(ve),className:"text-xs text-destructive hover:underline",children:"Remove"})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Name"}),c.jsx("input",{type:"text",value:H.name,onChange:we=>oe(ve,{name:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Description"}),c.jsx("input",{type:"text",value:H.description,onChange:we=>oe(ve,{description:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Content"}),c.jsx("textarea",{value:H.content,onChange:we=>oe(ve,{content:we.target.value}),rows:5,className:"w-full px-2 py-1 rounded border bg-background text-sm font-mono focus:outline-none focus:ring-1 focus:ring-ring resize-none"})]})]},ve)),c.jsx("button",{onClick:ge,className:"text-sm text-muted-foreground hover:text-foreground border rounded-md px-3 py-2 w-full hover:bg-accent transition-colors",children:"+ Add Skill"})]}),d==="Hooks"&&c.jsxs("div",{className:"max-w-2xl space-y-4",children:[Oe.map((H,ve)=>c.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("span",{className:"text-sm font-medium",children:["Hook ",ve+1]}),c.jsx("button",{onClick:()=>be(ve),className:"text-xs text-destructive hover:underline",children:"Remove"})]}),c.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Event"}),c.jsx("select",{value:H.event,onChange:we=>K(ve,{event:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring",children:U3.map(we=>c.jsx("option",{value:we,children:we},we))})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Name"}),c.jsx("input",{type:"text",value:H.name,onChange:we=>K(ve,{name:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium mb-1",children:"Handler URL"}),c.jsx("input",{type:"url",value:H.handlerUrl,onChange:we=>K(ve,{handlerUrl:we.target.value}),className:"w-full px-2 py-1 rounded border bg-background text-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"https://my-service.example.com/hook"})]}),c.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:H.enabled,onChange:we=>K(ve,{enabled:we.target.checked}),className:"accent-primary"}),c.jsx("span",{className:"text-xs",children:"Enabled"})]})]},ve)),c.jsx("button",{onClick:J,className:"text-sm text-muted-foreground hover:text-foreground border rounded-md px-3 py-2 w-full hover:bg-accent transition-colors",children:"+ Add Hook"})]}),d==="Tools"&&c.jsxs("div",{className:"max-w-2xl space-y-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"MCP servers give this agent extra tools beyond the capabilities above. Rules still apply to them."}),ye&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading servers..."}),!ye&&je.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:"Your organization has no MCP servers yet. An admin can add them under Admin → MCP servers."}),je.map(H=>{const ve=se(H.id),we=H.tools.length>0,Ee=!H.availableToMe;return c.jsxs("div",{className:`border rounded-lg p-4 space-y-3 ${Ee?"opacity-60":""}`,children:[c.jsxs("label",{className:`flex items-start gap-3 ${Ee&&!ve.enabled?"cursor-not-allowed":"cursor-pointer"}`,children:[c.jsx("input",{type:"checkbox",className:"mt-1 accent-primary",checked:ve.enabled,disabled:Ee&&!ve.enabled,onChange:ct=>He(H.id,{enabled:ct.target.checked}),"aria-label":`Use ${H.name}`}),c.jsxs("span",{children:[c.jsx("span",{className:"text-sm font-medium",children:H.name}),c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:H.transport==="http"?"HTTP":"stdio"}),H.description&&c.jsx("span",{className:"block text-xs text-muted-foreground",children:H.description}),Ee&&c.jsx("span",{className:"block text-xs text-muted-foreground",children:"Not available to you. Ask an admin to allow it."})]})]}),ve.enabled&&c.jsxs("div",{className:"ml-7 space-y-2",children:[c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"radio",name:`mcp-mode-${H.id}`,className:"accent-primary",checked:ve.all,disabled:Ee,onChange:()=>He(H.id,{all:!0})}),"All of its tools"]}),c.jsxs("label",{className:`flex items-center gap-2 text-sm ${we?"cursor-pointer":"opacity-50"}`,children:[c.jsx("input",{type:"radio",name:`mcp-mode-${H.id}`,className:"accent-primary",checked:!ve.all,disabled:!we||Ee,onChange:()=>He(H.id,{all:!1})}),"Only these tools"]}),!we&&c.jsx("p",{className:"text-xs text-muted-foreground",children:"Its tool list isn't known yet. An admin can test the connection to list them; until then the agent gets all of them."}),we&&!ve.all&&c.jsx("ul",{className:"space-y-1 pl-6",children:H.tools.map(ct=>c.jsx("li",{children:c.jsxs("label",{className:"flex items-start gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"mt-1 accent-primary",checked:ve.tools.includes(ct.name),disabled:Ee,onChange:Un=>He(H.id,{tools:Un.target.checked?[...ve.tools,ct.name]:ve.tools.filter(Ce=>Ce!==ct.name)}),"aria-label":ct.name}),c.jsxs("span",{children:[c.jsx("span",{className:"font-mono text-xs",children:ct.name}),ct.description&&c.jsx("span",{className:"block text-xs text-muted-foreground",children:ct.description})]})]})},ct.name))})]})]},H.id)})]}),d==="Review"&&c.jsxs("div",{className:"max-w-2xl space-y-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Let another agent check this agent's answers. After each answer the reviewer writes a critique; if it asks for changes, this agent revises, until the reviewer approves or the rounds below are used up, when you are asked whether to go on."}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"agent-reviewer",children:"Reviewer"}),c.jsxs("select",{id:"agent-reviewer",value:I,onChange:H=>ee(H.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx("option",{value:"",children:"No review"}),le.map(H=>c.jsx("option",{value:H.id,children:H.name},H.id))]})]}),I&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"agent-review-prompt",children:"Reviewer prompt"}),c.jsx("textarea",{id:"agent-review-prompt",value:ie,onChange:H=>re(H.target.value),rows:6,className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring resize-none",placeholder:"What should the reviewer look for?"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Added to the reviewer's own instructions, only when it reviews this agent."})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"agent-review-rounds",children:"Review rounds before asking"}),c.jsx("input",{id:"agent-review-rounds",type:"number",min:1,max:10,value:Z,onChange:H=>ce(Number(H.target.value)),className:"w-24 px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"agent-final-reviewer",children:"Final reviewer"}),c.jsxs("select",{id:"agent-final-reviewer",value:me,onChange:H=>Re(H.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx("option",{value:"",children:"None"}),le.map(H=>c.jsx("option",{value:H.id,children:H.name},H.id))]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Looks over the end result once, after the review rounds."})]})]}),d==="Sharing"&&c.jsxs("div",{className:"max-w-sm space-y-3",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Control who can use this agent."}),["private","org","selected"].map(H=>c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("input",{type:"radio",name:"visibility",value:H,checked:rt===H,onChange:()=>Qe(H),className:"accent-primary"}),c.jsx("span",{className:"text-sm capitalize",children:H==="private"?"Private (only me)":H==="org"?"Organization (everyone in my org)":"Selected users"})]},H)),rt==="selected"&&c.jsx("p",{className:"text-xs text-muted-foreground ml-7",children:"Manage individual access after saving."})]})]}),c.jsxs("div",{className:"border-t px-6 py-4 flex flex-wrap items-center gap-3 shrink-0 bg-background",children:[x&&c.jsx("span",{className:"text-sm text-destructive flex-1 truncate",children:x}),!x&&c.jsx("span",{className:"flex-1"}),c.jsx("input",{ref:o,type:"file",accept:"application/json",onChange:hr,className:"hidden"}),c.jsx("button",{onClick:()=>{var H;return(H=o.current)==null?void 0:H.click()},className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent transition-colors",children:"Import"}),t==="edit"&&r&&c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:fr,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent transition-colors",children:"Export"}),c.jsx("button",{onClick:kn,disabled:b,className:"px-3 py-1.5 text-sm rounded-md bg-destructive text-destructive-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:b?"Deleting...":"Delete"})]}),c.jsx("button",{onClick:Ye,disabled:p,className:"px-4 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:p?"Saving...":"Save"})]})]})}function H3(){return c.jsx(jw,{mode:"create"})}function B3({params:t}){const{id:r}=S.use(t),{data:a,isLoading:l,isError:o}=gw(r);return l?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading agent..."})}):o||!a?c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load agent."})}):c.jsx(jw,{mode:"edit",agent:a})}function I3(t,r){return Cn({queryKey:["conversations",t,"messages",r],queryFn:()=>ue.conversations.messages(t,r),enabled:!!t})}function F3(){return Cn({queryKey:["transcription"],queryFn:()=>ue.transcription.status(),staleTime:6e4})}function P3(t){return t.messages?t.messages:t.messageId!==void 0&&t.content!==void 0?[{messageId:t.messageId,senderName:t.senderName??null,content:t.content}]:[]}const Q3="temp-";function Hm(t){var r;return(t.role==="user"||t.role==="assistant")&&!t.id.startsWith(Q3)&&!((r=t.metadata)!=null&&r.forward)}function Y3(t,r){return t.filter(a=>a.senderType==="agent"&&a.senderId===r).map(a=>a.id).slice(-20)}function V3({conversationId:t,memberIds:r,onClose:a}){const l=Mt(),[o,u]=S.useState([]),[d,m]=S.useState(!1),[p,y]=S.useState("");async function x(){if(!(o.length===0||d)){m(!0),y("");try{await ue.conversations.addParticipants(t,o),await l.invalidateQueries({queryKey:["conversations"]}),a()}catch(g){y(g instanceof Error?g.message:"Failed to add people"),m(!1)}}}return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",role:"dialog","aria-modal":"true","aria-labelledby":"add-people-title",children:c.jsxs("div",{className:"w-96 max-w-[90vw] rounded-lg border bg-card p-6 shadow-lg",children:[c.jsx("h2",{id:"add-people-title",className:"text-base font-semibold mb-1",children:"Add people"}),c.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"They will see the whole conversation, including what was said before they joined."}),c.jsx("div",{className:"mb-4",children:c.jsx(Tp,{exclude:r,selected:o,onChange:u})}),p&&c.jsx("p",{role:"alert",className:"text-xs text-destructive mb-3",children:p}),c.jsxs("div",{className:"flex gap-2 justify-end",children:[c.jsx("button",{onClick:a,disabled:d,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),c.jsx("button",{onClick:()=>void x(),disabled:o.length===0||d,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:d?"Adding...":"Add"})]})]})})}function G3({conversationId:t,messages:r,sharedChat:a=!1,onClose:l,onForwarded:o}){const u=Mt(),{data:d,isLoading:m}=Pi(),p=(d==null?void 0:d.agents)??[],[y,x]=S.useState(""),[g,b]=S.useState(""),[w,C]=S.useState(!1),[T,E]=S.useState(""),k=Ap(y||void 0),A=Op(g,b,k),M=S.useRef(null);function F(j){A.choose(j),requestAnimationFrame(()=>{const L=M.current;L&&L.setSelectionRange(L.value.length,L.value.length)})}async function Q(){if(!(y===""||w)){C(!0),E("");try{await ue.conversations.forward(t,{messageIds:r.map(j=>j.id),agentId:y,...g.trim()!==""?{note:g.trim()}:{}}),await u.invalidateQueries({queryKey:["conversations",t,"messages"]}),o()}catch(j){E(j instanceof Error?j.message:"Failed to forward"),C(!1)}}}return c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",role:"dialog","aria-modal":"true","aria-labelledby":"forward-title",children:c.jsxs("div",{className:"w-[26rem] max-w-[90vw] rounded-lg border bg-card p-6 shadow-lg",children:[c.jsx("h2",{id:"forward-title",className:"text-base font-semibold mb-1",children:r.length===1?"Forward to an agent":`Forward ${r.length} messages to an agent`}),c.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["The agent gets only ",r.length===1?"this message":"these messages"," and your prompt, and answers here",a?" for everyone in the chat":"","."]}),c.jsx("div",{className:"mb-3 max-h-48 space-y-1.5 overflow-y-auto",children:r.map(j=>c.jsxs("blockquote",{className:"rounded-md border-l-4 border-primary/60 bg-muted/60 px-3 py-2 text-xs whitespace-pre-wrap break-words",children:[j.senderName&&c.jsxs("span",{className:"font-medium",children:[j.senderName,": "]}),j.content!==""?j.content:"(a file)"]},j.id))}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"forward-agent",children:"Agent"}),m?c.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading agents..."}):p.length===0?c.jsxs("p",{className:"text-xs text-muted-foreground",children:["You have no agents yet."," ",c.jsx(Xn,{href:"/agents/new",onClick:l,className:"text-foreground font-medium hover:underline",children:"Create one"})," ","to forward messages to it."]}):c.jsxs("select",{id:"forward-agent",value:y,onChange:j=>x(j.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx("option",{value:"",children:"Select an agent…"}),p.map(j=>c.jsx("option",{value:j.id,children:j.name},j.id))]})]}),c.jsxs("div",{className:"mb-4",children:[c.jsxs("label",{className:"block text-sm font-medium mb-1",htmlFor:"forward-note",children:["Prompt ",c.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),c.jsxs("div",{className:"relative",children:[A.open&&c.jsx(Rp,{id:"forward-note-skill-autocomplete",matches:A.matches,activeIndex:A.activeIndex,onChoose:F}),c.jsx("textarea",{ref:M,id:"forward-note",rows:3,value:g,onChange:j=>b(j.target.value),onKeyDown:j=>{A.onKeyDown(j)},placeholder:r.length===1?"What should the agent do with it?":"What should the agent do with them?",className:"w-full resize-none rounded-md border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring"})]})]}),T&&c.jsx("p",{role:"alert",className:"text-xs text-destructive mb-3",children:T}),c.jsxs("div",{className:"flex gap-2 justify-end",children:[c.jsx("button",{onClick:l,disabled:w,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 transition-colors",children:"Cancel"}),c.jsx("button",{onClick:()=>void Q(),disabled:y===""||w,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:w?"Forwarding...":"Forward"})]})]})})}function Bm(){return typeof window<"u"&&"speechSynthesis"in window&&typeof window.SpeechSynthesisUtterance=="function"}function K3(t){return t.replace(/```[\s\S]*?(```|$)/g,`
256
+ code block omitted.
257
+ `).replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]*)`/g,"$1").replace(/^ {0,3}#{1,6}\s+/gm,"").replace(/^ {0,3}>\s?/gm,"").replace(/^\s*([-*+]|\d+[.)])\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm,"").replace(/\|/g,", ").replace(/(\*\*|__|~~|\*)/g,"").replace(/[ \t]+/g," ").replace(/\n{2,}/g,`
258
+ `).trim()}function X3(t,r=200){const a=t.split(`
259
+ `).flatMap(d=>d.match(/[^.!?。]+[.!?。]*\s*/g)??[]).map(d=>d.trim()).filter(d=>d!==""),l=[];let o="";const u=()=>{o!==""&&l.push(o),o=""};for(const d of a)if(d.length>r){u();let m=d;for(;m.length>r;){const p=m.lastIndexOf(" ",r),y=p>0?p:r;l.push(m.slice(0,y).trim()),m=m.slice(y).trim()}o=m}else o!==""&&o.length+1+d.length>r?(u(),o=d):o=o===""?d:`${o} ${d}`;return u(),l}const Im=Wa((t,r)=>({speakingId:null,speak:(a,l)=>{if(!Bm())return;const o=X3(K3(l));if(window.speechSynthesis.cancel(),o.length===0){t({speakingId:null});return}t({speakingId:a});const u=()=>{r().speakingId===a&&t({speakingId:null})};o.forEach((d,m)=>{const p=new SpeechSynthesisUtterance(d);p.lang=navigator.language,p.onerror=()=>{r().speakingId===a&&r().stop()},m===o.length-1&&(p.onend=u),window.speechSynthesis.speak(p)})},stop:()=>{Bm()&&window.speechSynthesis.cancel(),t({speakingId:null})}}));function $3(t,r){const a={};return(t[t.length-1]===""?[...t,""]:t).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const Z3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,J3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W3={};function l0(t,r){return(W3.jsx?J3:Z3).test(t)}const eO=/[ \t\n\f\r]/g;function tO(t){return typeof t=="object"?t.type==="text"?s0(t.value):!1:s0(t)}function s0(t){return t.replace(eO,"")===""}class Vo{constructor(r,a,l){this.normal=a,this.property=r,l&&(this.space=l)}}Vo.prototype.normal={};Vo.prototype.property={};Vo.prototype.space=void 0;function Ew(t,r){const a={},l={};for(const o of t)Object.assign(a,o.property),Object.assign(l,o.normal);return new Vo(a,l,r)}function Fm(t){return t.toLowerCase()}class Ln{constructor(r,a){this.attribute=a,this.property=r}}Ln.prototype.attribute="";Ln.prototype.booleanish=!1;Ln.prototype.boolean=!1;Ln.prototype.commaOrSpaceSeparated=!1;Ln.prototype.commaSeparated=!1;Ln.prototype.defined=!1;Ln.prototype.mustUseProperty=!1;Ln.prototype.number=!1;Ln.prototype.overloadedBoolean=!1;Ln.prototype.property="";Ln.prototype.spaceSeparated=!1;Ln.prototype.space=void 0;let nO=0;const qe=Yi(),Kt=Yi(),Pm=Yi(),de=Yi(),St=Yi(),qi=Yi(),Kn=Yi();function Yi(){return 2**++nO}const Qm=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:Kt,commaOrSpaceSeparated:Kn,commaSeparated:qi,number:de,overloadedBoolean:Pm,spaceSeparated:St},Symbol.toStringTag,{value:"Module"})),rm=Object.keys(Qm);class Mp extends Ln{constructor(r,a,l,o){let u=-1;if(super(r,a),o0(this,"space",o),typeof l=="number")for(;++u<rm.length;){const d=rm[u];o0(this,rm[u],(l&Qm[d])===Qm[d])}}}Mp.prototype.defined=!0;function o0(t,r,a){a&&(t[r]=a)}function ls(t){const r={},a={};for(const[l,o]of Object.entries(t.properties)){const u=new Mp(l,t.transform(t.attributes||{},l),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),r[l]=u,a[Fm(l)]=l,a[Fm(u.attribute)]=l}return new Vo(r,a,t.space)}const Tw=ls({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:St,ariaCurrent:null,ariaDescribedBy:St,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:St,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:St,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:St,ariaLevel:de,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:St,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:St,ariaRowCount:de,ariaRowIndex:de,ariaRowSpan:de,ariaSelected:Kt,ariaSetSize:de,ariaSort:null,ariaValueMax:de,ariaValueMin:de,ariaValueNow:de,ariaValueText:null,role:null},transform(t,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Aw(t,r){return r in t?t[r]:r}function Ow(t,r){return Aw(t,r.toLowerCase())}const rO=ls({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:qi,acceptCharset:St,accessKey:St,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alpha:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:St,autoFocus:qe,autoPlay:qe,blocking:St,capture:null,charSet:null,checked:qe,cite:null,className:St,closedBy:null,colorSpace:null,cols:de,colSpan:de,command:null,commandFor:null,content:null,contentEditable:Kt,controls:qe,controlsList:St,coords:de|qi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:Pm,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:St,height:de,hidden:Pm,high:de,href:null,hrefLang:null,htmlFor:St,httpEquiv:St,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:St,itemRef:St,itemScope:qe,itemType:St,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:qe,low:de,manifest:null,max:null,maxLength:de,media:null,method:null,min:null,minLength:de,multiple:qe,muted:qe,name:null,nonce:null,noModule:qe,noValidate:qe,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:qe,optimum:de,pattern:null,ping:St,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:St,required:qe,reversed:qe,rows:de,rowSpan:de,sandbox:St,scope:null,scoped:qe,seamless:qe,selected:qe,shadowRootClonable:qe,shadowRootCustomElementRegistry:qe,shadowRootDelegatesFocus:qe,shadowRootMode:null,shadowRootSerializable:qe,shape:null,size:de,sizes:null,slot:null,span:de,spellCheck:Kt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:de,step:null,style:null,tabIndex:de,target:null,title:null,translate:null,type:null,typeMustMatch:qe,useMap:null,value:Kt,width:de,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:St,axis:null,background:null,bgColor:null,border:de,borderColor:null,bottomMargin:de,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:qe,declare:qe,event:null,face:null,frame:null,frameBorder:null,hSpace:de,leftMargin:de,link:null,longDesc:null,lowSrc:null,marginHeight:de,marginWidth:de,noResize:qe,noHref:qe,noShade:qe,noWrap:qe,object:null,profile:null,prompt:null,rev:null,rightMargin:de,rules:null,scheme:null,scrolling:Kt,standby:null,summary:null,text:null,topMargin:de,valueType:null,version:null,vAlign:null,vLink:null,vSpace:de,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:qe,disablePictureInPicture:qe,disableRemotePlayback:qe,exportParts:qi,part:St,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:Ow}),aO=ls({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",maskType:"mask-type",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:Kn,accentHeight:de,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:de,amplitude:de,arabicForm:null,ascent:de,attributeName:null,attributeType:null,azimuth:de,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:de,by:null,calcMode:null,capHeight:de,className:St,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:de,diffuseConstant:de,direction:null,display:null,dur:null,divisor:de,dominantBaseline:null,download:qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:de,enableBackground:null,end:null,event:null,exponent:de,externalResourcesRequired:null,fill:null,fillOpacity:de,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:qi,g2:qi,glyphName:qi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:de,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:de,horizOriginX:de,horizOriginY:de,id:null,ideographic:de,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:de,k:de,k1:de,k2:de,k3:de,k4:de,kernelMatrix:Kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:de,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:de,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:de,overlineThickness:de,paintOrder:null,panose1:null,path:null,pathLength:de,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:St,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Kn,rev:Kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Kn,requiredFeatures:Kn,requiredFonts:Kn,requiredFormats:Kn,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:de,specularExponent:de,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:de,strikethroughThickness:de,string:null,stroke:null,strokeDashArray:Kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:de,strokeOpacity:de,strokeWidth:null,style:null,surfaceScale:de,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Kn,tabIndex:de,tableValues:null,target:null,targetX:de,targetY:de,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:de,underlineThickness:de,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:de,values:null,vAlphabetic:de,vMathematical:de,vectorEffect:null,vHanging:de,vIdeographic:de,version:null,vertAdvY:de,vertOriginX:de,vertOriginY:de,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:de,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Aw}),Rw=ls({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,r){return"xlink:"+r.slice(5).toLowerCase()}}),Mw=ls({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ow}),zw=ls({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),iO={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"},lO=/[A-Z]/g,u0=/-[a-z]/g,sO=/^data[-\w.:]+$/i;function oO(t,r){const a=Fm(r);let l=r,o=Ln;if(a in t.normal)return t.property[t.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&sO.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(u0,cO);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!u0.test(u)){let d=u.replace(lO,uO);d.charAt(0)!=="-"&&(d="-"+d),r="data"+d}}o=Mp}return new o(l,r)}function uO(t){return"-"+t.toLowerCase()}function cO(t){return t.charAt(1).toUpperCase()}const dO=Ew([Tw,rO,Rw,Mw,zw],"html"),zp=Ew([Tw,aO,Rw,Mw,zw],"svg");function fO(t){return t.join(" ").trim()}var Ll={},am,c0;function hO(){if(c0)return am;c0=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,a=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,m=/^\s+|\s+$/g,p=`
260
+ `,y="/",x="*",g="",b="comment",w="declaration";function C(E,k){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];k=k||{};var A=1,M=1;function F(ie){var re=ie.match(r);re&&(A+=re.length);var Z=ie.lastIndexOf(p);M=~Z?ie.length-Z:M+ie.length}function Q(){var ie={line:A,column:M};return function(re){return re.position=new j(ie),W(),re}}function j(ie){this.start=ie,this.end={line:A,column:M},this.source=k.source}j.prototype.content=E;function L(ie){var re=new Error(k.source+":"+A+":"+M+": "+ie);if(re.reason=ie,re.filename=k.source,re.line=A,re.column=M,re.source=E,!k.silent)throw re}function $(ie){var re=ie.exec(E);if(re){var Z=re[0];return F(Z),E=E.slice(Z.length),re}}function W(){$(a)}function z(ie){var re;for(ie=ie||[];re=le();)re!==!1&&ie.push(re);return ie}function le(){var ie=Q();if(!(y!=E.charAt(0)||x!=E.charAt(1))){for(var re=2;g!=E.charAt(re)&&(x!=E.charAt(re)||y!=E.charAt(re+1));)++re;if(re+=2,g===E.charAt(re-1))return L("End of comment missing");var Z=E.slice(2,re-2);return M+=2,F(Z),E=E.slice(re),M+=2,ie({type:b,comment:Z})}}function I(){var ie=Q(),re=$(l);if(re){if(le(),!$(o))return L("property missing ':'");var Z=$(u),ce=ie({type:w,property:T(re[0].replace(t,g)),value:Z?T(Z[0].replace(t,g)):g});return $(d),ce}}function ee(){var ie=[];z(ie);for(var re;re=I();)re!==!1&&(ie.push(re),z(ie));return ie}return W(),ee()}function T(E){return E?E.replace(m,g):g}return am=C,am}var d0;function mO(){if(d0)return Ll;d0=1;var t=Ll&&Ll.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.default=a;const r=t(hO());function a(l,o){let u=null;if(!l||typeof l!="string")return u;const d=(0,r.default)(l),m=typeof o=="function";return d.forEach(p=>{if(p.type!=="declaration")return;const{property:y,value:x}=p;m?o(y,x,p):x&&(u=u||{},u[y]=x)}),u}return Ll}var oo={},f0;function pO(){if(f0)return oo;f0=1,Object.defineProperty(oo,"__esModule",{value:!0}),oo.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,a=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(y){return!y||a.test(y)||t.test(y)},d=function(y,x){return x.toUpperCase()},m=function(y,x){return"".concat(x,"-")},p=function(y,x){return x===void 0&&(x={}),u(y)?y:(y=y.toLowerCase(),x.reactCompat?y=y.replace(o,m):y=y.replace(l,m),y.replace(r,d))};return oo.camelCase=p,oo}var uo,h0;function gO(){if(h0)return uo;h0=1;var t=uo&&uo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=t(mO()),a=pO();function l(o,u){var d={};return!o||typeof o!="string"||(0,r.default)(o,function(m,p){m&&p&&(d[(0,a.camelCase)(m,u)]=p)}),d}return l.default=l,uo=l,uo}var yO=gO();const xO=ep(yO),Dw=_w("end"),Dp=_w("start");function _w(t){return r;function r(a){const l=a&&a.position&&a.position[t]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function bO(t){const r=Dp(t),a=Dw(t);if(r&&a)return{start:r,end:a}}function xo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?m0(t.position):"start"in t||"end"in t?m0(t):"line"in t||"column"in t?Ym(t):""}function Ym(t){return p0(t&&t.line)+":"+p0(t&&t.column)}function m0(t){return Ym(t&&t.start)+"-"+Ym(t&&t.end)}function p0(t){return t&&typeof t=="number"?t:1}class gn extends Error{constructor(r,a,l){super(),typeof a=="string"&&(l=a,a=void 0);let o="",u={},d=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof r=="string"?o=r:!u.cause&&r&&(d=!0,o=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof l=="string"){const p=l.indexOf(":");p===-1?u.ruleId=l:(u.source=l.slice(0,p),u.ruleId=l.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.position)}const m=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=m?m.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=m?m.line:void 0,this.name=xo(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gn.prototype.file="";gn.prototype.name="";gn.prototype.reason="";gn.prototype.message="";gn.prototype.stack="";gn.prototype.column=void 0;gn.prototype.line=void 0;gn.prototype.ancestors=void 0;gn.prototype.cause=void 0;gn.prototype.fatal=void 0;gn.prototype.place=void 0;gn.prototype.ruleId=void 0;gn.prototype.source=void 0;const _p={}.hasOwnProperty,vO=new Map,wO=/[A-Z]/g,SO=new Set(["table","tbody","thead","tfoot","tr"]),NO=new Set(["td","th"]),Lw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function CO(t,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=r.filePath||void 0;let l;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=MO(a,r.jsxDEV)}else{if(typeof r.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof r.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=RO(a,r.jsx,r.jsxs)}const o={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:l,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?zp:dO,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Uw(o,t,void 0);return u&&typeof u!="string"?u:o.create(t,o.Fragment,{children:u||void 0},void 0)}function Uw(t,r,a){if(r.type==="element")return kO(t,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return jO(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return TO(t,r,a);if(r.type==="mdxjsEsm")return EO(t,r);if(r.type==="root")return AO(t,r,a);if(r.type==="text")return OO(t,r)}function kO(t,r,a){const l=t.schema;let o=l;r.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=zp,t.schema=o),t.ancestors.push(r);const u=Hw(t,r.tagName,!1),d=zO(t,r);let m=Up(t,r);return SO.has(r.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!tO(p):!0})),qw(t,d,u,r),Lp(d,m),t.ancestors.pop(),t.schema=l,t.create(r,u,d,a)}function jO(t,r){if(r.data&&r.data.estree&&t.evaluater){const l=r.data.estree.body[0];return l.type,t.evaluater.evaluateExpression(l.expression)}To(t,r.position)}function EO(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);To(t,r.position)}function TO(t,r,a){const l=t.schema;let o=l;r.name==="svg"&&l.space==="html"&&(o=zp,t.schema=o),t.ancestors.push(r);const u=r.name===null?t.Fragment:Hw(t,r.name,!0),d=DO(t,r),m=Up(t,r);return qw(t,d,u,r),Lp(d,m),t.ancestors.pop(),t.schema=l,t.create(r,u,d,a)}function AO(t,r,a){const l={};return Lp(l,Up(t,r)),t.create(r,t.Fragment,l,a)}function OO(t,r){return r.value}function qw(t,r,a,l){typeof a!="string"&&a!==t.Fragment&&t.passNode&&(r.node=l)}function Lp(t,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(t.children=a)}}function RO(t,r,a){return l;function l(o,u,d,m){const y=Array.isArray(d.children)?a:r;return m?y(u,d,m):y(u,d)}}function MO(t,r){return a;function a(l,o,u,d){const m=Array.isArray(u.children),p=Dp(l);return r(o,u,d,m,{columnNumber:p?p.column-1:void 0,fileName:t,lineNumber:p?p.line:void 0},void 0)}}function zO(t,r){const a={};let l,o;for(o in r.properties)if(o!=="children"&&_p.call(r.properties,o)){const u=_O(t,o,r.properties[o]);if(u){const[d,m]=u;t.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&NO.has(r.tagName)?l=m:a[d]=m}}if(l){const u=a.style||(a.style={});u[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return a}function DO(t,r){const a={};for(const l of r.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&t.evaluater){const u=l.data.estree.body[0];u.type;const d=u.expression;d.type;const m=d.properties[0];m.type,Object.assign(a,t.evaluater.evaluateExpression(m.argument))}else To(t,r.position);else{const o=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&t.evaluater){const m=l.value.data.estree.body[0];m.type,u=t.evaluater.evaluateExpression(m.expression)}else To(t,r.position);else u=l.value===null?!0:l.value;a[o]=u}return a}function Up(t,r){const a=[];let l=-1;const o=t.passKeys?new Map:vO;for(;++l<r.children.length;){const u=r.children[l];let d;if(t.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const y=o.get(p)||0;d=p+"-"+y,o.set(p,y+1)}}const m=Uw(t,u,d);m!==void 0&&a.push(m)}return a}function _O(t,r,a){const l=oO(t.schema,r);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=l.commaSeparated?$3(a):fO(a)),l.property==="style"){let o=typeof a=="object"?a:LO(t,String(a));return t.stylePropertyNameCase==="css"&&(o=UO(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&l.space?iO[l.property]||l.property:l.attribute,a]}}function LO(t,r){try{return xO(r,{reactCompat:!0})}catch(a){if(t.ignoreInvalidStyle)return{};const l=a,o=new gn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=Lw+"#cannot-parse-style-attribute",o}}function Hw(t,r,a){let l;if(!a)l={type:"Literal",value:r};else if(r.includes(".")){const o=r.split(".");let u=-1,d;for(;++u<o.length;){const m=l0(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:m,computed:!!(u&&m.type==="Literal"),optional:!1}:m}l=d}else l=l0(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(l.type==="Literal"){const o=l.value;return _p.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(l);To(t)}function To(t,r){const a=new gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=Lw+"#cannot-handle-mdx-estrees-without-createevaluater",a}function UO(t){const r={};let a;for(a in t)_p.call(t,a)&&(r[qO(a)]=t[a]);return r}function qO(t){let r=t.replace(wO,HO);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function HO(t){return"-"+t.toLowerCase()}const im={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"]},BO={};function qp(t,r){const a=BO,l=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Bw(t,l,o)}function Bw(t,r,a){if(IO(t)){if("value"in t)return t.type==="html"&&!a?"":t.value;if(r&&"alt"in t&&t.alt)return t.alt;if("children"in t)return g0(t.children,r,a)}return Array.isArray(t)?g0(t,r,a):""}function g0(t,r,a){const l=[];let o=-1;for(;++o<t.length;)l[o]=Bw(t[o],r,a);return l.join("")}function IO(t){return!!(t&&typeof t=="object")}const y0=document.createElement("i");function Hp(t){const r="&"+t+";";y0.innerHTML=r;const a=y0.textContent;return a.charCodeAt(a.length-1)===59&&t!=="semi"||a===r?!1:a}function $n(t,r,a,l){const o=t.length;let u=0,d;if(r<0?r=-r>o?0:o+r:r=r>o?o:r,a=a>0?a:0,l.length<1e4)d=Array.from(l),d.unshift(r,a),t.splice(...d);else for(a&&t.splice(r,a);u<l.length;)d=l.slice(u,u+1e4),d.unshift(r,0),t.splice(...d),u+=1e4,r+=1e4}function ur(t,r){return t.length>0?($n(t,t.length,0,r),t):r}const x0={}.hasOwnProperty;function Iw(t){const r={};let a=-1;for(;++a<t.length;)FO(r,t[a]);return r}function FO(t,r){let a;for(a in r){const o=(x0.call(t,a)?t[a]:void 0)||(t[a]={}),u=r[a];let d;if(u)for(d in u){x0.call(o,d)||(o[d]=[]);const m=u[d];PO(o[d],Array.isArray(m)?m:m?[m]:[])}}}function PO(t,r){let a=-1;const l=[];for(;++a<r.length;)(r[a].add==="after"?t:l).push(r[a]);$n(t,0,0,l)}function Fw(t,r){const a=Number.parseInt(t,r);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Cr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nn=ei(/[A-Za-z]/),pn=ei(/[\dA-Za-z]/),QO=ei(/[#-'*+\--9=?A-Z^-~]/);function qc(t){return t!==null&&(t<32||t===127)}const Vm=ei(/\d/),YO=ei(/[\dA-Fa-f]/),VO=ei(/[!-/:-@[-`{-~]/);function ze(t){return t!==null&&t<-2}function Nt(t){return t!==null&&(t<0||t===32)}function Ze(t){return t===-2||t===-1||t===32}const nd=ei(new RegExp("\\p{P}|\\p{S}","u")),Ii=ei(/\s/);function ei(t){return r;function r(a){return a!==null&&a>-1&&t.test(String.fromCharCode(a))}}function ss(t){const r=[];let a=-1,l=0,o=0;for(;++a<t.length;){const u=t.charCodeAt(a);let d="";if(u===37&&pn(t.charCodeAt(a+1))&&pn(t.charCodeAt(a+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const m=t.charCodeAt(a+1);u<56320&&m>56319&&m<57344?(d=String.fromCharCode(u,m),o=1):d="�"}else d=String.fromCharCode(u);d&&(r.push(t.slice(l,a),encodeURIComponent(d)),l=a+o+1,d=""),o&&(a+=o,o=0)}return r.join("")+t.slice(l)}function it(t,r,a,l){const o=l?l-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(p){return Ze(p)?(t.enter(a),m(p)):r(p)}function m(p){return Ze(p)&&u++<o?(t.consume(p),m):(t.exit(a),r(p))}}const GO={tokenize:KO};function KO(t){const r=t.attempt(this.parser.constructs.contentInitial,l,o);let a;return r;function l(m){if(m===null){t.consume(m);return}return t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),it(t,r,"linePrefix")}function o(m){return t.enter("paragraph"),u(m)}function u(m){const p=t.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=p),a=p,d(m)}function d(m){if(m===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(m);return}return ze(m)?(t.consume(m),t.exit("chunkText"),u):(t.consume(m),d)}}const XO={tokenize:$O},b0={tokenize:ZO};function $O(t){const r=this,a=[];let l=0,o,u,d;return m;function m(M){if(l<a.length){const F=a[l];return r.containerState=F[1],t.attempt(F[0].continuation,p,y)(M)}return y(M)}function p(M){if(l++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&A();const F=r.events.length;let Q=F,j;for(;Q--;)if(r.events[Q][0]==="exit"&&r.events[Q][1].type==="chunkFlow"){j=r.events[Q][1].end;break}k(l);let L=F;for(;L<r.events.length;)r.events[L][1].end={...j},L++;return $n(r.events,Q+1,0,r.events.slice(F)),r.events.length=L,y(M)}return m(M)}function y(M){if(l===a.length){if(!o)return b(M);if(o.currentConstruct&&o.currentConstruct.concrete)return C(M);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(b0,x,g)(M)}function x(M){return o&&A(),k(l),b(M)}function g(M){return r.parser.lazy[r.now().line]=l!==a.length,d=r.now().offset,C(M)}function b(M){return r.containerState={},t.attempt(b0,w,C)(M)}function w(M){return l++,a.push([r.currentConstruct,r.containerState]),b(M)}function C(M){if(M===null){o&&A(),k(0),t.consume(M);return}return o=o||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),T(M)}function T(M){if(M===null){E(t.exit("chunkFlow"),!0),k(0),t.consume(M);return}return ze(M)?(t.consume(M),E(t.exit("chunkFlow")),l=0,r.interrupt=void 0,m):(t.consume(M),T)}function E(M,F){const Q=r.sliceStream(M);if(F&&Q.push(null),M.previous=u,u&&(u.next=M),u=M,o.defineSkip(M.start),o.write(Q),r.parser.lazy[M.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<d&&(!o.events[j][1].end||o.events[j][1].end.offset>d))return;const L=r.events.length;let $=L,W,z;for(;$--;)if(r.events[$][0]==="exit"&&r.events[$][1].type==="chunkFlow"){if(W){z=r.events[$][1].end;break}W=!0}for(k(l),j=L;j<r.events.length;)r.events[j][1].end={...z},j++;$n(r.events,$+1,0,r.events.slice(L)),r.events.length=j}}function k(M){let F=a.length;for(;F-- >M;){const Q=a[F];r.containerState=Q[1],Q[0].exit.call(r,t)}a.length=M}function A(){o.write([null]),u=void 0,o=void 0,r.containerState._closeFlow=void 0}}function ZO(t,r,a){return it(t,t.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ns(t){if(t===null||Nt(t)||Ii(t))return 1;if(nd(t))return 2}function rd(t,r,a){const l=[];let o=-1;for(;++o<t.length;){const u=t[o].resolveAll;u&&!l.includes(u)&&(r=u(r,a),l.push(u))}return r}const Gm={name:"attention",resolveAll:JO,tokenize:WO};function JO(t,r){let a=-1,l,o,u,d,m,p,y,x;for(;++a<t.length;)if(t[a][0]==="enter"&&t[a][1].type==="attentionSequence"&&t[a][1]._close){for(l=a;l--;)if(t[l][0]==="exit"&&t[l][1].type==="attentionSequence"&&t[l][1]._open&&r.sliceSerialize(t[l][1]).charCodeAt(0)===r.sliceSerialize(t[a][1]).charCodeAt(0)){if((t[l][1]._close||t[a][1]._open)&&(t[a][1].end.offset-t[a][1].start.offset)%3&&!((t[l][1].end.offset-t[l][1].start.offset+t[a][1].end.offset-t[a][1].start.offset)%3))continue;p=t[l][1].end.offset-t[l][1].start.offset>1&&t[a][1].end.offset-t[a][1].start.offset>1?2:1;const g={...t[l][1].end},b={...t[a][1].start};v0(g,-p),v0(b,p),d={type:p>1?"strongSequence":"emphasisSequence",start:g,end:{...t[l][1].end}},m={type:p>1?"strongSequence":"emphasisSequence",start:{...t[a][1].start},end:b},u={type:p>1?"strongText":"emphasisText",start:{...t[l][1].end},end:{...t[a][1].start}},o={type:p>1?"strong":"emphasis",start:{...d.start},end:{...m.end}},t[l][1].end={...d.start},t[a][1].start={...m.end},y=[],t[l][1].end.offset-t[l][1].start.offset&&(y=ur(y,[["enter",t[l][1],r],["exit",t[l][1],r]])),y=ur(y,[["enter",o,r],["enter",d,r],["exit",d,r],["enter",u,r]]),y=ur(y,rd(r.parser.constructs.insideSpan.null,t.slice(l+1,a),r)),y=ur(y,[["exit",u,r],["enter",m,r],["exit",m,r],["exit",o,r]]),t[a][1].end.offset-t[a][1].start.offset?(x=2,y=ur(y,[["enter",t[a][1],r],["exit",t[a][1],r]])):x=0,$n(t,l-1,a-l+3,y),a=l+y.length-x-2;break}}for(a=-1;++a<t.length;)t[a][1].type==="attentionSequence"&&(t[a][1].type="data");return t}function WO(t,r){const a=this.parser.constructs.attentionMarkers.null,l=this.previous,o=ns(l);let u;return d;function d(p){return u=p,t.enter("attentionSequence"),m(p)}function m(p){if(p===u)return t.consume(p),m;const y=t.exit("attentionSequence"),x=ns(p),g=!x||x===2&&o||a.includes(p),b=!o||o===2&&x||a.includes(l);return y._open=!!(u===42?g:g&&(o||!b)),y._close=!!(u===42?b:b&&(x||!g)),r(p)}}function v0(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const e4={name:"autolink",tokenize:t4};function t4(t,r,a){let l=0;return o;function o(w){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(w),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),u}function u(w){return Nn(w)?(t.consume(w),d):w===64?a(w):y(w)}function d(w){return w===43||w===45||w===46||pn(w)?(l=1,m(w)):y(w)}function m(w){return w===58?(t.consume(w),l=0,p):(w===43||w===45||w===46||pn(w))&&l++<32?(t.consume(w),m):(l=0,y(w))}function p(w){return w===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(w),t.exit("autolinkMarker"),t.exit("autolink"),r):w===null||w===32||w===60||qc(w)?a(w):(t.consume(w),p)}function y(w){return w===64?(t.consume(w),x):QO(w)?(t.consume(w),y):a(w)}function x(w){return pn(w)?g(w):a(w)}function g(w){return w===46?(t.consume(w),l=0,x):w===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(w),t.exit("autolinkMarker"),t.exit("autolink"),r):b(w)}function b(w){if((w===45||pn(w))&&l++<63){const C=w===45?b:g;return t.consume(w),C}return a(w)}}const Go={partial:!0,tokenize:n4};function n4(t,r,a){return l;function l(u){return Ze(u)?it(t,o,"linePrefix")(u):o(u)}function o(u){return u===null||ze(u)?r(u):a(u)}}const Pw={continuation:{tokenize:a4},exit:i4,name:"blockQuote",tokenize:r4};function r4(t,r,a){const l=this;return o;function o(d){if(d===62){const m=l.containerState;return m.open||(t.enter("blockQuote",{_container:!0}),m.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(d),t.exit("blockQuoteMarker"),u}return a(d)}function u(d){return Ze(d)?(t.enter("blockQuotePrefixWhitespace"),t.consume(d),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),r):(t.exit("blockQuotePrefix"),r(d))}}function a4(t,r,a){const l=this;return o;function o(d){return Ze(d)?it(t,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return t.attempt(Pw,r,a)(d)}}function i4(t){t.exit("blockQuote")}const Qw={name:"characterEscape",tokenize:l4};function l4(t,r,a){return l;function l(u){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(u),t.exit("escapeMarker"),o}function o(u){return VO(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):a(u)}}const Yw={name:"characterReference",tokenize:s4};function s4(t,r,a){const l=this;let o=0,u,d;return m;function m(g){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),p}function p(g){return g===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(g),t.exit("characterReferenceMarkerNumeric"),y):(t.enter("characterReferenceValue"),u=31,d=pn,x(g))}function y(g){return g===88||g===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(g),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),u=6,d=YO,x):(t.enter("characterReferenceValue"),u=7,d=Vm,x(g))}function x(g){if(g===59&&o){const b=t.exit("characterReferenceValue");return d===pn&&!Hp(l.sliceSerialize(b))?a(g):(t.enter("characterReferenceMarker"),t.consume(g),t.exit("characterReferenceMarker"),t.exit("characterReference"),r)}return d(g)&&o++<u?(t.consume(g),x):a(g)}}const w0={partial:!0,tokenize:u4},S0={concrete:!0,name:"codeFenced",tokenize:o4};function o4(t,r,a){const l=this,o={partial:!0,tokenize:Q};let u=0,d=0,m;return p;function p(j){return y(j)}function y(j){const L=l.events[l.events.length-1];return u=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,m=j,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),x(j)}function x(j){return j===m?(d++,t.consume(j),x):d<3?a(j):(t.exit("codeFencedFenceSequence"),Ze(j)?it(t,g,"whitespace")(j):g(j))}function g(j){return j===null||ze(j)?(t.exit("codeFencedFence"),l.interrupt?r(j):t.check(w0,T,F)(j)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(j))}function b(j){return j===null||ze(j)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(j)):Ze(j)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),it(t,w,"whitespace")(j)):j===96&&j===m?a(j):(t.consume(j),b)}function w(j){return j===null||ze(j)?g(j):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),C(j))}function C(j){return j===null||ze(j)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(j)):j===96&&j===m?a(j):(t.consume(j),C)}function T(j){return t.attempt(o,F,E)(j)}function E(j){return t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),k}function k(j){return u>0&&Ze(j)?it(t,A,"linePrefix",u+1)(j):A(j)}function A(j){return j===null||ze(j)?t.check(w0,T,F)(j):(t.enter("codeFlowValue"),M(j))}function M(j){return j===null||ze(j)?(t.exit("codeFlowValue"),A(j)):(t.consume(j),M)}function F(j){return t.exit("codeFenced"),r(j)}function Q(j,L,$){let W=0;return z;function z(re){return j.enter("lineEnding"),j.consume(re),j.exit("lineEnding"),le}function le(re){return j.enter("codeFencedFence"),Ze(re)?it(j,I,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(re):I(re)}function I(re){return re===m?(j.enter("codeFencedFenceSequence"),ee(re)):$(re)}function ee(re){return re===m?(W++,j.consume(re),ee):W>=d?(j.exit("codeFencedFenceSequence"),Ze(re)?it(j,ie,"whitespace")(re):ie(re)):$(re)}function ie(re){return re===null||ze(re)?(j.exit("codeFencedFence"),L(re)):$(re)}}}function u4(t,r,a){const l=this;return o;function o(d){return d===null?a(d):(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u)}function u(d){return l.parser.lazy[l.now().line]?a(d):r(d)}}const lm={name:"codeIndented",tokenize:d4},c4={partial:!0,tokenize:f4};function d4(t,r,a){const l=this;return o;function o(y){return t.enter("codeIndented"),it(t,u,"linePrefix",5)(y)}function u(y){const x=l.events[l.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?d(y):a(y)}function d(y){return y===null?p(y):ze(y)?t.attempt(c4,d,p)(y):(t.enter("codeFlowValue"),m(y))}function m(y){return y===null||ze(y)?(t.exit("codeFlowValue"),d(y)):(t.consume(y),m)}function p(y){return t.exit("codeIndented"),r(y)}}function f4(t,r,a){const l=this;return o;function o(d){return l.parser.lazy[l.now().line]?a(d):ze(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),o):it(t,u,"linePrefix",5)(d)}function u(d){const m=l.events[l.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?r(d):ze(d)?o(d):a(d)}}const h4={name:"codeText",previous:p4,resolve:m4,tokenize:g4};function m4(t){let r=t.length-4,a=3,l,o;if((t[a][1].type==="lineEnding"||t[a][1].type==="space")&&(t[r][1].type==="lineEnding"||t[r][1].type==="space")){for(l=a;++l<r;)if(t[l][1].type==="codeTextData"){t[a][1].type="codeTextPadding",t[r][1].type="codeTextPadding",a+=2,r-=2;break}}for(l=a-1,r++;++l<=r;)o===void 0?l!==r&&t[l][1].type!=="lineEnding"&&(o=l):(l===r||t[l][1].type==="lineEnding")&&(t[o][1].type="codeTextData",l!==o+2&&(t[o][1].end=t[l-1][1].end,t.splice(o+2,l-o-2),r-=l-o-2,l=o+2),o=void 0);return t}function p4(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function g4(t,r,a){let l=0,o,u;return d;function d(g){return t.enter("codeText"),t.enter("codeTextSequence"),m(g)}function m(g){return g===96?(t.consume(g),l++,m):(t.exit("codeTextSequence"),p(g))}function p(g){return g===null?a(g):g===32?(t.enter("space"),t.consume(g),t.exit("space"),p):g===96?(u=t.enter("codeTextSequence"),o=0,x(g)):ze(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),p):(t.enter("codeTextData"),y(g))}function y(g){return g===null||g===32||g===96||ze(g)?(t.exit("codeTextData"),p(g)):(t.consume(g),y)}function x(g){return g===96?(t.consume(g),o++,x):o===l?(t.exit("codeTextSequence"),t.exit("codeText"),r(g)):(u.type="codeTextData",y(g))}}class y4{constructor(r){this.left=r?[...r]:[],this.right=[]}get(r){if(r<0||r>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+r+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return r<this.left.length?this.left[r]:this.right[this.right.length-r+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(r,a){const l=a??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(r,l):r>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(r,a,l){const o=a||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&co(this.left,l),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(r){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(r)}pushMany(r){this.setCursor(Number.POSITIVE_INFINITY),co(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),co(this.right,r.reverse())}setCursor(r){if(!(r===this.left.length||r>this.left.length&&this.right.length===0||r<0&&this.left.length===0))if(r<this.left.length){const a=this.left.splice(r,Number.POSITIVE_INFINITY);co(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);co(this.left,a.reverse())}}}function co(t,r){let a=0;if(r.length<1e4)t.push(...r);else for(;a<r.length;)t.push(...r.slice(a,a+1e4)),a+=1e4}function Vw(t){const r={};let a=-1,l,o,u,d,m,p,y;const x=new y4(t);for(;++a<x.length;){for(;a in r;)a=r[a];if(l=x.get(a),a&&l[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(p=l[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(r,x4(x,a)),a=r[a],y=!0);else if(l[1]._container){for(u=a,o=void 0;u--;)if(d=x.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(x.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(l[1].end={...x.get(o)[1].start},m=x.slice(o,a),m.unshift(l),x.splice(o,a-o+1,m))}}return $n(t,0,Number.POSITIVE_INFINITY,x.slice(0)),!y}function x4(t,r){const a=t.get(r)[1],l=t.get(r)[2];let o=r-1;const u=[];let d=a._tokenizer;d||(d=l.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const m=d.events,p=[],y={};let x,g,b=-1,w=a,C=0,T=0;const E=[T];for(;w;){for(;t.get(++o)[1]!==w;);u.push(o),w._tokenizer||(x=l.sliceStream(w),w.next||x.push(null),g&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),g=w,w=w.next}for(w=a;++b<m.length;)m[b][0]==="exit"&&m[b-1][0]==="enter"&&m[b][1].type===m[b-1][1].type&&m[b][1].start.line!==m[b][1].end.line&&(T=b+1,E.push(T),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(d.events=[],w?(w._tokenizer=void 0,w.previous=void 0):E.pop(),b=E.length;b--;){const k=m.slice(E[b],E[b+1]),A=u.pop();p.push([A,A+k.length-1]),t.splice(A,2,k)}for(p.reverse(),b=-1;++b<p.length;)y[C+p[b][0]]=C+p[b][1],C+=p[b][1]-p[b][0]-1;return y}const b4={resolve:w4,tokenize:S4},v4={partial:!0,tokenize:N4};function w4(t){return Vw(t),t}function S4(t,r){let a;return l;function l(m){return t.enter("content"),a=t.enter("chunkContent",{contentType:"content"}),o(m)}function o(m){return m===null?u(m):ze(m)?t.check(v4,d,u)(m):(t.consume(m),o)}function u(m){return t.exit("chunkContent"),t.exit("content"),r(m)}function d(m){return t.consume(m),t.exit("chunkContent"),a.next=t.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function N4(t,r,a){const l=this;return o;function o(d){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),it(t,u,"linePrefix")}function u(d){if(d===null||ze(d))return a(d);const m=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?r(d):t.interrupt(l.parser.constructs.flow,a,r)(d)}}function Gw(t,r,a,l,o,u,d,m,p){const y=p||Number.POSITIVE_INFINITY;let x=0;return g;function g(k){return k===60?(t.enter(l),t.enter(o),t.enter(u),t.consume(k),t.exit(u),b):k===null||k===32||k===41||qc(k)?a(k):(t.enter(l),t.enter(d),t.enter(m),t.enter("chunkString",{contentType:"string"}),T(k))}function b(k){return k===62?(t.enter(u),t.consume(k),t.exit(u),t.exit(o),t.exit(l),r):(t.enter(m),t.enter("chunkString",{contentType:"string"}),w(k))}function w(k){return k===62?(t.exit("chunkString"),t.exit(m),b(k)):k===null||k===60||ze(k)?a(k):(t.consume(k),k===92?C:w)}function C(k){return k===60||k===62||k===92?(t.consume(k),w):w(k)}function T(k){return!x&&(k===null||k===41||Nt(k))?(t.exit("chunkString"),t.exit(m),t.exit(d),t.exit(l),r(k)):x<y&&k===40?(t.consume(k),x++,T):k===41?(t.consume(k),x--,T):k===null||k===32||k===40||qc(k)?a(k):(t.consume(k),k===92?E:T)}function E(k){return k===40||k===41||k===92?(t.consume(k),T):T(k)}}function Kw(t,r,a,l,o,u){const d=this;let m=0,p;return y;function y(w){return t.enter(l),t.enter(o),t.consume(w),t.exit(o),t.enter(u),x}function x(w){return m>999||w===null||w===91||w===93&&!p||w===94&&!m&&"_hiddenFootnoteSupport"in d.parser.constructs?a(w):w===93?(t.exit(u),t.enter(o),t.consume(w),t.exit(o),t.exit(l),r):ze(w)?(t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),x):(t.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||w===91||w===93||ze(w)||m++>999?(t.exit("chunkString"),x(w)):(t.consume(w),p||(p=!Ze(w)),w===92?b:g)}function b(w){return w===91||w===92||w===93?(t.consume(w),m++,g):g(w)}}function Xw(t,r,a,l,o,u){let d;return m;function m(b){return b===34||b===39||b===40?(t.enter(l),t.enter(o),t.consume(b),t.exit(o),d=b===40?41:b,p):a(b)}function p(b){return b===d?(t.enter(o),t.consume(b),t.exit(o),t.exit(l),r):(t.enter(u),y(b))}function y(b){return b===d?(t.exit(u),p(d)):b===null?a(b):ze(b)?(t.enter("lineEnding"),t.consume(b),t.exit("lineEnding"),it(t,y,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===d||b===null||ze(b)?(t.exit("chunkString"),y(b)):(t.consume(b),b===92?g:x)}function g(b){return b===d||b===92?(t.consume(b),x):x(b)}}function bo(t,r){let a;return l;function l(o){return ze(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),a=!0,l):Ze(o)?it(t,l,a?"linePrefix":"lineSuffix")(o):r(o)}}const C4={name:"definition",tokenize:j4},k4={partial:!0,tokenize:E4};function j4(t,r,a){const l=this;let o;return u;function u(w){return t.enter("definition"),d(w)}function d(w){return Kw.call(l,t,m,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function m(w){return o=Cr(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),w===58?(t.enter("definitionMarker"),t.consume(w),t.exit("definitionMarker"),p):a(w)}function p(w){return Nt(w)?bo(t,y)(w):y(w)}function y(w){return Gw(t,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function x(w){return t.attempt(k4,g,g)(w)}function g(w){return Ze(w)?it(t,b,"whitespace")(w):b(w)}function b(w){return w===null||ze(w)?(t.exit("definition"),l.parser.defined.push(o),r(w)):a(w)}}function E4(t,r,a){return l;function l(m){return Nt(m)?bo(t,o)(m):a(m)}function o(m){return Xw(t,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return Ze(m)?it(t,d,"whitespace")(m):d(m)}function d(m){return m===null||ze(m)?r(m):a(m)}}const T4={name:"hardBreakEscape",tokenize:A4};function A4(t,r,a){return l;function l(u){return t.enter("hardBreakEscape"),t.consume(u),o}function o(u){return ze(u)?(t.exit("hardBreakEscape"),r(u)):a(u)}}const O4={name:"headingAtx",resolve:R4,tokenize:M4};function R4(t,r){let a=t.length-2,l=3,o,u;return t[l][1].type==="whitespace"&&(l+=2),a-2>l&&t[a][1].type==="whitespace"&&(a-=2),t[a][1].type==="atxHeadingSequence"&&(l===a-1||a-4>l&&t[a-2][1].type==="whitespace")&&(a-=l+1===a?2:4),a>l&&(o={type:"atxHeadingText",start:t[l][1].start,end:t[a][1].end},u={type:"chunkText",start:t[l][1].start,end:t[a][1].end,contentType:"text"},$n(t,l,a-l+1,[["enter",o,r],["enter",u,r],["exit",u,r],["exit",o,r]])),t}function M4(t,r,a){let l=0;return o;function o(x){return t.enter("atxHeading"),u(x)}function u(x){return t.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&l++<6?(t.consume(x),d):x===null||Nt(x)?(t.exit("atxHeadingSequence"),m(x)):a(x)}function m(x){return x===35?(t.enter("atxHeadingSequence"),p(x)):x===null||ze(x)?(t.exit("atxHeading"),r(x)):Ze(x)?it(t,m,"whitespace")(x):(t.enter("atxHeadingText"),y(x))}function p(x){return x===35?(t.consume(x),p):(t.exit("atxHeadingSequence"),m(x))}function y(x){return x===null||x===35||Nt(x)?(t.exit("atxHeadingText"),m(x)):(t.consume(x),y)}}const z4=["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"],N0=["pre","script","style","textarea"],D4={concrete:!0,name:"htmlFlow",resolveTo:U4,tokenize:q4},_4={partial:!0,tokenize:B4},L4={partial:!0,tokenize:H4};function U4(t){let r=t.length;for(;r--&&!(t[r][0]==="enter"&&t[r][1].type==="htmlFlow"););return r>1&&t[r-2][1].type==="linePrefix"&&(t[r][1].start=t[r-2][1].start,t[r+1][1].start=t[r-2][1].start,t.splice(r-2,2)),t}function q4(t,r,a){const l=this;let o,u,d,m,p;return y;function y(_){return x(_)}function x(_){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(_),g}function g(_){return _===33?(t.consume(_),b):_===47?(t.consume(_),u=!0,T):_===63?(t.consume(_),o=3,l.interrupt?r:O):Nn(_)?(t.consume(_),d=String.fromCharCode(_),E):a(_)}function b(_){return _===45?(t.consume(_),o=2,w):_===91?(t.consume(_),o=5,m=0,C):Nn(_)?(t.consume(_),o=4,l.interrupt?r:O):a(_)}function w(_){return _===45?(t.consume(_),l.interrupt?r:O):a(_)}function C(_){const D="CDATA[";return _===D.charCodeAt(m++)?(t.consume(_),m===D.length?l.interrupt?r:I:C):a(_)}function T(_){return Nn(_)?(t.consume(_),d=String.fromCharCode(_),E):a(_)}function E(_){if(_===null||_===47||_===62||Nt(_)){const D=_===47,ae=d.toLowerCase();return!D&&!u&&N0.includes(ae)?(o=1,l.interrupt?r(_):I(_)):z4.includes(d.toLowerCase())?(o=6,D?(t.consume(_),k):l.interrupt?r(_):I(_)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?a(_):u?A(_):M(_))}return _===45||pn(_)?(t.consume(_),d+=String.fromCharCode(_),E):a(_)}function k(_){return _===62?(t.consume(_),l.interrupt?r:I):a(_)}function A(_){return Ze(_)?(t.consume(_),A):z(_)}function M(_){return _===47?(t.consume(_),z):_===58||_===95||Nn(_)?(t.consume(_),F):Ze(_)?(t.consume(_),M):z(_)}function F(_){return _===45||_===46||_===58||_===95||pn(_)?(t.consume(_),F):Q(_)}function Q(_){return _===61?(t.consume(_),j):Ze(_)?(t.consume(_),Q):M(_)}function j(_){return _===null||_===60||_===61||_===62||_===96?a(_):_===34||_===39?(t.consume(_),p=_,L):Ze(_)?(t.consume(_),j):$(_)}function L(_){return _===p?(t.consume(_),p=null,W):_===null||ze(_)?a(_):(t.consume(_),L)}function $(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Nt(_)?Q(_):(t.consume(_),$)}function W(_){return _===47||_===62||Ze(_)?M(_):a(_)}function z(_){return _===62?(t.consume(_),le):a(_)}function le(_){return _===null||ze(_)?I(_):Ze(_)?(t.consume(_),le):a(_)}function I(_){return _===45&&o===2?(t.consume(_),Z):_===60&&o===1?(t.consume(_),ce):_===62&&o===4?(t.consume(_),Be):_===63&&o===3?(t.consume(_),O):_===93&&o===5?(t.consume(_),Re):ze(_)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(_4,lt,ee)(_)):_===null||ze(_)?(t.exit("htmlFlowData"),ee(_)):(t.consume(_),I)}function ee(_){return t.check(L4,ie,lt)(_)}function ie(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),re}function re(_){return _===null||ze(_)?ee(_):(t.enter("htmlFlowData"),I(_))}function Z(_){return _===45?(t.consume(_),O):I(_)}function ce(_){return _===47?(t.consume(_),d="",me):I(_)}function me(_){if(_===62){const D=d.toLowerCase();return N0.includes(D)?(t.consume(_),Be):I(_)}return Nn(_)&&d.length<8?(t.consume(_),d+=String.fromCharCode(_),me):I(_)}function Re(_){return _===93?(t.consume(_),O):I(_)}function O(_){return _===62?(t.consume(_),Be):_===45&&o===2?(t.consume(_),O):I(_)}function Be(_){return _===null||ze(_)?(t.exit("htmlFlowData"),lt(_)):(t.consume(_),Be)}function lt(_){return t.exit("htmlFlow"),r(_)}}function H4(t,r,a){const l=this;return o;function o(d){return ze(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u):a(d)}function u(d){return l.parser.lazy[l.now().line]?a(d):r(d)}}function B4(t,r,a){return l;function l(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Go,r,a)}}const I4={name:"htmlText",tokenize:F4};function F4(t,r,a){const l=this;let o,u,d;return m;function m(O){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(O),p}function p(O){return O===33?(t.consume(O),y):O===47?(t.consume(O),Q):O===63?(t.consume(O),M):Nn(O)?(t.consume(O),$):a(O)}function y(O){return O===45?(t.consume(O),x):O===91?(t.consume(O),u=0,C):Nn(O)?(t.consume(O),A):a(O)}function x(O){return O===45?(t.consume(O),w):a(O)}function g(O){return O===null?a(O):O===45?(t.consume(O),b):ze(O)?(d=g,ce(O)):(t.consume(O),g)}function b(O){return O===45?(t.consume(O),w):g(O)}function w(O){return O===62?Z(O):O===45?b(O):g(O)}function C(O){const Be="CDATA[";return O===Be.charCodeAt(u++)?(t.consume(O),u===Be.length?T:C):a(O)}function T(O){return O===null?a(O):O===93?(t.consume(O),E):ze(O)?(d=T,ce(O)):(t.consume(O),T)}function E(O){return O===93?(t.consume(O),k):T(O)}function k(O){return O===62?Z(O):O===93?(t.consume(O),k):T(O)}function A(O){return O===null||O===62?Z(O):ze(O)?(d=A,ce(O)):(t.consume(O),A)}function M(O){return O===null?a(O):O===63?(t.consume(O),F):ze(O)?(d=M,ce(O)):(t.consume(O),M)}function F(O){return O===62?Z(O):M(O)}function Q(O){return Nn(O)?(t.consume(O),j):a(O)}function j(O){return O===45||pn(O)?(t.consume(O),j):L(O)}function L(O){return ze(O)?(d=L,ce(O)):Ze(O)?(t.consume(O),L):Z(O)}function $(O){return O===45||pn(O)?(t.consume(O),$):O===47||O===62||Nt(O)?W(O):a(O)}function W(O){return O===47?(t.consume(O),Z):O===58||O===95||Nn(O)?(t.consume(O),z):ze(O)?(d=W,ce(O)):Ze(O)?(t.consume(O),W):Z(O)}function z(O){return O===45||O===46||O===58||O===95||pn(O)?(t.consume(O),z):le(O)}function le(O){return O===61?(t.consume(O),I):ze(O)?(d=le,ce(O)):Ze(O)?(t.consume(O),le):W(O)}function I(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(t.consume(O),o=O,ee):ze(O)?(d=I,ce(O)):Ze(O)?(t.consume(O),I):(t.consume(O),ie)}function ee(O){return O===o?(t.consume(O),o=void 0,re):O===null?a(O):ze(O)?(d=ee,ce(O)):(t.consume(O),ee)}function ie(O){return O===null||O===34||O===39||O===60||O===61||O===96?a(O):O===47||O===62||Nt(O)?W(O):(t.consume(O),ie)}function re(O){return O===47||O===62||Nt(O)?W(O):a(O)}function Z(O){return O===62?(t.consume(O),t.exit("htmlTextData"),t.exit("htmlText"),r):a(O)}function ce(O){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),me}function me(O){return Ze(O)?it(t,Re,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):Re(O)}function Re(O){return t.enter("htmlTextData"),d(O)}}const Bp={name:"labelEnd",resolveAll:V4,resolveTo:G4,tokenize:K4},P4={tokenize:X4},Q4={tokenize:$4},Y4={tokenize:Z4};function V4(t){let r=-1;const a=[];for(;++r<t.length;){const l=t[r][1];if(a.push(t[r]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",r+=o}}return t.length!==a.length&&$n(t,0,t.length,a),t}function G4(t,r){let a=t.length,l=0,o,u,d,m;for(;a--;)if(o=t[a][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;t[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(t[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=a,o.type!=="labelLink")){l=2;break}}else o.type==="labelEnd"&&(d=a);const p={type:t[u][1].type==="labelLink"?"link":"image",start:{...t[u][1].start},end:{...t[t.length-1][1].end}},y={type:"label",start:{...t[u][1].start},end:{...t[d][1].end}},x={type:"labelText",start:{...t[u+l+2][1].end},end:{...t[d-2][1].start}};return m=[["enter",p,r],["enter",y,r]],m=ur(m,t.slice(u+1,u+l+3)),m=ur(m,[["enter",x,r]]),m=ur(m,rd(r.parser.constructs.insideSpan.null,t.slice(u+l+4,d-3),r)),m=ur(m,[["exit",x,r],t[d-2],t[d-1],["exit",y,r]]),m=ur(m,t.slice(d+1)),m=ur(m,[["exit",p,r]]),$n(t,u,t.length,m),t}function K4(t,r,a){const l=this;let o=l.events.length,u,d;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){u=l.events[o][1];break}return m;function m(b){return u?u._inactive?g(b):(d=l.parser.defined.includes(Cr(l.sliceSerialize({start:u.end,end:l.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(b),t.exit("labelMarker"),t.exit("labelEnd"),p):a(b)}function p(b){return b===40?t.attempt(P4,x,d?x:g)(b):b===91?t.attempt(Q4,x,d?y:g)(b):d?x(b):g(b)}function y(b){return t.attempt(Y4,x,g)(b)}function x(b){return r(b)}function g(b){return u._balanced=!0,a(b)}}function X4(t,r,a){return l;function l(g){return t.enter("resource"),t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),o}function o(g){return Nt(g)?bo(t,u)(g):u(g)}function u(g){return g===41?x(g):Gw(t,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function d(g){return Nt(g)?bo(t,p)(g):x(g)}function m(g){return a(g)}function p(g){return g===34||g===39||g===40?Xw(t,y,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):x(g)}function y(g){return Nt(g)?bo(t,x)(g):x(g)}function x(g){return g===41?(t.enter("resourceMarker"),t.consume(g),t.exit("resourceMarker"),t.exit("resource"),r):a(g)}}function $4(t,r,a){const l=this;return o;function o(m){return Kw.call(l,t,u,d,"reference","referenceMarker","referenceString")(m)}function u(m){return l.parser.defined.includes(Cr(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?r(m):a(m)}function d(m){return a(m)}}function Z4(t,r,a){return l;function l(u){return t.enter("reference"),t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),o}function o(u){return u===93?(t.enter("referenceMarker"),t.consume(u),t.exit("referenceMarker"),t.exit("reference"),r):a(u)}}const J4={name:"labelStartImage",resolveAll:Bp.resolveAll,tokenize:W4};function W4(t,r,a){const l=this;return o;function o(m){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(m),t.exit("labelImageMarker"),u}function u(m){return m===91?(t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelImage"),d):a(m)}function d(m){return m===94&&"_hiddenFootnoteSupport"in l.parser.constructs?a(m):r(m)}}const eR={name:"labelStartLink",resolveAll:Bp.resolveAll,tokenize:tR};function tR(t,r,a){const l=this;return o;function o(d){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(d),t.exit("labelMarker"),t.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?a(d):r(d)}}const sm={name:"lineEnding",tokenize:nR};function nR(t,r){return a;function a(l){return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),it(t,r,"linePrefix")}}const Dc={name:"thematicBreak",tokenize:rR};function rR(t,r,a){let l=0,o;return u;function u(y){return t.enter("thematicBreak"),d(y)}function d(y){return o=y,m(y)}function m(y){return y===o?(t.enter("thematicBreakSequence"),p(y)):l>=3&&(y===null||ze(y))?(t.exit("thematicBreak"),r(y)):a(y)}function p(y){return y===o?(t.consume(y),l++,p):(t.exit("thematicBreakSequence"),Ze(y)?it(t,m,"whitespace")(y):m(y))}}const zn={continuation:{tokenize:sR},exit:uR,name:"list",tokenize:lR},aR={partial:!0,tokenize:cR},iR={partial:!0,tokenize:oR};function lR(t,r,a){const l=this,o=l.events[l.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return m;function m(w){const C=l.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!l.containerState.marker||w===l.containerState.marker:Vm(w)){if(l.containerState.type||(l.containerState.type=C,t.enter(C,{_container:!0})),C==="listUnordered")return t.enter("listItemPrefix"),w===42||w===45?t.check(Dc,a,y)(w):y(w);if(!l.interrupt||w===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),p(w)}return a(w)}function p(w){return Vm(w)&&++d<10?(t.consume(w),p):(!l.interrupt||d<2)&&(l.containerState.marker?w===l.containerState.marker:w===41||w===46)?(t.exit("listItemValue"),y(w)):a(w)}function y(w){return t.enter("listItemMarker"),t.consume(w),t.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||w,t.check(Go,l.interrupt?a:x,t.attempt(aR,b,g))}function x(w){return l.containerState.initialBlankLine=!0,u++,b(w)}function g(w){return Ze(w)?(t.enter("listItemPrefixWhitespace"),t.consume(w),t.exit("listItemPrefixWhitespace"),b):a(w)}function b(w){return l.containerState.size=u+l.sliceSerialize(t.exit("listItemPrefix"),!0).length,r(w)}}function sR(t,r,a){const l=this;return l.containerState._closeFlow=void 0,t.check(Go,o,u);function o(m){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,it(t,r,"listItemIndent",l.containerState.size+1)(m)}function u(m){return l.containerState.furtherBlankLines||!Ze(m)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(m)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,t.attempt(iR,r,d)(m))}function d(m){return l.containerState._closeFlow=!0,l.interrupt=void 0,it(t,t.attempt(zn,r,a),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function oR(t,r,a){const l=this;return it(t,o,"listItemIndent",l.containerState.size+1);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?r(u):a(u)}}function uR(t){t.exit(this.containerState.type)}function cR(t,r,a){const l=this;return it(t,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=l.events[l.events.length-1];return!Ze(u)&&d&&d[1].type==="listItemPrefixWhitespace"?r(u):a(u)}}const C0={name:"setextUnderline",resolveTo:dR,tokenize:fR};function dR(t,r){let a=t.length,l,o,u;for(;a--;)if(t[a][0]==="enter"){if(t[a][1].type==="content"){l=a;break}t[a][1].type==="paragraph"&&(o=a)}else t[a][1].type==="content"&&t.splice(a,1),!u&&t[a][1].type==="definition"&&(u=a);const d={type:"setextHeading",start:{...t[l][1].start},end:{...t[t.length-1][1].end}};return t[o][1].type="setextHeadingText",u?(t.splice(o,0,["enter",d,r]),t.splice(u+1,0,["exit",t[l][1],r]),t[l][1].end={...t[u][1].end}):t[l][1]=d,t.push(["exit",d,r]),t}function fR(t,r,a){const l=this;let o;return u;function u(y){let x=l.events.length,g;for(;x--;)if(l.events[x][1].type!=="lineEnding"&&l.events[x][1].type!=="linePrefix"&&l.events[x][1].type!=="content"){g=l.events[x][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||g)?(t.enter("setextHeadingLine"),o=y,d(y)):a(y)}function d(y){return t.enter("setextHeadingLineSequence"),m(y)}function m(y){return y===o?(t.consume(y),m):(t.exit("setextHeadingLineSequence"),Ze(y)?it(t,p,"lineSuffix")(y):p(y))}function p(y){return y===null||ze(y)?(t.exit("setextHeadingLine"),r(y)):a(y)}}const hR={tokenize:mR};function mR(t){const r=this,a=t.attempt(Go,l,t.attempt(this.parser.constructs.flowInitial,o,it(t,t.attempt(this.parser.constructs.flow,o,t.attempt(b4,o)),"linePrefix")));return a;function l(u){if(u===null){t.consume(u);return}return t.enter("lineEndingBlank"),t.consume(u),t.exit("lineEndingBlank"),r.currentConstruct=void 0,a}function o(u){if(u===null){t.consume(u);return}return t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),r.currentConstruct=void 0,a}}const pR={resolveAll:Zw()},gR=$w("string"),yR=$w("text");function $w(t){return{resolveAll:Zw(t==="text"?xR:void 0),tokenize:r};function r(a){const l=this,o=this.parser.constructs[t],u=a.attempt(o,d,m);return d;function d(x){return y(x)?u(x):m(x)}function m(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),p}function p(x){return y(x)?(a.exit("data"),u(x)):(a.consume(x),p)}function y(x){if(x===null)return!0;const g=o[x];let b=-1;if(g)for(;++b<g.length;){const w=g[b];if(!w.previous||w.previous.call(l,l.previous))return!0}return!1}}}function Zw(t){return r;function r(a,l){let o=-1,u;for(;++o<=a.length;)u===void 0?a[o]&&a[o][1].type==="data"&&(u=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==u+2&&(a[u][1].end=a[o-1][1].end,a.splice(u+2,o-u-2),o=u+2),u=void 0);return t?t(a,l):a}}function xR(t,r){let a=0;for(;++a<=t.length;)if((a===t.length||t[a][1].type==="lineEnding")&&t[a-1][1].type==="data"){const l=t[a-1][1],o=r.sliceStream(l);let u=o.length,d=-1,m=0,p;for(;u--;){const y=o[u];if(typeof y=="string"){for(d=y.length;y.charCodeAt(d-1)===32;)m++,d--;if(d)break;d=-1}else if(y===-2)p=!0,m++;else if(y!==-1){u++;break}}if(r._contentTypeTextTrailing&&a===t.length&&(m=0),m){const y={type:a===t.length||p||m<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:l.start._bufferIndex+d,_index:l.start._index+u,line:l.end.line,column:l.end.column-m,offset:l.end.offset-m},end:{...l.end}};l.end={...y.start},l.start.offset===l.end.offset?Object.assign(l,y):(t.splice(a,0,["enter",y,r],["exit",y,r]),a+=2)}a++}return t}const bR={42:zn,43:zn,45:zn,48:zn,49:zn,50:zn,51:zn,52:zn,53:zn,54:zn,55:zn,56:zn,57:zn,62:Pw},vR={91:C4},wR={[-2]:lm,[-1]:lm,32:lm},SR={35:O4,42:Dc,45:[C0,Dc],60:D4,61:C0,95:Dc,96:S0,126:S0},NR={38:Yw,92:Qw},CR={[-5]:sm,[-4]:sm,[-3]:sm,33:J4,38:Yw,42:Gm,60:[e4,I4],91:eR,92:[T4,Qw],93:Bp,95:Gm,96:h4},kR={null:[Gm,pR]},jR={null:[42,95]},ER={null:[]},TR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jR,contentInitial:vR,disable:ER,document:bR,flow:SR,flowInitial:wR,insideSpan:kR,string:NR,text:CR},Symbol.toStringTag,{value:"Module"}));function AR(t,r,a){let l={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},u=[];let d=[],m=[];const p={attempt:L(Q),check:L(j),consume:A,enter:M,exit:F,interrupt:L(j,{interrupt:!0})},y={code:null,containerState:{},defineSkip:T,events:[],now:C,parser:t,previous:null,sliceSerialize:b,sliceStream:w,write:g};let x=r.tokenize.call(y,p);return r.resolveAll&&u.push(r),y;function g(le){return d=ur(d,le),E(),d[d.length-1]!==null?[]:($(r,0),y.events=rd(u,y.events,y),y.events)}function b(le,I){return RR(w(le),I)}function w(le){return OR(d,le)}function C(){const{_bufferIndex:le,_index:I,line:ee,column:ie,offset:re}=l;return{_bufferIndex:le,_index:I,line:ee,column:ie,offset:re}}function T(le){o[le.line]=le.column,z()}function E(){let le;for(;l._index<d.length;){const I=d[l._index];if(typeof I=="string")for(le=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===le&&l._bufferIndex<I.length;)k(I.charCodeAt(l._bufferIndex));else k(I)}}function k(le){x=x(le)}function A(le){ze(le)?(l.line++,l.column=1,l.offset+=le===-3?2:1,z()):le!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===d[l._index].length&&(l._bufferIndex=-1,l._index++)),y.previous=le}function M(le,I){const ee=I||{};return ee.type=le,ee.start=C(),y.events.push(["enter",ee,y]),m.push(ee),ee}function F(le){const I=m.pop();return I.end=C(),y.events.push(["exit",I,y]),I}function Q(le,I){$(le,I.from)}function j(le,I){I.restore()}function L(le,I){return ee;function ee(ie,re,Z){let ce,me,Re,O;return Array.isArray(ie)?lt(ie):"tokenize"in ie?lt([ie]):Be(ie);function Be(he){return xe;function xe(Oe){const Me=Oe!==null&&he[Oe],Le=Oe!==null&&he.null,ye=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return lt(ye)(Oe)}}function lt(he){return ce=he,me=0,he.length===0?Z:_(he[me])}function _(he){return xe;function xe(Oe){return O=W(),Re=he,he.partial||(y.currentConstruct=he),he.name&&y.parser.constructs.disable.null.includes(he.name)?ae():he.tokenize.call(I?Object.assign(Object.create(y),I):y,p,D,ae)(Oe)}}function D(he){return le(Re,O),re}function ae(he){return O.restore(),++me<ce.length?_(ce[me]):Z}}}function $(le,I){le.resolveAll&&!u.includes(le)&&u.push(le),le.resolve&&$n(y.events,I,y.events.length-I,le.resolve(y.events.slice(I),y)),le.resolveTo&&(y.events=le.resolveTo(y.events,y))}function W(){const le=C(),I=y.previous,ee=y.currentConstruct,ie=y.events.length,re=Array.from(m);return{from:ie,restore:Z};function Z(){l=le,y.previous=I,y.currentConstruct=ee,y.events.length=ie,m=re,z()}}function z(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function OR(t,r){const a=r.start._index,l=r.start._bufferIndex,o=r.end._index,u=r.end._bufferIndex;let d;if(a===o)d=[t[a].slice(l,u)];else{if(d=t.slice(a,o),l>-1){const m=d[0];typeof m=="string"?d[0]=m.slice(l):d.shift()}u>0&&d.push(t[o].slice(0,u))}return d}function RR(t,r){let a=-1;const l=[];let o;for(;++a<t.length;){const u=t[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
261
+ `;break}case-3:{d=`\r
262
+ `;break}case-2:{d=r?" ":" ";break}case-1:{if(!r&&o)continue;d=" ";break}default:d=String.fromCharCode(u)}o=u===-2,l.push(d)}return l.join("")}function MR(t){const l={constructs:Iw([TR,...(t||{}).extensions||[]]),content:o(GO),defined:[],document:o(XO),flow:o(hR),lazy:{},string:o(gR),text:o(yR)};return l;function o(u){return d;function d(m){return AR(l,u,m)}}}function zR(t){for(;!Vw(t););return t}const k0=/[\0\t\n\r]/g;function DR(){let t=1,r="",a=!0,l;return o;function o(u,d,m){const p=[];let y,x,g,b,w;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),g=0,r="",a&&(u.charCodeAt(0)===65279&&g++,a=void 0);g<u.length;){if(k0.lastIndex=g,y=k0.exec(u),b=y&&y.index!==void 0?y.index:u.length,w=u.charCodeAt(b),!y){r=u.slice(g);break}if(w===10&&g===b&&l)p.push(-3),l=void 0;else switch(l&&(p.push(-5),l=void 0),g<b&&(p.push(u.slice(g,b)),t+=b-g),w){case 0:{p.push(65533),t++;break}case 9:{for(x=Math.ceil(t/4)*4,p.push(-2);t++<x;)p.push(-1);break}case 10:{p.push(-4),t=1;break}default:l=!0,t=1}g=b+1}return m&&(l&&p.push(-5),r&&p.push(r),p.push(null)),p}}const _R=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function LR(t){return t.replace(_R,UR)}function UR(t,r,a){if(r)return r;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),u=o===120||o===88;return Fw(a.slice(u?2:1),u?16:10)}return Hp(a)||t}const Jw={}.hasOwnProperty;function qR(t,r,a){return r&&typeof r=="object"&&(a=r,r=void 0),HR(a)(zR(MR(a).document().write(DR()(t,r,!0))))}function HR(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(pt),autolinkProtocol:W,autolinkEmail:W,atxHeading:u(se),blockQuote:u(Le),characterEscape:W,characterReference:W,codeFenced:u(ye),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(ye,d),codeText:u(je,d),codeTextData:W,data:W,codeFlowValue:W,definition:u(Tt),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(Ke),hardBreakEscape:u(He),hardBreakTrailing:u(He),htmlFlow:u(rt,d),htmlFlowData:W,htmlText:u(rt,d),htmlTextData:W,image:u(Qe),label:d,link:u(pt),listItem:u(Ct),listItemValue:b,listOrdered:u(zt,g),listUnordered:u(zt),paragraph:u(fe),reference:_,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(se),strong:u(ge),thematicBreak:u(It)},exit:{atxHeading:p(),atxHeadingSequence:Q,autolink:p(),autolinkEmail:Me,autolinkProtocol:Oe,blockQuote:p(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:he,characterReference:xe,codeFenced:p(E),codeFencedFence:T,codeFencedFenceInfo:w,codeFencedFenceMeta:C,codeFlowValue:z,codeIndented:p(k),codeText:p(re),codeTextData:z,data:z,definition:p(),definitionDestinationString:F,definitionLabelString:A,definitionTitleString:M,emphasis:p(),hardBreakEscape:p(I),hardBreakTrailing:p(I),htmlFlow:p(ee),htmlFlowData:z,htmlText:p(ie),htmlTextData:z,image:p(ce),label:Re,labelText:me,lineEnding:le,link:p(Z),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:D,resourceDestinationString:O,resourceTitleString:Be,resource:lt,setextHeading:p($),setextHeadingLineSequence:L,setextHeadingText:j,strong:p(),thematicBreak:p()}};Ww(r,(t||{}).mdastExtensions||[]);const a={};return l;function l(J){let K={type:"root",children:[]};const be={stack:[K],tokenStack:[],config:r,enter:m,exit:y,buffer:d,resume:x,data:a},Te=[];let Ye=-1;for(;++Ye<J.length;)if(J[Ye][1].type==="listOrdered"||J[Ye][1].type==="listUnordered")if(J[Ye][0]==="enter")Te.push(Ye);else{const nn=Te.pop();Ye=o(J,nn,Ye)}for(Ye=-1;++Ye<J.length;){const nn=r[J[Ye][0]];Jw.call(nn,J[Ye][1].type)&&nn[J[Ye][1].type].call(Object.assign({sliceSerialize:J[Ye][2].sliceSerialize},be),J[Ye][1])}if(be.tokenStack.length>0){const nn=be.tokenStack[be.tokenStack.length-1];(nn[1]||j0).call(be,void 0,nn[0])}for(K.position={start:Pa(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:Pa(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<r.transforms.length;)K=r.transforms[Ye](K)||K;return K}function o(J,K,be){let Te=K-1,Ye=-1,nn=!1,Jn,kn,fr,hr;for(;++Te<=be;){const Ft=J[Te];switch(Ft[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ft[0]==="enter"?Ye++:Ye--,hr=void 0;break}case"lineEndingBlank":{Ft[0]==="enter"&&(Jn&&!hr&&!Ye&&!fr&&(fr=Te),hr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hr=void 0}if(!Ye&&Ft[0]==="enter"&&Ft[1].type==="listItemPrefix"||Ye===-1&&Ft[0]==="exit"&&(Ft[1].type==="listUnordered"||Ft[1].type==="listOrdered")){if(Jn){let mr=Te;for(kn=void 0;mr--;){const jn=J[mr];if(jn[1].type==="lineEnding"||jn[1].type==="lineEndingBlank"){if(jn[0]==="exit")continue;kn&&(J[kn][1].type="lineEndingBlank",nn=!0),jn[1].type="lineEnding",kn=mr}else if(!(jn[1].type==="linePrefix"||jn[1].type==="blockQuotePrefix"||jn[1].type==="blockQuotePrefixWhitespace"||jn[1].type==="blockQuoteMarker"||jn[1].type==="listItemIndent"))break}fr&&(!kn||fr<kn)&&(Jn._spread=!0),Jn.end=Object.assign({},kn?J[kn][1].start:Ft[1].end),J.splice(kn||Te,0,["exit",Jn,Ft[2]]),Te++,be++}if(Ft[1].type==="listItemPrefix"){const mr={type:"listItem",_spread:!1,start:Object.assign({},Ft[1].start),end:void 0};Jn=mr,J.splice(Te,0,["enter",mr,Ft[2]]),Te++,be++,fr=void 0,hr=!0}}}return J[K][1]._spread=nn,be}function u(J,K){return be;function be(Te){m.call(this,J(Te),Te),K&&K.call(this,Te)}}function d(){this.stack.push({type:"fragment",children:[]})}function m(J,K,be){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([K,be||void 0]),J.position={start:Pa(K.start),end:void 0}}function p(J){return K;function K(be){J&&J.call(this,be),y.call(this,be)}}function y(J,K){const be=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==J.type&&(K?K.call(this,J,Te[0]):(Te[1]||j0).call(this,J,Te[0]));else throw new Error("Cannot close `"+J.type+"` ("+xo({start:J.start,end:J.end})+"): it’s not open");be.position.end=Pa(J.end)}function x(){return qp(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(J){if(this.data.expectingFirstListItemValue){const K=this.stack[this.stack.length-2];K.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function w(){const J=this.resume(),K=this.stack[this.stack.length-1];K.lang=J}function C(){const J=this.resume(),K=this.stack[this.stack.length-1];K.meta=J}function T(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J.replace(/(\r?\n|\r)$/g,"")}function A(J){const K=this.resume(),be=this.stack[this.stack.length-1];be.label=K,be.identifier=Cr(this.sliceSerialize(J)).toLowerCase()}function M(){const J=this.resume(),K=this.stack[this.stack.length-1];K.title=J}function F(){const J=this.resume(),K=this.stack[this.stack.length-1];K.url=J}function Q(J){const K=this.stack[this.stack.length-1];if(!K.depth){const be=this.sliceSerialize(J).length;K.depth=be}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function L(J){const K=this.stack[this.stack.length-1];K.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function W(J){const be=this.stack[this.stack.length-1].children;let Te=be[be.length-1];(!Te||Te.type!=="text")&&(Te=oe(),Te.position={start:Pa(J.start),end:void 0},be.push(Te)),this.stack.push(Te)}function z(J){const K=this.stack.pop();K.value+=this.sliceSerialize(J),K.position.end=Pa(J.end)}function le(J){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=K.children[K.children.length-1];be.position.end=Pa(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(K.type)&&(W.call(this,J),z.call(this,J))}function I(){this.data.atHardBreak=!0}function ee(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J}function ie(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J}function re(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J}function Z(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=K,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function ce(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const K=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=K,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function me(J){const K=this.sliceSerialize(J),be=this.stack[this.stack.length-2];be.label=LR(K),be.identifier=Cr(K).toLowerCase()}function Re(){const J=this.stack[this.stack.length-1],K=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const Te=J.children;be.children=Te}else be.alt=K}function O(){const J=this.resume(),K=this.stack[this.stack.length-1];K.url=J}function Be(){const J=this.resume(),K=this.stack[this.stack.length-1];K.title=J}function lt(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function D(J){const K=this.resume(),be=this.stack[this.stack.length-1];be.label=K,be.identifier=Cr(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function ae(J){this.data.characterReferenceType=J.type}function he(J){const K=this.sliceSerialize(J),be=this.data.characterReferenceType;let Te;be?(Te=Fw(K,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Hp(K);const Ye=this.stack[this.stack.length-1];Ye.value+=Te}function xe(J){const K=this.stack.pop();K.position.end=Pa(J.end)}function Oe(J){z.call(this,J);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(J)}function Me(J){z.call(this,J);const K=this.stack[this.stack.length-1];K.url="mailto:"+this.sliceSerialize(J)}function Le(){return{type:"blockquote",children:[]}}function ye(){return{type:"code",lang:null,meta:null,value:""}}function je(){return{type:"inlineCode",value:""}}function Tt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function se(){return{type:"heading",depth:0,children:[]}}function He(){return{type:"break"}}function rt(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function pt(){return{type:"link",title:null,url:"",children:[]}}function zt(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function Ct(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function fe(){return{type:"paragraph",children:[]}}function ge(){return{type:"strong",children:[]}}function oe(){return{type:"text",value:""}}function It(){return{type:"thematicBreak"}}}function Pa(t){return{line:t.line,column:t.column,offset:t.offset}}function Ww(t,r){let a=-1;for(;++a<r.length;){const l=r[a];Array.isArray(l)?Ww(t,l):BR(t,l)}}function BR(t,r){let a;for(a in r)if(Jw.call(r,a))switch(a){case"canContainEols":{const l=r[a];l&&t[a].push(...l);break}case"transforms":{const l=r[a];l&&t[a].push(...l);break}case"enter":case"exit":{const l=r[a];l&&Object.assign(t[a],l);break}}}function j0(t,r){throw t?new Error("Cannot close `"+t.type+"` ("+xo({start:t.start,end:t.end})+"): a different token (`"+r.type+"`, "+xo({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+xo({start:r.start,end:r.end})+") is still open")}function IR(t){const r=this;r.parser=a;function a(l){return qR(l,{...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function FR(t,r){const a={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(r),!0)};return t.patch(r,a),t.applyData(r,a)}function PR(t,r){const a={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,a),[t.applyData(r,a),{type:"text",value:`
263
+ `}]}function QR(t,r){const a=r.value?r.value+`
264
+ `:"",l={},o=r.lang?r.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:l,children:[{type:"text",value:a}]};return r.meta&&(u.data={meta:r.meta}),t.patch(r,u),u=t.applyData(r,u),u={type:"element",tagName:"pre",properties:{},children:[u]},t.patch(r,u),u}function YR(t,r){const a={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function VR(t,r){const a={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function GR(t,r){const a=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),o=ss(l.toLowerCase()),u=t.footnoteOrder.indexOf(l);let d,m=t.footnoteCounts.get(l);m===void 0?(m=0,t.footnoteOrder.push(l),d=t.footnoteOrder.length):d=u+1,m+=1,t.footnoteCounts.set(l,m);const p={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(m>1?"-"+m:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};t.patch(r,p);const y={type:"element",tagName:"sup",properties:{},children:[p]};return t.patch(r,y),t.applyData(r,y)}function KR(t,r){const a={type:"element",tagName:"h"+r.depth,properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function XR(t,r){if(t.options.allowDangerousHtml){const a={type:"raw",value:r.value};return t.patch(r,a),t.applyData(r,a)}}function eS(t,r){const a=r.referenceType;let l="]";if(a==="collapsed"?l+="[]":a==="full"&&(l+="["+(r.label||r.identifier)+"]"),r.type==="imageReference")return[{type:"text",value:"!["+r.alt+l}];const o=t.all(r),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=l:o.push({type:"text",value:l}),o}function $R(t,r){const a=String(r.identifier).toUpperCase(),l=t.definitionById.get(a);if(!l)return eS(t,r);const o={src:ss(l.url||""),alt:r.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"img",properties:o,children:[]};return t.patch(r,u),t.applyData(r,u)}function ZR(t,r){const a={src:ss(r.url)};r.alt!==null&&r.alt!==void 0&&(a.alt=r.alt),r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"img",properties:a,children:[]};return t.patch(r,l),t.applyData(r,l)}function JR(t,r){const a={type:"text",value:r.value.replace(/\r?\n|\r/g," ")};t.patch(r,a);const l={type:"element",tagName:"code",properties:{},children:[a]};return t.patch(r,l),t.applyData(r,l)}function WR(t,r){const a=String(r.identifier).toUpperCase(),l=t.definitionById.get(a);if(!l)return eS(t,r);const o={href:ss(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"a",properties:o,children:t.all(r)};return t.patch(r,u),t.applyData(r,u)}function eM(t,r){const a={href:ss(r.url)};r.title!==null&&r.title!==void 0&&(a.title=r.title);const l={type:"element",tagName:"a",properties:a,children:t.all(r)};return t.patch(r,l),t.applyData(r,l)}function tM(t,r,a){const l=t.all(r),o=a?nM(a):tS(r),u={},d=[];if(typeof r.checked=="boolean"){const x=l[0];let g;x&&x.type==="element"&&x.tagName==="p"?g=x:(g={type:"element",tagName:"p",properties:{},children:[]},l.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:r.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let m=-1;for(;++m<l.length;){const x=l[m];(o||m!==0||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
265
+ `}),x.type==="element"&&x.tagName==="p"&&!o?d.push(...x.children):d.push(x)}const p=l[l.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
266
+ `});const y={type:"element",tagName:"li",properties:u,children:d};return t.patch(r,y),t.applyData(r,y)}function nM(t){let r=!1;if(t.type==="list"){r=t.spread||!1;const a=t.children;let l=-1;for(;!r&&++l<a.length;)r=tS(a[l])}return r}function tS(t){const r=t.spread;return r??t.children.length>1}function rM(t,r){const a={},l=t.all(r);let o=-1;for(typeof r.start=="number"&&r.start!==1&&(a.start=r.start);++o<l.length;){const d=l[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:r.ordered?"ol":"ul",properties:a,children:t.wrap(l,!0)};return t.patch(r,u),t.applyData(r,u)}function aM(t,r){const a={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function iM(t,r){const a={type:"root",children:t.wrap(t.all(r))};return t.patch(r,a),t.applyData(r,a)}function lM(t,r){const a={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function sM(t,r){const a=t.all(r),l=a.shift(),o=[];if(l){const d={type:"element",tagName:"thead",properties:{},children:t.wrap([l],!0)};t.patch(r.children[0],d),o.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:t.wrap(a,!0)},m=Dp(r.children[1]),p=Dw(r.children[r.children.length-1]);m&&p&&(d.position={start:m,end:p}),o.push(d)}const u={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(r,u),t.applyData(r,u)}function oM(t,r,a){const l=a?a.children:void 0,u=(l?l.indexOf(r):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,m=d?d.length:r.children.length;let p=-1;const y=[];for(;++p<m;){const g=r.children[p],b={},w=d?d[p]:void 0;w&&(b.align=w);let C={type:"element",tagName:u,properties:b,children:[]};g&&(C.children=t.all(g),t.patch(g,C),C=t.applyData(g,C)),y.push(C)}const x={type:"element",tagName:"tr",properties:{},children:t.wrap(y,!0)};return t.patch(r,x),t.applyData(r,x)}function uM(t,r){const a={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}const E0=9,T0=32;function cM(t){const r=String(t),a=/\r?\n|\r/g;let l=a.exec(r),o=0;const u=[];for(;l;)u.push(A0(r.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=a.exec(r);return u.push(A0(r.slice(o),o>0,!1)),u.join("")}function A0(t,r,a){let l=0,o=t.length;if(r){let u=t.codePointAt(l);for(;u===E0||u===T0;)l++,u=t.codePointAt(l)}if(a){let u=t.codePointAt(o-1);for(;u===E0||u===T0;)o--,u=t.codePointAt(o-1)}return o>l?t.slice(l,o):""}function dM(t,r){const a={type:"text",value:cM(String(r.value))};return t.patch(r,a),t.applyData(r,a)}function fM(t,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,a),t.applyData(r,a)}const hM={blockquote:FR,break:PR,code:QR,delete:YR,emphasis:VR,footnoteReference:GR,heading:KR,html:XR,imageReference:$R,image:ZR,inlineCode:JR,linkReference:WR,link:eM,listItem:tM,list:rM,paragraph:aM,root:iM,strong:lM,table:sM,tableCell:uM,tableRow:oM,text:dM,thematicBreak:fM,toml:Ec,yaml:Ec,definition:Ec,footnoteDefinition:Ec};function Ec(){}const nS=-1,ad=0,vo=1,Hc=2,Ip=3,Fp=4,Pp=5,Qp=6,rS=7,aS=8,{defineProperty:mM}=Object,iS=typeof self=="object"?self:globalThis,O0=(t,r)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new iS[t](r)},pM=(t,r)=>{const a=(o,u)=>(t.set(u,o),o),l=o=>{if(t.has(o))return t.get(o);const[u,d]=r[o];switch(u){case ad:case nS:return a(d,o);case vo:{const m=a([],o);for(const p of d)m.push(l(p));return m}case Hc:{const m=a({},o);for(const[p,y]of d){const x=l(p),g=l(y);x==="__proto__"?mM(m,x,{value:g,configurable:!0,enumerable:!0,writable:!0}):m[x]=g}return m}case Ip:return a(new Date(d),o);case Fp:{const{source:m,flags:p}=d;return a(new RegExp(m,p),o)}case Pp:{const m=a(new Map,o);for(const[p,y]of d)m.set(l(p),l(y));return m}case Qp:{const m=a(new Set,o);for(const p of d)m.add(l(p));return m}case rS:{const{name:m,message:p}=d;return a(typeof iS[m]=="function"?O0(m,p):new Error(p),o)}case aS:return a(BigInt(d),o);case"BigInt":return a(Object(BigInt(d)),o);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:m}=new Uint8Array(d);return a(new DataView(m),d)}case"-0":return-0}return a(O0(u,d),o)};return l},R0=t=>pM(new Map,t)(0),ji="",{toString:gM}={},{keys:yM,is:xM}=Object,fo=t=>{const r=typeof t;if(r!=="object"||!t)return[ad,r];const a=gM.call(t).slice(8,-1);switch(a){case"Array":return[vo,ji];case"Object":return[Hc,ji];case"Date":return[Ip,ji];case"RegExp":return[Fp,ji];case"Map":return[Pp,ji];case"Set":return[Qp,ji];case"DataView":return[vo,a]}return a.includes("Array")?[vo,a]:t instanceof Error?[rS,t.name||"Error"]:[Hc,a]},Tc=([t,r])=>t===ad&&(r==="function"||r==="symbol"),bM=(t,r,a,l)=>{const o=(d,m)=>{const p=l.push(d)-1;return a.set(m,p),p},u=d=>{if(a.has(d))return a.get(d);let[m,p]=fo(d);switch(m){case ad:{let x=d;switch(p){case"bigint":m=aS,x=d.toString();break;case"number":if(!d&&xM(d,-0))return l.push(["-0"])-1;break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+p);x=null;break;case"undefined":return o([nS],d)}return o([m,x],d)}case vo:{if(p){let b=d;return p==="DataView"?b=new Uint8Array(d.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(d)),o([p,[...b]],d)}const x=[],g=o([m,x],d);for(const b of d)x.push(u(b));return g}case Hc:{if(p)switch(p){case"BigInt":return o([p,d.toString()],d);case"Boolean":case"Number":case"String":return o([p,d.valueOf()],d)}if(r&&"toJSON"in d)return u(d.toJSON());const x=[],g=o([m,x],d);for(const b of yM(d))(t||!Tc(fo(d[b])))&&x.push([u(b),u(d[b])]);return g}case Ip:return o([m,isNaN(d.getTime())?ji:d.toISOString()],d);case Fp:{const{source:x,flags:g}=d;return o([m,{source:x,flags:g}],d)}case Pp:{const x=[],g=o([m,x],d);for(const[b,w]of d)(t||!(Tc(fo(b))||Tc(fo(w))))&&x.push([u(b),u(w)]);return g}case Qp:{const x=[],g=o([m,x],d);for(const b of d)(t||!Tc(fo(b)))&&x.push(u(b));return g}}const{message:y}=d;return o([m,{name:p,message:y}],d)};return u},M0=(t,{json:r,lossy:a}={})=>{const l=[];return bM(!(r||a),!!r,new Map,l)(t),l},Bc=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?R0(M0(t,r)):structuredClone(t):(t,r)=>R0(M0(t,r));function vM(t,r){const a=[{type:"text",value:"↩"}];return r>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(r)}]}),a}function wM(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function SM(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=t.options.footnoteBackContent||vM,l=t.options.footnoteBackLabel||wM,o=t.options.footnoteLabel||"Footnotes",u=t.options.footnoteLabelTagName||"h2",d=t.options.footnoteLabelProperties||{className:["sr-only"]},m=[];let p=-1;for(;++p<t.footnoteOrder.length;){const y=t.footnoteById.get(t.footnoteOrder[p]);if(!y)continue;const x=t.all(y),g=String(y.identifier).toUpperCase(),b=ss(g.toLowerCase());let w=0;const C=[],T=t.footnoteCounts.get(g);for(;T!==void 0&&++w<=T;){C.length>0&&C.push({type:"text",value:" "});let A=typeof a=="string"?a:a(p,w);typeof A=="string"&&(A={type:"text",value:A}),C.push({type:"element",tagName:"a",properties:{href:"#"+r+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(p,w),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const E=x[x.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const A=E.children[E.children.length-1];A&&A.type==="text"?A.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...C)}else x.push(...C);const k={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:t.wrap(x,!0)};t.patch(y,k),m.push(k)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Bc(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
267
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
268
+ `}]}}const id=(function(t){if(t==null)return jM;if(typeof t=="function")return ld(t);if(typeof t=="object")return Array.isArray(t)?NM(t):CM(t);if(typeof t=="string")return kM(t);throw new Error("Expected function, string, or object as test")});function NM(t){const r=[];let a=-1;for(;++a<t.length;)r[a]=id(t[a]);return ld(l);function l(...o){let u=-1;for(;++u<r.length;)if(r[u].apply(this,o))return!0;return!1}}function CM(t){const r=t;return ld(a);function a(l){const o=l;let u;for(u in t)if(o[u]!==r[u])return!1;return!0}}function kM(t){return ld(r);function r(a){return a&&a.type===t}}function ld(t){return r;function r(a,l,o){return!!(EM(a)&&t.call(this,a,typeof l=="number"?l:void 0,o||void 0))}}function jM(){return!0}function EM(t){return t!==null&&typeof t=="object"&&"type"in t}const lS=[],TM=!0,Km=!1,AM="skip";function sS(t,r,a,l){let o;typeof r=="function"&&typeof a!="function"?(l=a,a=r):o=r;const u=id(o),d=l?-1:1;m(t,void 0,[])();function m(p,y,x){const g=p&&typeof p=="object"?p:{};if(typeof g.type=="string"){const w=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(p.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=lS,C,T,E;if((!r||u(p,y,x[x.length-1]||void 0))&&(w=OM(a(p,x)),w[0]===Km))return w;if("children"in p&&p.children){const k=p;if(k.children&&w[0]!==AM)for(T=(l?k.children.length:-1)+d,E=x.concat(k);T>-1&&T<k.children.length;){const A=k.children[T];if(C=m(A,T,E)(),C[0]===Km)return C;T=typeof C[1]=="number"?C[1]:T+d}}return w}}}function OM(t){return Array.isArray(t)?t:typeof t=="number"?[TM,t]:t==null?lS:[t]}function Yp(t,r,a,l){let o,u,d;typeof r=="function"&&typeof a!="function"?(u=void 0,d=r,o=a):(u=r,d=a,o=l),sS(t,u,m,o);function m(p,y){const x=y[y.length-1],g=x?x.children.indexOf(p):void 0;return d(p,g,x)}}const Xm={}.hasOwnProperty,RM={};function MM(t,r){const a=r||RM,l=new Map,o=new Map,u=new Map,d={...hM,...a.handlers},m={all:y,applyData:DM,definitionById:l,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:p,options:a,patch:zM,wrap:LM};return Yp(t,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const g=x.type==="definition"?l:o,b=String(x.identifier).toUpperCase();g.has(b)||g.set(b,x)}}),m;function p(x,g){const b=x.type,w=m.handlers[b];if(Xm.call(m.handlers,b)&&w)return w(m,x,g);if(m.options.passThrough&&m.options.passThrough.includes(b)){if("children"in x){const{children:T,...E}=x,k=Bc(E);return k.children=m.all(x),k}return Bc(x)}return(m.options.unknownHandler||_M)(m,x,g)}function y(x){const g=[];if("children"in x){const b=x.children;let w=-1;for(;++w<b.length;){const C=m.one(b[w],x);if(C){if(w&&b[w-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=z0(C.value)),!Array.isArray(C)&&C.type==="element")){const T=C.children[0];T&&T.type==="text"&&(T.value=z0(T.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function zM(t,r){t.position&&(r.position=bO(t))}function DM(t,r){let a=r;if(t&&t.data){const l=t.data.hName,o=t.data.hChildren,u=t.data.hProperties;if(typeof l=="string")if(a.type==="element")a.tagName=l;else{const d="children"in a?a.children:[a];a={type:"element",tagName:l,properties:{},children:d}}a.type==="element"&&u&&Object.assign(a.properties,Bc(u)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function _M(t,r){const a=r.data||{},l="value"in r&&!(Xm.call(a,"hProperties")||Xm.call(a,"hChildren"))?{type:"text",value:r.value}:{type:"element",tagName:"div",properties:{},children:t.all(r)};return t.patch(r,l),t.applyData(r,l)}function LM(t,r){const a=[];let l=-1;for(r&&a.push({type:"text",value:`
269
+ `});++l<t.length;)l&&a.push({type:"text",value:`
270
+ `}),a.push(t[l]);return r&&t.length>0&&a.push({type:"text",value:`
271
+ `}),a}function z0(t){let r=0,a=t.charCodeAt(r);for(;a===9||a===32;)r++,a=t.charCodeAt(r);return t.slice(r)}function D0(t,r){const a=MM(t,r),l=a.one(t,void 0),o=SM(a),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
272
+ `},o),u}function UM(t,r){return t&&"run"in t?async function(a,l){const o=D0(a,{file:l,...r});await t.run(o,l)}:function(a,l){return D0(a,{file:l,...t||r})}}function _0(t){if(t)throw t}var om,L0;function qM(){if(L0)return om;L0=1;var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(y){return typeof Array.isArray=="function"?Array.isArray(y):r.call(y)==="[object Array]"},u=function(y){if(!y||r.call(y)!=="[object Object]")return!1;var x=t.call(y,"constructor"),g=y.constructor&&y.constructor.prototype&&t.call(y.constructor.prototype,"isPrototypeOf");if(y.constructor&&!x&&!g)return!1;var b;for(b in y);return typeof b>"u"||t.call(y,b)},d=function(y,x){a&&x.name==="__proto__"?a(y,x.name,{enumerable:!0,configurable:!0,value:x.newValue,writable:!0}):y[x.name]=x.newValue},m=function(y,x){if(x==="__proto__")if(t.call(y,x)){if(l)return l(y,x).value}else return;return y[x]};return om=function p(){var y,x,g,b,w,C,T=arguments[0],E=1,k=arguments.length,A=!1;for(typeof T=="boolean"&&(A=T,T=arguments[1]||{},E=2),(T==null||typeof T!="object"&&typeof T!="function")&&(T={});E<k;++E)if(y=arguments[E],y!=null)for(x in y)g=m(T,x),b=m(y,x),T!==b&&(A&&b&&(u(b)||(w=o(b)))?(w?(w=!1,C=g&&o(g)?g:[]):C=g&&u(g)?g:{},d(T,{name:x,newValue:p(A,C,b)})):typeof b<"u"&&d(T,{name:x,newValue:b}));return T},om}var HM=qM();const um=ep(HM);function $m(t){if(typeof t!="object"||t===null)return!1;const r=Object.getPrototypeOf(t);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function BM(){const t=[],r={run:a,use:l};return r;function a(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);m(null,...o);function m(p,...y){const x=t[++u];let g=-1;if(p){d(p);return}for(;++g<o.length;)(y[g]===null||y[g]===void 0)&&(y[g]=o[g]);o=y,x?IM(x,m)(...y):d(null,...y)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return t.push(o),r}}function IM(t,r){let a;return l;function l(...d){const m=t.length>d.length;let p;m&&d.push(o);try{p=t.apply(this,d)}catch(y){const x=y;if(m&&a)throw x;return o(x)}m||(p&&p.then&&typeof p.then=="function"?p.then(u,o):p instanceof Error?o(p):u(p))}function o(d,...m){a||(a=!0,r(d,...m))}function u(d){o(null,d)}}const qr={basename:FM,dirname:PM,extname:QM,join:YM,sep:"/"};function FM(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Ko(t);let a=0,l=-1,o=t.length,u;if(r===void 0||r.length===0||r.length>t.length){for(;o--;)if(t.codePointAt(o)===47){if(u){a=o+1;break}}else l<0&&(u=!0,l=o+1);return l<0?"":t.slice(a,l)}if(r===t)return"";let d=-1,m=r.length-1;for(;o--;)if(t.codePointAt(o)===47){if(u){a=o+1;break}}else d<0&&(u=!0,d=o+1),m>-1&&(t.codePointAt(o)===r.codePointAt(m--)?m<0&&(l=o):(m=-1,l=d));return a===l?l=d:l<0&&(l=t.length),t.slice(a,l)}function PM(t){if(Ko(t),t.length===0)return".";let r=-1,a=t.length,l;for(;--a;)if(t.codePointAt(a)===47){if(l){r=a;break}}else l||(l=!0);return r<0?t.codePointAt(0)===47?"/":".":r===1&&t.codePointAt(0)===47?"//":t.slice(0,r)}function QM(t){Ko(t);let r=t.length,a=-1,l=0,o=-1,u=0,d;for(;r--;){const m=t.codePointAt(r);if(m===47){if(d){l=r+1;break}continue}a<0&&(d=!0,a=r+1),m===46?o<0?o=r:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||a<0||u===0||u===1&&o===a-1&&o===l+1?"":t.slice(o,a)}function YM(...t){let r=-1,a;for(;++r<t.length;)Ko(t[r]),t[r]&&(a=a===void 0?t[r]:a+"/"+t[r]);return a===void 0?".":VM(a)}function VM(t){Ko(t);const r=t.codePointAt(0)===47;let a=GM(t,!r);return a.length===0&&!r&&(a="."),a.length>0&&t.codePointAt(t.length-1)===47&&(a+="/"),r?"/"+a:a}function GM(t,r){let a="",l=0,o=-1,u=0,d=-1,m,p;for(;++d<=t.length;){if(d<t.length)m=t.codePointAt(d);else{if(m===47)break;m=47}if(m===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(a.length<2||l!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(p=a.lastIndexOf("/"),p!==a.length-1){p<0?(a="",l=0):(a=a.slice(0,p),l=a.length-1-a.lastIndexOf("/")),o=d,u=0;continue}}else if(a.length>0){a="",l=0,o=d,u=0;continue}}r&&(a=a.length>0?a+"/..":"..",l=2)}else a.length>0?a+="/"+t.slice(o+1,d):a=t.slice(o+1,d),l=d-o-1;o=d,u=0}else m===46&&u>-1?u++:u=-1}return a}function Ko(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const KM={cwd:XM};function XM(){return"/"}function Zm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function $M(t){if(typeof t=="string")t=new URL(t);else if(!Zm(t)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(t.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return ZM(t)}function ZM(t){if(t.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const r=t.pathname;let a=-1;for(;++a<r.length;)if(r.codePointAt(a)===37&&r.codePointAt(a+1)===50){const l=r.codePointAt(a+2);if(l===70||l===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(r)}const cm=["history","path","basename","stem","extname","dirname"];class oS{constructor(r){let a;r?Zm(r)?a={path:r}:typeof r=="string"||JM(r)?a={value:r}:a=r:a={},this.cwd="cwd"in a?"":KM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<cm.length;){const u=cm[l];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let o;for(o in a)cm.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(r){fm(r,"basename"),dm(r,"basename"),this.path=qr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?qr.dirname(this.path):void 0}set dirname(r){U0(this.basename,"dirname"),this.path=qr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?qr.extname(this.path):void 0}set extname(r){if(dm(r,"extname"),U0(this.dirname,"extname"),r){if(r.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(r.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=qr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){Zm(r)&&(r=$M(r)),fm(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?qr.basename(this.path,this.extname):void 0}set stem(r){fm(r,"stem"),dm(r,"stem"),this.path=qr.join(this.dirname||"",r+(this.extname||""))}fail(r,a,l){const o=this.message(r,a,l);throw o.fatal=!0,o}info(r,a,l){const o=this.message(r,a,l);return o.fatal=void 0,o}message(r,a,l){const o=new gn(r,a,l);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function dm(t,r){if(t&&t.includes(qr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+qr.sep+"`")}function fm(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function U0(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function JM(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const WM=(function(t){const l=this.constructor.prototype,o=l[t],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),ez={}.hasOwnProperty;class Vp extends WM{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=BM()}copy(){const r=new Vp;let a=-1;for(;++a<this.attachers.length;){const l=this.attachers[a];r.use(...l)}return r.data(um(!0,{},this.namespace)),r}data(r,a){return typeof r=="string"?arguments.length===2?(pm("data",this.frozen),this.namespace[r]=a,this):ez.call(this.namespace,r)&&this.namespace[r]||void 0:r?(pm("data",this.frozen),this.namespace=r,this):this.namespace}freeze(){if(this.frozen)return this;const r=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=a.call(r,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const a=Ac(r),l=this.parser||this.Parser;return hm("parse",l),l(String(a),a)}process(r,a){const l=this;return this.freeze(),hm("process",this.parser||this.Parser),mm("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(u,d){const m=Ac(r),p=l.parse(m);l.run(p,m,function(x,g,b){if(x||!g||!b)return y(x);const w=g,C=l.stringify(w,b);rz(C)?b.value=C:b.result=C,y(x,b)});function y(x,g){x||!g?d(x):u?u(g):a(void 0,g)}}}processSync(r){let a=!1,l;return this.freeze(),hm("processSync",this.parser||this.Parser),mm("processSync",this.compiler||this.Compiler),this.process(r,o),H0("processSync","process",a),l;function o(u,d){a=!0,_0(u),l=d}}run(r,a,l){q0(r),this.freeze();const o=this.transformers;return!l&&typeof a=="function"&&(l=a,a=void 0),l?u(void 0,l):new Promise(u);function u(d,m){const p=Ac(a);o.run(r,p,y);function y(x,g,b){const w=g||r;x?m(x):d?d(w):l(void 0,w,b)}}}runSync(r,a){let l=!1,o;return this.run(r,a,u),H0("runSync","run",l),o;function u(d,m){_0(d),o=m,l=!0}}stringify(r,a){this.freeze();const l=Ac(a),o=this.compiler||this.Compiler;return mm("stringify",o),q0(r),o(r,l)}use(r,...a){const l=this.attachers,o=this.namespace;if(pm("use",this.frozen),r!=null)if(typeof r=="function")p(r,a);else if(typeof r=="object")Array.isArray(r)?m(r):d(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(y){if(typeof y=="function")p(y,[]);else if(typeof y=="object")if(Array.isArray(y)){const[x,...g]=y;p(x,g)}else d(y);else throw new TypeError("Expected usable value, not `"+y+"`")}function d(y){if(!("plugins"in y)&&!("settings"in y))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");m(y.plugins),y.settings&&(o.settings=um(!0,o.settings,y.settings))}function m(y){let x=-1;if(y!=null)if(Array.isArray(y))for(;++x<y.length;){const g=y[x];u(g)}else throw new TypeError("Expected a list of plugins, not `"+y+"`")}function p(y,x){let g=-1,b=-1;for(;++g<l.length;)if(l[g][0]===y){b=g;break}if(b===-1)l.push([y,...x]);else if(x.length>0){let[w,...C]=x;const T=l[b][1];$m(T)&&$m(w)&&(w=um(!0,T,w)),l[b]=[y,w,...C]}}}}const tz=new Vp().freeze();function hm(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function mm(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function pm(t,r){if(r)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function q0(t){if(!$m(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function H0(t,r,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function Ac(t){return nz(t)?t:new oS(t)}function nz(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function rz(t){return typeof t=="string"||az(t)}function az(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const iz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",B0=[],I0={allowDangerousHtml:!0},lz=/^(https?|ircs?|mailto|xmpp)$/i,sz=[{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 oz(t){const r=uz(t),a=cz(t);return dz(r.runSync(r.parse(a),a),t)}function uz(t){const r=t.rehypePlugins||B0,a=t.remarkPlugins||B0,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...I0}:I0;return tz().use(IR).use(a).use(UM,l).use(r)}function cz(t){const r=t.children||"",a=new oS;return typeof r=="string"&&(a.value=r),a}function dz(t,r){const a=r.allowedElements,l=r.allowElement,o=r.components,u=r.disallowedElements,d=r.skipHtml,m=r.unwrapDisallowed,p=r.urlTransform||fz;for(const x of sz)Object.hasOwn(r,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+iz+x.id,void 0);return Yp(t,y),CO(t,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function y(x,g,b){if(x.type==="raw"&&b&&typeof g=="number")return d?b.children.splice(g,1):b.children[g]={type:"text",value:x.value},g;if(x.type==="element"){let w;for(w in im)if(Object.hasOwn(im,w)&&Object.hasOwn(x.properties,w)){const C=x.properties[w],T=im[w];(T===null||T.includes(x.tagName))&&(x.properties[w]=p(String(C||""),w,x))}}if(x.type==="element"){let w=a?!a.includes(x.tagName):u?u.includes(x.tagName):!1;if(!w&&l&&typeof g=="number"&&(w=!l(x,g,b)),w&&b&&typeof g=="number")return m&&x.children?b.children.splice(g,1,...x.children):b.children.splice(g,1),g}}}function fz(t){const r=t.indexOf(":"),a=t.indexOf("?"),l=t.indexOf("#"),o=t.indexOf("/");return r===-1||o!==-1&&r>o||a!==-1&&r>a||l!==-1&&r>l||lz.test(t.slice(0,r))?t:""}function F0(t,r){const a=String(t);if(typeof r!="string")throw new TypeError("Expected character");let l=0,o=a.indexOf(r);for(;o!==-1;)l++,o=a.indexOf(r,o+r.length);return l}function hz(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mz(t,r,a){const o=id((a||{}).ignore||[]),u=pz(r);let d=-1;for(;++d<u.length;)sS(t,"text",m);function m(y,x){let g=-1,b;for(;++g<x.length;){const w=x[g],C=b?b.children:void 0;if(o(w,C?C.indexOf(w):void 0,b))return;b=w}if(b)return p(y,x)}function p(y,x){const g=x[x.length-1],b=u[d][0],w=u[d][1];let C=0;const E=g.children.indexOf(y);let k=!1,A=[];b.lastIndex=0;let M=b.exec(y.value);for(;M;){const F=M.index,Q={index:M.index,input:M.input,stack:[...x,y]};let j=w(...M,Q);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?b.lastIndex=F+1:(C!==F&&A.push({type:"text",value:y.value.slice(C,F)}),Array.isArray(j)?A.push(...j):j&&A.push(j),C=F+M[0].length,k=!0),!b.global)break;M=b.exec(y.value)}return k?(C<y.value.length&&A.push({type:"text",value:y.value.slice(C)}),g.children.splice(E,1,...A)):A=[y],E+A.length}}function pz(t){const r=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const a=!t[0]||Array.isArray(t[0])?t:[t];let l=-1;for(;++l<a.length;){const o=a[l];r.push([gz(o[0]),yz(o[1])])}return r}function gz(t){return typeof t=="string"?new RegExp(hz(t),"g"):t}function yz(t){return typeof t=="function"?t:function(){return t}}const gm="phrasing",ym=["autolink","link","image","label"];function xz(){return{transforms:[kz],enter:{literalAutolink:vz,literalAutolinkEmail:xm,literalAutolinkHttp:xm,literalAutolinkWww:xm},exit:{literalAutolink:Cz,literalAutolinkEmail:Nz,literalAutolinkHttp:wz,literalAutolinkWww:Sz}}}function bz(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gm,notInConstruct:ym},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gm,notInConstruct:ym},{character:":",before:"[ps]",after:"\\/",inConstruct:gm,notInConstruct:ym}]}}function vz(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function xm(t){this.config.enter.autolinkProtocol.call(this,t)}function wz(t){this.config.exit.autolinkProtocol.call(this,t)}function Sz(t){this.config.exit.data.call(this,t);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(t)}function Nz(t){this.config.exit.autolinkEmail.call(this,t)}function Cz(t){this.exit(t)}function kz(t){mz(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,jz],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Ez]],{ignore:["link","linkReference"]})}function jz(t,r,a,l,o){let u="";if(!uS(o)||(/^w/i.test(r)&&(a=r+a,r="",u="http://"),!Tz(a)))return!1;const d=Az(a+l);if(!d[0])return!1;const m={type:"link",title:null,url:u+r+d[0],children:[{type:"text",value:r+d[0]}]};return d[1]?[m,{type:"text",value:d[1]}]:m}function Ez(t,r,a,l){return!uS(l,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+a,children:[{type:"text",value:r+"@"+a}]}}function Tz(t){const r=t.split(".");return!(r.length<2||r[r.length-1]&&(/_/.test(r[r.length-1])||!/[a-zA-Z\d]/.test(r[r.length-1]))||r[r.length-2]&&(/_/.test(r[r.length-2])||!/[a-zA-Z\d]/.test(r[r.length-2])))}function Az(t){const r=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!r)return[t,void 0];t=t.slice(0,r.index);let a=r[0],l=a.indexOf(")");const o=F0(t,"(");let u=F0(t,")");for(;l!==-1&&o>u;)t+=a.slice(0,l+1),a=a.slice(l+1),l=a.indexOf(")"),u++;return[t,a]}function uS(t,r){const a=t.input.charCodeAt(t.index-1);return(t.index===0||Ii(a)||nd(a))&&(!r||a!==47)}cS.peek=qz;function Oz(){this.buffer()}function Rz(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Mz(){this.buffer()}function zz(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function Dz(t){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Cr(this.sliceSerialize(t)).toLowerCase(),a.label=r}function _z(t){this.exit(t)}function Lz(t){const r=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Cr(this.sliceSerialize(t)).toLowerCase(),a.label=r}function Uz(t){this.exit(t)}function qz(){return"["}function cS(t,r,a,l){const o=a.createTracker(l);let u=o.move("[^");const d=a.enter("footnoteReference"),m=a.enter("reference");return u+=o.move(a.safe(a.associationId(t),{after:"]",before:u})),m(),d(),u+=o.move("]"),u}function Hz(){return{enter:{gfmFootnoteCallString:Oz,gfmFootnoteCall:Rz,gfmFootnoteDefinitionLabelString:Mz,gfmFootnoteDefinition:zz},exit:{gfmFootnoteCallString:Dz,gfmFootnoteCall:_z,gfmFootnoteDefinitionLabelString:Lz,gfmFootnoteDefinition:Uz}}}function Bz(t){let r=!1;return t&&t.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:cS},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(l,o,u,d){const m=u.createTracker(d);let p=m.move("[^");const y=u.enter("footnoteDefinition"),x=u.enter("label");return p+=m.move(u.safe(u.associationId(l),{before:p,after:"]"})),x(),p+=m.move("]:"),l.children&&l.children.length>0&&(m.shift(4),p+=m.move((r?`
273
+ `:" ")+u.indentLines(u.containerFlow(l,m.current()),r?dS:Iz))),y(),p}}function Iz(t,r,a){return r===0?t:dS(t,r,a)}function dS(t,r,a){return(a?"":" ")+t}const Fz=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];fS.peek=Gz;function Pz(){return{canContainEols:["delete"],enter:{strikethrough:Yz},exit:{strikethrough:Vz}}}function Qz(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Fz}],handlers:{delete:fS}}}function Yz(t){this.enter({type:"delete",children:[]},t)}function Vz(t){this.exit(t)}function fS(t,r,a,l){const o=a.createTracker(l),u=a.enter("strikethrough");let d=o.move("~~");return d+=a.containerPhrasing(t,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),u(),d}function Gz(){return"~"}function Kz(t){return t.length}function Xz(t,r){const a=r||{},l=(a.align||[]).concat(),o=a.stringLength||Kz,u=[],d=[],m=[],p=[];let y=0,x=-1;for(;++x<t.length;){const T=[],E=[];let k=-1;for(t[x].length>y&&(y=t[x].length);++k<t[x].length;){const A=$z(t[x][k]);if(a.alignDelimiters!==!1){const M=o(A);E[k]=M,(p[k]===void 0||M>p[k])&&(p[k]=M)}T.push(A)}d[x]=T,m[x]=E}let g=-1;if(typeof l=="object"&&"length"in l)for(;++g<y;)u[g]=P0(l[g]);else{const T=P0(l);for(;++g<y;)u[g]=T}g=-1;const b=[],w=[];for(;++g<y;){const T=u[g];let E="",k="";T===99?(E=":",k=":"):T===108?E=":":T===114&&(k=":");let A=a.alignDelimiters===!1?1:Math.max(1,p[g]-E.length-k.length);const M=E+"-".repeat(A)+k;a.alignDelimiters!==!1&&(A=E.length+A+k.length,A>p[g]&&(p[g]=A),w[g]=A),b[g]=M}d.splice(1,0,b),m.splice(1,0,w),x=-1;const C=[];for(;++x<d.length;){const T=d[x],E=m[x];g=-1;const k=[];for(;++g<y;){const A=T[g]||"";let M="",F="";if(a.alignDelimiters!==!1){const Q=p[g]-(E[g]||0),j=u[g];j===114?M=" ".repeat(Q):j===99?Q%2?(M=" ".repeat(Q/2+.5),F=" ".repeat(Q/2-.5)):(M=" ".repeat(Q/2),F=M):F=" ".repeat(Q)}a.delimiterStart!==!1&&!g&&k.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&A==="")&&(a.delimiterStart!==!1||g)&&k.push(" "),a.alignDelimiters!==!1&&k.push(M),k.push(A),a.alignDelimiters!==!1&&k.push(F),a.padding!==!1&&k.push(" "),(a.delimiterEnd!==!1||g!==y-1)&&k.push("|")}C.push(a.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return C.join(`
274
+ `)}function $z(t){return t==null?"":String(t)}function P0(t){const r=typeof t=="string"?t.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function Zz(t,r,a,l){const o=a.enter("blockquote"),u=a.createTracker(l);u.move("> "),u.shift(2);const d=a.indentLines(a.containerFlow(t,u.current()),Jz);return o(),d}function Jz(t,r,a){return">"+(a?"":" ")+t}function Wz(t,r){return Q0(t,r.inConstruct,!0)&&!Q0(t,r.notInConstruct,!1)}function Q0(t,r,a){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return a;let l=-1;for(;++l<r.length;)if(t.includes(r[l]))return!0;return!1}function Y0(t,r,a,l){let o=-1;for(;++o<a.unsafe.length;)if(a.unsafe[o].character===`
275
+ `&&Wz(a.stack,a.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
276
+ `}function eD(t,r){const a=String(t);let l=a.indexOf(r),o=l,u=0,d=0;if(typeof r!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++u>d&&(d=u):u=1,o=l+r.length,l=a.indexOf(r,o);return d}function tD(t,r){return!!(r.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function nD(t){const r=t.options.fence||"`";if(r!=="`"&&r!=="~")throw new Error("Cannot serialize code with `"+r+"` for `options.fence`, expected `` ` `` or `~`");return r}function rD(t,r,a,l){const o=nD(a),u=t.value||"",d=o==="`"?"GraveAccent":"Tilde";if(tD(t,a)){const g=a.enter("codeIndented"),b=a.indentLines(u,aD);return g(),b}const m=a.createTracker(l),p=o.repeat(Math.max(eD(u,o)+1,3)),y=a.enter("codeFenced");let x=m.move(p);if(t.lang){const g=a.enter(`codeFencedLang${d}`);x+=m.move(a.safe(t.lang,{before:x,after:" ",encode:["`"],...m.current()})),g()}if(t.lang&&t.meta){const g=a.enter(`codeFencedMeta${d}`);x+=m.move(" "),x+=m.move(a.safe(t.meta,{before:x,after:`
277
+ `,encode:["`"],...m.current()})),g()}return x+=m.move(`
278
+ `),u&&(x+=m.move(u+`
279
+ `)),x+=m.move(p),y(),x}function aD(t,r,a){return(a?"":" ")+t}function Gp(t){const r=t.options.quote||'"';if(r!=='"'&&r!=="'")throw new Error("Cannot serialize title with `"+r+"` for `options.quote`, expected `\"`, or `'`");return r}function iD(t,r,a,l){const o=Gp(a),u=o==='"'?"Quote":"Apostrophe",d=a.enter("definition");let m=a.enter("label");const p=a.createTracker(l);let y=p.move("[");return y+=p.move(a.safe(a.associationId(t),{before:y,after:"]",...p.current()})),y+=p.move("]: "),m(),!t.url||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),y+=p.move("<"),y+=p.move(a.safe(t.url,{before:y,after:">",...p.current()})),y+=p.move(">")):(m=a.enter("destinationRaw"),y+=p.move(a.safe(t.url,{before:y,after:t.title?" ":`
280
+ `,...p.current()}))),m(),t.title&&(m=a.enter(`title${u}`),y+=p.move(" "+o),y+=p.move(a.safe(t.title,{before:y,after:o,...p.current()})),y+=p.move(o),m()),d(),y}function lD(t){const r=t.options.emphasis||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize emphasis with `"+r+"` for `options.emphasis`, expected `*`, or `_`");return r}function Ao(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Ic(t,r,a){const l=ns(t),o=ns(r);return l===void 0?o===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}hS.peek=sD;function hS(t,r,a,l){const o=lD(a),u=a.enter("emphasis"),d=a.createTracker(l),m=d.move(o);let p=d.move(a.containerPhrasing(t,{after:o,before:m,...d.current()}));const y=p.charCodeAt(0),x=Ic(l.before.charCodeAt(l.before.length-1),y,o);x.inside&&(p=Ao(y)+p.slice(1));const g=p.charCodeAt(p.length-1),b=Ic(l.after.charCodeAt(0),g,o);b.inside&&(p=p.slice(0,-1)+Ao(g));const w=d.move(o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},m+p+w}function sD(t,r,a){return a.options.emphasis||"*"}function oD(t,r){let a=!1;return Yp(t,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return a=!0,Km}),!!((!t.depth||t.depth<3)&&qp(t)&&(r.options.setext||a))}function uD(t,r,a,l){const o=Math.max(Math.min(6,t.depth||1),1),u=a.createTracker(l);if(oD(t,a)){const x=a.enter("headingSetext"),g=a.enter("phrasing"),b=a.containerPhrasing(t,{...u.current(),before:`
281
+ `,after:`
282
+ `});return g(),x(),b+`
283
+ `+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
284
+ `))+1))}const d="#".repeat(o),m=a.enter("headingAtx"),p=a.enter("phrasing");u.move(d+" ");let y=a.containerPhrasing(t,{before:"# ",after:`
285
+ `,...u.current()});return/^[\t ]/.test(y)&&(y=Ao(y.charCodeAt(0))+y.slice(1)),y=y?d+" "+y:d,a.options.closeAtx&&(y+=" "+d),p(),m(),y}mS.peek=cD;function mS(t){return t.value||""}function cD(){return"<"}pS.peek=dD;function pS(t,r,a,l){const o=Gp(a),u=o==='"'?"Quote":"Apostrophe",d=a.enter("image");let m=a.enter("label");const p=a.createTracker(l);let y=p.move("![");return y+=p.move(a.safe(t.alt,{before:y,after:"]",...p.current()})),y+=p.move("]("),m(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(m=a.enter("destinationLiteral"),y+=p.move("<"),y+=p.move(a.safe(t.url,{before:y,after:">",...p.current()})),y+=p.move(">")):(m=a.enter("destinationRaw"),y+=p.move(a.safe(t.url,{before:y,after:t.title?" ":")",...p.current()}))),m(),t.title&&(m=a.enter(`title${u}`),y+=p.move(" "+o),y+=p.move(a.safe(t.title,{before:y,after:o,...p.current()})),y+=p.move(o),m()),y+=p.move(")"),d(),y}function dD(){return"!"}gS.peek=fD;function gS(t,r,a,l){const o=t.referenceType,u=a.enter("imageReference");let d=a.enter("label");const m=a.createTracker(l);let p=m.move("![");const y=a.safe(t.alt,{before:p,after:"]",...m.current()});p+=m.move(y+"]["),d();const x=a.stack;a.stack=[],d=a.enter("reference");const g=a.safe(a.associationId(t),{before:p,after:"]",...m.current()});return d(),a.stack=x,u(),o==="full"||!y||y!==g?p+=m.move(g+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function fD(){return"!"}yS.peek=hD;function yS(t,r,a){let l=t.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++u<a.unsafe.length;){const d=a.unsafe[u],m=a.compilePattern(d);let p;if(d.atBreak)for(;p=m.exec(l);){let y=p.index;l.charCodeAt(y)===10&&l.charCodeAt(y-1)===13&&y--,l=l.slice(0,y)+" "+l.slice(p.index+1)}}return o+l+o}function hD(){return"`"}function xS(t,r){const a=qp(t);return!!(!r.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(a===t.url||"mailto:"+a===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}bS.peek=mD;function bS(t,r,a,l){const o=Gp(a),u=o==='"'?"Quote":"Apostrophe",d=a.createTracker(l);let m,p;if(xS(t,a)){const x=a.stack;a.stack=[],m=a.enter("autolink");let g=d.move("<");return g+=d.move(a.containerPhrasing(t,{before:g,after:">",...d.current()})),g+=d.move(">"),m(),a.stack=x,g}m=a.enter("link"),p=a.enter("label");let y=d.move("[");return y+=d.move(a.containerPhrasing(t,{before:y,after:"](",...d.current()})),y+=d.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=a.enter("destinationLiteral"),y+=d.move("<"),y+=d.move(a.safe(t.url,{before:y,after:">",...d.current()})),y+=d.move(">")):(p=a.enter("destinationRaw"),y+=d.move(a.safe(t.url,{before:y,after:t.title?" ":")",...d.current()}))),p(),t.title&&(p=a.enter(`title${u}`),y+=d.move(" "+o),y+=d.move(a.safe(t.title,{before:y,after:o,...d.current()})),y+=d.move(o),p()),y+=d.move(")"),m(),y}function mD(t,r,a){return xS(t,a)?"<":"["}vS.peek=pD;function vS(t,r,a,l){const o=t.referenceType,u=a.enter("linkReference");let d=a.enter("label");const m=a.createTracker(l);let p=m.move("[");const y=a.containerPhrasing(t,{before:p,after:"]",...m.current()});p+=m.move(y+"]["),d();const x=a.stack;a.stack=[],d=a.enter("reference");const g=a.safe(a.associationId(t),{before:p,after:"]",...m.current()});return d(),a.stack=x,u(),o==="full"||!y||y!==g?p+=m.move(g+"]"):o==="shortcut"?p=p.slice(0,-1):p+=m.move("]"),p}function pD(){return"["}function Kp(t){const r=t.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function gD(t){const r=Kp(t),a=t.options.bulletOther;if(!a)return r==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+a+"`) to be different");return a}function yD(t){const r=t.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function wS(t){const r=t.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function xD(t,r,a,l){const o=a.enter("list"),u=a.bulletCurrent;let d=t.ordered?yD(a):Kp(a);const m=t.ordered?d==="."?")":".":gD(a);let p=r&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!t.ordered){const x=t.children?t.children[0]:void 0;if((d==="*"||d==="-")&&x&&(!x.children||!x.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(p=!0),wS(a)===d&&x){let g=-1;for(;++g<t.children.length;){const b=t.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(d=m),a.bulletCurrent=d;const y=a.containerFlow(t,l);return a.bulletLastUsed=d,a.bulletCurrent=u,o(),y}function bD(t){const r=t.options.listItemIndent||"one";if(r!=="tab"&&r!=="one"&&r!=="mixed")throw new Error("Cannot serialize items with `"+r+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return r}function vD(t,r,a,l){const o=bD(a);let u=a.bulletCurrent||Kp(a);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(a.options.incrementListMarker===!1?0:r.children.indexOf(t))+u);let d=u.length+1;(o==="tab"||o==="mixed"&&(r&&r.type==="list"&&r.spread||t.spread))&&(d=Math.ceil(d/4)*4);const m=a.createTracker(l);m.move(u+" ".repeat(d-u.length)),m.shift(d);const p=a.enter("listItem"),y=a.indentLines(a.containerFlow(t,m.current()),x);return p(),y;function x(g,b,w){return b?(w?"":" ".repeat(d))+g:(w?u:u+" ".repeat(d-u.length))+g}}function wD(t,r,a,l){const o=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(t,l);return u(),o(),d}const SD=id(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ND(t,r,a,l){return(t.children.some(function(d){return SD(d)})?a.containerPhrasing:a.containerFlow).call(a,t,l)}function CD(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}SS.peek=kD;function SS(t,r,a,l){const o=CD(a),u=a.enter("strong"),d=a.createTracker(l),m=d.move(o+o);let p=d.move(a.containerPhrasing(t,{after:o,before:m,...d.current()}));const y=p.charCodeAt(0),x=Ic(l.before.charCodeAt(l.before.length-1),y,o);x.inside&&(p=Ao(y)+p.slice(1));const g=p.charCodeAt(p.length-1),b=Ic(l.after.charCodeAt(0),g,o);b.inside&&(p=p.slice(0,-1)+Ao(g));const w=d.move(o+o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},m+p+w}function kD(t,r,a){return a.options.strong||"*"}function jD(t,r,a,l){return a.safe(t.value,l)}function ED(t){const r=t.options.ruleRepetition||3;if(r<3)throw new Error("Cannot serialize rules with repetition `"+r+"` for `options.ruleRepetition`, expected `3` or more");return r}function TD(t,r,a){const l=(wS(a)+(a.options.ruleSpaces?" ":"")).repeat(ED(a));return a.options.ruleSpaces?l.slice(0,-1):l}const NS={blockquote:Zz,break:Y0,code:rD,definition:iD,emphasis:hS,hardBreak:Y0,heading:uD,html:mS,image:pS,imageReference:gS,inlineCode:yS,link:bS,linkReference:vS,list:xD,listItem:vD,paragraph:wD,root:ND,strong:SS,text:jD,thematicBreak:TD};function AD(){return{enter:{table:OD,tableData:V0,tableHeader:V0,tableRow:MD},exit:{codeText:zD,table:RD,tableData:bm,tableHeader:bm,tableRow:bm}}}function OD(t){const r=t._align;this.enter({type:"table",align:r.map(function(a){return a==="none"?null:a}),children:[]},t),this.data.inTable=!0}function RD(t){this.exit(t),this.data.inTable=void 0}function MD(t){this.enter({type:"tableRow",children:[]},t)}function bm(t){this.exit(t)}function V0(t){this.enter({type:"tableCell",children:[]},t)}function zD(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,DD));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(t)}function DD(t,r){return r==="|"?r:t}function _D(t){const r=t||{},a=r.tableCellPadding,l=r.tablePipeAlign,o=r.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
286
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:d,tableCell:p,tableRow:m}};function d(w,C,T,E){return y(x(w,T,E),w.align)}function m(w,C,T,E){const k=g(w,T,E),A=y([k]);return A.slice(0,A.indexOf(`
287
+ `))}function p(w,C,T,E){const k=T.enter("tableCell"),A=T.enter("phrasing"),M=T.containerPhrasing(w,{...E,before:u,after:u});return A(),k(),M}function y(w,C){return Xz(w,{align:C,alignDelimiters:l,padding:a,stringLength:o})}function x(w,C,T){const E=w.children;let k=-1;const A=[],M=C.enter("table");for(;++k<E.length;)A[k]=g(E[k],C,T);return M(),A}function g(w,C,T){const E=w.children;let k=-1;const A=[],M=C.enter("tableRow");for(;++k<E.length;)A[k]=p(E[k],w,C,T);return M(),A}function b(w,C,T){let E=NS.inlineCode(w,C,T);return T.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function LD(){return{exit:{taskListCheckValueChecked:G0,taskListCheckValueUnchecked:G0,paragraph:qD}}}function UD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:HD}}}function G0(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function qD(t){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const l=a.children[0];if(l&&l.type==="text"){const o=r.children;let u=-1,d;for(;++u<o.length;){const m=o[u];if(m.type==="paragraph"){d=m;break}}d===a&&(l.value=l.value.slice(1),l.value.length===0?a.children.shift():a.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,a.position.start=Object.assign({},l.position.start)))}}this.exit(t)}function HD(t,r,a,l){const o=t.children[0],u=typeof t.checked=="boolean"&&o&&o.type==="paragraph",d="["+(t.checked?"x":" ")+"] ",m=a.createTracker(l);u&&m.move(d);let p=NS.listItem(t,r,a,{...l,...m.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,y)),p;function y(x){return x+d}}function BD(){return[xz(),Hz(),Pz(),AD(),LD()]}function ID(t){return{extensions:[bz(),Bz(t),Qz(),_D(t),UD()]}}const FD={tokenize:KD,partial:!0},CS={tokenize:XD,partial:!0},kS={tokenize:$D,partial:!0},jS={tokenize:ZD,partial:!0},PD={tokenize:JD,partial:!0},ES={name:"wwwAutolink",tokenize:VD,previous:AS},TS={name:"protocolAutolink",tokenize:GD,previous:OS},fa={name:"emailAutolink",tokenize:YD,previous:RS},Pr={};function QD(){return{text:Pr}}let Ci=48;for(;Ci<123;)Pr[Ci]=fa,Ci++,Ci===58?Ci=65:Ci===91&&(Ci=97);Pr[43]=fa;Pr[45]=fa;Pr[46]=fa;Pr[95]=fa;Pr[72]=[fa,TS];Pr[104]=[fa,TS];Pr[87]=[fa,ES];Pr[119]=[fa,ES];function YD(t,r,a){const l=this;let o,u;return d;function d(g){return!Jm(g)||!RS.call(l,l.previous)||Xp(l.events)?a(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(g))}function m(g){return Jm(g)?(t.consume(g),m):g===64?(t.consume(g),p):a(g)}function p(g){return g===46?t.check(PD,x,y)(g):g===45||g===95||pn(g)?(u=!0,t.consume(g),p):x(g)}function y(g){return t.consume(g),o=!0,p}function x(g){return u&&o&&Nn(l.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),r(g)):a(g)}}function VD(t,r,a){const l=this;return o;function o(d){return d!==87&&d!==119||!AS.call(l,l.previous)||Xp(l.events)?a(d):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(FD,t.attempt(CS,t.attempt(kS,u),a),a)(d))}function u(d){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(d)}}function GD(t,r,a){const l=this;let o="",u=!1;return d;function d(g){return(g===72||g===104)&&OS.call(l,l.previous)&&!Xp(l.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),t.consume(g),m):a(g)}function m(g){if(Nn(g)&&o.length<5)return o+=String.fromCodePoint(g),t.consume(g),m;if(g===58){const b=o.toLowerCase();if(b==="http"||b==="https")return t.consume(g),p}return a(g)}function p(g){return g===47?(t.consume(g),u?y:(u=!0,p)):a(g)}function y(g){return g===null||qc(g)||Nt(g)||Ii(g)||nd(g)?a(g):t.attempt(CS,t.attempt(kS,x),a)(g)}function x(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(g)}}function KD(t,r,a){let l=0;return o;function o(d){return(d===87||d===119)&&l<3?(l++,t.consume(d),o):d===46&&l===3?(t.consume(d),u):a(d)}function u(d){return d===null?a(d):r(d)}}function XD(t,r,a){let l,o,u;return d;function d(y){return y===46||y===95?t.check(jS,p,m)(y):y===null||Nt(y)||Ii(y)||y!==45&&nd(y)?p(y):(u=!0,t.consume(y),d)}function m(y){return y===95?l=!0:(o=l,l=void 0),t.consume(y),d}function p(y){return o||l||!u?a(y):r(y)}}function $D(t,r){let a=0,l=0;return o;function o(d){return d===40?(a++,t.consume(d),o):d===41&&l<a?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?t.check(jS,r,u)(d):d===null||Nt(d)||Ii(d)?r(d):(t.consume(d),o)}function u(d){return d===41&&l++,t.consume(d),o}}function ZD(t,r,a){return l;function l(m){return m===33||m===34||m===39||m===41||m===42||m===44||m===46||m===58||m===59||m===63||m===95||m===126?(t.consume(m),l):m===38?(t.consume(m),u):m===93?(t.consume(m),o):m===60||m===null||Nt(m)||Ii(m)?r(m):a(m)}function o(m){return m===null||m===40||m===91||Nt(m)||Ii(m)?r(m):l(m)}function u(m){return Nn(m)?d(m):a(m)}function d(m){return m===59?(t.consume(m),l):Nn(m)?(t.consume(m),d):a(m)}}function JD(t,r,a){return l;function l(u){return t.consume(u),o}function o(u){return pn(u)?a(u):r(u)}}function AS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Nt(t)}function OS(t){return!Nn(t)}function RS(t){return!(t===47||Jm(t))}function Jm(t){return t===43||t===45||t===46||t===95||pn(t)}function Xp(t){let r=t.length,a=!1;for(;r--;){const l=t[r][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){a=!0;break}if(l._gfmAutolinkLiteralWalkedInto){a=!1;break}}return t.length>0&&!a&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const WD={tokenize:s_,partial:!0};function e_(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:a_,continuation:{tokenize:i_},exit:l_}},text:{91:{name:"gfmFootnoteCall",tokenize:r_},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:t_,resolveTo:n_}}}}function t_(t,r,a){const l=this;let o=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;o--;){const p=l.events[o][1];if(p.type==="labelImage"){d=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return m;function m(p){if(!d||!d._balanced)return a(p);const y=Cr(l.sliceSerialize({start:d.end,end:l.now()}));return y.codePointAt(0)!==94||!u.includes(y.slice(1))?a(p):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),r(p))}}function n_(t,r){let a=t.length;for(;a--;)if(t[a][1].type==="labelImage"&&t[a][0]==="enter"){t[a][1];break}t[a+1][1].type="data",t[a+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},t[a+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[a+3][1].end),end:Object.assign({},t[a+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},m=[t[a+1],t[a+2],["enter",l,r],t[a+3],t[a+4],["enter",o,r],["exit",o,r],["enter",u,r],["enter",d,r],["exit",d,r],["exit",u,r],t[t.length-2],t[t.length-1],["exit",l,r]];return t.splice(a,t.length-a+1,...m),t}function r_(t,r,a){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=0,d;return m;function m(g){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),p}function p(g){return g!==94?a(g):(t.enter("gfmFootnoteCallMarker"),t.consume(g),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",y)}function y(g){if(u>999||g===93&&!d||g===null||g===91||Nt(g))return a(g);if(g===93){t.exit("chunkString");const b=t.exit("gfmFootnoteCallString");return o.includes(Cr(l.sliceSerialize(b)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(g),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),r):a(g)}return Nt(g)||(d=!0),u++,t.consume(g),g===92?x:y}function x(g){return g===91||g===92||g===93?(t.consume(g),u++,y):y(g)}}function a_(t,r,a){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,d=0,m;return p;function p(C){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),y}function y(C){return C===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",x):a(C)}function x(C){if(d>999||C===93&&!m||C===null||C===91||Nt(C))return a(C);if(C===93){t.exit("chunkString");const T=t.exit("gfmFootnoteDefinitionLabelString");return u=Cr(l.sliceSerialize(T)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return Nt(C)||(m=!0),d++,t.consume(C),C===92?g:x}function g(C){return C===91||C===92||C===93?(t.consume(C),d++,x):x(C)}function b(C){return C===58?(t.enter("definitionMarker"),t.consume(C),t.exit("definitionMarker"),o.includes(u)||o.push(u),it(t,w,"gfmFootnoteDefinitionWhitespace")):a(C)}function w(C){return r(C)}}function i_(t,r,a){return t.check(Go,r,t.attempt(WD,r,a))}function l_(t){t.exit("gfmFootnoteDefinition")}function s_(t,r,a){const l=this;return it(t,o,"gfmFootnoteDefinitionIndent",5);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?r(u):a(u)}}function o_(t){let a=(t||{}).singleTilde;const l={name:"strikethrough",tokenize:u,resolveAll:o};return a==null&&(a=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(d,m){let p=-1;for(;++p<d.length;)if(d[p][0]==="enter"&&d[p][1].type==="strikethroughSequenceTemporary"&&d[p][1]._close){let y=p;for(;y--;)if(d[y][0]==="exit"&&d[y][1].type==="strikethroughSequenceTemporary"&&d[y][1]._open&&d[p][1].end.offset-d[p][1].start.offset===d[y][1].end.offset-d[y][1].start.offset){d[p][1].type="strikethroughSequence",d[y][1].type="strikethroughSequence";const x={type:"strikethrough",start:Object.assign({},d[y][1].start),end:Object.assign({},d[p][1].end)},g={type:"strikethroughText",start:Object.assign({},d[y][1].end),end:Object.assign({},d[p][1].start)},b=[["enter",x,m],["enter",d[y][1],m],["exit",d[y][1],m],["enter",g,m]],w=m.parser.constructs.insideSpan.null;w&&$n(b,b.length,0,rd(w,d.slice(y+1,p),m)),$n(b,b.length,0,[["exit",g,m],["enter",d[p][1],m],["exit",d[p][1],m],["exit",x,m]]),$n(d,y-1,p-y+3,b),p=y+b.length-2;break}}for(p=-1;++p<d.length;)d[p][1].type==="strikethroughSequenceTemporary"&&(d[p][1].type="data");return d}function u(d,m,p){const y=this.previous,x=this.events;let g=0;return b;function b(C){return y===126&&x[x.length-1][1].type!=="characterEscape"?p(C):(d.enter("strikethroughSequenceTemporary"),w(C))}function w(C){const T=ns(y);if(C===126)return g>1?p(C):(d.consume(C),g++,w);if(g<2&&!a)return p(C);const E=d.exit("strikethroughSequenceTemporary"),k=ns(C);return E._open=!k||k===2&&!!T,E._close=!T||T===2&&!!k,m(C)}}}class u_{constructor(){this.map=[],this.index=new Map}add(r,a,l){c_(this,r,a,l)}consume(r){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const l=[];for(;a>0;)a-=1,l.push(r.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),r.length=this.map[a][0];l.push(r.slice()),r.length=0;let o=l.pop();for(;o;){for(const u of o)r.push(u);o=l.pop()}this.map.length=0,this.index.clear()}}function c_(t,r,a,l){if(a===0&&l.length===0)return;const o=t.index.get(r);if(o){o[1]+=a,o[2].push(...l);return}const u=[r,a,l];t.map.push(u),t.index.set(r,u)}function d_(t,r){let a=!1;const l=[];for(;r<t.length;){const o=t[r];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(t[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(t[r-1][1].type==="tableDelimiterMarker"){const u=l.length-1;l[u]=l[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);r+=1}return l}function f_(){return{flow:{null:{name:"table",tokenize:h_,resolveAll:m_}}}}function h_(t,r,a){const l=this;let o=0,u=0,d;return m;function m(z){let le=l.events.length-1;for(;le>-1;){const{type:ie}=l.events[le][1];if(ie==="lineEnding"||ie==="linePrefix")le--;else break}const I=le>-1?l.events[le][1].type:null,ee=I==="tableHead"||I==="tableRow"?j:p;return ee===j&&l.parser.lazy[l.now().line]?a(z):ee(z)}function p(z){return t.enter("tableHead"),t.enter("tableRow"),y(z)}function y(z){return z===124||(d=!0,u+=1),x(z)}function x(z){return z===null?a(z):ze(z)?u>1?(u=0,l.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),w):a(z):Ze(z)?it(t,x,"whitespace")(z):(u+=1,d&&(d=!1,o+=1),z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),d=!0,x):(t.enter("data"),g(z)))}function g(z){return z===null||z===124||Nt(z)?(t.exit("data"),x(z)):(t.consume(z),z===92?b:g)}function b(z){return z===92||z===124?(t.consume(z),g):g(z)}function w(z){return l.interrupt=!1,l.parser.lazy[l.now().line]?a(z):(t.enter("tableDelimiterRow"),d=!1,Ze(z)?it(t,C,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):C(z))}function C(z){return z===45||z===58?E(z):z===124?(d=!0,t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),T):Q(z)}function T(z){return Ze(z)?it(t,E,"whitespace")(z):E(z)}function E(z){return z===58?(u+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),k):z===45?(u+=1,k(z)):z===null||ze(z)?F(z):Q(z)}function k(z){return z===45?(t.enter("tableDelimiterFiller"),A(z)):Q(z)}function A(z){return z===45?(t.consume(z),A):z===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(z),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(z))}function M(z){return Ze(z)?it(t,F,"whitespace")(z):F(z)}function F(z){return z===124?C(z):z===null||ze(z)?!d||o!==u?Q(z):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(z)):Q(z)}function Q(z){return a(z)}function j(z){return t.enter("tableRow"),L(z)}function L(z){return z===124?(t.enter("tableCellDivider"),t.consume(z),t.exit("tableCellDivider"),L):z===null||ze(z)?(t.exit("tableRow"),r(z)):Ze(z)?it(t,L,"whitespace")(z):(t.enter("data"),$(z))}function $(z){return z===null||z===124||Nt(z)?(t.exit("data"),L(z)):(t.consume(z),z===92?W:$)}function W(z){return z===92||z===124?(t.consume(z),$):$(z)}}function m_(t,r){let a=-1,l=!0,o=0,u=[0,0,0,0],d=[0,0,0,0],m=!1,p=0,y,x,g;const b=new u_;for(;++a<t.length;){const w=t[a],C=w[1];w[0]==="enter"?C.type==="tableHead"?(m=!1,p!==0&&(K0(b,r,p,y,x),x=void 0,p=0),y={type:"table",start:Object.assign({},C.start),end:Object.assign({},C.end)},b.add(a,0,[["enter",y,r]])):C.type==="tableRow"||C.type==="tableDelimiterRow"?(l=!0,g=void 0,u=[0,0,0,0],d=[0,a+1,0,0],m&&(m=!1,x={type:"tableBody",start:Object.assign({},C.start),end:Object.assign({},C.end)},b.add(a,0,[["enter",x,r]])),o=C.type==="tableDelimiterRow"?2:x?3:1):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")?(l=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],g=Oc(b,r,u,o,void 0,g),u=[0,0,0,0]),d[2]=a)):C.type==="tableCellDivider"&&(l?l=!1:(u[1]!==0&&(d[0]=d[1],g=Oc(b,r,u,o,void 0,g)),u=d,d=[u[1],a,0,0])):C.type==="tableHead"?(m=!0,p=a):C.type==="tableRow"||C.type==="tableDelimiterRow"?(p=a,u[1]!==0?(d[0]=d[1],g=Oc(b,r,u,o,a,g)):d[1]!==0&&(g=Oc(b,r,d,o,a,g)),o=0):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(d[3]=a)}for(p!==0&&K0(b,r,p,y,x),b.consume(r.events),a=-1;++a<r.events.length;){const w=r.events[a];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=d_(r.events,a))}return t}function Oc(t,r,a,l,o,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(u.end=Object.assign({},Ul(r.events,a[0])),t.add(a[0],0,[["exit",u,r]]));const p=Ul(r.events,a[1]);if(u={type:d,start:Object.assign({},p),end:Object.assign({},p)},t.add(a[1],0,[["enter",u,r]]),a[2]!==0){const y=Ul(r.events,a[2]),x=Ul(r.events,a[3]),g={type:m,start:Object.assign({},y),end:Object.assign({},x)};if(t.add(a[2],0,[["enter",g,r]]),l!==2){const b=r.events[a[2]],w=r.events[a[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",a[3]>a[2]+1){const C=a[2]+1,T=a[3]-a[2]-1;t.add(C,T,[])}}t.add(a[3]+1,0,[["exit",g,r]])}return o!==void 0&&(u.end=Object.assign({},Ul(r.events,o)),t.add(o,0,[["exit",u,r]]),u=void 0),u}function K0(t,r,a,l,o){const u=[],d=Ul(r.events,a);o&&(o.end=Object.assign({},d),u.push(["exit",o,r])),l.end=Object.assign({},d),u.push(["exit",l,r]),t.add(a+1,0,u)}function Ul(t,r){const a=t[r],l=a[0]==="enter"?"start":"end";return a[1][l]}const p_={name:"tasklistCheck",tokenize:y_};function g_(){return{text:{91:p_}}}function y_(t,r,a){const l=this;return o;function o(p){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?a(p):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),u)}function u(p){return Nt(p)?(t.enter("taskListCheckValueUnchecked"),t.consume(p),t.exit("taskListCheckValueUnchecked"),d):p===88||p===120?(t.enter("taskListCheckValueChecked"),t.consume(p),t.exit("taskListCheckValueChecked"),d):a(p)}function d(p){return p===93?(t.enter("taskListCheckMarker"),t.consume(p),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),m):a(p)}function m(p){return ze(p)?r(p):Ze(p)?t.check({tokenize:x_},r,a)(p):a(p)}}function x_(t,r,a){return it(t,l,"whitespace");function l(o){return o===null?a(o):r(o)}}function b_(t){return Iw([QD(),e_(),o_(t),f_(),g_()])}const v_={};function w_(t){const r=this,a=t||v_,l=r.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(b_(a)),u.push(BD()),d.push(ID(a))}function MS(t){const r=t?"underline underline-offset-2":"text-blue-600 dark:text-blue-400 underline underline-offset-2";return{p:({children:a})=>c.jsx("p",{className:"whitespace-pre-wrap break-words [&:not(:first-child)]:mt-2",children:a}),a:({href:a,children:l})=>c.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer nofollow",className:r,children:l}),img:({alt:a})=>c.jsxs("span",{className:"italic opacity-80",children:["[image",a?`: ${a}`:"","]"]}),h1:({children:a})=>c.jsx("h1",{className:"text-base font-bold mt-3 mb-1 first:mt-0",children:a}),h2:({children:a})=>c.jsx("h2",{className:"text-base font-semibold mt-3 mb-1 first:mt-0",children:a}),h3:({children:a})=>c.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1 first:mt-0",children:a}),h4:({children:a})=>c.jsx("h4",{className:"text-sm font-semibold mt-2 mb-1 first:mt-0",children:a}),h5:({children:a})=>c.jsx("h5",{className:"text-sm font-medium mt-2 mb-1 first:mt-0",children:a}),h6:({children:a})=>c.jsx("h6",{className:"text-sm font-medium mt-2 mb-1 first:mt-0",children:a}),ul:({children:a})=>c.jsx("ul",{className:"list-disc pl-5 mt-2 first:mt-0 space-y-0.5",children:a}),ol:({children:a})=>c.jsx("ol",{className:"list-decimal pl-5 mt-2 first:mt-0 space-y-0.5",children:a}),li:({children:a})=>c.jsx("li",{className:"break-words",children:a}),blockquote:({children:a})=>c.jsx("blockquote",{className:"border-l-2 border-current/40 pl-3 mt-2 first:mt-0 opacity-90",children:a}),hr:()=>c.jsx("hr",{className:"my-3 border-current/30"}),pre:({children:a})=>c.jsx("pre",{className:"mt-2 first:mt-0 overflow-x-auto rounded-md bg-black/15 p-2 text-xs leading-snug [&>code]:bg-transparent [&>code]:p-0",children:a}),code:({children:a})=>c.jsx("code",{className:"rounded bg-black/10 px-1 py-0.5 font-mono text-[0.85em]",children:a}),table:({children:a})=>c.jsx("div",{className:"mt-2 first:mt-0 overflow-x-auto",children:c.jsx("table",{className:"border-collapse text-xs",children:a})}),th:({children:a})=>c.jsx("th",{className:"border border-current/30 px-2 py-1 text-left font-semibold",children:a}),td:({children:a})=>c.jsx("td",{className:"border border-current/30 px-2 py-1",children:a})}}const S_=MS(!1),N_=MS(!0),zS=S.memo(function({children:r,inverted:a=!1}){return c.jsx(oz,{remarkPlugins:[w_],components:a?N_:S_,children:r})});function DS(t,r=!0){return Cn({queryKey:["attachment-blob",t],queryFn:()=>ue.attachments.blob(t),enabled:r,staleTime:1/0,gcTime:5*6e4})}function _S(t,r){const[a,l]=S.useState(null);return S.useEffect(()=>{if(!t){l(null);return}const o=URL.createObjectURL(r&&t.type!==r?t.slice(0,t.size,r):t);return l(o),()=>URL.revokeObjectURL(o)},[t,r]),a}const X0=5;function $p(t){return t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const C_=t=>t.kind==="image"||t.kind==="pdf"||t.kind==="text";async function LS(t){const r=await ue.attachments.blob(t.id),a=URL.createObjectURL(new Blob([r],{type:"application/octet-stream"})),l=document.createElement("a");l.href=a,l.download=t.name,document.body.append(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e4)}const $0=2e5;function k_({attachment:t,onClose:r}){const{data:a,error:l,isLoading:o}=DS(t.id),u=_S(a,t.kind==="pdf"?"application/pdf":void 0),[d,m]=S.useState(null),[p,y]=S.useState("");S.useEffect(()=>{if(t.kind!=="text"||!a)return;let g=!0;return a.text().then(b=>g&&m(b)),()=>{g=!1}},[t.kind,a]);async function x(){y("");try{await LS(t)}catch(g){y(g instanceof Error?g.message:"Download failed")}}return c.jsxs(da,{title:t.name,onClose:r,width:"w-[48rem] max-w-[95vw]",children:[c.jsxs("div",{className:"mb-3 min-h-24",children:[o&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}),l&&c.jsx("p",{role:"alert",className:"text-sm text-destructive",children:l instanceof Error?l.message:"Could not load the file"}),a&&t.kind==="image"&&u&&c.jsx("img",{src:u,alt:t.name,className:"max-h-[70vh] max-w-full mx-auto rounded"}),a&&t.kind==="pdf"&&u&&c.jsx("object",{data:u,type:"application/pdf","aria-label":t.name,className:"w-full h-[70vh]",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"This browser cannot show the PDF here. Download it instead."})}),a&&t.kind==="text"&&d!==null&&c.jsxs(c.Fragment,{children:[c.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words max-h-[70vh] overflow-auto rounded border bg-muted p-3",children:d.slice(0,$0)}),d.length>$0&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Only the beginning is shown. Download the file to read all of it."})]})]}),p&&c.jsx("p",{role:"alert",className:"text-xs text-destructive mb-2",children:p}),c.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[c.jsx("span",{className:"mr-auto text-xs text-muted-foreground",children:$p(t.size)}),c.jsx("button",{type:"button",onClick:()=>void x(),className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent transition-colors",children:"Download"}),c.jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Close"})]})]})}function j_({attachments:t,alignEnd:r}){const[a,l]=S.useState(null);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:`flex flex-wrap gap-2 mb-1 ${r?"justify-end":""}`,children:t.map(o=>o.kind==="image"?c.jsx(E_,{attachment:o,onOpen:()=>l(o)},o.id):c.jsx(US,{attachment:o,onOpen:()=>l(o)},o.id))}),a&&c.jsx(k_,{attachment:a,onClose:()=>l(null)})]})}function E_({attachment:t,onOpen:r}){const{data:a,error:l}=DS(t.id),o=_S(a);return l?c.jsx(US,{attachment:t,onOpen:r,unavailable:!0}):o?c.jsx("button",{type:"button",onClick:r,"aria-label":`Preview ${t.name}`,className:"rounded-lg overflow-hidden border focus:outline-none focus:ring-2 focus:ring-ring",children:c.jsx("img",{src:o,alt:t.name,className:"max-h-48 max-w-full object-cover"})}):c.jsx("div",{role:"img","aria-label":`Loading ${t.name}`,className:"h-24 w-32 rounded-lg bg-muted animate-pulse"})}function US({attachment:t,onOpen:r,unavailable:a}){const[l,o]=S.useState(""),u=C_(t),d=t.kind==="text"||t.kind==="pdf"?LE:UE;async function m(){if(u)return r();o("");try{await LS(t)}catch(p){o(p instanceof Error?p.message:"Download failed")}}return c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("button",{type:"button",onClick:()=>void m(),"aria-label":`${u?"Preview":"Download"} ${t.name}`,className:"flex items-center gap-2 max-w-[16rem] rounded-lg border bg-background px-3 py-2 text-left text-foreground hover:bg-accent transition-colors focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx(d,{size:18,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block truncate text-sm",children:t.name}),c.jsx("span",{className:"block text-xs text-muted-foreground",children:a?"Could not be loaded":$p(t.size)})]})]}),l&&c.jsx("span",{role:"alert",className:"text-xs text-destructive mt-0.5",children:l})]})}function T_({messageId:t,text:r}){const[a,l]=S.useState(!1);S.useEffect(()=>l(Bm()),[]);const o=Im(p=>p.speakingId===t),{speak:u,stop:d}=Im();if(!a)return null;const m=o?"Stop reading aloud":"Read aloud";return c.jsx("button",{type:"button",onClick:()=>o?d():u(t,r),"aria-label":m,"aria-pressed":o,title:m,className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:o?c.jsx(ew,{size:12}):c.jsx(JE,{size:12})})}function A_({agentName:t,disabled:r,onSend:a}){const[l,o]=S.useState(!1),[u,d]=S.useState(""),[m,p]=S.useState(!1),[y,x]=S.useState("");async function g(){const b=u.trim();if(!(!b||m)){p(!0),x("");try{await a(b),o(!1),d("")}catch(w){x(w instanceof Error?w.message:"Failed to send")}finally{p(!1)}}}return l?c.jsxs("div",{className:"mt-1 max-w-xs",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("input",{autoFocus:!0,value:u,disabled:m,onChange:b=>d(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),g()),b.key==="Escape"&&(b.preventDefault(),o(!1))},onBlur:()=>{!m&&u.trim()===""&&o(!1)},"aria-label":`Reply to ${t}`,placeholder:`Reply to ${t}…`,className:"min-w-0 flex-1 rounded-md border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50"}),c.jsx("button",{type:"button",onClick:g,disabled:m||u.trim()==="",className:"shrink-0 rounded-md bg-primary px-2 py-1 text-xs text-primary-foreground hover:opacity-90 disabled:opacity-40 transition-opacity",children:m?"…":"Send"})]}),y&&c.jsx("p",{role:"alert",className:"mt-0.5 text-[11px] text-destructive",children:y})]}):c.jsxs("button",{type:"button",onClick:()=>o(!0),disabled:r,className:"mt-0.5 flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[c.jsx(DE,{size:11}),"Reply to ",t]})}function Rc(...t){return Yo(Qo(t))}function O_({message:t,onJumpTo:r,jumpTargets:a}){var p;const l=(p=t.metadata)==null?void 0:p.forward;if(!l)return null;const o=P3(l),u=y=>r!==void 0&&(a==null?void 0:a.has(y))===!0,d=o.find(y=>u(y.messageId)),m=c.jsxs(c.Fragment,{children:[c.jsx(X1,{size:12,"aria-hidden":"true"}),"Forwarded to ",l.agentName,o.length>1&&c.jsxs("span",{className:"font-normal",children:["· ",o.length," messages"]})]});return c.jsxs("div",{className:"mb-1 max-w-full rounded-lg border-l-4 border-primary/60 bg-muted/60 px-3 py-1.5 text-xs",children:[d?c.jsx("button",{type:"button",onClick:()=>r(d.messageId),title:"Go to the original message",className:"flex items-center gap-1 font-medium text-muted-foreground hover:text-foreground hover:underline",children:m}):c.jsx("p",{className:"flex items-center gap-1 font-medium text-muted-foreground",children:m}),c.jsx("div",{className:"max-h-48 overflow-y-auto",children:o.map(y=>{const x=c.jsxs(c.Fragment,{children:[y.senderName?c.jsxs("span",{className:"font-medium",children:[y.senderName,": "]}):null,c.jsx("span",{className:"whitespace-pre-wrap break-words",children:y.content})]});return u(y.messageId)?c.jsx("button",{type:"button",onClick:()=>r(y.messageId),title:"Go to the original message",className:"mt-0.5 block w-full text-left text-muted-foreground hover:text-foreground hover:underline",children:x},y.messageId):c.jsx("p",{className:"mt-0.5 text-muted-foreground",children:x},y.messageId)})})]})}function R_({message:t,conversationType:r,currentUserId:a,onForward:l,selecting:o,selected:u,onToggleSelect:d,onJumpTo:m,jumpTargets:p,canReply:y,replyDisabled:x,onAgentReply:g}){const b=Eo(new Date(t.createdAt),"HH:mm");if(t.role==="system"||t.role==="tool")return c.jsx("div",{className:"flex justify-center my-1",children:c.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-3 py-1 rounded-full",children:t.content})});const w=r==="human",C=t.role==="user"&&(!w||t.senderId===a||t.senderId==="me"),T=C?null:t.senderName??(w?t.role==="assistant"?"Assistant":"Someone":"KAI"),E=Hm(t),k=l!==void 0&&E&&!o,A=c.jsxs("div",{className:Rc("flex gap-2 mb-3",C?"flex-row-reverse":"flex-row"),children:[c.jsx("div",{className:"mt-0.5",children:c.jsx(ed,{name:C?"U":T,avatarUrl:t.senderAvatarUrl})}),c.jsxs("div",{className:Rc("flex flex-col max-w-[85%] sm:max-w-[70%]",C&&"items-end"),children:[c.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[T&&c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:T}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:b}),!C&&t.content!==""&&c.jsx(T_,{messageId:t.id,text:t.content}),k&&c.jsx("button",{type:"button",onClick:()=>l(t),"aria-label":"Forward to an agent",title:"Forward to an agent",className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:c.jsx(X1,{size:12})})]}),c.jsx(O_,{message:t,onJumpTo:m,jumpTargets:p}),t.attachments&&t.attachments.length>0&&c.jsx(j_,{attachments:t.attachments,alignEnd:C}),t.content!==""&&c.jsx("div",{className:Rc("px-3 py-2 rounded-2xl text-sm leading-relaxed min-w-0 break-words",C?"bg-blue-600 text-white rounded-tr-sm":"bg-muted text-foreground rounded-tl-sm"),children:c.jsx(zS,{inverted:C,children:t.content})}),y&&g&&c.jsx(A_,{agentName:t.senderName??"this agent",disabled:x,onSend:M=>g(t,M)})]})]});return o?c.jsxs("div",{className:Rc("flex items-start gap-2 -mx-2 px-2 rounded-md",u&&"bg-accent/60"),children:[c.jsx("div",{className:"w-5 shrink-0 pt-1.5",children:E&&d&&c.jsx("input",{type:"checkbox",checked:u===!0,onChange:()=>d(t),"aria-label":"Select message",className:"h-4 w-4 accent-primary cursor-pointer"})}),c.jsx("div",{className:"min-w-0 flex-1",children:A})]}):A}function M_({content:t,name:r="KAI"}){return c.jsxs("div",{className:"flex gap-2 mb-3",children:[c.jsx("div",{className:"w-7 h-7 rounded-full bg-muted flex items-center justify-center text-xs font-semibold shrink-0 mt-0.5",children:r.charAt(0).toUpperCase()}),c.jsxs("div",{className:"flex flex-col max-w-[85%] sm:max-w-[70%]",children:[c.jsx("div",{className:"flex items-center gap-1.5 mb-0.5",children:c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r})}),c.jsxs("div",{className:"px-3 py-2 rounded-2xl rounded-tl-sm text-sm leading-relaxed bg-muted text-foreground",children:[c.jsx(zS,{children:t}),c.jsx("span",{className:"inline-block w-1.5 h-4 ml-0.5 bg-current opacity-70 animate-pulse align-middle"})]})]})]})}function z_({messages:t,streaming:r,streamingName:a,executionRunning:l,conversationType:o,currentUserId:u,onForward:d,selecting:m,selectedIds:p,onToggleSelect:y,replyTargets:x,replyDisabled:g,onAgentReply:b}){const w=S.useRef(null),C=S.useRef(new Map),[T,E]=S.useState(null),k=S.useRef(void 0),A=S.useMemo(()=>new Set(t.map(F=>F.id)),[t]);S.useEffect(()=>()=>clearTimeout(k.current),[]);function M(F){const Q=C.current.get(F);Q&&(Q.scrollIntoView({behavior:"smooth",block:"center"}),E(F),clearTimeout(k.current),k.current=setTimeout(()=>E(null),2e3))}return S.useEffect(()=>{var F;(F=w.current)==null||F.scrollIntoView({behavior:"smooth"})},[t,r]),c.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:[t.map(F=>c.jsx("div",{"data-message-id":F.id,ref:Q=>{Q?C.current.set(F.id,Q):C.current.delete(F.id)},className:T===F.id?"rounded-md ring-2 ring-primary/60 transition-shadow":"rounded-md transition-shadow",children:c.jsx(R_,{message:F,conversationType:o,currentUserId:u,onForward:d,selecting:m,selected:(p==null?void 0:p.includes(F.id))??!1,onToggleSelect:y,onJumpTo:M,jumpTargets:A,canReply:(x==null?void 0:x.has(F.id))??!1,replyDisabled:g,onAgentReply:b})},F.id)),r&&c.jsx(M_,{content:r,...a?{name:a}:{}}),l&&!r&&c.jsxs("div",{className:"flex gap-2 mb-3",children:[c.jsx("div",{className:"w-7 h-7 rounded-full bg-muted flex items-center justify-center text-xs font-semibold shrink-0"}),c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-2xl rounded-tl-sm bg-muted text-muted-foreground text-sm",children:[c.jsx("span",{className:"inline-block w-3 h-3 border-2 border-muted-foreground border-t-transparent rounded-full animate-spin"}),"Agent is working..."]})]}),c.jsx("div",{ref:w})]})}const D_=5*6e4,__=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"];function Z0(){var t;return typeof window<"u"&&typeof MediaRecorder<"u"&&typeof navigator<"u"&&typeof((t=navigator.mediaDevices)==null?void 0:t.getUserMedia)=="function"}function L_(t){const r=t instanceof Error?t.name:"";return r==="NotAllowedError"||r==="SecurityError"?"Microphone access was blocked. Allow it for this site (or app) to record.":r==="NotFoundError"||r==="OverconstrainedError"?"No microphone was found.":"The microphone could not be started."}function U_(t,r){const[a,l]=S.useState(!1),[o,u]=S.useState("idle"),[d,m]=S.useState(null),p=S.useRef(null),y=S.useRef(null),x=S.useRef(null),g=S.useRef(0),b=S.useRef(!1),w=S.useRef({transcribe:t,onText:r});w.current={transcribe:t,onText:r},S.useEffect(()=>l(Z0()),[]);const C=S.useCallback(()=>{var A;x.current&&clearTimeout(x.current),x.current=null,(A=y.current)==null||A.getTracks().forEach(M=>M.stop()),y.current=null},[]),T=S.useCallback(()=>{g.current++;const A=p.current;p.current=null,A&&(A.ondataavailable=null,A.onstop=null,A.onerror=null,A.state!=="inactive"&&A.stop()),C(),b.current=!1,u("idle")},[C]);S.useEffect(()=>T,[T]);const E=S.useCallback(async()=>{if(!Z0()||!w.current.transcribe||p.current||b.current)return;m(null),b.current=!0;const A=++g.current;let M;try{M=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(L){g.current===A&&(b.current=!1,m(L_(L)));return}if(g.current!==A){M.getTracks().forEach(L=>L.stop());return}b.current=!1;const F=__.find(L=>{var $;return($=MediaRecorder.isTypeSupported)==null?void 0:$.call(MediaRecorder,L)});let Q;try{Q=new MediaRecorder(M,F?{mimeType:F}:void 0)}catch{M.getTracks().forEach(L=>L.stop()),m("Recording is not supported here.");return}const j=[];Q.ondataavailable=L=>{L.data.size>0&&j.push(L.data)},Q.onerror=()=>{T(),m("The recording failed.")},Q.onstop=()=>{if(C(),p.current=null,g.current!==A)return;const L=new Blob(j,{type:Q.mimeType||F||"audio/webm"});if(L.size===0){u("idle"),m("Nothing was recorded.");return}u("transcribing"),w.current.transcribe(L).then($=>{g.current===A&&(u("idle"),$.trim()===""?m("No speech was heard."):w.current.onText($.trim()))},$=>{g.current===A&&(u("idle"),m($ instanceof Error&&$.message?$.message:"The recording could not be transcribed."))})},y.current=M,p.current=Q,Q.start(),u("recording"),x.current=setTimeout(()=>{p.current===Q&&Q.state==="recording"&&Q.stop()},D_)},[T,C]),k=S.useCallback(()=>{const A=p.current;A&&A.state==="recording"&&A.stop()},[]);return{available:a&&t!==void 0,state:o,error:d,start:E,stop:k,cancel:T}}function q_(t){return!t.startsWith("@")||t.includes(`
288
+ `)?null:t.slice(1)}function H_(t,r){const a=r.toLowerCase();return t.filter(l=>l.name.toLowerCase().startsWith(a)).sort((l,o)=>l.name.localeCompare(o.name))}function B_(t,r){if(!t.startsWith("@"))return null;const a=t.slice(1),l=a.toLowerCase();for(const o of[...r].sort((u,d)=>d.name.length-u.name.length)){const u=o.name.toLowerCase();if(u===""||!l.startsWith(u))continue;const d=a[u.length];if(d===void 0||/\s/.test(d))return{agent:o,note:a.slice(u.length).trim()}}return null}function I_(t,r,a){const l=q_(t),o=l!==null?H_(a,l):[];return Nw(l,o,u=>r(`@${u.name} `))}function F_({id:t,matches:r,activeIndex:a,onChoose:l}){return c.jsx("ul",{id:t,role:"listbox","aria-label":"Agents",className:"absolute bottom-full left-0 z-10 mb-1 max-h-48 w-72 overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md",children:r.map((o,u)=>c.jsxs("li",{role:"option","aria-selected":u===a,onMouseDown:d=>{d.preventDefault(),l(o)},className:`cursor-pointer px-3 py-1.5 text-sm ${u===a?"bg-accent":""}`,children:[c.jsxs("div",{className:"font-medium",children:["@",o.name]}),o.description&&c.jsx("div",{className:"truncate text-xs text-muted-foreground",children:o.description})]},o.id))})}const J0=[];function P_({onSend:t,disabled:r,onUpload:a,onDiscard:l,onTranscribe:o,skills:u=[],agents:d=J0,forwardCount:m=0,onForward:p,onMentionChange:y}){const[x,g]=S.useState(""),[b,w]=S.useState([]),[C,T]=S.useState(""),[E,k]=S.useState(!1),A=S.useRef(null),M=S.useRef(null),F=S.useRef(0),Q=S.useRef(new Set),j=Op(x,g,u),L=I_(x,g,p?d:J0),[$,W]=S.useState(!1),z=p?B_(x,d):null,le=p!==void 0&&x.startsWith("@"),I=S.useRef(y);I.current=y,S.useEffect(()=>{var se;(se=I.current)==null||se.call(I,le)},[le]);const ee=U_(o,se=>{g(He=>He.trim()===""?se:`${He.trimEnd()} ${se}`)}),{cancel:ie}=ee,re=ee.state!=="idle";S.useEffect(()=>{r&&ie()},[r,ie]),S.useEffect(()=>{const se=A.current;se&&(se.style.height="auto",se.style.height=`${Math.min(se.scrollHeight,160)}px`)},[x]);const Z=b.some(se=>se.status==="uploading"),ce=b.filter(se=>se.status==="done").flatMap(se=>se.attachment?[se.attachment]:[]),me=z?ce.length>0?`Files cannot be forwarded. Remove them to forward to ${z.agent.name}.`:m===0?`Select the messages above to forward to ${z.agent.name}.`:`Forwarding ${m===1?"1 selected message":`${m} selected messages`} to ${z.agent.name}. Change the selection above.`:"",Re=z!==null&&(ce.length>0||m===0),O=!r&&!Z&&!re&&!$&&!Re&&(x.trim()!==""||ce.length>0);function Be(se){if(!a||r||se.length===0)return;const He=X0-b.length,rt=se.slice(0,Math.max(He,0));T(rt.length<se.length?`A message can carry at most ${X0} files.`:"");for(const Qe of rt){const pt=`file-${++F.current}`;w(zt=>[...zt,{key:pt,name:Qe.name,size:Qe.size,status:"uploading"}]),a(Qe).then(zt=>{if(Q.current.delete(pt)){l==null||l(zt);return}w(Ct=>Ct.map(fe=>fe.key===pt?{...fe,status:"done",attachment:zt}:fe))},zt=>{if(Q.current.delete(pt))return;const Ct=zt instanceof Error?zt.message:"Upload failed";w(fe=>fe.map(ge=>ge.key===pt?{...ge,status:"error",error:Ct}:ge))})}}function lt(se){T(""),se.status==="uploading"?Q.current.add(se.key):se.attachment&&(l==null||l(se.attachment)),w(He=>He.filter(rt=>rt.key!==se.key))}function _(se){j.onKeyDown(se)||L.onKeyDown(se)||se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),Oe())}function D(){requestAnimationFrame(()=>{const se=A.current;se&&se.setSelectionRange(se.value.length,se.value.length)})}function ae(se){j.choose(se),D()}function he(se){L.choose(se),D()}function xe(){g(""),w([]),T(""),A.current&&(A.current.style.height="auto")}async function Oe(){if(!O)return;if(z&&p){W(!0),T("");try{await p(z.agent,z.note),xe()}catch(He){T(He instanceof Error?He.message:"Failed to forward")}finally{W(!1)}return}const se=x.trim();ce.length>0?t(se,ce):t(se),xe()}function Me(se){g(se.target.value);const He=se.target;He.style.height="auto",He.style.height=`${Math.min(He.scrollHeight,160)}px`}function Le(se){const He=Array.from(se.clipboardData.files);He.length===0||!a||(se.preventDefault(),Be(He))}function ye(se){se.preventDefault(),k(!1),Be(Array.from(se.dataTransfer.files))}function je(){ee.state==="recording"?ee.stop():ee.state==="idle"&&ee.start()}const Tt=a!==void 0,Ke=C||ee.error;return c.jsxs("div",{className:`sticky bottom-0 border-t px-4 py-3 bg-background ${E?"ring-2 ring-inset ring-ring":""}`,onDragOver:se=>{!Tt||r||!se.dataTransfer.types.includes("Files")||(se.preventDefault(),k(!0))},onDragLeave:()=>k(!1),onDrop:Tt?ye:void 0,children:[b.length>0&&c.jsx("ul",{className:"flex flex-wrap gap-2 mb-2","aria-label":"Files to send",children:b.map(se=>{var He;return c.jsxs("li",{className:`flex items-center gap-2 max-w-[16rem] rounded-lg border px-2 py-1 text-xs ${se.status==="error"?"border-destructive text-destructive":"bg-muted"}`,children:[c.jsxs("span",{className:"min-w-0",children:[c.jsx("span",{className:"block truncate",children:se.name}),c.jsxs("span",{className:"block text-muted-foreground",children:[se.status==="uploading"&&"Uploading…",se.status==="done"&&$p(((He=se.attachment)==null?void 0:He.size)??se.size),se.status==="error"&&c.jsx("span",{role:"alert",className:"text-destructive whitespace-normal",children:se.error})]})]}),c.jsx("button",{type:"button",onClick:()=>lt(se),"aria-label":`Remove ${se.name}`,className:"shrink-0 rounded p-0.5 hover:bg-accent transition-colors",children:c.jsx(tw,{size:14})})]},se.key)})}),Ke&&c.jsx("p",{role:"alert",className:"text-xs text-destructive mb-2",children:Ke}),me&&c.jsx("p",{role:"status",className:"text-xs text-muted-foreground mb-2",children:me}),c.jsxs("div",{className:"flex items-end gap-2",children:[Tt&&c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:M,type:"file",multiple:!0,"aria-label":"Choose files",tabIndex:-1,className:"sr-only",onChange:se=>{Be(Array.from(se.target.files??[])),se.target.value=""}}),c.jsx("button",{type:"button",onClick:()=>{var se;return(se=M.current)==null?void 0:se.click()},disabled:r,"aria-label":"Attach files",title:"Attach files",className:"h-10 w-10 flex items-center justify-center rounded-xl border text-muted-foreground hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed transition-colors shrink-0",children:c.jsx(YE,{size:18})})]}),c.jsxs("div",{className:"relative flex-1",children:[j.open&&c.jsx(Rp,{id:"message-skill-autocomplete",matches:j.matches,activeIndex:j.activeIndex,onChoose:ae}),L.open&&c.jsx(F_,{id:"message-agent-autocomplete",matches:L.matches,activeIndex:L.activeIndex,onChoose:he}),c.jsx("textarea",{ref:A,rows:1,value:x,onChange:Me,onKeyDown:_,onPaste:Le,disabled:r,placeholder:r?"Agent is running...":ee.state==="recording"?"Recording... press the microphone again to stop":ee.state==="transcribing"?"Transcribing...":"Message... (Enter to send, Shift+Enter for newline)",className:"w-full resize-none rounded-xl border bg-muted px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed leading-normal [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{minHeight:"40px",maxHeight:"160px"}})]}),ee.available&&c.jsx("button",{type:"button",onClick:je,disabled:r||ee.state==="transcribing","aria-label":ee.state==="recording"?"Stop recording":ee.state==="transcribing"?"Transcribing":"Record a message","aria-pressed":ee.state==="recording",title:ee.state==="recording"?"Stop recording":"Record a message",className:`h-10 w-10 flex items-center justify-center rounded-xl border disabled:opacity-40 disabled:cursor-not-allowed transition-colors shrink-0 ${ee.state==="recording"?"bg-destructive text-destructive-foreground border-destructive animate-pulse":"text-muted-foreground hover:bg-accent"}`,children:ee.state==="recording"?c.jsx(ew,{size:16}):ee.state==="transcribing"?c.jsx(HE,{size:18,className:"animate-spin"}):c.jsx(PE,{size:18})}),c.jsx("button",{onClick:()=>void Oe(),disabled:!O,className:"h-10 px-4 rounded-xl bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 disabled:opacity-40 transition-opacity shrink-0",children:"Send"})]})]})}function Q_(...t){return Yo(Qo(t))}function Y_({toolName:t,status:r,arguments:a,result:l}){const[o,u]=S.useState(!1),d=r==="completed"?"text-green-600":r==="failed"?"text-destructive":"text-muted-foreground";return c.jsxs("div",{className:"border rounded-md text-xs bg-card",children:[c.jsxs("button",{className:"w-full flex items-center justify-between px-3 py-2 hover:bg-accent/50 transition-colors",onClick:()=>u(m=>!m),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono font-medium",children:t}),c.jsx("span",{className:Q_("text-[10px]",d),children:r})]}),c.jsx("span",{className:"text-muted-foreground",children:o?"▲":"▼"})]}),o&&c.jsxs("div",{className:"border-t px-3 py-2 space-y-2",children:[a&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium text-muted-foreground mb-1",children:"Arguments"}),c.jsx("pre",{className:"bg-muted rounded p-2 overflow-auto text-[10px] whitespace-pre-wrap",children:JSON.stringify(a,null,2)})]}),l!==void 0&&c.jsxs("div",{children:[c.jsx("p",{className:"font-medium text-muted-foreground mb-1",children:"Result"}),c.jsx("pre",{className:"bg-muted rounded p-2 overflow-auto text-[10px] whitespace-pre-wrap",children:JSON.stringify(l,null,2)})]})]})]})}function V_({step:t}){return t.kind==="tool_call"?t.status==="running"?c.jsx("span",{className:"inline-block w-3.5 h-3.5 border-2 border-foreground border-t-transparent rounded-full animate-spin shrink-0"}):t.isError||t.status==="failed"?c.jsx("span",{className:"text-destructive font-bold shrink-0",children:"X"}):c.jsx("span",{className:"text-green-600 shrink-0",children:"✓"}):t.kind==="approval"?c.jsx("span",{className:"text-yellow-500 shrink-0",children:"◎"}):c.jsx("span",{className:"text-muted-foreground shrink-0",children:"ⓘ"})}function G_({steps:t}){if(t.length===0)return c.jsx("p",{className:"text-xs text-muted-foreground",children:"Waiting for execution events..."});const r=new Set,a=[];for(const l of t){const o=l.toolExecutionId??l.id;if(r.has(o))continue;r.add(o);const u=l.kind==="tool_call"?t.find(d=>d.kind==="tool_result"&&d.toolExecutionId===l.toolExecutionId):void 0;a.push({...l,...u?{status:u.status,result:u.result,isError:u.isError}:{}})}return c.jsx("div",{className:"space-y-1.5",children:a.map(l=>l.kind==="tool_call"||l.kind==="tool_result"?c.jsx(Y_,{toolName:l.toolName??"unknown",status:l.status??"running",arguments:l.arguments,result:l.result},l.id):c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx(V_,{step:l}),c.jsx("span",{className:"text-muted-foreground",children:l.kind==="approval"?`Waiting for approval: ${l.toolName??""}`:l.summary??l.status??l.kind})]},l.id))})}function K_({approval:t,executionId:r,onDecision:a}){const[l,o]=S.useState(!1),[u,d]=S.useState("");async function m(p){o(!0),d("");try{await ue.executions.respondToApproval(r,t.id,{decision:p}),a==null||a(p)}catch(y){d(y instanceof Error?y.message:"Failed to respond"),o(!1)}}return c.jsxs("div",{className:"border border-yellow-300 rounded-lg p-4 bg-yellow-50 dark:bg-yellow-950/20 dark:border-yellow-700 text-sm",children:[c.jsxs("p",{className:"font-semibold mb-1",children:["Agent wants to execute:"," ",c.jsx("span",{className:"font-mono text-yellow-700 dark:text-yellow-400",children:t.toolName})]}),c.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:t.summary}),c.jsxs("div",{className:"mb-3",children:[c.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Arguments"}),c.jsx("pre",{className:"bg-white/60 dark:bg-black/20 rounded p-2 text-[10px] overflow-auto whitespace-pre-wrap border",children:JSON.stringify(t.arguments,null,2)})]}),u&&c.jsx("p",{className:"text-xs text-destructive mb-2",children:u}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:()=>m("approved"),disabled:l,className:"px-3 py-1.5 rounded-md bg-green-600 text-white text-xs font-medium hover:bg-green-700 disabled:opacity-50 transition-colors",children:"Approve"}),c.jsx("button",{onClick:()=>m("rejected"),disabled:l,className:"px-3 py-1.5 rounded-md bg-destructive text-destructive-foreground text-xs font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:"Reject"})]})]})}function X_({status:t}){const r=t==="running"?"bg-blue-100 text-blue-700":t==="waiting_for_approval"?"bg-yellow-100 text-yellow-700":t==="completed"?"bg-green-100 text-green-700":t==="failed"||t==="cancelled"?"bg-red-100 text-red-700":"bg-muted text-muted-foreground";return c.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full ${r}`,children:t.replace(/_/g," ")})}function $_({conversationId:t}){const{getByConversation:r,setStatus:a,addStep:l,setPendingApproval:o,init:u}=kp(),d=r(t);if(S.useEffect(()=>{const y=[Ge.on("execution.started",x=>{const g=x;g.conversationId===t&&u(g.executionId,g.conversationId)}),Ge.on("execution.status_changed",x=>{const g=x,b=r(t);(b==null?void 0:b.executionId)===g.executionId&&a(g.executionId,g.status,g.error)}),Ge.on("execution.tool_call",x=>{const g=x,b=r(t);(b==null?void 0:b.executionId)===g.executionId&&l(g.executionId,{id:`${g.toolExecutionId}-call`,kind:"tool_call",toolExecutionId:g.toolExecutionId,toolName:g.toolName,status:"running",arguments:g.arguments,timestamp:Date.now()})}),Ge.on("execution.tool_result",x=>{const g=x,b=r(t);(b==null?void 0:b.executionId)===g.executionId&&l(g.executionId,{id:`${g.toolExecutionId}-result`,kind:"tool_result",toolExecutionId:g.toolExecutionId,toolName:g.toolName,status:g.status,result:g.result,isError:g.status==="failed",timestamp:Date.now()})}),Ge.on("execution.approval_requested",x=>{const g=x,b=r(t);(b==null?void 0:b.executionId)===g.executionId&&o(g.executionId,{id:g.approvalId,toolName:g.toolName,summary:g.summary,arguments:g.arguments})}),Ge.on("execution.completed",x=>{const g=x;g.conversationId===t&&a(g.executionId,"completed")})];return()=>y.forEach(x=>x())},[t,u,a,l,o,r]),!d||d.status==="completed")return null;async function m(y){try{await ue.executions.cancel(y)}catch(x){console.error("Failed to cancel execution",x)}}function p(){d&&(o(d.executionId,null),a(d.executionId,"running"))}return c.jsxs("div",{className:"border-t p-4 bg-muted/30 shrink-0 max-h-40 md:max-h-64 overflow-y-auto",children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsx("span",{className:"text-sm font-medium",children:"Agent execution"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(X_,{status:d.status}),["running","waiting_for_approval"].includes(d.status)&&c.jsx("button",{onClick:()=>m(d.executionId),className:"text-xs text-destructive hover:underline",children:"Stop"})]})]}),d.status==="failed"&&d.error&&c.jsx("p",{role:"alert",className:"mb-3 rounded-md bg-red-100 px-3 py-2 text-xs text-red-700 break-words",children:d.error}),c.jsx(G_,{steps:d.steps}),d.pendingApproval&&c.jsx("div",{className:"mt-3",children:c.jsx(K_,{approval:d.pendingApproval,executionId:d.executionId,onDecision:p})})]})}const W0="temp-",Z_=(t,r)=>(t??[]).map(a=>a.id).sort().join()===(r??[]).map(a=>a.id).sort().join();function J_({conversationId:t}){var zt,Ct;const r=Mt(),{data:a}=fT(t),{data:l}=I3(t),{data:o}=F3(),u=((zt=a==null?void 0:a.participants.find(fe=>fe.agentId))==null?void 0:zt.agentId)??void 0,d=Ap(u),{data:m}=Pi(),p=((m==null?void 0:m.agents)??[]).map(fe=>({id:fe.id,name:fe.name,description:fe.description})),[y,x]=S.useState([]),[g,b]=S.useState(null),[w,C]=S.useState(void 0),[T,E]=S.useState(!1),[k,A]=S.useState(!1),[M,F]=S.useState(!1),[Q,j]=S.useState(!1),[L,$]=S.useState(""),[W,z]=S.useState(null),[le,I]=S.useState(!1),[ee,ie]=S.useState(!1),re=mt(fe=>{var ge;return(ge=fe.user)==null?void 0:ge.id}),Z=Co(fe=>fe.openSidebar),{init:ce,setStatus:me,addStep:Re,setPendingApproval:O,getByConversation:Be}=kp(),lt=Be(t),_=lt!==void 0&&["running","waiting_for_approval","waiting_for_client"].includes(lt.status);S.useEffect(()=>()=>Im.getState().stop(),[t]);const D=S.useCallback(()=>{t&&ue.conversations.markRead(t).then(fe=>{r.setQueryData(["conversations"],ge=>ge&&{...ge,conversations:ge.conversations.map(oe=>oe.id===t?fe:oe)})}).catch(()=>{})},[t,r]);S.useEffect(()=>{D()},[D]),S.useEffect(()=>{l!=null&&l.messages&&x(l.messages)},[l]),S.useEffect(()=>{z(null),I(!1),ie(!1)},[t]),S.useEffect(()=>{z(fe=>{if(fe===null)return fe;const ge=new Set(y.filter(Hm).map(It=>It.id)),oe=fe.filter(It=>ge.has(It));return oe.length===fe.length?fe:oe})},[y]),S.useEffect(()=>{if(W===null||le)return;const fe=ge=>{ge.key==="Escape"&&(z(null),ie(!1))};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[W===null,le]);function ae(fe){ie(!1),z(ge=>ge===null?ge:ge.includes(fe.id)?ge.filter(oe=>oe!==fe.id):[...ge,fe.id])}S.useEffect(()=>{const fe=[Ge.on("chat.message",ge=>{const oe=ge;if(oe.conversationId===t)if(oe.streaming)oe.delta&&(b(It=>(It??"")+oe.delta),C(oe.senderName??void 0));else{b(null),C(void 0);const It=oe.senderType==="user";x(J=>{if(J.some(be=>be.id===oe.messageId))return J;const K={id:oe.messageId,conversationId:oe.conversationId,senderType:oe.senderType,senderId:oe.senderId,role:It?"user":"assistant",...oe.senderName!==void 0?{senderName:oe.senderName}:{},...oe.senderAvatarUrl!==void 0?{senderAvatarUrl:oe.senderAvatarUrl}:{},content:oe.content,metadata:oe.metadata??null,...oe.attachments&&oe.attachments.length>0?{attachments:oe.attachments}:{},createdAt:oe.createdAt};if(It&&(re===void 0||oe.senderId===re)){const be=J.findIndex(Te=>Te.id.startsWith(W0)&&Te.content===oe.content&&Z_(Te.attachments,oe.attachments));if(be!==-1)return J.map((Te,Ye)=>Ye===be?K:Te)}return[...J,K]}),r.invalidateQueries({queryKey:["conversations",t,"messages"]}),D()}}),Ge.on("conversation.updated",ge=>{ge.conversationId===t&&r.invalidateQueries({queryKey:["conversations",t],exact:!0})}),Ge.on("conversation.cleared",ge=>{ge.conversationId===t&&(x([]),b(null),C(void 0))}),Ge.on("execution.started",ge=>{const oe=ge;oe.conversationId===t&&ce(oe.executionId,oe.conversationId)}),Ge.on("execution.status_changed",ge=>{const oe=ge;oe.conversationId===t&&me(oe.executionId,oe.status,oe.error)}),Ge.on("execution.tool_call",ge=>{const oe=ge;Re(oe.executionId,{id:`${oe.toolExecutionId}-call`,kind:"tool_call",toolExecutionId:oe.toolExecutionId,toolName:oe.toolName,status:"running",arguments:oe.arguments,timestamp:Date.now()})}),Ge.on("execution.tool_result",ge=>{const oe=ge;Re(oe.executionId,{id:`${oe.toolExecutionId}-result`,kind:"tool_result",toolExecutionId:oe.toolExecutionId,toolName:oe.toolName,status:oe.status,result:oe.result,isError:oe.status==="failed",timestamp:Date.now()})}),Ge.on("execution.approval_requested",ge=>{const oe=ge;O(oe.executionId,{id:oe.approvalId,toolName:oe.toolName,summary:oe.summary,arguments:oe.arguments}),Re(oe.executionId,{id:`approval-${oe.approvalId}`,kind:"approval",approvalId:oe.approvalId,toolName:oe.toolName,summary:oe.summary,timestamp:Date.now()})}),Ge.on("execution.completed",ge=>{const oe=ge;oe.conversationId===t&&me(oe.executionId,"completed")}),Ge.on("execution.failed",ge=>{const oe=ge;oe.conversationId===t&&me(oe.executionId,"failed",oe.error)}),Ge.on("execution.cancelled",ge=>{const oe=ge;oe.conversationId===t&&me(oe.executionId,"cancelled")})];return()=>fe.forEach(ge=>ge())},[t,re,ce,me,Re,O,r,D]);const he=S.useCallback(fe=>ue.conversations.uploadAttachment(t,fe),[t]),xe=S.useCallback(fe=>{ue.attachments.delete(fe.id).catch(ge=>console.error("Failed to discard upload",ge))},[]),Oe=S.useCallback(async fe=>(await ue.transcription.transcribe(fe)).text,[]);async function Me(){const fe=L.trim();if(j(!1),!(!fe||!a||fe===ql(a,re)))try{await ue.conversations.rename(t,fe),await r.invalidateQueries({queryKey:["conversations",t]}),await r.invalidateQueries({queryKey:["conversations"]})}catch(ge){console.error("Failed to rename conversation",ge)}}const Le=S.useCallback(async(fe,ge=[])=>{const oe=`${W0}${Date.now()}`,It={id:oe,conversationId:t,senderType:"user",senderId:"me",role:"user",content:fe,metadata:null,...ge.length>0?{attachments:ge}:{},createdAt:new Date().toISOString()};x(J=>[...J,It]);try{await ue.conversations.sendMessage(t,{content:fe,...ge.length>0?{attachmentIds:ge.map(J=>J.id)}:{}}),r.invalidateQueries({queryKey:["conversations",t,"messages"]}),r.invalidateQueries({queryKey:["conversations"]})}catch(J){console.error("Failed to send message",J),x(K=>K.filter(be=>be.id!==oe))}},[t,r]),ye=S.useCallback(async(fe,ge)=>{await ue.conversations.forward(t,{messageIds:Y3(y,fe.senderId),agentId:fe.senderId,note:ge}),r.invalidateQueries({queryKey:["conversations",t,"messages"]})},[t,y,r]);function je(fe){if(fe){if(W!==null)return;const ge=[...y].reverse().find(Hm);if(!ge)return;z([ge.id]),ie(!0)}else ee&&(z(null),ie(!1))}async function Tt(fe,ge){await ue.conversations.forward(t,{messageIds:y.filter(oe=>W==null?void 0:W.includes(oe.id)).map(oe=>oe.id),agentId:fe.id,...ge!==""?{note:ge}:{}}),await r.invalidateQueries({queryKey:["conversations",t,"messages"]}),z(null),ie(!1)}const Ke=(a==null?void 0:a.type)==="agent",se=(a==null?void 0:a.type)==="human",He=(a==null?void 0:a.participants.filter(fe=>fe.userId!==null))??[],rt=(Ct=a==null?void 0:a.participants.find(fe=>fe.agentId))==null?void 0:Ct.agentId,Qe=new Map;for(const fe of y)fe.senderType==="agent"&&fe.senderId!=="llm"&&fe.senderId!==rt&&Qe.set(fe.senderId,fe.id);const pt=new Set(Qe.values());return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"border-b px-4 py-3 flex items-center gap-3 shrink-0",children:[c.jsx("button",{onClick:Z,className:"md:hidden shrink-0 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors","aria-label":"Back to conversations",children:c.jsx(RE,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[Q?c.jsx("input",{autoFocus:!0,value:L,onChange:fe=>$(fe.target.value),onBlur:()=>j(!1),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),Me()),fe.key==="Escape"&&(fe.preventDefault(),j(!1))},"aria-label":"Conversation name",className:"text-sm font-semibold bg-transparent border-b border-ring outline-none w-full max-w-[140px] sm:max-w-xs"}):c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("h2",{className:"text-sm font-semibold truncate",children:a?ql(a,re):"Conversation"}),a&&c.jsx("button",{onClick:()=>{$(ql(a,re)),j(!0)},className:"shrink-0 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"Rename conversation","aria-label":"Rename conversation",children:c.jsx(VE,{size:12})})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:se?He.map(fe=>fe.userId===re?"You":fe.name??"Someone").join(", "):a!=null&&a.type?c.jsxs("span",{className:"capitalize",children:[a.type," chat"]}):""})]}),se&&c.jsx("button",{onClick:()=>F(!0),className:"ml-auto p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"Add people","aria-label":"Add people",children:c.jsx(ZE,{size:16})}),(a==null?void 0:a.canDelete)&&c.jsx("button",{onClick:()=>A(!0),className:`${se?"":"ml-auto "}p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors`,title:"Clear chat","aria-label":"Clear chat",children:c.jsx(J1,{size:16})}),(a==null?void 0:a.canDelete)&&c.jsx("button",{onClick:()=>E(!0),className:"p-1.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-accent transition-colors",title:"Delete conversation","aria-label":"Delete conversation",children:c.jsx(Sp,{size:16})})]}),k&&a&&c.jsx(mw,{conversation:{id:a.id,title:a.title},onClose:()=>A(!1)}),T&&a&&c.jsx(hw,{conversation:{id:a.id,title:a.title},onClose:()=>E(!1)}),M&&a&&c.jsx(V3,{conversationId:t,memberIds:He.map(fe=>fe.userId),onClose:()=>F(!1)}),le&&W!==null&&W.length>0&&c.jsx(G3,{conversationId:t,messages:y.filter(fe=>W.includes(fe.id)),sharedChat:se,onClose:()=>I(!1),onForwarded:()=>{I(!1),z(null)}}),c.jsx(z_,{messages:y,streaming:g,streamingName:w,executionRunning:_,conversationType:a==null?void 0:a.type,currentUserId:re,onForward:fe=>z([fe.id]),selecting:W!==null,selectedIds:W??[],onToggleSelect:ae,replyTargets:pt,replyDisabled:_&&!se,onAgentReply:ye}),(Ke||lt!==void 0)&&c.jsx($_,{conversationId:t}),W!==null&&c.jsxs("div",{role:"toolbar","aria-label":"Forward messages",className:"flex items-center gap-2 border-t bg-muted/40 px-4 py-2 text-sm",children:[c.jsx("span",{"aria-live":"polite",children:W.length===1?"1 selected":`${W.length} selected`}),c.jsx("button",{onClick:()=>I(!0),disabled:W.length===0,className:"ml-auto px-3 py-1 rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:"Forward…"}),c.jsx("button",{onClick:()=>{z(null),ie(!1)},"aria-label":"Cancel selection",className:"px-3 py-1 rounded-md border hover:bg-accent transition-colors",children:"Cancel"})]}),c.jsx(P_,{onSend:Le,onUpload:he,onDiscard:xe,...o!=null&&o.available?{onTranscribe:Oe}:{},disabled:_&&!se,skills:d,agents:p,forwardCount:(W==null?void 0:W.length)??0,onForward:Tt,onMentionChange:je},t)]})}function W_({params:t}){const{id:r}=S.use(t);return c.jsx(J_,{conversationId:r})}function e5(){const t=_n();return S.useEffect(()=>{t.replace("/admin/users")},[t]),null}const t5=[{href:"/admin/users",label:"Users"},{href:"/admin/organizations",label:"Organizations",platformOnly:!0},{href:"/admin/llm",label:"AI models"},{href:"/admin/mcp",label:"MCP servers"},{href:"/admin/theme",label:"Theme",ownerOnly:!0}];function sd({children:t}){const r=mt(o=>o.user),a=Io();if(!vp(r))return c.jsx("div",{className:"flex h-full items-center justify-center",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have access to the admin area."})});const l=t5.filter(o=>(!o.platformOnly||(r==null?void 0:r.isPlatformAdmin))&&(!o.ownerOnly||(r==null?void 0:r.isPlatformAdmin)||(r==null?void 0:r.orgRole)==="owner"));return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"border-b px-6 pt-4 shrink-0",children:[c.jsxs("h1",{className:"text-lg font-semibold mb-3",children:["Admin",c.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:r!=null&&r.isPlatformAdmin?"Platform admin":r==null?void 0:r.orgName})]}),c.jsx("nav",{className:"flex gap-0 overflow-x-auto",children:l.map(o=>{const u=a===o.href;return c.jsx(Xn,{href:o.href,className:`shrink-0 px-4 py-2 text-sm border-b-2 transition-colors ${u?"border-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:o.label},o.href)})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:t})]})}function od(){return Cn({queryKey:["admin","orgs"],queryFn:()=>ue.admin.orgs.list()})}function n5(){return Cn({queryKey:["admin","users"],queryFn:()=>ue.admin.users.list()})}const Fc={chatter:0,member:1,admin:2,owner:3};function r5(t){return t.isPlatformAdmin?["chatter","member","admin","owner"]:["chatter","member","admin","owner"].filter(r=>Fc[r]<Fc[t.orgRole])}function a5(t,r){return r.id===t.id?!1:t.isPlatformAdmin?!0:r.isPlatformAdmin||!r.role?!1:Fc[r.role]<Fc[t.orgRole]}function ho({children:t,tone:r="muted"}){const a={muted:"bg-muted text-muted-foreground",warn:"bg-yellow-100 text-yellow-800",danger:"bg-red-100 text-red-700",info:"bg-blue-100 text-blue-700"};return c.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${a[r]}`,children:t})}function i5({user:t,actor:r,onClose:a,onAccountAction:l}){const o=Mt(),{data:u}=od(),d=(u==null?void 0:u.orgs)??[],m=r5(r),[p,y]=S.useState((t==null?void 0:t.email)??""),[x,g]=S.useState((t==null?void 0:t.displayName)??""),[b,w]=S.useState((t==null?void 0:t.orgId)??r.orgId),[C,T]=S.useState((t==null?void 0:t.role)??(m.includes("member")?"member":m[0])??"member"),[E,k]=S.useState((t==null?void 0:t.isPlatformAdmin)??!1),[A,M]=S.useState(!1),[F,Q]=S.useState(""),[j,L]=S.useState(null),$=(t==null?void 0:t.id)===r.id,W=r.isPlatformAdmin&&!$,z=!$;async function le(I){I.preventDefault(),M(!0),Q("");try{if(t)await ue.admin.users.update(t.id,{displayName:x,...z&&C!==t.role?{role:C}:{},...W&&b!==t.orgId?{orgId:b}:{},...r.isPlatformAdmin&&!$&&E!==t.isPlatformAdmin?{isPlatformAdmin:E}:{}});else{const ee=await ue.admin.users.create({email:p,displayName:x,orgId:b,role:C});await o.invalidateQueries({queryKey:["admin"]}),L({email:ee.email,emailSent:ee.emailSent}),M(!1);return}await o.invalidateQueries({queryKey:["admin"]}),a()}catch(ee){Q(ee instanceof Error?ee.message:"Failed to save"),M(!1)}}return j?c.jsxs(da,{title:"User created",onClose:a,children:[j.emailSent?c.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["An email with a link to set a password was sent to ",j.email,". The link works once and expires in 48 hours; you can send a new one from the user's Edit dialog."]}):c.jsxs("p",{className:"text-sm text-destructive mb-4",role:"alert",children:["The user was created, but the email to ",j.email," could not be sent (is email set up on the server?). Use “Resend setup email” in their Edit dialog once it is."]}),c.jsx("div",{className:"flex justify-end",children:c.jsx("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity",children:"Close"})})]}):c.jsx(da,{title:t?"Edit user":"New user",onClose:a,children:c.jsxs("form",{onSubmit:le,className:"space-y-4",children:[!t&&c.jsx(ot,{label:"Email",htmlFor:"user-email",children:c.jsx("input",{id:"user-email",type:"email",required:!0,className:ut,value:p,onChange:I=>y(I.target.value),autoFocus:!0})}),t&&c.jsx("p",{className:"text-sm text-muted-foreground",children:t.email}),c.jsx(ot,{label:"Display name",htmlFor:"user-name",children:c.jsx("input",{id:"user-name",required:!0,className:ut,value:x,onChange:I=>g(I.target.value)})}),(W||!t)&&c.jsx(ot,{label:"Organization",htmlFor:"user-org",children:r.isPlatformAdmin?c.jsx("select",{id:"user-org",className:ut,value:b,onChange:I=>w(I.target.value),children:d.map(I=>c.jsx("option",{value:I.id,children:I.name},I.id))}):c.jsx("input",{id:"user-org",className:ut,value:r.orgName,disabled:!0})}),z&&c.jsx(ot,{label:"Role",htmlFor:"user-role",children:c.jsx("select",{id:"user-role",className:ut,value:C,onChange:I=>T(I.target.value),children:[...new Set([...t!=null&&t.role?[t.role]:[],...m])].map(I=>c.jsx("option",{value:I,disabled:!m.includes(I),children:I},I))})}),r.isPlatformAdmin&&!$&&t&&c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:E,onChange:I=>k(I.target.checked)}),"Platform admin (manages every organization)"]}),!t&&c.jsx("p",{className:"text-xs text-muted-foreground",children:"The user gets an email with a link to choose their own password, then sets up an authenticator app at first sign-in."}),t&&!$&&c.jsxs("div",{className:"space-y-2 border-t pt-4",children:[c.jsx("p",{className:"text-sm font-medium",children:"Sign-in"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>l("link",t),className:"px-3 py-1.5 text-xs rounded-md border hover:bg-accent transition-colors",children:t.mustChangePassword?"Resend setup email":"Send password reset email"}),c.jsx("button",{type:"button",onClick:()=>l("mfa-required",t),className:"px-3 py-1.5 text-xs rounded-md border hover:bg-accent transition-colors",children:t.mfaRequired?"Exempt from MFA":"Require MFA again"}),t.mfaEnabled&&c.jsx("button",{type:"button",onClick:()=>l("mfa-reset",t),className:"px-3 py-1.5 text-xs rounded-md border hover:bg-accent transition-colors",children:"Reset MFA"})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Reset MFA is for someone who lost their phone: they set up a new authenticator at next sign-in."})]}),F&&c.jsx("p",{className:"text-xs text-destructive",children:F}),c.jsx(Qi,{onCancel:a,submitLabel:t?"Save":"Create user",busy:A})]})})}function l5({action:t,user:r,onClose:a}){const l=Mt(),o=()=>l.invalidateQueries({queryKey:["admin"]});if(t==="link"){const u=r.mustChangePassword;return c.jsx(Fr,{title:u?"Resend setup email?":"Send password reset email?",message:u?c.jsxs(c.Fragment,{children:[r.displayName," gets a new link to set a password; the earlier link stops working."]}):c.jsxs(c.Fragment,{children:[r.displayName," is signed out everywhere now and gets an email with a link to choose a new password. Their current password stops working."]}),confirmLabel:u?"Resend":"Send and sign out",destructive:!u,onConfirm:async()=>{const d=await ue.admin.users.sendPasswordLink(r.id);if(await o(),!d.emailSent)throw new Error("The email could not be sent. Check that email is set up on the server, then try again.")},onClose:a})}if(t==="mfa-required"){const u=r.mfaRequired;return c.jsx(Fr,{title:u?"Exempt from MFA?":"Require MFA again?",message:u?c.jsxs(c.Fragment,{children:[r.displayName," will sign in with the password alone, without an authenticator code."]}):c.jsxs(c.Fragment,{children:[r.displayName," will be asked for an authenticator code at next sign-in (and to set one up first if needed)."]}),confirmLabel:u?"Exempt":"Require MFA",destructive:u,onConfirm:async()=>{await ue.admin.users.setMfaRequired(r.id,{required:!u}),await o()},onClose:a})}return c.jsx(Fr,{title:"Reset MFA?",message:c.jsxs(c.Fragment,{children:[r.displayName,"'s authenticator is forgotten and they are signed out everywhere. At next sign-in they set up a new one."]}),confirmLabel:"Reset MFA",onConfirm:async()=>{await ue.admin.users.resetMfa(r.id),await o()},onClose:a})}function s5(){const t=mt(k=>k.user),r=Mt(),{data:a,isLoading:l,isError:o}=n5(),[u,d]=S.useState(null),[m,p]=S.useState(null),[y,x]=S.useState(null),[g,b]=S.useState(null),[w,C]=S.useState(""),T=(a==null?void 0:a.users)??[],E=T.filter(k=>ca(w,[k.displayName,k.email,k.orgName,k.role]));return t?c.jsxs("div",{className:"max-w-5xl",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[c.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.isPlatformAdmin?"Every user on this server.":`Users in ${t.orgName}.`," Disabling a user keeps their history",t.isPlatformAdmin?"; deleting one removes it too":"","."]}),c.jsx("button",{onClick:()=>d("new"),className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity whitespace-nowrap shrink-0",children:"New user"})]}),T.length>0&&c.jsx("div",{className:"max-w-xs mb-4",children:c.jsx(Bi,{value:w,onChange:C,placeholder:"Search users…","aria-label":"Search users"})}),l&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),o&&c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load users."}),!l&&!o&&E.length===0&&T.length>0&&c.jsxs("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:["No users match “",w.trim(),"”."]}),!l&&!o&&E.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm border rounded-md",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-left text-xs text-muted-foreground border-b",children:[c.jsx("th",{className:"px-3 py-2 font-medium",children:"User"}),t.isPlatformAdmin&&c.jsx("th",{className:"px-3 py-2 font-medium",children:"Organization"}),c.jsx("th",{className:"px-3 py-2 font-medium",children:"Role"}),c.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),c.jsx("th",{className:"px-3 py-2"})]})}),c.jsx("tbody",{className:"divide-y",children:E.map(k=>{const A=a5(t,k);return c.jsxs("tr",{className:k.disabled?"opacity-60":"",children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[k.displayName,k.id===t.id&&c.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(you)"})]}),c.jsx("div",{className:"text-xs text-muted-foreground",children:k.email})]}),t.isPlatformAdmin&&c.jsx("td",{className:"px-3 py-2",children:k.orgName??"—"}),c.jsx("td",{className:"px-3 py-2 capitalize",children:k.role??"—"}),c.jsx("td",{className:"px-3 py-2",children:c.jsxs("div",{className:"flex flex-wrap gap-1",children:[k.isPlatformAdmin&&c.jsx(ho,{tone:"info",children:"Platform admin"}),k.disabled&&c.jsx(ho,{tone:"danger",children:"Disabled"}),k.mustChangePassword&&c.jsx(ho,{tone:"warn",children:"Password change pending"}),!k.mfaRequired&&c.jsx(ho,{tone:"warn",children:"MFA exempt"}),k.mfaRequired&&k.mfaEnabled&&c.jsx(ho,{tone:"info",children:"MFA on"})]})}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:[(A||k.id===t.id)&&c.jsx("button",{onClick:()=>d(k),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),A&&c.jsx("button",{onClick:()=>p(k),className:`px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors ${k.disabled?"":"text-destructive"}`,children:k.disabled?"Enable":"Disable"}),t.isPlatformAdmin&&k.id!==t.id&&c.jsx("button",{onClick:()=>x(k),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors text-destructive",children:"Delete"})]})]},k.id)})})]})}),u&&c.jsx(i5,{user:u==="new"?null:u,actor:t,onClose:()=>d(null),onAccountAction:(k,A)=>{d(null),b({action:k,user:A})}}),g&&c.jsx(l5,{...g,onClose:()=>b(null)}),y&&c.jsx(Fr,{title:"Delete user?",message:c.jsxs(c.Fragment,{children:[y.displayName," (",y.email,") will be deleted for good, together with the conversations they created, the agents they own (and everyone's chats, runs and schedules with those agents), their messages and files. This cannot be undone. To keep the history, disable the user instead."]}),confirmLabel:"Delete",destructive:!0,onConfirm:async()=>{await ue.admin.users.delete(y.id),await r.invalidateQueries()},onClose:()=>x(null)}),m&&c.jsx(Fr,{title:m.disabled?"Enable user?":"Disable user?",message:m.disabled?c.jsxs(c.Fragment,{children:[m.displayName," will be able to sign in again."]}):c.jsxs(c.Fragment,{children:[m.displayName," will be signed out everywhere immediately and won't be able to sign in. Their conversations and agents are kept."]}),confirmLabel:m.disabled?"Enable":"Disable",destructive:!m.disabled,onConfirm:async()=>{await ue.admin.users.update(m.id,{disabled:!m.disabled}),await r.invalidateQueries({queryKey:["admin"]})},onClose:()=>p(null)})]}):null}function o5(){return c.jsx(sd,{children:c.jsx(s5,{})})}function u5({org:t,onClose:r}){const a=Mt(),[l,o]=S.useState((t==null?void 0:t.name)??""),[u,d]=S.useState(!1),[m,p]=S.useState("");async function y(x){x.preventDefault(),d(!0),p("");try{t?await ue.admin.orgs.update(t.id,l):await ue.admin.orgs.create(l),await a.invalidateQueries({queryKey:["admin"]}),r()}catch(g){p(g instanceof Error?g.message:"Failed to save"),d(!1)}}return c.jsx(da,{title:t?"Rename organization":"New organization",onClose:r,children:c.jsxs("form",{onSubmit:y,className:"space-y-4",children:[c.jsx(ot,{label:"Name",htmlFor:"org-name",children:c.jsx("input",{id:"org-name",className:ut,value:l,onChange:x=>o(x.target.value),autoFocus:!0,required:!0})}),m&&c.jsx("p",{className:"text-xs text-destructive",children:m}),c.jsx(Qi,{onCancel:r,submitLabel:t?"Save":"Create",busy:u,disabled:l.trim()===""})]})})}function c5(){const t=Mt(),{data:r,isLoading:a,isError:l}=od(),[o,u]=S.useState(null),[d,m]=S.useState(null),[p,y]=S.useState(""),x=(r==null?void 0:r.orgs)??[],g=x.filter(b=>ca(p,[b.name,b.slug]));return c.jsxs("div",{className:"max-w-3xl",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Organizations keep their users, agents, chats and AI models separate."}),c.jsx("button",{onClick:()=>u("new"),className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity whitespace-nowrap shrink-0",children:"New organization"})]}),x.length>0&&c.jsx("div",{className:"max-w-xs mb-4",children:c.jsx(Bi,{value:p,onChange:y,placeholder:"Search organizations…","aria-label":"Search organizations"})}),a&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),l&&c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load organizations."}),!a&&!l&&g.length===0&&x.length>0&&c.jsxs("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:["No organizations match “",p.trim(),"”."]}),!a&&!l&&g.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsxs("table",{className:"w-full text-sm border rounded-md",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"text-left text-xs text-muted-foreground border-b",children:[c.jsx("th",{className:"px-3 py-2 font-medium",children:"Name"}),c.jsx("th",{className:"px-3 py-2 font-medium",children:"Slug"}),c.jsx("th",{className:"px-3 py-2 font-medium",children:"Members"}),c.jsx("th",{className:"px-3 py-2"})]})}),c.jsx("tbody",{className:"divide-y",children:g.map(b=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-medium",children:b.name}),c.jsx("td",{className:"px-3 py-2 font-mono text-xs text-muted-foreground",children:b.slug}),c.jsx("td",{className:"px-3 py-2",children:b.memberCount}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:[c.jsx("button",{onClick:()=>u(b),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Rename"}),c.jsx("button",{onClick:()=>m(b),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},b.id))})]})}),o&&c.jsx(u5,{org:o==="new"?null:o,onClose:()=>u(null)}),d&&c.jsx(Fr,{title:"Delete organization?",message:c.jsxs(c.Fragment,{children:["“",d.name,"” will be deleted. An organization can only be deleted once it has no members, conversations, agents or MCP servers."]}),confirmLabel:"Delete",onConfirm:async()=>{await ue.admin.orgs.delete(d.id),await t.invalidateQueries({queryKey:["admin"]})},onClose:()=>m(null)})]})}function d5(){const t=mt(r=>r.user);return c.jsx(sd,{children:t!=null&&t.isPlatformAdmin?c.jsx(c5,{}):c.jsx("p",{className:"text-sm text-muted-foreground",children:"Only platform admins manage organizations."})})}const Ei=[{label:"OpenAI",type:"openai_compatible",baseUrl:"https://api.openai.com/v1",model:"gpt-4o"},{label:"DeepSeek",type:"openai_compatible",baseUrl:"https://api.deepseek.com",model:"deepseek-chat"},{label:"Kimi (Moonshot)",type:"openai_compatible",baseUrl:"https://api.moonshot.ai/v1",model:"kimi-latest",note:"Accounts registered in mainland China use https://api.moonshot.cn/v1"},{label:"Anthropic",type:"anthropic",baseUrl:"",model:"claude-sonnet-4-5"},{label:"Claude Code (on the user’s computer)",type:"claude_code_local",baseUrl:"",model:"sonnet",note:"Runs the Claude Code command in the KAI desktop app of whoever chats, with their own Claude login. Needs no key, and only works in the desktop app with Claude Code turned on in its Settings."},{label:"Other (OpenAI-compatible)",type:"openai_compatible",baseUrl:"",model:"",note:"OpenRouter, Groq, Ollama (http://localhost:11434/v1), vLLM, ..."}],f5=["none","minimal","low","medium","high","xhigh"];function h5(t){var r;return t?t.type==="anthropic"?"claude-sonnet-4-5":t.type==="claude_code_local"?"sonnet":((r=Ei.find(a=>a.baseUrl&&a.baseUrl===t.baseUrl))==null?void 0:r.model)??"":""}function m5({orgId:t,provider:r,onClose:a}){const l=Mt(),[o,u]=S.useState(0),d=Ei[o],[m,p]=S.useState((r==null?void 0:r.name)??Ei[0].label),[y,x]=S.useState((r==null?void 0:r.type)??Ei[0].type),[g,b]=S.useState((r==null?void 0:r.baseUrl)??Ei[0].baseUrl),[w,C]=S.useState(""),[T,E]=S.useState(!1),[k,A]=S.useState((r==null?void 0:r.transcriptionModel)??""),[M,F]=S.useState(!1),[Q,j]=S.useState(""),[L,$]=S.useState(!1),[W,z]=S.useState(null);S.useEffect(()=>{z(null)},[o,y,g,w,T]);function le(Z){const ce=Ei[Z];u(Z),p(ce.label.startsWith("Other")?"":ce.label),x(ce.type),b(ce.baseUrl)}async function I(){$(!0),z(null);try{z(await ue.admin.llm.testProvider(t,{...r?{providerId:r.id}:{type:y},...ie==="openai_compatible"?{baseUrl:g}:{},...w?{apiKey:w}:T?{apiKey:null}:{}}))}catch(Z){z({ok:!1,error:Z instanceof Error?Z.message:"The test could not be run"})}finally{$(!1)}}async function ee(Z){Z.preventDefault(),F(!0),j("");try{r?await ue.admin.llm.updateProvider(t,r.id,{name:m,...r.type==="openai_compatible"?{baseUrl:g}:{},...w?{apiKey:w}:T?{apiKey:null}:{},...r.type==="openai_compatible"&&k.trim()!==(r.transcriptionModel??"")?{transcriptionModel:k.trim()||null}:{}}):await ue.admin.llm.createProvider(t,{name:m,type:y,...y==="openai_compatible"?{baseUrl:g}:{},...w?{apiKey:w}:{},...y==="openai_compatible"&&k.trim()!==""?{transcriptionModel:k.trim()}:{}}),await l.invalidateQueries({queryKey:["admin","llm"]}),await l.invalidateQueries({queryKey:["llm-models"]}),a()}catch(ce){j(ce instanceof Error?ce.message:"Failed to save"),F(!1)}}const ie=(r==null?void 0:r.type)??y,re=(ie!=="openai_compatible"||g.trim()!=="")&&(ie!=="anthropic"||w!==""||!!(r!=null&&r.hasApiKey)&&!T);return c.jsx(da,{title:r?"Edit provider":"Add provider",onClose:a,width:"w-[28rem]",children:c.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[!r&&c.jsx(ot,{label:"Provider",htmlFor:"prov-preset",...d.note?{hint:d.note}:{},children:c.jsx("select",{id:"prov-preset",className:ut,value:o,onChange:Z=>le(Number(Z.target.value)),children:Ei.map((Z,ce)=>c.jsx("option",{value:ce,children:Z.label},Z.label))})}),c.jsx(ot,{label:"Name",htmlFor:"prov-name",children:c.jsx("input",{id:"prov-name",required:!0,className:ut,value:m,onChange:Z=>p(Z.target.value)})}),ie==="openai_compatible"&&c.jsx(ot,{label:"Base URL",htmlFor:"prov-url",children:c.jsx("input",{id:"prov-url",required:!0,spellCheck:!1,className:`${ut} font-mono`,value:g,onChange:Z=>b(Z.target.value),placeholder:"https://api.example.com/v1"})}),ie!=="claude_code_local"&&c.jsx(ot,{label:"API key",htmlFor:"prov-key",hint:r?r.hasApiKey?"A key is stored (encrypted). Leave empty to keep it, or enter a new one to replace it.":"No key stored.":ie==="anthropic"?"Required. Stored encrypted and never shown again.":"Optional for local servers such as Ollama. Stored encrypted and never shown again.",children:c.jsx("input",{id:"prov-key",type:"password",autoComplete:"new-password",required:!r&&ie==="anthropic",className:`${ut} font-mono`,value:w,onChange:Z=>C(Z.target.value),placeholder:r!=null&&r.hasApiKey?"••••••••••••":""})}),ie==="openai_compatible"&&c.jsx(ot,{label:"Speech-to-text model",htmlFor:"prov-stt",hint:"Optional. Lets people record voice messages: the name of a Whisper-style model this server offers at /audio/transcriptions, for example whisper-1. Leave empty for no voice input.",children:c.jsx("input",{id:"prov-stt",spellCheck:!1,className:`${ut} font-mono`,value:k,onChange:Z=>A(Z.target.value),placeholder:"whisper-1"})}),(r==null?void 0:r.hasApiKey)&&r.type==="openai_compatible"&&c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:T,onChange:Z=>E(Z.target.checked),disabled:w!==""}),"Remove the stored key"]}),ie==="claude_code_local"?c.jsx("p",{className:"text-xs text-muted-foreground",children:"The server cannot check this one: it runs on each person's own computer. Add a model, then use Test on it while the KAI desktop app is open."}):c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("button",{type:"button",onClick:()=>void I(),disabled:L||M||!re,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 whitespace-nowrap shrink-0 transition-colors",children:L?"Testing…":"Test connection"}),W&&c.jsx("div",{role:"status",className:"text-xs pt-1.5 min-w-0 break-words",children:W.ok?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"text-green-700",children:["Connected",W.models&&W.models.length>0?`. ${W.models.length} model${W.models.length===1?"":"s"} available, for example ${W.models.slice(0,3).join(", ")}.`:"."]}),W.note&&c.jsx("p",{className:"text-muted-foreground mt-0.5",children:W.note})]}):c.jsx("p",{className:"text-destructive",children:W.error})})]}),Q&&c.jsx("p",{className:"text-xs text-destructive",children:Q}),c.jsx(Qi,{onCancel:a,submitLabel:r?"Save":"Add provider",busy:M})]})})}function p5({orgId:t,providers:r,model:a,onClose:l}){var W;const o=Mt(),[u,d]=S.useState((a==null?void 0:a.providerId)??((W=r[0])==null?void 0:W.id)??""),[m,p]=S.useState((a==null?void 0:a.model)??""),[y,x]=S.useState((a==null?void 0:a.label)??""),[g,b]=S.useState(!1),[w,C]=S.useState((a==null?void 0:a.supportsImages)??!1),[T,E]=S.useState((a==null?void 0:a.reasoningEffort)??""),[k,A]=S.useState(!1),[M,F]=S.useState(""),Q=r.find(z=>z.id===u),j=(Q==null?void 0:Q.type)==="openai_compatible",L=(Q==null?void 0:Q.type)==="claude_code_local";async function $(z){z.preventDefault(),A(!0),F("");try{a?await ue.admin.llm.updateModel(t,a.id,{model:m,label:y||m,supportsImages:w,...j&&T!==(a.reasoningEffort??"")?{reasoningEffort:T||null}:{}}):await ue.admin.llm.createModel(t,{providerId:u,model:m,...y?{label:y}:{},...g?{isDefault:g}:{},...w?{supportsImages:w}:{},...j&&T?{reasoningEffort:T}:{}}),await o.invalidateQueries({queryKey:["admin","llm"]}),await o.invalidateQueries({queryKey:["llm-models"]}),l()}catch(le){F(le instanceof Error?le.message:"Failed to save"),A(!1)}}return c.jsx(da,{title:a?"Edit model":"Add model",onClose:l,width:"w-[28rem]",children:c.jsxs("form",{onSubmit:$,className:"space-y-4",children:[!a&&c.jsx(ot,{label:"Provider",htmlFor:"model-provider",children:c.jsx("select",{id:"model-provider",className:ut,value:u,onChange:z=>d(z.target.value),children:r.map(z=>c.jsx("option",{value:z.id,children:z.name},z.id))})}),c.jsx(ot,{label:"Model name",htmlFor:"model-name",hint:L?"A Claude model alias (sonnet, opus, haiku) or a full name such as claude-sonnet-4-5.":"Exactly as the provider names it.",children:c.jsx("input",{id:"model-name",required:!0,spellCheck:!1,className:`${ut} font-mono`,value:m,onChange:z=>p(z.target.value),placeholder:h5(Q)||"model-name",autoFocus:!0})}),c.jsx(ot,{label:"Label",htmlFor:"model-label",hint:"What users see. Defaults to the model name.",children:c.jsx("input",{id:"model-label",className:ut,value:y,onChange:z=>x(z.target.value),placeholder:m})}),!L&&c.jsxs("div",{children:[c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:w,onChange:z=>C(z.target.checked)}),"Can read images"]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 ml-6",children:"Pictures users attach are only sent to models marked like this. A text-only model rejects them, so it is told the picture exists instead."})]}),j&&c.jsx(ot,{label:"Reasoning effort",htmlFor:"model-effort",hint:"Sent with every request. Some models refuse function tools while they reason, so agents with tools fail with “Function tools with reasoning_effort are not supported”: choose none for those. Leave it on the provider default otherwise.",children:c.jsxs("select",{id:"model-effort",className:ut,value:T,onChange:z=>E(z.target.value),children:[c.jsx("option",{value:"",children:"Provider default"}),f5.map(z=>c.jsx("option",{value:z,children:z},z))]})}),!a&&c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:g,onChange:z=>b(z.target.checked)}),"Make this the organization default"]}),M&&c.jsx("p",{className:"text-xs text-destructive",children:M}),c.jsx(Qi,{onCancel:l,submitLabel:a?"Save":"Add model",busy:k,disabled:!u})]})})}function g5({orgId:t}){const r=Mt(),{data:a,isLoading:l,isError:o}=Cn({queryKey:["admin","llm",t],queryFn:()=>ue.admin.llm.config(t)}),[u,d]=S.useState(null),[m,p]=S.useState(null),[y,x]=S.useState(null),[g,b]=S.useState(null),[w,C]=S.useState({}),[T,E]=S.useState(""),[k,A]=S.useState(""),[M,F]=S.useState(""),Q=(a==null?void 0:a.providers)??[],j=(a==null?void 0:a.models)??[],L=Q.filter(I=>ca(k,[I.name,I.baseUrl,I.type])),$=j.filter(I=>ca(M,[I.label,I.model,I.providerName]));async function W(){await r.invalidateQueries({queryKey:["admin","llm"]}),await r.invalidateQueries({queryKey:["llm-models"]})}async function z(I){C(ee=>({...ee,[I]:{status:"testing"}}));try{const ee=await ue.admin.llm.testModel(t,I);C(ie=>({...ie,[I]:ee.ok?{status:"ok"}:{status:"error",message:ee.error??"Failed"}}))}catch(ee){C(ie=>({...ie,[I]:{status:"error",message:ee instanceof Error?ee.message:"Failed"}}))}}async function le(I){E("");try{await ue.admin.llm.updateModel(t,I,{isDefault:!0}),await W()}catch(ee){E(ee instanceof Error?ee.message:"Failed to change the default")}}return l?c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}):o?c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load the AI configuration."}):c.jsxs("div",{className:"space-y-8 max-w-4xl",children:[c.jsxs("section",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-sm font-semibold",children:"Providers"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Where requests are sent. API keys are stored encrypted and can't be read back."})]}),c.jsx("button",{onClick:()=>d("new"),className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity whitespace-nowrap shrink-0",children:"Add provider"})]}),Q.length===0?c.jsx("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:"No providers yet. Add one, then add the models your users may use."}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"max-w-xs mb-3",children:c.jsx(Bi,{value:k,onChange:A,placeholder:"Search providers…","aria-label":"Search providers"})}),L.length===0&&c.jsxs("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:["No providers match “",k.trim(),"”."]})]}),L.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsx("table",{className:"w-full text-sm border rounded-md",children:c.jsx("tbody",{className:"divide-y",children:L.map(I=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-medium",children:I.name}),c.jsxs("td",{className:"px-3 py-2 text-xs text-muted-foreground font-mono",children:[I.type==="anthropic"?"Anthropic API":I.type==="claude_code_local"?"Claude Code on the user’s computer":I.baseUrl,I.transcriptionModel&&c.jsxs("span",{className:"block font-sans",children:["Voice input: ",I.transcriptionModel]})]}),c.jsx("td",{className:"px-3 py-2 text-xs",children:I.type==="claude_code_local"?c.jsx("span",{className:"text-muted-foreground",children:"No key needed"}):I.hasApiKey?c.jsx("span",{className:"text-muted-foreground",children:"Key stored"}):c.jsx("span",{className:"text-yellow-700",children:"No key"})}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:[c.jsx("button",{onClick:()=>d(I),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>x(I),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},I.id))})})})]}),c.jsxs("section",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-sm font-semibold",children:"Models"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"What users and agents in this organization can choose. Agents without a choice use the default."})]}),c.jsx("button",{onClick:()=>p("new"),disabled:Q.length===0,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity whitespace-nowrap shrink-0",children:"Add model"})]}),T&&c.jsx("p",{className:"text-xs text-destructive mb-2",children:T}),j.length===0?c.jsx("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:"No models yet. Until one is added, chats and agents in this organization can't run."}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"max-w-xs mb-3",children:c.jsx(Bi,{value:M,onChange:F,placeholder:"Search models…","aria-label":"Search models"})}),$.length===0&&c.jsxs("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:["No models match “",M.trim(),"”."]})]}),$.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsx("table",{className:"w-full text-sm border rounded-md",children:c.jsx("tbody",{className:"divide-y",children:$.map(I=>{const ee=w[I.id];return c.jsxs("tr",{children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[I.label,I.isDefault&&c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:"Default"}),I.supportsImages&&c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-blue-100 text-blue-700",children:"Images"}),I.reasoningEffort&&c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-purple-100 text-purple-700",children:`Reasoning: ${I.reasoningEffort}`})]}),c.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[I.model," · ",I.providerName]}),(ee==null?void 0:ee.status)==="ok"&&c.jsx("div",{className:"text-xs text-green-700 mt-1",children:"Works: the provider answered."}),(ee==null?void 0:ee.status)==="error"&&c.jsx("div",{className:"text-xs text-destructive mt-1 break-words",children:ee.message})]}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap align-top",children:[c.jsx("button",{onClick:()=>void z(I.id),disabled:(ee==null?void 0:ee.status)==="testing",className:"px-2 py-1 text-xs rounded-md hover:bg-accent disabled:opacity-50 transition-colors",children:(ee==null?void 0:ee.status)==="testing"?"Testing…":"Test"}),!I.isDefault&&c.jsx("button",{onClick:()=>void le(I.id),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Make default"}),c.jsx("button",{onClick:()=>p(I),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>b(I),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},I.id)})})})})]}),u&&c.jsx(m5,{orgId:t,provider:u==="new"?null:u,onClose:()=>d(null)}),m&&c.jsx(p5,{orgId:t,providers:Q,model:m==="new"?null:m,onClose:()=>p(null)}),y&&c.jsx(Fr,{title:"Delete provider?",message:c.jsxs(c.Fragment,{children:["“",y.name,"” and all of its models will be removed. Agents that used those models switch to the organization default."]}),confirmLabel:"Delete",onConfirm:async()=>{await ue.admin.llm.deleteProvider(t,y.id),await W()},onClose:()=>x(null)}),g&&c.jsx(Fr,{title:"Remove model?",message:c.jsxs(c.Fragment,{children:["Users can no longer pick “",g.label,"”. Agents that used it switch to the organization default."]}),confirmLabel:"Remove",onConfirm:async()=>{await ue.admin.llm.deleteModel(t,g.id),await W()},onClose:()=>b(null)})]})}function y5(){const t=mt(d=>d.user),{data:r}=od(),[a,l]=S.useState(null);if(!t)return null;const o=t.isPlatformAdmin?a??t.orgId:t.orgId,u=(r==null?void 0:r.orgs)??[];return c.jsxs("div",{children:[t.isPlatformAdmin&&u.length>1&&c.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[c.jsx("label",{htmlFor:"llm-org",className:"text-sm text-muted-foreground",children:"Organization"}),c.jsx("select",{id:"llm-org",value:o,onChange:d=>l(d.target.value),className:"px-3 py-1.5 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:u.map(d=>c.jsx("option",{value:d.id,children:d.name},d.id))})]}),c.jsx(g5,{orgId:o},o)]})}function x5(){return c.jsx(sd,{children:c.jsx(y5,{})})}class Pc extends Error{}function b5(t){const r={};return t.split(/\r?\n/).forEach((a,l)=>{const o=a.trim();if(o===""||o.startsWith("#"))return;const u=o.indexOf("=");if(u<=0)throw new Pc(`Line ${l+1}: write it as NAME=value`);const d=o.slice(0,u).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(d))throw new Pc(`Line ${l+1}: "${d}" is not a valid variable name`);r[d]=o.slice(u+1)}),r}function v5(t){const r={};return t.split(/\r?\n/).forEach((a,l)=>{const o=a.trim();if(o==="")return;const u=o.indexOf(":");if(u<=0)throw new Pc(`Line ${l+1}: write it as Name: value`);const d=o.slice(0,u).trim();if(!/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/.test(d))throw new Pc(`Line ${l+1}: "${d}" is not a valid header name`);r[d]=o.slice(u+1).trim()}),r}function w5(t){return t.split(/\r?\n/).filter(r=>r.trim()!=="")}function S5(t){return(t??[]).join(`
289
+ `)}function qS(t,r){return t===r?ue.mcp:{list:()=>ue.admin.mcp.list(t),create:a=>ue.admin.mcp.create(t,a),update:(a,l)=>ue.admin.mcp.update(t,a,l),delete:a=>ue.admin.mcp.delete(t,a),test:a=>ue.admin.mcp.test(t,a),oauthDiscover:a=>ue.admin.mcp.oauthDiscover(t,a)}}const vm=`${ut} font-mono resize-y`,N5=[{value:"none",label:"No members"},{value:"org",label:"Everyone in the organization"},{value:"selected",label:"Selected people"}];function HS({result:t,authType:r}){if(!t.ok)return c.jsx("p",{className:"text-destructive break-words",children:t.error});const a=t.tools??[];return r==="oauth"&&a.length===0?c.jsxs("p",{className:"text-green-700",children:["Found it",t.serverName?` (issuer: ${t.serverName})`:"",". Connect your own account from Settings ",">"," Integrations, then test again to list its tools for every agent editor."]}):c.jsxs("div",{className:"min-w-0",children:[c.jsxs("p",{className:"text-green-700",children:["Connected",t.serverName?` to ${t.serverName}${t.serverVersion?` ${t.serverVersion}`:""}`:"","."," ",a.length===0?"It offers no tools.":`${a.length} tool${a.length===1?"":"s"}:`]}),a.length>0&&c.jsx("p",{className:"text-muted-foreground font-mono mt-0.5 break-words",children:a.map(l=>l.name).join(", ")})]})}function C5({server:t,orgId:r,onClose:a}){const l=mt(K=>{var be;return(be=K.user)==null?void 0:be.orgId}),o=qS(r,l),u=Mt(),[d,m]=S.useState((t==null?void 0:t.name)??""),[p,y]=S.useState((t==null?void 0:t.description)??""),[x,g]=S.useState((t==null?void 0:t.transport)??"http"),[b,w]=S.useState((t==null?void 0:t.authType)??"header"),[C,T]=S.useState((t==null?void 0:t.url)??""),[E,k]=S.useState(""),[A,M]=S.useState((t==null?void 0:t.command)??""),[F,Q]=S.useState(S5(t==null?void 0:t.args)),[j,L]=S.useState(""),[$,W]=S.useState(!1),[z,le]=S.useState((t==null?void 0:t.oauthAuthorizationUrl)??""),[I,ee]=S.useState((t==null?void 0:t.oauthTokenUrl)??""),[ie,re]=S.useState((t==null?void 0:t.oauthScope)??""),[Z,ce]=S.useState((t==null?void 0:t.oauthClientId)??""),[me,Re]=S.useState(""),[O,Be]=S.useState(!1),[lt,_]=S.useState((t==null?void 0:t.memberAccess)??"none"),[D,ae]=S.useState((t==null?void 0:t.memberUserIds)??[]),[he,xe]=S.useState(!1),[Oe,Me]=S.useState(""),[Le,ye]=S.useState(!1),[je,Tt]=S.useState(null),[Ke,se]=S.useState(null),[He,rt]=S.useState(!1),Qe=!t||x===t.transport,pt=Qe?(x==="http"?t==null?void 0:t.headerNames:t==null?void 0:t.envKeys)??[]:[],zt=x==="http"?E:j,Ct=Qe&&b==="oauth"&&((t==null?void 0:t.hasOauthClientSecret)??!1);S.useEffect(()=>{Tt(null),Me("")},[x,b,C,E,A,F,j,$,z,I,ie,Z,me,O]);function fe(){if(x==="http"){const be=b==="header"?E.trim()?v5(E):$?{}:void 0:void 0,Te={...z.trim()?{authorizationUrl:z.trim()}:{},...I.trim()?{tokenUrl:I.trim()}:{},...ie.trim()?{scope:ie.trim()}:{},...Z.trim()?{clientId:Z.trim()}:{},...me.trim()?{clientSecret:me.trim()}:O?{clientSecret:""}:{}},Ye=b==="oauth"&&Object.keys(Te).length>0?Te:void 0;return{url:C.trim(),...be?{headers:be}:{},...Ye?{oauth:Ye}:{}}}const K=j.trim()?b5(j):$?{}:void 0;return{command:A.trim(),args:w5(F),...K?{env:K}:{}}}async function ge(){rt(!0);try{const K=await o.oauthDiscover(C.trim()?{url:C.trim()}:{});se(K),K.authorizationUrl&&le(be=>be||K.authorizationUrl),K.tokenUrl&&ee(be=>be||K.tokenUrl),K.scope&&re(be=>be||K.scope)}catch(K){se({redirectUri:"",error:K instanceof Error?K.message:"Could not check the server"})}finally{rt(!1)}}S.useEffect(()=>{x==="http"&&b==="oauth"&&ge()},[x,b]);const oe=x==="http"?C.trim()!=="":A.trim()!=="";async function It(){ye(!0),Tt(null),Me("");try{const K=fe();Tt(await o.test({...t?{serverId:t.id}:{},transport:x,authType:b,config:K}))}catch(K){Tt({ok:!1,error:K instanceof Error?K.message:"The test could not be run"})}finally{ye(!1)}}async function J(K){K.preventDefault(),xe(!0),Me("");try{const be=fe(),Te={memberAccess:lt,...lt==="selected"?{memberUserIds:D}:{}},Ye=t?await o.update(t.id,{name:d,description:p,transport:x,authType:b,config:be,...Te}):await o.create({name:d,description:p,transport:x,authType:b,config:be,...Te});await o.test({serverId:Ye.id}).catch(()=>{}),await u.invalidateQueries({queryKey:["mcp-servers"]}),a()}catch(be){Me(be instanceof Error?be.message:"Failed to save"),xe(!1)}}return c.jsx(da,{title:t?"Edit MCP server":"Add MCP server",onClose:a,width:"w-[32rem]",children:c.jsxs("form",{onSubmit:J,className:"space-y-4",children:[c.jsx(ot,{label:"Name",htmlFor:"mcp-name",children:c.jsx("input",{id:"mcp-name",required:!0,className:ut,value:d,onChange:K=>m(K.target.value),autoFocus:!0})}),c.jsx(ot,{label:"Description",htmlFor:"mcp-desc",hint:"What its tools are for. Optional.",children:c.jsx("input",{id:"mcp-desc",className:ut,value:p,onChange:K=>y(K.target.value)})}),c.jsx(ot,{label:"Connection",htmlFor:"mcp-transport",children:c.jsxs("select",{id:"mcp-transport",className:ut,value:x,onChange:K=>g(K.target.value),children:[c.jsx("option",{value:"http",children:"Remote server (HTTP)"}),c.jsx("option",{value:"stdio",children:"Local command (stdio)"})]})}),x==="http"?c.jsxs(c.Fragment,{children:[c.jsx(ot,{label:"URL",htmlFor:"mcp-url",children:c.jsx("input",{id:"mcp-url",onBlur:()=>{b==="oauth"&&ge()},required:!0,spellCheck:!1,className:`${ut} font-mono`,value:C,onChange:K=>T(K.target.value),placeholder:"https://mcp.example.com/mcp"})}),c.jsx(ot,{label:"Authentication",htmlFor:"mcp-auth-type",children:c.jsxs("select",{id:"mcp-auth-type",className:ut,value:b,onChange:K=>w(K.target.value),children:[c.jsx("option",{value:"header",children:"A fixed header (one shared credential for everyone)"}),c.jsx("option",{value:"oauth",children:"OAuth (each person connects their own account)"})]})}),b==="header"?c.jsx(ot,{label:"Headers",htmlFor:"mcp-headers",hint:pt.length>0?`Stored: ${pt.join(", ")}. Leave empty to keep them, or enter the full list to replace them. Values are stored encrypted and can't be read back.`:"One per line, for example Authorization: Bearer <token>. Stored encrypted.",children:c.jsx("textarea",{id:"mcp-headers",rows:3,spellCheck:!1,className:vm,value:E,onChange:K=>k(K.target.value),placeholder:"Authorization: Bearer ..."})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs text-muted-foreground rounded-md border bg-muted/40 px-3 py-2",children:"KAI tries to register itself with the server automatically. If it needs a pre-registered app instead (common for Google, GitHub, …), fill in the fields below. All optional."}),c.jsxs("div",{className:"space-y-1 text-xs",children:[c.jsx("span",{className:"font-medium",children:"Redirect URI"}),Ke!=null&&Ke.redirectUri?c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"flex-1 break-all rounded-md border bg-muted/40 px-2 py-1 font-mono",children:Ke.redirectUri}),c.jsx("button",{type:"button",className:"underline",onClick:()=>{var K;return void((K=navigator.clipboard)==null?void 0:K.writeText(Ke.redirectUri))},children:"Copy"})]}):c.jsx("p",{className:"text-muted-foreground",children:Ke?"Set PUBLIC_SERVER_URL on the server to get one.":"Loading…"}),c.jsx("p",{className:"text-muted-foreground",children:"Register this as the redirect (callback) URL of the app at the provider."})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[c.jsx("button",{type:"button",className:"underline disabled:opacity-50",disabled:He||C.trim()==="",onClick:()=>void ge(),children:He?"Detecting…":"Detect from server"}),(Ke==null?void 0:Ke.error)&&c.jsx("span",{className:"text-destructive break-words",children:Ke.error}),!(Ke!=null&&Ke.error)&&(Ke==null?void 0:Ke.issuer)&&c.jsxs("span",{className:"text-muted-foreground break-words",children:["Detected from ",Ke.issuer]})]}),c.jsx(ot,{label:"Authorization URL",htmlFor:"mcp-oauth-auth-url",children:c.jsx("input",{id:"mcp-oauth-auth-url",spellCheck:!1,className:`${ut} font-mono`,value:z,onChange:K=>le(K.target.value)})}),c.jsx(ot,{label:"Token URL",htmlFor:"mcp-oauth-token-url",children:c.jsx("input",{id:"mcp-oauth-token-url",spellCheck:!1,className:`${ut} font-mono`,value:I,onChange:K=>ee(K.target.value)})}),c.jsx(ot,{label:"Scope",htmlFor:"mcp-oauth-scope",children:c.jsx("input",{id:"mcp-oauth-scope",spellCheck:!1,className:ut,value:ie,onChange:K=>re(K.target.value)})}),c.jsx(ot,{label:"Client ID",htmlFor:"mcp-oauth-client-id",hint:(Ke==null?void 0:Ke.registrationSupported)===!1&&!Z.trim()?"Required: this server cannot register KAI automatically. Use the Client ID issued by the provider.":void 0,children:c.jsx("input",{id:"mcp-oauth-client-id",spellCheck:!1,className:`${ut} font-mono`,value:Z,onChange:K=>ce(K.target.value)})}),c.jsx(ot,{label:"Client secret",htmlFor:"mcp-oauth-client-secret",hint:Ct?"Stored. Leave empty to keep it, or enter a new one to replace it. Can't be read back.":(Ke==null?void 0:Ke.registrationSupported)===!1&&Ke.clientSecretRequired?"Required: this server does not accept a client without a secret. Stored encrypted.":"Stored encrypted.",children:c.jsx("input",{id:"mcp-oauth-client-secret",type:"password",spellCheck:!1,className:`${ut} font-mono`,value:me,onChange:K=>Re(K.target.value)})}),Ct&&c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:O,onChange:K=>Be(K.target.checked),disabled:me.trim()!==""}),"Remove the stored client secret"]})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-xs text-muted-foreground rounded-md border bg-muted/40 px-3 py-2",children:"This starts the command as a process on the KAI server machine whenever an agent uses it. Only add commands you trust."}),c.jsx(ot,{label:"Command",htmlFor:"mcp-command",children:c.jsx("input",{id:"mcp-command",required:!0,spellCheck:!1,className:`${ut} font-mono`,value:A,onChange:K=>M(K.target.value),placeholder:"npx"})}),c.jsx(ot,{label:"Arguments",htmlFor:"mcp-args",hint:"One per line.",children:c.jsx("textarea",{id:"mcp-args",rows:3,spellCheck:!1,className:vm,value:F,onChange:K=>Q(K.target.value),placeholder:`-y
290
+ @modelcontextprotocol/server-filesystem`})}),c.jsx(ot,{label:"Environment variables",htmlFor:"mcp-env",hint:pt.length>0?`Stored: ${pt.join(", ")}. Leave empty to keep them, or enter the full list to replace them. Values are stored encrypted and can't be read back.`:"One NAME=value per line, for example API keys. Stored encrypted. The server gets only these, not the KAI server's own environment.",children:c.jsx("textarea",{id:"mcp-env",rows:3,spellCheck:!1,className:vm,value:j,onChange:K=>L(K.target.value),placeholder:"API_KEY=..."})})]}),pt.length>0&&c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"checkbox",className:"accent-primary",checked:$,onChange:K=>W(K.target.checked),disabled:zt.trim()!==""}),"Remove the stored ",x==="http"?"headers":"environment variables"]}),c.jsxs("fieldset",{className:"space-y-2",children:[c.jsx("legend",{className:"block text-sm font-medium mb-1",children:"Who can add this server to their own agents?"}),N5.map(K=>c.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[c.jsx("input",{type:"radio",name:"mcp-member-access",className:"accent-primary",checked:lt===K.value,onChange:()=>_(K.value)}),K.label]},K.value)),lt==="selected"&&c.jsxs("div",{className:"pl-6",children:["foreignOrg ? (",c.jsx("p",{className:"text-xs text-muted-foreground",children:"People of another organization can only be chosen by its own admins. The current selection stays as it is."}),") : (",c.jsx(Tp,{exclude:[],selected:D,onChange:ae}),")"]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Org admins can always use it. Agents that already have it keep it either way."})]}),c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("button",{type:"button",onClick:()=>void It(),disabled:Le||he||!oe,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 whitespace-nowrap shrink-0 transition-colors",children:Le?"Testing…":"Test connection"}),je&&c.jsx("div",{role:"status",className:"text-xs pt-1.5 min-w-0",children:c.jsx(HS,{result:je,authType:b})})]}),Oe&&c.jsx("p",{className:"text-xs text-destructive",children:Oe}),c.jsx(Qi,{onCancel:a,submitLabel:t?"Save":"Add server",busy:he})]})})}function k5({orgId:t}){const r=Mt(),a=mt(j=>{var L;return(L=j.user)==null?void 0:L.orgId}),l=qS(t,a),o=t!==a,{data:u,isLoading:d,isError:m}=Cn({queryKey:["mcp-servers","admin",t],queryFn:()=>l.list()}),[p,y]=S.useState(null),[x,g]=S.useState(null),[b,w]=S.useState({}),[C,T]=S.useState(""),E=S.useRef(null),k=(u==null?void 0:u.servers)??[],A=k.filter(j=>ca(C,[j.name,j.description,j.transport==="http"?j.url:j.command,...j.args??[]]));S.useEffect(()=>()=>{var j;return(j=E.current)==null?void 0:j.call(E)},[]);async function M(j){w(L=>({...L,[j.id]:"testing"}));try{const L=await l.test({serverId:j.id});w($=>({...$,[j.id]:L})),L.ok&&await r.invalidateQueries({queryKey:["mcp-servers"]})}catch(L){w($=>({...$,[j.id]:{ok:!1,error:L instanceof Error?L.message:"The test could not be run"}}))}}async function F(j){var L;w($=>({...$,[j.id]:"connecting"}));try{const{authorizationUrl:$}=await ue.mcp.oauthConnect(j.id),W=window.open($,"kai-mcp-oauth-connect","width=500,height=700");if(!W){w(z=>({...z,[j.id]:{ok:!1,error:"Your browser blocked the pop-up. Allow pop-ups for this site and try again."}}));return}(L=E.current)==null||L.call(E),E.current=kw(W,()=>{r.invalidateQueries({queryKey:["mcp-servers"]}),M(j)})}catch($){w(W=>({...W,[j.id]:{ok:!1,error:$ instanceof Error?$.message:"Could not start the connection"}}))}}function Q(j){return!o&&j.authType==="oauth"&&!j.connected?F(j):M(j)}return c.jsxs("div",{className:"max-w-4xl",children:[c.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"MCP servers give agents extra tools. Add them here, then choose which agents use them on each agent's Tools tab."}),c.jsx("button",{onClick:()=>y("new"),className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 transition-opacity whitespace-nowrap shrink-0",children:"Add server"})]}),k.length>0&&c.jsx("div",{className:"max-w-xs mb-4",children:c.jsx(Bi,{value:C,onChange:T,placeholder:"Search MCP servers…","aria-label":"Search MCP servers"})}),d&&c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}),m&&c.jsx("p",{className:"text-sm text-destructive",children:"Failed to load MCP servers."}),!d&&!m&&k.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:"No MCP servers yet."}),!d&&!m&&k.length>0&&A.length===0&&c.jsxs("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:["No MCP servers match “",C.trim(),"”."]}),A.length>0&&c.jsx("div",{className:"overflow-x-auto",children:c.jsx("table",{className:"w-full text-sm border rounded-md",children:c.jsx("tbody",{className:"divide-y",children:A.map(j=>{const L=b[j.id],$=j.transport==="http"?j.url:[j.command,...j.args??[]].join(" ");return c.jsxs("tr",{children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[j.name,c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:j.transport==="http"?"HTTP":"stdio"}),j.authType==="oauth"&&c.jsx("span",{className:"ml-1 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"OAuth"}),j.memberAccess==="org"&&c.jsx("span",{className:"ml-1 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-blue-100 text-blue-700",children:"All members"}),j.memberAccess==="selected"&&c.jsx("span",{className:"ml-1 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-blue-100 text-blue-700",children:(j.memberUserIds??[]).length===1?"1 person":`${(j.memberUserIds??[]).length} people`})]}),c.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate max-w-md",title:$,children:$}),c.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:j.toolsCheckedAt?`${j.tools.length} tool${j.tools.length===1?"":"s"} (checked ${Eo(new Date(j.toolsCheckedAt),"d MMM HH:mm")})`:j.authType==="oauth"?"Each person connects their own account from Settings > Integrations; an admin can test again afterwards to list its tools.":"Not tested yet"}),L==="connecting"&&c.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Connecting…"}),L==="testing"&&c.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Testing…"}),L&&L!=="connecting"&&L!=="testing"&&c.jsx("div",{role:"status",className:"text-xs mt-1",children:c.jsx(HS,{result:L,authType:j.authType})})]}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap align-top",children:[c.jsx("button",{onClick:()=>void Q(j),disabled:L==="connecting"||L==="testing",className:"px-2 py-1 text-xs rounded-md hover:bg-accent disabled:opacity-50 transition-colors",children:j.authType==="oauth"&&!j.connected?"Connect & test":"Test"}),c.jsx("button",{onClick:()=>y(j),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>g(j),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},j.id)})})})}),p&&c.jsx(C5,{server:p==="new"?null:p,orgId:t,onClose:()=>y(null)}),x&&c.jsx(Fr,{title:"Delete MCP server?",message:c.jsxs(c.Fragment,{children:["“",x.name,"” is removed from every agent that uses it. Those agents keep working without its tools."]}),confirmLabel:"Delete",onConfirm:async()=>{await l.delete(x.id),await r.invalidateQueries({queryKey:["mcp-servers"]})},onClose:()=>g(null)})]})}function j5(){const t=mt(d=>d.user),{data:r}=od(),[a,l]=S.useState(null);if(!t)return null;const o=t.isPlatformAdmin?a??t.orgId:t.orgId,u=(r==null?void 0:r.orgs)??[];return c.jsxs("div",{children:[t.isPlatformAdmin&&u.length>1&&c.jsxs("div",{className:"mb-6 flex items-center gap-2 max-w-4xl",children:[c.jsx("label",{htmlFor:"mcp-org",className:"text-sm text-muted-foreground",children:"Organization"}),c.jsx("select",{id:"mcp-org",value:o,onChange:d=>l(d.target.value),className:"px-3 py-1.5 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:u.map(d=>c.jsx("option",{value:d.id,children:d.name},d.id))})]}),c.jsx(k5,{orgId:o},o)]})}function E5(){return c.jsx(sd,{children:c.jsx(j5,{})})}const wm=8;function T5(){const t=_n(),r=mt(k=>k.setUser),a=Po(k=>k.setStatus),[l,o]=S.useState(!1),[u,d]=S.useState(""),[m,p]=S.useState(""),[y,x]=S.useState(""),[g,b]=S.useState(""),[w,C]=S.useState(!1);S.useEffect(()=>{if(!No()){t.replace("/login");return}ue.auth.me().then(k=>{if(!k.mustChangePassword){t.replace("/settings/general");return}o(!0)}).catch(()=>t.replace("/login"))},[t]);async function T(k){if(k.preventDefault(),b(""),m.length<wm){b(`The new password must be at least ${wm} characters.`);return}if(m!==y){b("The new passwords do not match.");return}C(!0);try{const A=await ue.auth.changePassword({currentPassword:u,newPassword:m});if($c(A.accessToken,A.refreshToken),r(Bo(A.user)),A.user.mfaPending){t.push("/mfa");return}Ge.onStatusChange(a),Ge.connect(A.accessToken),t.push("/")}catch(A){b(A instanceof Error?A.message:"Failed to change password")}finally{C(!1)}}if(!l)return c.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."});const E="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";return c.jsxs("div",{className:"w-full max-w-sm p-8 rounded-lg border bg-card text-card-foreground shadow-sm",children:[c.jsxs("div",{className:"mb-6 text-center",children:[c.jsx("h1",{className:"text-2xl font-bold",children:"Change password"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"You must choose a new password before you can continue."})]}),c.jsxs("form",{onSubmit:T,className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"current-password",children:"Current password"}),c.jsx("input",{id:"current-password",type:"password",required:!0,autoComplete:"current-password",value:u,onChange:k=>d(k.target.value),className:E})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"new-password",children:"New password"}),c.jsx("input",{id:"new-password",type:"password",required:!0,minLength:wm,autoComplete:"new-password",value:m,onChange:k=>p(k.target.value),className:E})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"confirm-password",children:"Confirm new password"}),c.jsx("input",{id:"confirm-password",type:"password",required:!0,autoComplete:"new-password",value:y,onChange:k=>x(k.target.value),className:E})]}),g&&c.jsx("p",{className:"text-sm text-destructive",children:g}),c.jsx("button",{type:"submit",disabled:w,className:"w-full py-2 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:w?"Saving...":"Change password"})]})]})}function A5(){return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsx(T5,{})})}const O5="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";function R5(){const t=_n(),r=mt(C=>C.setUser),a=Po(C=>C.setStatus),[l,o]=S.useState(null),[u,d]=S.useState(null),[m,p]=S.useState(""),[y,x]=S.useState(""),[g,b]=S.useState(!1);S.useEffect(()=>{if(!No()){t.replace("/login");return}let C=!1;return(async()=>{try{const T=await ue.auth.me();if(C)return;if(!T.mfaPending){t.replace("/");return}T.mfaPending==="setup"&&d(await ue.auth.mfa.setup()),C||o(T.mfaPending)}catch{C||t.replace("/login")}})(),()=>{C=!0}},[t]);async function w(C){C.preventDefault(),x(""),b(!0);try{const T={code:m.trim()},E=l==="setup"?await ue.auth.mfa.confirm(T):await ue.auth.mfa.verify(T);$c(E.accessToken,E.refreshToken),r(Bo(E.user)),Ge.onStatusChange(a),Ge.connect(E.accessToken),t.push("/")}catch(T){x(T instanceof Error?T.message:"Could not check the code"),p("")}finally{b(!1)}}return!l||l==="setup"&&!u?c.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."}):c.jsxs("div",{className:"w-full max-w-sm p-8 rounded-lg border bg-card text-card-foreground shadow-sm",children:[c.jsxs("div",{className:"mb-6 text-center",children:[c.jsx("h1",{className:"text-2xl font-bold",children:l==="setup"?"Set up two-step sign-in":"Two-step sign-in"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:l==="setup"?"Scan the QR code with an authenticator app (Google Authenticator, Microsoft Authenticator, 1Password, …), then enter the 6-digit code it shows.":"Enter the 6-digit code from your authenticator app."})]}),l==="setup"&&u&&c.jsxs("div",{className:"mb-6 flex flex-col items-center gap-3",children:[c.jsx("img",{src:u.qrCodeDataUrl,alt:"QR code for your authenticator app",width:192,height:192,className:"rounded-md border bg-white"}),c.jsxs("div",{className:"w-full text-center",children:[c.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Cannot scan it? Enter this key in your app instead:"}),c.jsx("code",{"data-testid":"manual-entry-key",className:"block select-all break-all rounded-md border bg-muted px-3 py-2 font-mono text-sm tracking-wider",children:u.manualEntryKey})]})]}),c.jsxs("form",{onSubmit:w,className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"mfa-code",children:"6-digit code"}),c.jsx("input",{id:"mfa-code",inputMode:"numeric",autoComplete:"one-time-code",pattern:"[0-9]{6}",maxLength:6,required:!0,autoFocus:!0,value:m,onChange:C=>p(C.target.value.replace(/\D/g,"")),className:`${O5} font-mono tracking-widest`})]}),y&&c.jsx("p",{className:"text-sm text-destructive",children:y}),c.jsx("button",{type:"submit",disabled:g||m.length!==6,className:"w-full py-2 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:g?"Checking...":l==="setup"?"Turn on and sign in":"Verify"})]})]})}function M5(){return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsx(R5,{})})}function dn(){if(!window.kai)throw new Error("Desktop bridge unavailable (not running in Electron)");return window.kai}const Lt={available:()=>window.kai!==void 0,filesystem:{list:t=>dn().filesystem.list(t),read:t=>dn().filesystem.read(t),write:(t,r)=>dn().filesystem.write(t,r)},settings:{getFolders:()=>dn().settings.getFolders(),addFolder:()=>dn().settings.addFolder(),removeFolder:t=>dn().settings.removeFolder(t),setAccess:(t,r)=>dn().settings.setAccess(t,r)},browser:{run:(t,r)=>dn().browser.run(t,r),getEnabled:()=>dn().browser.getEnabled(),setEnabled:t=>dn().browser.setEnabled(t)},screen:{capture:()=>dn().screen.capture()},claude:{status:()=>dn().claude.status(),setEnabled:t=>dn().claude.setEnabled(t),run:t=>dn().claude.run(t),cancel:t=>dn().claude.cancel(t),cancelAll:()=>dn().claude.cancelAll(),onEvent:t=>dn().claude.onEvent(t)}},z5=25,Oo=Wa(t=>({entries:[],start:r=>t(a=>({entries:[{...r,status:"running",at:new Date().toISOString()},...a.entries].slice(0,z5)})),finish:(r,a)=>t(l=>({entries:l.entries.map(o=>o.id===r?{...o,status:a===void 0?"ok":"error",...a===void 0?{}:{error:a}}:o)}))})),D5=["filesystem.list","filesystem.read","filesystem.write","screen.capture","browser.read","browser.interact"];function mo(t,r){if(typeof t!="string")throw new Error(`Missing or invalid argument: ${r}`);return t}async function _5(t){const{capability:r,args:a}=t;switch(r){case"filesystem.list":return Lt.filesystem.list(mo(a.path,"path"));case"filesystem.read":return Lt.filesystem.read(mo(a.path,"path"));case"filesystem.write":return Lt.filesystem.write(mo(a.path,"path"),mo(a.content,"content"));case"screen.capture":return Lt.screen.capture();case"browser.read":case"browser.interact":return Lt.browser.run(mo(t.tool,"tool"),a);default:throw new Error(`Unknown capability: ${r}`)}}function BS(t){return(t instanceof Error?t.message:String(t)).replace(/^Error invoking remote method '[^']+': (Error: )?/,"")}async function L5(t,r){const a=Oo.getState(),l=typeof r.args.path=="string"?r.args.path:typeof r.args.url=="string"?r.args.url:null;a.start({id:t,capability:r.capability,target:l});try{const o=await _5(r);a.finish(t),Ge.send({type:"capability.response",id:t,payload:{success:!0,result:o}})}catch(o){const u=BS(o);a.finish(t,u),Ge.send({type:"capability.response",id:t,payload:{success:!1,error:u}})}}async function U5(t){const r=Oo.getState();r.start({id:t.runId,capability:"claude.run",target:t.model||null});try{await Lt.claude.run({...t,serverUrl:ts()})}catch(a){const l=BS(a);r.finish(t.runId,l),Ge.send({type:"claude.event",id:crypto.randomUUID(),payload:{runId:t.runId,kind:"error",message:l}})}}function q5(t){Ge.send({type:"claude.event",id:crypto.randomUUID(),payload:t}),t.kind==="done"?Oo.getState().finish(t.runId):t.kind==="error"&&Oo.getState().finish(t.runId,t.message)}function H5(){return S.useEffect(()=>{if(!Lt.available())return;const t=Ge.onStatusChange(u=>{if(u!=="connected"){Lt.claude.cancelAll().catch(()=>{});return}Ge.send({type:"client.register",id:crypto.randomUUID(),payload:{clientType:"desktop",capabilities:[...D5]}})}),r=Ge.on("capability.request",(u,d)=>{L5(d.id,u)}),a=Ge.on("claude.run",u=>{U5(u)}),l=Ge.on("claude.cancel",u=>{const d=u==null?void 0:u.runId;typeof d=="string"&&Lt.claude.cancel(d).catch(()=>{})}),o=Lt.claude.onEvent(q5);return()=>{t(),r(),a(),l(),o()}},[]),null}function B5(){const t=_n(),r=mt(b=>b.setUser),a=Po(b=>b.setStatus),[l,o]=S.useState(""),[u,d]=S.useState(""),[m,p]=S.useState(""),[y,x]=S.useState(!1);async function g(b){b.preventDefault(),p(""),x(!0);try{const w=await ue.auth.login({email:l,password:u});if($c(w.accessToken,w.refreshToken),r(Bo(w.user)),w.user.mustChangePassword){t.push("/change-password");return}if(w.user.mfaPending){t.push("/mfa");return}Ge.onStatusChange(a),Ge.connect(w.accessToken),t.push("/")}catch(w){p(w instanceof Error?w.message:"Login failed")}finally{x(!1)}}return c.jsxs("div",{className:"w-full max-w-sm p-8 rounded-lg border bg-card text-card-foreground shadow-sm",children:[c.jsxs("div",{className:"mb-6 text-center",children:[c.jsx("h1",{className:"text-2xl font-bold",children:"KAI Chat"}),c.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Sign in to your account"})]}),c.jsxs("form",{onSubmit:g,className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"email",children:"Email"}),c.jsx("input",{id:"email",type:"email",required:!0,autoComplete:"email",value:l,onChange:b=>o(b.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"you@example.com"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"password",children:"Password"}),c.jsx("input",{id:"password",type:"password",required:!0,autoComplete:"current-password",value:u,onChange:b=>d(b.target.value),className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"••••••••"})]}),m&&c.jsx("p",{className:"text-sm text-destructive",children:m}),c.jsx("button",{type:"submit",disabled:y,className:"w-full py-2 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:y?"Signing in...":"Sign in"})]})]})}function I5(){const[t,r]=S.useState(ts);function a(l){r(l),l.trim()&&eT(l)}return c.jsxs("div",{className:"w-full max-w-sm",children:[c.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",htmlFor:"server-url",children:"Server"}),c.jsx("input",{id:"server-url",type:"text",value:t,onChange:l=>a(l.target.value),onBlur:()=>r(ts()),spellCheck:!1,className:"w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",placeholder:"https://kai-chat.eutima.ch"})]})}function F5(){return c.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-background p-4",children:[c.jsx(I5,{}),c.jsx(B5,{})]})}const P5={connected:"Connected",reconnecting:"Reconnecting…",disconnected:"Disconnected"},Q5={connected:"bg-green-500",reconnecting:"bg-yellow-500",disconnected:"bg-red-500"};function Ro(t){return(t instanceof Error?t.message:String(t)).replace(/^Error invoking remote method '[^']+': (Error: )?/,"")}function Xo({title:t,description:r,children:a}){return c.jsxs("section",{className:"rounded-lg border bg-card text-card-foreground",children:[c.jsxs("div",{className:"px-5 py-4 border-b",children:[c.jsx("h2",{className:"text-sm font-semibold",children:t}),r&&c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r})]}),c.jsx("div",{className:"px-5 py-4",children:a})]})}function Y5(){const[t,r]=S.useState(null),[a,l]=S.useState("");async function o(u){l("");try{r(await u())}catch(d){l(Ro(d))}}return S.useEffect(()=>{if(!Lt.available()){r([]),l("File access can only be configured in the desktop app.");return}o(()=>Lt.settings.getFolders())},[]),c.jsxs(Xo,{title:"File access",description:"Agents can only read or write inside these folders.",children:[t&&t.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"No folders allowed. Agent file tools will fail until you add one."}),t&&t.length>0&&c.jsx("ul",{className:"divide-y rounded-md border mb-4",children:t.map(u=>c.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[c.jsx("span",{className:"flex-1 min-w-0 truncate text-sm font-mono",title:u.path,children:u.path}),c.jsxs("select",{value:u.access,onChange:d=>void o(()=>Lt.settings.setAccess(u.path,d.target.value)),"aria-label":`Access for ${u.path}`,className:"px-2 py-1 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring",children:[c.jsx("option",{value:"read",children:"Read only"}),c.jsx("option",{value:"readwrite",children:"Read & write"})]}),c.jsx("button",{onClick:()=>void o(()=>Lt.settings.removeFolder(u.path)),className:"p-1.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-accent transition-colors",title:"Remove folder","aria-label":`Remove ${u.path}`,children:c.jsx(Sp,{size:16})})]},u.path))}),a&&c.jsx("p",{className:"text-sm text-destructive mb-3",children:a}),c.jsxs("button",{onClick:()=>void o(()=>Lt.settings.addFolder()),disabled:!Lt.available(),className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 transition-colors",children:[c.jsx(qE,{size:16}),"Add folder…"]})]})}function V5(){const[t,r]=S.useState(null),[a,l]=S.useState("");S.useEffect(()=>{if(!Lt.available()){l("Claude Code can only be used from the desktop app.");return}Lt.claude.status().then(r,u=>l(Ro(u)))},[]);async function o(u){l("");try{await Lt.claude.setEnabled(u),r(await Lt.claude.status())}catch(d){l(Ro(d))}}return c.jsxs(Xo,{title:"Claude Code",description:"AI models of the type “Claude Code” run the Claude Code command on this computer, with your own Claude login. It only ever starts when an agent of yours uses such a model.",children:[c.jsxs("label",{className:"flex items-start gap-3 text-sm",children:[c.jsx("input",{type:"checkbox",className:"mt-0.5",checked:(t==null?void 0:t.enabled)??!1,disabled:!t,onChange:u=>void o(u.target.checked)}),c.jsxs("span",{children:["Let agents run Claude Code on this computer",c.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"It can only read and write in the folders under File access. An agent's MCP tools are served by the KAI server; their keys never reach this computer."})]})]}),t&&c.jsx("p",{className:`text-sm mt-3 ${t.problem?"text-destructive":"text-muted-foreground"}`,children:t.problem?t.problem:`Found ${t.command}${t.version?` (${t.version})`:""}.`}),a&&c.jsx("p",{className:"text-sm text-destructive mt-3",children:a})]})}function G5(){const[t,r]=S.useState(null),[a,l]=S.useState("");S.useEffect(()=>{if(!Lt.available()){l("The browser can only be used from the desktop app.");return}Lt.browser.getEnabled().then(r,u=>l(Ro(u)))},[]);async function o(u){l("");try{r(await Lt.browser.setEnabled(u))}catch(d){l(Ro(d))}}return c.jsxs(Xo,{title:"Browser",description:"Agents with the browser capabilities open web pages in a “KAI browser” window on this computer, where you can watch them.",children:[c.jsxs("label",{className:"flex items-start gap-3 text-sm",children:[c.jsx("input",{type:"checkbox",className:"mt-0.5",checked:t??!1,disabled:t===null,onChange:u=>void o(u.target.checked)}),c.jsxs("span",{children:["Let agents use a browser on this computer",c.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"It is signed in nowhere and keeps no cookies. It never goes to this computer or your local network, only to public websites. Turning this off closes the window."})]})]}),a&&c.jsx("p",{className:"text-sm text-destructive mt-3",children:a})]})}function K5(){const t=mt(a=>a.user),r=Po(a=>a.status);return c.jsx(Xo,{title:"Connection",children:c.jsxs("dl",{className:"grid grid-cols-[7rem_1fr] gap-y-2 text-sm",children:[c.jsx("dt",{className:"text-muted-foreground",children:"Server"}),c.jsx("dd",{className:"font-mono truncate",children:ts()}),c.jsx("dt",{className:"text-muted-foreground",children:"Status"}),c.jsxs("dd",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${Q5[r]}`}),P5[r]]}),c.jsx("dt",{className:"text-muted-foreground",children:"Signed in as"}),c.jsx("dd",{className:"truncate",children:t?`${t.displayName} (${t.email})`:"—"})]})})}function X5(){const t=Oo(r=>r.entries);return c.jsx(Xo,{title:"Recent activity",description:"Requests agents made to this computer since the app started.",children:t.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing yet."}):c.jsx("ul",{className:"space-y-2",children:t.map(r=>c.jsxs("li",{className:"text-sm",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`inline-block w-2 h-2 rounded-full shrink-0 ${r.status==="ok"?"bg-green-500":r.status==="error"?"bg-red-500":"bg-yellow-500"}`}),c.jsx("span",{className:"font-mono",children:r.capability}),r.target&&c.jsx("span",{className:"text-muted-foreground truncate font-mono",title:r.target,children:r.target}),c.jsx("span",{className:"ml-auto text-xs text-muted-foreground shrink-0",children:Eo(new Date(r.at),"HH:mm:ss")})]}),r.error&&c.jsx("p",{className:"ml-4 text-xs text-destructive",children:r.error})]},r.id))})})}function $5(){return c.jsx("div",{className:"h-full overflow-y-auto",children:c.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-8 space-y-6",children:[c.jsx("h1",{className:"text-xl font-semibold",children:"Settings"}),c.jsx(Y5,{}),c.jsx(V5,{}),c.jsx(G5,{}),c.jsx(K5,{}),c.jsx(X5,{})]})})}const e1=new Map;function IS(t){let r=e1.get(t);return r||(r=Promise.resolve({id:t}),e1.set(t,r)),r}function Z5(){const{id:t=""}=j1();return c.jsx(W_,{params:IS(t)})}function J5(){const{id:t=""}=j1();return c.jsx(B3,{params:IS(t)})}function W5(){return c.jsxs(c.Fragment,{children:[c.jsx(H5,{}),c.jsx(rA,{children:c.jsx(Vk,{})})]})}function e6(){return c.jsx(EE,{children:c.jsx(xj,{children:c.jsx(S.Suspense,{fallback:null,children:c.jsxs(Kk,{children:[c.jsx(Gt,{path:"/login",element:c.jsx(F5,{})}),c.jsx(Gt,{path:"/change-password",element:c.jsx(A5,{})}),c.jsx(Gt,{path:"/mfa",element:c.jsx(M5,{})}),c.jsxs(Gt,{element:c.jsx(W5,{}),children:[c.jsx(Gt,{index:!0,element:c.jsx(iA,{})}),c.jsx(Gt,{path:"conversations/:id",element:c.jsx(Z5,{})}),c.jsx(Gt,{path:"agents",element:c.jsx(uA,{})}),c.jsx(Gt,{path:"agents/new",element:c.jsx(H3,{})}),c.jsx(Gt,{path:"agents/:id/edit",element:c.jsx(J5,{})}),c.jsx(Gt,{path:"schedules",element:c.jsx(w3,{})}),c.jsx(Gt,{path:"settings",element:c.jsx($5,{})}),c.jsx(Gt,{path:"settings/general",element:c.jsx(O3,{})}),c.jsx(Gt,{path:"settings/integrations",element:c.jsx(M3,{})}),c.jsx(Gt,{path:"admin",element:c.jsx(e5,{})}),c.jsx(Gt,{path:"admin/users",element:c.jsx(o5,{})}),c.jsx(Gt,{path:"admin/organizations",element:c.jsx(d5,{})}),c.jsx(Gt,{path:"admin/llm",element:c.jsx(x5,{})}),c.jsx(Gt,{path:"admin/mcp",element:c.jsx(E5,{})})]}),c.jsx(Gt,{path:"*",element:c.jsx(Yk,{to:"/",replace:!0})})]})})})})}const FS=document.getElementById("root");if(!FS)throw new Error("Root element not found");QC.createRoot(FS).render(c.jsx(po.StrictMode,{children:c.jsx(e6,{})}));