@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.
@@ -1,260 +0,0 @@
1
- var y2=Object.defineProperty;var lv=t=>{throw TypeError(t)};var x2=(t,r,a)=>r in t?y2(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var $t=(t,r,a)=>x2(t,typeof r!="symbol"?r+"":r,a),Ah=(t,r,a)=>r.has(t)||lv("Cannot "+a);var U=(t,r,a)=>(Ah(t,r,"read from private field"),a?a.call(t):r.get(t)),De=(t,r,a)=>r.has(t)?lv("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(t):r.set(t,a),Se=(t,r,a,l)=>(Ah(t,r,"write to private field"),l?l.call(t,a):r.set(t,a),a),et=(t,r,a)=>(Ah(t,r,"access private method"),a);var bc=(t,r,a,l)=>({set _(o){Se(t,r,o,a)},get _(){return U(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 Vm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Oh={exports:{}},eo={};/**
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 sv;function b2(){if(sv)return eo;sv=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 eo.Fragment=r,eo.jsx=a,eo.jsxs=a,eo}var ov;function v2(){return ov||(ov=1,Oh.exports=b2()),Oh.exports}var c=v2(),Rh={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 uv;function w2(){if(uv)return Ue;uv=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 k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function A(D,re,he){this.props=D,this.context=re,this.refs=j,this.updater=he||k}A.prototype.isReactComponent={},A.prototype.setState=function(D,re){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,re,"setState")},A.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function z(){}z.prototype=A.prototype;function Y(D,re,he){this.props=D,this.context=re,this.refs=j,this.updater=he||k}var q=Y.prototype=new z;q.constructor=Y,E(q,A.prototype),q.isPureReactComponent=!0;var T=Array.isArray;function H(){}var $={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function M(D,re,he){var xe=he.ref;return{$$typeof:t,type:D,key:re,ref:xe!==void 0?xe:null,props:he}}function ie(D,re){return M(D.type,re,D.props)}function Q(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function ae(D){var re={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(he){return re[he]})}var le=/\/+/g;function ne(D,re){return typeof D=="object"&&D!==null&&D.key!=null?ae(""+D.key):re.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(H,H):(D.status="pending",D.then(function(re){D.status==="pending"&&(D.status="fulfilled",D.value=re)},function(re){D.status==="pending"&&(D.status="rejected",D.reason=re)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function ce(D,re,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),re,he,xe,Oe)}}if(Le)return Oe=Oe(D),Le=xe===""?"."+ne(D,0):xe,T(Oe)?(he="",Le!=null&&(he=Le.replace(le,"$&/")+"/"),ce(Oe,re,he,"",function(Tt){return Tt})):Oe!=null&&(Q(Oe)&&(Oe=ie(Oe,he+(Oe.key==null||D&&D.key===Oe.key?"":(""+Oe.key).replace(le,"$&/")+"/")+Le)),re.push(Oe)),1;Le=0;var ye=xe===""?".":xe+":";if(T(D))for(var Ee=0;Ee<D.length;Ee++)xe=D[Ee],Me=ye+ne(xe,Ee),Le+=ce(xe,re,he,Me,Oe);else if(Ee=C(D),typeof Ee=="function")for(D=Ee.call(D),Ee=0;!(xe=D.next()).done;)xe=xe.value,Me=ye+ne(xe,Ee++),Le+=ce(xe,re,he,Me,Oe);else if(Me==="object"){if(typeof D.then=="function")return ce(Z(D),re,he,xe,Oe);throw re=String(D),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.")}return Le}function me(D,re,he){if(D==null)return D;var xe=[],Oe=0;return ce(D,xe,"","",function(Me){return re.call(he,Me,Oe++)}),xe}function Re(D){if(D._status===-1){var re=D._result,he=re();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 re=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(re))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)};function Be(D){var re=$.T,he={};he.types=re!==null?re.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(H,O)}catch(Me){O(Me)}finally{re!==null&&he.types!==null&&(re.types=he.types),$.T=re}}function it(D){var re=$.T;if(re!==null){var he=re.types;he===null?re.types=[D]:he.indexOf(D)===-1&&he.push(D)}else Be(it.bind(null,D))}var _={map:me,forEach:function(D,re,he){me(D,function(){re.apply(this,arguments)},he)},count:function(D){var re=0;return me(D,function(){re++}),re},toArray:function(D){return me(D,function(re){return re})||[]},only:function(D){if(!Q(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=Y,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=it,Ue.cache=function(D){return function(){return D.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(D,re,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(re!=null)for(Me in re.key!==void 0&&(Oe=""+re.key),re)!W.call(re,Me)||Me==="key"||Me==="__self"||Me==="__source"||Me==="ref"&&re.ref===void 0||(xe[Me]=re[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 M(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,re,he){var xe,Oe={},Me=null;if(re!=null)for(xe in re.key!==void 0&&(Me=""+re.key),re)W.call(re,xe)&&xe!=="key"&&xe!=="__self"&&xe!=="__source"&&(Oe[xe]=re[xe]);var Le=arguments.length-2;if(Le===1)Oe.children=he;else if(1<Le){for(var ye=Array(Le),Ee=0;Ee<Le;Ee++)ye[Ee]=arguments[Ee+2];Oe.children=ye}if(D&&D.defaultProps)for(xe in Le=D.defaultProps,Le)Oe[xe]===void 0&&(Oe[xe]=Le[xe]);return M(D,Me,Oe)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(D){return{$$typeof:m,render:D}},Ue.isValidElement=Q,Ue.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:Re}},Ue.memo=function(D,re){return{$$typeof:y,type:D,compare:re===void 0?null:re}},Ue.startTransition=Be,Ue.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ue.use=function(D){return $.H.use(D)},Ue.useActionState=function(D,re,he){return $.H.useActionState(D,re,he)},Ue.useCallback=function(D,re){return $.H.useCallback(D,re)},Ue.useContext=function(D){return $.H.useContext(D)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(D,re){return $.H.useDeferredValue(D,re)},Ue.useEffect=function(D,re){return $.H.useEffect(D,re)},Ue.useEffectEvent=function(D){return $.H.useEffectEvent(D)},Ue.useId=function(){return $.H.useId()},Ue.useImperativeHandle=function(D,re,he){return $.H.useImperativeHandle(D,re,he)},Ue.useInsertionEffect=function(D,re){return $.H.useInsertionEffect(D,re)},Ue.useLayoutEffect=function(D,re){return $.H.useLayoutEffect(D,re)},Ue.useMemo=function(D,re){return $.H.useMemo(D,re)},Ue.useOptimistic=function(D,re){return $.H.useOptimistic(D,re)},Ue.useReducer=function(D,re,he){return $.H.useReducer(D,re,he)},Ue.useRef=function(D){return $.H.useRef(D)},Ue.useState=function(D){return $.H.useState(D)},Ue.useSyncExternalStore=function(D,re,he){return $.H.useSyncExternalStore(D,re,he)},Ue.useTransition=function(){return $.H.useTransition()},Ue.version="19.3.0",Ue}var cv;function Gm(){return cv||(cv=1,Rh.exports=w2()),Rh.exports}var S=Gm();const mo=Vm(S);var Mh={exports:{}},to={},zh={exports:{}},Dh={};/**
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 dv;function S2(){return dv||(dv=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 it=2*(Re+1)-1,_=Z[it],D=it+1,re=Z[D];if(0>o(_,me))D<O&&0>o(re,_)?(Z[Re]=re,Z[D]=me,Re=D):(Z[Re]=_,Z[it]=me,Re=it);else if(D<O&&0>o(re,me))Z[Re]=re,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,k=!1,E=!1,j=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function Y(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(k=!1,Y(Z),!C)if(a(p)!==null)C=!0,T||(T=!0,Q());else{var ce=a(y);ce!==null&&ne(q,ce.startTime-Z)}}var T=!1,H=-1,$=5,W=-1;function M(){return E?!0:!(t.unstable_now()-W<$)}function ie(){if(E=!1,T){var Z=t.unstable_now();W=Z;var ce=!0;try{e:{C=!1,k&&(k=!1,A(H),H=-1),w=!0;var me=b;try{t:{for(Y(Z),g=a(p);g!==null&&!(g.expirationTime>Z&&M());){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,Y(Z),ce=!0;break t}g===a(p)&&l(p),Y(Z)}else l(p);g=a(p)}if(g!==null)ce=!0;else{var Be=a(y);Be!==null&&ne(q,Be.startTime-Z),ce=!1}}break e}finally{g=null,b=me,w=!1}ce=void 0}}finally{ce?Q():T=!1}}}var Q;if(typeof z=="function")Q=function(){z(ie)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,le=ae.port2;ae.port1.onmessage=ie,Q=function(){le.postMessage(null)}}else Q=function(){j(ie,0)};function ne(Z,ce){H=j(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)&&(k?(A(H),H=-1):k=!0,ne(q,me-Re))):(Z.sortIndex=O,r(p,Z),C||w||(C=!0,T||(T=!0,Q()))),Z},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(Z){var ce=b;return function(){var me=b;b=ce;try{return Z.apply(this,arguments)}finally{b=me}}}})(Dh)),Dh}var fv;function N2(){return fv||(fv=1,zh.exports=S2()),zh.exports}var _h={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 hv;function C2(){if(hv)return cn;hv=1;var t=Gm();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,k=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:k}):b==="script"&&l.d.X(x,{crossOrigin:w,integrity:C,fetchPriority:k,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 mv;function j2(){if(mv)return _h.exports;mv=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(),_h.exports=C2(),_h.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 pv;function E2(){if(pv)return to;pv=1;var t=N2(),r=Gm(),a=j2();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||k(n,e,i.child,{foundSelf:!1}),n}function k(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)&&k(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 j=null,A=null;function z(e,n,i){return e===i?!0:e===n?(j=e,!0):!1}function Y(e,n,i){return e===i?(A=e,!1):e===n?(A!==null&&(j=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 T(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 H=Object.assign,$=Symbol.for("react.element"),W=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),ie=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),ae=Symbol.for("react.profiler"),le=Symbol.for("react.consumer"),ne=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"),it=Symbol.for("react.legacy_hidden"),_=Symbol.for("react.memo_cache_sentinel"),D=Symbol.for("react.view_transition"),re=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 ie:return"Fragment";case ae:return"Profiler";case Q: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 M:return"Portal";case ne:return e.displayName||"Context";case le: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,Ee=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 nt(e){0>se||(e.current=Ke[se],Ke[se]=null,se--)}function Qe(e,n){se++,Ke[se]=e.current,e.current=n}var ht=He(null),Mt=He(null),Ct=He(null),fe=He(null);function ge(e,n){switch(Qe(Ct,n),Qe(Mt,e),Qe(ht,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?pb(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=pb(n),e=gb(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}nt(ht),Qe(ht,e)}function oe(){nt(ht),nt(Mt),nt(Ct)}function Ft(e){var n=e.memoizedState;n!==null&&(Rl._currentValue=n.memoizedState,Qe(fe,e)),n=ht.current;var i=gb(n,e.type);n!==i&&(Qe(Mt,e),Qe(ht,i))}function J(e){Mt.current===e&&(nt(ht),nt(Mt)),fe.current===e&&(nt(fe),Rl._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 te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(pe){var F=pe}Reflect.construct(e,[],te)}else{try{te.call()}catch(pe){F=pe}te=!1;try{var G=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),te=!0,new e}finally{te&&(G!==void 0?Object.defineProperty(e.prototype,"props",G):delete e.prototype.props)}}}else{try{throw Error()}catch(pe){F=pe}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(pe){if(pe&&F&&typeof pe.stack=="string")return[pe.stack,F.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
- `),P=N.split(`
45
- `);for(f=s=0;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;for(;f<P.length&&!P[f].includes("DetermineComponentFrameRoot");)f++;if(s===R.length||f===P.length)for(s=R.length-1,f=P.length-1;1<=s&&0<=f&&R[s]!==P[f];)f--;for(;1<=s&&0<=f;s--,f--)if(R[s]!==P[f]){if(s!==1||f!==1)do if(s--,f--,0>f||R[s]!==P[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 jn(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,It=t.unstable_cancelCallback,mr=t.unstable_shouldYield,En=t.unstable_requestPaint,B=t.unstable_now,ve=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,ke=t.unstable_UserBlockingPriority,ut=t.unstable_NormalPriority,Ln=t.unstable_LowPriority,Ce=t.unstable_IdlePriority,Ht=t.log,kS=t.unstable_setDisableYieldValue,ss=null,Un=null;function fa(e){if(typeof Ht=="function"&&kS(e),Un&&typeof Un.setStrictMode=="function")try{Un.setStrictMode(ss,e)}catch{}}var qn=Math.clz32?Math.clz32:OS,TS=Math.log,AS=Math.LN2;function OS(e){return e>>>=0,e===0?32:31-(TS(e)/AS|0)|0}var Go=256,Ko=262144,Xo=4194304;function Wa(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 $o(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=Wa(s):(v&=N,v!==0?f=Wa(v):i||(i=N&~e,i!==0&&(f=Wa(i))))):(N=s&~h,N!==0?f=Wa(N):v!==0?f=Wa(v):i||(i=s&~e,i!==0&&(f=Wa(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 os(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Fp(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-qn(i),f=1<<s;n|=e[s],i&=~f}return n}function RS(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 Ip(){var e=Xo;return Xo<<=1,(Xo&62914560)===0&&(Xo=4194304),e}function td(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function us(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function MS(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,P=e.hiddenUpdates;for(i=v&~i;0<i;){var X=31-qn(i),te=1<<X;N[X]=0,R[X]=-1;var F=P[X];if(F!==null)for(P[X]=null,X=0;X<F.length;X++){var G=F[X];G!==null&&(G.lane&=-536870913)}i&=~te}s!==0&&Pp(e,s,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(v&~n))}function Pp(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-qn(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function Qp(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var s=31-qn(i),f=1<<s;f&n|e[s]&n&&(e[s]|=n),i&=~f}}function Yp(e,n){var i=n&-n;return i=(i&42)!==0?1:nd(i),(i&(e.suspendedLanes|n))!==0?0:i}function nd(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 rd(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Vp(){var e=Ee.p;return e!==0?e:(e=window.event,e===void 0?32:Wb(e.type))}function Gp(e,n){var i=Ee.p;try{return Ee.p=e,n()}finally{Ee.p=i}}var Qr=Math.random().toString(36).slice(2),rn="__reactFiber$"+Qr,kn="__reactProps$"+Qr,Yi="__reactContainer$"+Qr,Kp="__reactEvents$"+Qr,zS="__reactListeners$"+Qr,DS="__reactHandles$"+Qr,Xp="__reactResources$"+Qr,cs="__reactMarker$"+Qr,Zo="__reactLoad$"+Qr;function Jo(e){delete e[rn],delete e[kn],delete e[zS],delete e[DS]}function ei(e){var n;if(n=e[rn])return n;for(var i=e.parentNode;i;){if(n=i[Yi]||i[rn]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=zb(e);e!==null;){if(i=e[rn])return i;e=zb(e)}return n}e=i,i=e.parentNode}return null}function Vi(e){if(e=e[rn]||e[Yi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function ds(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(l(33))}function Gi(e){var n=e[Xp];return n||(n=e[Xp]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Jt(e){e[cs]=!0}function $p(e){e[Zo]=void 0}var Zp=new Set,Jp={};function ti(e,n){Ki(e,n),Ki(e+"Capture",n)}function Ki(e,n){for(Jp[e]=n,e=0;e<n.length;e++)Zp.add(n[e])}var _S=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]*$"),Wp={},eg={};function LS(e){return fr.call(eg,e)?!0:fr.call(Wp,e)?!1:_S.test(e)?eg[e]=!0:(Wp[e]=!0,!1)}var lt=!1;function tg(){var e=lt;return lt=!1,e}function Wo(e,n,i){if(LS(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 eu(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 Hn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ng(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function US(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 ad(e){if(!e._valueTracker){var n=ng(e)?"checked":"value";e._valueTracker=US(e,n,""+e[n])}}function rg(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),s="";return e&&(s=ng(e)?e.checked?"true":"false":e.value),e=s,e!==i?(n.setValue(e),!0):!1}var qS=/[\n"\\]/g;function Wn(e){return e.replace(qS,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function id(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=""+Hn(n)):e.value!==""+Hn(n)&&(e.value=""+Hn(n)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),n!=null?v==="number"&&e.value==n?ld(e,Hn(e.value)):ld(e,Hn(n)):i!=null?ld(e,Hn(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=""+Hn(N):e.removeAttribute("name")}function ag(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)){ad(e);return}i=i!=null?""+Hn(i):"",n=n!=null?""+Hn(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),ad(e)}function ld(e,n){e.defaultValue!==""+n&&(e.defaultValue=""+n)}function Xi(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=""+Hn(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 ig(e,n,i){if(n!=null&&(n=""+Hn(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Hn(i):""}function lg(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=Hn(n),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),ad(e)}function $i(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var HS=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 sg(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||HS.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function og(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]="",lt=!0);for(var f in n)s=n[f],n.hasOwnProperty(f)&&i[f]!==s&&(sg(e,f,s),lt=!0)}else for(var h in n)n.hasOwnProperty(h)&&sg(e,h,n[h])}function sd(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 BS=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"]]),FS=/^[\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 tu(e){return FS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function kr(){}var od=null;function ud(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zi=null,Ji=null;function ug(e){var n=Vi(e);if(n&&(e=n.stateNode)){var i=e[kn]||null;e:switch(e=n.stateNode,n.type){case"input":if(id(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[kn]||null;if(!f)throw Error(l(90));id(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&&rg(s)}break e;case"textarea":ig(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Xi(e,!!i.multiple,n,!1)}}}var cd=!1;function cg(e,n,i){if(cd)return e(n,i);cd=!0;try{var s=e(n);return s}finally{if(cd=!1,(Zi!==null||Ji!==null)&&(tc(),Zi&&(n=Zi,e=Ji,Ji=Zi=null,ug(n),e)))for(n=0;n<e.length;n++)ug(e[n])}}function fs(e,n){var i=e.stateNode;if(i===null)return null;var s=i[kn]||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"),dd=!1;if(Vr)try{var hs={};Object.defineProperty(hs,"passive",{get:function(){dd=!0}}),window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{dd=!1}var ha=null,fd=null,nu=null;function dg(){if(nu)return nu;var e,n=fd,i=n.length,s,f="value"in ha?ha.value:ha.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 nu=f.slice(e,1<s?1-s:void 0)}function ru(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 au(){return!0}function fg(){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)?au:fg,this.isPropagationStopped=fg,this}return H(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=au)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=au)},persist:function(){},isPersistent:au}),n}var ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},iu=yn(ma),ms=H({},ma,{view:0,detail:0}),IS=yn(ms),hd,md,ps,lu=H({},ms,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gd,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!==ps&&(ps&&e.type==="mousemove"?(hd=e.screenX-ps.screenX,md=e.screenY-ps.screenY):md=hd=0,ps=e),hd)},movementY:function(e){return"movementY"in e?e.movementY:md}}),hg=yn(lu),PS=H({},lu,{dataTransfer:0}),QS=yn(PS),YS=H({},ms,{relatedTarget:0}),pd=yn(YS),VS=H({},ma,{animationName:0,elapsedTime:0,pseudoElement:0}),GS=yn(VS),KS=H({},ma,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),XS=yn(KS),$S=H({},ma,{data:0}),mg=yn($S),ZS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JS={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"},WS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function eN(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=WS[e])?!!n[e]:!1}function gd(){return eN}var tN=H({},ms,{key:function(e){if(e.key){var n=ZS[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ru(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?JS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gd,charCode:function(e){return e.type==="keypress"?ru(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ru(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),nN=yn(tN),rN=H({},lu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pg=yn(rN),aN=H({},ma,{submitter:0}),iN=yn(aN),lN=H({},ms,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gd}),sN=yn(lN),oN=H({},ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),uN=yn(oN),cN=H({},lu,{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}),dN=yn(cN),fN=H({},ma,{newState:0,oldState:0,source:0}),hN=yn(fN),mN=[9,13,27,32],yd=Vr&&"CompositionEvent"in window,gs=null;Vr&&"documentMode"in document&&(gs=document.documentMode);var pN=Vr&&"TextEvent"in window&&!gs,gg=Vr&&(!yd||gs&&8<gs&&11>=gs),yg=" ",xg=!1;function bg(e,n){switch(e){case"keyup":return mN.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vg(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wi=!1;function gN(e,n){switch(e){case"compositionend":return vg(n);case"keypress":return n.which!==32?null:(xg=!0,yg);case"textInput":return e=n.data,e===yg&&xg?null:e;default:return null}}function yN(e,n){if(Wi)return e==="compositionend"||!yd&&bg(e,n)?(e=dg(),nu=fd=ha=null,Wi=!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 gg&&n.locale!=="ko"?null:n.data;default:return null}}var xN={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 wg(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!xN[e.type]:n==="textarea"}function Sg(e,n,i,s){Zi?Ji?Ji.push(s):Ji=[s]:Zi=s,n=sc(n,"onChange"),0<n.length&&(i=new iu("onChange","change",null,i,s),e.push({event:i,listeners:n}))}var ys=null,xs=null;function bN(e){ub(e,0)}function su(e){var n=ds(e);if(rg(n))return e}function Ng(e,n){if(e==="change")return n}var Cg=!1;if(Vr){var xd;if(Vr){var bd="oninput"in document;if(!bd){var jg=document.createElement("div");jg.setAttribute("oninput","return;"),bd=typeof jg.oninput=="function"}xd=bd}else xd=!1;Cg=xd&&(!document.documentMode||9<document.documentMode)}function Eg(){ys&&(ys.detachEvent("onpropertychange",kg),xs=ys=null)}function kg(e){if(e.propertyName==="value"&&su(xs)){var n=[];Sg(n,xs,e,ud(e)),cg(bN,n)}}function vN(e,n,i){e==="focusin"?(Eg(),ys=n,xs=i,ys.attachEvent("onpropertychange",kg)):e==="focusout"&&Eg()}function wN(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return su(xs)}function SN(e,n){if(e==="click")return su(n)}function NN(e,n){if(e==="input"||e==="change")return su(n)}function CN(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var Bn=typeof Object.is=="function"?Object.is:CN;function bs(e,n){if(Bn(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)||!Bn(e[f],n[f]))return!1}return!0}function vd(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 Tg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ag(e,n){var i=Tg(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=Tg(i)}}function Og(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Og(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Rg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=vd(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=vd(e.document)}return n}function wd(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 jN=Vr&&"documentMode"in document&&11>=document.documentMode,el=null,Sd=null,vs=null,Nd=!1;function Mg(e,n,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Nd||el==null||el!==vd(s)||(s=el,"selectionStart"in s&&wd(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}),vs&&bs(vs,s)||(vs=s,s=sc(Sd,"onSelect"),0<s.length&&(n=new iu("onSelect","select",null,n,i),e.push({event:n,listeners:s}),n.target=el)))}function ni(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var tl={animationend:ni("Animation","AnimationEnd"),animationiteration:ni("Animation","AnimationIteration"),animationstart:ni("Animation","AnimationStart"),transitionrun:ni("Transition","TransitionRun"),transitionstart:ni("Transition","TransitionStart"),transitioncancel:ni("Transition","TransitionCancel"),transitionend:ni("Transition","TransitionEnd")},Cd={},zg={};Vr&&(zg=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function ri(e){if(Cd[e])return Cd[e];if(!tl[e])return e;var n=tl[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in zg)return Cd[e]=n[i];return e}var Dg=ri("animationend"),_g=ri("animationiteration"),Lg=ri("animationstart"),EN=ri("transitionrun"),kN=ri("transitionstart"),TN=ri("transitioncancel"),Ug=ri("transitionend"),qg=new Map,jd="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(" ");jd.push("scrollEnd");function pr(e,n){qg.set(e,n),ti(n,[e])}var AN=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=AN++;return e="_"+e+"t_"+i.toString(32)+"_",n.autoName=e}function Hg(e){if(e==null||typeof e=="string")return e;var n=null,i=wl;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=Hg(e),n=Hg(n),n==null?e==="auto"?null:e:n==="auto"?null:n}var ou=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=[],nl=0,Ed=0;function uu(){for(var e=nl,n=Ed=nl=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&&Bg(i,f,h)}}function cu(e,n,i,s){er[nl++]=e,er[nl++]=n,er[nl++]=i,er[nl++]=s,Ed|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function kd(e,n,i,s){return cu(e,n,i,s),du(e)}function ai(e,n){return cu(e,null,null,n),du(e)}function Bg(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-qn(i),e=h.hiddenUpdates,s=e[f],s===null?e[f]=[n]:s.push(n),n.lane=i|536870912),h):null}function du(e){if(50<Is)throw Is=0,ec=null,Error(l(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var rl={};function ON(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 ON(e,n,i,s)}function Td(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 Fg(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 fu(e,n,i,s,f,h){var v=0;if(s=e,typeof s=="function")Td(s)&&(v=1);else if(typeof s=="string")v=a2(e,i,ht.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 ie:return ii(i.children,f,h,n);case Q:v=8,f|=24;break;case ae:return e=Tn(12,i,n,f|2),e.elementType=ae,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 it: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 ne:v=10;break e;case le: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 ii(e,n,i,s){return e=Tn(7,e,s,n),e.lanes=i,e}function Ad(e,n,i){return e=Tn(6,e,null,n),e.lanes=i,e}function Ig(e){var n=Tn(18,null,null,0);return n.stateNode=e,n}function Od(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 Pg=new WeakMap;function tr(e,n){if(typeof e=="object"&&e!==null){var i=Pg.get(e);return i!==void 0?i:(n={value:e,source:n,stack:jn(n)},Pg.set(e,n),n)}return{value:e,source:n,stack:jn(n)}}var al=[],il=0,hu=null,ws=0,nr=[],rr=0,pa=null,Tr=1,Ar="";function $r(e,n){al[il++]=ws,al[il++]=hu,hu=e,ws=n}function Qg(e,n,i){nr[rr++]=Tr,nr[rr++]=Ar,nr[rr++]=pa,pa=e;var s=Tr;e=Ar;var f=32-qn(s)-1;s&=~(1<<f),i+=1;var h=32-qn(n)+f;if(30<h){var v=f-f%5;h=(s&(1<<v)-1).toString(32),s>>=v,f-=v,Tr=1<<32-qn(n)+f|i<<f|s,Ar=h+e}else Tr=1<<h|i<<f|s,Ar=e}function mu(e){e.return!==null&&($r(e,1),Qg(e,1,0))}function Rd(e){for(;e===hu;)hu=al[--il],al[il]=null,ws=al[--il],al[il]=null;for(;e===pa;)pa=nr[--rr],nr[rr]=null,Ar=nr[--rr],nr[rr]=null,Tr=nr[--rr],nr[rr]=null}function Yg(e,n){nr[rr++]=Tr,nr[rr++]=Ar,nr[rr++]=pa,Tr=n.id,Ar=n.overflow,pa=e}var Wt=null,jt=null,Ve=!1,ga=null,ar=!1,Md=Error(l(519));function ya(e){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ss(tr(n,e)),Md}function Vg(e){var n=e.stateNode,i=e.type,s=e.memoizedProps;switch(n[rn]=e,n[kn]=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<Qs.length;i++)$e(Qs[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),ag(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),lg(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||hb(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=kr),n=!0):n=!1,n||ya(e,!0)}function pu(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 ll(e){if(e!==Wt)return!1;if(!Ve)return pu(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")||uh(e.type,e.memoizedProps)),i=!i),i&&jt&&ya(e),pu(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));jt=Mb(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));jt=Mb(e)}else n===27?(n=jt,za(e.type)?(e=xh,xh=null,jt=e):jt=n):jt=Wt?lr(e.stateNode.nextSibling):null;return!0}function li(){jt=Wt=null,Ve=!1}function zd(){var e=ga;return e!==null&&(Rn===null?Rn=e:Rn.push.apply(Rn,e),ga=null),e}function Ss(e){ga===null?ga=[e]:ga.push(e)}var Dd=He(null),si=null,Zr=null;function xa(e,n,i){Qe(Dd,n._currentValue),n._currentValue=i}function Jr(e){e._currentValue=Dd.current,nt(Dd)}function gu(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 _d(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),gu(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),gu(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),gu(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 oi(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;Bn(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(Rl):e=[Rl])}f=f.return}return e!==null&&_d(n,e,i,s),n.flags|=262144,e!==null}function yu(e){for(e=e.firstContext;e!==null;){if(!Bn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ui(e){si=e,Zr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function an(e){return Gg(si,e)}function xu(e,n){return si===null&&ui(e),Gg(e,n)}function Gg(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 RN=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()})}},MN=t.unstable_scheduleCallback,zN=t.unstable_NormalPriority,Pt={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ld(){return{controller:new RN,data:new Map,refCount:0}}function Ns(e){e.refCount--,e.refCount===0&&MN(zN,function(){e.controller.abort()})}function Kg(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 Cs=null;function DN(e){var n=e.transitionTypes;return e.transitionTypes=null,n}var js=null,Ud=0,ci=0,sl=null;function _N(e,n){if(js===null){var i=js=[];Ud=0,ci=eh(),sl={status:"pending",value:void 0,then:function(s){i.push(s)}}}return Ud++,n.then(Xg,Xg),n}function Xg(){if(--Ud===0&&(Cs=null,js!==null)){sl!==null&&(sl.status="fulfilled");var e=js;js=null,ci=0,sl=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function LN(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 $g=ye.S;ye.S=function(e,n){if(Ix=B(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&_N(e,n),Cs!==null)for(var i=jl;i!==null;)Kg(i,Cs),i=i.next;if(i=e.types,i!==null){for(var s=jl;s!==null;)Kg(s,i),s=s.next;if(ci!==0){s=Cs,s===null&&(s=Cs=[]);for(var f=0;f<i.length;f++){var h=i[f];s.indexOf(h)===-1&&s.push(h)}}}$g!==null&&$g(e,n)};var di=He(null);function qd(){var e=di.current;return e!==null?e:vt.pooledCache}function bu(e,n){n===null?Qe(di,di.current):Qe(di,n.pool)}function Zg(){var e=qd();return e===null?null:{parent:Pt._currentValue,pool:e}}var ol=Error(l(460)),Hd=Error(l(474)),vu=Error(l(542)),wu={then:function(){}};function Jg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Wg(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(kr,kr),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ty(e),e===void 0&&!("reason"in n)?Error(l(600)):e;default:if(typeof n.status=="string")n.then(kr,kr);else{if(e=vt,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,ty(e),e}throw hi=n,ol}}function fi(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(hi=i,ol):i}}var hi=null;function ey(){if(hi===null)throw Error(l(459));var e=hi;return hi=null,e}function ty(e){if(e===ol||e===vu)throw Error(l(483))}var ul=null,Es=0;function Su(e){var n=Es;return Es+=1,ul===null&&(ul=[]),Wg(ul,e,n)}function ba(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Nu(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 ny(e){function n(I,L){if(e){var V=I.deletions;V===null?(I.deletions=[L],I.flags|=16):V.push(L)}}function i(I,L){if(!e)return null;for(;L!==null;)n(I,L),L=L.sibling;return null}function s(I){for(var L=new Map;I!==null;)I.key===null?L.set(I.index,I):L.set(I.key,I),I=I.sibling;return L}function f(I,L){return I=Xr(I,L),I.index=0,I.sibling=null,I}function h(I,L,V){return I.index=V,e?(V=I.alternate,V!==null?(V=V.index,V<L?(I.flags|=2,L):V):(I.flags|=134217730,L)):(I.flags|=1048576,L)}function v(I){return e&&I.alternate===null&&(I.flags|=134217730),I}function N(I,L,V,ee){return L===null||L.tag!==6?(L=Ad(V,I.mode,ee),L.return=I,L):(L=f(L,V),L.return=I,L)}function R(I,L,V,ee){var Ne=V.type;return Ne===ie?(I=X(I,L,V.props.children,ee,V.key),ba(I,V),I):L!==null&&(L.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===O&&fi(Ne)===L.type)?(L=f(L,V.props),ba(L,V),L.return=I,L):(L=fu(V.type,V.key,V.props,null,I.mode,ee),ba(L,V),L.return=I,L)}function P(I,L,V,ee){return L===null||L.tag!==4||L.stateNode.containerInfo!==V.containerInfo||L.stateNode.implementation!==V.implementation?(L=Od(V,I.mode,ee),L.return=I,L):(L=f(L,V.children||[]),L.return=I,L)}function X(I,L,V,ee,Ne){return L===null||L.tag!==7?(L=ii(V,I.mode,ee,Ne),L.return=I,L):(L=f(L,V),L.return=I,L)}function te(I,L,V){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Ad(""+L,I.mode,V),L.return=I,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case W:return V=fu(L.type,L.key,L.props,null,I.mode,V),ba(V,L),V.return=I,V;case M:return L=Od(L,I.mode,V),L.return=I,L;case O:return L=fi(L),te(I,L,V)}if(Le(L)||xe(L))return L=ii(L,I.mode,V,null),L.return=I,L;if(typeof L.then=="function")return te(I,Su(L),V);if(L.$$typeof===ne)return te(I,xu(I,L),V);Nu(I,L)}return null}function F(I,L,V,ee){var Ne=L!==null?L.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Ne!==null?null:N(I,L,""+V,ee);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case W:return V.key===Ne?R(I,L,V,ee):null;case M:return V.key===Ne?P(I,L,V,ee):null;case O:return V=fi(V),F(I,L,V,ee)}if(Le(V)||xe(V))return Ne!==null?null:X(I,L,V,ee,null);if(typeof V.then=="function")return F(I,L,Su(V),ee);if(V.$$typeof===ne)return F(I,L,xu(I,V),ee);Nu(I,V)}return null}function G(I,L,V,ee,Ne){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return I=I.get(V)||null,N(L,I,""+ee,Ne);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case W:return I=I.get(ee.key===null?V:ee.key)||null,R(L,I,ee,Ne);case M:return I=I.get(ee.key===null?V:ee.key)||null,P(L,I,ee,Ne);case O:return ee=fi(ee),G(I,L,V,ee,Ne)}if(Le(ee)||xe(ee))return I=I.get(V)||null,X(L,I,ee,Ne,null);if(typeof ee.then=="function")return G(I,L,V,Su(ee),Ne);if(ee.$$typeof===ne)return G(I,L,V,xu(L,ee),Ne);Nu(L,ee)}return null}function pe(I,L,V,ee){for(var Ne=null,We=null,Ae=L,_e=L=0,Vt=null;Ae!==null&&_e<V.length;_e++){Ae.index>_e?(Vt=Ae,Ae=null):Vt=Ae.sibling;var rt=F(I,Ae,V[_e],ee);if(rt===null){Ae===null&&(Ae=Vt);break}e&&Ae&&rt.alternate===null&&n(I,Ae),L=h(rt,L,_e),We===null?Ne=rt:We.sibling=rt,We=rt,Ae=Vt}if(_e===V.length)return i(I,Ae),Ve&&$r(I,_e),Ne;if(Ae===null){for(;_e<V.length;_e++)Ae=te(I,V[_e],ee),Ae!==null&&(L=h(Ae,L,_e),We===null?Ne=Ae:We.sibling=Ae,We=Ae);return Ve&&$r(I,_e),Ne}for(Ae=s(Ae);_e<V.length;_e++)Vt=G(Ae,I,_e,V[_e],ee),Vt!==null&&(e&&(rt=Vt.alternate,rt!==null&&Ae.delete(rt.key===null?_e:rt.key)),L=h(Vt,L,_e),We===null?Ne=Vt:We.sibling=Vt,We=Vt);return e&&Ae.forEach(function(qa){return n(I,qa)}),Ve&&$r(I,_e),Ne}function je(I,L,V,ee){if(V==null)throw Error(l(151));for(var Ne=null,We=null,Ae=L,_e=L=0,Vt=null,rt=V.next();Ae!==null&&!rt.done;_e++,rt=V.next()){Ae.index>_e?(Vt=Ae,Ae=null):Vt=Ae.sibling;var qa=F(I,Ae,rt.value,ee);if(qa===null){Ae===null&&(Ae=Vt);break}e&&Ae&&qa.alternate===null&&n(I,Ae),L=h(qa,L,_e),We===null?Ne=qa:We.sibling=qa,We=qa,Ae=Vt}if(rt.done)return i(I,Ae),Ve&&$r(I,_e),Ne;if(Ae===null){for(;!rt.done;_e++,rt=V.next())rt=te(I,rt.value,ee),rt!==null&&(L=h(rt,L,_e),We===null?Ne=rt:We.sibling=rt,We=rt);return Ve&&$r(I,_e),Ne}for(Ae=s(Ae);!rt.done;_e++,rt=V.next())rt=G(Ae,I,_e,rt.value,ee),rt!==null&&(e&&(Vt=rt.alternate,Vt!==null&&Ae.delete(Vt.key===null?_e:Vt.key)),L=h(rt,L,_e),We===null?Ne=rt:We.sibling=rt,We=rt);return e&&Ae.forEach(function(g2){return n(I,g2)}),Ve&&$r(I,_e),Ne}function Ie(I,L,V,ee){if(typeof V=="object"&&V!==null&&V.type===ie&&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;L!==null;){if(L.key===Ne){if(Ne=V.type,Ne===ie){if(L.tag===7){i(I,L.sibling),ee=f(L,V.props.children),ba(ee,V),ee.return=I,I=ee;break e}}else if(L.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===O&&fi(Ne)===L.type){i(I,L.sibling),ee=f(L,V.props),ba(ee,V),ee.return=I,I=ee;break e}i(I,L);break}else n(I,L);L=L.sibling}V.type===ie?(ee=ii(V.props.children,I.mode,ee,V.key),ba(ee,V),ee.return=I,I=ee):(ee=fu(V.type,V.key,V.props,null,I.mode,ee),ba(ee,V),ee.return=I,I=ee)}return v(I);case M:e:{for(Ne=V.key;L!==null;){if(L.key===Ne)if(L.tag===4&&L.stateNode.containerInfo===V.containerInfo&&L.stateNode.implementation===V.implementation){i(I,L.sibling),ee=f(L,V.children||[]),ee.return=I,I=ee;break e}else{i(I,L);break}else n(I,L);L=L.sibling}ee=Od(V,I.mode,ee),ee.return=I,I=ee}return v(I);case O:return V=fi(V),Ie(I,L,V,ee)}if(Le(V))return pe(I,L,V,ee);if(xe(V)){if(Ne=xe(V),typeof Ne!="function")throw Error(l(150));return V=Ne.call(V),je(I,L,V,ee)}if(typeof V.then=="function")return Ie(I,L,Su(V),ee);if(V.$$typeof===ne)return Ie(I,L,xu(I,V),ee);Nu(I,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,L!==null&&L.tag===6?(i(I,L.sibling),ee=f(L,V),ee.return=I,I=ee):(i(I,L),ee=Ad(V,I.mode,ee),ee.return=I,I=ee),v(I)):i(I,L)}return function(I,L,V,ee){try{Es=0;var Ne=Ie(I,L,V,ee);return ul=null,Ne}catch(Ae){if(Ae===ol||Ae===vu)throw Ae;var We=Tn(29,Ae,null,I.mode);return We.lanes=ee,We.return=I,We}finally{}}}var mi=ny(!0),ry=ny(!1),va=!1;function Bd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fd(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 wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sa(e,n,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(ct&2)!==0){var f=s.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),s.pending=n,n=du(e),Bg(e,null,i),n}return cu(e,s,n,i),du(e)}function ks(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,Qp(e,i)}}function Id(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 Pd=!1;function Ts(){if(Pd){var e=sl;if(e!==null)throw e}}function As(e,n,i,s){Pd=!1;var f=e.updateQueue;va=!1;var h=f.firstBaseUpdate,v=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var R=N,P=R.next;R.next=null,v===null?h=P:v.next=P,v=R;var X=e.alternate;X!==null&&(X=X.updateQueue,N=X.lastBaseUpdate,N!==v&&(N===null?X.firstBaseUpdate=P:N.next=P,X.lastBaseUpdate=R))}if(h!==null){var te=f.baseState;v=0,X=P=R=null,N=h;do{var F=N.lane&-536870913,G=F!==N.lane;if(G?(Je&F)===F:(s&F)===F){F!==0&&F===ci&&(Pd=!0),X!==null&&(X=X.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var pe=e,je=N;F=n;var Ie=i;switch(je.tag){case 1:if(pe=je.payload,typeof pe=="function"){te=pe.call(Ie,te,F);break e}te=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=je.payload,F=typeof pe=="function"?pe.call(Ie,te,F):pe,F==null)break e;te=H({},te,F);break e;case 2:va=!0}}F=N.callback,F!==null&&(e.flags|=64,G&&(e.flags|=8192),G=f.callbacks,G===null?f.callbacks=[F]:G.push(F))}else G={lane:F,tag:N.tag,payload:N.payload,callback:N.callback,next:null},X===null?(P=X=G,R=te):X=X.next=G,v|=F;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=te),f.baseState=R,f.firstBaseUpdate=P,f.lastBaseUpdate=X,h===null&&(f.shared.lanes=0),Aa|=v,e.lanes=v,e.memoizedState=te}}function ay(e,n){if(typeof e!="function")throw Error(l(191,e));e.call(n)}function iy(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ay(i[e],n)}var Na=He(null),Cu=He(0);function ly(e,n){e=ra,Qe(Cu,e),Qe(Na,n),ra=e|n.baseLanes}function Qd(){Qe(Cu,ra),Qe(Na,Na.current)}function Yd(){ra=Cu.current,nt(Na),nt(Cu)}var ln=He(null),hn=null;function Ca(e){var n=e.alternate;Qe(sn,sn.current&1),Qe(ln,e),hn===null&&(n===null||Na.current!==null||n.memoizedState!==null)&&(hn=e)}function Vd(e){Qe(sn,sn.current),Qe(ln,e),hn===null&&(hn=e)}function sy(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){nt(ln),hn===e&&(hn=null),nt(sn)}var sn=He(0);function Os(e,n){Qe(ln,ln.current),Qe(sn,n)}function Gd(e){nt(sn),nt(ln),hn===e&&(hn=null)}function ju(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||gh(i)||yh(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,Fe=null,bt=null,Qt=null,Eu=!1,cl=!1,pi=!1,ku=0,Rs=0,dl=null,UN=0;function Ut(){throw Error(l(321))}function Kd(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!Bn(e[i],n[i]))return!1;return!0}function Xd(e,n,i,s,f,h){return Wr=h,Fe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,ye.H=e===null||e.memoizedState===null?Qy:Yy,pi=!1,h=i(s,f),pi=!1,cl&&(h=uy(n,i,s,f)),oy(e),h}function oy(e){ye.H=Du;var n=bt!==null&&bt.next!==null;if(Wr=0,Qt=bt=Fe=null,Eu=!1,Rs=0,dl=null,n)throw Error(l(300));e===null||Yt||(e=e.dependencies,e!==null&&yu(e)&&(Yt=!0))}function uy(e,n,i,s){Fe=e;var f=0;do{if(cl&&(dl=null),Rs=0,cl=!1,25<=f)throw Error(l(301));if(f+=1,Qt=bt=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=YN,h=n(i,s)}while(cl);return h}function qN(){var e=ye.H,n=e.useState()[0];return n=typeof n.then=="function"?Ms(n):n,e=e.useState()[0],(bt!==null?bt.memoizedState:null)!==e&&(Fe.flags|=1024),n}function $d(){var e=ku!==0;return ku=0,e}function Zd(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function Jd(e){if(Eu){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Eu=!1}Wr=0,Qt=bt=Fe=null,cl=!1,Rs=ku=0,dl=null}function xn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?Fe.memoizedState=Qt=e:Qt=Qt.next=e,Qt}function Bt(){if(bt===null){var e=Fe.alternate;e=e!==null?e.memoizedState:null}else e=bt.next;var n=Qt===null?Fe.memoizedState:Qt.next;if(n!==null)Qt=n,bt=e;else{if(e===null)throw Fe.alternate===null?Error(l(467)):Error(l(310));bt=e,e={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Qt===null?Fe.memoizedState=Qt=e:Qt=Qt.next=e}return Qt}function Tu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ms(e){var n=Rs;return Rs+=1,dl===null&&(dl=[]),e=Wg(dl,e,n),n=Fe,(Qt===null?n.memoizedState:Qt.next)===null&&(n=n.alternate,ye.H=n===null||n.memoizedState===null?Qy:Yy),e}function Au(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ms(e);if(e.$$typeof===re)return;if(e.$$typeof===ne)return an(e)}throw Error(l(438,String(e)))}function Wd(e){var n=null,i=Fe.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var s=Fe.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=Tu(),Fe.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 Ou(e){var n=Bt();return ef(n,bt,e)}function ef(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,P=n,X=!1;do{var te=P.lane&-536870913;if(te!==P.lane?(Je&te)===te:(Wr&te)===te){var F=P.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),te===ci&&(X=!0);else if((Wr&F)===F){P=P.next,F===ci&&(X=!0);continue}else te={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},R===null?(N=R=te,v=h):R=R.next=te,Fe.lanes|=F,Aa|=F;te=P.action,pi&&i(h,te),h=P.hasEagerState?P.eagerState:i(h,te)}else F={lane:te,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},R===null?(N=R=F,v=h):R=R.next=F,Fe.lanes|=te,Aa|=te;P=P.next}while(P!==null&&P!==n);if(R===null?v=h:R.next=N,!Bn(h,e.memoizedState)&&(Yt=!0,X&&(i=sl,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 tf(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);Bn(h,n.memoizedState)||(Yt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,s]}function cy(e,n,i){var s=Fe,f=Bt(),h=Ve;if(h){if(i===void 0)throw Error(l(407));i=i()}else i=n();var v=!Bn((bt||f).memoizedState,i);if(v&&(f.memoizedState=i,Yt=!0),f=f.queue,af(hy.bind(null,s,f,e),[e]),e=f.getSnapshot!==n||v||Qt!==null&&(Qt.memoizedState.tag&1)!==0,fl(e?9:8,{destroy:void 0},fy.bind(null,s,f,i,n),null),e){if(s.flags|=2048,vt===null)throw Error(l(349));h||(Wr&127)!==0||dy(s,n,i)}return i}function dy(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Fe.updateQueue,n===null?(n=Tu(),Fe.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function fy(e,n,i,s){n.value=i,n.getSnapshot=s,my(n)&&py(e)}function hy(e,n,i){return i(function(){my(n)&&py(e)})}function my(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!Bn(e,i)}catch{return!0}}function py(e){var n=ai(e,2);n!==null&&Mn(n,e,2)}function nf(e){var n=xn();if(typeof e=="function"){var i=e;if(e=i(),pi){fa(!0);try{i()}finally{fa(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},n}function gy(e,n,i,s){return e.baseState=i,ef(e,bt,typeof s=="function"?s:ea)}function HN(e,n,i,s,f){if(zu(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,yy(n,h)):(h.next=i.next,n.pending=i.next=h)}}function yy(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),xy(e,n,N)}catch(P){rf(e,n,P)}finally{h!==null&&v.types!==null&&(h.types=v.types),ye.T=h}}else try{h=i(f,s),xy(e,n,h)}catch(P){rf(e,n,P)}}function xy(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){by(e,n,s)},function(s){return rf(e,n,s)}):by(e,n,i)}function by(e,n,i){n.status="fulfilled",n.value=i,vy(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,yy(e,i)))}function rf(e,n,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=i,vy(n),n=n.next;while(n!==s)}e.action=null}function vy(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function wy(e,n){return n}function Sy(e,n){if(Ve){var i=vt.formState;if(i!==null){e:{var s=Fe;if(Ve){if(jt){t:{for(var f=jt,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){jt=lr(f.nextSibling),s=f.data==="F!";break e}}ya(s)}s=!1}s&&(n=i[0])}}return i=xn(),i.memoizedState=i.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wy,lastRenderedState:n},i.queue=s,i=Fy.bind(null,Fe,s),s.dispatch=i,s=nf(!1),h=cf.bind(null,Fe,!1,s.queue),s=xn(),f={state:n,dispatch:null,action:e,pending:null},s.queue=f,i=HN.bind(null,Fe,f,h,i),f.dispatch=i,s.memoizedState=e,[n,i,!1]}function Ny(e){var n=Bt();return Cy(n,bt,e)}function Cy(e,n,i){if(n=ef(e,n,wy)[0],e=Ou(ea)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=Ms(n)}catch(v){throw v===ol?vu:v}else s=n;n=Bt();var f=n.queue,h=f.dispatch;return i!==n.memoizedState&&(Fe.flags|=2048,fl(9,{destroy:void 0},BN.bind(null,f,i),null)),[s,h,e]}function BN(e,n){e.action=n}function jy(e){var n=Bt(),i=bt;if(i!==null)return Cy(n,i,e);Bt(),n=n.memoizedState,i=Bt();var s=i.queue.dispatch;return i.memoizedState=e,[n,s,!1]}function fl(e,n,i,s){return e={tag:e,create:i,deps:s,inst:n,next:null},n=Fe.updateQueue,n===null&&(n=Tu(),Fe.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 Ey(){return Bt().memoizedState}function Ru(e,n,i,s){var f=xn();Fe.flags|=e,f.memoizedState=fl(1|n,{destroy:void 0},i,s===void 0?null:s)}function Mu(e,n,i,s){var f=Bt();s=s===void 0?null:s;var h=f.memoizedState.inst;bt!==null&&s!==null&&Kd(s,bt.memoizedState.deps)?f.memoizedState=fl(n,h,i,s):(Fe.flags|=e,f.memoizedState=fl(1|n,h,i,s))}function ky(e,n){Ru(8390656,8,e,n)}function af(e,n){Mu(2048,8,e,n)}function FN(e){Fe.flags|=4;var n=Fe.updateQueue;if(n===null)n=Tu(),Fe.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function Ty(e){var n=Bt().memoizedState;return FN({ref:n,nextImpl:e}),function(){if((ct&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function Ay(e,n){return Mu(4,2,e,n)}function Oy(e,n){return Mu(4,4,e,n)}function Ry(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 My(e,n,i){i=i!=null?i.concat([e]):null,Mu(4,4,Ry.bind(null,n,e),i)}function lf(){}function zy(e,n){var i=Bt();n=n===void 0?null:n;var s=i.memoizedState;return n!==null&&Kd(n,s[1])?s[0]:(i.memoizedState=[e,n],e)}function Dy(e,n){var i=Bt();n=n===void 0?null:n;var s=i.memoizedState;if(n!==null&&Kd(n,s[1]))return s[0];if(s=e(),pi){fa(!0);try{e()}finally{fa(!1)}}return i.memoizedState=[s,n],s}function sf(e,n,i){return i===void 0||(Wr&1073741824)!==0&&(Je&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=Qx(),Fe.lanes|=e,Aa|=e,i)}function _y(e,n,i,s){return Bn(i,n)?i:Na.current!==null?(e=sf(e,i,s),Bn(e,n)||(Yt=!0),e):(Wr&106)===0||(Wr&1073741824)!==0&&(Je&261930)===0?(Yt=!0,e.memoizedState=i):(e=Qx(),Fe.lanes|=e,Aa|=e,n)}function Ly(e,n,i,s,f){var h=Ee.p;Ee.p=h!==0&&8>h?h:8;var v=ye.T,N={};N.types=v!==null?v.types:null,ye.T=N,cf(e,!1,n,i);try{var R=f(),P=ye.S;if(P!==null&&P(N,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var X=LN(R,s);zs(e,n,X,Yn(e))}else zs(e,n,s,Yn(e))}catch(te){zs(e,n,{then:function(){},status:"rejected",reason:te},Yn())}finally{Ee.p=h,v!==null&&N.types!==null&&(v.types=N.types),ye.T=v}}function IN(){}function of(e,n,i,s){if(e.tag!==5)throw Error(l(476));var f=Uy(e).queue;Ly(e,f,n,Tt,i===null?IN:function(){return qy(e),i(s)})}function Uy(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 qy(e){var n=Uy(e);n.next===null&&(n=e.alternate.memoizedState),zs(e,n.next.queue,{},Yn())}function uf(){return an(Rl)}function Hy(){return Bt().memoizedState}function By(){return Bt().memoizedState}function PN(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Yn();e=wa(i);var s=Sa(n,e,i);s!==null&&(Mn(s,n,i),ks(s,n,i)),n={cache:Ld()},e.payload=n;return}n=n.return}}function QN(e,n,i){var s=Yn();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},zu(e)?Iy(n,i):(i=kd(e,n,i,s),i!==null&&(Mn(i,e,s),Py(i,n,s)))}function Fy(e,n,i){var s=Yn();zs(e,n,i,s)}function zs(e,n,i,s){var f={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(zu(e))Iy(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,Bn(N,v))return cu(e,n,f,0),vt===null&&uu(),!1}catch{}finally{}if(i=kd(e,n,f,s),i!==null)return Mn(i,e,s),Py(i,n,s),!0}return!1}function cf(e,n,i,s){if(s={lane:2,revertLane:eh(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},zu(e)){if(n)throw Error(l(479))}else n=kd(e,i,s,2),n!==null&&Mn(n,e,2)}function zu(e){var n=e.alternate;return e===Fe||n!==null&&n===Fe}function Iy(e,n){cl=Eu=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Py(e,n,i){if((i&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,i|=s,n.lanes=i,Qp(e,i)}}var Du={readContext:an,use:Au,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},Qy={readContext:an,use:Au,useCallback:function(e,n){return xn().memoizedState=[e,n===void 0?null:n],e},useContext:an,useEffect:ky,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Ru(4194308,4,Ry.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Ru(4194308,4,e,n)},useInsertionEffect:function(e,n){Ru(4,2,e,n)},useMemo:function(e,n){var i=xn();n=n===void 0?null:n;var s=e();if(pi){fa(!0);try{e()}finally{fa(!1)}}return i.memoizedState=[s,n],s},useReducer:function(e,n,i){var s=xn();if(i!==void 0){var f=i(n);if(pi){fa(!0);try{i(n)}finally{fa(!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=QN.bind(null,Fe,e),[s.memoizedState,e]},useRef:function(e){var n=xn();return e={current:e},n.memoizedState=e},useState:function(e){e=nf(e);var n=e.queue,i=Fy.bind(null,Fe,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:lf,useDeferredValue:function(e,n){var i=xn();return sf(i,e,n)},useTransition:function(){var e=nf(!1);return e=Ly.bind(null,Fe,e.queue,!0,!1),xn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var s=Fe,f=xn();if(Ve){if(i===void 0)throw Error(l(407));i=i()}else{if(i=n(),vt===null)throw Error(l(349));(Je&127)!==0||dy(s,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,ky(hy.bind(null,s,h,e),[e]),s.flags|=2048,fl(9,{destroy:void 0},fy.bind(null,s,h,i,n),null),i},useId:function(){var e=xn(),n=vt.identifierPrefix;if(Ve){var i=Ar,s=Tr;i=(s&~(1<<32-qn(s)-1)).toString(32)+i,n="_"+n+"R_"+i,i=ku++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=UN++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:uf,useFormState:Sy,useActionState:Sy,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=cf.bind(null,Fe,!0,i),i.dispatch=n,[e,n]},useMemoCache:Wd,useCacheRefresh:function(){return xn().memoizedState=PN.bind(null,Fe)},useEffectEvent:function(e){var n=xn(),i={impl:e};return n.memoizedState=i,function(){if((ct&2)!==0)throw Error(l(440));return i.impl.apply(void 0,arguments)}}},Yy={readContext:an,use:Au,useCallback:zy,useContext:an,useEffect:af,useImperativeHandle:My,useInsertionEffect:Ay,useLayoutEffect:Oy,useMemo:Dy,useReducer:Ou,useRef:Ey,useState:function(){return Ou(ea)},useDebugValue:lf,useDeferredValue:function(e,n){var i=Bt();return _y(i,bt.memoizedState,e,n)},useTransition:function(){var e=Ou(ea)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:Ms(e),n]},useSyncExternalStore:cy,useId:Hy,useHostTransitionStatus:uf,useFormState:Ny,useActionState:Ny,useOptimistic:function(e,n){var i=Bt();return gy(i,bt,e,n)},useMemoCache:Wd,useCacheRefresh:By,useEffectEvent:Ty},YN={readContext:an,use:Au,useCallback:zy,useContext:an,useEffect:af,useImperativeHandle:My,useInsertionEffect:Ay,useLayoutEffect:Oy,useMemo:Dy,useReducer:tf,useRef:Ey,useState:function(){return tf(ea)},useDebugValue:lf,useDeferredValue:function(e,n){var i=Bt();return bt===null?sf(i,e,n):_y(i,bt.memoizedState,e,n)},useTransition:function(){var e=tf(ea)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:Ms(e),n]},useSyncExternalStore:cy,useId:Hy,useHostTransitionStatus:uf,useFormState:jy,useActionState:jy,useOptimistic:function(e,n){var i=Bt();return bt!==null?gy(i,bt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Wd,useCacheRefresh:By,useEffectEvent:Ty};function df(e,n,i,s){n=e.memoizedState,i=i(s,n),i=i==null?n:H({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var ff={enqueueSetState:function(e,n,i){e=e._reactInternals;var s=Yn(),f=wa(s);f.payload=n,i!=null&&(f.callback=i),n=Sa(e,f,s),n!==null&&(Mn(n,e,s),ks(n,e,s))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var s=Yn(),f=wa(s);f.tag=1,f.payload=n,i!=null&&(f.callback=i),n=Sa(e,f,s),n!==null&&(Mn(n,e,s),ks(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Yn(),s=wa(i);s.tag=2,n!=null&&(s.callback=n),n=Sa(e,s,i),n!==null&&(Mn(n,e,i),ks(n,e,i))}};function Vy(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?!bs(i,s)||!bs(f,h):!0}function Gy(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&&ff.enqueueReplaceState(n,n.state,null)}function gi(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=H({},i));for(var f in e)i[f]===void 0&&(i[f]=e[f])}return i}function Ky(e){ou(e)}function Xy(e){console.error(e)}function $y(e){ou(e)}function _u(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function Zy(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 hf(e,n,i){return i=wa(i),i.tag=3,i.payload={element:null},i.callback=function(){_u(e,n)},i}function Jy(e){return e=wa(e),e.tag=3,e}function Wy(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(){Zy(n,i,s)}}var v=i.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){Zy(n,i,s),typeof f!="function"&&(Oa===null?Oa=new Set([this]):Oa.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function VN(e,n,i,s,f){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=i.alternate,n!==null&&oi(n,i,f,!0),i=ln.current,i!==null){switch(i.tag){case 31:case 13:case 19:return hn===null?nc():i.alternate===null&&qt===0&&(qt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,s===wu?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([s]):n.add(s),Zf(e,s,f)),!1;case 22:return i.flags|=65536,s===wu?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)),Zf(e,s,f)),!1}throw Error(l(435,i.tag))}return Zf(e,s,f),nc(),!1}if(Ve)return n=ln.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,s!==Md&&(e=Error(l(422),{cause:s}),Ss(tr(e,i)))):(s!==Md&&(n=Error(l(423),{cause:s}),Ss(tr(n,i))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,s=tr(s,i),f=hf(e.stateNode,s,f),Id(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=hf(i.stateNode,s,e),Id(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"&&(Oa===null||!Oa.has(h))))return i.flags|=65536,f&=-f,i.lanes|=f,f=Jy(f),Wy(f,e,i,s),Id(i,f),!1;break;case 22:if(i.memoizedState!==null)return i.flags|=65536,!1}i=i.return}while(i!==null);return!1}var mf=Error(l(461)),Yt=!1;function Xt(e,n,i,s){n.child=e===null?ry(n,null,i,s):mi(n,e.child,i,s)}function ex(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 ui(n),s=Xd(e,n,i,v,h,f),N=$d(),e!==null&&!Yt?(Zd(e,n,f),ta(e,n,f)):(Ve&&N&&mu(n),n.flags|=1,Xt(e,n,s,f),n.child)}function tx(e,n,i,s,f){if(e===null){var h=i.type;return typeof h=="function"&&!Td(h)&&h.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=h,nx(e,n,h,s,f)):(e=fu(i.type,null,s,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Sf(e,f)){var v=h.memoizedProps;if(i=i.compare,i=i!==null?i:bs,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 nx(e,n,i,s,f){if(e!==null){var h=e.memoizedProps;if(bs(h,s)&&e.ref===n.ref)if(Yt=!1,n.pendingProps=s=h,Sf(e,f))(e.flags&131072)!==0&&(Yt=!0);else return n.lanes=e.lanes,ta(e,n,f)}return pf(e,n,i,s,f)}function rx(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 ax(e,n,h,i,s)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&bu(n,h!==null?h.cachePool:null),h!==null?ly(n,h):Qd(),sy(n);else return s=n.lanes=536870912,ax(e,n,h!==null?h.baseLanes|i:i,i,s)}else h!==null?(bu(n,h.cachePool),ly(n,h),ja(),n.memoizedState=null):(e!==null&&bu(n,null),Qd(),ja());return Xt(e,n,f,i),n.child}function Ds(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function ax(e,n,i,s,f){var h=qd();return h=h===null?null:{parent:Pt._currentValue,pool:h},n.memoizedState={baseLanes:i,cachePool:h},e!==null&&bu(n,null),Qd(),sy(n),e!==null&&oi(e,n,s,!0),n.childLanes=f,null}function Lu(e,n){return n=Uu({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function ix(e,n,i){return mi(n,e.child,null,i),e=Lu(n,n.pendingProps),e.flags|=2,Fn(n),n.memoizedState=null,e}function GN(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=Lu(n,s),n.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Ds(null,e);if(Vd(n),(e=jt)?(e=Rb(e,ar),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:pa!==null?{id:Tr,overflow:Ar}:null,retryLane:536870912,hydrationErrors:null},i=Ig(e),i.return=n,n.child=i,Wt=n,jt=null)):e=null,e===null)throw ya(n);return n.lanes=536870912,null}return Lu(n,s)}var h=e.memoizedState;if(h!==null){var v=h.dehydrated;if(Vd(n),f)if(n.flags&256)n.flags&=-257,n=ix(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||oi(e,n,i,!1),f=(i&e.childLanes)!==0,Yt||f){if(Na.current===null){if(s=vt,s!==null&&(v=Yp(s,i),v!==0&&v!==h.retryLane))throw h.retryLane=v,ai(e,v),Mn(s,e,v),mf;nc()}n=ix(e,n,i)}else e=h.treeContext,jt=lr(v.nextSibling),Wt=n,Ve=!0,ga=null,ar=!1,e!==null&&Yg(n,e),n=Lu(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 hl(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 pf(e,n,i,s,f){return ui(n),i=Xd(e,n,i,s,void 0,f),s=$d(),e!==null&&!Yt?(Zd(e,n,f),ta(e,n,f)):(Ve&&s&&mu(n),n.flags|=1,Xt(e,n,i,f),n.child)}function lx(e,n,i,s,f,h){return ui(n),n.updateQueue=null,i=uy(n,s,i,f),oy(e),s=$d(),e!==null&&!Yt?(Zd(e,n,h),ta(e,n,h)):(Ve&&s&&mu(n),n.flags|=1,Xt(e,n,i,h),n.child)}function sx(e,n,i,s,f){if(ui(n),n.stateNode===null){var h=rl,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=ff,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=s,h.state=n.memoizedState,h.refs={},Bd(n),v=i.contextType,h.context=typeof v=="object"&&v!==null?an(v):rl,h.state=n.memoizedState,v=i.getDerivedStateFromProps,typeof v=="function"&&(df(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&&ff.enqueueReplaceState(h,h.state,null),As(n,s,h,f),Ts(),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=gi(i,N);h.props=R;var P=h.context,X=i.contextType;v=rl,typeof X=="object"&&X!==null&&(v=an(X));var te=i.getDerivedStateFromProps;X=typeof te=="function"||typeof h.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,X||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(N||P!==v)&&Gy(n,h,s,v),va=!1;var F=n.memoizedState;h.state=F,As(n,s,h,f),Ts(),P=n.memoizedState,N||F!==P||va?(typeof te=="function"&&(df(n,i,te,s),P=n.memoizedState),(R=va||Vy(n,i,R,s,F,P,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=P),h.props=s,h.state=P,h.context=v,s=R):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{h=n.stateNode,Fd(e,n),v=n.memoizedProps,X=gi(i,v),h.props=X,te=n.pendingProps,F=h.context,P=i.contextType,R=rl,typeof P=="object"&&P!==null&&(R=an(P)),N=i.getDerivedStateFromProps,(P=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==te||F!==R)&&Gy(n,h,s,R),va=!1,F=n.memoizedState,h.state=F,As(n,s,h,f),Ts();var G=n.memoizedState;v!==te||F!==G||va||e!==null&&e.dependencies!==null&&yu(e.dependencies)?(typeof N=="function"&&(df(n,i,N,s),G=n.memoizedState),(X=va||Vy(n,i,X,s,F,G,R)||e!==null&&e.dependencies!==null&&yu(e.dependencies))?(P||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&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&F===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&&F===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),s=!1)}return h=s,hl(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=mi(n,e.child,null,f),n.child=mi(n,null,i,f)):Xt(e,n,i,f),n.memoizedState=h.state,e=n.child):e=ta(e,n,f),e}function ox(e,n,i,s){return li(),n.flags|=256,Xt(e,n,i,s),n.child}var gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yf(e){return{baseLanes:e,cachePool:Zg()}}function xf(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=Qn),e}function ux(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?Ca(n):ja(),(e=jt)?(e=Rb(e,ar),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:pa!==null?{id:Tr,overflow:Ar}:null,retryLane:536870912,hydrationErrors:null},i=Ig(e),i.return=n,n.child=i,Wt=n,jt=null)):e=null,e===null)throw ya(n);return yh(e)?n.lanes=32:n.lanes=536870912,null}return h=s.children,s=s.fallback,f?(ja(),f=n.mode,h=Uu({mode:"hidden",children:h},f),s=ii(s,f,i,null),h.return=n,s.return=n,h.sibling=s,n.child=h,s=n.child,s.memoizedState=yf(i),s.childLanes=xf(e,v,i),n.memoizedState=gf,Ds(null,s)):(Ca(n),bf(n,h))}var N=e.memoizedState;if(N!==null){var R=N.dehydrated;if(R!==null)return KN(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=ii(f,h,i,null),f.flags|=2),f.return=n,s.return=n,s.sibling=f,n.child=s,Ds(null,s),s=n.child,f=e.child.memoizedState,f===null?f=yf(i):(h=f.cachePool,h!==null?(N=Pt._currentValue,h=h.parent!==N?{parent:N,pool:N}:h):h=Zg(),f={baseLanes:f.baseLanes|i,cachePool:h}),s.memoizedState=f,s.childLanes=xf(e,v,i),n.memoizedState=gf,Ds(e.child,s)):(Ca(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 bf(e,n){return n=Uu({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Uu(e,n){return e=Tn(22,e,null,n),e.lanes=0,e}function qu(e,n,i){return mi(n,e.child,null,i),e=bf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function KN(e,n,i,s,f,h,v,N){if(i)return n.flags&256?(Ca(n),n.flags&=-257,qu(e,n,N)):n.memoizedState!==null?(ja(),n.child=e.child,n.flags|=128,null):(ja(),h=f.fallback,v=n.mode,f=Uu({mode:"visible",children:f.children},v),h=ii(h,v,N,null),h.flags|=2,f.return=n,h.return=n,f.sibling=h,n.child=f,mi(n,e.child,null,N),f=n.child,f.memoizedState=yf(N),f.childLanes=xf(e,s,N),n.memoizedState=gf,Ds(null,f));if(Ca(n),yh(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,Ss({value:f,source:null,stack:null})),qu(e,n,N)}if(Yt||oi(e,n,N,!1),s=(N&e.childLanes)!==0,Yt||s){if(Na.current!==null)return qu(e,n,N);if(s=vt,s!==null&&(f=Yp(s,N),f!==0&&f!==v.retryLane))throw v.retryLane=f,ai(e,f),Mn(s,e,f),mf;return gh(h)||nc(),qu(e,n,N)}return gh(h)?(n.flags|=192,n.child=e.child,null):(e=v.treeContext,jt=lr(h.nextSibling),Wt=n,Ve=!0,ga=null,ar=!1,e!==null&&Yg(n,e),n=bf(n,f.children),n.flags|=134221824,n)}function cx(e,n,i){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),gu(e.return,n,i)}function dx(e){for(var n=null;e!==null;){var i=e.alternate;i!==null&&ju(i)===null&&(n=e),e=e.sibling}return n}function Hu(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 vf(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 wf(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 Os(n,v),null;var N=(v&2)!==0;if(N?(v=v&1|2,n.flags|=128):v&=1,Os(n,v),f==="backwards"&&e!==null?(vf(e),Xt(e,n,s,i),vf(e)):Xt(e,n,s,i),s=Ve?ws:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cx(e,i,n);else if(e.tag===19)cx(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=dx(n.child),i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null,vf(n)),Hu(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&&ju(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}Hu(n,!0,i,null,h,s);break;case"together":Hu(n,!1,null,null,void 0,s);break;case"independent":n.memoizedState=null;break;default:i=dx(n.child),i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),Hu(n,!1,f,i,h,s)}return n.child}function fx(e,n,i){var s=n.pendingProps;return xa(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),Aa|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(oi(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 Sf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&yu(e)))}function XN(e,n,i){switch(n.tag){case 3:ge(n,n.stateNode.containerInfo),xa(n,Pt,e.memoizedState.cache),li();break;case 27:case 5:Ft(n);break;case 4:ge(n,n.stateNode.containerInfo);break;case 10:xa(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Vd(n),null;break;case 13:var s=n.memoizedState;if(s!==null){if(s.dehydrated!==null)return Ca(n),n.flags|=128,null;s=oi(e,n,i,!1);var f=n.child.childLanes;return s||(i&f)!==0?ux(e,n,i):(Ca(n),e=ta(e,n,i),e!==null?e.sibling:null)}Ca(n);break;case 19:if(n.flags&128)return wf(e,n,i);if(f=(e.flags&128)!==0,s=(i&n.childLanes)!==0,s||(oi(e,n,i,!1),s=(i&n.childLanes)!==0),f){if(s)return wf(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Os(n,sn.current),s)break;return null;case 22:return n.lanes=0,rx(e,n,i,n.pendingProps);case 24:xa(n,Pt,e.memoizedState.cache)}return ta(e,n,i)}function hx(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Yt=!0;else{if(!Sf(e,i)&&(n.flags&128)===0)return Yt=!1,XN(e,n,i);Yt=(e.flags&131072)!==0}else Yt=!1,Ve&&(n.flags&1048576)!==0&&Qg(n,ws,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=fi(n.elementType),n.type=e,typeof e=="function")Td(e)?(s=gi(e,s),n.tag=1,n=sx(null,n,e,s,i)):(n.tag=0,n=pf(null,n,e,s,i));else{if(e!=null){var f=e.$$typeof;if(f===Z){n.tag=11,n=ex(null,n,e,s,i);break e}else if(f===Re){n.tag=14,n=tx(null,n,e,s,i);break e}else if(f===ne){n.tag=10,n.type=e,n=fx(null,n,i);break e}}throw n=Me(e)||e,Error(l(306,n,""))}}return n;case 0:return pf(e,n,n.type,n.pendingProps,i);case 1:return s=n.type,f=gi(s,n.pendingProps),sx(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,Fd(e,n),As(n,s,null,i);var v=n.memoizedState;if(s=v.cache,xa(n,Pt,s),s!==h.cache&&_d(n,[Pt],i,!0),Ts(),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=ox(e,n,s,i);break e}else if(s!==f){f=tr(Error(l(424)),n),Ss(f),n=ox(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(jt=lr(e.firstChild),Wt=n,Ve=!0,ga=null,ar=!0,i=ry(n,null,s,i),n.child=i;i;)i.flags=i.flags&-3|134221824,i=i.sibling}else{if(li(),s===f){n=ta(e,n,i);break e}Xt(e,n,s,i)}n=n.child}return n;case 26:return hl(e,n),e===null?(i=qb(n.type,null,n.pendingProps,null))?n.memoizedState=i:Ve||(n.stateNode=yb(n.type,n.pendingProps,Ct.current,n)):n.memoizedState=qb(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Ft(n),e===null&&Ve&&(s=n.stateNode=Db(n.type,n.pendingProps,Ct.current),Wt=n,ar=!0,f=jt,za(n.type)?(xh=f,jt=lr(s.firstChild)):jt=f),Xt(e,n,n.pendingProps.children,i),hl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ve&&((f=s=jt)&&(s=PC(s,n.type,n.pendingProps,ar),s!==null?(n.stateNode=s,Wt=n,jt=lr(s.firstChild),ar=!1,f=!0):f=!1),f||ya(n)),Ft(n),f=n.type,h=n.pendingProps,v=e!==null?e.memoizedProps:null,s=h.children,uh(f,h)?s=null:v!==null&&uh(f,v)&&(n.flags|=32),n.memoizedState!==null&&(f=Xd(e,n,qN,null,null,i),Rl._currentValue=f),hl(e,n),Xt(e,n,s,i),n.child;case 6:return e===null&&Ve&&((e=i=jt)&&(i=QC(i,n.pendingProps,ar),i!==null?(n.stateNode=i,Wt=n,jt=null,e=!0):e=!1),e||ya(n)),null;case 13:return ux(e,n,i);case 4:return ge(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=mi(n,null,s,i):Xt(e,n,s,i),n.child;case 11:return ex(e,n,n.type,n.pendingProps,i);case 7:return s=n.pendingProps,hl(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 fx(e,n,i);case 9:return f=n.type._context,s=n.pendingProps.children,ui(n),f=an(f),s=s(f),n.flags|=1,Xt(e,n,s,i),n.child;case 14:return tx(e,n,n.type,n.pendingProps,i);case 15:return nx(e,n,n.type,n.pendingProps,i);case 19:return wf(e,n,i);case 31:return GN(e,n,i);case 22:return rx(e,n,i,n.pendingProps);case 24:return ui(n),s=an(Pt),e===null?(f=qd(),f===null&&(f=vt,h=Ld(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=i),f=h),n.memoizedState={parent:s,cache:f},Bd(n),xa(n,Pt,f)):((e.lanes&i)!==0&&(Fd(e,n),As(n,null,null,i),Ts()),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),xa(n,Pt,s)):(s=h.cache,xa(n,Pt,s),s!==f.cache&&_d(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&&mu(n),e!==null&&e.memoizedProps.name!==s.name?n.flags|=4194816:hl(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 Nf(e,n,i,s,f){var h;if((h=(e.mode&32)!==0)&&(h=i===null?Ib(n,s):Ib(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(Kx())e.flags|=8192;else throw hi=wu,Hd}else e.flags&=-16777217}function mx(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Pb(n))if(Kx())e.flags|=8192;else throw hi=wu,Hd}function Bu(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Ip():536870912,e.lanes|=n,xl|=n)}function _s(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 Et(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 $N(e,n,i){var s=n.pendingProps;switch(Rd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(n),null;case 1:return Et(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)&&(ll(n)?na(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,zd())),Et(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(na(n),h!==null?(Et(n),mx(n,h)):(Et(n),Nf(n,f,null,s,i))):h?h!==e.memoizedState?(na(n),Et(n),mx(n,h)):(Et(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&na(n),Et(n),Nf(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 Et(n),n.subtreeFlags&=-33554433,null}e=ht.current,ll(n)?Vg(n):(e=Db(f,s,i),n.stateNode=e,na(n))}return Et(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 Et(n),n.subtreeFlags&=-33554433,null}if(h=ht.current,ll(n))Vg(n);else{var v=Vs(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[kn]=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 Et(n),n.subtreeFlags&=-33554433,Nf(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,ll(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||hb(e.nodeValue,i)),e||ya(n,!0)}else e=Vs(e).createTextNode(s),e[rn]=n,n.stateNode=e}return Et(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(s=ll(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 li(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),e=!1}else i=zd(),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 Et(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=ll(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 li(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Et(n),f=!1}else f=zd(),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),Bu(n,n.updateQueue),Et(n),null);case 4:return oe(),e===null&&ah(n.stateNode.containerInfo),n.flags|=67108864,Et(n),null;case 10:return Jr(n.type),Et(n),null;case 19:if(Gd(n),s=n.memoizedState,s===null)return Et(n),null;if(f=(n.flags&128)!==0,h=s.rendering,h===null)if(f)_s(s,!1);else{if(qt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=ju(e),h!==null){for(n.flags|=128,_s(s,!1),e=h.updateQueue,n.updateQueue=e,Bu(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)Fg(i,e),i=i.sibling;return Os(n,sn.current&1|2),Ve&&$r(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&B()>Ju&&(n.flags|=128,f=!0,_s(s,!1),n.lanes=4194304)}else{if(!f)if(e=ju(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Bu(n,e),_s(s,!0),s.tail===null&&s.tailMode!=="collapsed"&&s.tailMode!=="visible"&&!h.alternate&&!Ve)return Et(n),null}else 2*B()-s.renderingStartTime>Ju&&i!==536870912&&(n.flags|=128,f=!0,_s(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=B(),e.sibling=null,h=sn.current,h=f?h&1|2:h&1,s.tailMode==="visible"||s.tailMode==="collapsed"||!i||Ve?Os(n,h):(i=h,Qe(ln,n),Qe(sn,i),hn===null&&(hn=n)),Ve&&$r(n,s.treeForkCount),e}return Et(n),null;case 22:case 23:return Fn(n),Yd(),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&&(Et(n),n.subtreeFlags&6&&(n.flags|=8192)):Et(n),i=n.updateQueue,i!==null&&Bu(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&&nt(di),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Jr(Pt),Et(n),null;case 25:return null;case 30:return n.flags|=33554432,Et(n),null}throw Error(l(156,n.tag))}function ZN(e,n){switch(Rd(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));li()}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));li()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return Gd(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),Yd(),e!==null&&nt(di),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 px(e,n){switch(Rd(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:Gd(n);break;case 10:Jr(n.type);break;case 22:case 23:Fn(n),Yd(),e!==null&&nt(di);break;case 24:Jr(Pt)}}function Ls(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){pt(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,P=N;try{P()}catch(X){pt(f,R,X)}}}s=s.next}while(s!==h)}}catch(X){pt(n,n.return,X)}}function gx(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{iy(n,i)}catch(s){pt(e,e.return,s)}}}function yx(e,n,i){i.props=gi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){pt(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=Cb(h)),s=f.ref;break;case 7:if(e.stateNode===null){var v=new Vn(e);g(e.child,!1,FC,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){pt(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){pt(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){pt(e,n,f)}else i.current=null}function Fu(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++)Ob(e.stateNode,n[i])}function xx(e){for(var n=e.return;n!==null&&(jf(n)&&Ob(e.stateNode,n.stateNode),!Cf(n));)n=n.return}function Us(e){for(var n=e.return;n!==null&&(jf(n)&&IC(e.stateNode,n.stateNode),!Cf(n));)n=n.return}function Cf(e){return e.tag===5||e.tag===3||e.tag===27}function jf(e){return e&&e.tag===7&&e.stateNode!==null}function Ef(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){pt(e,e.return,f)}}function kf(e,n,i){try{var s=e.stateNode;NC(s,e.type,i,n),s[kn]=n}catch(f){pt(e,e.return,f)}}function bx(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&za(e.type)||e.tag===4}function Tf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bx(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&&za(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 Af(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=kr)),Fu(e,s),lt=!0;else if(f!==4&&(f===27&&(Fu(e,s),s=null,za(e.type)&&(i=e.stateNode,n=null)),e=e.child,e!==null))for(Af(e,n,i,s),e=e.sibling;e!==null;)Af(e,n,i,s),e=e.sibling}function Iu(e,n,i,s){var f=e.tag;if(f===5||f===6)f=e.stateNode,n?i.insertBefore(f,n):i.appendChild(f),Fu(e,s),lt=!0;else if(f!==4&&(f===27&&(Fu(e,s),s=null,za(e.type)&&(i=e.stateNode)),e=e.child,e!==null))for(Iu(e,n,i,s),e=e.sibling;e!==null;)Iu(e,n,i,s),e=e.sibling}function vx(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[kn]=i}catch(h){pt(e,e.return,h)}}var Pu=!1,In=null;function wx(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(Pu=!0)}var Rr=null;function Sx(){var e=Rr;return Rr=null,e}var An=0;function ml(e,n,i,s,f){return An=0,Nx(e.child,n,i,s,f)}function Nx(e,n,i,s,f){for(var h=!1;e!==null;){if(e.tag===5){var v=e.stateNode;if(s!==null){var N=fh(v);s.push(N),N.view&&(h=!0)}else h||fh(v).view&&(h=!0);Pu=!0,Sb(v,An===0?n:n+"_"+An,i),An++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&f||Nx(e.child,n,i,s,f)&&(h=!0));e=e.sibling}return h}function Mr(e,n){for(;e!==null;)e.tag===5?Nb(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&n||Mr(e.child,n)),e=e.sibling}function Qu(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Qu(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"&&(ml(e,i,n,null,!1)||Mr(e.child,!1))}e=e.sibling}}function Of(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"?ml(e,f,h,null,!1)?(Qu(e),i.paired||n||Sl(e,s.onEnter)):Mr(e.child,!1):Qu(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Of(e,n),e=e.sibling;else Qu(e)}function Rf(e){if(In!==null&&In.size!==0){var n=In;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"&&(ml(e,s,h,null,!1)?(h=e.stateNode,f.paired=h,h.paired=f,Sl(e,i.onShare)):Mr(e.child,!1)),n.delete(s),n.size===0)break}}}Rf(e)}e=e.sibling}}}function Mf(e){if(e.tag===30){var n=e.memoizedProps,i=Gr(n,e.stateNode),s=In!==null?In.get(i):void 0,f=Kr(n.default,s!==void 0?n.share:n.exit);f!=="none"&&(ml(e,i,f,null,!1)?s!==void 0?(f=e.stateNode,s.paired=f,f.paired=s,In.delete(i),Sl(e,n.onShare)):Sl(e,n.onExit):Mr(e.child,!1)),In!==null&&Rf(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Mf(e),e=e.sibling;else In!==null&&Rf(e)}function Cx(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"&&ml(e,i,n,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Cx(e);e=e.sibling}}function zf(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))}zf(e)}e=e.sibling}}function Yu(e){if(e.tag===30)e.stateNode.paired=null,Mr(e.child,!1),zf(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Yu(e),e=e.sibling;else zf(e)}function jx(e){for(e=e.child;e!==null;)e.tag===30?Mr(e.child,!1):(e.subtreeFlags&33554432)!==0&&jx(e),e=e.sibling}function Df(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 P=h[An],X=fh(R);(P.view||X.view)&&(N=!0);var te;if(te=(e.flags&4)===0)if(X.clip)te=!0;else{te=P.rect;var F=X.rect;te=te.y!==F.y||te.x!==F.x||te.height!==F.height||te.width!==F.width}te&&(e.flags|=4),X.abs?X=!P.abs:(P=P.rect,X=X.rect,X=P.height!==X.height||P.width!==X.width),X&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Sb(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:Df(e,n.child,i,s,f,h,v)&&(N=!0));n=n.sibling}return N}function Ex(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=Df(s,N,f,f,h,v,!1),(e.flags&4)!==0&&f&&Sl(e,i.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Ex(e);e=e.sibling}}var en=!1,ft=!1,zr=!1,_f=!1,kx=typeof WeakSet=="function"?WeakSet:Set,tn=null,Dr=!1,qs=!1,Vu=!1,Lf=!1;function JN(e,n,i){if(e=e.containerInfo,sh=Ml,e=Rg(e),wd(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,P=-1,X=0,te=0,F=e,G=null;t:for(;;){for(var pe;F!==s||h!==0&&F.nodeType!==3||(R=N+h),F!==v||f!==0&&F.nodeType!==3||(P=N+f),F.nodeType===3&&(N+=F.nodeValue.length),(pe=F.firstChild)!==null;)G=F,F=pe;for(;;){if(F===e)break t;if(G===s&&++X===h&&(R=N),G===v&&++te===f&&(P=N),(pe=F.nextSibling)!==null)break;F=G,G=F.parentNode}F=pe}s=R===-1||P===-1?null:{start:R,end:P}}else s=null}s=s||{start:0,end:0}}else s=null;for(oh={focusedElem:e,selectionRange:s},Ml=!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&&Mf(s[h]);if(e.alternate===null&&(e.flags&2)!==0)i&&wx(e),Gu(i);else{if(e.tag===22){if(s=e.alternate,e.memoizedState!==null){s!==null&&s.memoizedState===null&&i&&Mf(s),Gu(i);continue}else if(s!==null&&s.memoizedState!==null){i&&wx(e),Gu(i);continue}}s=e.child,(e.subtreeFlags&n)!==0&&s!==null?(s.return=e,tn=s):(i&&Cx(e),Gu(i))}}In=null}function Gu(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=gi(n.type,f);i=h.getSnapshotBeforeUpdate(v,s),h.__reactInternalSnapshotBeforeUpdate=i}catch(N){pt(n,n.return,N)}}break;case 3:if((f&1024)!==0){if(s=n.stateNode.containerInfo,i=s.nodeType,i===9)ph(s);else if(i===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":ph(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"&&ml(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 Tx(e,n,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:_r(e,i),s&4&&Ls(5,i);break;case 1:if(_r(e,i),s&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(v){pt(i,i.return,v)}else{var f=gi(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(v){pt(i,i.return,v)}}s&64&&gx(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{iy(e,n)}catch(v){pt(i,i.return,v)}}break;case 27:n===null&&s&4&&vx(i);case 26:case 5:_r(e,i),n===null&&s&4&&Ef(i),s&512&&Or(i,i.return);break;case 12:_r(e,i);break;case 31:_r(e,i),s&4&&Mx(e,i);break;case 13:_r(e,i),s&4&&zx(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=cC.bind(null,i),YC(e,i))));break;case 22:if(s=i.memoizedState!==null||en,!s){var h=n!==null&&n.memoizedState!==null||ft;n=en,f=ft,en=s,(ft=h)&&!f?(s=2,(i.subtreeFlags&8772)!==0&&(s|=1),xr(e,i,s)):_r(e,i),en=n,ft=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 Uf(e,n){for(e=e.child;e!==null;)Ax(e,n),e=e.sibling}function Ax(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){pt(e,e.return,R)}qf(e,n);break;case 6:try{e.stateNode.nodeValue=n?"":e.memoizedProps,lt=!0}catch(R){pt(e,e.return,R)}break;case 18:try{var N=e.stateNode;n?wb(N,!0):wb(e.stateNode,!1)}catch(R){pt(e,e.return,R)}break;case 22:case 23:e.memoizedState===null&&Uf(e,n);break;default:Uf(e,n)}}function qf(e,n){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var i=e,s=n;switch(i.tag){case 4:Ax(i,s);break e;case 22:i.memoizedState===null&&qf(i,s);break e;default:qf(i,s)}}e=e.sibling}}function Ox(e){var n=e.alternate;n!==null&&(e.alternate=null,Ox(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Jo(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;)Rx(e,n,i),i=i.sibling}function Rx(e,n,i){if(Un&&typeof Un.onCommitFiberUnmount=="function")try{Un.onCommitFiberUnmount(ss,i)}catch{}switch(i.tag){case 26:ft||on(i,n),gr(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&!ft&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:ft||on(i,n),Us(i);var s=At,f=On;za(i.type)&&(At=i.stateNode,On=!1),gr(e,n,i),_b(i.stateNode,i.type,i.memoizedProps),At=s,On=f;break;case 5:ft||on(i,n),Us(i);case 6:if(i.tag===6&&Us(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),lt=!0}catch(h){pt(i,n,h)}else try{At.removeChild(i.stateNode),lt=!0}catch(h){pt(i,n,h)}break;case 18:At!==null&&(On?(e=At,vb(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),zl(e)):vb(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),ft||Ea(4,i,n),gr(e,n,i);break;case 1:ft||(on(i,n),s=i.stateNode,typeof s.componentWillUnmount=="function"&&yx(i,n,s)),gr(e,n,i);break;case 21:gr(e,n,i);break;case 22:ft=(s=ft)||i.memoizedState!==null,gr(e,n,i),ft=s;break;case 30:on(i,n),gr(e,n,i);break;case 7:ft||on(i,n),gr(e,n,i);break;default:gr(e,n,i)}}function Mx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{zl(e)}catch(i){pt(n,n.return,i)}}}function zx(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{zl(e)}catch(i){pt(n,n.return,i)}}function WN(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new kx),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new kx),n;default:throw Error(l(435,e.tag))}}function Ku(e,n){var i=WN(e);n.forEach(function(s){if(!i.has(s)){i.add(s);var f=dC.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(za(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));Rx(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;)Dx(n,e,i),n=n.sibling}var yr=null;function Dx(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),Ls(3,e),Ea(5,e,e.return));break;case 1:bn(n,e,i),vn(e),f&512&&(ft||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&&(ft||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=yb(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[cs]||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=Fb("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=Fb("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||Sh(h,e.type,e.stateNode);else e.stateNode=Bb(h,i,e.memoizedProps);else f!==i?(f===null?(n=s.stateNode,n===null||ft||n.parentNode.removeChild(n)):f.count--,i===null?en||Sh(h,e.type,e.stateNode):Bb(h,i,e.memoizedProps)):i===null&&e.stateNode!==null&&kf(e,e.memoizedProps,s.memoizedProps);break;case 27:bn(n,e,i),vn(e),f&512&&(ft||s===null||on(s,s.return)),s!==null&&f&4&&kf(e,e.memoizedProps,s.memoizedProps);break;case 5:if(h=zr,zr=!1,bn(n,e,i),zr=h,vn(e),f&512&&(ft||s===null||on(s,s.return)),e.flags&32){n=e.stateNode;try{$i(n,""),lt=!0}catch(X){pt(e,e.return,X)}}f&4&&e.stateNode!=null&&(n=e.memoizedProps,kf(e,n,s!==null?s.memoizedProps:n)),f&1024&&(_f=!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,lt=!0}catch(X){pt(e,e.return,X)}}break;case 3:if(lt=!1,uc=null,h=yr,yr=Gs(n.containerInfo),bn(n,e,i),yr=h,vn(e),f&4&&s!==null&&s.memoizedState.isDehydrated)try{zl(n.containerInfo)}catch(X){pt(e,e.return,X)}_f&&(_f=!1,_x(e)),lt=!1;break;case 4:f=zr,zr=en,s=tg(),h=yr,yr=Gs(e.stateNode.containerInfo),bn(n,e,i),vn(e),yr=h,lt&&qs&&(Vu=!0),lt=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,Ku(e,n)));break;case 13:bn(n,e,i),vn(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Zu=B()),f&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ku(e,n)));break;case 22:h=e.memoizedState!==null,v=s!==null&&s.memoizedState!==null;var N=en,R=ft,P=zr;en=N||h,zr=P||h,ft=R||v,bn(n,e,i),ft=R,zr=P,en=N,vn(e),f&8192&&(n=e.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,!h||s===null||v||en||ft||(n=v||ft,i=en,s=ft,en=h||en,ft=n,ka(e,2),en=i,ft=s),!h&&zr||Uf(e,h)),f&4&&(n=e.updateQueue,n!==null&&(i=n.retryQueue,i!==null&&(n.retryQueue=null,Ku(e,i))));break;case 19:bn(n,e,i),vn(e),f&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Ku(e,n)));break;case 30:f&512&&(ft||s===null||on(s,s.return)),f=tg(),h=qs,v=(i&335544064)===i,N=e.memoizedProps,qs=v&&Kr(N.default,N.update)!=="none",bn(n,e,i),vn(e),v&&s!==null&&lt&&(e.flags|=4),qs=h,lt=f;break;case 21:break;case 7:f&512&&(ft||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(bx(s)){i=s;break}s=s.return}s=null;for(var f=e.return;f!==null;){if(jf(f)){var h=f.stateNode;s===null?s=[h]:s.push(h)}if(Cf(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=Tf(e);Iu(e,R,N,v);break;case 5:var P=i.stateNode;i.flags&32&&($i(P,""),i.flags&=-33);var X=Tf(e);Iu(e,X,P,v);break;case 3:case 4:var te=i.stateNode.containerInfo,F=Tf(e);Af(e,F,te,v);break;default:throw Error(l(161))}}catch(G){pt(e,e.return,G)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function _x(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;_x(n),n.tag===5&&n.flags&1024&&(n=n.stateNode,Ml=!0,n.reset(),Ml=!1),e=e.sibling}}function pl(e,n){if(n.subtreeFlags&9270)for(n=n.child;n!==null;)Lx(n,e),n=n.sibling;else Ex(n)}function Lx(e,n){var i=e.alternate;if(i===null)Of(e,!1);else switch(e.tag){case 3:if(Lf=Dr=!1,Sx(),pl(n,e),!Dr&&!Vu){if(e=Rr,e!==null)for(var s=0;s<e.length;s+=3){i=e[s];var f=e[s+1];Nb(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"})),Lf=!0}Rr=null;break;case 5:pl(n,e);break;case 4:s=Dr,Dr=!1,pl(n,e),Dr&&(Vu=!0),Dr=s;break;case 22:e.memoizedState===null&&(i.memoizedState!==null?Of(e,!1):pl(n,e));break;case 30:s=Dr,f=Sx(),Dr=!1,pl(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=Df(e,i,n,v,N,h,!0),An!==(h===null?0:h.length)&&(e.flags|=32)),(e.flags&4)!==0&&n?(Sl(e,e.memoizedProps.onUpdate),Rr=f):f!==null&&(f.push.apply(f,Rr),Rr=f),Dr=(e.flags&32)!==0?!0:s;break;default:pl(n,e)}}function _r(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Tx(e,n.alternate,n),n=n.sibling}function ka(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),ka(i,s);break;case 1:on(i,i.return);var f=i.stateNode;typeof f.componentWillUnmount=="function"&&yx(i,i.return,f),ka(i,s);break;case 27:(s&2)!==0&&_b(i.stateNode,i.type,i.memoizedProps);case 5:on(i,i.return),i.tag!==5&&i.tag!==27||Us(i),ka(i,s);break;case 6:Us(i);break;case 26:on(i,i.return),f=i.stateNode,i.memoizedState!==null||f===null||ft||f.parentNode.removeChild(f),ka(i,s);break;case 22:i.memoizedState===null&&ka(i,s);break;case 30:on(i,i.return),ka(i,s);break;case 7:on(i,i.return);default:ka(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),Ls(4,h);break;case 1:if(xr(f,h,i),s=h,f=s.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(X){pt(s,s.return,X)}if(s=h,f=s.updateQueue,f!==null){var R=s.stateNode;try{var P=f.shared.hiddenCallbacks;if(P!==null)for(f.shared.hiddenCallbacks=null,f=0;f<P.length;f++)ay(P[f],R)}catch(X){pt(s,s.return,X)}}N&&v&64&&gx(h),Or(h,h.return);break;case 27:(i&2)!==0&&vx(h);case 5:h.tag!==5&&h.tag!==27||xx(h),xr(f,h,i),N&&s===null&&v&4&&Ef(h),Or(h,h.return);break;case 6:xx(h);break;case 26:R=h.stateNode,h.memoizedState!==null||R===null||en||Sh(Gs(R.ownerDocument),h.type,R),xr(f,h,i),N&&s===null&&v&4&&Ef(h),Or(h,h.return);break;case 12:xr(f,h,i);break;case 31:xr(f,h,i),N&&v&4&&Mx(f,h);break;case 13:xr(f,h,i),N&&v&4&&zx(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 Hf(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&&Ns(i))}function Bf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ns(e))}function ir(e,n,i,s){var f=(i&335544064)===i;if(n.subtreeFlags&(f?10262:10256))for(n=n.child;n!==null;)Ux(e,n,i,s),n=n.sibling;else f&&jx(n)}function Ux(e,n,i,s){var f=(i&335544064)===i;f&&n.alternate===null&&n.return!==null&&n.return.alternate!==null&&Yu(n);var h=n.flags;switch(n.tag){case 0:case 11:case 15:ir(e,n,i,s),h&2048&&Ls(9,n);break;case 1:ir(e,n,i,s);break;case 3:ir(e,n,i,s),f&&Lf&&(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&&Ns(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(P){pt(n,n.return,P)}}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&&Yu(N),v._visibility&2?ir(e,n,i,s):Hs(e,n)):(f&&N!==null&&N.memoizedState!==null&&Yu(n),v._visibility&2?ir(e,n,i,s):(v._visibility|=2,gl(e,n,i,s,(n.subtreeFlags&10256)!==0||!1))),h&2048&&Hf(N,n);break;case 24:ir(e,n,i,s),h&2048&&Bf(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 gl(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,P=v.flags;switch(v.tag){case 0:case 11:case 15:gl(h,v,N,R,f),Ls(8,v);break;case 23:break;case 22:var X=v.stateNode;v.memoizedState!==null?X._visibility&2?gl(h,v,N,R,f):Hs(h,v):(X._visibility|=2,gl(h,v,N,R,f)),f&&P&2048&&Hf(v.alternate,v);break;case 24:gl(h,v,N,R,f),f&&P&2048&&Bf(v.alternate,v);break;default:gl(h,v,N,R,f)}n=n.sibling}}function Hs(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:Hs(i,s),f&2048&&Hf(s.alternate,s);break;case 24:Hs(i,s),f&2048&&Bf(s.alternate,s);break;default:Hs(i,s)}n=n.sibling}}var yi=8192;function xi(e,n,i){if(e.subtreeFlags&yi)for(e=e.child;e!==null;)qx(e,n,i),e=e.sibling}function qx(e,n,i){switch(e.tag){case 26:xi(e,n,i),e.flags&yi&&(e.memoizedState!==null?i2(i,yr,e.memoizedState,e.memoizedProps):(e=e.stateNode,(n&335544128)===n&&Yb(i,e)));break;case 5:xi(e,n,i),e.flags&yi&&(e=e.stateNode,(n&335544128)===n&&Yb(i,e));break;case 3:case 4:var s=yr;yr=Gs(e.stateNode.containerInfo),xi(e,n,i),yr=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=yi,yi=16777216,xi(e,n,i),yi=s):xi(e,n,i));break;case 30:if((e.flags&yi)!==0&&(s=e.memoizedProps.name,s!=null&&s!=="auto")){var f=e.stateNode;f.paired=null,In===null&&(In=new Map),In.set(s,f)}xi(e,n,i);break;default:xi(e,n,i)}}function Hx(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 Bs(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,Fx(s,e)}Hx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Bx(e),e=e.sibling}function Bx(e){switch(e.tag){case 0:case 11:case 15:Bs(e),e.flags&2048&&Ea(9,e,e.return);break;case 3:Bs(e);break;case 12:Bs(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Xu(e)):Bs(e);break;default:Bs(e)}}function Xu(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,Fx(s,e)}Hx(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ea(8,n,n.return),Xu(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,Xu(n));break;default:Xu(n)}e=e.sibling}}function Fx(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:Ns(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(Ox(s),s===i){tn=null;break e}if(f!==null){f.return=h,tn=f;break e}tn=h}}}var eC={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}},tC=typeof WeakMap=="function"?WeakMap:Map,ct=0,vt=null,Xe=null,Je=0,mt=0,Pn=null,Ta=!1,yl=!1,Ff=!1,ra=0,qt=0,Aa=0,bi=0,$u=0,Qn=0,xl=0,Fs=null,Rn=null,If=!1,Zu=0,Ix=0,Ju=1/0,Wu=null,Oa=null,zt=0,br=null,vi=null,Lr=0,Pf=0,Qf=null,Px=null,bl=null,vl=null,wl=null,Is=0,ec=null;function Yn(){return(ct&2)!==0&&Je!==0?Je&-Je:ye.T!==null?eh():Vp()}function Qx(){if(Qn===0)if((Je&536870912)===0||Ve){var e=Ko;Ko<<=1,(Ko&3932160)===0&&(Ko=262144),Qn=e}else Qn=536870912;return e=ln.current,e!==null&&(e.flags|=32),Qn}function Sl(e,n){if(n!=null){var i=e.stateNode,s=i.ref;s===null&&(s=i.ref=Cb(Gr(e.memoizedProps,i))),vl===null&&(vl=[]),vl.push(n.bind(null,s))}}function Mn(e,n,i){(e===vt&&(mt===2||mt===9)||e.cancelPendingCommit!==null)&&(Nl(e,0),Ra(e,Je,Qn,!1)),us(e,i),((ct&2)===0||e!==vt)&&(e===vt&&((ct&2)===0&&(bi|=i),qt===4&&Ra(e,Je,Qn,!1)),Ur(e))}function Yx(e,n,i){if((ct&6)!==0)throw Error(l(327));var s=!i&&(n&127)===0&&(n&e.expiredLanes)===0||os(e,n),f=s?aC(e,n):Vf(e,n,!0),h=s;do{if(f===0){yl&&!s&&Ra(e,n,0,!1);break}else{if(i=e.current.alternate,h&&!nC(i)){f=Vf(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&&(Nl(N,v).flags|=256),v=Vf(N,v,!1),v!==2&&v!==6){if(Ff&&!R){N.errorRecoveryDisabledLanes|=h,bi|=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){Nl(e,0),Ra(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:Ra(s,n,Qn,!Ta);break e;case 2:Rn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(f=Zu+300-B(),10<f)){if(Ra(s,n,Qn,!Ta),$o(s,0,!0)!==0)break e;Lr=n,s.timeoutHandle=dh(Vx.bind(null,s,i,Rn,Wu,If,n,Qn,bi,xl,Ta,h,"Throttled",-0,0),f);break e}Vx(s,i,Rn,Wu,If,n,Qn,bi,xl,Ta,h,null,-0,0)}}break}while(!0);Ur(e)}function Vx(e,n,i,s,f,h,v,N,R,P,X,te,F,G){e.timeoutHandle=-1;var pe=n.subtreeFlags,je=(h&335544064)===h;if(te=null,(je||pe&8192||(pe&16785408)===16785408)&&(te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:kr},In=null,qx(n,h,te),je&&(pe=te,je=e.containerInfo,je=(je.nodeType===9?je:je.ownerDocument).__reactViewTransition,je!=null&&(pe.count++,pe.waitingForViewTransition=!0,pe=$s.bind(pe),je.finished.then(pe,pe))),pe=(h&62914560)===h?Zu-B():(h&4194048)===h?Ix-B():0,pe=l2(te,pe),pe!==null)){Lr=h,e.cancelPendingCommit=pe(eb.bind(null,e,n,h,i,s,f,v,N,R,P,X,te,null,F,G)),Ra(e,h,v,!P);return}eb(e,n,h,i,s,f,v,N,R,P,X,te)}function nC(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(!Bn(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 Ra(e,n,i,s){n=Fp(e,n),n&=~$u,n&=~bi,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var f=n;0<f;){var h=31-qn(f),v=1<<h;s[h]=-1,f&=~v}i!==0&&Pp(e,i,n)}function tc(){return(ct&6)===0?(Ps(0),!1):!0}function Yf(){if(Xe!==null){if(mt===0)var e=Xe.return;else e=Xe,Zr=si=null,Jd(e),ul=null,Es=0,e=Xe;for(;e!==null;)px(e.alternate,e),e=e.return;Xe=null}}function Nl(e,n){var i=e.timeoutHandle;return i!==-1&&(e.timeoutHandle=-1,EC(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Lr=0,Yf(),vt=e,Xe=i=Xr(e.current,null),Je=n,mt=0,Pn=null,Ta=!1,yl=os(e,n),Ff=!1,xl=Qn=$u=bi=Aa=qt=0,Rn=Fs=null,If=!1,ra=Fp(e,n),uu(),i}function Gx(e,n){Fe=null,ye.H=Du,n===ol||n===vu?(n=ey(),mt=3):n===Hd?(n=ey(),mt=4):mt=n===mf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Pn=n,Xe===null&&(qt=1,_u(e,tr(n,e.current)))}function Kx(){var e=ln.current;return e===null?!0:(Je&4194048)===Je?hn===null:(Je&62914560)===Je||(Je&536870912)!==0?e===hn:!1}function Xx(){var e=ye.H;return ye.H=Du,e===null?Du:e}function $x(){var e=ye.A;return ye.A=eC,e}function nc(){qt=4,Ta||(Je&4194048)!==Je&&ln.current!==null||(yl=!0),(Aa&134217727)===0&&(bi&134217727)===0||vt===null||Ra(vt,Je,Qn,!1)}function Vf(e,n,i){var s=ct;ct|=2;var f=Xx(),h=$x();(vt!==e||Je!==n)&&(Wu=null,Nl(e,n)),n=!1;var v=qt;e:do try{if(mt!==0&&Xe!==null){var N=Xe,R=Pn;switch(mt){case 8:Yf(),v=6;break e;case 3:case 2:case 9:case 6:ln.current===null&&(n=!0);var P=mt;if(mt=0,Pn=null,Cl(e,N,R,P),i&&yl){v=0;break e}break;default:P=mt,mt=0,Pn=null,Cl(e,N,R,P)}}rC(),v=qt;break}catch(X){Gx(e,X)}while(!0);return n&&e.shellSuspendCounter++,Zr=si=null,ct=s,ye.H=f,ye.A=h,Xe===null&&(vt=null,Je=0,uu()),v}function rC(){for(;Xe!==null;)Zx(Xe)}function aC(e,n){var i=ct;ct|=2;var s=Xx(),f=$x();vt!==e||Je!==n?(Wu=null,Ju=B()+500,Nl(e,n)):yl=os(e,n);e:do try{if(mt!==0&&Xe!==null){n=Xe;var h=Pn;t:switch(mt){case 1:mt=0,Pn=null,Cl(e,n,h,1);break;case 2:case 9:if(Jg(h)){mt=0,Pn=null,Jx(n);break}n=function(){mt!==2&&mt!==9||vt!==e||(mt=7),Ur(e)},h.then(n,n);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Jg(h)?(mt=0,Pn=null,Jx(n)):(mt=0,Pn=null,Cl(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?Pb(v):N.stateNode.complete){mt=0,Pn=null;var R=N.sibling;if(R!==null)Xe=R;else{var P=N.return;P!==null?(Xe=P,rc(P)):Xe=null}break t}}mt=0,Pn=null,Cl(e,n,h,5);break;case 6:mt=0,Pn=null,Cl(e,n,h,6);break;case 8:Yf(),qt=6;break e;default:throw Error(l(462))}}iC();break}catch(X){Gx(e,X)}while(!0);return Zr=si=null,ye.H=s,ye.A=f,ct=i,Xe!==null?0:(vt=null,Je=0,uu(),qt)}function iC(){for(;Xe!==null&&!mr();)Zx(Xe)}function Zx(e){var n=hx(e.alternate,e,ra);e.memoizedProps=e.pendingProps,n===null?rc(e):Xe=n}function Jx(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=lx(i,n,n.pendingProps,n.type,void 0,Je);break;case 11:n=lx(i,n,n.pendingProps,n.type.render,n.ref,Je);break;case 5:Jd(n);var s=n;s===Wt&&(Ve?(pu(s),s.tag===5&&s.stateNode!=null&&(jt=s.stateNode)):(pu(s),Ve=!0));default:px(i,n),n=Xe=Fg(n,ra),n=hx(i,n,ra)}e.memoizedProps=e.pendingProps,n===null?rc(e):Xe=n}function Cl(e,n,i,s){Zr=si=null,Jd(n),ul=null,Es=0;var f=n.return;try{if(VN(e,f,n,i,Je)){qt=1,_u(e,tr(i,e.current)),Xe=null;return}}catch(h){if(f!==null)throw Xe=f,h;qt=1,_u(e,tr(i,e.current)),Xe=null;return}n.flags&32768?(Ve||s===1?e=!0:yl||(Je&536870912)!==0?e=!1:(Ta=e=!0,(s===2||s===9||s===3||s===6)&&(s=ln.current,s!==null&&s.tag===13&&(s.flags|=16384))),Wx(n,e)):rc(n)}function rc(e){var n=e;do{if((n.flags&32768)!==0){Wx(n,Ta);return}e=n.return;var i=$N(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 Wx(e,n){do{var i=ZN(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 eb(e,n,i,s,f,h,v,N,R,P,X,te){e.cancelPendingCommit=null;do ac();while(zt!==0);if((ct&6)!==0)throw Error(l(327));if(n!==null){if(n===e.current)throw Error(l(177));e===vt&&(Xe=vt=null,Je=0),vi=n,br=e,Lr=i,Qf=f,Px=s,lC(e,n,i,v,N,R,te)}}function lC(e,n,i,s,f,h,v){var N=n.lanes|n.childLanes;if(Pf=N,N|=Ed,MS(e,i,N,s,f,h),vl=null,(i&335544064)===i?(wl=DN(e),s=10262):(wl=null,s=10256),(n.subtreeFlags&s)!==0||(n.flags&s)!==0?(e.callbackNode=null,e.callbackPriority=0,fC(ut,function(){return $f(),null})):(e.callbackNode=null,e.callbackPriority=0),Pu=!1,s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=ye.T,ye.T=null,f=Ee.p,Ee.p=2,h=ct,ct|=4;try{JN(e,n,i)}finally{ct=h,Ee.p=f,ye.T=s}}zt=1,Pu?bl=MC(v,e.containerInfo,wl,Gf,Kf,oC,Xf,$f,sC):(Gf(),Kf(),Xf())}function sC(e){if(zt!==0){var n=br.onRecoverableError;n(e,{componentStack:null})}}function oC(){zt===3&&(zt=0,Lx(vi,br),zt=4)}function Gf(){if(zt===1){zt=0;var e=br,n=vi,i=Lr,s=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||s){s=ye.T,ye.T=null;var f=Ee.p;Ee.p=2;var h=ct;ct|=4;try{qs=Vu=!1,Dx(n,e,i),i=oh;var v=Rg(e.containerInfo),N=i.focusedElem,R=i.selectionRange;if(v!==N&&N&&N.ownerDocument&&Og(N.ownerDocument.documentElement,N)){if(R!==null&&wd(N)){var P=R.start,X=R.end;if(X===void 0&&(X=P),"selectionStart"in N)N.selectionStart=P,N.selectionEnd=Math.min(X,N.value.length);else{var te=N.ownerDocument||document,F=te&&te.defaultView||window;if(F.getSelection){var G=F.getSelection(),pe=N.textContent.length,je=Math.min(R.start,pe),Ie=R.end===void 0?je:Math.min(R.end,pe);!G.extend&&je>Ie&&(v=Ie,Ie=je,je=v);var I=Ag(N,je),L=Ag(N,Ie);if(I&&L&&(G.rangeCount!==1||G.anchorNode!==I.node||G.anchorOffset!==I.offset||G.focusNode!==L.node||G.focusOffset!==L.offset)){var V=te.createRange();V.setStart(I.node,I.offset),G.removeAllRanges(),je>Ie?(G.addRange(V),G.extend(L.node,L.offset)):(V.setEnd(L.node,L.offset),G.addRange(V))}}}}for(te=[],G=N;G=G.parentNode;)G.nodeType===1&&te.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<te.length;N++){var ee=te[N];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Ml=!!sh,oh=sh=null}finally{ct=h,Ee.p=f,ye.T=s}}e.current=n,zt=2}}function Kf(){if(zt===2){zt=0;var e=br,n=vi,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=ye.T,ye.T=null;var s=Ee.p;Ee.p=2;var f=ct;ct|=4;try{Tx(e,n.alternate,n)}finally{ct=f,Ee.p=s,ye.T=i}}zt=3}}function Xf(){if(zt===4||zt===3){zt=0;var e=bl;bl=null,En();var n=br,i=vi,s=Lr,f=Px,h=(s&335544064)===s?10262:10256;if((i.subtreeFlags&h)!==0||(i.flags&h)!==0?zt=5:(zt=0,vi=br=null,tb(n,n.pendingLanes)),h=n.pendingLanes,h===0&&(Oa=null),rd(s),i=i.stateNode,Un&&typeof Un.onCommitFiberRoot=="function")try{Un.onCommitFiberRoot(ss,i,void 0,(i.current.flags&128)===128)}catch{}if(f!==null){i=ye.T,h=Ee.p,Ee.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,Ee.p=h}}if(f=vl,v=wl,wl=null,f!==null&&(vl=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&&ac(),Ur(n),h=n.pendingLanes,(s&261930)!==0&&(h&42)!==0?n===ec?Is++:(Is=0,ec=n):(Is=0,ec=null),Ps(0)}}function tb(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Ns(n)))}function ac(){return bl!==null&&(bl.skipTransition(),bl=null),Gf(),Kf(),Xf(),$f()}function $f(){if(zt!==5)return!1;var e=br,n=Pf;Pf=0;var i=rd(Lr),s=ye.T,f=Ee.p;try{Ee.p=32>i?32:i,ye.T=null,i=Qf,Qf=null;var h=br,v=Lr;if(zt=0,vi=br=null,Lr=0,(ct&6)!==0)throw Error(l(331));var N=ct;if(ct|=4,Bx(h.current),Ux(h,h.current,v,i),ct=N,Ps(0,!1),Un&&typeof Un.onPostCommitFiberRoot=="function")try{Un.onPostCommitFiberRoot(ss,h)}catch{}return!0}finally{Ee.p=f,ye.T=s,tb(e,n)}}function nb(e,n,i){n=tr(i,n),n=hf(e.stateNode,n,2),e=Sa(e,n,2),e!==null&&(us(e,2),Ur(e))}function pt(e,n,i){if(e.tag===3)nb(e,e,i);else for(;n!==null;){if(n.tag===3){nb(n,e,i);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Oa===null||!Oa.has(s))){e=tr(i,e),i=Jy(2),s=Sa(n,i,2),s!==null&&(Wy(i,s,n,e),us(s,2),Ur(s));break}}n=n.return}}function Zf(e,n,i){var s=e.pingCache;if(s===null){s=e.pingCache=new tC;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)||(Ff=!0,f.add(i),e=uC.bind(null,e,n,i),n.then(e,e))}function uC(e,n,i){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,vt===e&&(Je&i)===i&&((qt===4||qt===3&&(Je&62914560)===Je&&300>B()-Zu)&&(ct&2)===0?Nl(e,0):$u|=i,xl===Je&&(xl=0)),Ur(e)}function rb(e,n){n===0&&(n=Ip()),e=ai(e,n),e!==null&&(us(e,n),Ur(e))}function cC(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),rb(e,i)}function dC(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),rb(e,i)}function fC(e,n){return hr(e,n)}var jl=null,El=null,Jf=!1,ic=!1,Wf=!1,Ma=0;function Ur(e){e!==El&&e.next===null&&(El===null?jl=El=e:El=El.next=e),ic=!0,Jf||(Jf=!0,mC())}function Ps(e,n){if(!Wf&&ic){Wf=!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-qn(42|e)+1)-1,h&=f&~(v&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,sb(s,h))}else h=Je,h=$o(s,s===vt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(h&3)===0||os(s,h)||(i=!0,sb(s,h));s=s.next}while(i);Wf=!1}}function hC(){ab()}function ab(){ic=Jf=!1;var e=0;Ma!==0&&jC()&&(e=Ma);for(var n=B(),i=null,s=jl;s!==null;){var f=s.next,h=ib(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)&&(ic=!0)),s=f}zt!==0&&zt!==5||Ps(e),Ma!==0&&(Ma=0)}function ib(e,n){for(var i=e.suspendedLanes,s=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var v=31-qn(h),N=1<<v,R=f[v];R===-1?((N&i)===0||(N&s)!==0)&&(f[v]=RS(N,n)):R<=n&&(e.expiredLanes|=N),h&=~N}if(n=vt,i=Je,i=$o(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===n&&(mt===2||mt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&It(s),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||os(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(s!==null&&It(s),rd(i)){case 2:case 8:i=ke;break;case 32:i=ut;break;case 268435456:i=Ce;break;default:i=ut}return s=lb.bind(null,e),i=hr(i,s),e.callbackPriority=n,e.callbackNode=i,n}return s!==null&&s!==null&&It(s),e.callbackPriority=2,e.callbackNode=null,2}function lb(e,n){if(zt!==0&&zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(ac()&&e.callbackNode!==i)return null;var s=Je;return s=$o(e,e===vt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Yx(e,s,n),ib(e,B()),e.callbackNode!=null&&e.callbackNode===i?lb.bind(null,e):null)}function sb(e,n){if(ac())return null;Yx(e,n,!0)}function mC(){kC(function(){(ct&6)!==0?hr(we,hC):ab()})}function eh(){if(Ma===0){var e=ci;e===0&&(e=Go,Go<<=1,(Go&261888)===0&&(Go=256)),Ma=e}return Ma}function ob(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:tu(e)}function pC(e,n,i,s,f){if(n==="submit"&&i&&i.stateNode===f){var h=ob((f[kn]||null).action),v=s.submitter;v&&(n=(n=v[kn]||null)?ob(n.formAction):v.getAttribute("formAction"),n!==null&&(h=n,v=null));var N=new iu("action","action",null,s,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ma!==0){var R=new FormData(f,v);of(i,{pending:!0,data:R,method:f.method,action:h},null,R)}}else typeof h=="function"&&(N.preventDefault(),R=new FormData(f,v),of(i,{pending:!0,data:R,method:f.method,action:h},h,R))},currentTarget:f}]})}}for(var th=0;th<jd.length;th++){var nh=jd[th],gC=nh.toLowerCase(),yC=nh[0].toUpperCase()+nh.slice(1);pr(gC,"on"+yC)}pr(Dg,"onAnimationEnd"),pr(_g,"onAnimationIteration"),pr(Lg,"onAnimationStart"),pr("dblclick","onDoubleClick"),pr("focusin","onFocus"),pr("focusout","onBlur"),pr(EN,"onTransitionRun"),pr(kN,"onTransitionStart"),pr(TN,"onTransitionCancel"),pr(Ug,"onTransitionEnd"),Ki("onMouseEnter",["mouseout","mouseover"]),Ki("onMouseLeave",["mouseout","mouseover"]),Ki("onPointerEnter",["pointerout","pointerover"]),Ki("onPointerLeave",["pointerout","pointerover"]),ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ti("onBeforeInput",["compositionend","keypress","textInput","paste"]),ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qs="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(" "),xC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qs));function ub(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,P=N.currentTarget;if(N=N.listener,R!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=P;try{h(f)}catch(X){ou(X)}f.currentTarget=null,h=R}else for(v=0;v<s.length;v++){if(N=s[v],R=N.instance,P=N.currentTarget,N=N.listener,R!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=P;try{h(f)}catch(X){ou(X)}f.currentTarget=null,h=R}}}}function $e(e,n){var i=n[Kp];i===void 0&&(i=n[Kp]=new Set);var s=e+"__bubble";i.has(s)||(cb(n,e,2,!1),i.add(s))}function rh(e,n,i){var s=0;n&&(s|=4),cb(i,e,s,n)}var lc="_reactListening"+Math.random().toString(36).slice(2);function ah(e){if(!e[lc]){e[lc]=!0,Zp.forEach(function(i){i!=="selectionchange"&&(xC.has(i)||rh(i,!1,e),rh(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[lc]||(n[lc]=!0,rh("selectionchange",!1,n))}}function cb(e,n,i,s){switch(Wb(n)){case 2:var f=c2;break;case 8:f=d2;break;default:f=Ch}i=f.bind(null,n,i,e),f=void 0,!dd||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 ih(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=ei(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}cg(function(){var P=h,X=ud(i),te=[];e:{var F=qg.get(e);if(F!==void 0){var G=iu,pe=e;switch(e){case"keypress":if(ru(i)===0)break e;case"keydown":case"keyup":G=nN;break;case"focusin":pe="focus",G=pd;break;case"focusout":pe="blur",G=pd;break;case"beforeblur":case"afterblur":G=pd;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=hg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=QS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=sN;break;case Dg:case _g:case Lg:G=GS;break;case Ug:G=uN;break;case"scroll":case"scrollend":G=IS;break;case"wheel":G=dN;break;case"copy":case"cut":case"paste":G=XS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=pg;break;case"submit":G=iN;break;case"toggle":case"beforetoggle":G=hN}var je=(n&4)!==0,Ie=!je&&(e==="scroll"||e==="scrollend"),I=je?F!==null?F+"Capture":null:F;je=[];for(var L=P,V;L!==null;){var ee=L;if(V=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||V===null||I===null||(ee=fs(L,I),ee!=null&&je.push(Ys(L,ee,V))),Ie)break;L=L.return}0<je.length&&(F=new G(F,pe,null,i,X),te.push({event:F,listeners:je}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",F=e==="mouseout"||e==="pointerout",G&&i!==od&&(pe=i.relatedTarget||i.fromElement)&&(ei(pe)||pe[Yi]))break e;(F||G)&&(pe=X.window===X?X:(G=X.ownerDocument)?G.defaultView||G.parentWindow:window,F?(G=i.relatedTarget||i.toElement,F=P,G=G?ei(G):null,G!==null&&(Ie=u(G),je=G.tag,G!==Ie||je!==5&&je!==27&&je!==6)&&(G=null)):(F=null,G=P),F!==G&&(je=hg,ee="onMouseLeave",I="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(je=pg,ee="onPointerLeave",I="onPointerEnter",L="pointer"),Ie=F==null?pe:ds(F),V=G==null?pe:ds(G),pe=new je(ee,L+"leave",F,i,X),pe.target=Ie,pe.relatedTarget=V,ee=null,ei(X)===P&&(je=new je(I,L+"enter",G,i,X),je.target=V,je.relatedTarget=Ie,ee=je),Ie=ee,je=F&&G?T(F,G,bC):null,F!==null&&db(te,pe,F,je,!1),G!==null&&Ie!==null&&db(te,Ie,G,je,!0)))}e:{if(F=P?ds(P):window,G=F.nodeName&&F.nodeName.toLowerCase(),G==="select"||G==="input"&&F.type==="file")var Ne=Ng;else if(wg(F))if(Cg)Ne=NN;else{Ne=wN;var We=vN}else G=F.nodeName,!G||G.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?P&&sd(P.elementType)&&(Ne=Ng):Ne=SN;if(Ne&&(Ne=Ne(e,P))){Sg(te,Ne,i,X);break e}We&&We(e,F,P)}switch(We=P?ds(P):window,e){case"focusin":(wg(We)||We.contentEditable==="true")&&(el=We,Sd=P,vs=null);break;case"focusout":vs=Sd=el=null;break;case"mousedown":Nd=!0;break;case"contextmenu":case"mouseup":case"dragend":Nd=!1,Mg(te,i,X);break;case"selectionchange":if(jN)break;case"keydown":case"keyup":Mg(te,i,X)}var Ae;if(yd)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 Wi?bg(e,i)&&(_e="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(_e="onCompositionStart");_e&&(gg&&i.locale!=="ko"&&(Wi||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Wi&&(Ae=dg()):(ha=X,fd="value"in ha?ha.value:ha.textContent,Wi=!0)),We=sc(P,_e),0<We.length&&(_e=new mg(_e,e,null,i,X),te.push({event:_e,listeners:We}),Ae?_e.data=Ae:(Ae=vg(i),Ae!==null&&(_e.data=Ae)))),(Ae=pN?gN(e,i):yN(e,i))&&(_e=sc(P,"onBeforeInput"),0<_e.length&&(We=new mg("onBeforeInput","beforeinput",null,i,X),te.push({event:We,listeners:_e}),We.data=Ae)),pC(te,e,P,i,X)}ub(te,n)})}function Ys(e,n,i){return{instance:e,listener:n,currentTarget:i}}function sc(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=fs(e,i),f!=null&&s.unshift(Ys(e,f,h)),f=fs(e,n),f!=null&&s.push(Ys(e,f,h))),e.tag===3)return s;e=e.return}return[]}function bC(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function db(e,n,i,s,f){for(var h=n._reactName,v=[];i!==null&&i!==s;){var N=i,R=N.alternate,P=N.stateNode;if(N=N.tag,R!==null&&R===s)break;N!==5&&N!==26&&N!==27||P===null||(R=P,f?(P=fs(i,h),P!=null&&v.unshift(Ys(i,P,R))):f||(P=fs(i,h),P!=null&&v.push(Ys(i,P,R)))),i=i.return}v.length!==0&&e.push({event:n,listeners:v})}var vC=/\r\n?/g,wC=/\u0000|\uFFFD/g;function fb(e){return(typeof e=="string"?e:""+e).replace(vC,`
49
- `).replace(wC,"")}function hb(e,n){return n=fb(n),fb(e)===n}function gt(e,n,i,s,f,h){switch(i){case"children":if(typeof s=="string")n==="body"||n==="textarea"&&s===""||$i(e,s);else if(typeof s=="number"||typeof s=="bigint")n!=="body"&&$i(e,""+s);else return;break;case"className":eu(e,"class",s);break;case"tabIndex":eu(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":eu(e,i,s);break;case"style":og(e,s,h);return;case"data":if(n!=="object"){eu(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=tu(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"&&gt(e,n,"name",f.name,f,null),gt(e,n,"formEncType",f.formEncType,f,null),gt(e,n,"formMethod",f.formMethod,f,null),gt(e,n,"formTarget",f.formTarget,f,null)):(gt(e,n,"encType",f.encType,f,null),gt(e,n,"method",f.method,f,null),gt(e,n,"target",f.target,f,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=tu(s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=kr);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=tu(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),Wo(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":Wo(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=BS.get(i)||i,Wo(e,i,s);else return}lt=!0}function lh(e,n,i,s,f,h){switch(i){case"style":og(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")$i(e,s);else if(typeof s=="number"||typeof s=="bigint")$i(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=kr);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Jp.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[kn]||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}lt=!0,i in e?e[i]=s:s===!0?e.setAttribute(i,""):Wo(e,i,s)}return}lt=!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:gt(e,n,h,v,i,null)}}f&&gt(e,n,"srcSet",i.srcSet,i,null),s&&gt(e,n,"src",i.src,i,null);return;case"input":$e("invalid",e);var N=h=v=f=null,R=null,P=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":P=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:gt(e,n,s,X,i,null)}}ag(e,h,N,R,P,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:gt(e,n,f,N,i,null)}n=h,i=v,e.multiple=!!s,n!=null?Xi(e,!!s,n,!1):i!=null&&Xi(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:gt(e,n,v,N,i,null)}lg(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:gt(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<Qs.length;s++)$e(Qs[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(P in i)if(i.hasOwnProperty(P)&&(s=i[P],s!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:gt(e,n,P,s,i,null)}return;default:if(sd(n)){for(X in i)i.hasOwnProperty(X)&&(s=i[X],s!==void 0&&lh(e,n,X,s,i,void 0));return}}for(N in i)i.hasOwnProperty(N)&&(s=i[N],s!=null&&gt(e,n,N,s,i,null))}var SC={};function NC(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,P=null,X=null;for(G in i){var te=i[G];if(i.hasOwnProperty(G)&&te!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":R=te;default:s.hasOwnProperty(G)||gt(e,n,G,null,s,te)}}for(var F in s){var G=s[F];if(te=i[F],s.hasOwnProperty(F)&&(G!=null||te!=null))switch(F){case"type":G!==te&&(lt=!0),h=G;break;case"name":G!==te&&(lt=!0),f=G;break;case"checked":G!==te&&(lt=!0),P=G;break;case"defaultChecked":G!==te&&(lt=!0),X=G;break;case"value":G!==te&&(lt=!0),v=G;break;case"defaultValue":G!==te&&(lt=!0),N=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(l(137,n));break;default:G!==te&&gt(e,n,F,G,s,te)}}id(e,v,N,R,P,X,h,f);return;case"select":G=v=N=F=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)||gt(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&&(lt=!0),F=h;break;case"defaultValue":h!==R&&(lt=!0),N=h;break;case"multiple":h!==R&&(lt=!0),v=h;default:h!==R&&gt(e,n,f,h,s,R)}n=N,i=v,s=G,F!=null?Xi(e,!!i,F,!1):!!s!=!!i&&(n!=null?Xi(e,!!i,n,!0):Xi(e,!!i,i?[]:"",!1));return;case"textarea":G=F=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:gt(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&&(lt=!0),F=f;break;case"defaultValue":f!==h&&(lt=!0),G=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==h&&gt(e,n,v,f,s,h)}ig(e,F,G);return;case"option":for(var pe in i)if(F=i[pe],i.hasOwnProperty(pe)&&F!=null&&!s.hasOwnProperty(pe))switch(pe){case"selected":e.selected=!1;break;default:gt(e,n,pe,null,s,F)}for(R in s)if(F=s[R],G=i[R],s.hasOwnProperty(R)&&F!==G&&(F!=null||G!=null))switch(R){case"selected":F!==G&&(lt=!0),e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:gt(e,n,R,F,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 je in i)F=i[je],i.hasOwnProperty(je)&&F!=null&&!s.hasOwnProperty(je)&&gt(e,n,je,null,s,F);for(P in s)if(F=s[P],G=i[P],s.hasOwnProperty(P)&&F!==G&&(F!=null||G!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(l(137,n));break;default:gt(e,n,P,F,s,G)}return;default:if(sd(n)){for(var Ie in i)F=i[Ie],i.hasOwnProperty(Ie)&&F!==void 0&&!s.hasOwnProperty(Ie)&&lh(e,n,Ie,void 0,s,F);for(X in s)F=s[X],G=i[X],!s.hasOwnProperty(X)||F===G||F===void 0&&G===void 0||lh(e,n,X,F,s,G);return}}for(var I in i)F=i[I],i.hasOwnProperty(I)&&F!=null&&!s.hasOwnProperty(I)&&gt(e,n,I,null,s,F);for(te in s)F=s[te],G=i[te],!s.hasOwnProperty(te)||F===G||F==null&&G==null||gt(e,n,te,F,s,G)}function mb(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function CC(){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&&mb(v)){for(v=0,N=f.responseEnd,s+=1;s<i.length;s++){var R=i[s],P=R.startTime;if(P>N)break;var X=R.transferSize,te=R.initiatorType;X&&mb(te)&&(R=R.responseEnd,v+=X*(R<N?1:(N-P)/(R-P)))}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 sh=null,oh=null;function Vs(e){return e.nodeType===9?e:e.ownerDocument}function pb(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 gb(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 yb(e,n,i,s){return i=Vs(i).createElement(e),i[rn]=s,i[kn]=n,un(i,e,n),Jt(i),i}function uh(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 ch=null;function jC(){var e=window.event;return e&&e.type==="popstate"?e===ch?!1:(ch=e,!0):(ch=null,!1)}var dh=typeof setTimeout=="function"?setTimeout:void 0,EC=typeof clearTimeout=="function"?clearTimeout:void 0,xb=typeof Promise=="function"?Promise:void 0,bb=typeof requestAnimationFrame=="function"?requestAnimationFrame:dh,kC=typeof queueMicrotask=="function"?queueMicrotask:typeof xb<"u"?function(e){return xb.resolve(null).then(e).catch(TC)}:dh;function TC(e){setTimeout(function(){throw e})}function za(e){return e==="head"}function vb(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),zl(n);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")bh(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,bh(i);for(var h=i.firstChild;h;){var v=h.nextSibling,N=h.nodeName;h[cs]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=v}}else i==="body"&&bh(e.ownerDocument.body);i=f}while(i);zl(n)}function wb(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 Sb(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 Nb(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 AC(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 fh(e){var n=e.getBoundingClientRect(),i=getComputedStyle(e);return AC(n,i,e)}function OC(e){return e.documentElement.clientHeight}function RC(e){this.addEventListener("load",e),this.addEventListener("error",e)}function MC(e,n,i,s,f,h,v,N,R){var P=n.nodeType===9?n:n.ownerDocument;try{var X=P.startViewTransition({update:function(){var F=P.defaultView,G=F.navigation&&F.navigation.transition,pe=P.fonts.status;s();var je=[];if(pe==="loaded"&&(OC(P),P.fonts.status==="loading"&&je.push(P.fonts.ready)),pe=je.length,e!==null)for(var Ie=e.suspenseyImages,I=0,L=0;L<Ie.length;L++){var V=Ie[L];if(!V.complete){var ee=V.getBoundingClientRect();if(0<ee.bottom&&0<ee.right&&ee.top<F.innerHeight&&ee.left<F.innerWidth){if(I+=Qb(V),I>cc){je.length=pe;break}V=new Promise(RC.bind(V)),je.push(V)}}}if(0<je.length)return F=Promise.race([Promise.all(je),new Promise(function(Ne){return setTimeout(Ne,500)})]).then(f,f),(G?Promise.allSettled([G.finished,F]):F).then(h,h);if(f(),G)return G.finished.then(h,h);h()},types:i});P.__reactViewTransition=X;var te=[];return X.ready.then(function(){for(var F=P.documentElement.getAnimations({subtree:!0}),G=0;G<F.length;G++){var pe=F[G],je=pe.effect,Ie=je.pseudoElement;if(Ie!=null&&Ie.startsWith("::view-transition")){te.push(pe),pe=je.getKeyframes();for(var I=Ie=void 0,L=!0,V=0;V<pe.length;V++){var ee=pe[V],Ne=ee.width;if(Ie===void 0)Ie=Ne;else if(Ie!==Ne){L=!1;break}if(Ne=ee.height,I===void 0)I=Ne;else if(I!==Ne){L=!1;break}delete ee.width,delete ee.height,ee.transform==="none"&&delete ee.transform}L&&Ie!==void 0&&I!==void 0&&(je.setKeyframes(pe),L=getComputedStyle(je.target,je.pseudoElement),L.width!==Ie||L.height!==I)&&(L=pe[0],L.width=Ie,L.height=I,L=pe[pe.length-1],L.width=Ie,L.height=I,je.setKeyframes(pe))}}v()},function(F){P.__reactViewTransition===X&&(P.__reactViewTransition=null);try{if(typeof F=="object"&&F!==null)switch(F.name){case"InvalidStateError":(F.message==="View transition was skipped because document visibility state is hidden."||F.message==="Skipping view transition because document visibility state has become hidden."||F.message==="Skipping view transition because viewport size changed."||F.message==="Transition was aborted because of invalid state")&&(F=null)}F!==null&&R(F)}finally{s(),f(),v()}}),X.finished.finally(function(){for(var F=0;F<te.length;F++)te[F].cancel();P.__reactViewTransition===X&&(P.__reactViewTransition=null),N()}),X}catch{return s(),f(),v(),null}}function wi(e,n){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+n+")"}wi.prototype.animate=function(e,n){return n=typeof n=="number"?{duration:n}:H({},n),n.pseudoElement=this._selector,this._scope.animate(e,n)},wi.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},wi.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Cb(e){return{name:e,group:new wi("group",e),imagePair:new wi("image-pair",e),old:new wi("old",e),new:new wi("new",e)}}function Vn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Vn.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(Eb(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=kl(i),h.push({type:e,listener:n,optionsOrUseCapture:i,attachedListener:N,cleanup:f}),g(this._fragmentFiber.child,!1,zC,e,N,s)}this._eventListeners=h}};function zC(e,n,i,s){return E(e).addEventListener(n,i,s),!1}Vn.prototype.removeEventListener=function(e,n,i){var s=this._eventListeners;if(s!==null&&(n=Eb(s,e,n,i),n!==-1)){var f=s[n];i=f.attachedListener;var h=f.cleanup;f=kl(f.optionsOrUseCapture),g(this._fragmentFiber.child,!1,DC,e,i,f),s.splice(n,1),h!==null&&h()}};function DC(e,n,i,s){return E(e).removeEventListener(n,i,s),!1}function kl(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function jb(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Eb(e,n,i,s){if(e.length===0)return-1;s=jb(s);for(var f=0;f<e.length;f++){var h=e[f];if(h.type===n&&h.listener===i&&jb(h.optionsOrUseCapture)===s)return f}return-1}Vn.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,kl(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,kl(h.optionsOrUseCapture));return n.removeChild(s),e}return n.dispatchEvent(e)},Vn.prototype.focus=function(e){g(this._fragmentFiber.child,!0,kb,e,void 0,void 0)};function kb(e,n){return e.tag===6?!1:(e=E(e),VC(e,n))}Vn.prototype.focusLast=function(e){var n=[];g(this._fragmentFiber.child,!0,hh,n,void 0,void 0);for(var i=n.length-1;0<=i&&!kb(n[i],e);i--);};function hh(e,n){return n.push(e),!1}Vn.prototype.blur=function(){var e=b(this._fragmentFiber);e!==null&&(e=E(e),e=Vs(e).activeElement,e!==null&&g(this._fragmentFiber.child,!1,_C,e,void 0,void 0))};function _C(e,n){return e.tag===6?!1:(e=E(e),e===n||e.contains(n)?(n.blur(),!0):!1)}Vn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),g(this._fragmentFiber.child,!1,LC,e,void 0,void 0)};function LC(e,n){return e.tag===6||(e=E(e),n.observe(e)),!1}Vn.prototype.unobserveUsing=function(e){var n=this._observers;if(n!==null&&n.has(e)){n.delete(e),g(this._fragmentFiber.child,!1,UC,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 UC(e,n){return e.tag===6||(e=E(e),n.unobserve(e)),!1}var vr=[],mh=!1;function qC(e,n,i){vr.push({fragmentInstance:e,observer:n,instance:i}),mh||(mh=!0,GC(function(){mh=!1;var s=vr;vr=[];for(var f=0;f<s.length;f++){var h=s[f];h.observer.unobserve(h.instance)}}))}Vn.prototype.getClientRects=function(){var e=[];return g(this._fragmentFiber.child,!1,HC,e,void 0,void 0),e};function HC(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}Vn.prototype.getRootNode=function(e){var n=b(this._fragmentFiber);return n===null?this:E(n).getRootNode(e)},Vn.prototype.compareDocumentPosition=function(e){var n=b(this._fragmentFiber);if(n===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var i=[];g(this._fragmentFiber.child,!1,hh,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||BC(n,this._fragmentFiber,i[0],i[i.length-1],e)?n:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function BC(e,n,i,s,f){var h=ei(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=T(i,h,q),n===null?n=!1:(g(n,!0,z,h,i),h=j,j=null,n=h!==null)),n):e&Node.DOCUMENT_POSITION_FOLLOWING?((n=!!h)&&!(n=h===s)&&(n=T(s,h,q),n===null?n=!1:(g(n,!0,Y,h,s),h=j,A=j=null,n=h!==null)),n):!1}function Tb(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)}Vn.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(l(566));var n=[];g(this._fragmentFiber.child,!1,hh,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),Tb(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),Tb(f,i)):E(f).scrollIntoView(e),s+=i?-1:1}};function FC(e,n){return e=E(e),Ab(e,n),!1}function Ab(e,n){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(n)}function Ob(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,kl(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)}),Ab(e,n))}function IC(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,kl(f.optionsOrUseCapture))}e.nodeType!==3&&(i=n._observers,i!==null&&i.forEach(function(h){typeof h.rootMargin=="string"?qC(n,h,e):h.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(n))}function ph(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":ph(i),Jo(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function PC(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[cs])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 QC(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 Rb(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 gh(e){return e.data==="$?"||e.data==="$~"}function yh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function YC(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 xh=null;function Mb(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 zb(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 VC(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 GC(e){bb(function(){bb(function(n){return e(n)})})}function Db(e,n,i){switch(n=Vs(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 _b(e,n,i){for(var s in i){var f=i[s];i.hasOwnProperty(s)&&f!=null&&gt(e,n,s,null,SC,f)}i.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===kr&&(e.onclick=null),Jo(e)}function bh(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Jo(e)}var sr=new Map,Lb=new Set;function Gs(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=Ee.d;Ee.d={f:KC,r:XC,D:$C,C:ZC,L:JC,m:WC,X:t2,S:e2,M:n2};function KC(){var e=aa.f(),n=tc();return e||n}function XC(e){var n=Vi(e);n!==null&&n.tag===5&&n.type==="form"?qy(n):aa.r(e)}var Tl=typeof document>"u"?null:document;function Ub(e,n,i){var s=Tl;if(s&&typeof n=="string"&&n){var f=Wn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),Lb.has(f)||(Lb.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 $C(e){aa.D(e),Ub("dns-prefetch",e,null)}function ZC(e,n){aa.C(e,n),Ub("preconnect",e,n)}function JC(e,n,i){aa.L(e,n,i);var s=Tl;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=Al(e);break;case"script":h=Ol(e)}if(!(sr.has(h)||(e=H({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(Ks(h))||n==="script"&&s.querySelector(Xs(h))))){var v=s.createElement("link");un(v,"link",e),n==="style"&&(v[Zo]=!0,v.onload=v.onerror=function(){$p(v)}),Jt(v),s.head.appendChild(v)}}}function WC(e,n){aa.m(e,n);var i=Tl;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=Ol(e)}if(!sr.has(h)&&(e=H({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(Xs(h)))return}s=i.createElement("link"),un(s,"link",e),Jt(s),i.head.appendChild(s)}}}function e2(e,n,i){aa.S(e,n,i);var s=Tl;if(s&&e){var f=Gi(s).hoistableStyles,h=Al(e);n=n||"default";var v=f.get(h);if(!v){var N={loading:0,preload:null};if(v=s.querySelector(Ks(h)))N.loading=5;else{e=H({rel:"stylesheet",href:e,"data-precedence":n},i),(i=sr.get(h))&&vh(e,i);var R=v=s.createElement("link");Jt(R),un(R,"link",e),R._p=new Promise(function(P,X){R.onload=P,R.onerror=X}),R.addEventListener("load",function(){N.loading|=1}),R.addEventListener("error",function(){N.loading|=2}),N.loading|=4,oc(v,n,s)}v={type:"stylesheet",instance:v,count:1,state:N},f.set(h,v)}}}function t2(e,n){aa.X(e,n);var i=Tl;if(i&&e){var s=Gi(i).hoistableScripts,f=Ol(e),h=s.get(f);h||(h=i.querySelector(Xs(f)),h||(e=H({src:e,async:!0},n),(n=sr.get(f))&&wh(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 n2(e,n){aa.M(e,n);var i=Tl;if(i&&e){var s=Gi(i).hoistableScripts,f=Ol(e),h=s.get(f);h||(h=i.querySelector(Xs(f)),h||(e=H({src:e,async:!0,type:"module"},n),(n=sr.get(f))&&wh(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 qb(e,n,i,s){var f=(f=Ct.current)?Gs(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=Al(i.href),n=Gi(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=Al(i.href);var h=Gi(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(Ks(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)),r2(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=Ol(i),n=Gi(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 Al(e){return'href="'+Wn(e)+'"'}function Ks(e){return'link[rel="stylesheet"]['+e+"]"}function Hb(e){return H({},e,{"data-precedence":e.precedence,precedence:null})}function r2(e,n,i,s){if(n=e.querySelector('link[rel="preload"][as="style"]['+n+"]")){if(n[Zo]!==!0){s.loading=1;return}}else n=e.createElement("link"),n[Zo]=!0,n.onload=n.onerror=$p.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 Ol(e){return'[src="'+Wn(e)+'"]'}function Xs(e){return"script[async]"+e}function Bb(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=H({},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),oc(s,i.precedence,e),n.instance=s;case"stylesheet":f=Al(i.href);var h=e.querySelector(Ks(f));if(h)return n.state.loading|=4,n.instance=h,Jt(h),h;s=Hb(i),(f=sr.get(f))&&vh(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,oc(h,i.precedence,e),n.instance=h;case"script":return h=Ol(i.src),(f=e.querySelector(Xs(h)))?(n.instance=f,Jt(f),f):(s=i,(f=sr.get(h))&&(s=H({},i),wh(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,oc(s,i.precedence,e));return n.instance}function oc(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 vh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function wh(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var uc=null;function Fb(e,n,i){if(uc===null){var s=new Map,f=uc=new Map;f.set(i,s)}else f=uc,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[cs]||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 Sh(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function a2(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 Ib(e,n){return e==="img"&&n.src!=null&&n.src!==""&&n.onLoad==null&&n.loading!=="lazy"}function Pb(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Qb(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function Yb(e,n){typeof n.decode=="function"&&(e.imgCount++,n.complete||(e.imgBytes+=Qb(n),e.suspenseyImages.push(n)),e=s2.bind(e),n.decode().then(e,e))}function i2(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=Al(s.href),h=n.querySelector(Ks(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=$s.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=h,Jt(h);return}h=n.ownerDocument||n,s=Hb(s),(f=sr.get(f))&&vh(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=$s.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var cc=0;function l2(e,n){return e.stylesheets&&e.count===0&&fc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&fc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&cc===0&&(cc=62500*CC());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&fc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>cc?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(f)}}:null}function Vb(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)fc(e,e.stylesheets);else if(e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}}}function $s(){this.count--,Vb(this)}function s2(){this.imgCount--,Vb(this)}var dc=null;function fc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,dc=new Map,n.forEach(o2,e),dc=null,$s.call(e))}function o2(e,n){if(!(n.state.loading&4)){var i=dc.get(e);if(i)var s=i.get(null);else{i=new Map,dc.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=$s.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 Rl={$$typeof:ne,Provider:null,Consumer:null,_currentValue:Tt,_currentValue2:Tt,_threadCount:0};function u2(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=td(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=td(0),this.hiddenUpdates=td(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 Gb(e,n,i,s,f,h,v,N,R,P,X,te){return e=new u2(e,n,i,v,R,P,X,te,N),n=1,h===!0&&(n|=24),h=Tn(3,null,null,n),e.current=h,h.stateNode=e,n=Ld(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:s,isDehydrated:i,cache:n},Bd(h),e}function Kb(e){return e?(e=rl,e):rl}function Xb(e,n,i,s,f,h){f=Kb(f),s.context===null?s.context=f:s.pendingContext=f,s=wa(n),s.payload={element:i},h=h===void 0?null:h,h!==null&&(s.callback=h),i=Sa(e,s,n),i!==null&&(Mn(i,e,n),ks(i,e,n))}function $b(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Nh(e,n){$b(e,n),(e=e.alternate)&&$b(e,n)}function Zb(e){if(e.tag===13||e.tag===31){var n=ai(e,67108864);n!==null&&Mn(n,e,67108864),Nh(e,67108864)}}function Jb(e){if(e.tag===13||e.tag===31){var n=Yn();n=nd(n);var i=ai(e,n);i!==null&&Mn(i,e,n),Nh(e,n)}}var Ml=!0;function c2(e,n,i,s){var f=ye.T;ye.T=null;var h=Ee.p;try{Ee.p=2,Ch(e,n,i,s)}finally{Ee.p=h,ye.T=f}}function d2(e,n,i,s){var f=ye.T;ye.T=null;var h=Ee.p;try{Ee.p=8,Ch(e,n,i,s)}finally{Ee.p=h,ye.T=f}}function Ch(e,n,i,s){if(Ml){var f=jh(s);if(f===null)ih(e,n,s,hc,i),ev(e,s);else if(h2(f,e,n,i,s))s.stopPropagation();else if(ev(e,s),n&4&&-1<f2.indexOf(e)){for(;f!==null;){var h=Vi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=Wa(h.pendingLanes);if(v!==0){var N=h;for(N.pendingLanes|=2,N.entangledLanes|=2;v;){var R=1<<31-qn(v);N.entanglements[1]|=R,v&=~R}Ur(h),(ct&6)===0&&(Ju=B()+500,Ps(0))}}break;case 31:case 13:N=ai(h,2),N!==null&&Mn(N,h,2),tc(),Nh(h,2)}if(h=jh(s),h===null&&ih(e,n,s,hc,i),h===f)break;f=h}f!==null&&s.stopPropagation()}else ih(e,n,s,null,i)}}function jh(e){return e=ud(e),Eh(e)}var hc=null;function Eh(e){if(hc=null,e=ei(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 hc=e,null}function Wb(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 ke:return 8;case ut:case Ln:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var kh=!1,Da=null,_a=null,La=null,Zs=new Map,Js=new Map,Ua=[],f2="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 ev(e,n){switch(e){case"focusin":case"focusout":Da=null;break;case"dragenter":case"dragleave":_a=null;break;case"mouseover":case"mouseout":La=null;break;case"pointerover":case"pointerout":Zs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Js.delete(n.pointerId)}}function Ws(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=Vi(n),n!==null&&Zb(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function h2(e,n,i,s,f){switch(n){case"focusin":return Da=Ws(Da,e,n,i,s,f),!0;case"dragenter":return _a=Ws(_a,e,n,i,s,f),!0;case"mouseover":return La=Ws(La,e,n,i,s,f),!0;case"pointerover":var h=f.pointerId;return Zs.set(h,Ws(Zs.get(h)||null,e,n,i,s,f)),!0;case"gotpointercapture":return h=f.pointerId,Js.set(h,Ws(Js.get(h)||null,e,n,i,s,f)),!0}return!1}function tv(e){var n=ei(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,Gp(e.priority,function(){Jb(i)});return}}else if(n===31){if(n=m(i),n!==null){e.blockedOn=n,Gp(e.priority,function(){Jb(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 mc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=jh(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);od=s,i.target.dispatchEvent(s),od=null}else return n=Vi(i),n!==null&&Zb(n),e.blockedOn=i,!1;n.shift()}return!0}function nv(e,n,i){mc(e)&&i.delete(n)}function m2(){kh=!1,Da!==null&&mc(Da)&&(Da=null),_a!==null&&mc(_a)&&(_a=null),La!==null&&mc(La)&&(La=null),Zs.forEach(nv),Js.forEach(nv)}function pc(e,n){e.blockedOn===n&&(e.blockedOn=null,kh||(kh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,m2)))}var gc=null;function rv(e){gc!==e&&(gc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){gc===e&&(gc=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(Eh(s||i)===null)continue;break}var h=Vi(i);h!==null&&(e.splice(n,3),n-=3,of(h,{pending:!0,data:f,method:i.method,action:s},s,f))}}))}function zl(e){function n(R){return pc(R,e)}Da!==null&&pc(Da,e),_a!==null&&pc(_a,e),La!==null&&pc(La,e),Zs.forEach(n),Js.forEach(n);for(var i=0;i<Ua.length;i++){var s=Ua[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ua.length&&(i=Ua[0],i.blockedOn===null);)tv(i),i.blockedOn===null&&Ua.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[kn]||null;if(typeof h=="function")v||rv(i);else if(v){var N=null;if(h&&h.hasAttribute("formAction")){if(f=h,v=h[kn]||null)N=v.formAction;else if(Eh(f)!==null)continue}else N=v.action;typeof N=="function"?i[s+1]=N:(i.splice(s,3),s-=3),rv(i)}}}function av(){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 Th(e){this._internalRoot=e}yc.prototype.render=Th.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(l(409));var i=n.current,s=Yn();Xb(i,s,e,n,null,null)},yc.prototype.unmount=Th.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Xb(e.current,2,null,e,null,null),tc(),n[Yi]=null}};function yc(e){this._internalRoot=e}yc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Vp();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Ua.length&&n!==0&&n<Ua[i].priority;i++);Ua.splice(i,0,e),i===0&&tv(e)}};var iv=r.version;if(iv!=="19.3.0")throw Error(l(527,iv,"19.3.0"));Ee.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 p2={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ye,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xc.isDisabled&&xc.supportsFiber)try{ss=xc.inject(p2),Un=xc}catch{}}return to.createRoot=function(e,n){if(!o(e))throw Error(l(299));var i=!1,s="",f=Ky,h=Xy,v=$y;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=Gb(e,1,!1,null,null,i,s,null,f,h,v,av),e[Yi]=n.current,ah(e),new Th(n)},to.hydrateRoot=function(e,n,i){if(!o(e))throw Error(l(299));var s=!1,f="",h=Ky,v=Xy,N=$y,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=Gb(e,1,!0,n,i??null,s,f,R,h,v,N,av),n.context=Kb(null),i=n.current,s=Yn(),s=nd(s),f=wa(s),f.callback=null,Sa(i,f,s),i=s,n.current.lanes=i,us(n,i),Ur(n),e[Yi]=n.current,ah(e),new yc(n)},to.version="19.3.0",to}var gv;function k2(){if(gv)return Mh.exports;gv=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(),Mh.exports=E2(),Mh.exports}var T2=k2();/**
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 Km=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,e1=/^[\\/]{2}/;function A2(t,r){return r+t.replace(/\\/g,"/")}var yv="popstate";function xv(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function O2(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),hm("",{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:Ui(u))}function l(o,u){cr(o.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(u)})`)}return M2(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 R2(){return Math.random().toString(36).substring(2,10)}function bv(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 hm(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||R2(),mask:o}}function Ui({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 M2(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(),j=E==null?null:E-y;y=E,p&&p({action:m,location:k.location,delta:j})}function b(E,j){m="PUSH";let A=xv(E)?E:hm(k.location,E,j);a&&a(A,E),y=x()+1;let z=bv(A,y),Y=k.createHref(A.mask||A);try{d.pushState(z,"",Y)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;o.location.assign(Y)}u&&p&&p({action:m,location:k.location,delta:1})}function w(E,j){m="REPLACE";let A=xv(E)?E:hm(k.location,E,j);a&&a(A,E),y=x();let z=bv(A,y),Y=k.createHref(A.mask||A);d.replaceState(z,"",Y),u&&p&&p({action:m,location:k.location,delta:0})}function C(E){return z2(o,E)}let k={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(yv,g),p=E,()=>{o.removeEventListener(yv,g),p=null}},createHref(E){return r(o,E)},createURL:C,encodeLocation(E){let j=C(E);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:b,replace:w,go(E){return d.go(E)}};return k}function z2(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:Ui(r);return o=o.replace(/ $/,"%20"),!a&&e1.test(o)&&(o=l+o),new URL(o,l)}function t1(t,r,a="/"){return D2(t,r,a,!1)}function D2(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=_2(t),p=null,y=V2(d);for(let x=0;p==null&&x<m.length;++x)p=Y2(m[x],y,l);return p}function _2(t){let r=n1(t);return L2(r),r}function n1(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}".`),n1(d.children,r,b,g,p)),!(d.path==null&&!d.index)&&r.push({path:g,score:P2(g,d.index),routesMeta:b.map((w,C)=>{let[k,E]=i1(w.relativePath,w.caseSensitive,C===b.length-1);return{...w,matcher:k,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 r1(d.path))u(d,m,!0,y)}),r}function r1(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=r1(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 L2(t){t.sort((r,a)=>r.score!==a.score?a.score-r.score:Q2(r.routesMeta.map(l=>l.childrenIndex),a.routesMeta.map(l=>l.childrenIndex)))}var U2=/^:[\w-]+$/,q2=3,H2=2,B2=1,F2=10,I2=-2,vv=t=>t==="*";function P2(t,r){let a=t.split("/"),l=a.length;return a.some(vv)&&(l+=I2),r&&(l+=H2),a.filter(o=>!vv(o)).reduce((o,u)=>o+(U2.test(u)?q2:u===""?B2:F2),l)}function Q2(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 Y2(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?a1(g,x,p.matcher,p.compiledParams):Oc(g,x),w=p.route;if(!b&&y&&a&&!l[l.length-1].route.index&&(b=Oc({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:X2(Nr([u,b.pathnameBase])),route:w}),b.pathnameBase!=="/"&&(u=Nr([u,b.pathnameBase]))}return d}function Oc(t,r){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[a,l]=i1(t.path,t.caseSensitive,t.end);return a1(t,r,a,l)}function a1(t,r,a,l){let o=r.match(a);if(!o)return null;let u=o[0],d=Zl(u,1),m=o.slice(1);return{params:l.reduce((y,{paramName:x,isOptional:g},b)=>{if(x==="*"){let C=m[b]||"";d=Zl(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 i1(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 V2(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 G2(t,r="/"){let{pathname:a,search:l="",hash:o=""}=typeof t=="string"?Fi(t):t,u;return a?(a=l1(a),a.startsWith("/")||a.startsWith("\\")?u=wv(a.substring(1),"/"):u=wv(a,r)):u=r,{pathname:u,search:$2(l),hash:Z2(o)}}function wv(t,r){let a=Zl(r).split("/");return t.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function Lh(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 K2(t){return t.filter((r,a)=>a===0||r.route.path&&r.route.path.length>0)}function Xm(t){let r=K2(t);return r.map((a,l)=>l===r.length-1?a.pathname:a.pathnameBase)}function Hc(t,r,a,l=!1){let o;typeof t=="string"?o=Fi(t):(o={...t},Rt(!o.pathname||!o.pathname.includes("?"),Lh("?","pathname","search",o)),Rt(!o.pathname||!o.pathname.includes("#"),Lh("#","pathname","hash",o)),Rt(!o.search||!o.search.includes("#"),Lh("#","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=G2(o,m),y=d&&d!=="/"&&d.endsWith("/"),x=(u||d===".")&&a.endsWith("/");return!p.pathname.endsWith("/")&&(y||x)&&(p.pathname+="/"),p}var l1=t=>t.replace(/[\\/]{2,}/g,"/"),Nr=t=>l1(t.join("/"));function Zl(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 X2=t=>Zl(t).replace(/^\/*/,"/"),$2=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Z2=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,J2=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 W2(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function ej(t){let r=t.map(a=>a.route.path).filter(Boolean);return Nr(r)||"/"}var s1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function o1(t,r){let a=t;if(typeof a!="string"||!Km.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let l=a,o=!1;if(s1)try{let u=new URL(window.location.href),d=e1.test(a)?new URL(A2(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 Sv=new URL("http://localhost");function $m(t){if(t.createURL)return t.createURL("/");try{return new URL(t.createHref("/"),Sv)}catch{return Sv}}function Uh(t,r){return t.origin===r.origin&&(t.origin!=="null"||t.protocol===r.protocol&&t.host===r.host)}function tj(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 Zm(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&&!Uh(o,a),m=!Uh(u,a);if(l==="reject"){if(d||m)throw new Error("External navigation is not allowed")}else if(m&&(o==null||!tj(t,o)||!Uh(o,u)))throw new Error("External navigation is not allowed")}var u1=["POST","PUT","PATCH","DELETE"];new Set(u1);var nj=["GET",...u1];new Set(nj);var rj=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function aj(t){try{return rj.includes(new URL(t).protocol)}catch{return!1}}var ts=S.createContext(null);ts.displayName="DataRouter";var Bc=S.createContext(null);Bc.displayName="DataRouterState";var c1=S.createContext(!1);function ij(){return S.useContext(c1)}var d1=S.createContext({isTransitioning:!1});d1.displayName="ViewTransition";var lj=S.createContext(new Map);lj.displayName="Fetchers";var sj=S.createContext(null);sj.displayName="Await";var $n=S.createContext(null);$n.displayName="Navigation";var _o=S.createContext(null);_o.displayName="Location";var dr=S.createContext({outlet:null,matches:[],isDataRoute:!1});dr.displayName="Route";var Jm=S.createContext(null);Jm.displayName="RouteError";var f1="REACT_ROUTER_ERROR",oj="REDIRECT",uj="ROUTE_ERROR_RESPONSE";function cj(t){if(t.startsWith(`${f1}:${oj}:{`))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 dj(t){if(t.startsWith(`${f1}:${uj}:{`))try{let r=JSON.parse(t.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new J2(r.status,r.statusText,r.data)}catch{}}function fj(t,{relative:r}={}){Rt(ns(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:l}=S.useContext($n),{hash:o,pathname:u,search:d}=Lo(t,{relative:r}),m=u;return a!=="/"&&(m=u==="/"?a:Nr([a,u])),l.createHref({pathname:m,search:d,hash:o})}function ns(){return S.useContext(_o)!=null}function jr(){return Rt(ns(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(_o).location}var h1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function m1(t){S.useContext($n).static||S.useLayoutEffect(t)}function Wm(){let{isDataRoute:t}=S.useContext(dr);return t?kj():hj()}function hj(){Rt(ns(),"useNavigate() may be used only in the context of a <Router> component.");let t=S.useContext(ts),{basename:r,navigator:a}=S.useContext($n),{matches:l}=S.useContext(dr),{pathname:o}=jr(),u=JSON.stringify(Xm(l)),d=S.useRef(!1);return m1(()=>{d.current=!0}),S.useCallback((p,y={})=>{if(cr(d.current,h1),!d.current)return;if(typeof p=="number"){a.go(p);return}let x=Hc(p,JSON.parse(u),o,y.relative==="path");t==null&&r!=="/"&&(x.pathname=x.pathname==="/"?r:Nr([r,x.pathname])),Zm(typeof p=="string"?p:Ui(p),a.createHref(x),$m(a),"reject"),(y.replace?a.replace:a.push)(x,y.state,y)},[r,a,u,o,t])}var mj=S.createContext(null);function pj(t){let r=S.useContext(dr).outlet;return S.useMemo(()=>r&&S.createElement(mj.Provider,{value:t},r),[r,t])}function p1(){let{matches:t}=S.useContext(dr),r=t[t.length-1];return(r==null?void 0:r.params)??{}}function Lo(t,{relative:r}={}){let{matches:a}=S.useContext(dr),{pathname:l}=jr(),o=JSON.stringify(Xm(a));return S.useMemo(()=>Hc(t,JSON.parse(o),l,r==="path"),[t,o,l,r])}function gj(t,r){return g1(t,r)}function g1(t,r,a){var E;Rt(ns(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=S.useContext($n),{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 j=y&&y.path||"";x1(m,!y||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let x=jr(),g;if(r){let j=typeof r=="string"?Fi(r):r;Rt(p==="/"||((E=j.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 "${j.pathname}" was given in the \`location\` prop.`),g=j}else g=x;let b=g.pathname||"/",w=b;if(p!=="/"){let j=p.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(j.length).join("/")}let C=a&&a.state.matches.length?a.state.matches.map(j=>Object.assign(j,{route:a.manifest[j.route.id]||j.route})):t1(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 k=wj(C&&C.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:Nr([p,l.encodeLocation?l.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?p:Nr([p,l.encodeLocation?l.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,a);return r&&k?S.createElement(_o.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},k):k}function yj(){let t=Ej(),r=W2(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 xj=S.createElement(yj,null),y1=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=dj(t.digest);a&&(t=a)}let r=t!==void 0?S.createElement(dr.Provider,{value:this.props.routeContext},S.createElement(Jm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?S.createElement(bj,{error:t},r):r}};y1.contextType=c1;var qh=new WeakMap;function bj({children:t,error:r}){let{basename:a,navigator:l}=S.useContext($n);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let o=cj(r.digest);if(o){let u=qh.get(r);if(u)throw u;let d=o1(o.location,a),m=d.absoluteURL||d.to;if(Zm(o.location,m,$m(l),"allow-explicit"),aj(m))throw new Error("Invalid redirect location");if(s1&&!qh.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 qh.set(r,p),p}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${m}`})}}return t}function vj({routeContext:t,match:r,children:a}){let l=S.useContext(ts);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 wj(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:ej(l.matches),errorInfo:g})}:void 0;return o.reduceRight((x,g,b)=>{let w,C=!1,k=null,E=null;l&&(w=u&&g.route.id?u[g.route.id]:void 0,k=g.route.errorElement||xj,d&&(m<0&&b===0?(x1("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 j=r.concat(o.slice(0,b+1)),A=()=>{let z;return w?z=k:C?z=E:g.route.Component?z=S.createElement(g.route.Component,null):g.route.element?z=g.route.element:z=x,S.createElement(vj,{match:g,routeContext:{outlet:x,matches:j,isDataRoute:l!=null},children:z})};return l&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?S.createElement(y1,{location:l.location,revalidation:l.revalidation,component:k,error:w,children:A(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:y}):A()},null)}function ep(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sj(t){let r=S.useContext(ts);return Rt(r,ep(t)),r}function Nj(t){let r=S.useContext(Bc);return Rt(r,ep(t)),r}function Cj(t){let r=S.useContext(dr);return Rt(r,ep(t)),r}function tp(t){let r=Cj(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 jj(){return tp("useRouteId")}function Ej(){var l;let t=S.useContext(Jm),r=Nj("useRouteError"),a=tp("useRouteError");return t!==void 0?t:(l=r.errors)==null?void 0:l[a]}function kj(){let{router:t}=Sj("useNavigate"),r=tp("useNavigate"),a=S.useRef(!1);return m1(()=>{a.current=!0}),S.useCallback(async(o,u={})=>{cr(a.current,h1),a.current&&(typeof o=="number"?await t.navigate(o):await t.navigate(o,{fromRouteId:r,...u}))},[t,r])}var Nv={};function x1(t,r,a){!r&&!Nv[t]&&(Nv[t]=!0,cr(!1,a))}S.memo(Tj);function Tj({routes:t,manifest:r,future:a,state:l,isStatic:o,onError:u}){return g1(t,void 0,{manifest:r,state:l,isStatic:o,onError:u})}function Aj({to:t,replace:r,state:a,relative:l}){Rt(ns(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o,navigator:u}=S.useContext($n);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}=jr(),p=Wm(),y=Hc(t,Xm(d),m,l==="path");Zm(typeof t=="string"?t:Ui(t),u.createHref(y),$m(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 Oj(t){return pj(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 Rj({basename:t="/",children:r=null,location:a,navigationType:l="POP",navigator:o,static:u=!1,useTransitions:d}){Rt(!ns(),"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,k=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(k!=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.`),k==null?null:S.createElement($n.Provider,{value:p},S.createElement(_o.Provider,{children:r,value:k}))}function Mj({children:t,location:r}){return gj(mm(t),r)}function mm(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,mm(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=mm(l.props.children,u)),a.push(d)}),a}var kc="get",Tc="application/x-www-form-urlencoded";function Fc(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function zj(t){return Fc(t)&&t.tagName.toLowerCase()==="button"}function Dj(t){return Fc(t)&&t.tagName.toLowerCase()==="form"}function _j(t){return Fc(t)&&t.tagName.toLowerCase()==="input"}function Lj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Uj(t,r){return t.button===0&&(!r||r==="_self")&&!Lj(t)}var vc=null;function qj(){if(vc===null)try{new FormData(document.createElement("form"),0),vc=!1}catch{vc=!0}return vc}var Hj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Hh(t){return t!=null&&!Hj.has(t)?(cr(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tc}"`),null):t}function Bj(t,r){let a,l,o,u,d;if(Dj(t)){let m=t.getAttribute("action");l=m?ua(m,r):null,a=t.getAttribute("method")||kc,o=Hh(t.getAttribute("enctype"))||Tc,u=new FormData(t)}else if(zj(t)||_j(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")||kc,o=Hh(t.getAttribute("formenctype"))||Hh(m.getAttribute("enctype"))||Tc,u=new FormData(m,t),!qj()){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(Fc(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=kc,l=null,o=Tc,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 np(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function b1(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=`${Zl(r)}/_root.${l}`:o.pathname=`${Zl(o.pathname)}.${l}`,o}async function Fj(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 Ij(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 Pj(t,r,a){let l=await Promise.all(t.map(async o=>{let u=r.routes[o.route.id];if(u){let d=await Fj(u,a);return d.links?d.links():[]}return[]}));return Gj(l.flat(1).filter(Ij).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Cv(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 Qj(t,r,{includeHydrateFallback:a}={}){return Yj(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 Yj(t){return[...new Set(t)]}function Vj(t){let r={},a=Object.keys(t).sort();for(let l of a)r[l]=t[l];return r}function Gj(t,r){let a=new Set;return new Set(r),t.reduce((l,o)=>{let u=JSON.stringify(Vj(o));return a.has(u)||(a.add(u),l.push({key:u,link:o})),l},[])}function rp(){let t=S.useContext(ts);return np(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Kj(){let t=S.useContext(Bc);return np(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var ap=S.createContext(void 0);ap.displayName="FrameworkContext";function Ic(){let t=S.useContext(ap);return np(t,"You must render this element inside a <HydratedRouter> element"),t}function Xj(t,r){let a=S.useContext(ap),[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 k=j=>{j.forEach(A=>{d(A.isIntersecting)})},E=new IntersectionObserver(k,{threshold:.5});return b.current&&E.observe(b.current),()=>{E.disconnect()}}},[t]),S.useEffect(()=>{if(l){let k=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(k)}}},[l]);let w=()=>{o(!0)},C=()=>{o(!1),d(!1)};return a?t!=="intent"?[u,b,{}]:[u,b,{onFocus:no(m,w),onBlur:no(p,C),onMouseEnter:no(y,w),onMouseLeave:no(x,C),onTouchStart:no(g,w)}]:[!1,b,{}]}function no(t,r){return a=>{t&&t(a),a.defaultPrevented||r(a)}}function $j({page:t,...r}){let a=ij(),{nonce:l}=Ic(),{router:o}=rp(),u=S.useMemo(()=>t1(o.routes,t,o.basename),[o.routes,t,o.basename]);return u?(r.nonce==null&&l&&(r={...r,nonce:l}),a?S.createElement(Jj,{page:t,matches:u,...r}):S.createElement(Wj,{page:t,matches:u,...r})):null}function Zj(t){let{manifest:r,routeModules:a}=Ic(),[l,o]=S.useState([]);return S.useEffect(()=>{let u=!1;return Pj(t,r,a).then(d=>{u||o(d)}),()=>{u=!0}},[t,r,a]),l}function Jj({page:t,matches:r,...a}){let l=jr(),{future:o}=Ic(),{basename:u}=rp(),d=S.useMemo(()=>{if(t===l.pathname+l.search+l.hash)return[];let m=b1(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 Wj({page:t,matches:r,...a}){let l=jr(),{future:o,manifest:u,routeModules:d}=Ic(),{basename:m}=rp(),{loaderData:p,matches:y}=Kj(),x=S.useMemo(()=>Cv(t,r,y,u,l,"data"),[t,r,y,u,l]),g=S.useMemo(()=>Cv(t,r,y,u,l,"assets"),[t,r,y,u,l]),b=S.useMemo(()=>{if(t===l.pathname+l.search+l.hash)return[];let k=new Set,E=!1;if(r.forEach(A=>{var Y;let z=u.routes[A.route.id];!z||!z.hasLoader||(!x.some(q=>q.route.id===A.route.id)&&A.route.id in p&&((Y=d[A.route.id])!=null&&Y.shouldRevalidate)||z.hasClientLoader?E=!0:k.add(A.route.id))}),k.size===0)return[];let j=b1(t,m,o.v8_trailingSlashAwareDataRequests,"data");return E&&k.size>0&&j.searchParams.set("_routes",r.filter(A=>k.has(A.route.id)).map(A=>A.route.id).join(",")),[j.pathname+j.search]},[m,o.v8_trailingSlashAwareDataRequests,p,l,u,x,r,t,d]),w=S.useMemo(()=>Qj(g,u),[g,u]),C=Zj(g);return S.createElement(S.Fragment,null,b.map(k=>S.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...a})),w.map(k=>S.createElement("link",{key:k,rel:"modulepreload",href:k,...a})),C.map(({key:k,link:E})=>S.createElement("link",{key:k,nonce:a.nonce,...E,crossOrigin:E.crossOrigin??a.crossOrigin})))}function eE(...t){return r=>{t.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var tE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{tE&&(window.__reactRouterVersion="7.18.4")}catch{}function nE({basename:t,children:r,useTransitions:a,window:l}){let o=S.useRef();o.current==null&&(o.current=O2({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(Rj,{basename:t,children:r,location:d.location,navigationType:d.action,navigator:u,useTransitions:a})}var Pc=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},k){let{basename:E,navigator:j,useTransitions:A}=S.useContext($n),z=typeof x=="string"&&Km.test(x),Y=o1(x,E);x=Y.to;let q=fj(x,{relative:o}),T=jr(),H=null;if(m){let ne=Hc(m,[],T.mask?T.mask.pathname:"/",!0);E!=="/"&&(ne.pathname=ne.pathname==="/"?E:Nr([E,ne.pathname])),H=j.createHref(ne)}let[$,W,M]=Xj(l,C),ie=lE(x,{replace:d,mask:m,state:p,target:y,preventScrollReset:g,relative:o,viewTransition:b,defaultShouldRevalidate:w,useTransitions:A});function Q(ne){r&&r(ne),ne.defaultPrevented||ie(ne)}let ae=!(Y.isExternal||u),le=S.createElement("a",{...C,...M,href:(ae?H:void 0)||Y.absoluteURL||q,onClick:ae?Q:r,ref:eE(k,W),target:y,"data-discover":!z&&a==="render"?"true":void 0});return $&&!z?S.createElement(S.Fragment,null,le,S.createElement($j,{page:q})):le});Pc.displayName="Link";var rE=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=Lo(d,{relative:y.relative}),b=jr(),w=S.useContext(Bc),{navigator:C,basename:k}=S.useContext($n),E=w!=null&&dE(g)&&m===!0,j=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,A=b.pathname,z=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;a||(A=A.toLowerCase(),z=z?z.toLowerCase():null,j=j.toLowerCase()),z&&k&&(z=ua(z,k)||z);const Y=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let q=A===j||!o&&A.startsWith(j)&&A.charAt(Y)==="/",T=z!=null&&(z===j||!o&&z.startsWith(j)&&z.charAt(j.length)==="/"),H={isActive:q,isPending:T,isTransitioning:E},$=q?r:void 0,W;typeof l=="function"?W=l(H):W=[l,q?"active":null,T?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let M=typeof u=="function"?u(H):u;return S.createElement(Pc,{...y,"aria-current":$,className:W,ref:x,style:M,to:d,viewTransition:m},typeof p=="function"?p(H):p)});rE.displayName="NavLink";var aE=S.forwardRef(({discover:t="render",fetcherKey:r,navigate:a,reloadDocument:l,replace:o,state:u,method:d=kc,action:m,onSubmit:p,relative:y,preventScrollReset:x,viewTransition:g,defaultShouldRevalidate:b,...w},C)=>{let{useTransitions:k}=S.useContext($n),E=uE(),j=cE(m,{relative:y}),A=d.toLowerCase()==="get"?"get":"post",z=typeof m=="string"&&Km.test(m),Y=q=>{if(p&&p(q),q.defaultPrevented)return;q.preventDefault();let T=q.nativeEvent.submitter,H=(T==null?void 0:T.getAttribute("formmethod"))||d,$=()=>E(T||q.currentTarget,{fetcherKey:r,method:H,navigate:a,replace:o,state:u,relative:y,preventScrollReset:x,viewTransition:g,defaultShouldRevalidate:b});k&&a!==!1?S.startTransition(()=>$()):$()};return S.createElement("form",{ref:C,method:A,action:j,onSubmit:l?p:Y,...w,"data-discover":!z&&t==="render"?"true":void 0})});aE.displayName="Form";function iE(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function v1(t){let r=S.useContext(ts);return Rt(r,iE(t)),r}function lE(t,{target:r,replace:a,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:m,defaultShouldRevalidate:p,useTransitions:y}={}){let x=Wm(),g=jr(),b=Lo(t,{relative:d});return S.useCallback(w=>{if(Uj(w,r)){w.preventDefault();let C=a!==void 0?a:Ui(g)===Ui(b),k=()=>x(t,{replace:C,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:m,defaultShouldRevalidate:p});y?S.startTransition(()=>k()):k()}},[g,x,b,a,l,o,r,t,u,d,m,p,y])}var sE=0,oE=()=>`__${String(++sE)}__`;function uE(){let{router:t}=v1("useSubmit"),{basename:r}=S.useContext($n),a=jj(),l=t.fetch,o=t.navigate;return S.useCallback(async(u,d={})=>{let{action:m,method:p,encType:y,formData:x,body:g}=Bj(u,r);if(d.navigate===!1){let b=d.fetcherKey||oE();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 cE(t,{relative:r}={}){let{basename:a}=S.useContext($n),l=S.useContext(dr);Rt(l,"useFormAction must be used inside a RouteContext");let[o]=l.matches.slice(-1),u={...Lo(t||".",{relative:r})},d=jr();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])),Ui(u)}function dE(t,{relative:r}={}){let a=S.useContext(d1);Rt(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=v1("useViewTransitionState"),o=Lo(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 Oc(o.pathname,d)!=null||Oc(o.pathname,u)!=null}const w1=S.createContext(void 0),Lt=t=>{const r=S.useContext(w1);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},fE=({client:t,children:r})=>(S.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),c.jsx(w1.Provider,{value:t,children:r})),hE={setTimeout:(t,r)=>setTimeout(t,r),clearTimeout:t=>clearTimeout(t),setInterval:(t,r)=>setInterval(t,r),clearInterval:t=>clearInterval(t)};var Qa,Ym,Q0,mE=(Q0=class{constructor(){De(this,Qa,hE);De(this,Ym,!1)}setTimeoutProvider(t){Se(this,Qa,t)}setTimeout(t,r){return U(this,Qa).setTimeout(t,r)}clearTimeout(t){U(this,Qa).clearTimeout(t)}setInterval(t,r){return U(this,Qa).setInterval(t,r)}clearInterval(t){U(this,Qa).clearInterval(t)}},Qa=new WeakMap,Ym=new WeakMap,Q0);const Ei=new mE;function pE(t){setTimeout(t,0)}const gE=typeof window>"u"||"Deno"in globalThis;function Dn(){}function yE(t,r){return typeof t=="function"?t(r):t}function S1(t){return typeof t=="number"&&t>=0&&t!==1/0}function N1(t,r){return Math.max(t+(r||0)-Date.now(),0)}function Ot(t,r){return typeof t=="function"?t(r):t}function jv(t,r){const{type:a="all",exact:l,fetchStatus:o,predicate:u,queryKey:d,stale:m}=t;if(d){if(l){if(r.queryHash!==ip(d,r.options))return!1}else if(!Jl(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 Ev(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(!Jl(r.options.mutationKey,u))return!1}return!(l&&r.state.status!==l||o&&!o(r))}function ip(t,r){return((r==null?void 0:r.queryKeyHashFn)||wo)(t)}function wo(t){return JSON.stringify(t,(r,a)=>pm(a)?Object.keys(a).sort().reduce((l,o)=>(l[o]=a[o],l),{}):a)}function Jl(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(!Jl(t[l],r[l]))return!1;return!0}const a=Object.keys(r);for(const l of a)if(!Jl(t[l],r[l]))return!1;return!0}return!1}const xE=Object.prototype.hasOwnProperty;function C1(t,r,a=0){if(t===r)return t;if(a>500)return r;const l=kv(t)&&kv(r);if(!l&&!(pm(t)&&pm(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:xE.call(t,x))&&p++;continue}if(g===null||b===null||typeof g!="object"||typeof b!="object"){m[x]=b;continue}const w=C1(g,b,a+1);m[x]=w,w===g&&p++}return o===d&&p===o?t:m}function Bh(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 kv(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function pm(t){if(!Tv(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!(!Tv(l)||!l.hasOwnProperty("isPrototypeOf")||r!==Object.prototype)}function Tv(t){return Object.prototype.toString.call(t)==="[object Object]"}function bE(t){return new Promise(r=>{Ei.setTimeout(r,t)})}function gm(t,r,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,r):a.structuralSharing!==!1?C1(t,r):r}function vE(t,r,a=0){const l=[...t,r];return a&&l.length>a?l.slice(1):l}function wE(t,r,a=0){const l=[r,...t];return a&&l.length>a?l.slice(0,-1):l}const lp=Symbol();function j1(t,r){return!t.queryFn&&(r!=null&&r.initialPromise)?()=>r.initialPromise:!t.queryFn||t.queryFn===lp?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function E1(t,r){return typeof t=="function"?t(...r):!!t}function SE(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 NE=()=>gE;const sp=()=>NE();var Uo=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(){}},ki,Ya,ql,Y0,CE=(Y0=class extends Uo{constructor(){super();De(this,ki);De(this,Ya);De(this,ql);Se(this,ql,r=>{if(typeof window<"u"&&window.addEventListener){const a=()=>r();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){U(this,Ya)||this.setEventListener(U(this,ql))}onUnsubscribe(){var r;this.hasListeners()||((r=U(this,Ya))==null||r.call(this),Se(this,Ya,void 0))}setEventListener(r){var a;Se(this,ql,r),(a=U(this,Ya))==null||a.call(this),Se(this,Ya,r(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(r){U(this,ki)!==r&&(Se(this,ki,r),this.onFocus())}onFocus(){const r=this.isFocused();this.listeners.forEach(a=>{a(r)})}isFocused(){var r;return typeof U(this,ki)=="boolean"?U(this,ki):((r=globalThis.document)==null?void 0:r.visibilityState)!=="hidden"}},ki=new WeakMap,Ya=new WeakMap,ql=new WeakMap,Y0);const op=new CE,jE=pE;function EE(){let t=[],r=0,a=m=>{m()},l=m=>{m()},o=jE;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=EE();var Hl,Va,Bl,V0,kE=(V0=class extends Uo{constructor(){super();De(this,Hl,!0);De(this,Va);De(this,Bl);Se(this,Bl,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(){U(this,Va)||this.setEventListener(U(this,Bl))}onUnsubscribe(){var r;this.hasListeners()||((r=U(this,Va))==null||r.call(this),Se(this,Va,void 0))}setEventListener(r){var a;Se(this,Bl,r),(a=U(this,Va))==null||a.call(this),Se(this,Va,r(this.setOnline.bind(this)))}setOnline(r){U(this,Hl)!==r&&(Se(this,Hl,r),this.listeners.forEach(a=>{a(r)}))}isOnline(){return U(this,Hl)}},Hl=new WeakMap,Va=new WeakMap,Bl=new WeakMap,V0);const Rc=new kE;function TE(t){return Math.min(1e3*2**t,3e4)}function k1(t){return(t??"online")==="online"?Rc.isOnline():!0}var ym=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function T1(t){let r=!1,a=0,l,o="pending",u,d;const m=new Promise((A,z)=>{u=A,d=z});m.catch(Dn);const p=()=>o!=="pending",y=A=>{var z;if(!p()){const Y=new ym(A);k(Y),(z=t.onCancel)==null||z.call(t,Y)}},x=()=>{r=!0},g=()=>{r=!1},b=()=>op.isFocused()&&(t.networkMode==="always"||Rc.isOnline())&&t.canRun(),w=()=>k1(t.networkMode)&&t.canRun(),C=A=>{p()||(l==null||l(),o="resolved",u(A))},k=A=>{p()||(l==null||l(),o="rejected",d(A))},E=()=>new Promise(A=>{var z;l=Y=>{(p()||b())&&A(Y)},(z=t.onPause)==null||z.call(t)}).then(()=>{var A;l=void 0,p()||(A=t.onContinue)==null||A.call(t)}),j=()=>{if(p())return;let A;const z=a===0?t.initialPromise:void 0;try{A=z??t.fn()}catch(Y){A=Promise.reject(Y)}Promise.resolve(A).then(C).catch(Y=>{var W;if(p())return;const q=t.retry??(sp()?0:3),T=t.retryDelay??TE,H=typeof T=="function"?T(a,Y):T,$=q===!0||typeof q=="number"&&a<q||typeof q=="function"&&q(a,Y);if(r||!$){k(Y);return}a++,(W=t.onFail)==null||W.call(t,a,Y),bE(H).then(()=>b()?void 0:E()).then(()=>{r?k(Y):j()})})};return{promise:m,status:()=>o,cancel:y,continue:()=>(l==null||l(),m),cancelRetry:x,continueRetry:g,canStart:w,start:()=>(w()?j():E().then(j),m)}}var Ti,G0,A1=(G0=class{constructor(){De(this,Ti)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S1(this.gcTime)&&Se(this,Ti,Ei.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(sp()?1/0:3e5))}clearGcTimeout(){U(this,Ti)!==void 0&&(Ei.clearTimeout(U(this,Ti)),Se(this,Ti,void 0))}},Ti=new WeakMap,G0);function AE(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 k=!1;const E=z=>{SE(z,()=>r.signal,()=>k=!0)},j=j1(r.options,r.fetchOptions),A=async(z,Y,q)=>{if(k)return Promise.reject(r.signal.reason);if(Y==null&&z.pages.length)return Promise.resolve(z);const H=(()=>{const ie={client:r.client,queryKey:r.queryKey,pageParam:Y,direction:q?"backward":"forward",meta:r.options.meta};return E(ie),ie})(),$=await j(H),{maxPages:W}=r.options,M=q?wE:vE;return{pages:M(z.pages,$,W),pageParams:M(z.pageParams,Y,W)}};if(o&&u.length){const z=o==="backward",Y=z?OE:Av,q={pages:u,pageParams:d};m=await A(q,Y(l,q),z)}else{const z=t??u.length;do{const Y=p===0?d[0]??l.initialPageParam:Av(l,m);if(p>0&&Y==null)break;m=await A(m,Y),p++}while(p<z)}return m};r.options.persister?r.fetchFn=()=>{var k,E;return(E=(k=r.options).persister)==null?void 0:E.call(k,y,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},a)}:r.fetchFn=y}}}function Av(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 OE(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 Fl,Ai,Il,or,Oi,Zt,Oo,Ri,wr,la,K0,RE=(K0=class extends A1{constructor(r){super();De(this,wr);De(this,Fl);De(this,Ai);De(this,Il);De(this,or);De(this,Oi);De(this,Zt);De(this,Oo);De(this,Ri);Se(this,Ri,!1),Se(this,Oo,r.defaultOptions),this.setOptions(r.options),this.observers=[],Se(this,Oi,r.client),Se(this,or,U(this,Oi).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,Se(this,Ai,Rv(this.options)),this.state=r.state??U(this,Ai),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return U(this,Fl)}get promise(){var r;return(r=U(this,Zt))==null?void 0:r.promise}setOptions(r){if(this.options={...U(this,Oo),...r},r!=null&&r._type&&Se(this,Fl,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=Rv(this.options);a.data!==void 0&&(this.setState(Ov(a.data,a.dataUpdatedAt)),Se(this,Ai,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&U(this,or).remove(this)}setData(r,a){const l=gm(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=U(this,Zt))==null?void 0:l.promise;return(o=U(this,Zt))==null||o.cancel(r),a?a.then(Dn).catch(Dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return U(this,Ai)}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===lp||!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:!N1(this.state.dataUpdatedAt,r)}onFocus(){var r,a;(r=this.observers.find(l=>l.shouldFetchOnWindowFocus()))==null||r.refetch({cancelRefetch:!1}),(a=U(this,Zt))==null||a.continue()}onOnline(){var r,a;(r=this.observers.find(l=>l.shouldFetchOnReconnect()))==null||r.refetch({cancelRefetch:!1}),(a=U(this,Zt))==null||a.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),U(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||(U(this,Zt)&&(U(this,Ri)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?U(this,Zt).cancel({revert:!0}):U(this,Zt).cancelRetry()),this.scheduleGc()),U(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,k,E,j,A,z,Y;if(this.state.fetchStatus!=="idle"&&((y=U(this,Zt))==null?void 0:y.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(U(this,Zt))return U(this,Zt).continueRetry(),U(this,Zt).promise}if(r&&this.setOptions(r),!this.options.queryFn){const q=this.observers.find(T=>T.options.queryFn);q&&this.setOptions(q.options)}const l=new AbortController,o=q=>{Object.defineProperty(q,"signal",{enumerable:!0,get:()=>(Se(this,Ri,!0),l.signal)})},u=()=>{const q=j1(this.options,a),H=(()=>{const $={client:U(this,Oi),queryKey:this.queryKey,meta:this.meta};return o($),$})();return Se(this,Ri,!1),this.options.persister?this.options.persister(q,H,this):q(H)},m=(()=>{const q={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:U(this,Oi),state:this.state,fetchFn:u};return o(q),q})();(x=U(this,Fl)==="infinite"?AE(this.options.pages):this.options.behavior)==null||x.onFetch(m,this),Se(this,Il,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,T1({initialPromise:a==null?void 0:a.initialPromise,fn:m.fetchFn,onCancel:q=>{q instanceof ym&&q.revert&&this.setState({...U(this,Il),fetchStatus:"idle"}),l.abort()},onFail:(q,T)=>{et(this,wr,la).call(this,{type:"failed",failureCount:q,error:T})},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=U(this,or).config).onSuccess)==null||C.call(w,q,this),(E=(k=U(this,or).config).onSettled)==null||E.call(k,q,this.state.error,this),q}catch(q){if(q instanceof ym){if(q.silent)return U(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=(j=U(this,or).config).onError)==null||A.call(j,q,this),(Y=(z=U(this,or).config).onSettled)==null||Y.call(z,this.state.data,q,this),q}finally{U(this,Zt)===p&&Se(this,Zt,void 0),this.scheduleGc()}}},Fl=new WeakMap,Ai=new WeakMap,Il=new WeakMap,or=new WeakMap,Oi=new WeakMap,Zt=new WeakMap,Oo=new WeakMap,Ri=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,...O1(l.data,this.options),fetchMeta:r.meta??null};case"success":const o={...l,...Ov(r.data,r.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Se(this,Il,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()}),U(this,or).notify({query:this,type:"updated",action:r})})},K0);function O1(t,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:k1(r.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ov(t,r){return{data:t,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Rv(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,Ro,Sn,Mi,Pl,sa,Mo,Ql,Yl,zi,Di,Ga,Vl,dt,po,xm,bm,vm,wm,Sm,Nm,Cm,jm,X0,ME=(X0=class extends Uo{constructor(r,a){super();De(this,dt);De(this,wn);De(this,tt);De(this,Ro);De(this,Sn);De(this,Mi);De(this,Pl);De(this,sa);De(this,Mo);De(this,Ql);De(this,Yl);De(this,zi);De(this,Di);De(this,Ga);De(this,Vl,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&&(U(this,tt).addObserver(this),Mv(U(this,tt),this.options)?et(this,dt,po).call(this):this.updateResult(),et(this,dt,Sm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Em(U(this,tt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Em(U(this,tt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,et(this,dt,Nm).call(this),et(this,dt,Cm).call(this),U(this,tt).removeObserver(this)}setOptions(r){const a=this.options,l=U(this,tt);if(this.options=U(this,wn).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ot(this.options.enabled,U(this,tt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");et(this,dt,jm).call(this),U(this,tt).setOptions(this.options),a._defaulted&&!Bh(this.options,a)&&U(this,wn).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,tt),observer:this});const o=this.hasListeners();o&&zv(U(this,tt),l,this.options,a)&&et(this,dt,po).call(this),this.updateResult(),o&&(U(this,tt)!==l||Ot(this.options.enabled,U(this,tt))!==Ot(a.enabled,U(this,tt))||Ot(this.options.staleTime,U(this,tt))!==Ot(a.staleTime,U(this,tt)))&&et(this,dt,bm).call(this);const u=et(this,dt,vm).call(this);o&&(U(this,tt)!==l||Ot(this.options.enabled,U(this,tt))!==Ot(a.enabled,U(this,tt))||u!==U(this,Ga))&&et(this,dt,wm).call(this,u)}getOptimisticResult(r){const a=U(this,wn).getQueryCache().build(U(this,wn),r),l=this.createResult(a,r);return Bh(this.getCurrentResult(),l)||(Se(this,Sn,l),Se(this,Pl,this.options),Se(this,Mi,U(this,tt).state)),l}getCurrentResult(){return U(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){U(this,Vl).add(r)}getCurrentQuery(){return U(this,tt)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){const a=U(this,wn).defaultQueryOptions(r),l=U(this,wn).getQueryCache().build(U(this,wn),a);let o=()=>{},u;const d=new Promise(m=>{u=m,o=U(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,dt,po).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,Sn)))}createResult(r,a){var T;const l=U(this,tt),o=this.options,u=U(this,Sn),d=U(this,Mi),m=U(this,Pl),p=r!==l?r.state:U(this,Ro),{state:y}=r;let x={...y},g=!1,b;if(a._optimisticResults){const H=this.hasListeners(),$=!H&&Mv(r,a),W=H&&zv(r,l,a,o);($||W)&&(x={...x,...O1(y.data,r.options)}),a._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:w,errorUpdatedAt:C,status:k}=x;b=x.data;let E=!1;if(a.placeholderData!==void 0&&b===void 0&&k==="pending"){let H;u!=null&&u.isPlaceholderData&&a.placeholderData===(m==null?void 0:m.placeholderData)?(H=u.data,E=!0):H=typeof a.placeholderData=="function"?a.placeholderData((T=U(this,Yl))==null?void 0:T.state.data,U(this,Yl)):a.placeholderData,H!==void 0&&(k="success",b=gm(u==null?void 0:u.data,H,a),g=!0)}if(a.select&&b!==void 0&&!E)if(u&&b===(d==null?void 0:d.data)&&a.select===U(this,Mo))b=U(this,Ql);else try{Se(this,Mo,a.select),b=a.select(b),b=gm(u==null?void 0:u.data,b,a),Se(this,Ql,b),Se(this,sa,null)}catch(H){Se(this,sa,H)}else b===void 0&&Se(this,sa,null);U(this,sa)&&(w=U(this,sa),b=U(this,Ql),C=Date.now(),k="error",g=!1);const j=x.fetchStatus==="fetching",A=k==="pending",z=k==="error",Y=A&&j,q=b!==void 0;return{status:k,fetchStatus:x.fetchStatus,isPending:A,isSuccess:k==="success",isError:z,isInitialLoading:Y,isLoading:Y,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:j,isRefetching:j&&!A,isLoadingError:z&&!q,isPaused:x.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:z&&q,isStale:up(r,a),refetch:this.refetch,isEnabled:Ot(a.enabled,r)!==!1}}updateResult(){const r=U(this,Sn),a=this.createResult(U(this,tt),this.options);if(Se(this,Mi,U(this,tt).state),Se(this,Pl,this.options),U(this,Mi).data!==void 0&&Se(this,Yl,U(this,tt)),Bh(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&&!U(this,Vl).size)return!0;const m=new Set(d??U(this,Vl));return this.options.throwOnError&&m.add("error"),Object.keys(U(this,Sn)).some(p=>{const y=p;return U(this,Sn)[y]!==r[y]&&m.has(y)})})();fn.batch(()=>{o&&this.listeners.forEach(u=>{u(U(this,Sn))}),U(this,wn).getQueryCache().notify({query:U(this,tt),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&et(this,dt,Sm).call(this)}},wn=new WeakMap,tt=new WeakMap,Ro=new WeakMap,Sn=new WeakMap,Mi=new WeakMap,Pl=new WeakMap,sa=new WeakMap,Mo=new WeakMap,Ql=new WeakMap,Yl=new WeakMap,zi=new WeakMap,Di=new WeakMap,Ga=new WeakMap,Vl=new WeakMap,dt=new WeakSet,po=function(r){et(this,dt,jm).call(this);let a=U(this,tt).fetch(this.options,r);return r!=null&&r.throwOnError||(a=a.catch(Dn)),a},xm=function(r){return!sp()&&Ot(this.options.enabled,U(this,tt))!==!1&&S1(r)},bm=function(){et(this,dt,Nm).call(this);const r=Ot(this.options.staleTime,U(this,tt));if(U(this,Sn).isStale||!et(this,dt,xm).call(this,r))return;const a=N1(U(this,Sn).dataUpdatedAt,r)+1;Se(this,zi,Ei.setTimeout(()=>{U(this,Sn).isStale||this.updateResult()},a))},vm=function(){return Ot(this.options.refetchInterval,U(this,tt))??!1},wm=function(r){et(this,dt,Cm).call(this),Se(this,Ga,r),!(U(this,Ga)===0||!et(this,dt,xm).call(this,U(this,Ga)))&&Se(this,Di,Ei.setInterval(()=>{(this.options.refetchIntervalInBackground||op.isFocused())&&et(this,dt,po).call(this)},U(this,Ga)))},Sm=function(){et(this,dt,bm).call(this),et(this,dt,wm).call(this,et(this,dt,vm).call(this))},Nm=function(){U(this,zi)!==void 0&&(Ei.clearTimeout(U(this,zi)),Se(this,zi,void 0))},Cm=function(){U(this,Di)!==void 0&&(Ei.clearInterval(U(this,Di)),Se(this,Di,void 0))},jm=function(){const r=U(this,wn).getQueryCache().build(U(this,wn),this.options);if(r===U(this,tt))return;const a=U(this,tt);Se(this,tt,r),Se(this,Ro,r.state),this.hasListeners()&&(a==null||a.removeObserver(this),r.addObserver(this))},X0);function zE(t,r){return Ot(r.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Ot(r.retryOnMount,t)===!1)}function Mv(t,r){return zE(t,r)||t.state.data!==void 0&&Em(t,r,r.refetchOnMount)}function Em(t,r,a){if(Ot(r.enabled,t)!==!1&&Ot(r.staleTime,t)!=="static"){const l=Ot(a,t);return l==="always"||l!==!1&&up(t,r)}return!1}function zv(t,r,a,l){return(t!==r||Ot(l.enabled,t)===!1)&&(!a.suspense||t.state.status!=="error")&&up(t,a)}function up(t,r){return Ot(r.enabled,t)!==!1&&t.isStaleByTime(Ot(r.staleTime,t))}var zo,Hr,mn,_i,Br,Pa,$0,DE=($0=class extends A1{constructor(r){super();De(this,Br);De(this,zo);De(this,Hr);De(this,mn);De(this,_i);Se(this,zo,r.client),this.mutationId=r.mutationId,Se(this,mn,r.mutationCache),Se(this,Hr,[]),this.state=r.state||_E(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){U(this,Hr).includes(r)||(U(this,Hr).push(r),this.clearGcTimeout(),U(this,mn).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){Se(this,Hr,U(this,Hr).filter(a=>a!==r)),this.scheduleGc(),U(this,mn).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){U(this,Hr).length||(this.state.status==="pending"?this.scheduleGc():U(this,mn).remove(this))}continue(){var r;return((r=U(this,_i))==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,k,E,j,A,z,Y,q,T,H,$;const a=()=>{et(this,Br,Pa).call(this,{type:"continue"})},l={client:U(this,zo),meta:this.options.meta,mutationKey:this.options.mutationKey},o=Se(this,_i,T1({fn:()=>this.options.mutationFn?this.options.mutationFn(r,l):Promise.reject(new Error("No mutationFn found")),onFail:(W,M)=>{et(this,Br,Pa).call(this,{type:"failed",failureCount:W,error:M})},onPause:()=>{et(this,Br,Pa).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>U(this,mn).canRun(this)})),u=this.state.status==="pending",d=!o.canStart();try{if(u)a();else{et(this,Br,Pa).call(this,{type:"pending",variables:r,isPaused:d}),U(this,mn).config.onMutate&&await U(this,mn).config.onMutate(r,this,l);const M=await((p=(m=this.options).onMutate)==null?void 0:p.call(m,r,l));M!==this.state.context&&et(this,Br,Pa).call(this,{type:"pending",context:M,variables:r,isPaused:d})}const W=await o.start();return await((x=(y=U(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=U(this,mn).config).onSettled)==null?void 0:C.call(w,W,null,this.state.variables,this.state.context,this,l)),await((E=(k=this.options).onSettled)==null?void 0:E.call(k,W,null,r,this.state.context,l)),et(this,Br,Pa).call(this,{type:"success",data:W}),W}catch(W){try{await((A=(j=U(this,mn).config).onError)==null?void 0:A.call(j,W,r,this.state.context,this,l))}catch(M){Promise.reject(M)}try{await((Y=(z=this.options).onError)==null?void 0:Y.call(z,W,r,this.state.context,l))}catch(M){Promise.reject(M)}try{await((T=(q=U(this,mn).config).onSettled)==null?void 0:T.call(q,void 0,W,this.state.variables,this.state.context,this,l))}catch(M){Promise.reject(M)}try{await(($=(H=this.options).onSettled)==null?void 0:$.call(H,void 0,W,r,this.state.context,l))}catch(M){Promise.reject(M)}throw et(this,Br,Pa).call(this,{type:"error",error:W}),W}finally{U(this,_i)===o&&Se(this,_i,void 0),U(this,mn).runNext(this)}}},zo=new WeakMap,Hr=new WeakMap,mn=new WeakMap,_i=new WeakMap,Br=new WeakSet,Pa=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(()=>{U(this,Hr).forEach(l=>{l.onMutationUpdate(r)}),U(this,mn).notify({mutation:this,type:"updated",action:r})})},$0);function _E(){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,Do,Z0,LE=(Z0=class extends Uo{constructor(r={}){super();De(this,oa);De(this,Sr);De(this,Do);this.config=r,Se(this,oa,new Set),Se(this,Sr,new Map),Se(this,Do,0)}build(r,a,l){const o=new DE({client:r,mutationCache:this,mutationId:++bc(this,Do)._,options:r.defaultMutationOptions(a),state:l});return this.add(o),o}add(r){U(this,oa).add(r);const a=wc(r);if(typeof a=="string"){const l=U(this,Sr).get(a);l?l.push(r):U(this,Sr).set(a,[r])}this.notify({type:"added",mutation:r})}remove(r){if(U(this,oa).delete(r)){const a=wc(r);if(typeof a=="string"){const l=U(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&&U(this,Sr).delete(a)}}this.notify({type:"removed",mutation:r})}canRun(r){var l;const a=wc(r);if(typeof a=="string"){const o=(l=U(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=wc(r);return typeof a=="string"?((o=(l=U(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(()=>{U(this,oa).forEach(r=>{this.notify({type:"removed",mutation:r})}),U(this,oa).clear(),U(this,Sr).clear()})}getAll(){return Array.from(U(this,oa))}find(r){const a={exact:!0,...r};return this.getAll().find(l=>Ev(a,l))}findAll(r={}){return this.getAll().filter(a=>Ev(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,Do=new WeakMap,Z0);function wc(t){var r;return(r=t.options.scope)==null?void 0:r.id}var Fr,J0,UE=(J0=class extends Uo{constructor(r={}){super();De(this,Fr);this.config=r,Se(this,Fr,new Map)}build(r,a,l){const o=a.queryKey,u=a.queryHash??ip(o,a);let d=this.get(u);return d||(d=new RE({client:r,queryKey:o,queryHash:u,options:r.defaultQueryOptions(a),state:l,defaultOptions:r.getQueryDefaults(o)}),this.add(d)),d}add(r){U(this,Fr).has(r.queryHash)||(U(this,Fr).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){const a=U(this,Fr).get(r.queryHash);a&&(r.destroy(),a===r&&U(this,Fr).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){fn.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return U(this,Fr).get(r)}getAll(){return[...U(this,Fr).values()]}find(r){const a={exact:!0,...r};return this.getAll().find(l=>jv(a,l))}findAll(r={}){const a=this.getAll();return Object.keys(r).length>0?a.filter(l=>jv(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()})})}},Fr=new WeakMap,J0),Dt,Ka,Xa,Gl,Kl,$a,Xl,$l,W0,qE=(W0=class{constructor(t={}){De(this,Dt);De(this,Ka);De(this,Xa);De(this,Gl);De(this,Kl);De(this,$a);De(this,Xl);De(this,$l);Se(this,Dt,t.queryCache||new UE),Se(this,Ka,t.mutationCache||new LE),Se(this,Xa,t.defaultOptions||{}),Se(this,Gl,new Map),Se(this,Kl,new Map),Se(this,$a,0)}mount(){bc(this,$a)._++,U(this,$a)===1&&(Se(this,Xl,op.subscribe(async t=>{t&&(await this.resumePausedMutations(),U(this,Dt).onFocus())})),Se(this,$l,Rc.subscribe(async t=>{t&&(await this.resumePausedMutations(),U(this,Dt).onOnline())})))}unmount(){var t,r;bc(this,$a)._--,U(this,$a)===0&&((t=U(this,Xl))==null||t.call(this),Se(this,Xl,void 0),(r=U(this,$l))==null||r.call(this),Se(this,$l,void 0))}isFetching(t){return U(this,Dt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return U(this,Ka).findAll({...t,status:"pending"}).length}getQueryData(t){var a;const r=this.defaultQueryOptions({queryKey:t});return(a=U(this,Dt).get(r.queryHash))==null?void 0:a.state.data}ensureQueryData(t){const r=this.defaultQueryOptions(t),a=U(this,Dt).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 U(this,Dt).findAll(t).map(({queryKey:r,state:a})=>[r,a.data])}setQueryData(t,r,a){var d;const l=this.defaultQueryOptions({queryKey:t}),o=(d=U(this,Dt).get(l.queryHash))==null?void 0:d.state.data,u=yE(r,o);if(u!==void 0)return U(this,Dt).build(this,l).setData(u,{...a,manual:!0})}setQueriesData(t,r,a){return fn.batch(()=>U(this,Dt).findAll(t).map(({queryKey:l})=>[l,this.setQueryData(l,r,a)]))}getQueryState(t){var a;const r=this.defaultQueryOptions({queryKey:t});return(a=U(this,Dt).get(r.queryHash))==null?void 0:a.state}removeQueries(t){const r=U(this,Dt);fn.batch(()=>{r.findAll(t).forEach(a=>{r.remove(a)})})}resetQueries(t,r){const a=U(this,Dt);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(()=>U(this,Dt).findAll(t).map(o=>o.cancel(a)));return Promise.all(l).then(Dn).catch(Dn)}invalidateQueries(t,r={}){return fn.batch(()=>(U(this,Dt).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(()=>U(this,Dt).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=U(this,Dt).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=U(this,Dt).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 Rc.isOnline()?U(this,Ka).resumePausedMutations():Promise.resolve()}getQueryCache(){return U(this,Dt)}getMutationCache(){return U(this,Ka)}getDefaultOptions(){return U(this,Xa)}setDefaultOptions(t){Se(this,Xa,t)}setQueryDefaults(t,r){U(this,Gl).set(wo(t),{queryKey:t,defaultOptions:r})}getQueryDefaults(t){const r=[...U(this,Gl).values()],a={};return r.forEach(l=>{Jl(t,l.queryKey)&&Object.assign(a,l.defaultOptions)}),a}setMutationDefaults(t,r){U(this,Kl).set(wo(t),{mutationKey:t,defaultOptions:r})}getMutationDefaults(t){const r=[...U(this,Kl).values()],a={};return r.forEach(l=>{Jl(t,l.mutationKey)&&Object.assign(a,l.defaultOptions)}),a}defaultQueryOptions(t){if(t._defaulted)return t;const r={...U(this,Xa).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return r.queryHash||(r.queryHash=ip(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===lp&&(r.enabled=!1),r}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...U(this,Xa).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){U(this,Dt).clear(),U(this,Ka).clear()}},Dt=new WeakMap,Ka=new WeakMap,Xa=new WeakMap,Gl=new WeakMap,Kl=new WeakMap,$a=new WeakMap,Xl=new WeakMap,$l=new WeakMap,W0);const R1=S.createContext(!1),HE=()=>S.useContext(R1);R1.Provider;function BE(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const FE=S.createContext(BE()),IE=()=>S.useContext(FE),PE=(t,r,a)=>{const l=a!=null&&a.state.error&&typeof t.throwOnError=="function"?E1(t.throwOnError,[a.state.error,a]):t.throwOnError;(t.suspense||l)&&(r.isReset()||(t.retryOnMount=!1))},QE=t=>{S.useEffect(()=>{t.clearReset()},[t])},YE=({result:t,errorResetBoundary:r,throwOnError:a,query:l,suspense:o})=>t.isError&&!r.isReset()&&!t.isFetching&&l&&(o&&t.data===void 0||E1(a,[t.error,l])),VE=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))}},GE=(t,r)=>(t==null?void 0:t.suspense)&&r.isPending,KE=(t,r,a)=>r.fetchOptimistic(t).catch(()=>{a.clearReset()});function XE(t,r,a){const l=HE(),o=IE(),u=Lt(),d=u.defaultQueryOptions(t),m=u.getQueryCache().get(d.queryHash),p=t.subscribed!==!1;d._optimisticResults=l?"isRestoring":p?"optimistic":void 0,VE(d),PE(d,o,m),QE(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]),GE(d,x))throw KE(d,y,o);if(YE({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 XE(t,ME)}const Dv=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},$E=(t=>t?Dv(t):Dv),ZE=t=>t;function JE(t,r=ZE){const a=mo.useSyncExternalStore(t.subscribe,mo.useCallback(()=>r(t.getState()),[t,r]),mo.useCallback(()=>r(t.getInitialState()),[t,r]));return mo.useDebugValue(a),a}const _v=t=>{const r=$E(t),a=l=>JE(r,l);return Object.assign(a,r),a},Ii=(t=>t?_v(t):_v),go={theme:"light",highContrast:!1,fontSize:"normal"},M1=["light","dark"],z1=["small","normal","big"],cp="kai_appearance";function WE(){try{const t=JSON.parse(localStorage.getItem(cp)??"null");return!t||typeof t!="object"?go:{theme:M1.includes(t.theme)?t.theme:go.theme,highContrast:t.highContrast===!0,fontSize:z1.includes(t.fontSize)?t.fontSize:go.fontSize}}catch{return go}}function ek(t){try{localStorage.setItem(cp,JSON.stringify(t))}catch{}}function Lv(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(cp)}`;const km=Ii((t,r)=>({appearance:go,hydrate:()=>{const a=WE();Lv(a),t({appearance:a})},update:a=>{const l={...r().appearance,...a};Lv(l),ek(l),t({appearance:l})}})),tk=new qE({defaultOptions:{queries:{staleTime:3e4,retry:1}}});function nk({children:t}){return S.useEffect(()=>{km.getState().hydrate()},[]),c.jsx(fE,{client:tk,children:t})}function Zn(){const t=Wm(),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 qo(){return jr().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 rk=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),D1=(...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 ak={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 ik=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,...ak,width:r,height:r,stroke:t,strokeWidth:l?Number(a)*24/Number(r):a,className:D1("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 xt=(t,r)=>{const a=S.forwardRef(({className:l,...o},u)=>S.createElement(ik,{ref:u,iconNode:r,className:D1(`lucide-${rk(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 lk=xt("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 _1=xt("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 sk=xt("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"}]]);/**
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 ok=xt("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"}]]);/**
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 uk=xt("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/**
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 L1=xt("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/**
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 ck=xt("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"}]]);/**
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 dk=xt("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"}]]);/**
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 fk=xt("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"}]]);/**
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 hk=xt("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"}]]);/**
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 mk=xt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 pk=xt("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"}]]);/**
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 gk=xt("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"}]]);/**
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 yk=xt("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"}]]);/**
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 xk=xt("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"}]]);/**
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 bk=xt("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"}]]);/**
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 vk=xt("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"}]]);/**
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 U1=xt("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"}]]);/**
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 wk=xt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Sk=xt("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"}]]);/**
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 Nk=xt("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"}]]);/**
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 Ck=xt("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"}]]);/**
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 jk=xt("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"}]]);/**
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 q1=xt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 dp=xt("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"}]]);/**
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 Ek=xt("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"}]]);/**
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 kk=xt("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"}]]);/**
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 Tk=xt("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"}]]);/**
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 H1=xt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),B1="kai_server_url",Tm="http://localhost:3001";function Wl(){try{return localStorage.getItem(B1)||Tm}catch{return Tm}}function Ak(t){let r=t.trim().replace(/\/+$/,"");r&&!/^https?:\/\//i.test(r)&&(r=`http://${r}`),localStorage.setItem(B1,r||Tm)}const Ok=Wl;function Rk(){return Wl().replace(/^http/,"ws")}const Qc="kai_access_token",fp="kai_refresh_token";function So(){return typeof window>"u"?null:localStorage.getItem(Qc)}function Mk(){return typeof window>"u"?null:localStorage.getItem(fp)}function Yc(t,r){typeof window>"u"||(localStorage.setItem(Qc,t),localStorage.setItem(fp,r))}function zk(t){typeof window>"u"||localStorage.setItem(Qc,t)}function Dk(){typeof window>"u"||(localStorage.removeItem(Qc),localStorage.removeItem(fp))}function Ho(t){return{id:t.id,email:t.email,displayName:t.displayName,avatarUrl:t.avatarUrl,orgId:t.orgId,orgName:t.orgName,orgRole:t.orgRole,isPlatformAdmin:t.isPlatformAdmin,mustChangePassword:t.mustChangePassword,...t.mfaPending?{mfaPending:t.mfaPending}:{}}}function F1(t){return!!t&&(t.isPlatformAdmin||t.orgRole==="owner"||t.orgRole==="admin")}function hp(t){return!!t&&t.orgRole!=="chatter"}const Nt=Ii(t=>({user:null,setUser:r=>t({user:r}),logout:()=>{Dk(),t({user:null})}}));class I1 extends Error{constructor(r,a){super(`API Error ${r}: ${a}`),this.status=r,this.name="ApiError"}}class Am extends Error{constructor(){super("Your session has expired. Please sign in again."),this.name="SessionExpiredError"}}let Fh=null;const _k=new Set(["/api/auth/login","/api/auth/refresh","/api/auth/set-password"]);function P1(){return Fh??(Fh=(async()=>{const t=Mk();if(!t)throw Nt.getState().logout(),new Am;let r;try{r=await ue.auth.refresh({refreshToken:t})}catch(a){throw a instanceof I1&&(a.status===400||a.status===401)?(Nt.getState().logout(),new Am):a}return zk(r.accessToken),r.accessToken})().finally(()=>{Fh=null})),Fh}class Lk{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"})},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=So(),d={...a.body!=null&&!(a.body instanceof FormData)?{"Content-Type":"application/json"}:{},...a.headers};u&&(d.Authorization=`Bearer ${u}`);const m=await fetch(`${Ok()}${r}`,{...a,headers:d});if(m.status===401&&u&&!o&&!_k.has(r)){let p=null;try{p=await P1()}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 I1(m.status,p)}if(m.status!==204)return l==="blob"?m.blob():m.json()}}const ue=new Lk,Ih=1e3,Uk=3e4,qk=1008;class Hk{constructor(){$t(this,"ws",null);$t(this,"handlers",new Map);$t(this,"reconnectTimer",null);$t(this,"reconnectDelay",Ih);$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=Ih,this.openConnection()}openConnection(){this.ws&&(this.ws.onclose=null,this.ws.close());const r=`${Rk()}/ws?token=${encodeURIComponent(this.token)}`;this.ws=new WebSocket(r),this.ws.onopen=()=>{this.reconnectDelay=Ih,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)===qk?this.renewToken():this.scheduleReconnect()},this.ws.onerror=()=>{}}async renewToken(){try{this.token=await P1()}catch(r){if(r instanceof Am){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,Uk))},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 Hk,Bo=Ii(t=>({status:"disconnected",setStatus:r=>t({status:r})})),No=Ii(t=>({isSidebarOpen:!1,openSidebar:()=>t({isSidebarOpen:!0}),closeSidebar:()=>t({isSidebarOpen:!1}),toggleSidebar:()=>t(r=>({isSidebarOpen:!r.isSidebarOpen}))}));function Bk(){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 Q1(){return typeof window<"u"&&"Notification"in window}function Fk(){!Q1()||Notification.permission!=="default"||Notification.requestPermission()}function Ik(t,r){if(!(!Q1()||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 Pk(t){var m;const r=Nt(p=>{var y;return(y=p.user)==null?void 0:y.id}),a=S.useRef(r);a.current=r;const l=Zn(),o=qo(),u=(m=o==null?void 0:o.match(/^\/conversations\/([^/]+)/))==null?void 0:m[1],d=S.useRef(u);d.current=u,S.useEffect(()=>{t&&Fk()},[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&&Bk(),document.hasFocus()||Ik(y.senderName,()=>l.push(`/conversations/${y.conversationId}`)))})},[t,l])}function Kn({href:t,prefetch:r,scroll:a,...l}){return c.jsx(Pc,{to:t,...l})}function Y1(){return Cn({queryKey:["conversations"],queryFn:()=>ue.conversations.list()})}function Qk(t){return Cn({queryKey:["conversations",t],queryFn:()=>ue.conversations.get(t),enabled:!!t})}function V1(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 yo(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 Yk(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 G1(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=G1(t[r]))&&(l&&(l+=" "),l+=a)}else for(a in t)t[a]&&(l&&(l+=" "),l+=a);return l}function Fo(){for(var t,r,a=0,l="",o=arguments.length;a<o;a++)(t=arguments[a])&&(r=G1(t))&&(l&&(l+=" "),l+=r);return l}const mp="-",Vk=t=>{const r=Kk(t),{conflictingClassGroups:a,conflictingClassGroupModifiers:l}=t;return{getClassGroupId:d=>{const m=d.split(mp);return m[0]===""&&m.length!==1&&m.shift(),K1(m,r)||Gk(d)},getConflictingClassGroupIds:(d,m)=>{const p=a[d]||[];return m&&l[d]?[...p,...l[d]]:p}}},K1=(t,r)=>{var d;if(t.length===0)return r.classGroupId;const a=t[0],l=r.nextPart.get(a),o=l?K1(t.slice(1),l):void 0;if(o)return o;if(r.validators.length===0)return;const u=t.join(mp);return(d=r.validators.find(({validator:m})=>m(u)))==null?void 0:d.classGroupId},Uv=/^\[(.+)\]$/,Gk=t=>{if(Uv.test(t)){const r=Uv.exec(t)[1],a=r==null?void 0:r.substring(0,r.indexOf(":"));if(a)return"arbitrary.."+a}},Kk=t=>{const{theme:r,prefix:a}=t,l={nextPart:new Map,validators:[]};return $k(Object.entries(t.classGroups),a).forEach(([u,d])=>{Om(d,l,u,r)}),l},Om=(t,r,a,l)=>{t.forEach(o=>{if(typeof o=="string"){const u=o===""?r:qv(r,o);u.classGroupId=a;return}if(typeof o=="function"){if(Xk(o)){Om(o(l),r,a,l);return}r.validators.push({validator:o,classGroupId:a});return}Object.entries(o).forEach(([u,d])=>{Om(d,qv(r,u),a,l)})})},qv=(t,r)=>{let a=t;return r.split(mp).forEach(l=>{a.nextPart.has(l)||a.nextPart.set(l,{nextPart:new Map,validators:[]}),a=a.nextPart.get(l)}),a},Xk=t=>t.isThemeGetter,$k=(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,Zk=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)}}},X1="!",Jk=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 j=m[E];if(y===0){if(j===o&&(l||m.slice(E,E+u)===r)){p.push(m.slice(x,E)),x=E+u;continue}if(j==="/"){g=E;continue}}j==="["?y++:j==="]"&&y--}const b=p.length===0?m:m.substring(x),w=b.startsWith(X1),C=w?b.substring(1):b,k=g&&g>x?g-x:void 0;return{modifiers:p,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:k}};return a?m=>a({className:m,parseClassName:d}):d},Wk=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},eT=t=>({cache:Zk(t.cacheSize),parseClassName:Jk(t),...Vk(t)}),tT=/\s+/,nT=(t,r)=>{const{parseClassName:a,getClassGroupId:l,getConflictingClassGroupIds:o}=r,u=[],d=t.trim().split(tT);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,k=l(C?b.substring(0,w):b);if(!k){if(!C){m=y+(m.length>0?" "+m:m);continue}if(k=l(b),!k){m=y+(m.length>0?" "+m:m);continue}C=!1}const E=Wk(x).join(":"),j=g?E+X1:E,A=j+k;if(u.includes(A))continue;u.push(A);const z=o(k,C);for(let Y=0;Y<z.length;++Y){const q=z[Y];u.push(j+q)}m=y+(m.length>0?" "+m:m)}return m};function rT(){let t=0,r,a,l="";for(;t<arguments.length;)(r=arguments[t++])&&(a=$1(r))&&(l&&(l+=" "),l+=a);return l}const $1=t=>{if(typeof t=="string")return t;let r,a="";for(let l=0;l<t.length;l++)t[l]&&(r=$1(t[l]))&&(a&&(a+=" "),a+=r);return a};function aT(t,...r){let a,l,o,u=d;function d(p){const y=r.reduce((x,g)=>g(x),t());return a=eT(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=nT(p,a);return o(p,x),x}return function(){return u(rT.apply(null,arguments))}}const kt=t=>{const r=a=>a[t]||[];return r.isThemeGetter=!0,r},Z1=/^\[(?:([a-z-]+):)?(.+)\]$/i,iT=/^\d+\/\d+$/,lT=new Set(["px","full","screen"]),sT=/^(\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$/,uT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ia=t=>Ul(t)||lT.has(t)||iT.test(t),Ha=t=>rs(t,"length",bT),Ul=t=>!!t&&!Number.isNaN(Number(t)),Ph=t=>rs(t,"number",Ul),ro=t=>!!t&&Number.isInteger(Number(t)),fT=t=>t.endsWith("%")&&Ul(t.slice(0,-1)),Pe=t=>Z1.test(t),Ba=t=>sT.test(t),hT=new Set(["length","size","percentage"]),mT=t=>rs(t,hT,J1),pT=t=>rs(t,"position",J1),gT=new Set(["image","url"]),yT=t=>rs(t,gT,wT),xT=t=>rs(t,"",vT),ao=()=>!0,rs=(t,r,a)=>{const l=Z1.exec(t);return l?l[1]?typeof r=="string"?l[1]===r:r.has(l[1]):a(l[2]):!1},bT=t=>oT.test(t)&&!uT.test(t),J1=()=>!1,vT=t=>cT.test(t),wT=t=>dT.test(t),ST=()=>{const t=kt("colors"),r=kt("spacing"),a=kt("blur"),l=kt("brightness"),o=kt("borderColor"),u=kt("borderRadius"),d=kt("borderSpacing"),m=kt("borderWidth"),p=kt("contrast"),y=kt("grayscale"),x=kt("hueRotate"),g=kt("invert"),b=kt("gap"),w=kt("gradientColorStops"),C=kt("gradientColorStopPositions"),k=kt("inset"),E=kt("margin"),j=kt("opacity"),A=kt("padding"),z=kt("saturate"),Y=kt("scale"),q=kt("sepia"),T=kt("skew"),H=kt("space"),$=kt("translate"),W=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",Pe,r],Q=()=>[Pe,r],ae=()=>["",ia,Ha],le=()=>["auto",Ul,Pe],ne=()=>["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=()=>[Ul,Pe];return{cacheSize:500,separator:":",theme:{colors:[ao],spacing:[ia,Ha],blur:["none","",Ba,Pe],brightness:Be(),borderColor:[t],borderRadius:["none","","full",Ba,Pe],borderSpacing:Q(),borderWidth:ae(),contrast:Be(),grayscale:Re(),hueRotate:Be(),invert:Re(),gap:Q(),gradientColorStops:[t],gradientColorStopPositions:[fT,Ha],inset:ie(),margin:ie(),opacity:Be(),padding:Q(),saturate:Be(),scale:Be(),sepia:Re(),skew:Be(),space:Q(),translate:Q()},classGroups:{aspect:[{aspect:["auto","square","video",Pe]}],container:["container"],columns:[{columns:[Ba]}],"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:[...ne(),Pe]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ro,Pe]}],basis:[{basis:ie()}],"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",ro,Pe]}],"grid-cols":[{"grid-cols":[ao]}],"col-start-end":[{col:["auto",{span:["full",ro,Pe]},Pe]}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":[ao]}],"row-start-end":[{row:["auto",{span:[ro,Pe]},Pe]}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"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":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"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:[Ba]},Ba]}],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",Ba,Ha]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ph]}],"font-family":[{font:[ao]}],"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",Ul,Ph]}],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":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ia,Ha]}],"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:Q()}],"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":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ne(),pT]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",mT]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},yT]}],"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":[j]}],"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":[j]}],"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,Ha]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[ia,Ha]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ba,xT]}],"shadow-color":[{shadow:[ao]}],opacity:[{opacity:[j]}],"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",Ba,Pe]}],grayscale:[{grayscale:[y]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[g]}],saturate:[{saturate:[z]}],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":[j]}],"backdrop-saturate":[{"backdrop-saturate":[z]}],"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:[Y]}],"scale-x":[{"scale-x":[Y]}],"scale-y":[{"scale-y":[Y]}],rotate:[{rotate:[ro,Pe]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"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":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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,Ha,Ph]}],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"]}}},Io=aT(ST);function Hv(...t){return Io(Fo(t))}function Vc({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:Hv("rounded-full object-cover shrink-0",a)}):c.jsx("div",{className:Hv("rounded-full bg-muted flex items-center justify-center font-semibold shrink-0",a),"aria-hidden":"true",children:(t??"K").charAt(0).toUpperCase()})}function qi(t,r){const a=t.trim().toLowerCase();return a===""?!0:r.some(l=>(l??"").toLowerCase().includes(a))}function W1({conversation:t,onClose:r}){const a=Zn(),l=qo(),o=Lt(),[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),V1(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 pp=Ii((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 ew({conversation:t,onClose:r}){const a=Lt(),l=pp(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 Hi({value:t,onChange:r,placeholder:a="Search…",className:l,...o}){return c.jsxs("div",{className:"relative",children:[c.jsx(wk,{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 Qh(...t){return Io(Fo(t))}const Bv={human:"Human",llm:"AI",agent:"Agent"},NT={human:kk,llm:jk,agent:_1},CT={human:"bg-blue-100 text-blue-700",llm:"bg-purple-100 text-purple-700",agent:"bg-green-100 text-green-700"};function jT(){const{data:t,isLoading:r,isError:a}=Y1(),l=qo(),o=Zn(),u=Lt(),d=Nt(E=>{var j;return(j=E.user)==null?void 0:j.id}),m=No(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:j}=E;V1(u,j),y(A=>(A==null?void 0:A.id)===j?null:A),l===`/conversations/${j}`&&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 k=C.filter(E=>qi(b,[yo(E,d)]));return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-2 pb-2",children:c.jsx(Hi,{value:b,onChange:w,placeholder:"Search chats…","aria-label":"Search chats"})}),k.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:k.map(E=>{const j=l===`/conversations/${E.id}`,A=yo(E,d),z=Yk(E,d),Y=NT[E.type];return c.jsxs("div",{className:"group relative",children:[c.jsxs(Kn,{href:`/conversations/${E.id}`,onClick:m,className:Qh("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",j&&"bg-accent font-medium"),children:[c.jsx(Vc,{name:z.name,avatarUrl:z.avatarUrl,className:"w-6 h-6 text-[11px]"}),c.jsx("span",{className:Qh("shrink-0 text-[10px] font-semibold px-1.5 py-0.5 rounded",CT[E.type]??"bg-muted text-muted-foreground"),children:Y?c.jsx(Y,{size:12,role:"img","aria-label":Bv[E.type]??E.type}):Bv[E.type]??E.type}),c.jsx("span",{className:Qh("truncate",E.unread&&!j&&"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(U1,{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(dp,{size:14})})]})]},E.id)})}),p&&c.jsx(W1,{conversation:p,onClose:()=>y(null)}),x&&c.jsx(ew,{conversation:x,onClose:()=>g(null)})]})}function ET(){return c.jsxs(Pc,{to:"/settings",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(hk,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Device settings"})]})}function as(){return Cn({queryKey:["agents"],queryFn:()=>ue.agents.list()})}function tw(t){return Cn({queryKey:["agents",t],queryFn:()=>ue.agents.get(t),enabled:!!t})}function gp(t={}){return Cn({queryKey:["mcp-servers",t.accessibleOnly??!1],queryFn:()=>ue.mcp.list(t)})}function nw(){const{data:t}=gp({accessibleOnly:!0});return((t==null?void 0:t.servers)??[]).filter(r=>r.authType==="oauth"&&!r.connected).length}function yp({label:t,size:r=14}){return c.jsx(ok,{role:"img","aria-label":t,size:r,className:"shrink-0 text-destructive"})}function kT(){const t=Nt(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 xp({exclude:t,selected:r,onChange:a}){const{data:l,isLoading:o,isError:u}=kT(),[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 TT({onClose:t}){const r=Zn(),a=Lt(),[l,o]=S.useState("llm"),[u,d]=S.useState(""),[m,p]=S.useState([]),y=Nt(q=>q.user),[x,g]=S.useState(!1),[b,w]=S.useState(""),{data:C,isLoading:k}=as(),E=(C==null?void 0:C.agents)??[],j=l==="agent",A=l==="human",z=!x&&(!j||u!=="")&&(!A||m.length>0);async function Y(){if(z){g(!0),w("");try{const q=await ue.conversations.create({type:l,...j?{agentId:u}:{},...A?{participantUserIds:m}:{}});await a.invalidateQueries({queryKey:["conversations"]}),t(),r.push(`/conversations/${q.id}`)}catch(q){w(q instanceof Error?q.message:"Failed to create conversation"),g(!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(q=>c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("input",{type:"radio",name:"type",value:q,checked:l===q,onChange:()=>o(q),className:"accent-primary"}),c.jsx("span",{className:"text-sm capitalize",children:q==="llm"?"AI Chat":q==="human"?"Human Chat":"Agent Chat"})]},q))}),A&&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(xp,{exclude:y?[y.id]:[],selected:m,onChange:p})]}),j&&c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"block text-sm font-medium mb-1",htmlFor:"new-chat-agent",children:"Agent"}),k?c.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading agents..."}):E.length===0?c.jsx("p",{className:"text-xs text-muted-foreground",children:y&&hp(y)?c.jsxs(c.Fragment,{children:["You have no agents yet."," ",c.jsx(Kn,{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:u,onChange:q=>d(q.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…"}),E.map(q=>c.jsx("option",{value:q.id,children:q.name},q.id))]})]}),b&&c.jsx("p",{className:"text-xs text-destructive mb-3",children:b}),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:Y,disabled:!z,className:"px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-opacity",children:x?"Creating...":"Create"})]})]})})}function AT(){const t=Nt(y=>y.user),r=nw(),a=Nt(y=>y.logout),l=Zn(),[o,u]=S.useState(!1),d=No(y=>y.isSidebarOpen),m=No(y=>y.closeSidebar);function p(){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.jsx("span",{className:"font-bold text-lg tracking-tight",children:"KAI"}),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,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(H1,{size:18})})]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:c.jsx(jT,{})}),c.jsxs("div",{className:"border-t px-2 py-2 space-y-1",onClick:m,children:[c.jsxs(Kn,{href:"/agents",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:"Agents"})]}),c.jsxs(Kn,{href:"/schedules",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(sk,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Schedules"})]}),c.jsxs(Kn,{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(Sk,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Settings"}),r>0&&c.jsx(yp,{label:"Integrations to connect"})]}),F1(t)&&c.jsxs(Kn,{href:"/admin",className:"flex items-center gap-2 px-2 py-2 rounded-md text-sm hover:bg-accent transition-colors",children:[c.jsx(Nk,{size:16,className:"shrink-0"}),c.jsx("span",{children:"Admin"})]}),c.jsx(ET,{}),t&&c.jsxs("div",{className:"flex items-center gap-2 px-2 py-2",onClick:y=>y.stopPropagation(),children:[c.jsx(Vc,{name:t.displayName,avatarUrl:t.avatarUrl}),c.jsx("span",{className:"text-sm truncate flex-1",children:t.displayName}),c.jsx("button",{onClick:p,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Log out","aria-label":"Log out",children:c.jsx(pk,{size:16})})]})]})]}),o&&c.jsx(TT,{onClose:()=>u(!1)})]})}function OT({children:t}){const r=Zn(),a=Nt(m=>m.setUser),l=Bo(m=>m.setStatus),[o,u]=S.useState(!1);Pk(o),S.useEffect(()=>{let m=null;const p=So();if(!p){r.push("/login");return}return ue.auth.me().then(y=>{if(a(Ho(y)),y.mustChangePassword){r.replace("/change-password");return}if(y.mfaPending){r.replace("/mfa");return}m=Ge.onStatusChange(l),Ge.connect(So()??p),u(!0)}).catch(()=>{r.push("/login")}),()=>{m==null||m()}},[r,a,l]);const d=Nt(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(RT,{}),c.jsx(AT,{}),c.jsx("main",{className:"flex-1 overflow-hidden min-w-0",children:t})]}):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 RT(){const t=No(r=>r.toggleSidebar);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(gk,{size:20})}),c.jsx("span",{className:"font-bold text-base tracking-tight",children:"KAI"})]})}function MT(){const t=Zn(),{data:r,isLoading:a}=Y1();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 zT={private:"Private",org:"Organization",selected:"Selected"},DT={private:"bg-muted text-muted-foreground",org:"bg-blue-100 text-blue-700",selected:"bg-purple-100 text-purple-700"};function _T({agent:t}){const r=Zn(),a=Lt();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 ${DT[t.visibility]??"bg-muted text-muted-foreground"}`,children:zT[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(Kn,{href:`/agents/${t.id}/edit`,className:"px-3 py-1.5 text-xs rounded-md border hover:bg-accent transition-colors",children:"Edit"})]})]})}function LT(){const{data:t,isLoading:r,isError:a}=as(),l=hp(Nt(p=>p.user)),[o,u]=S.useState(""),d=(t==null?void 0:t.agents)??[],m=d.filter(p=>qi(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(Kn,{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(Kn,{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(Hi,{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(_T,{agent:p},p.id))})]})})]})]})}const rw=6048e5,UT=864e5,Fv=Symbol.for("constructDateFrom");function Za(t,r){return typeof t=="function"?t(r):t&&typeof t=="object"&&Fv in t?t[Fv](r):t instanceof Date?new t.constructor(r):new Date(r)}function Er(t,r){return Za(r||t,t)}let qT={};function Gc(){return qT}function Co(t,r){var m,p,y,x;const a=Gc(),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=Er(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 Mc(t,r){return Co(t,{...r,weekStartsOn:1})}function aw(t,r){const a=Er(t,r==null?void 0:r.in),l=a.getFullYear(),o=Za(a,0);o.setFullYear(l+1,0,4),o.setHours(0,0,0,0);const u=Mc(o),d=Za(a,0);d.setFullYear(l,0,4),d.setHours(0,0,0,0);const m=Mc(d);return a.getTime()>=u.getTime()?l+1:a.getTime()>=m.getTime()?l:l-1}function Iv(t){const r=Er(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 HT(t,...r){const a=Za.bind(null,r.find(l=>typeof l=="object"));return r.map(a)}function Pv(t,r){const a=Er(t,r==null?void 0:r.in);return a.setHours(0,0,0,0),a}function BT(t,r,a){const[l,o]=HT(a==null?void 0:a.in,t,r),u=Pv(l),d=Pv(o),m=+u-Iv(u),p=+d-Iv(d);return Math.round((m-p)/UT)}function FT(t,r){const a=aw(t,r),l=Za(t,0);return l.setFullYear(a,0,4),l.setHours(0,0,0,0),Mc(l)}function IT(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function PT(t){return!(!IT(t)&&typeof t!="number"||isNaN(+Er(t)))}function QT(t,r){const a=Er(t,r==null?void 0:r.in);return a.setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a}const YT={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"}},VT=(t,r,a)=>{let l;const o=YT[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 Yh(t){return(r={})=>{const a=r.width?String(r.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const GT={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},KT={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},XT={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$T={date:Yh({formats:GT,defaultWidth:"full"}),time:Yh({formats:KT,defaultWidth:"full"}),dateTime:Yh({formats:XT,defaultWidth:"full"})},ZT={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},JT=(t,r,a,l)=>ZT[t];function io(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 WT={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"]},nA={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"]},rA={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"}},aA={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"}},iA=(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"},lA={ordinalNumber:iA,era:io({values:WT,defaultWidth:"wide"}),quarter:io({values:eA,defaultWidth:"wide",argumentCallback:t=>t-1}),month:io({values:tA,defaultWidth:"wide"}),day:io({values:nA,defaultWidth:"wide"}),dayPeriod:io({values:rA,defaultWidth:"wide",formattingValues:aA,defaultFormattingWidth:"wide"})};function lo(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)?oA(m,g=>g.test(d)):sA(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 sA(t,r){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r(t[a]))return a}function oA(t,r){for(let a=0;a<t.length;a++)if(r(t[a]))return a}function uA(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 cA=/^(\d+)(th|st|nd|rd)?/i,dA=/\d+/i,fA={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},hA={any:[/^b/i,/^(a|c)/i]},mA={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pA={any:[/1/i,/2/i,/3/i,/4/i]},gA={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},yA={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]},xA={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},bA={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]},vA={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},wA={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}},SA={ordinalNumber:uA({matchPattern:cA,parsePattern:dA,valueCallback:t=>parseInt(t,10)}),era:lo({matchPatterns:fA,defaultMatchWidth:"wide",parsePatterns:hA,defaultParseWidth:"any"}),quarter:lo({matchPatterns:mA,defaultMatchWidth:"wide",parsePatterns:pA,defaultParseWidth:"any",valueCallback:t=>t+1}),month:lo({matchPatterns:gA,defaultMatchWidth:"wide",parsePatterns:yA,defaultParseWidth:"any"}),day:lo({matchPatterns:xA,defaultMatchWidth:"wide",parsePatterns:bA,defaultParseWidth:"any"}),dayPeriod:lo({matchPatterns:vA,defaultMatchWidth:"any",parsePatterns:wA,defaultParseWidth:"any"})},NA={code:"en-US",formatDistance:VT,formatLong:$T,formatRelative:JT,localize:lA,match:SA,options:{weekStartsOn:0,firstWeekContainsDate:1}};function CA(t,r){const a=Er(t,r==null?void 0:r.in);return BT(a,QT(a))+1}function jA(t,r){const a=Er(t,r==null?void 0:r.in),l=+Mc(a)-+FT(a);return Math.round(l/rw)+1}function iw(t,r){var x,g,b,w;const a=Er(t,r==null?void 0:r.in),l=a.getFullYear(),o=Gc(),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=Za((r==null?void 0:r.in)||t,0);d.setFullYear(l+1,0,u),d.setHours(0,0,0,0);const m=Co(d,r),p=Za((r==null?void 0:r.in)||t,0);p.setFullYear(l,0,u),p.setHours(0,0,0,0);const y=Co(p,r);return+a>=+m?l+1:+a>=+y?l:l-1}function EA(t,r){var m,p,y,x;const a=Gc(),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=iw(t,r),u=Za((r==null?void 0:r.in)||t,0);return u.setFullYear(o,0,l),u.setHours(0,0,0,0),Co(u,r)}function kA(t,r){const a=Er(t,r==null?void 0:r.in),l=+Co(a,r)-+EA(a,r);return Math.round(l/rw)+1}function yt(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 yt(r==="yy"?l%100:l,r.length)},M(t,r){const a=t.getMonth();return r==="M"?String(a+1):yt(a+1,2)},d(t,r){return yt(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 yt(t.getHours()%12||12,r.length)},H(t,r){return yt(t.getHours(),r.length)},m(t,r){return yt(t.getMinutes(),r.length)},s(t,r){return yt(t.getSeconds(),r.length)},S(t,r){const a=r.length,l=t.getMilliseconds(),o=Math.trunc(l*Math.pow(10,a-3));return yt(o,r.length)}},Dl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Qv={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=iw(t,l),u=o>0?o:1-o;if(r==="YY"){const d=u%100;return yt(d,2)}return r==="Yo"?a.ordinalNumber(u,{unit:"year"}):yt(u,r.length)},R:function(t,r){const a=aw(t);return yt(a,r.length)},u:function(t,r){const a=t.getFullYear();return yt(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 yt(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 yt(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 yt(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=kA(t,l);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):yt(o,r.length)},I:function(t,r,a){const l=jA(t);return r==="Io"?a.ordinalNumber(l,{unit:"week"}):yt(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=CA(t);return r==="Do"?a.ordinalNumber(l,{unit:"dayOfYear"}):yt(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 yt(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 yt(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 yt(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=Dl.noon:l===0?o=Dl.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=Dl.evening:l>=12?o=Dl.afternoon:l>=4?o=Dl.morning:o=Dl.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"}):yt(l,r.length)},k:function(t,r,a){let l=t.getHours();return l===0&&(l=24),r==="ko"?a.ordinalNumber(l,{unit:"hour"}):yt(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 Vv(l);case"XXXX":case"XX":return Ni(l);case"XXXXX":case"XXX":default:return Ni(l,":")}},x:function(t,r,a){const l=t.getTimezoneOffset();switch(r){case"x":return Vv(l);case"xxxx":case"xx":return Ni(l);case"xxxxx":case"xxx":default:return Ni(l,":")}},O:function(t,r,a){const l=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+Yv(l,":");case"OOOO":default:return"GMT"+Ni(l,":")}},z:function(t,r,a){const l=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+Yv(l,":");case"zzzz":default:return"GMT"+Ni(l,":")}},t:function(t,r,a){const l=Math.trunc(+t/1e3);return yt(l,r.length)},T:function(t,r,a){return yt(+t,r.length)}};function Yv(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+yt(u,2)}function Vv(t,r){return t%60===0?(t>0?"-":"+")+yt(Math.abs(t)/60,2):Ni(t,r)}function Ni(t,r=""){const a=t>0?"-":"+",l=Math.abs(t),o=yt(Math.trunc(l/60),2),u=yt(l%60,2);return a+o+r+u}const Gv=(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"})}},lw=(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"})}},TA=(t,r)=>{const a=t.match(/(P+)(p+)?/)||[],l=a[1],o=a[2];if(!o)return Gv(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}}",Gv(l,r)).replace("{{time}}",lw(o,r))},AA={p:lw,P:TA},OA=/^D+$/,RA=/^Y+$/,MA=["D","DD","YY","YYYY"];function zA(t){return OA.test(t)}function DA(t){return RA.test(t)}function _A(t,r,a){const l=LA(t,r,a);if(console.warn(l),MA.includes(t))throw new RangeError(l)}function LA(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 UA=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qA=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,HA=/^'([^]*?)'?$/,BA=/''/g,FA=/[a-zA-Z]/;function jo(t,r,a){var x,g,b,w;const l=Gc(),o=l.locale??NA,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=Er(t,a==null?void 0:a.in);if(!PT(m))throw new RangeError("Invalid time value");let p=r.match(qA).map(C=>{const k=C[0];if(k==="p"||k==="P"){const E=AA[k];return E(C,o.formatLong)}return C}).join("").match(UA).map(C=>{if(C==="''")return{isToken:!1,value:"'"};const k=C[0];if(k==="'")return{isToken:!1,value:IA(C)};if(Qv[k])return{isToken:!0,value:C};if(k.match(FA))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");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 k=C.value;(DA(k)||zA(k))&&_A(k,r,String(t));const E=Qv[k[0]];return E(m,k,o.localize,y)}).join("")}function IA(t){const r=t.match(HA);return r?r[1].replace(BA,"'"):t}function bp(t){const{data:r}=tw(t??"");return!t||!r?[]:r.skills}function PA(){return Cn({queryKey:["schedules"],queryFn:()=>ue.schedules.list()})}function QA(t){const r=/^\/([a-zA-Z0-9_-]*)$/.exec(t);return r?r[1]:null}function YA(t,r){const a=r.toLowerCase();return t.filter(l=>l.name.toLowerCase().startsWith(a)).sort((l,o)=>l.name.localeCompare(o.name))}function sw(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 vp(t,r,a){const l=QA(t),o=l!==null?YA(a,l):[];return sw(l,o,u=>r(`/${u.name} `))}function wp({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 ca({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 ot="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";function st({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 Pi({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 Ir({title:t,message:r,confirmLabel:a,destructive:l=!0,onConfirm:o,onClose:u}){return c.jsx(VA,{title:t,message:r,confirmLabel:a,destructive:l,onConfirm:o,onClose:u})}function VA({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(ca,{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(Pi,{onCancel:u,submitLabel:a,busy:d,destructive:l,onSubmit:x})]})}function Kv({schedule:t,onClose:r}){const a=Lt(),{data:l,isLoading:o}=as(),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,k]=S.useState(!1),[E,j]=S.useState(""),A=bp(d||void 0),z=vp(x,g,A),Y=S.useRef(null);function q(H){z.choose(H),requestAnimationFrame(()=>{const $=Y.current;$&&$.setSelectionRange($.value.length,$.value.length)})}async function T(H){if(H.preventDefault(),!!d){k(!0),j("");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($){j($ instanceof Error?$.message:`Failed to ${t?"save":"create"} schedule`),k(!1)}}}return c.jsx(ca,{title:t?"Edit schedule":"New schedule",onClose:r,width:"w-[28rem]",children:c.jsxs("form",{onSubmit:T,className:"space-y-4",children:[c.jsx(st,{label:"Agent",htmlFor:"schedule-agent",children:t?c.jsx("p",{id:"schedule-agent",className:`${ot} 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:ot,value:d,onChange:H=>m(H.target.value),autoFocus:!0,children:[c.jsx("option",{value:"",children:"Select an agent…"}),u.map(H=>c.jsx("option",{value:H.id,children:H.name},H.id))]})}),c.jsx(st,{label:"Name",htmlFor:"schedule-name",children:c.jsx("input",{id:"schedule-name",required:!0,className:ot,value:p,onChange:H=>y(H.target.value),placeholder:"Check for new emails",autoFocus:!!t})}),c.jsx(st,{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:[z.open&&c.jsx(wp,{id:"schedule-prompt-skill-autocomplete",matches:z.matches,activeIndex:z.activeIndex,onChoose:q}),c.jsx("textarea",{ref:Y,id:"schedule-prompt",required:!0,rows:3,className:ot,value:x,onChange:H=>g(H.target.value),onKeyDown:H=>{z.onKeyDown(H)},placeholder:"Check for new emails and propose an answer."})]})}),c.jsx(st,{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:`${ot} font-mono`,value:b,onChange:H=>w(H.target.value),placeholder:"*/30 * * * *"})}),E&&c.jsx("p",{className:"text-xs text-destructive",children:E}),c.jsx(Pi,{onCancel:r,submitLabel:t?"Save":"Create",busy:C,disabled:!d})]})})}function GA(){const t=Lt(),{data:r,isLoading:a,isError:l}=PA(),[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 ${jo(new Date(b.nextRunAt),"d MMM HH:mm")}`:"Paused",b.lastRunAt&&` · last ran ${jo(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(Kn,{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(Kv,{onClose:()=>u(!1)}),d&&c.jsx(Kv,{schedule:d,onClose:()=>m(null)}),p&&c.jsx(Ir,{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 KA(){return c.jsx(GA,{})}const XA=[{href:"/settings/general",label:"General",icon:Ck},{href:"/settings/integrations",label:"Integrations",icon:vk}];function ow({children:t}){const r=qo(),a=nw();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:XA.map(l=>{const o=r===l.href,u=l.icon;return c.jsxs(Kn,{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(yp,{label:"Not connected"})]},l.href)})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:t})]})}const Vh=8,Gh="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";function $A(){const t=Nt(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<Vh){p(`The new password must be at least ${Vh} characters.`);return}if(l!==u){p("The new passwords do not match.");return}b(!0);try{const k=await ue.auth.changePassword({currentPassword:r,newPassword:l});Yc(k.accessToken,k.refreshToken),t(Ho(k.user)),a(""),o(""),d(""),x(!0)}catch(k){p(k instanceof Error?k.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:Gh})]}),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:Vh,autoComplete:"new-password",value:l,onChange:C=>o(C.target.value),className:Gh})]}),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:Gh})]}),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 ZA={light:"Light",dark:"Dark"},JA={small:"Small",normal:"Normal",big:"Big"};function WA(){const t=km(a=>a.appearance),r=km(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:M1.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})}),ZA[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:z1.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})}),JA[a]]},a))})]})]})}function eO(){const t=Nt(g=>g.user),r=Nt(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(Vc,{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(WA,{}),c.jsx($A,{})]})}function tO(){return c.jsx(ow,{children:c.jsx(eO,{})})}function uw(t,r){const a=setInterval(()=>{t.closed&&(clearInterval(a),r())},500),l=setTimeout(()=>clearInterval(a),600*1e3);return()=>{clearInterval(a),clearTimeout(l)}}function nO(){const t=Lt(),{data:r,isLoading:a,isError:l}=gp({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),k=window.open(C,"kai-oauth-connect","width=500,height=700");if(!k){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=uw(k,()=>{u(E=>({...E,[b]:!1})),t.invalidateQueries({queryKey:["mcp-servers"]})})}catch(C){m(k=>({...k,[b]:C instanceof Error?C.message:"Could not start the connection"})),u(k=>({...k,[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(yp,{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 rO(){return c.jsx(ow,{children:c.jsx(nO,{})})}function aO(){return Cn({queryKey:["llm-models"],queryFn:()=>ue.llm.models(),staleTime:6e4})}function iO(...t){return Io(Fo(t))}const lO=["filesystem.list","filesystem.read","filesystem.write","screen.capture","browser.read","browser.interact"],sO={"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"},oO=["before_tool_call","after_tool_call","before_agent_response","after_agent_response","on_agent_error"],uO=["Identity","Instructions","Capabilities","Rules","Skills","Hooks","Tools","Review","Sharing"];function cw({mode:t,agent:r}){var It,mr,En;const a=Zn(),l=Lt(),o=S.useRef(null),u=Nt(B=>B.user),[d,m]=S.useState("Identity"),[p,y]=S.useState(!1),[x,g]=S.useState(""),[b,w]=S.useState(!1),[C,k]=S.useState((r==null?void 0:r.name)??""),[E,j]=S.useState((r==null?void 0:r.description)??""),[A,z]=S.useState((r==null?void 0:r.avatarUrl)??""),{data:Y}=aO(),[q,T]=S.useState((r==null?void 0:r.llmModelId)??""),[H,$]=S.useState((r==null?void 0:r.autoLocalClaudeModelId)??""),W=(Y==null?void 0:Y.models.filter(B=>B.isLocalClaude))??[],{data:M}=as(),ie=((M==null?void 0:M.agents)??[]).filter(B=>B.id!==(r==null?void 0:r.id)),[Q,ae]=S.useState((r==null?void 0:r.reviewAgentId)??""),[le,ne]=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)??""),[it,_]=S.useState((r==null?void 0:r.capabilities)??[]),[D,re]=S.useState(((It=r==null?void 0:r.rules)==null?void 0:It.map(B=>({id:B.id,name:B.name,description:B.description,enforcement:B.enforcement,conditionType:B.condition.type,conditionToolName:B.condition.toolName??""})))??[]),[he,xe]=S.useState(((mr=r==null?void 0:r.skills)==null?void 0:mr.map(B=>({id:B.id,name:B.name,description:B.description,content:B.content})))??[]),[Oe,Me]=S.useState(((En=r==null?void 0:r.hooks)==null?void 0:En.map(B=>({id:B.id,event:B.event,name:B.name,handlerUrl:B.handlerUrl,enabled:B.enabled})))??[]),{data:Le,isLoading:ye}=gp(),Ee=(Le==null?void 0:Le.servers)??[],[Tt,Ke]=S.useState(()=>Object.fromEntries(((r==null?void 0:r.mcpBindings)??[]).map(B=>[B.mcpServerId,{enabled:!0,all:B.enabledTools.length===0,tools:B.enabledTools}])));function se(B){return Tt[B]??{enabled:!1,all:!0,tools:[]}}function He(B,ve){Ke(we=>({...we,[B]:{...se(B),...ve}}))}const[nt,Qe]=S.useState((r==null?void 0:r.visibility)??"private");function ht(B){_(ve=>ve.includes(B)?ve.filter(we=>we!==B):[...ve,B])}function Mt(){re(B=>[...B,{name:"",description:"",enforcement:"prompt_only",conditionType:"always"}])}function Ct(B,ve){re(we=>we.map((ke,ut)=>ut===B?{...ke,...ve}:ke))}function fe(B){re(ve=>ve.filter((we,ke)=>ke!==B))}function ge(){xe(B=>[...B,{name:"",description:"",content:""}])}function oe(B,ve){xe(we=>we.map((ke,ut)=>ut===B?{...ke,...ve}:ke))}function Ft(B){xe(ve=>ve.filter((we,ke)=>ke!==B))}function J(){Me(B=>[...B,{event:"before_tool_call",name:"",handlerUrl:"",enabled:!0}])}function K(B,ve){Me(we=>we.map((ke,ut)=>ut===B?{...ke,...ve}:ke))}function be(B){Me(ve=>ve.filter((we,ke)=>ke!==B))}const Te=Y==null?void 0:Y.models.find(B=>B.id===Y.defaultModelId);async function Ye(){if(!C.trim()){m("Identity"),g("Agent name is required");return}const B=Ee.find(ve=>{const we=se(ve.id);return we.enabled&&!we.all&&we.tools.length===0});if(B){m("Tools"),g(`Choose at least one tool for "${B.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:H||null,reviewAgentId:Q||null,reviewPrompt:le.trim(),reviewMaxRounds:Z,finalReviewAgentId:me||null,visibility:nt,capabilities:it};if(t==="create"){const we=await ue.agents.create(ve);for(const ke of he)ke.name&&await ue.agents.skills.create(we.id,{name:ke.name,description:ke.description,content:ke.content});for(const ke of D)ke.name&&await ue.agents.rules.create(we.id,{name:ke.name,description:ke.description,enforcement:ke.enforcement,condition:{type:ke.conditionType,toolName:ke.conditionToolName||void 0}});for(const ke of Oe)ke.name&&ke.handlerUrl&&await ue.agents.hooks.create(we.id,{event:ke.event,name:ke.name,handlerUrl:ke.handlerUrl,enabled:ke.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(B){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),ke=new Map(B.skills.map(Ce=>[Ce.id,{name:Ce.name,description:Ce.description,content:Ce.content}])),ut=new Map(B.rules.map(Ce=>[Ce.id,ve({name:Ce.name,description:Ce.description,enforcement:Ce.enforcement,conditionType:Ce.condition.type,conditionToolName:Ce.condition.toolName??""})])),Ln=new Map(B.hooks.map(Ce=>[Ce.id,{event:Ce.event,name:Ce.name,handlerUrl:Ce.handlerUrl,enabled:Ce.enabled}]));for(const Ce of ke.keys())he.some(Ht=>Ht.id===Ce)||await ue.agents.skills.delete(B.id,Ce);for(const Ce of ut.keys())D.some(Ht=>Ht.id===Ce)||await ue.agents.rules.delete(B.id,Ce);for(const Ce of Ln.keys())Oe.some(Ht=>Ht.id===Ce)||await ue.agents.hooks.delete(B.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,ke.get(Ce.id))||await ue.agents.skills.update(B.id,Ce.id,Ht):await ue.agents.skills.create(B.id,Ht)}for(const Ce of D){if(!Ce.name)continue;const Ht=ve(Ce);Ce.id?we(Ht,ut.get(Ce.id))||await ue.agents.rules.update(B.id,Ce.id,Ht):await ue.agents.rules.create(B.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,Ln.get(Ce.id))||await ue.agents.hooks.update(B.id,Ce.id,Ht):await ue.agents.hooks.create(B.id,Ht)}}async function Jn(B,ve){for(const we of Ee){const ke=se(we.id),ut=ve.find(Ln=>Ln.mcpServerId===we.id);if(ke.enabled){const Ln=ke.all?[]:ke.tools;ut&&JSON.stringify([...ut.enabledTools].sort())===JSON.stringify([...Ln].sort())||await ue.mcp.bind(B,{mcpServerId:we.id,enabledTools:Ln})}else ut&&await ue.mcp.unbind(B,ut.id)}}async function jn(){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(B){g(B instanceof Error?B.message:"Delete failed"),w(!1)}}}async function fr(){if(r)try{const B=await ue.agents.export(r.id),ve=new Blob([JSON.stringify(B,null,2)],{type:"application/json"}),we=URL.createObjectURL(ve),ke=document.createElement("a");ke.href=we,ke.download=`${r.name.replace(/\s+/g,"-")}-export.json`,ke.click(),URL.revokeObjectURL(we)}catch(B){g(B instanceof Error?B.message:"Export failed")}}async function hr(B){var we;const ve=(we=B.target.files)==null?void 0:we[0];if(ve){try{const ke=await ve.text(),ut=JSON.parse(ke),Ln=await ue.agents.import(ut);await l.invalidateQueries({queryKey:["agents"]}),a.push(`/agents/${Ln.id}/edit`)}catch(ke){g(ke instanceof Error?ke.message:"Import failed")}B.target.value=""}}return t==="create"&&u!==null&&!hp(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:uO.map(B=>c.jsx("button",{onClick:()=>m(B),className:iO("px-4 py-2.5 text-sm border-b-2 transition-colors whitespace-nowrap",d===B?"border-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground"),children:B},B))}),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:B=>k(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:"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:B=>j(B.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:B=>z(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:"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:B=>T(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",children:[c.jsxs("option",{value:"",children:["Organization default",Te?` (${Te.label})`:""]}),Y==null?void 0:Y.models.map(B=>c.jsxs("option",{value:B.id,children:[B.label," — ",B.providerName]},B.id))]}),Y&&Y.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:H,onChange:B=>$(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",children:[c.jsx("option",{value:"",children:"Off"}),W.map(B=>c.jsx("option",{value:B.id,children:B.label},B.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:B=>Be(B.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."}),lO.map(B=>c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:it.includes(B),onChange:()=>ht(B),className:"rounded border accent-primary"}),c.jsxs("span",{children:[c.jsx("span",{className:"text-sm font-mono",children:B}),c.jsx("span",{className:"block text-xs text-muted-foreground",children:sO[B]})]})]},B))]}),d==="Rules"&&c.jsxs("div",{className:"max-w-2xl space-y-4",children:[D.map((B,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:B.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:B.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:B.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:B.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"})]})]}),B.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:B.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:Mt,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((B,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:()=>Ft(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:B.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:B.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:B.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((B,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:B.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:oO.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:B.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:B.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:B.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&&Ee.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."}),Ee.map(B=>{const ve=se(B.id),we=B.tools.length>0,ke=!B.availableToMe;return c.jsxs("div",{className:`border rounded-lg p-4 space-y-3 ${ke?"opacity-60":""}`,children:[c.jsxs("label",{className:`flex items-start gap-3 ${ke&&!ve.enabled?"cursor-not-allowed":"cursor-pointer"}`,children:[c.jsx("input",{type:"checkbox",className:"mt-1 accent-primary",checked:ve.enabled,disabled:ke&&!ve.enabled,onChange:ut=>He(B.id,{enabled:ut.target.checked}),"aria-label":`Use ${B.name}`}),c.jsxs("span",{children:[c.jsx("span",{className:"text-sm font-medium",children:B.name}),c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:B.transport==="http"?"HTTP":"stdio"}),B.description&&c.jsx("span",{className:"block text-xs text-muted-foreground",children:B.description}),ke&&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-${B.id}`,className:"accent-primary",checked:ve.all,disabled:ke,onChange:()=>He(B.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-${B.id}`,className:"accent-primary",checked:!ve.all,disabled:!we||ke,onChange:()=>He(B.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:B.tools.map(ut=>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(ut.name),disabled:ke,onChange:Ln=>He(B.id,{tools:Ln.target.checked?[...ve.tools,ut.name]:ve.tools.filter(Ce=>Ce!==ut.name)}),"aria-label":ut.name}),c.jsxs("span",{children:[c.jsx("span",{className:"font-mono text-xs",children:ut.name}),ut.description&&c.jsx("span",{className:"block text-xs text-muted-foreground",children:ut.description})]})]})},ut.name))})]})]},B.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:Q,onChange:B=>ae(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",children:[c.jsx("option",{value:"",children:"No review"}),ie.map(B=>c.jsx("option",{value:B.id,children:B.name},B.id))]})]}),Q&&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:le,onChange:B=>ne(B.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:B=>ce(Number(B.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:B=>Re(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",children:[c.jsx("option",{value:"",children:"None"}),ie.map(B=>c.jsx("option",{value:B.id,children:B.name},B.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(B=>c.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[c.jsx("input",{type:"radio",name:"visibility",value:B,checked:nt===B,onChange:()=>Qe(B),className:"accent-primary"}),c.jsx("span",{className:"text-sm capitalize",children:B==="private"?"Private (only me)":B==="org"?"Organization (everyone in my org)":"Selected users"})]},B)),nt==="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 B;return(B=o.current)==null?void 0:B.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:jn,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 cO(){return c.jsx(cw,{mode:"create"})}function dO({params:t}){const{id:r}=S.use(t),{data:a,isLoading:l,isError:o}=tw(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(cw,{mode:"edit",agent:a})}function fO(t,r){return Cn({queryKey:["conversations",t,"messages",r],queryFn:()=>ue.conversations.messages(t,r),enabled:!!t})}function hO(){return Cn({queryKey:["transcription"],queryFn:()=>ue.transcription.status(),staleTime:6e4})}function mO(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 pO="temp-";function Rm(t){var r;return(t.role==="user"||t.role==="assistant")&&!t.id.startsWith(pO)&&!((r=t.metadata)!=null&&r.forward)}function gO(t,r){return t.filter(a=>a.senderType==="agent"&&a.senderId===r).map(a=>a.id).slice(-20)}function yO({conversationId:t,memberIds:r,onClose:a}){const l=Lt(),[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(xp,{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 xO({conversationId:t,messages:r,sharedChat:a=!1,onClose:l,onForwarded:o}){const u=Lt(),{data:d,isLoading:m}=as(),p=(d==null?void 0:d.agents)??[],[y,x]=S.useState(""),[g,b]=S.useState(""),[w,C]=S.useState(!1),[k,E]=S.useState(""),j=bp(y||void 0),A=vp(g,b,j),z=S.useRef(null);function Y(T){A.choose(T),requestAnimationFrame(()=>{const H=z.current;H&&H.setSelectionRange(H.value.length,H.value.length)})}async function q(){if(!(y===""||w)){C(!0),E("");try{await ue.conversations.forward(t,{messageIds:r.map(T=>T.id),agentId:y,...g.trim()!==""?{note:g.trim()}:{}}),await u.invalidateQueries({queryKey:["conversations",t,"messages"]}),o()}catch(T){E(T instanceof Error?T.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(T=>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:[T.senderName&&c.jsxs("span",{className:"font-medium",children:[T.senderName,": "]}),T.content!==""?T.content:"(a file)"]},T.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(Kn,{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:T=>x(T.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(T=>c.jsx("option",{value:T.id,children:T.name},T.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(wp,{id:"forward-note-skill-autocomplete",matches:A.matches,activeIndex:A.activeIndex,onChoose:Y}),c.jsx("textarea",{ref:z,id:"forward-note",rows:3,value:g,onChange:T=>b(T.target.value),onKeyDown:T=>{A.onKeyDown(T)},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"})]})]}),k&&c.jsx("p",{role:"alert",className:"text-xs text-destructive mb-3",children:k}),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 Mm(){return typeof window<"u"&&"speechSynthesis"in window&&typeof window.SpeechSynthesisUtterance=="function"}function bO(t){return t.replace(/```[\s\S]*?(```|$)/g,`
226
- code block omitted.
227
- `).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,`
228
- `).trim()}function vO(t,r=200){const a=t.split(`
229
- `).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 zm=Ii((t,r)=>({speakingId:null,speak:(a,l)=>{if(!Mm())return;const o=vO(bO(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:()=>{Mm()&&window.speechSynthesis.cancel(),t({speakingId:null})}}));function wO(t,r){const a={};return(t[t.length-1]===""?[...t,""]:t).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const SO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,CO={};function Xv(t,r){return(CO.jsx?NO:SO).test(t)}const jO=/[ \t\n\f\r]/g;function EO(t){return typeof t=="object"?t.type==="text"?$v(t.value):!1:$v(t)}function $v(t){return t.replace(jO,"")===""}class Po{constructor(r,a,l){this.normal=a,this.property=r,l&&(this.space=l)}}Po.prototype.normal={};Po.prototype.property={};Po.prototype.space=void 0;function dw(t,r){const a={},l={};for(const o of t)Object.assign(a,o.property),Object.assign(l,o.normal);return new Po(a,l,r)}function Dm(t){return t.toLowerCase()}class _n{constructor(r,a){this.attribute=a,this.property=r}}_n.prototype.attribute="";_n.prototype.booleanish=!1;_n.prototype.boolean=!1;_n.prototype.commaOrSpaceSeparated=!1;_n.prototype.commaSeparated=!1;_n.prototype.defined=!1;_n.prototype.mustUseProperty=!1;_n.prototype.number=!1;_n.prototype.overloadedBoolean=!1;_n.prototype.property="";_n.prototype.spaceSeparated=!1;_n.prototype.space=void 0;let kO=0;const qe=Qi(),Kt=Qi(),_m=Qi(),de=Qi(),wt=Qi(),Li=Qi(),Gn=Qi();function Qi(){return 2**++kO}const Lm=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:Kt,commaOrSpaceSeparated:Gn,commaSeparated:Li,number:de,overloadedBoolean:_m,spaceSeparated:wt},Symbol.toStringTag,{value:"Module"})),Kh=Object.keys(Lm);class Sp extends _n{constructor(r,a,l,o){let u=-1;if(super(r,a),Zv(this,"space",o),typeof l=="number")for(;++u<Kh.length;){const d=Kh[u];Zv(this,Kh[u],(l&Lm[d])===Lm[d])}}}Sp.prototype.defined=!0;function Zv(t,r,a){a&&(t[r]=a)}function is(t){const r={},a={};for(const[l,o]of Object.entries(t.properties)){const u=new Sp(l,t.transform(t.attributes||{},l),o,t.space);t.mustUseProperty&&t.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),r[l]=u,a[Dm(l)]=l,a[Dm(u.attribute)]=l}return new Po(r,a,t.space)}const fw=is({properties:{ariaActiveDescendant:null,ariaAtomic:Kt,ariaAutoComplete:null,ariaBusy:Kt,ariaChecked:Kt,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:Kt,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:Kt,ariaFlowTo:wt,ariaGrabbed:Kt,ariaHasPopup:null,ariaHidden:Kt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:de,ariaLive:null,ariaModal:Kt,ariaMultiLine:Kt,ariaMultiSelectable:Kt,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:Kt,ariaReadOnly:Kt,ariaRelevant:null,ariaRequired:Kt,ariaRoleDescription:wt,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 hw(t,r){return r in t?t[r]:r}function mw(t,r){return hw(t,r.toLowerCase())}const TO=is({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Li,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alpha:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:wt,autoFocus:qe,autoPlay:qe,blocking:wt,capture:null,charSet:null,checked:qe,cite:null,className:wt,closedBy:null,colorSpace:null,cols:de,colSpan:de,command:null,commandFor:null,content:null,contentEditable:Kt,controls:qe,controlsList:wt,coords:de|Li,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:_m,draggable:Kt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:wt,height:de,hidden:_m,high:de,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:wt,itemRef:wt,itemScope:qe,itemType:wt,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:wt,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:wt,required:qe,reversed:qe,rows:de,rowSpan:de,sandbox:wt,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:wt,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:Li,part:wt,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:mw}),AO=is({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:Gn,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:wt,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:Li,g2:Li,glyphName:Li,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:Gn,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:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:Gn,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:Gn,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:Gn,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:hw}),pw=is({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()}}),gw=is({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:mw}),yw=is({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,r){return"xml:"+r.slice(3).toLowerCase()}}),OO={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"},RO=/[A-Z]/g,Jv=/-[a-z]/g,MO=/^data[-\w.:]+$/i;function zO(t,r){const a=Dm(r);let l=r,o=_n;if(a in t.normal)return t.property[t.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&MO.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Jv,_O);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Jv.test(u)){let d=u.replace(RO,DO);d.charAt(0)!=="-"&&(d="-"+d),r="data"+d}}o=Sp}return new o(l,r)}function DO(t){return"-"+t.toLowerCase()}function _O(t){return t.charAt(1).toUpperCase()}const LO=dw([fw,TO,pw,gw,yw],"html"),Np=dw([fw,AO,pw,gw,yw],"svg");function UO(t){return t.join(" ").trim()}var _l={},Xh,Wv;function qO(){if(Wv)return Xh;Wv=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=`
230
- `,y="/",x="*",g="",b="comment",w="declaration";function C(E,j){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];j=j||{};var A=1,z=1;function Y(le){var ne=le.match(r);ne&&(A+=ne.length);var Z=le.lastIndexOf(p);z=~Z?le.length-Z:z+le.length}function q(){var le={line:A,column:z};return function(ne){return ne.position=new T(le),W(),ne}}function T(le){this.start=le,this.end={line:A,column:z},this.source=j.source}T.prototype.content=E;function H(le){var ne=new Error(j.source+":"+A+":"+z+": "+le);if(ne.reason=le,ne.filename=j.source,ne.line=A,ne.column=z,ne.source=E,!j.silent)throw ne}function $(le){var ne=le.exec(E);if(ne){var Z=ne[0];return Y(Z),E=E.slice(Z.length),ne}}function W(){$(a)}function M(le){var ne;for(le=le||[];ne=ie();)ne!==!1&&le.push(ne);return le}function ie(){var le=q();if(!(y!=E.charAt(0)||x!=E.charAt(1))){for(var ne=2;g!=E.charAt(ne)&&(x!=E.charAt(ne)||y!=E.charAt(ne+1));)++ne;if(ne+=2,g===E.charAt(ne-1))return H("End of comment missing");var Z=E.slice(2,ne-2);return z+=2,Y(Z),E=E.slice(ne),z+=2,le({type:b,comment:Z})}}function Q(){var le=q(),ne=$(l);if(ne){if(ie(),!$(o))return H("property missing ':'");var Z=$(u),ce=le({type:w,property:k(ne[0].replace(t,g)),value:Z?k(Z[0].replace(t,g)):g});return $(d),ce}}function ae(){var le=[];M(le);for(var ne;ne=Q();)ne!==!1&&(le.push(ne),M(le));return le}return W(),ae()}function k(E){return E?E.replace(m,g):g}return Xh=C,Xh}var e0;function HO(){if(e0)return _l;e0=1;var t=_l&&_l.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(_l,"__esModule",{value:!0}),_l.default=a;const r=t(qO());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 _l}var so={},t0;function BO(){if(t0)return so;t0=1,Object.defineProperty(so,"__esModule",{value:!0}),so.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 so.camelCase=p,so}var oo,n0;function FO(){if(n0)return oo;n0=1;var t=oo&&oo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},r=t(HO()),a=BO();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,oo=l,oo}var IO=FO();const PO=Vm(IO),xw=bw("end"),Cp=bw("start");function bw(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 QO(t){const r=Cp(t),a=xw(t);if(r&&a)return{start:r,end:a}}function xo(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?r0(t.position):"start"in t||"end"in t?r0(t):"line"in t||"column"in t?Um(t):""}function Um(t){return a0(t&&t.line)+":"+a0(t&&t.column)}function r0(t){return Um(t&&t.start)+"-"+Um(t&&t.end)}function a0(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 jp={}.hasOwnProperty,YO=new Map,VO=/[A-Z]/g,GO=new Set(["table","tbody","thead","tfoot","tr"]),KO=new Set(["td","th"]),vw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function XO(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=r3(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=n3(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"?Np:LO,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=ww(o,t,void 0);return u&&typeof u!="string"?u:o.create(t,o.Fragment,{children:u||void 0},void 0)}function ww(t,r,a){if(r.type==="element")return $O(t,r,a);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return ZO(t,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return WO(t,r,a);if(r.type==="mdxjsEsm")return JO(t,r);if(r.type==="root")return e3(t,r,a);if(r.type==="text")return t3(t,r)}function $O(t,r,a){const l=t.schema;let o=l;r.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=Np,t.schema=o),t.ancestors.push(r);const u=Nw(t,r.tagName,!1),d=a3(t,r);let m=kp(t,r);return GO.has(r.tagName)&&(m=m.filter(function(p){return typeof p=="string"?!EO(p):!0})),Sw(t,d,u,r),Ep(d,m),t.ancestors.pop(),t.schema=l,t.create(r,u,d,a)}function ZO(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)}Eo(t,r.position)}function JO(t,r){if(r.data&&r.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(r.data.estree);Eo(t,r.position)}function WO(t,r,a){const l=t.schema;let o=l;r.name==="svg"&&l.space==="html"&&(o=Np,t.schema=o),t.ancestors.push(r);const u=r.name===null?t.Fragment:Nw(t,r.name,!0),d=i3(t,r),m=kp(t,r);return Sw(t,d,u,r),Ep(d,m),t.ancestors.pop(),t.schema=l,t.create(r,u,d,a)}function e3(t,r,a){const l={};return Ep(l,kp(t,r)),t.create(r,t.Fragment,l,a)}function t3(t,r){return r.value}function Sw(t,r,a,l){typeof a!="string"&&a!==t.Fragment&&t.passNode&&(r.node=l)}function Ep(t,r){if(r.length>0){const a=r.length>1?r:r[0];a&&(t.children=a)}}function n3(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 r3(t,r){return a;function a(l,o,u,d){const m=Array.isArray(u.children),p=Cp(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 a3(t,r){const a={};let l,o;for(o in r.properties)if(o!=="children"&&jp.call(r.properties,o)){const u=l3(t,o,r.properties[o]);if(u){const[d,m]=u;t.tableCellAlignToStyle&&d==="align"&&typeof m=="string"&&KO.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 i3(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 Eo(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 Eo(t,r.position);else u=l.value===null?!0:l.value;a[o]=u}return a}function kp(t,r){const a=[];let l=-1;const o=t.passKeys?new Map:YO;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=ww(t,u,d);m!==void 0&&a.push(m)}return a}function l3(t,r,a){const l=zO(t.schema,r);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=l.commaSeparated?wO(a):UO(a)),l.property==="style"){let o=typeof a=="object"?a:s3(t,String(a));return t.stylePropertyNameCase==="css"&&(o=o3(o)),["style",o]}return[t.elementAttributeNameCase==="react"&&l.space?OO[l.property]||l.property:l.attribute,a]}}function s3(t,r){try{return PO(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=vw+"#cannot-parse-style-attribute",o}}function Nw(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=Xv(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=Xv(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(l.type==="Literal"){const o=l.value;return jp.call(t.components,o)?t.components[o]:o}if(t.evaluater)return t.evaluater.evaluateExpression(l);Eo(t)}function Eo(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=vw+"#cannot-handle-mdx-estrees-without-createevaluater",a}function o3(t){const r={};let a;for(a in t)jp.call(t,a)&&(r[u3(a)]=t[a]);return r}function u3(t){let r=t.replace(VO,c3);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function c3(t){return"-"+t.toLowerCase()}const $h={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"]},d3={};function Tp(t,r){const a=d3,l=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Cw(t,l,o)}function Cw(t,r,a){if(f3(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 i0(t.children,r,a)}return Array.isArray(t)?i0(t,r,a):""}function i0(t,r,a){const l=[];let o=-1;for(;++o<t.length;)l[o]=Cw(t[o],r,a);return l.join("")}function f3(t){return!!(t&&typeof t=="object")}const l0=document.createElement("i");function Ap(t){const r="&"+t+";";l0.innerHTML=r;const a=l0.textContent;return a.charCodeAt(a.length-1)===59&&t!=="semi"||a===r?!1:a}function Xn(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?(Xn(t,t.length,0,r),t):r}const s0={}.hasOwnProperty;function jw(t){const r={};let a=-1;for(;++a<t.length;)h3(r,t[a]);return r}function h3(t,r){let a;for(a in r){const o=(s0.call(t,a)?t[a]:void 0)||(t[a]={}),u=r[a];let d;if(u)for(d in u){s0.call(o,d)||(o[d]=[]);const m=u[d];m3(o[d],Array.isArray(m)?m:m?[m]:[])}}}function m3(t,r){let a=-1;const l=[];for(;++a<r.length;)(r[a].add==="after"?t:l).push(r[a]);Xn(t,0,0,l)}function Ew(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=Ja(/[A-Za-z]/),pn=Ja(/[\dA-Za-z]/),p3=Ja(/[#-'*+\--9=?A-Z^-~]/);function zc(t){return t!==null&&(t<32||t===127)}const qm=Ja(/\d/),g3=Ja(/[\dA-Fa-f]/),y3=Ja(/[!-/:-@[-`{-~]/);function ze(t){return t!==null&&t<-2}function St(t){return t!==null&&(t<0||t===32)}function Ze(t){return t===-2||t===-1||t===32}const Kc=Ja(new RegExp("\\p{P}|\\p{S}","u")),Bi=Ja(/\s/);function Ja(t){return r;function r(a){return a!==null&&a>-1&&t.test(String.fromCharCode(a))}}function ls(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 at(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 x3={tokenize:b3};function b3(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"),at(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 v3={tokenize:w3},o0={tokenize:S3};function w3(t){const r=this,a=[];let l=0,o,u,d;return m;function m(z){if(l<a.length){const Y=a[l];return r.containerState=Y[1],t.attempt(Y[0].continuation,p,y)(z)}return y(z)}function p(z){if(l++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,o&&A();const Y=r.events.length;let q=Y,T;for(;q--;)if(r.events[q][0]==="exit"&&r.events[q][1].type==="chunkFlow"){T=r.events[q][1].end;break}j(l);let H=Y;for(;H<r.events.length;)r.events[H][1].end={...T},H++;return Xn(r.events,q+1,0,r.events.slice(Y)),r.events.length=H,y(z)}return m(z)}function y(z){if(l===a.length){if(!o)return b(z);if(o.currentConstruct&&o.currentConstruct.concrete)return C(z);r.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return r.containerState={},t.check(o0,x,g)(z)}function x(z){return o&&A(),j(l),b(z)}function g(z){return r.parser.lazy[r.now().line]=l!==a.length,d=r.now().offset,C(z)}function b(z){return r.containerState={},t.attempt(o0,w,C)(z)}function w(z){return l++,a.push([r.currentConstruct,r.containerState]),b(z)}function C(z){if(z===null){o&&A(),j(0),t.consume(z);return}return o=o||r.parser.flow(r.now()),t.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),k(z)}function k(z){if(z===null){E(t.exit("chunkFlow"),!0),j(0),t.consume(z);return}return ze(z)?(t.consume(z),E(t.exit("chunkFlow")),l=0,r.interrupt=void 0,m):(t.consume(z),k)}function E(z,Y){const q=r.sliceStream(z);if(Y&&q.push(null),z.previous=u,u&&(u.next=z),u=z,o.defineSkip(z.start),o.write(q),r.parser.lazy[z.start.line]){let T=o.events.length;for(;T--;)if(o.events[T][1].start.offset<d&&(!o.events[T][1].end||o.events[T][1].end.offset>d))return;const H=r.events.length;let $=H,W,M;for(;$--;)if(r.events[$][0]==="exit"&&r.events[$][1].type==="chunkFlow"){if(W){M=r.events[$][1].end;break}W=!0}for(j(l),T=H;T<r.events.length;)r.events[T][1].end={...M},T++;Xn(r.events,$+1,0,r.events.slice(H)),r.events.length=T}}function j(z){let Y=a.length;for(;Y-- >z;){const q=a[Y];r.containerState=q[1],q[0].exit.call(r,t)}a.length=z}function A(){o.write([null]),u=void 0,o=void 0,r.containerState._closeFlow=void 0}}function S3(t,r,a){return at(t,t.attempt(this.parser.constructs.document,r,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function es(t){if(t===null||St(t)||Bi(t))return 1;if(Kc(t))return 2}function Xc(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 Hm={name:"attention",resolveAll:N3,tokenize:C3};function N3(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};u0(g,-p),u0(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,Xc(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,Xn(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 C3(t,r){const a=this.parser.constructs.attentionMarkers.null,l=this.previous,o=es(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=es(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 u0(t,r){t.column+=r,t.offset+=r,t._bufferIndex+=r}const j3={name:"autolink",tokenize:E3};function E3(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||zc(w)?a(w):(t.consume(w),p)}function y(w){return w===64?(t.consume(w),x):p3(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 Qo={partial:!0,tokenize:k3};function k3(t,r,a){return l;function l(u){return Ze(u)?at(t,o,"linePrefix")(u):o(u)}function o(u){return u===null||ze(u)?r(u):a(u)}}const kw={continuation:{tokenize:A3},exit:O3,name:"blockQuote",tokenize:T3};function T3(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 A3(t,r,a){const l=this;return o;function o(d){return Ze(d)?at(t,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return t.attempt(kw,r,a)(d)}}function O3(t){t.exit("blockQuote")}const Tw={name:"characterEscape",tokenize:R3};function R3(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 y3(u)?(t.enter("characterEscapeValue"),t.consume(u),t.exit("characterEscapeValue"),t.exit("characterEscape"),r):a(u)}}const Aw={name:"characterReference",tokenize:M3};function M3(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=g3,x):(t.enter("characterReferenceValue"),u=7,d=qm,x(g))}function x(g){if(g===59&&o){const b=t.exit("characterReferenceValue");return d===pn&&!Ap(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 c0={partial:!0,tokenize:D3},d0={concrete:!0,name:"codeFenced",tokenize:z3};function z3(t,r,a){const l=this,o={partial:!0,tokenize:q};let u=0,d=0,m;return p;function p(T){return y(T)}function y(T){const H=l.events[l.events.length-1];return u=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,m=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),x(T)}function x(T){return T===m?(d++,t.consume(T),x):d<3?a(T):(t.exit("codeFencedFenceSequence"),Ze(T)?at(t,g,"whitespace")(T):g(T))}function g(T){return T===null||ze(T)?(t.exit("codeFencedFence"),l.interrupt?r(T):t.check(c0,k,Y)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),b(T))}function b(T){return T===null||ze(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),g(T)):Ze(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),at(t,w,"whitespace")(T)):T===96&&T===m?a(T):(t.consume(T),b)}function w(T){return T===null||ze(T)?g(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),C(T))}function C(T){return T===null||ze(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),g(T)):T===96&&T===m?a(T):(t.consume(T),C)}function k(T){return t.attempt(o,Y,E)(T)}function E(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),j}function j(T){return u>0&&Ze(T)?at(t,A,"linePrefix",u+1)(T):A(T)}function A(T){return T===null||ze(T)?t.check(c0,k,Y)(T):(t.enter("codeFlowValue"),z(T))}function z(T){return T===null||ze(T)?(t.exit("codeFlowValue"),A(T)):(t.consume(T),z)}function Y(T){return t.exit("codeFenced"),r(T)}function q(T,H,$){let W=0;return M;function M(ne){return T.enter("lineEnding"),T.consume(ne),T.exit("lineEnding"),ie}function ie(ne){return T.enter("codeFencedFence"),Ze(ne)?at(T,Q,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):Q(ne)}function Q(ne){return ne===m?(T.enter("codeFencedFenceSequence"),ae(ne)):$(ne)}function ae(ne){return ne===m?(W++,T.consume(ne),ae):W>=d?(T.exit("codeFencedFenceSequence"),Ze(ne)?at(T,le,"whitespace")(ne):le(ne)):$(ne)}function le(ne){return ne===null||ze(ne)?(T.exit("codeFencedFence"),H(ne)):$(ne)}}}function D3(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 Zh={name:"codeIndented",tokenize:L3},_3={partial:!0,tokenize:U3};function L3(t,r,a){const l=this;return o;function o(y){return t.enter("codeIndented"),at(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(_3,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 U3(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):at(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 q3={name:"codeText",previous:B3,resolve:H3,tokenize:F3};function H3(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 B3(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function F3(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 I3{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&&uo(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),uo(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),uo(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);uo(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);uo(this.left,a.reverse())}}}function uo(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 Ow(t){const r={};let a=-1,l,o,u,d,m,p,y;const x=new I3(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,P3(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 Xn(t,0,Number.POSITIVE_INFINITY,x.slice(0)),!y}function P3(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,k=0;const E=[k];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&&(k=b+1,E.push(k),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 j=m.slice(E[b],E[b+1]),A=u.pop();p.push([A,A+j.length-1]),t.splice(A,2,j)}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 Q3={resolve:V3,tokenize:G3},Y3={partial:!0,tokenize:K3};function V3(t){return Ow(t),t}function G3(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(Y3,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 K3(t,r,a){const l=this;return o;function o(d){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),at(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 Rw(t,r,a,l,o,u,d,m,p){const y=p||Number.POSITIVE_INFINITY;let x=0;return g;function g(j){return j===60?(t.enter(l),t.enter(o),t.enter(u),t.consume(j),t.exit(u),b):j===null||j===32||j===41||zc(j)?a(j):(t.enter(l),t.enter(d),t.enter(m),t.enter("chunkString",{contentType:"string"}),k(j))}function b(j){return j===62?(t.enter(u),t.consume(j),t.exit(u),t.exit(o),t.exit(l),r):(t.enter(m),t.enter("chunkString",{contentType:"string"}),w(j))}function w(j){return j===62?(t.exit("chunkString"),t.exit(m),b(j)):j===null||j===60||ze(j)?a(j):(t.consume(j),j===92?C:w)}function C(j){return j===60||j===62||j===92?(t.consume(j),w):w(j)}function k(j){return!x&&(j===null||j===41||St(j))?(t.exit("chunkString"),t.exit(m),t.exit(d),t.exit(l),r(j)):x<y&&j===40?(t.consume(j),x++,k):j===41?(t.consume(j),x--,k):j===null||j===32||j===40||zc(j)?a(j):(t.consume(j),j===92?E:k)}function E(j){return j===40||j===41||j===92?(t.consume(j),k):k(j)}}function Mw(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 zw(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"),at(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)?at(t,l,a?"linePrefix":"lineSuffix")(o):r(o)}}const X3={name:"definition",tokenize:Z3},$3={partial:!0,tokenize:J3};function Z3(t,r,a){const l=this;let o;return u;function u(w){return t.enter("definition"),d(w)}function d(w){return Mw.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 St(w)?bo(t,y)(w):y(w)}function y(w){return Rw(t,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function x(w){return t.attempt($3,g,g)(w)}function g(w){return Ze(w)?at(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 J3(t,r,a){return l;function l(m){return St(m)?bo(t,o)(m):a(m)}function o(m){return zw(t,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function u(m){return Ze(m)?at(t,d,"whitespace")(m):d(m)}function d(m){return m===null||ze(m)?r(m):a(m)}}const W3={name:"hardBreakEscape",tokenize:eR};function eR(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 tR={name:"headingAtx",resolve:nR,tokenize:rR};function nR(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"},Xn(t,l,a-l+1,[["enter",o,r],["enter",u,r],["exit",u,r],["exit",o,r]])),t}function rR(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||St(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)?at(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||St(x)?(t.exit("atxHeadingText"),m(x)):(t.consume(x),y)}}const aR=["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"],f0=["pre","script","style","textarea"],iR={concrete:!0,name:"htmlFlow",resolveTo:oR,tokenize:uR},lR={partial:!0,tokenize:dR},sR={partial:!0,tokenize:cR};function oR(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 uR(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,k):_===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:Q:C):a(_)}function k(_){return Nn(_)?(t.consume(_),d=String.fromCharCode(_),E):a(_)}function E(_){if(_===null||_===47||_===62||St(_)){const D=_===47,re=d.toLowerCase();return!D&&!u&&f0.includes(re)?(o=1,l.interrupt?r(_):Q(_)):aR.includes(d.toLowerCase())?(o=6,D?(t.consume(_),j):l.interrupt?r(_):Q(_)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?a(_):u?A(_):z(_))}return _===45||pn(_)?(t.consume(_),d+=String.fromCharCode(_),E):a(_)}function j(_){return _===62?(t.consume(_),l.interrupt?r:Q):a(_)}function A(_){return Ze(_)?(t.consume(_),A):M(_)}function z(_){return _===47?(t.consume(_),M):_===58||_===95||Nn(_)?(t.consume(_),Y):Ze(_)?(t.consume(_),z):M(_)}function Y(_){return _===45||_===46||_===58||_===95||pn(_)?(t.consume(_),Y):q(_)}function q(_){return _===61?(t.consume(_),T):Ze(_)?(t.consume(_),q):z(_)}function T(_){return _===null||_===60||_===61||_===62||_===96?a(_):_===34||_===39?(t.consume(_),p=_,H):Ze(_)?(t.consume(_),T):$(_)}function H(_){return _===p?(t.consume(_),p=null,W):_===null||ze(_)?a(_):(t.consume(_),H)}function $(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||St(_)?q(_):(t.consume(_),$)}function W(_){return _===47||_===62||Ze(_)?z(_):a(_)}function M(_){return _===62?(t.consume(_),ie):a(_)}function ie(_){return _===null||ze(_)?Q(_):Ze(_)?(t.consume(_),ie):a(_)}function Q(_){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(lR,it,ae)(_)):_===null||ze(_)?(t.exit("htmlFlowData"),ae(_)):(t.consume(_),Q)}function ae(_){return t.check(sR,le,it)(_)}function le(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),ne}function ne(_){return _===null||ze(_)?ae(_):(t.enter("htmlFlowData"),Q(_))}function Z(_){return _===45?(t.consume(_),O):Q(_)}function ce(_){return _===47?(t.consume(_),d="",me):Q(_)}function me(_){if(_===62){const D=d.toLowerCase();return f0.includes(D)?(t.consume(_),Be):Q(_)}return Nn(_)&&d.length<8?(t.consume(_),d+=String.fromCharCode(_),me):Q(_)}function Re(_){return _===93?(t.consume(_),O):Q(_)}function O(_){return _===62?(t.consume(_),Be):_===45&&o===2?(t.consume(_),O):Q(_)}function Be(_){return _===null||ze(_)?(t.exit("htmlFlowData"),it(_)):(t.consume(_),Be)}function it(_){return t.exit("htmlFlow"),r(_)}}function cR(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 dR(t,r,a){return l;function l(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Qo,r,a)}}const fR={name:"htmlText",tokenize:hR};function hR(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),z):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?k:C):a(O)}function k(O){return O===null?a(O):O===93?(t.consume(O),E):ze(O)?(d=k,ce(O)):(t.consume(O),k)}function E(O){return O===93?(t.consume(O),j):k(O)}function j(O){return O===62?Z(O):O===93?(t.consume(O),j):k(O)}function A(O){return O===null||O===62?Z(O):ze(O)?(d=A,ce(O)):(t.consume(O),A)}function z(O){return O===null?a(O):O===63?(t.consume(O),Y):ze(O)?(d=z,ce(O)):(t.consume(O),z)}function Y(O){return O===62?Z(O):z(O)}function q(O){return Nn(O)?(t.consume(O),T):a(O)}function T(O){return O===45||pn(O)?(t.consume(O),T):H(O)}function H(O){return ze(O)?(d=H,ce(O)):Ze(O)?(t.consume(O),H):Z(O)}function $(O){return O===45||pn(O)?(t.consume(O),$):O===47||O===62||St(O)?W(O):a(O)}function W(O){return O===47?(t.consume(O),Z):O===58||O===95||Nn(O)?(t.consume(O),M):ze(O)?(d=W,ce(O)):Ze(O)?(t.consume(O),W):Z(O)}function M(O){return O===45||O===46||O===58||O===95||pn(O)?(t.consume(O),M):ie(O)}function ie(O){return O===61?(t.consume(O),Q):ze(O)?(d=ie,ce(O)):Ze(O)?(t.consume(O),ie):W(O)}function Q(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(t.consume(O),o=O,ae):ze(O)?(d=Q,ce(O)):Ze(O)?(t.consume(O),Q):(t.consume(O),le)}function ae(O){return O===o?(t.consume(O),o=void 0,ne):O===null?a(O):ze(O)?(d=ae,ce(O)):(t.consume(O),ae)}function le(O){return O===null||O===34||O===39||O===60||O===61||O===96?a(O):O===47||O===62||St(O)?W(O):(t.consume(O),le)}function ne(O){return O===47||O===62||St(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)?at(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 Op={name:"labelEnd",resolveAll:yR,resolveTo:xR,tokenize:bR},mR={tokenize:vR},pR={tokenize:wR},gR={tokenize:SR};function yR(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&&Xn(t,0,t.length,a),t}function xR(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,Xc(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]]),Xn(t,u,t.length,m),t}function bR(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(mR,x,d?x:g)(b):b===91?t.attempt(pR,x,d?y:g)(b):d?x(b):g(b)}function y(b){return t.attempt(gR,x,g)(b)}function x(b){return r(b)}function g(b){return u._balanced=!0,a(b)}}function vR(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 St(g)?bo(t,u)(g):u(g)}function u(g){return g===41?x(g):Rw(t,d,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function d(g){return St(g)?bo(t,p)(g):x(g)}function m(g){return a(g)}function p(g){return g===34||g===39||g===40?zw(t,y,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):x(g)}function y(g){return St(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 wR(t,r,a){const l=this;return o;function o(m){return Mw.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 SR(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 NR={name:"labelStartImage",resolveAll:Op.resolveAll,tokenize:CR};function CR(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 jR={name:"labelStartLink",resolveAll:Op.resolveAll,tokenize:ER};function ER(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 Jh={name:"lineEnding",tokenize:kR};function kR(t,r){return a;function a(l){return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),at(t,r,"linePrefix")}}const Ac={name:"thematicBreak",tokenize:TR};function TR(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)?at(t,m,"whitespace")(y):m(y))}}const zn={continuation:{tokenize:MR},exit:DR,name:"list",tokenize:RR},AR={partial:!0,tokenize:_R},OR={partial:!0,tokenize:zR};function RR(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:qm(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(Ac,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 qm(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(Qo,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 MR(t,r,a){const l=this;return l.containerState._closeFlow=void 0,t.check(Qo,o,u);function o(m){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,at(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(OR,r,d)(m))}function d(m){return l.containerState._closeFlow=!0,l.interrupt=void 0,at(t,t.attempt(zn,r,a),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function zR(t,r,a){const l=this;return at(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 DR(t){t.exit(this.containerState.type)}function _R(t,r,a){const l=this;return at(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 h0={name:"setextUnderline",resolveTo:LR,tokenize:UR};function LR(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 UR(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)?at(t,p,"lineSuffix")(y):p(y))}function p(y){return y===null||ze(y)?(t.exit("setextHeadingLine"),r(y)):a(y)}}const qR={tokenize:HR};function HR(t){const r=this,a=t.attempt(Qo,l,t.attempt(this.parser.constructs.flowInitial,o,at(t,t.attempt(this.parser.constructs.flow,o,t.attempt(Q3,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 BR={resolveAll:_w()},FR=Dw("string"),IR=Dw("text");function Dw(t){return{resolveAll:_w(t==="text"?PR: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 _w(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 PR(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 QR={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:kw},YR={91:X3},VR={[-2]:Zh,[-1]:Zh,32:Zh},GR={35:tR,42:Ac,45:[h0,Ac],60:iR,61:h0,95:Ac,96:d0,126:d0},KR={38:Aw,92:Tw},XR={[-5]:Jh,[-4]:Jh,[-3]:Jh,33:NR,38:Aw,42:Hm,60:[j3,fR],91:jR,92:[W3,Tw],93:Op,95:Hm,96:q3},$R={null:[Hm,BR]},ZR={null:[42,95]},JR={null:[]},WR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ZR,contentInitial:YR,disable:JR,document:QR,flow:GR,flowInitial:VR,insideSpan:$R,string:KR,text:XR},Symbol.toStringTag,{value:"Module"}));function e4(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:H(q),check:H(T),consume:A,enter:z,exit:Y,interrupt:H(T,{interrupt:!0})},y={code:null,containerState:{},defineSkip:k,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(ie){return d=ur(d,ie),E(),d[d.length-1]!==null?[]:($(r,0),y.events=Xc(u,y.events,y),y.events)}function b(ie,Q){return n4(w(ie),Q)}function w(ie){return t4(d,ie)}function C(){const{_bufferIndex:ie,_index:Q,line:ae,column:le,offset:ne}=l;return{_bufferIndex:ie,_index:Q,line:ae,column:le,offset:ne}}function k(ie){o[ie.line]=ie.column,M()}function E(){let ie;for(;l._index<d.length;){const Q=d[l._index];if(typeof Q=="string")for(ie=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===ie&&l._bufferIndex<Q.length;)j(Q.charCodeAt(l._bufferIndex));else j(Q)}}function j(ie){x=x(ie)}function A(ie){ze(ie)?(l.line++,l.column=1,l.offset+=ie===-3?2:1,M()):ie!==-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=ie}function z(ie,Q){const ae=Q||{};return ae.type=ie,ae.start=C(),y.events.push(["enter",ae,y]),m.push(ae),ae}function Y(ie){const Q=m.pop();return Q.end=C(),y.events.push(["exit",Q,y]),Q}function q(ie,Q){$(ie,Q.from)}function T(ie,Q){Q.restore()}function H(ie,Q){return ae;function ae(le,ne,Z){let ce,me,Re,O;return Array.isArray(le)?it(le):"tokenize"in le?it([le]):Be(le);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 it(ye)(Oe)}}function it(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)?re():he.tokenize.call(Q?Object.assign(Object.create(y),Q):y,p,D,re)(Oe)}}function D(he){return ie(Re,O),ne}function re(he){return O.restore(),++me<ce.length?_(ce[me]):Z}}}function $(ie,Q){ie.resolveAll&&!u.includes(ie)&&u.push(ie),ie.resolve&&Xn(y.events,Q,y.events.length-Q,ie.resolve(y.events.slice(Q),y)),ie.resolveTo&&(y.events=ie.resolveTo(y.events,y))}function W(){const ie=C(),Q=y.previous,ae=y.currentConstruct,le=y.events.length,ne=Array.from(m);return{from:le,restore:Z};function Z(){l=ie,y.previous=Q,y.currentConstruct=ae,y.events.length=le,m=ne,M()}}function M(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function t4(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 n4(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=`
231
- `;break}case-3:{d=`\r
232
- `;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 r4(t){const l={constructs:jw([WR,...(t||{}).extensions||[]]),content:o(x3),defined:[],document:o(v3),flow:o(qR),lazy:{},string:o(FR),text:o(IR)};return l;function o(u){return d;function d(m){return e4(l,u,m)}}}function a4(t){for(;!Ow(t););return t}const m0=/[\0\t\n\r]/g;function i4(){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(m0.lastIndex=g,y=m0.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 l4=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function s4(t){return t.replace(l4,o4)}function o4(t,r,a){if(r)return r;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),u=o===120||o===88;return Ew(a.slice(u?2:1),u?16:10)}return Ap(a)||t}const Lw={}.hasOwnProperty;function u4(t,r,a){return r&&typeof r=="object"&&(a=r,r=void 0),c4(a)(a4(r4(a).document().write(i4()(t,r,!0))))}function c4(t){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(ht),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(Ee,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(nt,d),htmlFlowData:W,htmlText:u(nt,d),htmlTextData:W,image:u(Qe),label:d,link:u(ht),listItem:u(Ct),listItemValue:b,listOrdered:u(Mt,g),listUnordered:u(Mt),paragraph:u(fe),reference:_,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(se),strong:u(ge),thematicBreak:u(Ft)},exit:{atxHeading:p(),atxHeadingSequence:q,autolink:p(),autolinkEmail:Me,autolinkProtocol:Oe,blockQuote:p(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:he,characterReference:xe,codeFenced:p(E),codeFencedFence:k,codeFencedFenceInfo:w,codeFencedFenceMeta:C,codeFlowValue:M,codeIndented:p(j),codeText:p(ne),codeTextData:M,data:M,definition:p(),definitionDestinationString:Y,definitionLabelString:A,definitionTitleString:z,emphasis:p(),hardBreakEscape:p(Q),hardBreakTrailing:p(Q),htmlFlow:p(ae),htmlFlowData:M,htmlText:p(le),htmlTextData:M,image:p(ce),label:Re,labelText:me,lineEnding:ie,link:p(Z),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:D,resourceDestinationString:O,resourceTitleString:Be,resource:it,setextHeading:p($),setextHeadingLineSequence:H,setextHeadingText:T,strong:p(),thematicBreak:p()}};Uw(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]];Lw.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]||p0).call(be,void 0,nn[0])}for(K.position={start:Ia(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:Ia(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,jn,fr,hr;for(;++Te<=be;){const It=J[Te];switch(It[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{It[0]==="enter"?Ye++:Ye--,hr=void 0;break}case"lineEndingBlank":{It[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&&It[0]==="enter"&&It[1].type==="listItemPrefix"||Ye===-1&&It[0]==="exit"&&(It[1].type==="listUnordered"||It[1].type==="listOrdered")){if(Jn){let mr=Te;for(jn=void 0;mr--;){const En=J[mr];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;jn&&(J[jn][1].type="lineEndingBlank",nn=!0),En[1].type="lineEnding",jn=mr}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}fr&&(!jn||fr<jn)&&(Jn._spread=!0),Jn.end=Object.assign({},jn?J[jn][1].start:It[1].end),J.splice(jn||Te,0,["exit",Jn,It[2]]),Te++,be++}if(It[1].type==="listItemPrefix"){const mr={type:"listItem",_spread:!1,start:Object.assign({},It[1].start),end:void 0};Jn=mr,J.splice(Te,0,["enter",mr,It[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:Ia(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]||p0).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=Ia(J.end)}function x(){return Tp(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 k(){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 j(){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 z(){const J=this.resume(),K=this.stack[this.stack.length-1];K.title=J}function Y(){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 T(){this.data.setextHeadingSlurpLineEnding=!0}function H(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:Ia(J.start),end:void 0},be.push(Te)),this.stack.push(Te)}function M(J){const K=this.stack.pop();K.value+=this.sliceSerialize(J),K.position.end=Ia(J.end)}function ie(J){const K=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=K.children[K.children.length-1];be.position.end=Ia(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(K.type)&&(W.call(this,J),M.call(this,J))}function Q(){this.data.atHardBreak=!0}function ae(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J}function le(){const J=this.resume(),K=this.stack[this.stack.length-1];K.value=J}function ne(){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=s4(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 it(){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 re(J){this.data.characterReferenceType=J.type}function he(J){const K=this.sliceSerialize(J),be=this.data.characterReferenceType;let Te;be?(Te=Ew(K,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Ap(K);const Ye=this.stack[this.stack.length-1];Ye.value+=Te}function xe(J){const K=this.stack.pop();K.position.end=Ia(J.end)}function Oe(J){M.call(this,J);const K=this.stack[this.stack.length-1];K.url=this.sliceSerialize(J)}function Me(J){M.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 Ee(){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 nt(){return{type:"html",value:""}}function Qe(){return{type:"image",title:null,url:"",alt:null}}function ht(){return{type:"link",title:null,url:"",children:[]}}function Mt(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 Ft(){return{type:"thematicBreak"}}}function Ia(t){return{line:t.line,column:t.column,offset:t.offset}}function Uw(t,r){let a=-1;for(;++a<r.length;){const l=r[a];Array.isArray(l)?Uw(t,l):d4(t,l)}}function d4(t,r){let a;for(a in r)if(Lw.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 p0(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 f4(t){const r=this;r.parser=a;function a(l){return u4(l,{...r.data("settings"),...t,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function h4(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 m4(t,r){const a={type:"element",tagName:"br",properties:{},children:[]};return t.patch(r,a),[t.applyData(r,a),{type:"text",value:`
233
- `}]}function p4(t,r){const a=r.value?r.value+`
234
- `:"",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 g4(t,r){const a={type:"element",tagName:"del",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function y4(t,r){const a={type:"element",tagName:"em",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function x4(t,r){const a=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",l=String(r.identifier).toUpperCase(),o=ls(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 b4(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 v4(t,r){if(t.options.allowDangerousHtml){const a={type:"raw",value:r.value};return t.patch(r,a),t.applyData(r,a)}}function qw(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 w4(t,r){const a=String(r.identifier).toUpperCase(),l=t.definitionById.get(a);if(!l)return qw(t,r);const o={src:ls(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 S4(t,r){const a={src:ls(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 N4(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 C4(t,r){const a=String(r.identifier).toUpperCase(),l=t.definitionById.get(a);if(!l)return qw(t,r);const o={href:ls(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 j4(t,r){const a={href:ls(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 E4(t,r,a){const l=t.all(r),o=a?k4(a):Hw(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:`
235
- `}),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:`
236
- `});const y={type:"element",tagName:"li",properties:u,children:d};return t.patch(r,y),t.applyData(r,y)}function k4(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=Hw(a[l])}return r}function Hw(t){const r=t.spread;return r??t.children.length>1}function T4(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 A4(t,r){const a={type:"element",tagName:"p",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function O4(t,r){const a={type:"root",children:t.wrap(t.all(r))};return t.patch(r,a),t.applyData(r,a)}function R4(t,r){const a={type:"element",tagName:"strong",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}function M4(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=Cp(r.children[1]),p=xw(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 z4(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 D4(t,r){const a={type:"element",tagName:"td",properties:{},children:t.all(r)};return t.patch(r,a),t.applyData(r,a)}const g0=9,y0=32;function _4(t){const r=String(t),a=/\r?\n|\r/g;let l=a.exec(r),o=0;const u=[];for(;l;)u.push(x0(r.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=a.exec(r);return u.push(x0(r.slice(o),o>0,!1)),u.join("")}function x0(t,r,a){let l=0,o=t.length;if(r){let u=t.codePointAt(l);for(;u===g0||u===y0;)l++,u=t.codePointAt(l)}if(a){let u=t.codePointAt(o-1);for(;u===g0||u===y0;)o--,u=t.codePointAt(o-1)}return o>l?t.slice(l,o):""}function L4(t,r){const a={type:"text",value:_4(String(r.value))};return t.patch(r,a),t.applyData(r,a)}function U4(t,r){const a={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(r,a),t.applyData(r,a)}const q4={blockquote:h4,break:m4,code:p4,delete:g4,emphasis:y4,footnoteReference:x4,heading:b4,html:v4,imageReference:w4,image:S4,inlineCode:N4,linkReference:C4,link:j4,listItem:E4,list:T4,paragraph:A4,root:O4,strong:R4,table:M4,tableCell:D4,tableRow:z4,text:L4,thematicBreak:U4,toml:Sc,yaml:Sc,definition:Sc,footnoteDefinition:Sc};function Sc(){}const Bw=-1,$c=0,vo=1,Dc=2,Rp=3,Mp=4,zp=5,Dp=6,Fw=7,Iw=8,{defineProperty:H4}=Object,Pw=typeof self=="object"?self:globalThis,b0=(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 Pw[t](r)},B4=(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 $c:case Bw:return a(d,o);case vo:{const m=a([],o);for(const p of d)m.push(l(p));return m}case Dc:{const m=a({},o);for(const[p,y]of d){const x=l(p),g=l(y);x==="__proto__"?H4(m,x,{value:g,configurable:!0,enumerable:!0,writable:!0}):m[x]=g}return m}case Rp:return a(new Date(d),o);case Mp:{const{source:m,flags:p}=d;return a(new RegExp(m,p),o)}case zp:{const m=a(new Map,o);for(const[p,y]of d)m.set(l(p),l(y));return m}case Dp:{const m=a(new Set,o);for(const p of d)m.add(l(p));return m}case Fw:{const{name:m,message:p}=d;return a(typeof Pw[m]=="function"?b0(m,p):new Error(p),o)}case Iw: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(b0(u,d),o)};return l},v0=t=>B4(new Map,t)(0),Ci="",{toString:F4}={},{keys:I4,is:P4}=Object,co=t=>{const r=typeof t;if(r!=="object"||!t)return[$c,r];const a=F4.call(t).slice(8,-1);switch(a){case"Array":return[vo,Ci];case"Object":return[Dc,Ci];case"Date":return[Rp,Ci];case"RegExp":return[Mp,Ci];case"Map":return[zp,Ci];case"Set":return[Dp,Ci];case"DataView":return[vo,a]}return a.includes("Array")?[vo,a]:t instanceof Error?[Fw,t.name||"Error"]:[Dc,a]},Nc=([t,r])=>t===$c&&(r==="function"||r==="symbol"),Q4=(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]=co(d);switch(m){case $c:{let x=d;switch(p){case"bigint":m=Iw,x=d.toString();break;case"number":if(!d&&P4(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([Bw],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 Dc:{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 I4(d))(t||!Nc(co(d[b])))&&x.push([u(b),u(d[b])]);return g}case Rp:return o([m,isNaN(d.getTime())?Ci:d.toISOString()],d);case Mp:{const{source:x,flags:g}=d;return o([m,{source:x,flags:g}],d)}case zp:{const x=[],g=o([m,x],d);for(const[b,w]of d)(t||!(Nc(co(b))||Nc(co(w))))&&x.push([u(b),u(w)]);return g}case Dp:{const x=[],g=o([m,x],d);for(const b of d)(t||!Nc(co(b)))&&x.push(u(b));return g}}const{message:y}=d;return o([m,{name:p,message:y}],d)};return u},w0=(t,{json:r,lossy:a}={})=>{const l=[];return Q4(!(r||a),!!r,new Map,l)(t),l},_c=typeof structuredClone=="function"?(t,r)=>r&&("json"in r||"lossy"in r)?v0(w0(t,r)):structuredClone(t):(t,r)=>v0(w0(t,r));function Y4(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 V4(t,r){return"Back to reference "+(t+1)+(r>1?"-"+r:"")}function G4(t){const r=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=t.options.footnoteBackContent||Y4,l=t.options.footnoteBackLabel||V4,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=ls(g.toLowerCase());let w=0;const C=[],k=t.footnoteCounts.get(g);for(;k!==void 0&&++w<=k;){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 j={type:"element",tagName:"li",properties:{id:r+"fn-"+b},children:t.wrap(x,!0)};t.patch(y,j),m.push(j)}if(m.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{..._c(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
237
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(m,!0)},{type:"text",value:`
238
- `}]}}const Zc=(function(t){if(t==null)return Z4;if(typeof t=="function")return Jc(t);if(typeof t=="object")return Array.isArray(t)?K4(t):X4(t);if(typeof t=="string")return $4(t);throw new Error("Expected function, string, or object as test")});function K4(t){const r=[];let a=-1;for(;++a<t.length;)r[a]=Zc(t[a]);return Jc(l);function l(...o){let u=-1;for(;++u<r.length;)if(r[u].apply(this,o))return!0;return!1}}function X4(t){const r=t;return Jc(a);function a(l){const o=l;let u;for(u in t)if(o[u]!==r[u])return!1;return!0}}function $4(t){return Jc(r);function r(a){return a&&a.type===t}}function Jc(t){return r;function r(a,l,o){return!!(J4(a)&&t.call(this,a,typeof l=="number"?l:void 0,o||void 0))}}function Z4(){return!0}function J4(t){return t!==null&&typeof t=="object"&&"type"in t}const Qw=[],W4=!0,Bm=!1,eM="skip";function Yw(t,r,a,l){let o;typeof r=="function"&&typeof a!="function"?(l=a,a=r):o=r;const u=Zc(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=Qw,C,k,E;if((!r||u(p,y,x[x.length-1]||void 0))&&(w=tM(a(p,x)),w[0]===Bm))return w;if("children"in p&&p.children){const j=p;if(j.children&&w[0]!==eM)for(k=(l?j.children.length:-1)+d,E=x.concat(j);k>-1&&k<j.children.length;){const A=j.children[k];if(C=m(A,k,E)(),C[0]===Bm)return C;k=typeof C[1]=="number"?C[1]:k+d}}return w}}}function tM(t){return Array.isArray(t)?t:typeof t=="number"?[W4,t]:t==null?Qw:[t]}function _p(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),Yw(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 Fm={}.hasOwnProperty,nM={};function rM(t,r){const a=r||nM,l=new Map,o=new Map,u=new Map,d={...q4,...a.handlers},m={all:y,applyData:iM,definitionById:l,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:p,options:a,patch:aM,wrap:sM};return _p(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(Fm.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:k,...E}=x,j=_c(E);return j.children=m.all(x),j}return _c(x)}return(m.options.unknownHandler||lM)(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=S0(C.value)),!Array.isArray(C)&&C.type==="element")){const k=C.children[0];k&&k.type==="text"&&(k.value=S0(k.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function aM(t,r){t.position&&(r.position=QO(t))}function iM(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,_c(u)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function lM(t,r){const a=r.data||{},l="value"in r&&!(Fm.call(a,"hProperties")||Fm.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 sM(t,r){const a=[];let l=-1;for(r&&a.push({type:"text",value:`
239
- `});++l<t.length;)l&&a.push({type:"text",value:`
240
- `}),a.push(t[l]);return r&&t.length>0&&a.push({type:"text",value:`
241
- `}),a}function S0(t){let r=0,a=t.charCodeAt(r);for(;a===9||a===32;)r++,a=t.charCodeAt(r);return t.slice(r)}function N0(t,r){const a=rM(t,r),l=a.one(t,void 0),o=G4(a),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
242
- `},o),u}function oM(t,r){return t&&"run"in t?async function(a,l){const o=N0(a,{file:l,...r});await t.run(o,l)}:function(a,l){return N0(a,{file:l,...t||r})}}function C0(t){if(t)throw t}var Wh,j0;function uM(){if(j0)return Wh;j0=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 Wh=function p(){var y,x,g,b,w,C,k=arguments[0],E=1,j=arguments.length,A=!1;for(typeof k=="boolean"&&(A=k,k=arguments[1]||{},E=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});E<j;++E)if(y=arguments[E],y!=null)for(x in y)g=m(k,x),b=m(y,x),k!==b&&(A&&b&&(u(b)||(w=o(b)))?(w?(w=!1,C=g&&o(g)?g:[]):C=g&&u(g)?g:{},d(k,{name:x,newValue:p(A,C,b)})):typeof b<"u"&&d(k,{name:x,newValue:b}));return k},Wh}var cM=uM();const em=Vm(cM);function Im(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 dM(){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?fM(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 fM(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:hM,dirname:mM,extname:pM,join:gM,sep:"/"};function hM(t,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');Yo(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 mM(t){if(Yo(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 pM(t){Yo(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 gM(...t){let r=-1,a;for(;++r<t.length;)Yo(t[r]),t[r]&&(a=a===void 0?t[r]:a+"/"+t[r]);return a===void 0?".":yM(a)}function yM(t){Yo(t);const r=t.codePointAt(0)===47;let a=xM(t,!r);return a.length===0&&!r&&(a="."),a.length>0&&t.codePointAt(t.length-1)===47&&(a+="/"),r?"/"+a:a}function xM(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 Yo(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const bM={cwd:vM};function vM(){return"/"}function Pm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function wM(t){if(typeof t=="string")t=new URL(t);else if(!Pm(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 SM(t)}function SM(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 tm=["history","path","basename","stem","extname","dirname"];class Vw{constructor(r){let a;r?Pm(r)?a={path:r}:typeof r=="string"||NM(r)?a={value:r}:a=r:a={},this.cwd="cwd"in a?"":bM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<tm.length;){const u=tm[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)tm.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(r){rm(r,"basename"),nm(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){E0(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(nm(r,"extname"),E0(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){Pm(r)&&(r=wM(r)),rm(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){rm(r,"stem"),nm(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 nm(t,r){if(t&&t.includes(qr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+qr.sep+"`")}function rm(t,r){if(!t)throw new Error("`"+r+"` cannot be empty")}function E0(t,r){if(!t)throw new Error("Setting `"+r+"` requires `path` to be set too")}function NM(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const CM=(function(t){const l=this.constructor.prototype,o=l[t],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),jM={}.hasOwnProperty;class Lp extends CM{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=dM()}copy(){const r=new Lp;let a=-1;for(;++a<this.attachers.length;){const l=this.attachers[a];r.use(...l)}return r.data(em(!0,{},this.namespace)),r}data(r,a){return typeof r=="string"?arguments.length===2?(lm("data",this.frozen),this.namespace[r]=a,this):jM.call(this.namespace,r)&&this.namespace[r]||void 0:r?(lm("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=Cc(r),l=this.parser||this.Parser;return am("parse",l),l(String(a),a)}process(r,a){const l=this;return this.freeze(),am("process",this.parser||this.Parser),im("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(u,d){const m=Cc(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);TM(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(),am("processSync",this.parser||this.Parser),im("processSync",this.compiler||this.Compiler),this.process(r,o),T0("processSync","process",a),l;function o(u,d){a=!0,C0(u),l=d}}run(r,a,l){k0(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=Cc(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),T0("runSync","run",l),o;function u(d,m){C0(d),o=m,l=!0}}stringify(r,a){this.freeze();const l=Cc(a),o=this.compiler||this.Compiler;return im("stringify",o),k0(r),o(r,l)}use(r,...a){const l=this.attachers,o=this.namespace;if(lm("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=em(!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 k=l[b][1];Im(k)&&Im(w)&&(w=em(!0,k,w)),l[b]=[y,w,...C]}}}}const EM=new Lp().freeze();function am(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function im(t,r){if(typeof r!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function lm(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 k0(t){if(!Im(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function T0(t,r,a){if(!a)throw new Error("`"+t+"` finished async. Use `"+r+"` instead")}function Cc(t){return kM(t)?t:new Vw(t)}function kM(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function TM(t){return typeof t=="string"||AM(t)}function AM(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const OM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",A0=[],O0={allowDangerousHtml:!0},RM=/^(https?|ircs?|mailto|xmpp)$/i,MM=[{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 zM(t){const r=DM(t),a=_M(t);return LM(r.runSync(r.parse(a),a),t)}function DM(t){const r=t.rehypePlugins||A0,a=t.remarkPlugins||A0,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...O0}:O0;return EM().use(f4).use(a).use(oM,l).use(r)}function _M(t){const r=t.children||"",a=new Vw;return typeof r=="string"&&(a.value=r),a}function LM(t,r){const a=r.allowedElements,l=r.allowElement,o=r.components,u=r.disallowedElements,d=r.skipHtml,m=r.unwrapDisallowed,p=r.urlTransform||UM;for(const x of MM)Object.hasOwn(r,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+OM+x.id,void 0);return _p(t,y),XO(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 $h)if(Object.hasOwn($h,w)&&Object.hasOwn(x.properties,w)){const C=x.properties[w],k=$h[w];(k===null||k.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 UM(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||RM.test(t.slice(0,r))?t:""}function R0(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 qM(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function HM(t,r,a){const o=Zc((a||{}).ignore||[]),u=BM(r);let d=-1;for(;++d<u.length;)Yw(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 j=!1,A=[];b.lastIndex=0;let z=b.exec(y.value);for(;z;){const Y=z.index,q={index:z.index,input:z.input,stack:[...x,y]};let T=w(...z,q);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?b.lastIndex=Y+1:(C!==Y&&A.push({type:"text",value:y.value.slice(C,Y)}),Array.isArray(T)?A.push(...T):T&&A.push(T),C=Y+z[0].length,j=!0),!b.global)break;z=b.exec(y.value)}return j?(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 BM(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([FM(o[0]),IM(o[1])])}return r}function FM(t){return typeof t=="string"?new RegExp(qM(t),"g"):t}function IM(t){return typeof t=="function"?t:function(){return t}}const sm="phrasing",om=["autolink","link","image","label"];function PM(){return{transforms:[$M],enter:{literalAutolink:YM,literalAutolinkEmail:um,literalAutolinkHttp:um,literalAutolinkWww:um},exit:{literalAutolink:XM,literalAutolinkEmail:KM,literalAutolinkHttp:VM,literalAutolinkWww:GM}}}function QM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sm,notInConstruct:om},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sm,notInConstruct:om},{character:":",before:"[ps]",after:"\\/",inConstruct:sm,notInConstruct:om}]}}function YM(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function um(t){this.config.enter.autolinkProtocol.call(this,t)}function VM(t){this.config.exit.autolinkProtocol.call(this,t)}function GM(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 KM(t){this.config.exit.autolinkEmail.call(this,t)}function XM(t){this.exit(t)}function $M(t){HM(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ZM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),JM]],{ignore:["link","linkReference"]})}function ZM(t,r,a,l,o){let u="";if(!Gw(o)||(/^w/i.test(r)&&(a=r+a,r="",u="http://"),!WM(a)))return!1;const d=ez(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 JM(t,r,a,l){return!Gw(l,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+a,children:[{type:"text",value:r+"@"+a}]}}function WM(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 ez(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=R0(t,"(");let u=R0(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 Gw(t,r){const a=t.input.charCodeAt(t.index-1);return(t.index===0||Bi(a)||Kc(a))&&(!r||a!==47)}Kw.peek=uz;function tz(){this.buffer()}function nz(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function rz(){this.buffer()}function az(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function iz(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 lz(t){this.exit(t)}function sz(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 oz(t){this.exit(t)}function uz(){return"["}function Kw(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 cz(){return{enter:{gfmFootnoteCallString:tz,gfmFootnoteCall:nz,gfmFootnoteDefinitionLabelString:rz,gfmFootnoteDefinition:az},exit:{gfmFootnoteCallString:iz,gfmFootnoteCall:lz,gfmFootnoteDefinitionLabelString:sz,gfmFootnoteDefinition:oz}}}function dz(t){let r=!1;return t&&t.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:a,footnoteReference:Kw},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?`
243
- `:" ")+u.indentLines(u.containerFlow(l,m.current()),r?Xw:fz))),y(),p}}function fz(t,r,a){return r===0?t:Xw(t,r,a)}function Xw(t,r,a){return(a?"":" ")+t}const hz=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];$w.peek=xz;function mz(){return{canContainEols:["delete"],enter:{strikethrough:gz},exit:{strikethrough:yz}}}function pz(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:hz}],handlers:{delete:$w}}}function gz(t){this.enter({type:"delete",children:[]},t)}function yz(t){this.exit(t)}function $w(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 xz(){return"~"}function bz(t){return t.length}function vz(t,r){const a=r||{},l=(a.align||[]).concat(),o=a.stringLength||bz,u=[],d=[],m=[],p=[];let y=0,x=-1;for(;++x<t.length;){const k=[],E=[];let j=-1;for(t[x].length>y&&(y=t[x].length);++j<t[x].length;){const A=wz(t[x][j]);if(a.alignDelimiters!==!1){const z=o(A);E[j]=z,(p[j]===void 0||z>p[j])&&(p[j]=z)}k.push(A)}d[x]=k,m[x]=E}let g=-1;if(typeof l=="object"&&"length"in l)for(;++g<y;)u[g]=M0(l[g]);else{const k=M0(l);for(;++g<y;)u[g]=k}g=-1;const b=[],w=[];for(;++g<y;){const k=u[g];let E="",j="";k===99?(E=":",j=":"):k===108?E=":":k===114&&(j=":");let A=a.alignDelimiters===!1?1:Math.max(1,p[g]-E.length-j.length);const z=E+"-".repeat(A)+j;a.alignDelimiters!==!1&&(A=E.length+A+j.length,A>p[g]&&(p[g]=A),w[g]=A),b[g]=z}d.splice(1,0,b),m.splice(1,0,w),x=-1;const C=[];for(;++x<d.length;){const k=d[x],E=m[x];g=-1;const j=[];for(;++g<y;){const A=k[g]||"";let z="",Y="";if(a.alignDelimiters!==!1){const q=p[g]-(E[g]||0),T=u[g];T===114?z=" ".repeat(q):T===99?q%2?(z=" ".repeat(q/2+.5),Y=" ".repeat(q/2-.5)):(z=" ".repeat(q/2),Y=z):Y=" ".repeat(q)}a.delimiterStart!==!1&&!g&&j.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&A==="")&&(a.delimiterStart!==!1||g)&&j.push(" "),a.alignDelimiters!==!1&&j.push(z),j.push(A),a.alignDelimiters!==!1&&j.push(Y),a.padding!==!1&&j.push(" "),(a.delimiterEnd!==!1||g!==y-1)&&j.push("|")}C.push(a.delimiterEnd===!1?j.join("").replace(/ +$/,""):j.join(""))}return C.join(`
244
- `)}function wz(t){return t==null?"":String(t)}function M0(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 Sz(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()),Nz);return o(),d}function Nz(t,r,a){return">"+(a?"":" ")+t}function Cz(t,r){return z0(t,r.inConstruct,!0)&&!z0(t,r.notInConstruct,!1)}function z0(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 D0(t,r,a,l){let o=-1;for(;++o<a.unsafe.length;)if(a.unsafe[o].character===`
245
- `&&Cz(a.stack,a.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
246
- `}function jz(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 Ez(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 kz(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 Tz(t,r,a,l){const o=kz(a),u=t.value||"",d=o==="`"?"GraveAccent":"Tilde";if(Ez(t,a)){const g=a.enter("codeIndented"),b=a.indentLines(u,Az);return g(),b}const m=a.createTracker(l),p=o.repeat(Math.max(jz(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:`
247
- `,encode:["`"],...m.current()})),g()}return x+=m.move(`
248
- `),u&&(x+=m.move(u+`
249
- `)),x+=m.move(p),y(),x}function Az(t,r,a){return(a?"":" ")+t}function Up(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 Oz(t,r,a,l){const o=Up(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?" ":`
250
- `,...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 Rz(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 ko(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Lc(t,r,a){const l=es(t),o=es(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}}Zw.peek=Mz;function Zw(t,r,a,l){const o=Rz(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=Lc(l.before.charCodeAt(l.before.length-1),y,o);x.inside&&(p=ko(y)+p.slice(1));const g=p.charCodeAt(p.length-1),b=Lc(l.after.charCodeAt(0),g,o);b.inside&&(p=p.slice(0,-1)+ko(g));const w=d.move(o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},m+p+w}function Mz(t,r,a){return a.options.emphasis||"*"}function zz(t,r){let a=!1;return _p(t,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return a=!0,Bm}),!!((!t.depth||t.depth<3)&&Tp(t)&&(r.options.setext||a))}function Dz(t,r,a,l){const o=Math.max(Math.min(6,t.depth||1),1),u=a.createTracker(l);if(zz(t,a)){const x=a.enter("headingSetext"),g=a.enter("phrasing"),b=a.containerPhrasing(t,{...u.current(),before:`
251
- `,after:`
252
- `});return g(),x(),b+`
253
- `+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
254
- `))+1))}const d="#".repeat(o),m=a.enter("headingAtx"),p=a.enter("phrasing");u.move(d+" ");let y=a.containerPhrasing(t,{before:"# ",after:`
255
- `,...u.current()});return/^[\t ]/.test(y)&&(y=ko(y.charCodeAt(0))+y.slice(1)),y=y?d+" "+y:d,a.options.closeAtx&&(y+=" "+d),p(),m(),y}Jw.peek=_z;function Jw(t){return t.value||""}function _z(){return"<"}Ww.peek=Lz;function Ww(t,r,a,l){const o=Up(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 Lz(){return"!"}eS.peek=Uz;function eS(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 Uz(){return"!"}tS.peek=qz;function tS(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 qz(){return"`"}function nS(t,r){const a=Tp(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))}rS.peek=Hz;function rS(t,r,a,l){const o=Up(a),u=o==='"'?"Quote":"Apostrophe",d=a.createTracker(l);let m,p;if(nS(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 Hz(t,r,a){return nS(t,a)?"<":"["}aS.peek=Bz;function aS(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 Bz(){return"["}function qp(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 Fz(t){const r=qp(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 Iz(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 iS(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 Pz(t,r,a,l){const o=a.enter("list"),u=a.bulletCurrent;let d=t.ordered?Iz(a):qp(a);const m=t.ordered?d==="."?")":".":Fz(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),iS(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 Qz(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 Yz(t,r,a,l){const o=Qz(a);let u=a.bulletCurrent||qp(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 Vz(t,r,a,l){const o=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(t,l);return u(),o(),d}const Gz=Zc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Kz(t,r,a,l){return(t.children.some(function(d){return Gz(d)})?a.containerPhrasing:a.containerFlow).call(a,t,l)}function Xz(t){const r=t.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}lS.peek=$z;function lS(t,r,a,l){const o=Xz(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=Lc(l.before.charCodeAt(l.before.length-1),y,o);x.inside&&(p=ko(y)+p.slice(1));const g=p.charCodeAt(p.length-1),b=Lc(l.after.charCodeAt(0),g,o);b.inside&&(p=p.slice(0,-1)+ko(g));const w=d.move(o+o);return u(),a.attentionEncodeSurroundingInfo={after:b.outside,before:x.outside},m+p+w}function $z(t,r,a){return a.options.strong||"*"}function Zz(t,r,a,l){return a.safe(t.value,l)}function Jz(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 Wz(t,r,a){const l=(iS(a)+(a.options.ruleSpaces?" ":"")).repeat(Jz(a));return a.options.ruleSpaces?l.slice(0,-1):l}const sS={blockquote:Sz,break:D0,code:Tz,definition:Oz,emphasis:Zw,hardBreak:D0,heading:Dz,html:Jw,image:Ww,imageReference:eS,inlineCode:tS,link:rS,linkReference:aS,list:Pz,listItem:Yz,paragraph:Vz,root:Kz,strong:lS,text:Zz,thematicBreak:Wz};function eD(){return{enter:{table:tD,tableData:_0,tableHeader:_0,tableRow:rD},exit:{codeText:aD,table:nD,tableData:cm,tableHeader:cm,tableRow:cm}}}function tD(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 nD(t){this.exit(t),this.data.inTable=void 0}function rD(t){this.enter({type:"tableRow",children:[]},t)}function cm(t){this.exit(t)}function _0(t){this.enter({type:"tableCell",children:[]},t)}function aD(t){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,iD));const a=this.stack[this.stack.length-1];a.type,a.value=r,this.exit(t)}function iD(t,r){return r==="|"?r:t}function lD(t){const r=t||{},a=r.tableCellPadding,l=r.tablePipeAlign,o=r.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
256
- `,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,k,E){return y(x(w,k,E),w.align)}function m(w,C,k,E){const j=g(w,k,E),A=y([j]);return A.slice(0,A.indexOf(`
257
- `))}function p(w,C,k,E){const j=k.enter("tableCell"),A=k.enter("phrasing"),z=k.containerPhrasing(w,{...E,before:u,after:u});return A(),j(),z}function y(w,C){return vz(w,{align:C,alignDelimiters:l,padding:a,stringLength:o})}function x(w,C,k){const E=w.children;let j=-1;const A=[],z=C.enter("table");for(;++j<E.length;)A[j]=g(E[j],C,k);return z(),A}function g(w,C,k){const E=w.children;let j=-1;const A=[],z=C.enter("tableRow");for(;++j<E.length;)A[j]=p(E[j],w,C,k);return z(),A}function b(w,C,k){let E=sS.inlineCode(w,C,k);return k.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function sD(){return{exit:{taskListCheckValueChecked:L0,taskListCheckValueUnchecked:L0,paragraph:uD}}}function oD(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:cD}}}function L0(t){const r=this.stack[this.stack.length-2];r.type,r.checked=t.type==="taskListCheckValueChecked"}function uD(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 cD(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=sS.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 dD(){return[PM(),cz(),mz(),eD(),sD()]}function fD(t){return{extensions:[QM(),dz(t),pz(),lD(t),oD()]}}const hD={tokenize:bD,partial:!0},oS={tokenize:vD,partial:!0},uS={tokenize:wD,partial:!0},cS={tokenize:SD,partial:!0},mD={tokenize:ND,partial:!0},dS={name:"wwwAutolink",tokenize:yD,previous:hS},fS={name:"protocolAutolink",tokenize:xD,previous:mS},da={name:"emailAutolink",tokenize:gD,previous:pS},Pr={};function pD(){return{text:Pr}}let Si=48;for(;Si<123;)Pr[Si]=da,Si++,Si===58?Si=65:Si===91&&(Si=97);Pr[43]=da;Pr[45]=da;Pr[46]=da;Pr[95]=da;Pr[72]=[da,fS];Pr[104]=[da,fS];Pr[87]=[da,dS];Pr[119]=[da,dS];function gD(t,r,a){const l=this;let o,u;return d;function d(g){return!Qm(g)||!pS.call(l,l.previous)||Hp(l.events)?a(g):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),m(g))}function m(g){return Qm(g)?(t.consume(g),m):g===64?(t.consume(g),p):a(g)}function p(g){return g===46?t.check(mD,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 yD(t,r,a){const l=this;return o;function o(d){return d!==87&&d!==119||!hS.call(l,l.previous)||Hp(l.events)?a(d):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(hD,t.attempt(oS,t.attempt(uS,u),a),a)(d))}function u(d){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),r(d)}}function xD(t,r,a){const l=this;let o="",u=!1;return d;function d(g){return(g===72||g===104)&&mS.call(l,l.previous)&&!Hp(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||zc(g)||St(g)||Bi(g)||Kc(g)?a(g):t.attempt(oS,t.attempt(uS,x),a)(g)}function x(g){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),r(g)}}function bD(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 vD(t,r,a){let l,o,u;return d;function d(y){return y===46||y===95?t.check(cS,p,m)(y):y===null||St(y)||Bi(y)||y!==45&&Kc(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 wD(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(cS,r,u)(d):d===null||St(d)||Bi(d)?r(d):(t.consume(d),o)}function u(d){return d===41&&l++,t.consume(d),o}}function SD(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||St(m)||Bi(m)?r(m):a(m)}function o(m){return m===null||m===40||m===91||St(m)||Bi(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 ND(t,r,a){return l;function l(u){return t.consume(u),o}function o(u){return pn(u)?a(u):r(u)}}function hS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||St(t)}function mS(t){return!Nn(t)}function pS(t){return!(t===47||Qm(t))}function Qm(t){return t===43||t===45||t===46||t===95||pn(t)}function Hp(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 CD={tokenize:MD,partial:!0};function jD(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:AD,continuation:{tokenize:OD},exit:RD}},text:{91:{name:"gfmFootnoteCall",tokenize:TD},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ED,resolveTo:kD}}}}function ED(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 kD(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 TD(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||St(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 St(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 AD(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||St(C))return a(C);if(C===93){t.exit("chunkString");const k=t.exit("gfmFootnoteDefinitionLabelString");return u=Cr(l.sliceSerialize(k)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(C),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),b}return St(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),at(t,w,"gfmFootnoteDefinitionWhitespace")):a(C)}function w(C){return r(C)}}function OD(t,r,a){return t.check(Qo,r,t.attempt(CD,r,a))}function RD(t){t.exit("gfmFootnoteDefinition")}function MD(t,r,a){const l=this;return at(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 zD(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&&Xn(b,b.length,0,Xc(w,d.slice(y+1,p),m)),Xn(b,b.length,0,[["exit",g,m],["enter",d[p][1],m],["exit",d[p][1],m],["exit",x,m]]),Xn(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 k=es(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"),j=es(C);return E._open=!j||j===2&&!!k,E._close=!k||k===2&&!!j,m(C)}}}class DD{constructor(){this.map=[],this.index=new Map}add(r,a,l){_D(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 _D(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 LD(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 UD(){return{flow:{null:{name:"table",tokenize:qD,resolveAll:HD}}}}function qD(t,r,a){const l=this;let o=0,u=0,d;return m;function m(M){let ie=l.events.length-1;for(;ie>-1;){const{type:le}=l.events[ie][1];if(le==="lineEnding"||le==="linePrefix")ie--;else break}const Q=ie>-1?l.events[ie][1].type:null,ae=Q==="tableHead"||Q==="tableRow"?T:p;return ae===T&&l.parser.lazy[l.now().line]?a(M):ae(M)}function p(M){return t.enter("tableHead"),t.enter("tableRow"),y(M)}function y(M){return M===124||(d=!0,u+=1),x(M)}function x(M){return M===null?a(M):ze(M)?u>1?(u=0,l.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),w):a(M):Ze(M)?at(t,x,"whitespace")(M):(u+=1,d&&(d=!1,o+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),d=!0,x):(t.enter("data"),g(M)))}function g(M){return M===null||M===124||St(M)?(t.exit("data"),x(M)):(t.consume(M),M===92?b:g)}function b(M){return M===92||M===124?(t.consume(M),g):g(M)}function w(M){return l.interrupt=!1,l.parser.lazy[l.now().line]?a(M):(t.enter("tableDelimiterRow"),d=!1,Ze(M)?at(t,C,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):C(M))}function C(M){return M===45||M===58?E(M):M===124?(d=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),k):q(M)}function k(M){return Ze(M)?at(t,E,"whitespace")(M):E(M)}function E(M){return M===58?(u+=1,d=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),j):M===45?(u+=1,j(M)):M===null||ze(M)?Y(M):q(M)}function j(M){return M===45?(t.enter("tableDelimiterFiller"),A(M)):q(M)}function A(M){return M===45?(t.consume(M),A):M===58?(d=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),z):(t.exit("tableDelimiterFiller"),z(M))}function z(M){return Ze(M)?at(t,Y,"whitespace")(M):Y(M)}function Y(M){return M===124?C(M):M===null||ze(M)?!d||o!==u?q(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),r(M)):q(M)}function q(M){return a(M)}function T(M){return t.enter("tableRow"),H(M)}function H(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),H):M===null||ze(M)?(t.exit("tableRow"),r(M)):Ze(M)?at(t,H,"whitespace")(M):(t.enter("data"),$(M))}function $(M){return M===null||M===124||St(M)?(t.exit("data"),H(M)):(t.consume(M),M===92?W:$)}function W(M){return M===92||M===124?(t.consume(M),$):$(M)}}function HD(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 DD;for(;++a<t.length;){const w=t[a],C=w[1];w[0]==="enter"?C.type==="tableHead"?(m=!1,p!==0&&(U0(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=jc(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=jc(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=jc(b,r,u,o,a,g)):d[1]!==0&&(g=jc(b,r,d,o,a,g)),o=0):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(d[3]=a)}for(p!==0&&U0(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=LD(r.events,a))}return t}function jc(t,r,a,l,o,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",m="tableContent";a[0]!==0&&(u.end=Object.assign({},Ll(r.events,a[0])),t.add(a[0],0,[["exit",u,r]]));const p=Ll(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=Ll(r.events,a[2]),x=Ll(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,k=a[3]-a[2]-1;t.add(C,k,[])}}t.add(a[3]+1,0,[["exit",g,r]])}return o!==void 0&&(u.end=Object.assign({},Ll(r.events,o)),t.add(o,0,[["exit",u,r]]),u=void 0),u}function U0(t,r,a,l,o){const u=[],d=Ll(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 Ll(t,r){const a=t[r],l=a[0]==="enter"?"start":"end";return a[1][l]}const BD={name:"tasklistCheck",tokenize:ID};function FD(){return{text:{91:BD}}}function ID(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 St(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:PD},r,a)(p):a(p)}}function PD(t,r,a){return at(t,l,"whitespace");function l(o){return o===null?a(o):r(o)}}function QD(t){return jw([pD(),jD(),zD(t),UD(),FD()])}const YD={};function VD(t){const r=this,a=t||YD,l=r.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(QD(a)),u.push(dD()),d.push(fD(a))}function gS(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 GD=gS(!1),KD=gS(!0),yS=S.memo(function({children:r,inverted:a=!1}){return c.jsx(zM,{remarkPlugins:[VD],components:a?KD:GD,children:r})});function xS(t,r=!0){return Cn({queryKey:["attachment-blob",t],queryFn:()=>ue.attachments.blob(t),enabled:r,staleTime:1/0,gcTime:5*6e4})}function bS(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 q0=5;function Bp(t){return t<1024?`${t} B`:t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}const XD=t=>t.kind==="image"||t.kind==="pdf"||t.kind==="text";async function vS(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 H0=2e5;function $D({attachment:t,onClose:r}){const{data:a,error:l,isLoading:o}=xS(t.id),u=bS(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 vS(t)}catch(g){y(g instanceof Error?g.message:"Download failed")}}return c.jsxs(ca,{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,H0)}),d.length>H0&&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:Bp(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 ZD({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(JD,{attachment:o,onOpen:()=>l(o)},o.id):c.jsx(wS,{attachment:o,onOpen:()=>l(o)},o.id))}),a&&c.jsx($D,{attachment:a,onClose:()=>l(null)})]})}function JD({attachment:t,onOpen:r}){const{data:a,error:l}=xS(t.id),o=bS(a);return l?c.jsx(wS,{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 wS({attachment:t,onOpen:r,unavailable:a}){const[l,o]=S.useState(""),u=XD(t),d=t.kind==="text"||t.kind==="pdf"?ck:dk;async function m(){if(u)return r();o("");try{await vS(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":Bp(t.size)})]})]}),l&&c.jsx("span",{role:"alert",className:"text-xs text-destructive mt-0.5",children:l})]})}function WD({messageId:t,text:r}){const[a,l]=S.useState(!1);S.useEffect(()=>l(Mm()),[]);const o=zm(p=>p.speakingId===t),{speak:u,stop:d}=zm();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(q1,{size:12}):c.jsx(Tk,{size:12})})}function e_({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(uk,{size:11}),"Reply to ",t]})}function Ec(...t){return Io(Fo(t))}function t_({message:t,onJumpTo:r,jumpTargets:a}){var p;const l=(p=t.metadata)==null?void 0:p.forward;if(!l)return null;const o=mO(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(L1,{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 n_({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=jo(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"),k=C?null:t.senderName??(w?t.role==="assistant"?"Assistant":"Someone":"KAI"),E=Rm(t),j=l!==void 0&&E&&!o,A=c.jsxs("div",{className:Ec("flex gap-2 mb-3",C?"flex-row-reverse":"flex-row"),children:[c.jsx("div",{className:"mt-0.5",children:c.jsx(Vc,{name:C?"U":k,avatarUrl:t.senderAvatarUrl})}),c.jsxs("div",{className:Ec("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:[k&&c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:k}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:b}),!C&&t.content!==""&&c.jsx(WD,{messageId:t.id,text:t.content}),j&&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(L1,{size:12})})]}),c.jsx(t_,{message:t,onJumpTo:m,jumpTargets:p}),t.attachments&&t.attachments.length>0&&c.jsx(ZD,{attachments:t.attachments,alignEnd:C}),t.content!==""&&c.jsx("div",{className:Ec("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(yS,{inverted:C,children:t.content})}),y&&g&&c.jsx(e_,{agentName:t.senderName??"this agent",disabled:x,onSend:z=>g(t,z)})]})]});return o?c.jsxs("div",{className:Ec("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 r_({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(yS,{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 a_({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),[k,E]=S.useState(null),j=S.useRef(void 0),A=S.useMemo(()=>new Set(t.map(Y=>Y.id)),[t]);S.useEffect(()=>()=>clearTimeout(j.current),[]);function z(Y){const q=C.current.get(Y);q&&(q.scrollIntoView({behavior:"smooth",block:"center"}),E(Y),clearTimeout(j.current),j.current=setTimeout(()=>E(null),2e3))}return S.useEffect(()=>{var Y;(Y=w.current)==null||Y.scrollIntoView({behavior:"smooth"})},[t,r]),c.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:[t.map(Y=>c.jsx("div",{"data-message-id":Y.id,ref:q=>{q?C.current.set(Y.id,q):C.current.delete(Y.id)},className:k===Y.id?"rounded-md ring-2 ring-primary/60 transition-shadow":"rounded-md transition-shadow",children:c.jsx(n_,{message:Y,conversationType:o,currentUserId:u,onForward:d,selecting:m,selected:(p==null?void 0:p.includes(Y.id))??!1,onToggleSelect:y,onJumpTo:z,jumpTargets:A,canReply:(x==null?void 0:x.has(Y.id))??!1,replyDisabled:g,onAgentReply:b})},Y.id)),r&&c.jsx(r_,{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 i_=5*6e4,l_=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"];function B0(){var t;return typeof window<"u"&&typeof MediaRecorder<"u"&&typeof navigator<"u"&&typeof((t=navigator.mediaDevices)==null?void 0:t.getUserMedia)=="function"}function s_(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 o_(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(B0()),[]);const C=S.useCallback(()=>{var A;x.current&&clearTimeout(x.current),x.current=null,(A=y.current)==null||A.getTracks().forEach(z=>z.stop()),y.current=null},[]),k=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(()=>k,[k]);const E=S.useCallback(async()=>{if(!B0()||!w.current.transcribe||p.current||b.current)return;m(null),b.current=!0;const A=++g.current;let z;try{z=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(H){g.current===A&&(b.current=!1,m(s_(H)));return}if(g.current!==A){z.getTracks().forEach(H=>H.stop());return}b.current=!1;const Y=l_.find(H=>{var $;return($=MediaRecorder.isTypeSupported)==null?void 0:$.call(MediaRecorder,H)});let q;try{q=new MediaRecorder(z,Y?{mimeType:Y}:void 0)}catch{z.getTracks().forEach(H=>H.stop()),m("Recording is not supported here.");return}const T=[];q.ondataavailable=H=>{H.data.size>0&&T.push(H.data)},q.onerror=()=>{k(),m("The recording failed.")},q.onstop=()=>{if(C(),p.current=null,g.current!==A)return;const H=new Blob(T,{type:q.mimeType||Y||"audio/webm"});if(H.size===0){u("idle"),m("Nothing was recorded.");return}u("transcribing"),w.current.transcribe(H).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=z,p.current=q,q.start(),u("recording"),x.current=setTimeout(()=>{p.current===q&&q.state==="recording"&&q.stop()},i_)},[k,C]),j=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:j,cancel:k}}function u_(t){return!t.startsWith("@")||t.includes(`
258
- `)?null:t.slice(1)}function c_(t,r){const a=r.toLowerCase();return t.filter(l=>l.name.toLowerCase().startsWith(a)).sort((l,o)=>l.name.localeCompare(o.name))}function d_(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 f_(t,r,a){const l=u_(t),o=l!==null?c_(a,l):[];return sw(l,o,u=>r(`@${u.name} `))}function h_({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 F0=[];function m_({onSend:t,disabled:r,onUpload:a,onDiscard:l,onTranscribe:o,skills:u=[],agents:d=F0,forwardCount:m=0,onForward:p,onMentionChange:y}){const[x,g]=S.useState(""),[b,w]=S.useState([]),[C,k]=S.useState(""),[E,j]=S.useState(!1),A=S.useRef(null),z=S.useRef(null),Y=S.useRef(0),q=S.useRef(new Set),T=vp(x,g,u),H=f_(x,g,p?d:F0),[$,W]=S.useState(!1),M=p?d_(x,d):null,ie=p!==void 0&&x.startsWith("@"),Q=S.useRef(y);Q.current=y,S.useEffect(()=>{var se;(se=Q.current)==null||se.call(Q,ie)},[ie]);const ae=o_(o,se=>{g(He=>He.trim()===""?se:`${He.trimEnd()} ${se}`)}),{cancel:le}=ae,ne=ae.state!=="idle";S.useEffect(()=>{r&&le()},[r,le]),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=M?ce.length>0?`Files cannot be forwarded. Remove them to forward to ${M.agent.name}.`:m===0?`Select the messages above to forward to ${M.agent.name}.`:`Forwarding ${m===1?"1 selected message":`${m} selected messages`} to ${M.agent.name}. Change the selection above.`:"",Re=M!==null&&(ce.length>0||m===0),O=!r&&!Z&&!ne&&!$&&!Re&&(x.trim()!==""||ce.length>0);function Be(se){if(!a||r||se.length===0)return;const He=q0-b.length,nt=se.slice(0,Math.max(He,0));k(nt.length<se.length?`A message can carry at most ${q0} files.`:"");for(const Qe of nt){const ht=`file-${++Y.current}`;w(Mt=>[...Mt,{key:ht,name:Qe.name,size:Qe.size,status:"uploading"}]),a(Qe).then(Mt=>{if(q.current.delete(ht)){l==null||l(Mt);return}w(Ct=>Ct.map(fe=>fe.key===ht?{...fe,status:"done",attachment:Mt}:fe))},Mt=>{if(q.current.delete(ht))return;const Ct=Mt instanceof Error?Mt.message:"Upload failed";w(fe=>fe.map(ge=>ge.key===ht?{...ge,status:"error",error:Ct}:ge))})}}function it(se){k(""),se.status==="uploading"?q.current.add(se.key):se.attachment&&(l==null||l(se.attachment)),w(He=>He.filter(nt=>nt.key!==se.key))}function _(se){T.onKeyDown(se)||H.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 re(se){T.choose(se),D()}function he(se){H.choose(se),D()}function xe(){g(""),w([]),k(""),A.current&&(A.current.style.height="auto")}async function Oe(){if(!O)return;if(M&&p){W(!0),k("");try{await p(M.agent,M.note),xe()}catch(He){k(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(),j(!1),Be(Array.from(se.dataTransfer.files))}function Ee(){ae.state==="recording"?ae.stop():ae.state==="idle"&&ae.start()}const Tt=a!==void 0,Ke=C||ae.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(),j(!0))},onDragLeave:()=>j(!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"&&Bp(((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:()=>it(se),"aria-label":`Remove ${se.name}`,className:"shrink-0 rounded p-0.5 hover:bg-accent transition-colors",children:c.jsx(H1,{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:z,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=z.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(xk,{size:18})})]}),c.jsxs("div",{className:"relative flex-1",children:[T.open&&c.jsx(wp,{id:"message-skill-autocomplete",matches:T.matches,activeIndex:T.activeIndex,onChoose:re}),H.open&&c.jsx(h_,{id:"message-agent-autocomplete",matches:H.matches,activeIndex:H.activeIndex,onChoose:he}),c.jsx("textarea",{ref:A,rows:1,value:x,onChange:Me,onKeyDown:_,onPaste:Le,disabled:r,placeholder:r?"Agent is running...":ae.state==="recording"?"Recording... press the microphone again to stop":ae.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"}})]}),ae.available&&c.jsx("button",{type:"button",onClick:Ee,disabled:r||ae.state==="transcribing","aria-label":ae.state==="recording"?"Stop recording":ae.state==="transcribing"?"Transcribing":"Record a message","aria-pressed":ae.state==="recording",title:ae.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 ${ae.state==="recording"?"bg-destructive text-destructive-foreground border-destructive animate-pulse":"text-muted-foreground hover:bg-accent"}`,children:ae.state==="recording"?c.jsx(q1,{size:16}):ae.state==="transcribing"?c.jsx(mk,{size:18,className:"animate-spin"}):c.jsx(yk,{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 p_(...t){return Io(Fo(t))}function g_({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:p_("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 y_({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 x_({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(g_,{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(y_,{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 b_({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 v_({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 w_({conversationId:t}){const{getByConversation:r,setStatus:a,addStep:l,setPendingApproval:o,init:u}=pp(),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(v_,{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(x_,{steps:d.steps}),d.pendingApproval&&c.jsx("div",{className:"mt-3",children:c.jsx(b_,{approval:d.pendingApproval,executionId:d.executionId,onDecision:p})})]})}const I0="temp-",S_=(t,r)=>(t??[]).map(a=>a.id).sort().join()===(r??[]).map(a=>a.id).sort().join();function N_({conversationId:t}){var Mt,Ct;const r=Lt(),{data:a}=Qk(t),{data:l}=fO(t),{data:o}=hO(),u=((Mt=a==null?void 0:a.participants.find(fe=>fe.agentId))==null?void 0:Mt.agentId)??void 0,d=bp(u),{data:m}=as(),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),[k,E]=S.useState(!1),[j,A]=S.useState(!1),[z,Y]=S.useState(!1),[q,T]=S.useState(!1),[H,$]=S.useState(""),[W,M]=S.useState(null),[ie,Q]=S.useState(!1),[ae,le]=S.useState(!1),ne=Nt(fe=>{var ge;return(ge=fe.user)==null?void 0:ge.id}),Z=No(fe=>fe.openSidebar),{init:ce,setStatus:me,addStep:Re,setPendingApproval:O,getByConversation:Be}=pp(),it=Be(t),_=it!==void 0&&["running","waiting_for_approval","waiting_for_client"].includes(it.status);S.useEffect(()=>()=>zm.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(()=>{M(null),Q(!1),le(!1)},[t]),S.useEffect(()=>{M(fe=>{if(fe===null)return fe;const ge=new Set(y.filter(Rm).map(Ft=>Ft.id)),oe=fe.filter(Ft=>ge.has(Ft));return oe.length===fe.length?fe:oe})},[y]),S.useEffect(()=>{if(W===null||ie)return;const fe=ge=>{ge.key==="Escape"&&(M(null),le(!1))};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[W===null,ie]);function re(fe){le(!1),M(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(Ft=>(Ft??"")+oe.delta),C(oe.senderName??void 0));else{b(null),C(void 0);const Ft=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:Ft?"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(Ft&&(ne===void 0||oe.senderId===ne)){const be=J.findIndex(Te=>Te.id.startsWith(I0)&&Te.content===oe.content&&S_(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,ne,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=H.trim();if(T(!1),!(!fe||!a||fe===yo(a,ne)))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=`${I0}${Date.now()}`,Ft={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,Ft]);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:gO(y,fe.senderId),agentId:fe.senderId,note:ge}),r.invalidateQueries({queryKey:["conversations",t,"messages"]})},[t,y,r]);function Ee(fe){if(fe){if(W!==null)return;const ge=[...y].reverse().find(Rm);if(!ge)return;M([ge.id]),le(!0)}else ae&&(M(null),le(!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"]}),M(null),le(!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))??[],nt=(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!==nt&&Qe.set(fe.senderId,fe.id);const ht=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(lk,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[q?c.jsx("input",{autoFocus:!0,value:H,onChange:fe=>$(fe.target.value),onBlur:()=>T(!1),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),Me()),fe.key==="Escape"&&(fe.preventDefault(),T(!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?yo(a,ne):"Conversation"}),a&&c.jsx("button",{onClick:()=>{$(yo(a,ne)),T(!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(bk,{size:12})})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:se?He.map(fe=>fe.userId===ne?"You":fe.name??"Someone").join(", "):a!=null&&a.type?c.jsxs("span",{className:"capitalize",children:[a.type," chat"]}):""})]}),se&&c.jsx("button",{onClick:()=>Y(!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(Ek,{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(U1,{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(dp,{size:16})})]}),j&&a&&c.jsx(ew,{conversation:{id:a.id,title:a.title},onClose:()=>A(!1)}),k&&a&&c.jsx(W1,{conversation:{id:a.id,title:a.title},onClose:()=>E(!1)}),z&&a&&c.jsx(yO,{conversationId:t,memberIds:He.map(fe=>fe.userId),onClose:()=>Y(!1)}),ie&&W!==null&&W.length>0&&c.jsx(xO,{conversationId:t,messages:y.filter(fe=>W.includes(fe.id)),sharedChat:se,onClose:()=>Q(!1),onForwarded:()=>{Q(!1),M(null)}}),c.jsx(a_,{messages:y,streaming:g,streamingName:w,executionRunning:_,conversationType:a==null?void 0:a.type,currentUserId:ne,onForward:fe=>M([fe.id]),selecting:W!==null,selectedIds:W??[],onToggleSelect:re,replyTargets:ht,replyDisabled:_&&!se,onAgentReply:ye}),(Ke||it!==void 0)&&c.jsx(w_,{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:()=>Q(!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:()=>{M(null),le(!1)},"aria-label":"Cancel selection",className:"px-3 py-1 rounded-md border hover:bg-accent transition-colors",children:"Cancel"})]}),c.jsx(m_,{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:Ee},t)]})}function C_({params:t}){const{id:r}=S.use(t);return c.jsx(N_,{conversationId:r})}function j_(){const t=Zn();return S.useEffect(()=>{t.replace("/admin/users")},[t]),null}const E_=[{href:"/admin/users",label:"Users"},{href:"/admin/organizations",label:"Organizations",platformOnly:!0},{href:"/admin/llm",label:"AI models"},{href:"/admin/mcp",label:"MCP servers"}];function Wc({children:t}){const r=Nt(o=>o.user),a=qo();if(!F1(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=E_.filter(o=>!o.platformOnly||(r==null?void 0:r.isPlatformAdmin));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(Kn,{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 ed(){return Cn({queryKey:["admin","orgs"],queryFn:()=>ue.admin.orgs.list()})}function k_(){return Cn({queryKey:["admin","users"],queryFn:()=>ue.admin.users.list()})}const Uc={chatter:0,member:1,admin:2,owner:3};function T_(t){return t.isPlatformAdmin?["chatter","member","admin","owner"]:["chatter","member","admin","owner"].filter(r=>Uc[r]<Uc[t.orgRole])}function A_(t,r){return r.id===t.id?!1:t.isPlatformAdmin?!0:r.isPlatformAdmin||!r.role?!1:Uc[r.role]<Uc[t.orgRole]}function fo({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 O_({user:t,actor:r,onClose:a,onAccountAction:l}){const o=Lt(),{data:u}=ed(),d=(u==null?void 0:u.orgs)??[],m=T_(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,k]=S.useState((t==null?void 0:t.role)??(m.includes("member")?"member":m[0])??"member"),[E,j]=S.useState((t==null?void 0:t.isPlatformAdmin)??!1),[A,z]=S.useState(!1),[Y,q]=S.useState(""),[T,H]=S.useState(null),$=(t==null?void 0:t.id)===r.id,W=r.isPlatformAdmin&&!$,M=!$;async function ie(Q){Q.preventDefault(),z(!0),q("");try{if(t)await ue.admin.users.update(t.id,{displayName:x,...M&&C!==t.role?{role:C}:{},...W&&b!==t.orgId?{orgId:b}:{},...r.isPlatformAdmin&&!$&&E!==t.isPlatformAdmin?{isPlatformAdmin:E}:{}});else{const ae=await ue.admin.users.create({email:p,displayName:x,orgId:b,role:C});await o.invalidateQueries({queryKey:["admin"]}),H({email:ae.email,emailSent:ae.emailSent}),z(!1);return}await o.invalidateQueries({queryKey:["admin"]}),a()}catch(ae){q(ae instanceof Error?ae.message:"Failed to save"),z(!1)}}return T?c.jsxs(ca,{title:"User created",onClose:a,children:[T.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 ",T.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 ",T.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(ca,{title:t?"Edit user":"New user",onClose:a,children:c.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[!t&&c.jsx(st,{label:"Email",htmlFor:"user-email",children:c.jsx("input",{id:"user-email",type:"email",required:!0,className:ot,value:p,onChange:Q=>y(Q.target.value),autoFocus:!0})}),t&&c.jsx("p",{className:"text-sm text-muted-foreground",children:t.email}),c.jsx(st,{label:"Display name",htmlFor:"user-name",children:c.jsx("input",{id:"user-name",required:!0,className:ot,value:x,onChange:Q=>g(Q.target.value)})}),(W||!t)&&c.jsx(st,{label:"Organization",htmlFor:"user-org",children:r.isPlatformAdmin?c.jsx("select",{id:"user-org",className:ot,value:b,onChange:Q=>w(Q.target.value),children:d.map(Q=>c.jsx("option",{value:Q.id,children:Q.name},Q.id))}):c.jsx("input",{id:"user-org",className:ot,value:r.orgName,disabled:!0})}),M&&c.jsx(st,{label:"Role",htmlFor:"user-role",children:c.jsx("select",{id:"user-role",className:ot,value:C,onChange:Q=>k(Q.target.value),children:[...new Set([...t!=null&&t.role?[t.role]:[],...m])].map(Q=>c.jsx("option",{value:Q,disabled:!m.includes(Q),children:Q},Q))})}),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:Q=>j(Q.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."})]}),Y&&c.jsx("p",{className:"text-xs text-destructive",children:Y}),c.jsx(Pi,{onCancel:a,submitLabel:t?"Save":"Create user",busy:A})]})})}function R_({action:t,user:r,onClose:a}){const l=Lt(),o=()=>l.invalidateQueries({queryKey:["admin"]});if(t==="link"){const u=r.mustChangePassword;return c.jsx(Ir,{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(Ir,{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(Ir,{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 M_(){const t=Nt(j=>j.user),r=Lt(),{data:a,isLoading:l,isError:o}=k_(),[u,d]=S.useState(null),[m,p]=S.useState(null),[y,x]=S.useState(null),[g,b]=S.useState(null),[w,C]=S.useState(""),k=(a==null?void 0:a.users)??[],E=k.filter(j=>qi(w,[j.displayName,j.email,j.orgName,j.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"})]}),k.length>0&&c.jsx("div",{className:"max-w-xs mb-4",children:c.jsx(Hi,{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&&k.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(j=>{const A=A_(t,j);return c.jsxs("tr",{className:j.disabled?"opacity-60":"",children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[j.displayName,j.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:j.email})]}),t.isPlatformAdmin&&c.jsx("td",{className:"px-3 py-2",children:j.orgName??"—"}),c.jsx("td",{className:"px-3 py-2 capitalize",children:j.role??"—"}),c.jsx("td",{className:"px-3 py-2",children:c.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.isPlatformAdmin&&c.jsx(fo,{tone:"info",children:"Platform admin"}),j.disabled&&c.jsx(fo,{tone:"danger",children:"Disabled"}),j.mustChangePassword&&c.jsx(fo,{tone:"warn",children:"Password change pending"}),!j.mfaRequired&&c.jsx(fo,{tone:"warn",children:"MFA exempt"}),j.mfaRequired&&j.mfaEnabled&&c.jsx(fo,{tone:"info",children:"MFA on"})]})}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:[(A||j.id===t.id)&&c.jsx("button",{onClick:()=>d(j),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),A&&c.jsx("button",{onClick:()=>p(j),className:`px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors ${j.disabled?"":"text-destructive"}`,children:j.disabled?"Enable":"Disable"}),t.isPlatformAdmin&&j.id!==t.id&&c.jsx("button",{onClick:()=>x(j),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors text-destructive",children:"Delete"})]})]},j.id)})})]})}),u&&c.jsx(O_,{user:u==="new"?null:u,actor:t,onClose:()=>d(null),onAccountAction:(j,A)=>{d(null),b({action:j,user:A})}}),g&&c.jsx(R_,{...g,onClose:()=>b(null)}),y&&c.jsx(Ir,{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(Ir,{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 z_(){return c.jsx(Wc,{children:c.jsx(M_,{})})}function D_({org:t,onClose:r}){const a=Lt(),[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(ca,{title:t?"Rename organization":"New organization",onClose:r,children:c.jsxs("form",{onSubmit:y,className:"space-y-4",children:[c.jsx(st,{label:"Name",htmlFor:"org-name",children:c.jsx("input",{id:"org-name",className:ot,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(Pi,{onCancel:r,submitLabel:t?"Save":"Create",busy:u,disabled:l.trim()===""})]})})}function __(){const t=Lt(),{data:r,isLoading:a,isError:l}=ed(),[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=>qi(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(Hi,{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(D_,{org:o==="new"?null:o,onClose:()=>u(null)}),d&&c.jsx(Ir,{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 L_(){const t=Nt(r=>r.user);return c.jsx(Wc,{children:t!=null&&t.isPlatformAdmin?c.jsx(__,{}):c.jsx("p",{className:"text-sm text-muted-foreground",children:"Only platform admins manage organizations."})})}const ji=[{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, ..."}],U_=["none","minimal","low","medium","high","xhigh"];function q_(t){var r;return t?t.type==="anthropic"?"claude-sonnet-4-5":t.type==="claude_code_local"?"sonnet":((r=ji.find(a=>a.baseUrl&&a.baseUrl===t.baseUrl))==null?void 0:r.model)??"":""}function H_({orgId:t,provider:r,onClose:a}){const l=Lt(),[o,u]=S.useState(0),d=ji[o],[m,p]=S.useState((r==null?void 0:r.name)??ji[0].label),[y,x]=S.useState((r==null?void 0:r.type)??ji[0].type),[g,b]=S.useState((r==null?void 0:r.baseUrl)??ji[0].baseUrl),[w,C]=S.useState(""),[k,E]=S.useState(!1),[j,A]=S.useState((r==null?void 0:r.transcriptionModel)??""),[z,Y]=S.useState(!1),[q,T]=S.useState(""),[H,$]=S.useState(!1),[W,M]=S.useState(null);S.useEffect(()=>{M(null)},[o,y,g,w,k]);function ie(Z){const ce=ji[Z];u(Z),p(ce.label.startsWith("Other")?"":ce.label),x(ce.type),b(ce.baseUrl)}async function Q(){$(!0),M(null);try{M(await ue.admin.llm.testProvider(t,{...r?{providerId:r.id}:{type:y},...le==="openai_compatible"?{baseUrl:g}:{},...w?{apiKey:w}:k?{apiKey:null}:{}}))}catch(Z){M({ok:!1,error:Z instanceof Error?Z.message:"The test could not be run"})}finally{$(!1)}}async function ae(Z){Z.preventDefault(),Y(!0),T("");try{r?await ue.admin.llm.updateProvider(t,r.id,{name:m,...r.type==="openai_compatible"?{baseUrl:g}:{},...w?{apiKey:w}:k?{apiKey:null}:{},...r.type==="openai_compatible"&&j.trim()!==(r.transcriptionModel??"")?{transcriptionModel:j.trim()||null}:{}}):await ue.admin.llm.createProvider(t,{name:m,type:y,...y==="openai_compatible"?{baseUrl:g}:{},...w?{apiKey:w}:{},...y==="openai_compatible"&&j.trim()!==""?{transcriptionModel:j.trim()}:{}}),await l.invalidateQueries({queryKey:["admin","llm"]}),await l.invalidateQueries({queryKey:["llm-models"]}),a()}catch(ce){T(ce instanceof Error?ce.message:"Failed to save"),Y(!1)}}const le=(r==null?void 0:r.type)??y,ne=(le!=="openai_compatible"||g.trim()!=="")&&(le!=="anthropic"||w!==""||!!(r!=null&&r.hasApiKey)&&!k);return c.jsx(ca,{title:r?"Edit provider":"Add provider",onClose:a,width:"w-[28rem]",children:c.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[!r&&c.jsx(st,{label:"Provider",htmlFor:"prov-preset",...d.note?{hint:d.note}:{},children:c.jsx("select",{id:"prov-preset",className:ot,value:o,onChange:Z=>ie(Number(Z.target.value)),children:ji.map((Z,ce)=>c.jsx("option",{value:ce,children:Z.label},Z.label))})}),c.jsx(st,{label:"Name",htmlFor:"prov-name",children:c.jsx("input",{id:"prov-name",required:!0,className:ot,value:m,onChange:Z=>p(Z.target.value)})}),le==="openai_compatible"&&c.jsx(st,{label:"Base URL",htmlFor:"prov-url",children:c.jsx("input",{id:"prov-url",required:!0,spellCheck:!1,className:`${ot} font-mono`,value:g,onChange:Z=>b(Z.target.value),placeholder:"https://api.example.com/v1"})}),le!=="claude_code_local"&&c.jsx(st,{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.":le==="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&&le==="anthropic",className:`${ot} font-mono`,value:w,onChange:Z=>C(Z.target.value),placeholder:r!=null&&r.hasApiKey?"••••••••••••":""})}),le==="openai_compatible"&&c.jsx(st,{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:`${ot} font-mono`,value:j,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:k,onChange:Z=>E(Z.target.checked),disabled:w!==""}),"Remove the stored key"]}),le==="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 Q(),disabled:H||z||!ne,className:"px-3 py-1.5 text-sm rounded-md border hover:bg-accent disabled:opacity-50 whitespace-nowrap shrink-0 transition-colors",children:H?"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(Pi,{onCancel:a,submitLabel:r?"Save":"Add provider",busy:z})]})})}function B_({orgId:t,providers:r,model:a,onClose:l}){var W;const o=Lt(),[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),[k,E]=S.useState((a==null?void 0:a.reasoningEffort)??""),[j,A]=S.useState(!1),[z,Y]=S.useState(""),q=r.find(M=>M.id===u),T=(q==null?void 0:q.type)==="openai_compatible",H=(q==null?void 0:q.type)==="claude_code_local";async function $(M){M.preventDefault(),A(!0),Y("");try{a?await ue.admin.llm.updateModel(t,a.id,{model:m,label:y||m,supportsImages:w,...T&&k!==(a.reasoningEffort??"")?{reasoningEffort:k||null}:{}}):await ue.admin.llm.createModel(t,{providerId:u,model:m,...y?{label:y}:{},...g?{isDefault:g}:{},...w?{supportsImages:w}:{},...T&&k?{reasoningEffort:k}:{}}),await o.invalidateQueries({queryKey:["admin","llm"]}),await o.invalidateQueries({queryKey:["llm-models"]}),l()}catch(ie){Y(ie instanceof Error?ie.message:"Failed to save"),A(!1)}}return c.jsx(ca,{title:a?"Edit model":"Add model",onClose:l,width:"w-[28rem]",children:c.jsxs("form",{onSubmit:$,className:"space-y-4",children:[!a&&c.jsx(st,{label:"Provider",htmlFor:"model-provider",children:c.jsx("select",{id:"model-provider",className:ot,value:u,onChange:M=>d(M.target.value),children:r.map(M=>c.jsx("option",{value:M.id,children:M.name},M.id))})}),c.jsx(st,{label:"Model name",htmlFor:"model-name",hint:H?"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:`${ot} font-mono`,value:m,onChange:M=>p(M.target.value),placeholder:q_(q)||"model-name",autoFocus:!0})}),c.jsx(st,{label:"Label",htmlFor:"model-label",hint:"What users see. Defaults to the model name.",children:c.jsx("input",{id:"model-label",className:ot,value:y,onChange:M=>x(M.target.value),placeholder:m})}),!H&&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:M=>C(M.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."})]}),T&&c.jsx(st,{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:ot,value:k,onChange:M=>E(M.target.value),children:[c.jsx("option",{value:"",children:"Provider default"}),U_.map(M=>c.jsx("option",{value:M,children:M},M))]})}),!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:M=>b(M.target.checked)}),"Make this the organization default"]}),z&&c.jsx("p",{className:"text-xs text-destructive",children:z}),c.jsx(Pi,{onCancel:l,submitLabel:a?"Save":"Add model",busy:j,disabled:!u})]})})}function F_({orgId:t}){const r=Lt(),{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({}),[k,E]=S.useState(""),[j,A]=S.useState(""),[z,Y]=S.useState(""),q=(a==null?void 0:a.providers)??[],T=(a==null?void 0:a.models)??[],H=q.filter(Q=>qi(j,[Q.name,Q.baseUrl,Q.type])),$=T.filter(Q=>qi(z,[Q.label,Q.model,Q.providerName]));async function W(){await r.invalidateQueries({queryKey:["admin","llm"]}),await r.invalidateQueries({queryKey:["llm-models"]})}async function M(Q){C(ae=>({...ae,[Q]:{status:"testing"}}));try{const ae=await ue.admin.llm.testModel(t,Q);C(le=>({...le,[Q]:ae.ok?{status:"ok"}:{status:"error",message:ae.error??"Failed"}}))}catch(ae){C(le=>({...le,[Q]:{status:"error",message:ae instanceof Error?ae.message:"Failed"}}))}}async function ie(Q){E("");try{await ue.admin.llm.updateModel(t,Q,{isDefault:!0}),await W()}catch(ae){E(ae instanceof Error?ae.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(Hi,{value:j,onChange:A,placeholder:"Search providers…","aria-label":"Search providers"})}),H.length===0&&c.jsxs("p",{className:"text-sm text-muted-foreground border rounded-md px-4 py-6 text-center",children:["No providers match “",j.trim(),"”."]})]}),H.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:H.map(Q=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-medium",children:Q.name}),c.jsxs("td",{className:"px-3 py-2 text-xs text-muted-foreground font-mono",children:[Q.type==="anthropic"?"Anthropic API":Q.type==="claude_code_local"?"Claude Code on the user’s computer":Q.baseUrl,Q.transcriptionModel&&c.jsxs("span",{className:"block font-sans",children:["Voice input: ",Q.transcriptionModel]})]}),c.jsx("td",{className:"px-3 py-2 text-xs",children:Q.type==="claude_code_local"?c.jsx("span",{className:"text-muted-foreground",children:"No key needed"}):Q.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(Q),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>x(Q),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},Q.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"})]}),k&&c.jsx("p",{className:"text-xs text-destructive mb-2",children:k}),T.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(Hi,{value:z,onChange:Y,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 “",z.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(Q=>{const ae=w[Q.id];return c.jsxs("tr",{children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[Q.label,Q.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"}),Q.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"}),Q.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: ${Q.reasoningEffort}`})]}),c.jsxs("div",{className:"text-xs text-muted-foreground font-mono",children:[Q.model," · ",Q.providerName]}),(ae==null?void 0:ae.status)==="ok"&&c.jsx("div",{className:"text-xs text-green-700 mt-1",children:"Works: the provider answered."}),(ae==null?void 0:ae.status)==="error"&&c.jsx("div",{className:"text-xs text-destructive mt-1 break-words",children:ae.message})]}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap align-top",children:[c.jsx("button",{onClick:()=>void M(Q.id),disabled:(ae==null?void 0:ae.status)==="testing",className:"px-2 py-1 text-xs rounded-md hover:bg-accent disabled:opacity-50 transition-colors",children:(ae==null?void 0:ae.status)==="testing"?"Testing…":"Test"}),!Q.isDefault&&c.jsx("button",{onClick:()=>void ie(Q.id),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Make default"}),c.jsx("button",{onClick:()=>p(Q),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>b(Q),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},Q.id)})})})})]}),u&&c.jsx(H_,{orgId:t,provider:u==="new"?null:u,onClose:()=>d(null)}),m&&c.jsx(B_,{orgId:t,providers:q,model:m==="new"?null:m,onClose:()=>p(null)}),y&&c.jsx(Ir,{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(Ir,{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 I_(){const t=Nt(d=>d.user),{data:r}=ed(),[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(F_,{orgId:o},o)]})}function P_(){return c.jsx(Wc,{children:c.jsx(I_,{})})}class qc extends Error{}function Q_(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 qc(`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 qc(`Line ${l+1}: "${d}" is not a valid variable name`);r[d]=o.slice(u+1)}),r}function Y_(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 qc(`Line ${l+1}: write it as Name: value`);const d=o.slice(0,u).trim();if(!/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/.test(d))throw new qc(`Line ${l+1}: "${d}" is not a valid header name`);r[d]=o.slice(u+1).trim()}),r}function V_(t){return t.split(/\r?\n/).filter(r=>r.trim()!=="")}function G_(t){return(t??[]).join(`
259
- `)}function SS(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 dm=`${ot} font-mono resize-y`,K_=[{value:"none",label:"No members"},{value:"org",label:"Everyone in the organization"},{value:"selected",label:"Selected people"}];function NS({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 X_({server:t,orgId:r,onClose:a}){const l=Nt(K=>{var be;return(be=K.user)==null?void 0:be.orgId}),o=SS(r,l),u=Lt(),[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,k]=S.useState((t==null?void 0:t.url)??""),[E,j]=S.useState(""),[A,z]=S.useState((t==null?void 0:t.command)??""),[Y,q]=S.useState(G_(t==null?void 0:t.args)),[T,H]=S.useState(""),[$,W]=S.useState(!1),[M,ie]=S.useState((t==null?void 0:t.oauthAuthorizationUrl)??""),[Q,ae]=S.useState((t==null?void 0:t.oauthTokenUrl)??""),[le,ne]=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),[it,_]=S.useState((t==null?void 0:t.memberAccess)??"none"),[D,re]=S.useState((t==null?void 0:t.memberUserIds)??[]),[he,xe]=S.useState(!1),[Oe,Me]=S.useState(""),[Le,ye]=S.useState(!1),[Ee,Tt]=S.useState(null),[Ke,se]=S.useState(null),[He,nt]=S.useState(!1),Qe=!t||x===t.transport,ht=Qe?(x==="http"?t==null?void 0:t.headerNames:t==null?void 0:t.envKeys)??[]:[],Mt=x==="http"?E:T,Ct=Qe&&b==="oauth"&&((t==null?void 0:t.hasOauthClientSecret)??!1);S.useEffect(()=>{Tt(null),Me("")},[x,b,C,E,A,Y,T,$,M,Q,le,Z,me,O]);function fe(){if(x==="http"){const be=b==="header"?E.trim()?Y_(E):$?{}:void 0:void 0,Te={...M.trim()?{authorizationUrl:M.trim()}:{},...Q.trim()?{tokenUrl:Q.trim()}:{},...le.trim()?{scope:le.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=T.trim()?Q_(T):$?{}:void 0;return{command:A.trim(),args:V_(Y),...K?{env:K}:{}}}async function ge(){nt(!0);try{const K=await o.oauthDiscover(C.trim()?{url:C.trim()}:{});se(K),K.authorizationUrl&&ie(be=>be||K.authorizationUrl),K.tokenUrl&&ae(be=>be||K.tokenUrl),K.scope&&ne(be=>be||K.scope)}catch(K){se({redirectUri:"",error:K instanceof Error?K.message:"Could not check the server"})}finally{nt(!1)}}S.useEffect(()=>{x==="http"&&b==="oauth"&&ge()},[x,b]);const oe=x==="http"?C.trim()!=="":A.trim()!=="";async function Ft(){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:it,...it==="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(ca,{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(st,{label:"Name",htmlFor:"mcp-name",children:c.jsx("input",{id:"mcp-name",required:!0,className:ot,value:d,onChange:K=>m(K.target.value),autoFocus:!0})}),c.jsx(st,{label:"Description",htmlFor:"mcp-desc",hint:"What its tools are for. Optional.",children:c.jsx("input",{id:"mcp-desc",className:ot,value:p,onChange:K=>y(K.target.value)})}),c.jsx(st,{label:"Connection",htmlFor:"mcp-transport",children:c.jsxs("select",{id:"mcp-transport",className:ot,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(st,{label:"URL",htmlFor:"mcp-url",children:c.jsx("input",{id:"mcp-url",onBlur:()=>{b==="oauth"&&ge()},required:!0,spellCheck:!1,className:`${ot} font-mono`,value:C,onChange:K=>k(K.target.value),placeholder:"https://mcp.example.com/mcp"})}),c.jsx(st,{label:"Authentication",htmlFor:"mcp-auth-type",children:c.jsxs("select",{id:"mcp-auth-type",className:ot,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(st,{label:"Headers",htmlFor:"mcp-headers",hint:ht.length>0?`Stored: ${ht.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:dm,value:E,onChange:K=>j(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(st,{label:"Authorization URL",htmlFor:"mcp-oauth-auth-url",children:c.jsx("input",{id:"mcp-oauth-auth-url",spellCheck:!1,className:`${ot} font-mono`,value:M,onChange:K=>ie(K.target.value)})}),c.jsx(st,{label:"Token URL",htmlFor:"mcp-oauth-token-url",children:c.jsx("input",{id:"mcp-oauth-token-url",spellCheck:!1,className:`${ot} font-mono`,value:Q,onChange:K=>ae(K.target.value)})}),c.jsx(st,{label:"Scope",htmlFor:"mcp-oauth-scope",children:c.jsx("input",{id:"mcp-oauth-scope",spellCheck:!1,className:ot,value:le,onChange:K=>ne(K.target.value)})}),c.jsx(st,{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:`${ot} font-mono`,value:Z,onChange:K=>ce(K.target.value)})}),c.jsx(st,{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:`${ot} 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(st,{label:"Command",htmlFor:"mcp-command",children:c.jsx("input",{id:"mcp-command",required:!0,spellCheck:!1,className:`${ot} font-mono`,value:A,onChange:K=>z(K.target.value),placeholder:"npx"})}),c.jsx(st,{label:"Arguments",htmlFor:"mcp-args",hint:"One per line.",children:c.jsx("textarea",{id:"mcp-args",rows:3,spellCheck:!1,className:dm,value:Y,onChange:K=>q(K.target.value),placeholder:`-y
260
- @modelcontextprotocol/server-filesystem`})}),c.jsx(st,{label:"Environment variables",htmlFor:"mcp-env",hint:ht.length>0?`Stored: ${ht.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:dm,value:T,onChange:K=>H(K.target.value),placeholder:"API_KEY=..."})})]}),ht.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:Mt.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?"}),K_.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:it===K.value,onChange:()=>_(K.value)}),K.label]},K.value)),it==="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(xp,{exclude:[],selected:D,onChange:re}),")"]}),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 Ft(),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"}),Ee&&c.jsx("div",{role:"status",className:"text-xs pt-1.5 min-w-0",children:c.jsx(NS,{result:Ee,authType:b})})]}),Oe&&c.jsx("p",{className:"text-xs text-destructive",children:Oe}),c.jsx(Pi,{onCancel:a,submitLabel:t?"Save":"Add server",busy:he})]})})}function $_({orgId:t}){const r=Lt(),a=Nt(T=>{var H;return(H=T.user)==null?void 0:H.orgId}),l=SS(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,k]=S.useState(""),E=S.useRef(null),j=(u==null?void 0:u.servers)??[],A=j.filter(T=>qi(C,[T.name,T.description,T.transport==="http"?T.url:T.command,...T.args??[]]));S.useEffect(()=>()=>{var T;return(T=E.current)==null?void 0:T.call(E)},[]);async function z(T){w(H=>({...H,[T.id]:"testing"}));try{const H=await l.test({serverId:T.id});w($=>({...$,[T.id]:H})),H.ok&&await r.invalidateQueries({queryKey:["mcp-servers"]})}catch(H){w($=>({...$,[T.id]:{ok:!1,error:H instanceof Error?H.message:"The test could not be run"}}))}}async function Y(T){var H;w($=>({...$,[T.id]:"connecting"}));try{const{authorizationUrl:$}=await ue.mcp.oauthConnect(T.id),W=window.open($,"kai-mcp-oauth-connect","width=500,height=700");if(!W){w(M=>({...M,[T.id]:{ok:!1,error:"Your browser blocked the pop-up. Allow pop-ups for this site and try again."}}));return}(H=E.current)==null||H.call(E),E.current=uw(W,()=>{r.invalidateQueries({queryKey:["mcp-servers"]}),z(T)})}catch($){w(W=>({...W,[T.id]:{ok:!1,error:$ instanceof Error?$.message:"Could not start the connection"}}))}}function q(T){return!o&&T.authType==="oauth"&&!T.connected?Y(T):z(T)}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"})]}),j.length>0&&c.jsx("div",{className:"max-w-xs mb-4",children:c.jsx(Hi,{value:C,onChange:k,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&&j.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&&j.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(T=>{const H=b[T.id],$=T.transport==="http"?T.url:[T.command,...T.args??[]].join(" ");return c.jsxs("tr",{children:[c.jsxs("td",{className:"px-3 py-2",children:[c.jsxs("div",{className:"font-medium",children:[T.name,c.jsx("span",{className:"ml-2 text-[10px] font-semibold px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:T.transport==="http"?"HTTP":"stdio"}),T.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"}),T.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"}),T.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:(T.memberUserIds??[]).length===1?"1 person":`${(T.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:T.toolsCheckedAt?`${T.tools.length} tool${T.tools.length===1?"":"s"} (checked ${jo(new Date(T.toolsCheckedAt),"d MMM HH:mm")})`:T.authType==="oauth"?"Each person connects their own account from Settings > Integrations; an admin can test again afterwards to list its tools.":"Not tested yet"}),H==="connecting"&&c.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Connecting…"}),H==="testing"&&c.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Testing…"}),H&&H!=="connecting"&&H!=="testing"&&c.jsx("div",{role:"status",className:"text-xs mt-1",children:c.jsx(NS,{result:H,authType:T.authType})})]}),c.jsxs("td",{className:"px-3 py-2 text-right whitespace-nowrap align-top",children:[c.jsx("button",{onClick:()=>void q(T),disabled:H==="connecting"||H==="testing",className:"px-2 py-1 text-xs rounded-md hover:bg-accent disabled:opacity-50 transition-colors",children:T.authType==="oauth"&&!T.connected?"Connect & test":"Test"}),c.jsx("button",{onClick:()=>y(T),className:"px-2 py-1 text-xs rounded-md hover:bg-accent transition-colors",children:"Edit"}),c.jsx("button",{onClick:()=>g(T),className:"px-2 py-1 text-xs rounded-md text-destructive hover:bg-accent transition-colors",children:"Delete"})]})]},T.id)})})})}),p&&c.jsx(X_,{server:p==="new"?null:p,orgId:t,onClose:()=>y(null)}),x&&c.jsx(Ir,{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 Z_(){const t=Nt(d=>d.user),{data:r}=ed(),[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($_,{orgId:o},o)]})}function J_(){return c.jsx(Wc,{children:c.jsx(Z_,{})})}const fm=8;function W_(){const t=Zn(),r=Nt(j=>j.setUser),a=Bo(j=>j.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(!So()){t.replace("/login");return}ue.auth.me().then(j=>{if(!j.mustChangePassword){t.replace("/settings/general");return}o(!0)}).catch(()=>t.replace("/login"))},[t]);async function k(j){if(j.preventDefault(),b(""),m.length<fm){b(`The new password must be at least ${fm} 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(Yc(A.accessToken,A.refreshToken),r(Ho(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:k,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:j=>d(j.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:fm,autoComplete:"new-password",value:m,onChange:j=>p(j.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:j=>x(j.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 e5(){return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsx(W_,{})})}const t5="w-full px-3 py-2 rounded-md border bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring";function n5(){const t=Zn(),r=Nt(C=>C.setUser),a=Bo(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(!So()){t.replace("/login");return}let C=!1;return(async()=>{try{const k=await ue.auth.me();if(C)return;if(!k.mfaPending){t.replace("/");return}k.mfaPending==="setup"&&d(await ue.auth.mfa.setup()),C||o(k.mfaPending)}catch{C||t.replace("/login")}})(),()=>{C=!0}},[t]);async function w(C){C.preventDefault(),x(""),b(!0);try{const k={code:m.trim()},E=l==="setup"?await ue.auth.mfa.confirm(k):await ue.auth.mfa.verify(k);Yc(E.accessToken,E.refreshToken),r(Ho(E.user)),Ge.onStatusChange(a),Ge.connect(E.accessToken),t.push("/")}catch(k){x(k instanceof Error?k.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:`${t5} 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 r5(){return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:c.jsx(n5,{})})}function dn(){if(!window.kai)throw new Error("Desktop bridge unavailable (not running in Electron)");return window.kai}const _t={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)}},a5=25,To=Ii(t=>({entries:[],start:r=>t(a=>({entries:[{...r,status:"running",at:new Date().toISOString()},...a.entries].slice(0,a5)})),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)}))})),i5=["filesystem.list","filesystem.read","filesystem.write","screen.capture","browser.read","browser.interact"];function ho(t,r){if(typeof t!="string")throw new Error(`Missing or invalid argument: ${r}`);return t}async function l5(t){const{capability:r,args:a}=t;switch(r){case"filesystem.list":return _t.filesystem.list(ho(a.path,"path"));case"filesystem.read":return _t.filesystem.read(ho(a.path,"path"));case"filesystem.write":return _t.filesystem.write(ho(a.path,"path"),ho(a.content,"content"));case"screen.capture":return _t.screen.capture();case"browser.read":case"browser.interact":return _t.browser.run(ho(t.tool,"tool"),a);default:throw new Error(`Unknown capability: ${r}`)}}function CS(t){return(t instanceof Error?t.message:String(t)).replace(/^Error invoking remote method '[^']+': (Error: )?/,"")}async function s5(t,r){const a=To.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 l5(r);a.finish(t),Ge.send({type:"capability.response",id:t,payload:{success:!0,result:o}})}catch(o){const u=CS(o);a.finish(t,u),Ge.send({type:"capability.response",id:t,payload:{success:!1,error:u}})}}async function o5(t){const r=To.getState();r.start({id:t.runId,capability:"claude.run",target:t.model||null});try{await _t.claude.run({...t,serverUrl:Wl()})}catch(a){const l=CS(a);r.finish(t.runId,l),Ge.send({type:"claude.event",id:crypto.randomUUID(),payload:{runId:t.runId,kind:"error",message:l}})}}function u5(t){Ge.send({type:"claude.event",id:crypto.randomUUID(),payload:t}),t.kind==="done"?To.getState().finish(t.runId):t.kind==="error"&&To.getState().finish(t.runId,t.message)}function c5(){return S.useEffect(()=>{if(!_t.available())return;const t=Ge.onStatusChange(u=>{if(u!=="connected"){_t.claude.cancelAll().catch(()=>{});return}Ge.send({type:"client.register",id:crypto.randomUUID(),payload:{clientType:"desktop",capabilities:[...i5]}})}),r=Ge.on("capability.request",(u,d)=>{s5(d.id,u)}),a=Ge.on("claude.run",u=>{o5(u)}),l=Ge.on("claude.cancel",u=>{const d=u==null?void 0:u.runId;typeof d=="string"&&_t.claude.cancel(d).catch(()=>{})}),o=_t.claude.onEvent(u5);return()=>{t(),r(),a(),l(),o()}},[]),null}function d5(){const t=Zn(),r=Nt(b=>b.setUser),a=Bo(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(Yc(w.accessToken,w.refreshToken),r(Ho(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 f5(){const[t,r]=S.useState(Wl);function a(l){r(l),l.trim()&&Ak(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(Wl()),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 h5(){return c.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-background p-4",children:[c.jsx(f5,{}),c.jsx(d5,{})]})}const m5={connected:"Connected",reconnecting:"Reconnecting…",disconnected:"Disconnected"},p5={connected:"bg-green-500",reconnecting:"bg-yellow-500",disconnected:"bg-red-500"};function Ao(t){return(t instanceof Error?t.message:String(t)).replace(/^Error invoking remote method '[^']+': (Error: )?/,"")}function Vo({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 g5(){const[t,r]=S.useState(null),[a,l]=S.useState("");async function o(u){l("");try{r(await u())}catch(d){l(Ao(d))}}return S.useEffect(()=>{if(!_t.available()){r([]),l("File access can only be configured in the desktop app.");return}o(()=>_t.settings.getFolders())},[]),c.jsxs(Vo,{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(()=>_t.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(()=>_t.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(dp,{size:16})})]},u.path))}),a&&c.jsx("p",{className:"text-sm text-destructive mb-3",children:a}),c.jsxs("button",{onClick:()=>void o(()=>_t.settings.addFolder()),disabled:!_t.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(fk,{size:16}),"Add folder…"]})]})}function y5(){const[t,r]=S.useState(null),[a,l]=S.useState("");S.useEffect(()=>{if(!_t.available()){l("Claude Code can only be used from the desktop app.");return}_t.claude.status().then(r,u=>l(Ao(u)))},[]);async function o(u){l("");try{await _t.claude.setEnabled(u),r(await _t.claude.status())}catch(d){l(Ao(d))}}return c.jsxs(Vo,{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 x5(){const[t,r]=S.useState(null),[a,l]=S.useState("");S.useEffect(()=>{if(!_t.available()){l("The browser can only be used from the desktop app.");return}_t.browser.getEnabled().then(r,u=>l(Ao(u)))},[]);async function o(u){l("");try{r(await _t.browser.setEnabled(u))}catch(d){l(Ao(d))}}return c.jsxs(Vo,{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 b5(){const t=Nt(a=>a.user),r=Bo(a=>a.status);return c.jsx(Vo,{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:Wl()}),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 ${p5[r]}`}),m5[r]]}),c.jsx("dt",{className:"text-muted-foreground",children:"Signed in as"}),c.jsx("dd",{className:"truncate",children:t?`${t.displayName} (${t.email})`:"—"})]})})}function v5(){const t=To(r=>r.entries);return c.jsx(Vo,{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:jo(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 w5(){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(g5,{}),c.jsx(y5,{}),c.jsx(x5,{}),c.jsx(b5,{}),c.jsx(v5,{})]})})}const P0=new Map;function jS(t){let r=P0.get(t);return r||(r=Promise.resolve({id:t}),P0.set(t,r)),r}function S5(){const{id:t=""}=p1();return c.jsx(C_,{params:jS(t)})}function N5(){const{id:t=""}=p1();return c.jsx(dO,{params:jS(t)})}function C5(){return c.jsxs(c.Fragment,{children:[c.jsx(c5,{}),c.jsx(OT,{children:c.jsx(Oj,{})})]})}function j5(){return c.jsx(nk,{children:c.jsx(nE,{children:c.jsx(S.Suspense,{fallback:null,children:c.jsxs(Mj,{children:[c.jsx(Gt,{path:"/login",element:c.jsx(h5,{})}),c.jsx(Gt,{path:"/change-password",element:c.jsx(e5,{})}),c.jsx(Gt,{path:"/mfa",element:c.jsx(r5,{})}),c.jsxs(Gt,{element:c.jsx(C5,{}),children:[c.jsx(Gt,{index:!0,element:c.jsx(MT,{})}),c.jsx(Gt,{path:"conversations/:id",element:c.jsx(S5,{})}),c.jsx(Gt,{path:"agents",element:c.jsx(LT,{})}),c.jsx(Gt,{path:"agents/new",element:c.jsx(cO,{})}),c.jsx(Gt,{path:"agents/:id/edit",element:c.jsx(N5,{})}),c.jsx(Gt,{path:"schedules",element:c.jsx(KA,{})}),c.jsx(Gt,{path:"settings",element:c.jsx(w5,{})}),c.jsx(Gt,{path:"settings/general",element:c.jsx(tO,{})}),c.jsx(Gt,{path:"settings/integrations",element:c.jsx(rO,{})}),c.jsx(Gt,{path:"admin",element:c.jsx(j_,{})}),c.jsx(Gt,{path:"admin/users",element:c.jsx(z_,{})}),c.jsx(Gt,{path:"admin/organizations",element:c.jsx(L_,{})}),c.jsx(Gt,{path:"admin/llm",element:c.jsx(P_,{})}),c.jsx(Gt,{path:"admin/mcp",element:c.jsx(J_,{})})]}),c.jsx(Gt,{path:"*",element:c.jsx(Aj,{to:"/",replace:!0})})]})})})})}const ES=document.getElementById("root");if(!ES)throw new Error("Root element not found");T2.createRoot(ES).render(c.jsx(mo.StrictMode,{children:c.jsx(j5,{})}));