openfox 1.6.18 → 1.6.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WRFOMNHM.js → chunk-AE7FYMCR.js} +2 -2
- package/dist/{chunk-THP77DXS.js → chunk-N2V2K5QV.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/package.json +1 -1
- package/dist/{serve-KMTRAQ4F.js → serve-CJKXYYIA.js} +2 -2
- package/dist/server/index.js +1 -1
- package/dist/web/assets/{index-DwDDssmB.js → index-CLd1Kqv-.js} +16 -15
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ var T1=Object.defineProperty;var A1=(e,r,i)=>r in e?T1(e,r,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ox;function M1(){if(ox)return Ge;ox=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,v={};function b(B,W,F){this.props=B,this.context=W,this.refs=v,this.updater=F||k}b.prototype.isReactComponent={},b.prototype.setState=function(B,W){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,W,"setState")},b.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function x(){}x.prototype=b.prototype;function S(B,W,F){this.props=B,this.context=W,this.refs=v,this.updater=F||k}var j=S.prototype=new x;j.constructor=S,C(j,b.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function I(B,W,F){var re=F.ref;return{$$typeof:e,type:B,key:W,ref:re!==void 0?re:null,props:F}}function H(B,W){return I(B.type,W,B.props)}function V(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function Y(B){var W={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(F){return W[F]})}var q=/\/+/g;function O(B,W){return typeof B=="object"&&B!==null&&B.key!=null?Y(""+B.key):W.toString(36)}function U(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(N,N):(B.status="pending",B.then(function(W){B.status==="pending"&&(B.status="fulfilled",B.value=W)},function(W){B.status==="pending"&&(B.status="rejected",B.reason=W)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function z(B,W,F,re,Z){var ee=typeof B;(ee==="undefined"||ee==="boolean")&&(B=null);var K=!1;if(B===null)K=!0;else switch(ee){case"bigint":case"string":case"number":K=!0;break;case"object":switch(B.$$typeof){case e:case r:K=!0;break;case g:return K=B._init,z(K(B._payload),W,F,re,Z)}}if(K)return Z=Z(B),K=re===""?"."+O(B,0):re,A(Z)?(F="",K!=null&&(F=K.replace(q,"$&/")+"/"),z(Z,W,F,"",function(ne){return ne})):Z!=null&&(V(Z)&&(Z=H(Z,F+(Z.key==null||B&&B.key===Z.key?"":(""+Z.key).replace(q,"$&/")+"/")+K)),W.push(Z)),1;K=0;var $=re===""?".":re+":";if(A(B))for(var ae=0;ae<B.length;ae++)re=B[ae],ee=$+O(re,ae),K+=z(re,W,F,ee,Z);else if(ae=_(B),typeof ae=="function")for(B=ae.call(B),ae=0;!(re=B.next()).done;)re=re.value,ee=$+O(re,ae++),K+=z(re,W,F,ee,Z);else if(ee==="object"){if(typeof B.then=="function")return z(U(B),W,F,re,Z);throw W=String(B),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return K}function X(B,W,F){if(B==null)return B;var re=[],Z=0;return z(B,re,"","",function(ee){return W.call(F,ee,Z++)}),re}function Q(B){if(B._status===-1){var W=B._result;W=W(),W.then(function(F){(B._status===0||B._status===-1)&&(B._status=1,B._result=F)},function(F){(B._status===0||B._status===-1)&&(B._status=2,B._result=F)}),B._status===-1&&(B._status=0,B._result=W)}if(B._status===1)return B._result.default;throw B._result}var M=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},L={map:X,forEach:function(B,W,F){X(B,function(){W.apply(this,arguments)},F)},count:function(B){var W=0;return X(B,function(){W++}),W},toArray:function(B){return X(B,function(W){return W})||[]},only:function(B){if(!V(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ge.Activity=m,Ge.Children=L,Ge.Component=b,Ge.Fragment=i,Ge.Profiler=c,Ge.PureComponent=S,Ge.StrictMode=s,Ge.Suspense=d,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(B){return D.H.useMemoCache(B)}},Ge.cache=function(B){return function(){return B.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(B,W,F){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var re=C({},B.props),Z=B.key;if(W!=null)for(ee in W.key!==void 0&&(Z=""+W.key),W)!T.call(W,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&W.ref===void 0||(re[ee]=W[ee]);var ee=arguments.length-2;if(ee===1)re.children=F;else if(1<ee){for(var K=Array(ee),$=0;$<ee;$++)K[$]=arguments[$+2];re.children=K}return I(B.type,Z,re)},Ge.createContext=function(B){return B={$$typeof:f,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:u,_context:B},B},Ge.createElement=function(B,W,F){var re,Z={},ee=null;if(W!=null)for(re in W.key!==void 0&&(ee=""+W.key),W)T.call(W,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(Z[re]=W[re]);var K=arguments.length-2;if(K===1)Z.children=F;else if(1<K){for(var $=Array(K),ae=0;ae<K;ae++)$[ae]=arguments[ae+2];Z.children=$}if(B&&B.defaultProps)for(re in K=B.defaultProps,K)Z[re]===void 0&&(Z[re]=K[re]);return I(B,ee,Z)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(B){return{$$typeof:l,render:B}},Ge.isValidElement=V,Ge.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:Q}},Ge.memo=function(B,W){return{$$typeof:p,type:B,compare:W===void 0?null:W}},Ge.startTransition=function(B){var W=D.T,F={};D.T=F;try{var re=B(),Z=D.S;Z!==null&&Z(F,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(N,M)}catch(ee){M(ee)}finally{W!==null&&F.types!==null&&(W.types=F.types),D.T=W}},Ge.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ge.use=function(B){return D.H.use(B)},Ge.useActionState=function(B,W,F){return D.H.useActionState(B,W,F)},Ge.useCallback=function(B,W){return D.H.useCallback(B,W)},Ge.useContext=function(B){return D.H.useContext(B)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(B,W){return D.H.useDeferredValue(B,W)},Ge.useEffect=function(B,W){return D.H.useEffect(B,W)},Ge.useEffectEvent=function(B){return D.H.useEffectEvent(B)},Ge.useId=function(){return D.H.useId()},Ge.useImperativeHandle=function(B,W,F){return D.H.useImperativeHandle(B,W,F)},Ge.useInsertionEffect=function(B,W){return D.H.useInsertionEffect(B,W)},Ge.useLayoutEffect=function(B,W){return D.H.useLayoutEffect(B,W)},Ge.useMemo=function(B,W){return D.H.useMemo(B,W)},Ge.useOptimistic=function(B,W){return D.H.useOptimistic(B,W)},Ge.useReducer=function(B,W,F){return D.H.useReducer(B,W,F)},Ge.useRef=function(B){return D.H.useRef(B)},Ge.useState=function(B){return D.H.useState(B)},Ge.useSyncExternalStore=function(B,W,F){return D.H.useSyncExternalStore(B,W,F)},Ge.useTransition=function(){return D.H.useTransition()},Ge.version="19.2.4",Ge}var lx;function Fl(){return lx||(lx=1,bd.exports=M1()),bd.exports}var P=Fl();const
|
|
17
|
+
*/var ox;function M1(){if(ox)return Ge;ox=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),f=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=y&&B[y]||B["@@iterator"],typeof B=="function"?B:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,v={};function b(B,W,F){this.props=B,this.context=W,this.refs=v,this.updater=F||k}b.prototype.isReactComponent={},b.prototype.setState=function(B,W){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,W,"setState")},b.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function x(){}x.prototype=b.prototype;function S(B,W,F){this.props=B,this.context=W,this.refs=v,this.updater=F||k}var j=S.prototype=new x;j.constructor=S,C(j,b.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function N(){}var D={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function I(B,W,F){var re=F.ref;return{$$typeof:e,type:B,key:W,ref:re!==void 0?re:null,props:F}}function H(B,W){return I(B.type,W,B.props)}function V(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function Y(B){var W={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(F){return W[F]})}var q=/\/+/g;function O(B,W){return typeof B=="object"&&B!==null&&B.key!=null?Y(""+B.key):W.toString(36)}function U(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(N,N):(B.status="pending",B.then(function(W){B.status==="pending"&&(B.status="fulfilled",B.value=W)},function(W){B.status==="pending"&&(B.status="rejected",B.reason=W)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function z(B,W,F,re,Z){var ee=typeof B;(ee==="undefined"||ee==="boolean")&&(B=null);var K=!1;if(B===null)K=!0;else switch(ee){case"bigint":case"string":case"number":K=!0;break;case"object":switch(B.$$typeof){case e:case r:K=!0;break;case g:return K=B._init,z(K(B._payload),W,F,re,Z)}}if(K)return Z=Z(B),K=re===""?"."+O(B,0):re,A(Z)?(F="",K!=null&&(F=K.replace(q,"$&/")+"/"),z(Z,W,F,"",function(ne){return ne})):Z!=null&&(V(Z)&&(Z=H(Z,F+(Z.key==null||B&&B.key===Z.key?"":(""+Z.key).replace(q,"$&/")+"/")+K)),W.push(Z)),1;K=0;var $=re===""?".":re+":";if(A(B))for(var ae=0;ae<B.length;ae++)re=B[ae],ee=$+O(re,ae),K+=z(re,W,F,ee,Z);else if(ae=_(B),typeof ae=="function")for(B=ae.call(B),ae=0;!(re=B.next()).done;)re=re.value,ee=$+O(re,ae++),K+=z(re,W,F,ee,Z);else if(ee==="object"){if(typeof B.then=="function")return z(U(B),W,F,re,Z);throw W=String(B),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return K}function X(B,W,F){if(B==null)return B;var re=[],Z=0;return z(B,re,"","",function(ee){return W.call(F,ee,Z++)}),re}function Q(B){if(B._status===-1){var W=B._result;W=W(),W.then(function(F){(B._status===0||B._status===-1)&&(B._status=1,B._result=F)},function(F){(B._status===0||B._status===-1)&&(B._status=2,B._result=F)}),B._status===-1&&(B._status=0,B._result=W)}if(B._status===1)return B._result.default;throw B._result}var M=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},L={map:X,forEach:function(B,W,F){X(B,function(){W.apply(this,arguments)},F)},count:function(B){var W=0;return X(B,function(){W++}),W},toArray:function(B){return X(B,function(W){return W})||[]},only:function(B){if(!V(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ge.Activity=m,Ge.Children=L,Ge.Component=b,Ge.Fragment=i,Ge.Profiler=c,Ge.PureComponent=S,Ge.StrictMode=s,Ge.Suspense=d,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(B){return D.H.useMemoCache(B)}},Ge.cache=function(B){return function(){return B.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(B,W,F){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var re=C({},B.props),Z=B.key;if(W!=null)for(ee in W.key!==void 0&&(Z=""+W.key),W)!T.call(W,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&W.ref===void 0||(re[ee]=W[ee]);var ee=arguments.length-2;if(ee===1)re.children=F;else if(1<ee){for(var K=Array(ee),$=0;$<ee;$++)K[$]=arguments[$+2];re.children=K}return I(B.type,Z,re)},Ge.createContext=function(B){return B={$$typeof:f,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:u,_context:B},B},Ge.createElement=function(B,W,F){var re,Z={},ee=null;if(W!=null)for(re in W.key!==void 0&&(ee=""+W.key),W)T.call(W,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(Z[re]=W[re]);var K=arguments.length-2;if(K===1)Z.children=F;else if(1<K){for(var $=Array(K),ae=0;ae<K;ae++)$[ae]=arguments[ae+2];Z.children=$}if(B&&B.defaultProps)for(re in K=B.defaultProps,K)Z[re]===void 0&&(Z[re]=K[re]);return I(B,ee,Z)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(B){return{$$typeof:l,render:B}},Ge.isValidElement=V,Ge.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:Q}},Ge.memo=function(B,W){return{$$typeof:p,type:B,compare:W===void 0?null:W}},Ge.startTransition=function(B){var W=D.T,F={};D.T=F;try{var re=B(),Z=D.S;Z!==null&&Z(F,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(N,M)}catch(ee){M(ee)}finally{W!==null&&F.types!==null&&(W.types=F.types),D.T=W}},Ge.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},Ge.use=function(B){return D.H.use(B)},Ge.useActionState=function(B,W,F){return D.H.useActionState(B,W,F)},Ge.useCallback=function(B,W){return D.H.useCallback(B,W)},Ge.useContext=function(B){return D.H.useContext(B)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(B,W){return D.H.useDeferredValue(B,W)},Ge.useEffect=function(B,W){return D.H.useEffect(B,W)},Ge.useEffectEvent=function(B){return D.H.useEffectEvent(B)},Ge.useId=function(){return D.H.useId()},Ge.useImperativeHandle=function(B,W,F){return D.H.useImperativeHandle(B,W,F)},Ge.useInsertionEffect=function(B,W){return D.H.useInsertionEffect(B,W)},Ge.useLayoutEffect=function(B,W){return D.H.useLayoutEffect(B,W)},Ge.useMemo=function(B,W){return D.H.useMemo(B,W)},Ge.useOptimistic=function(B,W){return D.H.useOptimistic(B,W)},Ge.useReducer=function(B,W,F){return D.H.useReducer(B,W,F)},Ge.useRef=function(B){return D.H.useRef(B)},Ge.useState=function(B){return D.H.useState(B)},Ge.useSyncExternalStore=function(B,W,F){return D.H.useSyncExternalStore(B,W,F)},Ge.useTransition=function(){return D.H.useTransition()},Ge.version="19.2.4",Ge}var lx;function Fl(){return lx||(lx=1,bd.exports=M1()),bd.exports}var P=Fl();const on=Pl(P),O1=D1({__proto__:null,default:on},[P]);var yd={exports:{}},Na={},_d={exports:{}},Sd={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -45,7 +45,7 @@ var T1=Object.defineProperty;var A1=(e,r,i)=>r in e?T1(e,r,{enumerable:!0,config
|
|
|
45
45
|
`);for(w=h=0;h<J.length&&!J[h].includes("DetermineComponentFrameRoot");)h++;for(;w<le.length&&!le[w].includes("DetermineComponentFrameRoot");)w++;if(h===J.length||w===le.length)for(h=J.length-1,w=le.length-1;1<=h&&0<=w&&J[h]!==le[w];)w--;for(;1<=h&&0<=w;h--,w--)if(J[h]!==le[w]){if(h!==1||w!==1)do if(h--,w--,0>w||J[h]!==le[w]){var he=`
|
|
46
46
|
`+J[h].replace(" at new "," at ");return t.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",t.displayName)),he}while(1<=h&&0<=w);break}}}finally{Ie=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Me(a):""}function ke(t,n){switch(t.tag){case 26:case 27:case 5:return Me(t.type);case 16:return Me("Lazy");case 13:return t.child!==n&&n!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return Fe(t.type,!1);case 11:return Fe(t.type.render,!1);case 1:return Fe(t.type,!0);case 31:return Me("Activity");default:return""}}function ge(t){try{var n="",a=null;do n+=ke(t,a),a=t,t=t.return;while(t);return n}catch(h){return`
|
|
47
47
|
Error generating stack: `+h.message+`
|
|
48
|
-
`+h.stack}}var je=Object.prototype.hasOwnProperty,We=e.unstable_scheduleCallback,Lt=e.unstable_cancelCallback,pe=e.unstable_shouldYield,Ne=e.unstable_requestPaint,Oe=e.unstable_now,lt=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,Be=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,Ct=e.log,se=e.unstable_setDisableYieldValue,Le=null,$e=null;function at(t){if(typeof Ct=="function"&&se(t),$e&&typeof $e.setStrictMode=="function")try{$e.setStrictMode(Le,t)}catch{}}var qe=Math.clz32?Math.clz32:oi,Ut=Math.log,Rt=Math.LN2;function oi(t){return t>>>=0,t===0?32:31-(Ut(t)/Rt|0)|0}var fe=256,ye=262144,we=4194304;function Ye(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function rt(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,E=t.suspendedLanes,R=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~E,h!==0?w=Ye(h):(R&=G,R!==0?w=Ye(R):a||(a=G&~t,a!==0&&(w=Ye(a))))):(G=h&~E,G!==0?w=Ye(G):R!==0?w=Ye(R):a||(a=h&~t,a!==0&&(w=Ye(a)))),w===0?0:n!==0&&n!==w&&(n&E)===0&&(E=w&-w,a=n&-n,E>=a||E===32&&(a&4194048)!==0)?n:w}function Ue(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Zt(t,n){switch(t){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 Mt(){var t=we;return we<<=1,(we&62914560)===0&&(we=4194304),t}function $t(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Hi(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ac(t,n,a,h,w,E){var R=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=R&~a;0<a;){var he=31-qe(a),xe=1<<he;G[he]=0,J[he]=-1;var ce=le[he];if(ce!==null)for(le[he]=null,he=0;he<ce.length;he++){var de=ce[he];de!==null&&(de.lane&=-536870913)}a&=~xe}h!==0&&uf(t,h,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(R&~n))}function uf(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var h=31-qe(n);t.entangledLanes|=n,t.entanglements[h]=t.entanglements[h]|1073741824|a&261930}function df(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var h=31-qe(a),w=1<<h;w&n|t[h]&n&&(t[h]|=n),a&=~w}}function hf(t,n){var a=n&-n;return a=(a&42)!==0?1:oc(a),(a&(t.suspendedLanes|n))!==0?0:a}function oc(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function lc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ff(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:Qg(t.type))}function pf(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var Ar=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Ar,fn="__reactProps$"+Ar,Pi="__reactContainer$"+Ar,cc="__reactEvents$"+Ar,v0="__reactListeners$"+Ar,b0="__reactHandles$"+Ar,mf="__reactResources$"+Ar,zs="__reactMarker$"+Ar;function uc(t){delete t[Qt],delete t[fn],delete t[cc],delete t[v0],delete t[b0]}function Fi(t){var n=t[Qt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Pi]||a[Qt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Bg(t);t!==null;){if(a=t[Qt])return a;t=Bg(t)}return n}t=a,a=t.parentNode}return null}function Ui(t){if(t=t[Qt]||t[Pi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Hs(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function $i(t){var n=t[mf];return n||(n=t[mf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Yt(t){t[zs]=!0}var gf=new Set,xf={};function li(t,n){qi(t,n),qi(t+"Capture",n)}function qi(t,n){for(xf[t]=n,t=0;t<n.length;t++)gf.add(n[t])}var y0=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]*$"),vf={},bf={};function _0(t){return je.call(bf,t)?!0:je.call(vf,t)?!1:y0.test(t)?bf[t]=!0:(vf[t]=!0,!1)}function so(t,n,a){if(_0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var h=n.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function ao(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function lr(t,n,a,h){if(h===null)t.removeAttribute(a);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+h)}}function Mn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function yf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function S0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,E=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(R){a=""+R,E.call(this,R)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(R){a=""+R},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function dc(t){if(!t._valueTracker){var n=yf(t)?"checked":"value";t._valueTracker=S0(t,n,""+t[n])}}function _f(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=yf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function oo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var w0=/[\n"\\]/g;function On(t){return t.replace(w0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function hc(t,n,a,h,w,E,R,G){t.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.type=R:t.removeAttribute("type"),n!=null?R==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Mn(n)):t.value!==""+Mn(n)&&(t.value=""+Mn(n)):R!=="submit"&&R!=="reset"||t.removeAttribute("value"),n!=null?fc(t,R,Mn(n)):a!=null?fc(t,R,Mn(a)):h!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+Mn(G):t.removeAttribute("name")}function Sf(t,n,a,h,w,E,R,G){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.type=E),n!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||n!=null)){dc(t);return}a=a!=null?""+Mn(a):"",n=n!=null?""+Mn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=G?t.checked:!!h,t.defaultChecked=!!h,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(t.name=R),dc(t)}function fc(t,n,a){n==="number"&&oo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Wi(t,n,a,h){if(t=t.options,n){n={};for(var w=0;w<a.length;w++)n["$"+a[w]]=!0;for(a=0;a<t.length;a++)w=n.hasOwnProperty("$"+t[a].value),t[a].selected!==w&&(t[a].selected=w),w&&h&&(t[a].defaultSelected=!0)}else{for(a=""+Mn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,h&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function wf(t,n,a){if(n!=null&&(n=""+Mn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Mn(a):""}function Cf(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(U(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=Mn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),dc(t)}function Gi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var C0=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 kf(t,n,a){var h=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?h?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":h?t.setProperty(n,a):typeof a!="number"||a===0||C0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Ef(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var h in a)!a.hasOwnProperty(h)||n!=null&&n.hasOwnProperty(h)||(h.indexOf("--")===0?t.setProperty(h,""):h==="float"?t.cssFloat="":t[h]="");for(var w in n)h=n[w],n.hasOwnProperty(w)&&a[w]!==h&&kf(t,w,h)}else for(var E in n)n.hasOwnProperty(E)&&kf(t,E,n[E])}function pc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 k0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),E0=/^[\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 lo(t){return E0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function cr(){}var mc=null;function gc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Vi=null,Yi=null;function jf(t){var n=Ui(t);if(n&&(t=n.stateNode)){var a=t[fn]||null;e:switch(t=n.stateNode,n.type){case"input":if(hc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+On(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[fn]||null;if(!w)throw Error(s(90));hc(h,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)h=a[n],h.form===t.form&&_f(h)}break e;case"textarea":wf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Wi(t,!!a.multiple,n,!1)}}}var xc=!1;function Nf(t,n,a){if(xc)return t(n,a);xc=!0;try{var h=t(n);return h}finally{if(xc=!1,(Vi!==null||Yi!==null)&&(Xo(),Vi&&(n=Vi,t=Yi,Yi=Vi=null,jf(n),t)))for(n=0;n<t.length;n++)jf(t[n])}}function Ps(t,n){var a=t.stateNode;if(a===null)return null;var h=a[fn]||null;if(h===null)return null;a=h[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":(h=!h.disabled)||(t=t.type,h=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!h;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vc=!1;if(ur)try{var Fs={};Object.defineProperty(Fs,"passive",{get:function(){vc=!0}}),window.addEventListener("test",Fs,Fs),window.removeEventListener("test",Fs,Fs)}catch{vc=!1}var Dr=null,bc=null,co=null;function Tf(){if(co)return co;var t,n=bc,a=n.length,h,w="value"in Dr?Dr.value:Dr.textContent,E=w.length;for(t=0;t<a&&n[t]===w[t];t++);var R=a-t;for(h=1;h<=R&&n[a-h]===w[E-h];h++);return co=w.slice(t,1<h?1-h:void 0)}function uo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function ho(){return!0}function Af(){return!1}function pn(t){function n(a,h,w,E,R){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=E,this.target=R,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(E):E[G]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?ho:Af,this.isPropagationStopped=Af,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ho)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ho)},persist:function(){},isPersistent:ho}),n}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fo=pn(ci),Us=m({},ci,{view:0,detail:0}),j0=pn(Us),yc,_c,$s,po=m({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==$s&&($s&&t.type==="mousemove"?(yc=t.screenX-$s.screenX,_c=t.screenY-$s.screenY):_c=yc=0,$s=t),yc)},movementY:function(t){return"movementY"in t?t.movementY:_c}}),Df=pn(po),N0=m({},po,{dataTransfer:0}),T0=pn(N0),A0=m({},Us,{relatedTarget:0}),Sc=pn(A0),D0=m({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),L0=pn(D0),R0=m({},ci,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),M0=pn(R0),O0=m({},ci,{data:0}),Lf=pn(O0),B0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I0={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"},z0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function H0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=z0[t])?!!n[t]:!1}function wc(){return H0}var P0=m({},Us,{key:function(t){if(t.key){var n=B0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=uo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?I0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wc,charCode:function(t){return t.type==="keypress"?uo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?uo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),F0=pn(P0),U0=m({},po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rf=pn(U0),$0=m({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),q0=pn($0),W0=m({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),G0=pn(W0),V0=m({},po,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Y0=pn(V0),K0=m({},ci,{newState:0,oldState:0}),X0=pn(K0),Z0=[9,13,27,32],Cc=ur&&"CompositionEvent"in window,qs=null;ur&&"documentMode"in document&&(qs=document.documentMode);var Q0=ur&&"TextEvent"in window&&!qs,Mf=ur&&(!Cc||qs&&8<qs&&11>=qs),Of=" ",Bf=!1;function If(t,n){switch(t){case"keyup":return Z0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ki=!1;function J0(t,n){switch(t){case"compositionend":return zf(n);case"keypress":return n.which!==32?null:(Bf=!0,Of);case"textInput":return t=n.data,t===Of&&Bf?null:t;default:return null}}function e_(t,n){if(Ki)return t==="compositionend"||!Cc&&If(t,n)?(t=Tf(),co=bc=Dr=null,Ki=!1,t):null;switch(t){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 Mf&&n.locale!=="ko"?null:n.data;default:return null}}var t_={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 Hf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!t_[t.type]:n==="textarea"}function Pf(t,n,a,h){Vi?Yi?Yi.push(h):Yi=[h]:Vi=h,n=rl(n,"onChange"),0<n.length&&(a=new fo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var Ws=null,Gs=null;function n_(t){Sg(t,0)}function mo(t){var n=Hs(t);if(_f(n))return t}function Ff(t,n){if(t==="change")return n}var Uf=!1;if(ur){var kc;if(ur){var Ec="oninput"in document;if(!Ec){var $f=document.createElement("div");$f.setAttribute("oninput","return;"),Ec=typeof $f.oninput=="function"}kc=Ec}else kc=!1;Uf=kc&&(!document.documentMode||9<document.documentMode)}function qf(){Ws&&(Ws.detachEvent("onpropertychange",Wf),Gs=Ws=null)}function Wf(t){if(t.propertyName==="value"&&mo(Gs)){var n=[];Pf(n,Gs,t,gc(t)),Nf(n_,n)}}function r_(t,n,a){t==="focusin"?(qf(),Ws=n,Gs=a,Ws.attachEvent("onpropertychange",Wf)):t==="focusout"&&qf()}function i_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return mo(Gs)}function s_(t,n){if(t==="click")return mo(n)}function a_(t,n){if(t==="input"||t==="change")return mo(n)}function o_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Sn=typeof Object.is=="function"?Object.is:o_;function Vs(t,n){if(Sn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),h=Object.keys(n);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var w=a[h];if(!je.call(n,w)||!Sn(t[w],n[w]))return!1}return!0}function Gf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vf(t,n){var a=Gf(t);t=0;for(var h;a;){if(a.nodeType===3){if(h=t+a.textContent.length,t<=n&&h>=n)return{node:a,offset:n-t};t=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Gf(a)}}function Yf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Yf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Kf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=oo(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=oo(t.document)}return n}function jc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var l_=ur&&"documentMode"in document&&11>=document.documentMode,Xi=null,Nc=null,Ys=null,Tc=!1;function Xf(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tc||Xi==null||Xi!==oo(h)||(h=Xi,"selectionStart"in h&&jc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ys&&Vs(Ys,h)||(Ys=h,h=rl(Nc,"onSelect"),0<h.length&&(n=new fo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Xi)))}function ui(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Zi={animationend:ui("Animation","AnimationEnd"),animationiteration:ui("Animation","AnimationIteration"),animationstart:ui("Animation","AnimationStart"),transitionrun:ui("Transition","TransitionRun"),transitionstart:ui("Transition","TransitionStart"),transitioncancel:ui("Transition","TransitionCancel"),transitionend:ui("Transition","TransitionEnd")},Ac={},Zf={};ur&&(Zf=document.createElement("div").style,"AnimationEvent"in window||(delete Zi.animationend.animation,delete Zi.animationiteration.animation,delete Zi.animationstart.animation),"TransitionEvent"in window||delete Zi.transitionend.transition);function di(t){if(Ac[t])return Ac[t];if(!Zi[t])return t;var n=Zi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Zf)return Ac[t]=n[a];return t}var Qf=di("animationend"),Jf=di("animationiteration"),ep=di("animationstart"),c_=di("transitionrun"),u_=di("transitionstart"),d_=di("transitioncancel"),tp=di("transitionend"),np=new Map,Dc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Dc.push("scrollEnd");function Gn(t,n){np.set(t,n),li(n,[t])}var go=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Bn=[],Qi=0,Lc=0;function xo(){for(var t=Qi,n=Lc=Qi=0;n<t;){var a=Bn[n];Bn[n++]=null;var h=Bn[n];Bn[n++]=null;var w=Bn[n];Bn[n++]=null;var E=Bn[n];if(Bn[n++]=null,h!==null&&w!==null){var R=h.pending;R===null?w.next=w:(w.next=R.next,R.next=w),h.pending=w}E!==0&&rp(a,w,E)}}function vo(t,n,a,h){Bn[Qi++]=t,Bn[Qi++]=n,Bn[Qi++]=a,Bn[Qi++]=h,Lc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Rc(t,n,a,h){return vo(t,n,a,h),bo(t)}function hi(t,n){return vo(t,null,null,n),bo(t)}function rp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,E=t.return;E!==null;)E.childLanes|=a,h=E.alternate,h!==null&&(h.childLanes|=a),E.tag===22&&(t=E.stateNode,t===null||t._visibility&1||(w=!0)),t=E,E=E.return;return t.tag===3?(E=t.stateNode,w&&n!==null&&(w=31-qe(a),t=E.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),E):null}function bo(t){if(50<ga)throw ga=0,Uu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Ji={};function h_(t,n,a,h){this.tag=t,this.key=a,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=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(t,n,a,h){return new h_(t,n,a,h)}function Mc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dr(t,n){var a=t.alternate;return a===null?(a=wn(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function ip(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function yo(t,n,a,h,w,E){var R=0;if(h=t,typeof t=="function")Mc(t)&&(R=1);else if(typeof t=="string")R=x1(t,a,re.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=wn(31,a,n,w),t.elementType=I,t.lanes=E,t;case C:return fi(a.children,w,E,n);case v:R=8,w|=24;break;case b:return t=wn(12,a,n,w|2),t.elementType=b,t.lanes=E,t;case A:return t=wn(13,a,n,w),t.elementType=A,t.lanes=E,t;case N:return t=wn(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:R=10;break e;case x:R=9;break e;case j:R=11;break e;case D:R=14;break e;case T:R=16,h=null;break e}R=29,a=Error(s(130,t===null?"null":typeof t,"")),h=null}return n=wn(R,a,n,w),n.elementType=t,n.type=h,n.lanes=E,n}function fi(t,n,a,h){return t=wn(7,t,h,n),t.lanes=a,t}function Oc(t,n,a){return t=wn(6,t,null,n),t.lanes=a,t}function sp(t){var n=wn(18,null,null,0);return n.stateNode=t,n}function Bc(t,n,a){return n=wn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var ap=new WeakMap;function In(t,n){if(typeof t=="object"&&t!==null){var a=ap.get(t);return a!==void 0?a:(n={value:t,source:n,stack:ge(n)},ap.set(t,n),n)}return{value:t,source:n,stack:ge(n)}}var es=[],ts=0,_o=null,Ks=0,zn=[],Hn=0,Lr=null,Zn=1,Qn="";function hr(t,n){es[ts++]=Ks,es[ts++]=_o,_o=t,Ks=n}function op(t,n,a){zn[Hn++]=Zn,zn[Hn++]=Qn,zn[Hn++]=Lr,Lr=t;var h=Zn;t=Qn;var w=32-qe(h)-1;h&=~(1<<w),a+=1;var E=32-qe(n)+w;if(30<E){var R=w-w%5;E=(h&(1<<R)-1).toString(32),h>>=R,w-=R,Zn=1<<32-qe(n)+w|a<<w|h,Qn=E+t}else Zn=1<<E|a<<w|h,Qn=t}function Ic(t){t.return!==null&&(hr(t,1),op(t,1,0))}function zc(t){for(;t===_o;)_o=es[--ts],es[ts]=null,Ks=es[--ts],es[ts]=null;for(;t===Lr;)Lr=zn[--Hn],zn[Hn]=null,Qn=zn[--Hn],zn[Hn]=null,Zn=zn[--Hn],zn[Hn]=null}function lp(t,n){zn[Hn++]=Zn,zn[Hn++]=Qn,zn[Hn++]=Lr,Zn=n.id,Qn=n.overflow,Lr=t}var Jt=null,_t=null,it=!1,Rr=null,Pn=!1,Hc=Error(s(519));function Mr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xs(In(n,t)),Hc}function cp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[Qt]=t,n[fn]=h,a){case"dialog":Je("cancel",n),Je("close",n);break;case"iframe":case"object":case"embed":Je("load",n);break;case"video":case"audio":for(a=0;a<va.length;a++)Je(va[a],n);break;case"source":Je("error",n);break;case"img":case"image":case"link":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"input":Je("invalid",n),Sf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Je("invalid",n);break;case"textarea":Je("invalid",n),Cf(n,h.value,h.defaultValue,h.children)}a=h.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||h.suppressHydrationWarning===!0||Eg(n.textContent,a)?(h.popover!=null&&(Je("beforetoggle",n),Je("toggle",n)),h.onScroll!=null&&Je("scroll",n),h.onScrollEnd!=null&&Je("scrollend",n),h.onClick!=null&&(n.onclick=cr),n=!0):n=!1,n||Mr(t,!0)}function up(t){for(Jt=t.return;Jt;)switch(Jt.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Jt=Jt.return}}function ns(t){if(t!==Jt)return!1;if(!it)return up(t),it=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||rd(t.type,t.memoizedProps)),a=!a),a&&_t&&Mr(t),up(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Og(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Og(t)}else n===27?(n=_t,Yr(t.type)?(t=ld,ld=null,_t=t):_t=n):_t=Jt?Un(t.stateNode.nextSibling):null;return!0}function pi(){_t=Jt=null,it=!1}function Pc(){var t=Rr;return t!==null&&(vn===null?vn=t:vn.push.apply(vn,t),Rr=null),t}function Xs(t){Rr===null?Rr=[t]:Rr.push(t)}var Fc=B(null),mi=null,fr=null;function Or(t,n,a){F(Fc,n._currentValue),n._currentValue=a}function pr(t){t._currentValue=Fc.current,W(Fc)}function Uc(t,n,a){for(;t!==null;){var h=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,h!==null&&(h.childLanes|=n)):h!==null&&(h.childLanes&n)!==n&&(h.childLanes|=n),t===a)break;t=t.return}}function $c(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var R=w.child;E=E.firstContext;e:for(;E!==null;){var G=E;E=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){E.lanes|=a,G=E.alternate,G!==null&&(G.lanes|=a),Uc(E.return,a,t),h||(R=null);break e}E=G.next}}else if(w.tag===18){if(R=w.return,R===null)throw Error(s(341));R.lanes|=a,E=R.alternate,E!==null&&(E.lanes|=a),Uc(R,a,t),R=null}else R=w.child;if(R!==null)R.return=w;else for(R=w;R!==null;){if(R===t){R=null;break}if(w=R.sibling,w!==null){w.return=R.return,R=w;break}R=R.return}w=R}}function rs(t,n,a,h){t=null;for(var w=n,E=!1;w!==null;){if(!E){if((w.flags&524288)!==0)E=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var R=w.alternate;if(R===null)throw Error(s(387));if(R=R.memoizedProps,R!==null){var G=w.type;Sn(w.pendingProps.value,R.value)||(t!==null?t.push(G):t=[G])}}else if(w===K.current){if(R=w.alternate,R===null)throw Error(s(387));R.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(wa):t=[wa])}w=w.return}t!==null&&$c(n,t,a,h),n.flags|=262144}function So(t){for(t=t.firstContext;t!==null;){if(!Sn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function gi(t){mi=t,fr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function en(t){return dp(mi,t)}function wo(t,n){return mi===null&&gi(t),dp(t,n)}function dp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},fr===null){if(t===null)throw Error(s(308));fr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else fr=fr.next=n;return a}var f_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,h){t.push(h)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},p_=e.unstable_scheduleCallback,m_=e.unstable_NormalPriority,Ot={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qc(){return{controller:new f_,data:new Map,refCount:0}}function Zs(t){t.refCount--,t.refCount===0&&p_(m_,function(){t.controller.abort()})}var Qs=null,Wc=0,is=0,ss=null;function g_(t,n){if(Qs===null){var a=Qs=[];Wc=0,is=Yu(),ss={status:"pending",value:void 0,then:function(h){a.push(h)}}}return Wc++,n.then(hp,hp),n}function hp(){if(--Wc===0&&Qs!==null){ss!==null&&(ss.status="fulfilled");var t=Qs;Qs=null,is=0,ss=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function x_(t,n){var a=[],h={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){h.status="fulfilled",h.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(h.status="rejected",h.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),h}var fp=z.S;z.S=function(t,n){Xm=Oe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&g_(t,n),fp!==null&&fp(t,n)};var xi=B(null);function Gc(){var t=xi.current;return t!==null?t:vt.pooledCache}function Co(t,n){n===null?F(xi,xi.current):F(xi,n.pool)}function pp(){var t=Gc();return t===null?null:{parent:Ot._currentValue,pool:t}}var as=Error(s(460)),Vc=Error(s(474)),ko=Error(s(542)),Eo={then:function(){}};function mp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function gp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(cr,cr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,vp(t),t;default:if(typeof n.status=="string")n.then(cr,cr);else{if(t=vt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(h){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=h}},function(h){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=h}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,vp(t),t}throw bi=n,as}}function vi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(bi=a,as):a}}var bi=null;function xp(){if(bi===null)throw Error(s(459));var t=bi;return bi=null,t}function vp(t){if(t===as||t===ko)throw Error(s(483))}var os=null,Js=0;function jo(t){var n=Js;return Js+=1,os===null&&(os=[]),gp(os,t,n)}function ea(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function No(t,n){throw n.$$typeof===y?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function bp(t){function n(ie,te){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[te],ie.flags|=16):oe.push(te)}}function a(ie,te){if(!t)return null;for(;te!==null;)n(ie,te),te=te.sibling;return null}function h(ie){for(var te=new Map;ie!==null;)ie.key!==null?te.set(ie.key,ie):te.set(ie.index,ie),ie=ie.sibling;return te}function w(ie,te){return ie=dr(ie,te),ie.index=0,ie.sibling=null,ie}function E(ie,te,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<te?(ie.flags|=67108866,te):oe):(ie.flags|=67108866,te)):(ie.flags|=1048576,te)}function R(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function G(ie,te,oe,me){return te===null||te.tag!==6?(te=Oc(oe,ie.mode,me),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function J(ie,te,oe,me){var ze=oe.type;return ze===C?he(ie,te,oe.props.children,me,oe.key):te!==null&&(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type)?(te=w(te,oe.props),ea(te,oe),te.return=ie,te):(te=yo(oe.type,oe.key,oe.props,null,ie.mode,me),ea(te,oe),te.return=ie,te)}function le(ie,te,oe,me){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=Bc(oe,ie.mode,me),te.return=ie,te):(te=w(te,oe.children||[]),te.return=ie,te)}function he(ie,te,oe,me,ze){return te===null||te.tag!==7?(te=fi(oe,ie.mode,me,ze),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function xe(ie,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Oc(""+te,ie.mode,oe),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return oe=yo(te.type,te.key,te.props,null,ie.mode,oe),ea(oe,te),oe.return=ie,oe;case k:return te=Bc(te,ie.mode,oe),te.return=ie,te;case T:return te=vi(te),xe(ie,te,oe)}if(U(te)||Y(te))return te=fi(te,ie.mode,oe,null),te.return=ie,te;if(typeof te.then=="function")return xe(ie,jo(te),oe);if(te.$$typeof===S)return xe(ie,wo(ie,te),oe);No(ie,te)}return null}function ce(ie,te,oe,me){var ze=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return ze!==null?null:G(ie,te,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return oe.key===ze?J(ie,te,oe,me):null;case k:return oe.key===ze?le(ie,te,oe,me):null;case T:return oe=vi(oe),ce(ie,te,oe,me)}if(U(oe)||Y(oe))return ze!==null?null:he(ie,te,oe,me,null);if(typeof oe.then=="function")return ce(ie,te,jo(oe),me);if(oe.$$typeof===S)return ce(ie,te,wo(ie,oe),me);No(ie,oe)}return null}function de(ie,te,oe,me,ze){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ie=ie.get(oe)||null,G(te,ie,""+me,ze);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case _:return ie=ie.get(me.key===null?oe:me.key)||null,J(te,ie,me,ze);case k:return ie=ie.get(me.key===null?oe:me.key)||null,le(te,ie,me,ze);case T:return me=vi(me),de(ie,te,oe,me,ze)}if(U(me)||Y(me))return ie=ie.get(oe)||null,he(te,ie,me,ze,null);if(typeof me.then=="function")return de(ie,te,oe,jo(me),ze);if(me.$$typeof===S)return de(ie,te,oe,wo(te,me),ze);No(te,me)}return null}function De(ie,te,oe,me){for(var ze=null,ct=null,Re=te,Xe=te=0,nt=null;Re!==null&&Xe<oe.length;Xe++){Re.index>Xe?(nt=Re,Re=null):nt=Re.sibling;var ut=ce(ie,Re,oe[Xe],me);if(ut===null){Re===null&&(Re=nt);break}t&&Re&&ut.alternate===null&&n(ie,Re),te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut,Re=nt}if(Xe===oe.length)return a(ie,Re),it&&hr(ie,Xe),ze;if(Re===null){for(;Xe<oe.length;Xe++)Re=xe(ie,oe[Xe],me),Re!==null&&(te=E(Re,te,Xe),ct===null?ze=Re:ct.sibling=Re,ct=Re);return it&&hr(ie,Xe),ze}for(Re=h(Re);Xe<oe.length;Xe++)nt=de(Re,ie,Xe,oe[Xe],me),nt!==null&&(t&&nt.alternate!==null&&Re.delete(nt.key===null?Xe:nt.key),te=E(nt,te,Xe),ct===null?ze=nt:ct.sibling=nt,ct=nt);return t&&Re.forEach(function(Jr){return n(ie,Jr)}),it&&hr(ie,Xe),ze}function Pe(ie,te,oe,me){if(oe==null)throw Error(s(151));for(var ze=null,ct=null,Re=te,Xe=te=0,nt=null,ut=oe.next();Re!==null&&!ut.done;Xe++,ut=oe.next()){Re.index>Xe?(nt=Re,Re=null):nt=Re.sibling;var Jr=ce(ie,Re,ut.value,me);if(Jr===null){Re===null&&(Re=nt);break}t&&Re&&Jr.alternate===null&&n(ie,Re),te=E(Jr,te,Xe),ct===null?ze=Jr:ct.sibling=Jr,ct=Jr,Re=nt}if(ut.done)return a(ie,Re),it&&hr(ie,Xe),ze;if(Re===null){for(;!ut.done;Xe++,ut=oe.next())ut=xe(ie,ut.value,me),ut!==null&&(te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut);return it&&hr(ie,Xe),ze}for(Re=h(Re);!ut.done;Xe++,ut=oe.next())ut=de(Re,ie,Xe,ut.value,me),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Xe:ut.key),te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(N1){return n(ie,N1)}),it&&hr(ie,Xe),ze}function xt(ie,te,oe,me){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:e:{for(var ze=oe.key;te!==null;){if(te.key===ze){if(ze=oe.type,ze===C){if(te.tag===7){a(ie,te.sibling),me=w(te,oe.props.children),me.return=ie,ie=me;break e}}else if(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type){a(ie,te.sibling),me=w(te,oe.props),ea(me,oe),me.return=ie,ie=me;break e}a(ie,te);break}else n(ie,te);te=te.sibling}oe.type===C?(me=fi(oe.props.children,ie.mode,me,oe.key),me.return=ie,ie=me):(me=yo(oe.type,oe.key,oe.props,null,ie.mode,me),ea(me,oe),me.return=ie,ie=me)}return R(ie);case k:e:{for(ze=oe.key;te!==null;){if(te.key===ze)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){a(ie,te.sibling),me=w(te,oe.children||[]),me.return=ie,ie=me;break e}else{a(ie,te);break}else n(ie,te);te=te.sibling}me=Bc(oe,ie.mode,me),me.return=ie,ie=me}return R(ie);case T:return oe=vi(oe),xt(ie,te,oe,me)}if(U(oe))return De(ie,te,oe,me);if(Y(oe)){if(ze=Y(oe),typeof ze!="function")throw Error(s(150));return oe=ze.call(oe),Pe(ie,te,oe,me)}if(typeof oe.then=="function")return xt(ie,te,jo(oe),me);if(oe.$$typeof===S)return xt(ie,te,wo(ie,oe),me);No(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(a(ie,te.sibling),me=w(te,oe),me.return=ie,ie=me):(a(ie,te),me=Oc(oe,ie.mode,me),me.return=ie,ie=me),R(ie)):a(ie,te)}return function(ie,te,oe,me){try{Js=0;var ze=xt(ie,te,oe,me);return os=null,ze}catch(Re){if(Re===as||Re===ko)throw Re;var ct=wn(29,Re,null,ie.mode);return ct.lanes=me,ct.return=ie,ct}finally{}}}var yi=bp(!0),yp=bp(!1),Br=!1;function Yc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ir(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function zr(t,n,a){var h=t.updateQueue;if(h===null)return null;if(h=h.shared,(dt&2)!==0){var w=h.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),h.pending=n,n=bo(t),rp(t,null,a),n}return vo(t,h,n,a),bo(t)}function ta(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,df(t,a)}}function Xc(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var R={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=R:E=E.next=R,a=a.next}while(a!==null);E===null?w=E=n:E=E.next=n}else w=E=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Zc=!1;function na(){if(Zc){var t=ss;if(t!==null)throw t}}function ra(t,n,a,h){Zc=!1;var w=t.updateQueue;Br=!1;var E=w.firstBaseUpdate,R=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,R===null?E=le:R.next=le,R=J;var he=t.alternate;he!==null&&(he=he.updateQueue,G=he.lastBaseUpdate,G!==R&&(G===null?he.firstBaseUpdate=le:G.next=le,he.lastBaseUpdate=J))}if(E!==null){var xe=w.baseState;R=0,he=le=J=null,G=E;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(tt&ce)===ce:(h&ce)===ce){ce!==0&&ce===is&&(Zc=!0),he!==null&&(he=he.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var De=t,Pe=G;ce=n;var xt=a;switch(Pe.tag){case 1:if(De=Pe.payload,typeof De=="function"){xe=De.call(xt,xe,ce);break e}xe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Pe.payload,ce=typeof De=="function"?De.call(xt,xe,ce):De,ce==null)break e;xe=m({},xe,ce);break e;case 2:Br=!0}}ce=G.callback,ce!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:G.tag,payload:G.payload,callback:G.callback,next:null},he===null?(le=he=de,J=xe):he=he.next=de,R|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;de=G,G=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);he===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=he,E===null&&(w.shared.lanes=0),$r|=R,t.lanes=R,t.memoizedState=xe}}function _p(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function Sp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)_p(a[t],n)}var ls=B(null),To=B(0);function wp(t,n){t=wr,F(To,t),F(ls,n),wr=t|n.baseLanes}function Qc(){F(To,wr),F(ls,ls.current)}function Jc(){wr=To.current,W(ls),W(To)}var Cn=B(null),Fn=null;function Hr(t){var n=t.alternate;F(Nt,Nt.current&1),F(Cn,t),Fn===null&&(n===null||ls.current!==null||n.memoizedState!==null)&&(Fn=t)}function eu(t){F(Nt,Nt.current),F(Cn,t),Fn===null&&(Fn=t)}function Cp(t){t.tag===22?(F(Nt,Nt.current),F(Cn,t),Fn===null&&(Fn=t)):Pr()}function Pr(){F(Nt,Nt.current),F(Cn,Cn.current)}function kn(t){W(Cn),Fn===t&&(Fn=null),W(Nt)}var Nt=B(0);function Ao(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ad(a)||od(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var mr=0,Ke=null,mt=null,Bt=null,Do=!1,cs=!1,_i=!1,Lo=0,ia=0,us=null,v_=0;function Et(){throw Error(s(321))}function tu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Sn(t[a],n[a]))return!1;return!0}function nu(t,n,a,h,w,E){return mr=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,z.H=t===null||t.memoizedState===null?om:xu,_i=!1,E=a(h,w),_i=!1,cs&&(E=Ep(n,a,h,w)),kp(t),E}function kp(t){z.H=oa;var n=mt!==null&&mt.next!==null;if(mr=0,Bt=mt=Ke=null,Do=!1,ia=0,us=null,n)throw Error(s(300));t===null||It||(t=t.dependencies,t!==null&&So(t)&&(It=!0))}function Ep(t,n,a,h){Ke=t;var w=0;do{if(cs&&(us=null),ia=0,cs=!1,25<=w)throw Error(s(301));if(w+=1,Bt=mt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}z.H=lm,E=n(a,h)}while(cs);return E}function b_(){var t=z.H,n=t.useState()[0];return n=typeof n.then=="function"?sa(n):n,t=t.useState()[0],(mt!==null?mt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function ru(){var t=Lo!==0;return Lo=0,t}function iu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function su(t){if(Do){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Do=!1}mr=0,Bt=mt=Ke=null,cs=!1,ia=Lo=0,us=null}function un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Ke.memoizedState=Bt=t:Bt=Bt.next=t,Bt}function Tt(){if(mt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=mt.next;var n=Bt===null?Ke.memoizedState:Bt.next;if(n!==null)Bt=n,mt=t;else{if(t===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));mt=t,t={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Bt===null?Ke.memoizedState=Bt=t:Bt=Bt.next=t}return Bt}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sa(t){var n=ia;return ia+=1,us===null&&(us=[]),t=gp(us,t,n),n=Ke,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,z.H=n===null||n.memoizedState===null?om:xu),t}function Mo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return sa(t);if(t.$$typeof===S)return en(t)}throw Error(s(438,String(t)))}function au(t){var n=null,a=Ke.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var h=Ke.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(n={data:h.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ro(),Ke.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),h=0;h<t;h++)a[h]=H;return n.index++,a}function gr(t,n){return typeof n=="function"?n(t):n}function Oo(t){var n=Tt();return ou(n,mt,t)}function ou(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,E=h.pending;if(E!==null){if(w!==null){var R=w.next;w.next=E.next,E.next=R}n.baseQueue=w=E,h.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;else{n=w.next;var G=R=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(tt&xe)===xe:(mr&xe)===xe){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),xe===is&&(he=!0);else if((mr&ce)===ce){le=le.next,ce===is&&(he=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=xe,R=E):J=J.next=xe,Ke.lanes|=ce,$r|=ce;xe=le.action,_i&&a(E,xe),E=le.hasEagerState?le.eagerState:a(E,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ce,R=E):J=J.next=ce,Ke.lanes|=xe,$r|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?R=E:J.next=G,!Sn(E,t.memoizedState)&&(It=!0,he&&(a=ss,a!==null)))throw a;t.memoizedState=E,t.baseState=R,t.baseQueue=J,h.lastRenderedState=E}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function lu(t){var n=Tt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,E=n.memoizedState;if(w!==null){a.pending=null;var R=w=w.next;do E=t(E,R.action),R=R.next;while(R!==w);Sn(E,n.memoizedState)||(It=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,h]}function jp(t,n,a){var h=Ke,w=Tt(),E=it;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=n();var R=!Sn((mt||w).memoizedState,a);if(R&&(w.memoizedState=a,It=!0),w=w.queue,du(Ap.bind(null,h,w,t),[t]),w.getSnapshot!==n||R||Bt!==null&&Bt.memoizedState.tag&1){if(h.flags|=2048,ds(9,{destroy:void 0},Tp.bind(null,h,w,a,n),null),vt===null)throw Error(s(349));E||(mr&127)!==0||Np(h,n,a)}return a}function Np(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Ro(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Tp(t,n,a,h){n.value=a,n.getSnapshot=h,Dp(n)&&Lp(t)}function Ap(t,n,a){return a(function(){Dp(n)&&Lp(t)})}function Dp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Sn(t,a)}catch{return!0}}function Lp(t){var n=hi(t,2);n!==null&&bn(n,t,2)}function cu(t){var n=un();if(typeof t=="function"){var a=t;if(t=a(),_i){at(!0);try{a()}finally{at(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:t},n}function Rp(t,n,a,h){return t.baseState=a,ou(t,mt,typeof h=="function"?h:gr)}function y_(t,n,a,h,w){if(zo(t))throw Error(s(485));if(t=n.action,t!==null){var E={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){E.listeners.push(R)}};z.T!==null?a(!0):E.isTransition=!1,h(E),a=n.pending,a===null?(E.next=n.pending=E,Mp(n,E)):(E.next=a.next,n.pending=a.next=E)}}function Mp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var E=z.T,R={};z.T=R;try{var G=a(w,h),J=z.S;J!==null&&J(R,G),Op(t,n,G)}catch(le){uu(t,n,le)}finally{E!==null&&R.types!==null&&(E.types=R.types),z.T=E}}else try{E=a(w,h),Op(t,n,E)}catch(le){uu(t,n,le)}}function Op(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Bp(t,n,h)},function(h){return uu(t,n,h)}):Bp(t,n,a)}function Bp(t,n,a){n.status="fulfilled",n.value=a,Ip(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Mp(t,a)))}function uu(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Ip(n),n=n.next;while(n!==h)}t.action=null}function Ip(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function zp(t,n){return n}function Hp(t,n){if(it){var a=vt.formState;if(a!==null){e:{var h=Ke;if(it){if(_t){t:{for(var w=_t,E=Pn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Un(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){_t=Un(w.nextSibling),h=w.data==="F!";break e}}Mr(h)}h=!1}h&&(n=a[0])}}return a=un(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zp,lastRenderedState:n},a.queue=h,a=im.bind(null,Ke,h),h.dispatch=a,h=cu(!1),E=gu.bind(null,Ke,!1,h.queue),h=un(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=y_.bind(null,Ke,w,E,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Pp(t){var n=Tt();return Fp(n,mt,t)}function Fp(t,n,a){if(n=ou(t,n,zp)[0],t=Oo(gr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=sa(n)}catch(R){throw R===as?ko:R}else h=n;n=Tt();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,ds(9,{destroy:void 0},__.bind(null,w,a),null)),[h,E,t]}function __(t,n){t.action=n}function Up(t){var n=Tt(),a=mt;if(a!==null)return Fp(n,a,t);Tt(),n=n.memoizedState,a=Tt();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function ds(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Ro(),Ke.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(h=a.next,a.next=t,t.next=h,n.lastEffect=t),t}function $p(){return Tt().memoizedState}function Bo(t,n,a,h){var w=un();Ke.flags|=t,w.memoizedState=ds(1|n,{destroy:void 0},a,h===void 0?null:h)}function Io(t,n,a,h){var w=Tt();h=h===void 0?null:h;var E=w.memoizedState.inst;mt!==null&&h!==null&&tu(h,mt.memoizedState.deps)?w.memoizedState=ds(n,E,a,h):(Ke.flags|=t,w.memoizedState=ds(1|n,E,a,h))}function qp(t,n){Bo(8390656,8,t,n)}function du(t,n){Io(2048,8,t,n)}function S_(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Ro(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Wp(t){var n=Tt().memoizedState;return S_({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Gp(t,n){return Io(4,2,t,n)}function Vp(t,n){return Io(4,4,t,n)}function Yp(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Kp(t,n,a){a=a!=null?a.concat([t]):null,Io(4,4,Yp.bind(null,n,t),a)}function hu(){}function Xp(t,n){var a=Tt();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&tu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function Zp(t,n){var a=Tt();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&tu(n,h[1]))return h[0];if(h=t(),_i){at(!0);try{t()}finally{at(!1)}}return a.memoizedState=[h,n],h}function fu(t,n,a){return a===void 0||(mr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Qm(),Ke.lanes|=t,$r|=t,a)}function Qp(t,n,a,h){return Sn(a,n)?a:ls.current!==null?(t=fu(t,a,h),Sn(t,n)||(It=!0),t):(mr&42)===0||(mr&1073741824)!==0&&(tt&261930)===0?(It=!0,t.memoizedState=a):(t=Qm(),Ke.lanes|=t,$r|=t,n)}function Jp(t,n,a,h,w){var E=X.p;X.p=E!==0&&8>E?E:8;var R=z.T,G={};z.T=G,gu(t,!1,n,a);try{var J=w(),le=z.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=x_(J,h);aa(t,n,he,Nn(t))}else aa(t,n,h,Nn(t))}catch(xe){aa(t,n,{then:function(){},status:"rejected",reason:xe},Nn())}finally{X.p=E,R!==null&&G.types!==null&&(R.types=G.types),z.T=R}}function w_(){}function pu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=em(t).queue;Jp(t,w,n,Q,a===null?w_:function(){return tm(t),a(h)})}function em(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:Q},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function tm(t){var n=em(t);n.next===null&&(n=t.alternate.memoizedState),aa(t,n.next.queue,{},Nn())}function mu(){return en(wa)}function nm(){return Tt().memoizedState}function rm(){return Tt().memoizedState}function C_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Nn();t=Ir(a);var h=zr(n,t,a);h!==null&&(bn(h,n,a),ta(h,n,a)),n={cache:qc()},t.payload=n;return}n=n.return}}function k_(t,n,a){var h=Nn();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},zo(t)?sm(n,a):(a=Rc(t,n,a,h),a!==null&&(bn(a,t,h),am(a,n,h)))}function im(t,n,a){var h=Nn();aa(t,n,a,h)}function aa(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(zo(t))sm(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var R=n.lastRenderedState,G=E(R,a);if(w.hasEagerState=!0,w.eagerState=G,Sn(G,R))return vo(t,n,w,0),vt===null&&xo(),!1}catch{}finally{}if(a=Rc(t,n,w,h),a!==null)return bn(a,t,h),am(a,n,h),!0}return!1}function gu(t,n,a,h){if(h={lane:2,revertLane:Yu(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},zo(t)){if(n)throw Error(s(479))}else n=Rc(t,a,h,2),n!==null&&bn(n,t,2)}function zo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function sm(t,n){cs=Do=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function am(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,df(t,a)}}var oa={readContext:en,use:Mo,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};oa.useEffectEvent=Et;var om={readContext:en,use:Mo,useCallback:function(t,n){return un().memoizedState=[t,n===void 0?null:n],t},useContext:en,useEffect:qp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Bo(4194308,4,Yp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Bo(4194308,4,t,n)},useInsertionEffect:function(t,n){Bo(4,2,t,n)},useMemo:function(t,n){var a=un();n=n===void 0?null:n;var h=t();if(_i){at(!0);try{t()}finally{at(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=un();if(a!==void 0){var w=a(n);if(_i){at(!0);try{a(n)}finally{at(!1)}}}else w=n;return h.memoizedState=h.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},h.queue=t,t=t.dispatch=k_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=un();return t={current:t},n.memoizedState=t},useState:function(t){t=cu(t);var n=t.queue,a=im.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:hu,useDeferredValue:function(t,n){var a=un();return fu(a,t,n)},useTransition:function(){var t=cu(!1);return t=Jp.bind(null,Ke,t.queue,!0,!1),un().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=un();if(it){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),vt===null)throw Error(s(349));(tt&127)!==0||Np(h,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,qp(Ap.bind(null,h,E,t),[t]),h.flags|=2048,ds(9,{destroy:void 0},Tp.bind(null,h,E,a,n),null),a},useId:function(){var t=un(),n=vt.identifierPrefix;if(it){var a=Qn,h=Zn;a=(h&~(1<<32-qe(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Lo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=v_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:mu,useFormState:Hp,useActionState:Hp,useOptimistic:function(t){var n=un();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=gu.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:au,useCacheRefresh:function(){return un().memoizedState=C_.bind(null,Ke)},useEffectEvent:function(t){var n=un(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},xu={readContext:en,use:Mo,useCallback:Xp,useContext:en,useEffect:du,useImperativeHandle:Kp,useInsertionEffect:Gp,useLayoutEffect:Vp,useMemo:Zp,useReducer:Oo,useRef:$p,useState:function(){return Oo(gr)},useDebugValue:hu,useDeferredValue:function(t,n){var a=Tt();return Qp(a,mt.memoizedState,t,n)},useTransition:function(){var t=Oo(gr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:jp,useId:nm,useHostTransitionStatus:mu,useFormState:Pp,useActionState:Pp,useOptimistic:function(t,n){var a=Tt();return Rp(a,mt,t,n)},useMemoCache:au,useCacheRefresh:rm};xu.useEffectEvent=Wp;var lm={readContext:en,use:Mo,useCallback:Xp,useContext:en,useEffect:du,useImperativeHandle:Kp,useInsertionEffect:Gp,useLayoutEffect:Vp,useMemo:Zp,useReducer:lu,useRef:$p,useState:function(){return lu(gr)},useDebugValue:hu,useDeferredValue:function(t,n){var a=Tt();return mt===null?fu(a,t,n):Qp(a,mt.memoizedState,t,n)},useTransition:function(){var t=lu(gr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:jp,useId:nm,useHostTransitionStatus:mu,useFormState:Up,useActionState:Up,useOptimistic:function(t,n){var a=Tt();return mt!==null?Rp(a,mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:au,useCacheRefresh:rm};lm.useEffectEvent=Wp;function vu(t,n,a,h){n=t.memoizedState,a=a(h,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var bu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=Nn(),w=Ir(h);w.payload=n,a!=null&&(w.callback=a),n=zr(t,w,h),n!==null&&(bn(n,t,h),ta(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=Nn(),w=Ir(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=zr(t,w,h),n!==null&&(bn(n,t,h),ta(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Nn(),h=Ir(a);h.tag=2,n!=null&&(h.callback=n),n=zr(t,h,a),n!==null&&(bn(n,t,a),ta(n,t,a))}};function cm(t,n,a,h,w,E,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,E,R):n.prototype&&n.prototype.isPureReactComponent?!Vs(a,h)||!Vs(w,E):!0}function um(t,n,a,h){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,h),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,h),n.state!==t&&bu.enqueueReplaceState(n,n.state,null)}function Si(t,n){var a=n;if("ref"in n){a={};for(var h in n)h!=="ref"&&(a[h]=n[h])}if(t=t.defaultProps){a===n&&(a=m({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function dm(t){go(t)}function hm(t){console.error(t)}function fm(t){go(t)}function Ho(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function pm(t,n,a){try{var h=t.onCaughtError;h(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function yu(t,n,a){return a=Ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Ho(t,n)},a}function mm(t){return t=Ir(t),t.tag=3,t}function gm(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var E=h.value;t.payload=function(){return w(E)},t.callback=function(){pm(n,a,h)}}var R=a.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(t.callback=function(){pm(n,a,h),typeof w!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function E_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&rs(n,a,w,!0),a=Cn.current,a!==null){switch(a.tag){case 31:case 13:return Fn===null?Zo():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Eo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),Wu(t,h,w)),!1;case 22:return a.flags|=65536,h===Eo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([h])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([h]):a.add(h)),Wu(t,h,w)),!1}throw Error(s(435,a.tag))}return Wu(t,h,w),Zo(),!1}if(it)return n=Cn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==Hc&&(t=Error(s(422),{cause:h}),Xs(In(t,a)))):(h!==Hc&&(n=Error(s(423),{cause:h}),Xs(In(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=In(h,a),w=yu(t.stateNode,h,w),Xc(t,w),jt!==4&&(jt=2)),!1;var E=Error(s(520),{cause:h});if(E=In(E,a),ma===null?ma=[E]:ma.push(E),jt!==4&&(jt=2),n===null)return!0;h=In(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=yu(a.stateNode,h,t),Xc(a,t),!1;case 1:if(n=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(qr===null||!qr.has(E))))return a.flags|=65536,w&=-w,a.lanes|=w,w=mm(w),gm(w,t,a,h),Xc(a,w),!1}a=a.return}while(a!==null);return!1}var _u=Error(s(461)),It=!1;function tn(t,n,a,h){n.child=t===null?yp(n,null,a,h):yi(n,t.child,a,h)}function xm(t,n,a,h,w){a=a.render;var E=n.ref;if("ref"in h){var R={};for(var G in h)G!=="ref"&&(R[G]=h[G])}else R=h;return gi(n),h=nu(t,n,a,R,E,w),G=ru(),t!==null&&!It?(iu(t,n,w),xr(t,n,w)):(it&&G&&Ic(n),n.flags|=1,tn(t,n,h,w),n.child)}function vm(t,n,a,h,w){if(t===null){var E=a.type;return typeof E=="function"&&!Mc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,bm(t,n,E,h,w)):(t=yo(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Tu(t,w)){var R=E.memoizedProps;if(a=a.compare,a=a!==null?a:Vs,a(R,h)&&t.ref===n.ref)return xr(t,n,w)}return n.flags|=1,t=dr(E,h),t.ref=n.ref,t.return=n,n.child=t}function bm(t,n,a,h,w){if(t!==null){var E=t.memoizedProps;if(Vs(E,h)&&t.ref===n.ref)if(It=!1,n.pendingProps=h=E,Tu(t,w))(t.flags&131072)!==0&&(It=!0);else return n.lanes=t.lanes,xr(t,n,w)}return Su(t,n,a,h,w)}function ym(t,n,a,h){var w=h.children,E=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~E}else h=0,n.child=null;return _m(t,n,E,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Co(n,E!==null?E.cachePool:null),E!==null?wp(n,E):Qc(),Cp(n);else return h=n.lanes=536870912,_m(t,n,E!==null?E.baseLanes|a:a,a,h)}else E!==null?(Co(n,E.cachePool),wp(n,E),Pr(),n.memoizedState=null):(t!==null&&Co(n,null),Qc(),Pr());return tn(t,n,w,a),n.child}function la(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function _m(t,n,a,h,w){var E=Gc();return E=E===null?null:{parent:Ot._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&Co(n,null),Qc(),Cp(n),t!==null&&rs(t,n,h,!0),n.childLanes=w,null}function Po(t,n){return n=Uo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Sm(t,n,a){return yi(n,t.child,null,a),t=Po(n,n.pendingProps),t.flags|=2,kn(n),n.memoizedState=null,t}function j_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(h.mode==="hidden")return t=Po(n,h),n.lanes=536870912,la(null,t);if(eu(n),(t=_t)?(t=Mg(t,Pn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Lr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=sp(t),a.return=n,n.child=a,Jt=n,_t=null)):t=null,t===null)throw Mr(n);return n.lanes=536870912,null}return Po(n,h)}var E=t.memoizedState;if(E!==null){var R=E.dehydrated;if(eu(n),w)if(n.flags&256)n.flags&=-257,n=Sm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(It||rs(t,n,a,!1),w=(a&t.childLanes)!==0,It||w){if(h=vt,h!==null&&(R=hf(h,a),R!==0&&R!==E.retryLane))throw E.retryLane=R,hi(t,R),bn(h,t,R),_u;Zo(),n=Sm(t,n,a)}else t=E.treeContext,_t=Un(R.nextSibling),Jt=n,it=!0,Rr=null,Pn=!1,t!==null&&lp(n,t),n=Po(n,h),n.flags|=4096;return n}return t=dr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Fo(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Su(t,n,a,h,w){return gi(n),a=nu(t,n,a,h,void 0,w),h=ru(),t!==null&&!It?(iu(t,n,w),xr(t,n,w)):(it&&h&&Ic(n),n.flags|=1,tn(t,n,a,w),n.child)}function wm(t,n,a,h,w,E){return gi(n),n.updateQueue=null,a=Ep(n,h,a,w),kp(t),h=ru(),t!==null&&!It?(iu(t,n,E),xr(t,n,E)):(it&&h&&Ic(n),n.flags|=1,tn(t,n,a,E),n.child)}function Cm(t,n,a,h,w){if(gi(n),n.stateNode===null){var E=Ji,R=a.contextType;typeof R=="object"&&R!==null&&(E=en(R)),E=new a(h,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=bu,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=h,E.state=n.memoizedState,E.refs={},Yc(n),R=a.contextType,E.context=typeof R=="object"&&R!==null?en(R):Ji,E.state=n.memoizedState,R=a.getDerivedStateFromProps,typeof R=="function"&&(vu(n,a,R,h),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(R=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),R!==E.state&&bu.enqueueReplaceState(E,E.state,null),ra(n,h,E,w),na(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){E=n.stateNode;var G=n.memoizedProps,J=Si(a,G);E.props=J;var le=E.context,he=a.contextType;R=Ji,typeof he=="object"&&he!==null&&(R=en(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,he||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(G||le!==R)&&um(n,E,h,R),Br=!1;var ce=n.memoizedState;E.state=ce,ra(n,h,E,w),na(),le=n.memoizedState,G||ce!==le||Br?(typeof xe=="function"&&(vu(n,a,xe,h),le=n.memoizedState),(J=Br||cm(n,a,J,h,ce,le,R))?(he||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(n.flags|=4194308)):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),E.props=h,E.state=le,E.context=R,h=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{E=n.stateNode,Kc(t,n),R=n.memoizedProps,he=Si(a,R),E.props=he,xe=n.pendingProps,ce=E.context,le=a.contextType,J=Ji,typeof le=="object"&&le!==null&&(J=en(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(R!==xe||ce!==J)&&um(n,E,h,J),Br=!1,ce=n.memoizedState,E.state=ce,ra(n,h,E,w),na();var de=n.memoizedState;R!==xe||ce!==de||Br||t!==null&&t.dependencies!==null&&So(t.dependencies)?(typeof G=="function"&&(vu(n,a,G,h),de=n.memoizedState),(he=Br||cm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&So(t.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(h,de,J),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(h,de,J)),typeof E.componentDidUpdate=="function"&&(n.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof E.componentDidUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),E.props=h,E.state=de,E.context=J,h=he):(typeof E.componentDidUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return E=h,Fo(t,n),h=(n.flags&128)!==0,E||h?(E=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&h?(n.child=yi(n,t.child,null,w),n.child=yi(n,null,a,w)):tn(t,n,a,w),n.memoizedState=E.state,t=n.child):t=xr(t,n,w),t}function km(t,n,a,h){return pi(),n.flags|=256,tn(t,n,a,h),n.child}var wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cu(t){return{baseLanes:t,cachePool:pp()}}function ku(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=jn),t}function Em(t,n,a){var h=n.pendingProps,w=!1,E=(n.flags&128)!==0,R;if((R=E)||(R=t!==null&&t.memoizedState===null?!1:(Nt.current&2)!==0),R&&(w=!0,n.flags&=-129),R=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?Hr(n):Pr(),(t=_t)?(t=Mg(t,Pn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Lr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=sp(t),a.return=n,n.child=a,Jt=n,_t=null)):t=null,t===null)throw Mr(n);return od(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?(Pr(),w=n.mode,G=Uo({mode:"hidden",children:G},w),h=fi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=Cu(a),h.childLanes=ku(t,R,a),n.memoizedState=wu,la(null,h)):(Hr(n),Eu(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(E)n.flags&256?(Hr(n),n.flags&=-257,n=ju(t,n,a)):n.memoizedState!==null?(Pr(),n.child=t.child,n.flags|=128,n=null):(Pr(),G=h.fallback,w=n.mode,h=Uo({mode:"visible",children:h.children},w),G=fi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,yi(n,t.child,null,a),h=n.child,h.memoizedState=Cu(a),h.childLanes=ku(t,R,a),n.memoizedState=wu,n=la(null,h));else if(Hr(n),od(G)){if(R=G.nextSibling&&G.nextSibling.dataset,R)var le=R.dgst;R=le,h=Error(s(419)),h.stack="",h.digest=R,Xs({value:h,source:null,stack:null}),n=ju(t,n,a)}else if(It||rs(t,n,a,!1),R=(a&t.childLanes)!==0,It||R){if(R=vt,R!==null&&(h=hf(R,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,hi(t,h),bn(R,t,h),_u;ad(G)||Zo(),n=ju(t,n,a)}else ad(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,_t=Un(G.nextSibling),Jt=n,it=!0,Rr=null,Pn=!1,t!==null&&lp(n,t),n=Eu(n,h.children),n.flags|=4096);return n}return w?(Pr(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=dr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=dr(le,G):(G=fi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,la(null,h),h=n.child,G=t.child.memoizedState,G===null?G=Cu(a):(w=G.cachePool,w!==null?(J=Ot._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=pp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=ku(t,R,a),n.memoizedState=wu,la(t.child,h)):(Hr(n),a=t.child,t=a.sibling,a=dr(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(R=n.deletions,R===null?(n.deletions=[t],n.flags|=16):R.push(t)),n.child=a,n.memoizedState=null,a)}function Eu(t,n){return n=Uo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Uo(t,n){return t=wn(22,t,null,n),t.lanes=0,t}function ju(t,n,a){return yi(n,t.child,null,a),t=Eu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function jm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),Uc(t.return,n,a)}function Nu(t,n,a,h,w,E){var R=t.memoizedState;R===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:E}:(R.isBackwards=n,R.rendering=null,R.renderingStartTime=0,R.last=h,R.tail=a,R.tailMode=w,R.treeForkCount=E)}function Nm(t,n,a){var h=n.pendingProps,w=h.revealOrder,E=h.tail;h=h.children;var R=Nt.current,G=(R&2)!==0;if(G?(R=R&1|2,n.flags|=128):R&=1,F(Nt,R),tn(t,n,h,a),h=it?Ks:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&jm(t,a,n);else if(t.tag===19)jm(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(w){case"forwards":for(a=n.child,w=null;a!==null;)t=a.alternate,t!==null&&Ao(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Nu(n,!1,w,a,E,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Ao(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Nu(n,!0,a,null,E,h);break;case"together":Nu(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function xr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),$r|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(rs(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,a=dr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=dr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Tu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&So(t)))}function N_(t,n,a){switch(n.tag){case 3:$(n,n.stateNode.containerInfo),Or(n,Ot,t.memoizedState.cache),pi();break;case 27:case 5:ne(n);break;case 4:$(n,n.stateNode.containerInfo);break;case 10:Or(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,eu(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(Hr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Em(t,n,a):(Hr(n),t=xr(t,n,a),t!==null?t.sibling:null);Hr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(rs(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Nm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(Nt,Nt.current),h)break;return null;case 22:return n.lanes=0,ym(t,n,a,n.pendingProps);case 24:Or(n,Ot,t.memoizedState.cache)}return xr(t,n,a)}function Tm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)It=!0;else{if(!Tu(t,a)&&(n.flags&128)===0)return It=!1,N_(t,n,a);It=(t.flags&131072)!==0}else It=!1,it&&(n.flags&1048576)!==0&&op(n,Ks,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=vi(n.elementType),n.type=t,typeof t=="function")Mc(t)?(h=Si(t,h),n.tag=1,n=Cm(null,n,t,h,a)):(n.tag=0,n=Su(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=xm(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=vm(null,n,t,h,a);break e}}throw n=O(t)||t,Error(s(306,n,""))}}return n;case 0:return Su(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Si(h,n.pendingProps),Cm(t,n,h,w,a);case 3:e:{if($(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var E=n.memoizedState;w=E.element,Kc(t,n),ra(n,h,null,a);var R=n.memoizedState;if(h=R.cache,Or(n,Ot,h),h!==E.cache&&$c(n,[Ot],a,!0),na(),h=R.element,E.isDehydrated)if(E={element:h,isDehydrated:!1,cache:R.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=km(t,n,h,a);break e}else if(h!==w){w=In(Error(s(424)),n),Xs(w),n=km(t,n,h,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(_t=Un(t.firstChild),Jt=n,it=!0,Rr=null,Pn=!0,a=yp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(pi(),h===w){n=xr(t,n,a);break e}tn(t,n,h,a)}n=n.child}return n;case 26:return Fo(t,n),t===null?(a=Pg(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,h=il(ee.current).createElement(a),h[Qt]=n,h[fn]=t,nn(h,a,t),Yt(h),n.stateNode=h):n.memoizedState=Pg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ne(n),t===null&&it&&(h=n.stateNode=Ig(n.type,n.pendingProps,ee.current),Jt=n,Pn=!0,w=_t,Yr(n.type)?(ld=w,_t=Un(h.firstChild)):_t=w),tn(t,n,n.pendingProps.children,a),Fo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=h=_t)&&(h=i1(h,n.type,n.pendingProps,Pn),h!==null?(n.stateNode=h,Jt=n,_t=Un(h.firstChild),Pn=!1,w=!0):w=!1),w||Mr(n)),ne(n),w=n.type,E=n.pendingProps,R=t!==null?t.memoizedProps:null,h=E.children,rd(w,E)?h=null:R!==null&&rd(w,R)&&(n.flags|=32),n.memoizedState!==null&&(w=nu(t,n,b_,null,null,a),wa._currentValue=w),Fo(t,n),tn(t,n,h,a),n.child;case 6:return t===null&&it&&((t=a=_t)&&(a=s1(a,n.pendingProps,Pn),a!==null?(n.stateNode=a,Jt=n,_t=null,t=!0):t=!1),t||Mr(n)),null;case 13:return Em(t,n,a);case 4:return $(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=yi(n,null,h,a):tn(t,n,h,a),n.child;case 11:return xm(t,n,n.type,n.pendingProps,a);case 7:return tn(t,n,n.pendingProps,a),n.child;case 8:return tn(t,n,n.pendingProps.children,a),n.child;case 12:return tn(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,Or(n,n.type,h.value),tn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,gi(n),w=en(w),h=h(w),n.flags|=1,tn(t,n,h,a),n.child;case 14:return vm(t,n,n.type,n.pendingProps,a);case 15:return bm(t,n,n.type,n.pendingProps,a);case 19:return Nm(t,n,a);case 31:return j_(t,n,a);case 22:return ym(t,n,a,n.pendingProps);case 24:return gi(n),h=en(Ot),t===null?(w=Gc(),w===null&&(w=vt,E=qc(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:h,cache:w},Yc(n),Or(n,Ot,w)):((t.lanes&a)!==0&&(Kc(t,n),ra(n,null,null,a),na()),w=t.memoizedState,E=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Or(n,Ot,h)):(h=E.cache,Or(n,Ot,h),h!==w.cache&&$c(n,[Ot],a,!0))),tn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function vr(t){t.flags|=4}function Au(t,n,a,h,w){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(w&335544128)===w)if(t.stateNode.complete)t.flags|=8192;else if(ng())t.flags|=8192;else throw bi=Eo,Vc}else t.flags&=-16777217}function Am(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Wg(n))if(ng())t.flags|=8192;else throw bi=Eo,Vc}function $o(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Mt():536870912,t.lanes|=n,ms|=n)}function ca(t,n){if(!it)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function St(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,h=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags&65011712,h|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags,h|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=h,t.childLanes=a,n}function T_(t,n,a){var h=n.pendingProps;switch(zc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(n),null;case 1:return St(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),pr(Ot),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(ns(n)?vr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Pc())),St(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(vr(n),E!==null?(St(n),Am(n,E)):(St(n),Au(n,w,null,h,a))):E?E!==t.memoizedState?(vr(n),St(n),Am(n,E)):(St(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&vr(n),St(n),Au(n,w,t,h,a)),null;case 27:if(ve(n),a=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}t=re.current,ns(n)?cp(n):(t=Ig(w,h,a),n.stateNode=t,vr(n))}return St(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}if(E=re.current,ns(n))cp(n);else{var R=il(ee.current);switch(E){case 1:E=R.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=R.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=R.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof h.is=="string"?R.createElement("select",{is:h.is}):R.createElement("select"),h.multiple?E.multiple=!0:h.size&&(E.size=h.size);break;default:E=typeof h.is=="string"?R.createElement(w,{is:h.is}):R.createElement(w)}}E[Qt]=n,E[fn]=h;e:for(R=n.child;R!==null;){if(R.tag===5||R.tag===6)E.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===n)break e;for(;R.sibling===null;){if(R.return===null||R.return===n)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}n.stateNode=E;e:switch(nn(E,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&vr(n)}}return St(n),Au(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ee.current,ns(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=Jt,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[Qt]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Eg(t.nodeValue,a)),t||Mr(n,!0)}else t=il(t).createTextNode(h),t[Qt]=n,n.stateNode=t}return St(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=ns(n),a!==null){if(t===null){if(!h)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Qt]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),t=!1}else a=Pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(kn(n),n):(kn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return St(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=ns(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(s(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[Qt]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),w=!1}else w=Pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(kn(n),n):(kn(n),null)}return kn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=h!==null,t=t!==null&&t.memoizedState!==null,a&&(h=n.child,w=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(w=h.alternate.memoizedState.cachePool.pool),E=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(E=h.memoizedState.cachePool.pool),E!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),$o(n,n.updateQueue),St(n),null);case 4:return ae(),t===null&&Qu(n.stateNode.containerInfo),St(n),null;case 10:return pr(n.type),St(n),null;case 19:if(W(Nt),h=n.memoizedState,h===null)return St(n),null;if(w=(n.flags&128)!==0,E=h.rendering,E===null)if(w)ca(h,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=Ao(t),E!==null){for(n.flags|=128,ca(h,!1),t=E.updateQueue,n.updateQueue=t,$o(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)ip(a,t),a=a.sibling;return F(Nt,Nt.current&1|2),it&&hr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Oe()>Yo&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304)}else{if(!w)if(t=Ao(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,$o(n,t),ca(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!it)return St(n),null}else 2*Oe()-h.renderingStartTime>Yo&&a!==536870912&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304);h.isBackwards?(E.sibling=n.child,n.child=E):(t=h.last,t!==null?t.sibling=E:n.child=E,h.last=E)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Oe(),t.sibling=null,a=Nt.current,F(Nt,w?a&1|2:a&1),it&&hr(n,h.treeForkCount),t):(St(n),null);case 22:case 23:return kn(n),Jc(),h=n.memoizedState!==null,t!==null?t.memoizedState!==null!==h&&(n.flags|=8192):h&&(n.flags|=8192),h?(a&536870912)!==0&&(n.flags&128)===0&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),a=n.updateQueue,a!==null&&$o(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),h=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(h=n.memoizedState.cachePool.pool),h!==a&&(n.flags|=2048),t!==null&&W(xi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),pr(Ot),St(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function A_(t,n){switch(zc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return pr(Ot),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ve(n),null;case 31:if(n.memoizedState!==null){if(kn(n),n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(kn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return W(Nt),null;case 4:return ae(),null;case 10:return pr(n.type),null;case 22:case 23:return kn(n),Jc(),t!==null&&W(xi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return pr(Ot),null;case 25:return null;default:return null}}function Dm(t,n){switch(zc(n),n.tag){case 3:pr(Ot),ae();break;case 26:case 27:case 5:ve(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&kn(n);break;case 13:kn(n);break;case 19:W(Nt);break;case 10:pr(n.type);break;case 22:case 23:kn(n),Jc(),t!==null&&W(xi);break;case 24:pr(Ot)}}function ua(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var E=a.create,R=a.inst;h=E(),R.destroy=h}a=a.next}while(a!==w)}}catch(G){ft(n,n.return,G)}}function Fr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var E=w.next;h=E;do{if((h.tag&t)===t){var R=h.inst,G=R.destroy;if(G!==void 0){R.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(he){ft(w,J,he)}}}h=h.next}while(h!==E)}}catch(he){ft(n,n.return,he)}}function Lm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Sp(n,a)}catch(h){ft(t,t.return,h)}}}function Rm(t,n,a){a.props=Si(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function da(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var h=t.stateNode;break;case 30:h=t.stateNode;break;default:h=t.stateNode}typeof a=="function"?t.refCleanup=a(h):a.current=h}}catch(w){ft(t,n,w)}}function Jn(t,n){var a=t.ref,h=t.refCleanup;if(a!==null)if(typeof h=="function")try{h()}catch(w){ft(t,n,w)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(w){ft(t,n,w)}else a.current=null}function Mm(t){var n=t.type,a=t.memoizedProps,h=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&h.focus();break e;case"img":a.src?h.src=a.src:a.srcSet&&(h.srcset=a.srcSet)}}catch(w){ft(t,t.return,w)}}function Du(t,n,a){try{var h=t.stateNode;Q_(h,t.type,a,n),h[fn]=n}catch(w){ft(t,t.return,w)}}function Om(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Yr(t.type)||t.tag===4}function Lu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Om(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Yr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ru(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=cr));else if(h!==4&&(h===27&&Yr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Ru(t,n,a),t=t.sibling;t!==null;)Ru(t,n,a),t=t.sibling}function qo(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(h!==4&&(h===27&&Yr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(qo(t,n,a),t=t.sibling;t!==null;)qo(t,n,a),t=t.sibling}function Bm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);nn(n,h,a),n[Qt]=t,n[fn]=a}catch(E){ft(t,t.return,E)}}var br=!1,zt=!1,Mu=!1,Im=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function D_(t,n){if(t=t.containerInfo,td=dl,t=Kf(t),jc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,E=h.focusNode;h=h.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var R=0,G=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var de;xe!==a||w!==0&&xe.nodeType!==3||(G=R+w),xe!==E||h!==0&&xe.nodeType!==3||(J=R+h),xe.nodeType===3&&(R+=xe.nodeValue.length),(de=xe.firstChild)!==null;)ce=xe,xe=de;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&(G=R),ce===E&&++he===h&&(J=R),(de=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=de}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(nd={focusedElem:t,selectionRange:a},dl=!1,Kt=n;Kt!==null;)if(n=Kt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Kt=t;else for(;Kt!==null;){switch(n=Kt,E=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&E!==null){t=void 0,a=n,w=E.memoizedProps,E=E.memoizedState,h=a.stateNode;try{var De=Si(a.type,w);t=h.getSnapshotBeforeUpdate(De,E),h.__reactInternalSnapshotBeforeUpdate=t}catch(Pe){ft(a,a.return,Pe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)sd(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":sd(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,Kt=t;break}Kt=n.return}}function zm(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:_r(t,a),h&4&&ua(5,a);break;case 1:if(_r(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(R){ft(a,a.return,R)}else{var w=Si(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(R){ft(a,a.return,R)}}h&64&&Lm(a),h&512&&da(a,a.return);break;case 3:if(_r(t,a),h&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Sp(t,n)}catch(R){ft(a,a.return,R)}}break;case 27:n===null&&h&4&&Bm(a);case 26:case 5:_r(t,a),n===null&&h&4&&Mm(a),h&512&&da(a,a.return);break;case 12:_r(t,a);break;case 31:_r(t,a),h&4&&Fm(t,a);break;case 13:_r(t,a),h&4&&Um(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=P_.bind(null,a),a1(t,a))));break;case 22:if(h=a.memoizedState!==null||br,!h){n=n!==null&&n.memoizedState!==null||zt,w=br;var E=zt;br=h,(zt=n)&&!E?Sr(t,a,(a.subtreeFlags&8772)!==0):_r(t,a),br=w,zt=E}break;case 30:break;default:_r(t,a)}}function Hm(t){var n=t.alternate;n!==null&&(t.alternate=null,Hm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&uc(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var wt=null,mn=!1;function yr(t,n,a){for(a=a.child;a!==null;)Pm(t,n,a),a=a.sibling}function Pm(t,n,a){if($e&&typeof $e.onCommitFiberUnmount=="function")try{$e.onCommitFiberUnmount(Le,a)}catch{}switch(a.tag){case 26:zt||Jn(a,n),yr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:zt||Jn(a,n);var h=wt,w=mn;Yr(a.type)&&(wt=a.stateNode,mn=!1),yr(t,n,a),ya(a.stateNode),wt=h,mn=w;break;case 5:zt||Jn(a,n);case 6:if(h=wt,w=mn,wt=null,yr(t,n,a),wt=h,mn=w,wt!==null)if(mn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(a.stateNode)}catch(E){ft(a,n,E)}else try{wt.removeChild(a.stateNode)}catch(E){ft(a,n,E)}break;case 18:wt!==null&&(mn?(t=wt,Lg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ws(t)):Lg(wt,a.stateNode));break;case 4:h=wt,w=mn,wt=a.stateNode.containerInfo,mn=!0,yr(t,n,a),wt=h,mn=w;break;case 0:case 11:case 14:case 15:Fr(2,a,n),zt||Fr(4,a,n),yr(t,n,a);break;case 1:zt||(Jn(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Rm(a,n,h)),yr(t,n,a);break;case 21:yr(t,n,a);break;case 22:zt=(h=zt)||a.memoizedState!==null,yr(t,n,a),zt=h;break;default:yr(t,n,a)}}function Fm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ws(t)}catch(a){ft(n,n.return,a)}}}function Um(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ws(t)}catch(a){ft(n,n.return,a)}}function L_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Im),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Im),n;default:throw Error(s(435,t.tag))}}function Wo(t,n){var a=L_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=F_.bind(null,t,h);h.then(w,w)}})}function gn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],E=t,R=n,G=R;e:for(;G!==null;){switch(G.tag){case 27:if(Yr(G.type)){wt=G.stateNode,mn=!1;break e}break;case 5:wt=G.stateNode,mn=!1;break e;case 3:case 4:wt=G.stateNode.containerInfo,mn=!0;break e}G=G.return}if(wt===null)throw Error(s(160));Pm(E,R,w),wt=null,mn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)$m(n,t),n=n.sibling}var Vn=null;function $m(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:gn(n,t),xn(t),h&4&&(Fr(3,t,t.return),ua(3,t),Fr(5,t,t.return));break;case 1:gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),h&64&&br&&(t=t.updateQueue,t!==null&&(h=t.callbacks,h!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?h:a.concat(h))));break;case 26:var w=Vn;if(gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),h&4){var E=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":E=w.getElementsByTagName("title")[0],(!E||E[zs]||E[Qt]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(h),w.head.insertBefore(E,w.querySelector("head > title"))),nn(E,h,a),E[Qt]=t,Yt(E),h=E;break e;case"link":var R=$g("link","href",w).get(h+(a.href||""));if(R){for(var G=0;G<R.length;G++)if(E=R[G],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){R.splice(G,1);break t}}E=w.createElement(h),nn(E,h,a),w.head.appendChild(E);break;case"meta":if(R=$g("meta","content",w).get(h+(a.content||""))){for(G=0;G<R.length;G++)if(E=R[G],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){R.splice(G,1);break t}}E=w.createElement(h),nn(E,h,a),w.head.appendChild(E);break;default:throw Error(s(468,h))}E[Qt]=t,Yt(E),h=E}t.stateNode=h}else qg(w,t.type,t.stateNode);else t.stateNode=Ug(w,h,t.memoizedProps);else E!==h?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,h===null?qg(w,t.type,t.stateNode):Ug(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Du(t,t.memoizedProps,a.memoizedProps)}break;case 27:gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),a!==null&&h&4&&Du(t,t.memoizedProps,a.memoizedProps);break;case 5:if(gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),t.flags&32){w=t.stateNode;try{Gi(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Du(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Mu=!0);break;case 6:if(gn(n,t),xn(t),h&4){if(t.stateNode===null)throw Error(s(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(De){ft(t,t.return,De)}}break;case 3:if(ol=null,w=Vn,Vn=sl(n.containerInfo),gn(n,t),Vn=w,xn(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{ws(n.containerInfo)}catch(De){ft(t,t.return,De)}Mu&&(Mu=!1,qm(t));break;case 4:h=Vn,Vn=sl(t.stateNode.containerInfo),gn(n,t),xn(t),Vn=h;break;case 12:gn(n,t),xn(t);break;case 31:gn(n,t),xn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 13:gn(n,t),xn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Vo=Oe()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=br,he=zt;if(br=le||w,zt=he||J,gn(n,t),zt=he,br=le,xn(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||br||zt||wi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)R=E.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{G=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;G.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(De){ft(J,J.return,De)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){ft(J,J.return,De)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?Rg(de,!0):Rg(J.stateNode,!1)}catch(De){ft(J,J.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}h&4&&(h=t.updateQueue,h!==null&&(a=h.retryQueue,a!==null&&(h.retryQueue=null,Wo(t,a))));break;case 19:gn(n,t),xn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 30:break;case 21:break;default:gn(n,t),xn(t)}}function xn(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Om(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,E=Lu(t);qo(t,E,w);break;case 5:var R=a.stateNode;a.flags&32&&(Gi(R,""),a.flags&=-33);var G=Lu(t);qo(t,G,R);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Lu(t);Ru(t,le,J);break;default:throw Error(s(161))}}catch(he){ft(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function qm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;qm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function _r(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)zm(t,n.alternate,n),n=n.sibling}function wi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Fr(4,n,n.return),wi(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Rm(n,n.return,a),wi(n);break;case 27:ya(n.stateNode);case 26:case 5:Jn(n,n.return),wi(n);break;case 22:n.memoizedState===null&&wi(n);break;case 30:wi(n);break;default:wi(n)}t=t.sibling}}function Sr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,E=n,R=E.flags;switch(E.tag){case 0:case 11:case 15:Sr(w,E,a),ua(4,E);break;case 1:if(Sr(w,E,a),h=E,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ft(h,h.return,le)}if(h=E,w=h.updateQueue,w!==null){var G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)_p(J[w],G)}catch(le){ft(h,h.return,le)}}a&&R&64&&Lm(E),da(E,E.return);break;case 27:Bm(E);case 26:case 5:Sr(w,E,a),a&&h===null&&R&4&&Mm(E),da(E,E.return);break;case 12:Sr(w,E,a);break;case 31:Sr(w,E,a),a&&R&4&&Fm(w,E);break;case 13:Sr(w,E,a),a&&R&4&&Um(w,E);break;case 22:E.memoizedState===null&&Sr(w,E,a),da(E,E.return);break;case 30:break;default:Sr(w,E,a)}n=n.sibling}}function Ou(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Zs(a))}function Bu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t))}function Yn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Wm(t,n,a,h),n=n.sibling}function Wm(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Yn(t,n,a,h),w&2048&&ua(9,n);break;case 1:Yn(t,n,a,h);break;case 3:Yn(t,n,a,h),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t)));break;case 12:if(w&2048){Yn(t,n,a,h),t=n.stateNode;try{var E=n.memoizedProps,R=E.id,G=E.onPostCommit;typeof G=="function"&&G(R,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ft(n,n.return,J)}}else Yn(t,n,a,h);break;case 31:Yn(t,n,a,h);break;case 13:Yn(t,n,a,h);break;case 23:break;case 22:E=n.stateNode,R=n.alternate,n.memoizedState!==null?E._visibility&2?Yn(t,n,a,h):ha(t,n):E._visibility&2?Yn(t,n,a,h):(E._visibility|=2,hs(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Ou(R,n);break;case 24:Yn(t,n,a,h),w&2048&&Bu(n.alternate,n);break;default:Yn(t,n,a,h)}}function hs(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,R=n,G=a,J=h,le=R.flags;switch(R.tag){case 0:case 11:case 15:hs(E,R,G,J,w),ua(8,R);break;case 23:break;case 22:var he=R.stateNode;R.memoizedState!==null?he._visibility&2?hs(E,R,G,J,w):ha(E,R):(he._visibility|=2,hs(E,R,G,J,w)),w&&le&2048&&Ou(R.alternate,R);break;case 24:hs(E,R,G,J,w),w&&le&2048&&Bu(R.alternate,R);break;default:hs(E,R,G,J,w)}n=n.sibling}}function ha(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,h=n,w=h.flags;switch(h.tag){case 22:ha(a,h),w&2048&&Ou(h.alternate,h);break;case 24:ha(a,h),w&2048&&Bu(h.alternate,h);break;default:ha(a,h)}n=n.sibling}}var fa=8192;function fs(t,n,a){if(t.subtreeFlags&fa)for(t=t.child;t!==null;)Gm(t,n,a),t=t.sibling}function Gm(t,n,a){switch(t.tag){case 26:fs(t,n,a),t.flags&fa&&t.memoizedState!==null&&v1(a,Vn,t.memoizedState,t.memoizedProps);break;case 5:fs(t,n,a);break;case 3:case 4:var h=Vn;Vn=sl(t.stateNode.containerInfo),fs(t,n,a),Vn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=fa,fa=16777216,fs(t,n,a),fa=h):fs(t,n,a));break;default:fs(t,n,a)}}function Vm(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function pa(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Kt=h,Km(h,t)}Vm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(t),t=t.sibling}function Ym(t){switch(t.tag){case 0:case 11:case 15:pa(t),t.flags&2048&&Fr(9,t,t.return);break;case 3:pa(t);break;case 12:pa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Go(t)):pa(t);break;default:pa(t)}}function Go(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Kt=h,Km(h,t)}Vm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Fr(8,n,n.return),Go(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Go(n));break;default:Go(n)}t=t.sibling}}function Km(t,n){for(;Kt!==null;){var a=Kt;switch(a.tag){case 0:case 11:case 15:Fr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var h=a.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Zs(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Kt=h;else e:for(a=t;Kt!==null;){h=Kt;var w=h.sibling,E=h.return;if(Hm(h),h===a){Kt=null;break e}if(w!==null){w.return=E,Kt=w;break e}Kt=E}}}var R_={getCacheForType:function(t){var n=en(Ot),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return en(Ot).controller.signal}},M_=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,Qe=null,tt=0,ht=0,En=null,Ur=!1,ps=!1,Iu=!1,wr=0,jt=0,$r=0,Ci=0,zu=0,jn=0,ms=0,ma=null,vn=null,Hu=!1,Vo=0,Xm=0,Yo=1/0,Ko=null,qr=null,qt=0,Wr=null,gs=null,Cr=0,Pu=0,Fu=null,Zm=null,ga=0,Uu=null;function Nn(){return(dt&2)!==0&&tt!==0?tt&-tt:z.T!==null?Yu():ff()}function Qm(){if(jn===0)if((tt&536870912)===0||it){var t=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),jn=t}else jn=536870912;return t=Cn.current,t!==null&&(t.flags|=32),jn}function bn(t,n,a){(t===vt&&(ht===2||ht===9)||t.cancelPendingCommit!==null)&&(xs(t,0),Gr(t,tt,jn,!1)),Hi(t,a),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(Ci|=a),jt===4&&Gr(t,tt,jn,!1)),er(t))}function Jm(t,n,a){if((dt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Ue(t,n),w=h?I_(t,n):qu(t,n,!0),E=h;do{if(w===0){ps&&!h&&Gr(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!O_(a)){w=qu(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)var R=0;else R=t.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){n=R;e:{var G=t;w=ma;var J=G.current.memoizedState.isDehydrated;if(J&&(xs(G,R).flags|=256),R=qu(G,R,!1),R!==2){if(Iu&&!J){G.errorRecoveryDisabledLanes|=E,Ci|=E,w=4;break e}E=vn,vn=w,E!==null&&(vn===null?vn=E:vn.push.apply(vn,E))}w=R}if(E=!1,w!==2)continue}}if(w===1){xs(t,0),Gr(t,n,0,!0);break}e:{switch(h=t,E=w,E){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Gr(h,n,jn,!Ur);break e;case 2:vn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Vo+300-Oe(),10<w)){if(Gr(h,n,jn,!Ur),rt(h,0,!0)!==0)break e;Cr=n,h.timeoutHandle=Ag(eg.bind(null,h,a,vn,Ko,Hu,n,jn,Ci,ms,Ur,E,"Throttled",-0,0),w);break e}eg(h,a,vn,Ko,Hu,n,jn,Ci,ms,Ur,E,null,-0,0)}}break}while(!0);er(t)}function eg(t,n,a,h,w,E,R,G,J,le,he,xe,ce,de){if(t.timeoutHandle=-1,xe=n.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:cr},Gm(n,E,xe);var De=(E&62914560)===E?Vo-Oe():(E&4194048)===E?Xm-Oe():0;if(De=b1(xe,De),De!==null){Cr=E,t.cancelPendingCommit=De(lg.bind(null,t,n,E,a,h,w,R,G,J,he,xe,null,ce,de)),Gr(t,E,R,!le);return}}lg(t,n,E,a,h,w,R,G,J)}function O_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],E=w.getSnapshot;w=w.value;try{if(!Sn(E(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Gr(t,n,a,h){n&=~zu,n&=~Ci,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var E=31-qe(w),R=1<<E;h[E]=-1,w&=~R}a!==0&&uf(t,a,n)}function Xo(){return(dt&6)===0?(xa(0),!1):!0}function $u(){if(Qe!==null){if(ht===0)var t=Qe.return;else t=Qe,fr=mi=null,su(t),os=null,Js=0,t=Qe;for(;t!==null;)Dm(t.alternate,t),t=t.return;Qe=null}}function xs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,t1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,$u(),vt=t,Qe=a=dr(t.current,null),tt=n,ht=0,En=null,Ur=!1,ps=Ue(t,n),Iu=!1,ms=jn=zu=Ci=$r=jt=0,vn=ma=null,Hu=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-qe(h),E=1<<w;n|=t[w],h&=~E}return wr=n,xo(),a}function tg(t,n){Ke=null,z.H=oa,n===as||n===ko?(n=xp(),ht=3):n===Vc?(n=xp(),ht=4):ht=n===_u?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,En=n,Qe===null&&(jt=1,Ho(t,In(n,t.current)))}function ng(){var t=Cn.current;return t===null?!0:(tt&4194048)===tt?Fn===null:(tt&62914560)===tt||(tt&536870912)!==0?t===Fn:!1}function rg(){var t=z.H;return z.H=oa,t===null?oa:t}function ig(){var t=z.A;return z.A=R_,t}function Zo(){jt=4,Ur||(tt&4194048)!==tt&&Cn.current!==null||(ps=!0),($r&134217727)===0&&(Ci&134217727)===0||vt===null||Gr(vt,tt,jn,!1)}function qu(t,n,a){var h=dt;dt|=2;var w=rg(),E=ig();(vt!==t||tt!==n)&&(Ko=null,xs(t,n)),n=!1;var R=jt;e:do try{if(ht!==0&&Qe!==null){var G=Qe,J=En;switch(ht){case 8:$u(),R=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(n=!0);var le=ht;if(ht=0,En=null,vs(t,G,J,le),a&&ps){R=0;break e}break;default:le=ht,ht=0,En=null,vs(t,G,J,le)}}B_(),R=jt;break}catch(he){tg(t,he)}while(!0);return n&&t.shellSuspendCounter++,fr=mi=null,dt=h,z.H=w,z.A=E,Qe===null&&(vt=null,tt=0,xo()),R}function B_(){for(;Qe!==null;)sg(Qe)}function I_(t,n){var a=dt;dt|=2;var h=rg(),w=ig();vt!==t||tt!==n?(Ko=null,Yo=Oe()+500,xs(t,n)):ps=Ue(t,n);e:do try{if(ht!==0&&Qe!==null){n=Qe;var E=En;t:switch(ht){case 1:ht=0,En=null,vs(t,n,E,1);break;case 2:case 9:if(mp(E)){ht=0,En=null,ag(n);break}n=function(){ht!==2&&ht!==9||vt!==t||(ht=7),er(t)},E.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:mp(E)?(ht=0,En=null,ag(n)):(ht=0,En=null,vs(t,n,E,7));break;case 5:var R=null;switch(Qe.tag){case 26:R=Qe.memoizedState;case 5:case 27:var G=Qe;if(R?Wg(R):G.stateNode.complete){ht=0,En=null;var J=G.sibling;if(J!==null)Qe=J;else{var le=G.return;le!==null?(Qe=le,Qo(le)):Qe=null}break t}}ht=0,En=null,vs(t,n,E,5);break;case 6:ht=0,En=null,vs(t,n,E,6);break;case 8:$u(),jt=6;break e;default:throw Error(s(462))}}z_();break}catch(he){tg(t,he)}while(!0);return fr=mi=null,z.H=h,z.A=w,dt=a,Qe!==null?0:(vt=null,tt=0,xo(),jt)}function z_(){for(;Qe!==null&&!pe();)sg(Qe)}function sg(t){var n=Tm(t.alternate,t,wr);t.memoizedProps=t.pendingProps,n===null?Qo(t):Qe=n}function ag(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=wm(a,n,n.pendingProps,n.type,void 0,tt);break;case 11:n=wm(a,n,n.pendingProps,n.type.render,n.ref,tt);break;case 5:su(n);default:Dm(a,n),n=Qe=ip(n,wr),n=Tm(a,n,wr)}t.memoizedProps=t.pendingProps,n===null?Qo(t):Qe=n}function vs(t,n,a,h){fr=mi=null,su(n),os=null,Js=0;var w=n.return;try{if(E_(t,w,n,a,tt)){jt=1,Ho(t,In(a,t.current)),Qe=null;return}}catch(E){if(w!==null)throw Qe=w,E;jt=1,Ho(t,In(a,t.current)),Qe=null;return}n.flags&32768?(it||h===1?t=!0:ps||(tt&536870912)!==0?t=!1:(Ur=t=!0,(h===2||h===9||h===3||h===6)&&(h=Cn.current,h!==null&&h.tag===13&&(h.flags|=16384))),og(n,t)):Qo(n)}function Qo(t){var n=t;do{if((n.flags&32768)!==0){og(n,Ur);return}t=n.return;var a=T_(n.alternate,n,wr);if(a!==null){Qe=a;return}if(n=n.sibling,n!==null){Qe=n;return}Qe=n=t}while(n!==null);jt===0&&(jt=5)}function og(t,n){do{var a=A_(t.alternate,t);if(a!==null){a.flags&=32767,Qe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Qe=t;return}Qe=t=a}while(t!==null);jt=6,Qe=null}function lg(t,n,a,h,w,E,R,G,J){t.cancelPendingCommit=null;do Jo();while(qt!==0);if((dt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(E=n.lanes|n.childLanes,E|=Lc,ac(t,a,E,R,G,J),t===vt&&(Qe=vt=null,tt=0),gs=n,Wr=t,Cr=a,Pu=E,Fu=w,Zm=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,U_(Te,function(){return fg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=z.T,z.T=null,w=X.p,X.p=2,R=dt,dt|=4;try{D_(t,n,a)}finally{dt=R,X.p=w,z.T=h}}qt=1,cg(),ug(),dg()}}function cg(){if(qt===1){qt=0;var t=Wr,n=gs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{$m(n,t);var E=nd,R=Kf(t.containerInfo),G=E.focusedElem,J=E.selectionRange;if(R!==G&&G&&G.ownerDocument&&Yf(G.ownerDocument.documentElement,G)){if(J!==null&&jc(G)){var le=J.start,he=J.end;if(he===void 0&&(he=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(he,G.value.length);else{var xe=G.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),De=G.textContent.length,Pe=Math.min(J.start,De),xt=J.end===void 0?Pe:Math.min(J.end,De);!de.extend&&Pe>xt&&(R=xt,xt=Pe,Pe=R);var ie=Vf(G,Pe),te=Vf(G,xt);if(ie&&te&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var oe=xe.createRange();oe.setStart(ie.node,ie.offset),de.removeAllRanges(),Pe>xt?(de.addRange(oe),de.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),de.addRange(oe))}}}}for(xe=[],de=G;de=de.parentNode;)de.nodeType===1&&xe.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<xe.length;G++){var me=xe[G];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}dl=!!td,nd=td=null}finally{dt=w,X.p=h,z.T=a}}t.current=n,qt=2}}function ug(){if(qt===2){qt=0;var t=Wr,n=gs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{zm(t,n.alternate,n)}finally{dt=w,X.p=h,z.T=a}}qt=3}}function dg(){if(qt===4||qt===3){qt=0,Ne();var t=Wr,n=gs,a=Cr,h=Zm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?qt=5:(qt=0,gs=Wr=null,hg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(qr=null),lc(a),n=n.stateNode,$e&&typeof $e.onCommitFiberRoot=="function")try{$e.onCommitFiberRoot(Le,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=z.T,w=X.p,X.p=2,z.T=null;try{for(var E=t.onRecoverableError,R=0;R<h.length;R++){var G=h[R];E(G.value,{componentStack:G.stack})}}finally{z.T=n,X.p=w}}(Cr&3)!==0&&Jo(),er(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Uu?ga++:(ga=0,Uu=t):ga=0,xa(0)}}function hg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Zs(n)))}function Jo(){return cg(),ug(),dg(),fg()}function fg(){if(qt!==5)return!1;var t=Wr,n=Pu;Pu=0;var a=lc(Cr),h=z.T,w=X.p;try{X.p=32>a?32:a,z.T=null,a=Fu,Fu=null;var E=Wr,R=Cr;if(qt=0,gs=Wr=null,Cr=0,(dt&6)!==0)throw Error(s(331));var G=dt;if(dt|=4,Ym(E.current),Wm(E,E.current,R,a),dt=G,xa(0,!1),$e&&typeof $e.onPostCommitFiberRoot=="function")try{$e.onPostCommitFiberRoot(Le,E)}catch{}return!0}finally{X.p=w,z.T=h,hg(t,n)}}function pg(t,n,a){n=In(a,n),n=yu(t.stateNode,n,2),t=zr(t,n,2),t!==null&&(Hi(t,2),er(t))}function ft(t,n,a){if(t.tag===3)pg(t,t,a);else for(;n!==null;){if(n.tag===3){pg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(qr===null||!qr.has(h))){t=In(a,t),a=mm(2),h=zr(n,a,2),h!==null&&(gm(a,h,n,t),Hi(h,2),er(h));break}}n=n.return}}function Wu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new M_;var w=new Set;h.set(n,w)}else w=h.get(n),w===void 0&&(w=new Set,h.set(n,w));w.has(a)||(Iu=!0,w.add(a),t=H_.bind(null,t,n,a),n.then(t,t))}function H_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(tt&a)===a&&(jt===4||jt===3&&(tt&62914560)===tt&&300>Oe()-Vo?(dt&2)===0&&xs(t,0):zu|=a,ms===tt&&(ms=0)),er(t)}function mg(t,n){n===0&&(n=Mt()),t=hi(t,n),t!==null&&(Hi(t,n),er(t))}function P_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),mg(t,a)}function F_(t,n){var a=0;switch(t.tag){case 31:case 13:var h=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:h=t.stateNode;break;case 22:h=t.stateNode._retryCache;break;default:throw Error(s(314))}h!==null&&h.delete(n),mg(t,a)}function U_(t,n){return We(t,n)}var el=null,bs=null,Gu=!1,tl=!1,Vu=!1,Vr=0;function er(t){t!==bs&&t.next===null&&(bs===null?el=bs=t:bs=bs.next=t),tl=!0,Gu||(Gu=!0,q_())}function xa(t,n){if(!Vu&&tl){Vu=!0;do for(var a=!1,h=el;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var E=0;else{var R=h.suspendedLanes,G=h.pingedLanes;E=(1<<31-qe(42|t)+1)-1,E&=w&~(R&~G),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,bg(h,E))}else E=tt,E=rt(h,h===vt?E:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(E&3)===0||Ue(h,E)||(a=!0,bg(h,E));h=h.next}while(a);Vu=!1}}function $_(){gg()}function gg(){tl=Gu=!1;var t=0;Vr!==0&&e1()&&(t=Vr);for(var n=Oe(),a=null,h=el;h!==null;){var w=h.next,E=xg(h,n);E===0?(h.next=null,a===null?el=w:a.next=w,w===null&&(bs=a)):(a=h,(t!==0||(E&3)!==0)&&(tl=!0)),h=w}qt!==0&&qt!==5||xa(t),Vr!==0&&(Vr=0)}function xg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var R=31-qe(E),G=1<<R,J=w[R];J===-1?((G&a)===0||(G&h)!==0)&&(w[R]=Zt(G,n)):J<=n&&(t.expiredLanes|=G),E&=~G}if(n=vt,a=tt,a=rt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(ht===2||ht===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&Lt(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ue(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&Lt(h),lc(a)){case 2:case 8:a=_e;break;case 32:a=Te;break;case 268435456:a=Ve;break;default:a=Te}return h=vg.bind(null,t),a=We(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&Lt(h),t.callbackPriority=2,t.callbackNode=null,2}function vg(t,n){if(qt!==0&&qt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Jo()&&t.callbackNode!==a)return null;var h=tt;return h=rt(t,t===vt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(Jm(t,h,n),xg(t,Oe()),t.callbackNode!=null&&t.callbackNode===a?vg.bind(null,t):null)}function bg(t,n){if(Jo())return null;Jm(t,n,!0)}function q_(){n1(function(){(dt&6)!==0?We(ue,$_):gg()})}function Yu(){if(Vr===0){var t=is;t===0&&(t=fe,fe<<=1,(fe&261888)===0&&(fe=256)),Vr=t}return Vr}function yg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:lo(""+t)}function _g(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function W_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var E=yg((w[fn]||null).action),R=h.submitter;R&&(n=(n=R[fn]||null)?yg(n.formAction):R.getAttribute("formAction"),n!==null&&(E=n,R=null));var G=new fo("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Vr!==0){var J=R?_g(w,R):new FormData(w);pu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(G.preventDefault(),J=R?_g(w,R):new FormData(w),pu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var Ku=0;Ku<Dc.length;Ku++){var Xu=Dc[Ku],G_=Xu.toLowerCase(),V_=Xu[0].toUpperCase()+Xu.slice(1);Gn(G_,"on"+V_)}Gn(Qf,"onAnimationEnd"),Gn(Jf,"onAnimationIteration"),Gn(ep,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(c_,"onTransitionRun"),Gn(u_,"onTransitionStart"),Gn(d_,"onTransitionCancel"),Gn(tp,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),li("onBeforeInput",["compositionend","keypress","textInput","paste"]),li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),Y_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(va));function Sg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var E=void 0;if(n)for(var R=h.length-1;0<=R;R--){var G=h[R],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){go(he)}w.currentTarget=null,E=J}else for(R=0;R<h.length;R++){if(G=h[R],J=G.instance,le=G.currentTarget,G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){go(he)}w.currentTarget=null,E=J}}}}function Je(t,n){var a=n[cc];a===void 0&&(a=n[cc]=new Set);var h=t+"__bubble";a.has(h)||(wg(n,t,2,!1),a.add(h))}function Zu(t,n,a){var h=0;n&&(h|=4),wg(a,t,h,n)}var nl="_reactListening"+Math.random().toString(36).slice(2);function Qu(t){if(!t[nl]){t[nl]=!0,gf.forEach(function(a){a!=="selectionchange"&&(Y_.has(a)||Zu(a,!1,t),Zu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[nl]||(n[nl]=!0,Zu("selectionchange",!1,n))}}function wg(t,n,a,h){switch(Qg(n)){case 2:var w=S1;break;case 8:w=w1;break;default:w=fd}a=w.bind(null,n,a,t),w=void 0,!vc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),h?w!==void 0?t.addEventListener(n,a,{capture:!0,passive:w}):t.addEventListener(n,a,!0):w!==void 0?t.addEventListener(n,a,{passive:w}):t.addEventListener(n,a,!1)}function Ju(t,n,a,h,w){var E=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var R=h.tag;if(R===3||R===4){var G=h.stateNode.containerInfo;if(G===w)break;if(R===4)for(R=h.return;R!==null;){var J=R.tag;if((J===3||J===4)&&R.stateNode.containerInfo===w)return;R=R.return}for(;G!==null;){if(R=Fi(G),R===null)return;if(J=R.tag,J===5||J===6||J===26||J===27){h=E=R;continue e}G=G.parentNode}}h=h.return}Nf(function(){var le=E,he=gc(a),xe=[];e:{var ce=np.get(t);if(ce!==void 0){var de=fo,De=t;switch(t){case"keypress":if(uo(a)===0)break e;case"keydown":case"keyup":de=F0;break;case"focusin":De="focus",de=Sc;break;case"focusout":De="blur",de=Sc;break;case"beforeblur":case"afterblur":de=Sc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=T0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=q0;break;case Qf:case Jf:case ep:de=L0;break;case tp:de=G0;break;case"scroll":case"scrollend":de=j0;break;case"wheel":de=Y0;break;case"copy":case"cut":case"paste":de=M0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Rf;break;case"toggle":case"beforetoggle":de=X0}var Pe=(n&4)!==0,xt=!Pe&&(t==="scroll"||t==="scrollend"),ie=Pe?ce!==null?ce+"Capture":null:ce;Pe=[];for(var te=le,oe;te!==null;){var me=te;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||ie===null||(me=Ps(te,ie),me!=null&&Pe.push(ba(te,me,oe))),xt)break;te=te.return}0<Pe.length&&(ce=new de(ce,De,null,a,he),xe.push({event:ce,listeners:Pe}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ce&&a!==mc&&(De=a.relatedTarget||a.fromElement)&&(Fi(De)||De[Pi]))break e;if((de||ce)&&(ce=he.window===he?he:(ce=he.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(De=a.relatedTarget||a.toElement,de=le,De=De?Fi(De):null,De!==null&&(xt=u(De),Pe=De.tag,De!==xt||Pe!==5&&Pe!==27&&Pe!==6)&&(De=null)):(de=null,De=le),de!==De)){if(Pe=Df,me="onMouseLeave",ie="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Pe=Rf,me="onPointerLeave",ie="onPointerEnter",te="pointer"),xt=de==null?ce:Hs(de),oe=De==null?ce:Hs(De),ce=new Pe(me,te+"leave",de,a,he),ce.target=xt,ce.relatedTarget=oe,me=null,Fi(he)===le&&(Pe=new Pe(ie,te+"enter",De,a,he),Pe.target=oe,Pe.relatedTarget=xt,me=Pe),xt=me,de&&De)t:{for(Pe=K_,ie=de,te=De,oe=0,me=ie;me;me=Pe(me))oe++;me=0;for(var ze=te;ze;ze=Pe(ze))me++;for(;0<oe-me;)ie=Pe(ie),oe--;for(;0<me-oe;)te=Pe(te),me--;for(;oe--;){if(ie===te||te!==null&&ie===te.alternate){Pe=ie;break t}ie=Pe(ie),te=Pe(te)}Pe=null}else Pe=null;de!==null&&Cg(xe,ce,de,Pe,!1),De!==null&&xt!==null&&Cg(xe,xt,De,Pe,!0)}}e:{if(ce=le?Hs(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=Ff;else if(Hf(ce))if(Uf)ct=a_;else{ct=i_;var Re=r_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&pc(le.elementType)&&(ct=Ff):ct=s_;if(ct&&(ct=ct(t,le))){Pf(xe,ct,a,he);break e}Re&&Re(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&fc(ce,"number",ce.value)}switch(Re=le?Hs(le):window,t){case"focusin":(Hf(Re)||Re.contentEditable==="true")&&(Xi=Re,Nc=le,Ys=null);break;case"focusout":Ys=Nc=Xi=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,Xf(xe,a,he);break;case"selectionchange":if(l_)break;case"keydown":case"keyup":Xf(xe,a,he)}var Xe;if(Cc)e:{switch(t){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Ki?If(t,a)&&(nt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(nt="onCompositionStart");nt&&(Mf&&a.locale!=="ko"&&(Ki||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Ki&&(Xe=Tf()):(Dr=he,bc="value"in Dr?Dr.value:Dr.textContent,Ki=!0)),Re=rl(le,nt),0<Re.length&&(nt=new Lf(nt,t,null,a,he),xe.push({event:nt,listeners:Re}),Xe?nt.data=Xe:(Xe=zf(a),Xe!==null&&(nt.data=Xe)))),(Xe=Q0?J0(t,a):e_(t,a))&&(nt=rl(le,"onBeforeInput"),0<nt.length&&(Re=new Lf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Re,listeners:nt}),Re.data=Xe)),W_(xe,t,le,a,he)}Sg(xe,n)})}function ba(t,n,a){return{instance:t,listener:n,currentTarget:a}}function rl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Ps(t,a),w!=null&&h.unshift(ba(t,w,E)),w=Ps(t,n),w!=null&&h.push(ba(t,w,E))),t.tag===3)return h;t=t.return}return[]}function K_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Cg(t,n,a,h,w){for(var E=n._reactName,R=[];a!==null&&a!==h;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===h)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Ps(a,E),le!=null&&R.unshift(ba(a,le,J))):w||(le=Ps(a,E),le!=null&&R.push(ba(a,le,J)))),a=a.return}R.length!==0&&t.push({event:n,listeners:R})}var X_=/\r\n?/g,Z_=/\u0000|\uFFFD/g;function kg(t){return(typeof t=="string"?t:""+t).replace(X_,`
|
|
48
|
+
`+h.stack}}var je=Object.prototype.hasOwnProperty,We=e.unstable_scheduleCallback,Lt=e.unstable_cancelCallback,pe=e.unstable_shouldYield,Ne=e.unstable_requestPaint,Oe=e.unstable_now,lt=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,_e=e.unstable_UserBlockingPriority,Te=e.unstable_NormalPriority,Be=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,Ct=e.log,se=e.unstable_setDisableYieldValue,Le=null,$e=null;function at(t){if(typeof Ct=="function"&&se(t),$e&&typeof $e.setStrictMode=="function")try{$e.setStrictMode(Le,t)}catch{}}var qe=Math.clz32?Math.clz32:oi,Ut=Math.log,Rt=Math.LN2;function oi(t){return t>>>=0,t===0?32:31-(Ut(t)/Rt|0)|0}var fe=256,ye=262144,we=4194304;function Ye(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function rt(t,n,a){var h=t.pendingLanes;if(h===0)return 0;var w=0,E=t.suspendedLanes,R=t.pingedLanes;t=t.warmLanes;var G=h&134217727;return G!==0?(h=G&~E,h!==0?w=Ye(h):(R&=G,R!==0?w=Ye(R):a||(a=G&~t,a!==0&&(w=Ye(a))))):(G=h&~E,G!==0?w=Ye(G):R!==0?w=Ye(R):a||(a=h&~t,a!==0&&(w=Ye(a)))),w===0?0:n!==0&&n!==w&&(n&E)===0&&(E=w&-w,a=n&-n,E>=a||E===32&&(a&4194048)!==0)?n:w}function Ue(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Zt(t,n){switch(t){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 Mt(){var t=we;return we<<=1,(we&62914560)===0&&(we=4194304),t}function $t(t){for(var n=[],a=0;31>a;a++)n.push(t);return n}function Hi(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ac(t,n,a,h,w,E){var R=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var G=t.entanglements,J=t.expirationTimes,le=t.hiddenUpdates;for(a=R&~a;0<a;){var he=31-qe(a),xe=1<<he;G[he]=0,J[he]=-1;var ce=le[he];if(ce!==null)for(le[he]=null,he=0;he<ce.length;he++){var de=ce[he];de!==null&&(de.lane&=-536870913)}a&=~xe}h!==0&&uf(t,h,0),E!==0&&w===0&&t.tag!==0&&(t.suspendedLanes|=E&~(R&~n))}function uf(t,n,a){t.pendingLanes|=n,t.suspendedLanes&=~n;var h=31-qe(n);t.entangledLanes|=n,t.entanglements[h]=t.entanglements[h]|1073741824|a&261930}function df(t,n){var a=t.entangledLanes|=n;for(t=t.entanglements;a;){var h=31-qe(a),w=1<<h;w&n|t[h]&n&&(t[h]|=n),a&=~w}}function hf(t,n){var a=n&-n;return a=(a&42)!==0?1:oc(a),(a&(t.suspendedLanes|n))!==0?0:a}function oc(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function lc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function ff(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:Qg(t.type))}function pf(t,n){var a=X.p;try{return X.p=t,n()}finally{X.p=a}}var Ar=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Ar,fn="__reactProps$"+Ar,Pi="__reactContainer$"+Ar,cc="__reactEvents$"+Ar,v0="__reactListeners$"+Ar,b0="__reactHandles$"+Ar,mf="__reactResources$"+Ar,zs="__reactMarker$"+Ar;function uc(t){delete t[Qt],delete t[fn],delete t[cc],delete t[v0],delete t[b0]}function Fi(t){var n=t[Qt];if(n)return n;for(var a=t.parentNode;a;){if(n=a[Pi]||a[Qt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(t=Bg(t);t!==null;){if(a=t[Qt])return a;t=Bg(t)}return n}t=a,a=t.parentNode}return null}function Ui(t){if(t=t[Qt]||t[Pi]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Hs(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(s(33))}function $i(t){var n=t[mf];return n||(n=t[mf]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Yt(t){t[zs]=!0}var gf=new Set,xf={};function li(t,n){qi(t,n),qi(t+"Capture",n)}function qi(t,n){for(xf[t]=n,t=0;t<n.length;t++)gf.add(n[t])}var y0=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]*$"),vf={},bf={};function _0(t){return je.call(bf,t)?!0:je.call(vf,t)?!1:y0.test(t)?bf[t]=!0:(vf[t]=!0,!1)}function so(t,n,a){if(_0(n))if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var h=n.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+a)}}function ao(t,n,a){if(a===null)t.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+a)}}function lr(t,n,a,h){if(h===null)t.removeAttribute(a);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(n,a,""+h)}}function Mn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function yf(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function S0(t,n,a){var h=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var w=h.get,E=h.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return w.call(this)},set:function(R){a=""+R,E.call(this,R)}}),Object.defineProperty(t,n,{enumerable:h.enumerable}),{getValue:function(){return a},setValue:function(R){a=""+R},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function dc(t){if(!t._valueTracker){var n=yf(t)?"checked":"value";t._valueTracker=S0(t,n,""+t[n])}}function _f(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var a=n.getValue(),h="";return t&&(h=yf(t)?t.checked?"true":"false":t.value),t=h,t!==a?(n.setValue(t),!0):!1}function oo(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var w0=/[\n"\\]/g;function On(t){return t.replace(w0,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function hc(t,n,a,h,w,E,R,G){t.name="",R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.type=R:t.removeAttribute("type"),n!=null?R==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Mn(n)):t.value!==""+Mn(n)&&(t.value=""+Mn(n)):R!=="submit"&&R!=="reset"||t.removeAttribute("value"),n!=null?fc(t,R,Mn(n)):a!=null?fc(t,R,Mn(a)):h!=null&&t.removeAttribute("value"),w==null&&E!=null&&(t.defaultChecked=!!E),w!=null&&(t.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?t.name=""+Mn(G):t.removeAttribute("name")}function Sf(t,n,a,h,w,E,R,G){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(t.type=E),n!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||n!=null)){dc(t);return}a=a!=null?""+Mn(a):"",n=n!=null?""+Mn(n):a,G||n===t.value||(t.value=n),t.defaultValue=n}h=h??w,h=typeof h!="function"&&typeof h!="symbol"&&!!h,t.checked=G?t.checked:!!h,t.defaultChecked=!!h,R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"&&(t.name=R),dc(t)}function fc(t,n,a){n==="number"&&oo(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Wi(t,n,a,h){if(t=t.options,n){n={};for(var w=0;w<a.length;w++)n["$"+a[w]]=!0;for(a=0;a<t.length;a++)w=n.hasOwnProperty("$"+t[a].value),t[a].selected!==w&&(t[a].selected=w),w&&h&&(t[a].defaultSelected=!0)}else{for(a=""+Mn(a),n=null,w=0;w<t.length;w++){if(t[w].value===a){t[w].selected=!0,h&&(t[w].defaultSelected=!0);return}n!==null||t[w].disabled||(n=t[w])}n!==null&&(n.selected=!0)}}function wf(t,n,a){if(n!=null&&(n=""+Mn(n),n!==t.value&&(t.value=n),a==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=a!=null?""+Mn(a):""}function Cf(t,n,a,h){if(n==null){if(h!=null){if(a!=null)throw Error(s(92));if(U(h)){if(1<h.length)throw Error(s(93));h=h[0]}a=h}a==null&&(a=""),n=a}a=Mn(n),t.defaultValue=a,h=t.textContent,h===a&&h!==""&&h!==null&&(t.value=h),dc(t)}function Gi(t,n){if(n){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=n;return}}t.textContent=n}var C0=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 kf(t,n,a){var h=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?h?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":h?t.setProperty(n,a):typeof a!="number"||a===0||C0.has(n)?n==="float"?t.cssFloat=a:t[n]=(""+a).trim():t[n]=a+"px"}function Ef(t,n,a){if(n!=null&&typeof n!="object")throw Error(s(62));if(t=t.style,a!=null){for(var h in a)!a.hasOwnProperty(h)||n!=null&&n.hasOwnProperty(h)||(h.indexOf("--")===0?t.setProperty(h,""):h==="float"?t.cssFloat="":t[h]="");for(var w in n)h=n[w],n.hasOwnProperty(w)&&a[w]!==h&&kf(t,w,h)}else for(var E in n)n.hasOwnProperty(E)&&kf(t,E,n[E])}function pc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 k0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),E0=/^[\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 lo(t){return E0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function cr(){}var mc=null;function gc(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Vi=null,Yi=null;function jf(t){var n=Ui(t);if(n&&(t=n.stateNode)){var a=t[fn]||null;e:switch(t=n.stateNode,n.type){case"input":if(hc(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+On(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var h=a[n];if(h!==t&&h.form===t.form){var w=h[fn]||null;if(!w)throw Error(s(90));hc(h,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(n=0;n<a.length;n++)h=a[n],h.form===t.form&&_f(h)}break e;case"textarea":wf(t,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Wi(t,!!a.multiple,n,!1)}}}var xc=!1;function Nf(t,n,a){if(xc)return t(n,a);xc=!0;try{var h=t(n);return h}finally{if(xc=!1,(Vi!==null||Yi!==null)&&(Xo(),Vi&&(n=Vi,t=Yi,Yi=Vi=null,jf(n),t)))for(n=0;n<t.length;n++)jf(t[n])}}function Ps(t,n){var a=t.stateNode;if(a===null)return null;var h=a[fn]||null;if(h===null)return null;a=h[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":(h=!h.disabled)||(t=t.type,h=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!h;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(s(231,n,typeof a));return a}var ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vc=!1;if(ur)try{var Fs={};Object.defineProperty(Fs,"passive",{get:function(){vc=!0}}),window.addEventListener("test",Fs,Fs),window.removeEventListener("test",Fs,Fs)}catch{vc=!1}var Dr=null,bc=null,co=null;function Tf(){if(co)return co;var t,n=bc,a=n.length,h,w="value"in Dr?Dr.value:Dr.textContent,E=w.length;for(t=0;t<a&&n[t]===w[t];t++);var R=a-t;for(h=1;h<=R&&n[a-h]===w[E-h];h++);return co=w.slice(t,1<h?1-h:void 0)}function uo(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function ho(){return!0}function Af(){return!1}function pn(t){function n(a,h,w,E,R){this._reactName=a,this._targetInst=w,this.type=h,this.nativeEvent=E,this.target=R,this.currentTarget=null;for(var G in t)t.hasOwnProperty(G)&&(a=t[G],this[G]=a?a(E):E[G]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?ho:Af,this.isPropagationStopped=Af,this}return m(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=ho)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ho)},persist:function(){},isPersistent:ho}),n}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fo=pn(ci),Us=m({},ci,{view:0,detail:0}),j0=pn(Us),yc,_c,$s,po=m({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==$s&&($s&&t.type==="mousemove"?(yc=t.screenX-$s.screenX,_c=t.screenY-$s.screenY):_c=yc=0,$s=t),yc)},movementY:function(t){return"movementY"in t?t.movementY:_c}}),Df=pn(po),N0=m({},po,{dataTransfer:0}),T0=pn(N0),A0=m({},Us,{relatedTarget:0}),Sc=pn(A0),D0=m({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),L0=pn(D0),R0=m({},ci,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),M0=pn(R0),O0=m({},ci,{data:0}),Lf=pn(O0),B0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I0={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"},z0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function H0(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=z0[t])?!!n[t]:!1}function wc(){return H0}var P0=m({},Us,{key:function(t){if(t.key){var n=B0[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=uo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?I0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wc,charCode:function(t){return t.type==="keypress"?uo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?uo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),F0=pn(P0),U0=m({},po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rf=pn(U0),$0=m({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),q0=pn($0),W0=m({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),G0=pn(W0),V0=m({},po,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Y0=pn(V0),K0=m({},ci,{newState:0,oldState:0}),X0=pn(K0),Z0=[9,13,27,32],Cc=ur&&"CompositionEvent"in window,qs=null;ur&&"documentMode"in document&&(qs=document.documentMode);var Q0=ur&&"TextEvent"in window&&!qs,Mf=ur&&(!Cc||qs&&8<qs&&11>=qs),Of=" ",Bf=!1;function If(t,n){switch(t){case"keyup":return Z0.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ki=!1;function J0(t,n){switch(t){case"compositionend":return zf(n);case"keypress":return n.which!==32?null:(Bf=!0,Of);case"textInput":return t=n.data,t===Of&&Bf?null:t;default:return null}}function e_(t,n){if(Ki)return t==="compositionend"||!Cc&&If(t,n)?(t=Tf(),co=bc=Dr=null,Ki=!1,t):null;switch(t){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 Mf&&n.locale!=="ko"?null:n.data;default:return null}}var t_={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 Hf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!t_[t.type]:n==="textarea"}function Pf(t,n,a,h){Vi?Yi?Yi.push(h):Yi=[h]:Vi=h,n=rl(n,"onChange"),0<n.length&&(a=new fo("onChange","change",null,a,h),t.push({event:a,listeners:n}))}var Ws=null,Gs=null;function n_(t){Sg(t,0)}function mo(t){var n=Hs(t);if(_f(n))return t}function Ff(t,n){if(t==="change")return n}var Uf=!1;if(ur){var kc;if(ur){var Ec="oninput"in document;if(!Ec){var $f=document.createElement("div");$f.setAttribute("oninput","return;"),Ec=typeof $f.oninput=="function"}kc=Ec}else kc=!1;Uf=kc&&(!document.documentMode||9<document.documentMode)}function qf(){Ws&&(Ws.detachEvent("onpropertychange",Wf),Gs=Ws=null)}function Wf(t){if(t.propertyName==="value"&&mo(Gs)){var n=[];Pf(n,Gs,t,gc(t)),Nf(n_,n)}}function r_(t,n,a){t==="focusin"?(qf(),Ws=n,Gs=a,Ws.attachEvent("onpropertychange",Wf)):t==="focusout"&&qf()}function i_(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return mo(Gs)}function s_(t,n){if(t==="click")return mo(n)}function a_(t,n){if(t==="input"||t==="change")return mo(n)}function o_(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Sn=typeof Object.is=="function"?Object.is:o_;function Vs(t,n){if(Sn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var a=Object.keys(t),h=Object.keys(n);if(a.length!==h.length)return!1;for(h=0;h<a.length;h++){var w=a[h];if(!je.call(n,w)||!Sn(t[w],n[w]))return!1}return!0}function Gf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vf(t,n){var a=Gf(t);t=0;for(var h;a;){if(a.nodeType===3){if(h=t+a.textContent.length,t<=n&&h>=n)return{node:a,offset:n-t};t=h}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Gf(a)}}function Yf(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Yf(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Kf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=oo(t.document);n instanceof t.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)t=n.contentWindow;else break;n=oo(t.document)}return n}function jc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var l_=ur&&"documentMode"in document&&11>=document.documentMode,Xi=null,Nc=null,Ys=null,Tc=!1;function Xf(t,n,a){var h=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tc||Xi==null||Xi!==oo(h)||(h=Xi,"selectionStart"in h&&jc(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),Ys&&Vs(Ys,h)||(Ys=h,h=rl(Nc,"onSelect"),0<h.length&&(n=new fo("onSelect","select",null,n,a),t.push({event:n,listeners:h}),n.target=Xi)))}function ui(t,n){var a={};return a[t.toLowerCase()]=n.toLowerCase(),a["Webkit"+t]="webkit"+n,a["Moz"+t]="moz"+n,a}var Zi={animationend:ui("Animation","AnimationEnd"),animationiteration:ui("Animation","AnimationIteration"),animationstart:ui("Animation","AnimationStart"),transitionrun:ui("Transition","TransitionRun"),transitionstart:ui("Transition","TransitionStart"),transitioncancel:ui("Transition","TransitionCancel"),transitionend:ui("Transition","TransitionEnd")},Ac={},Zf={};ur&&(Zf=document.createElement("div").style,"AnimationEvent"in window||(delete Zi.animationend.animation,delete Zi.animationiteration.animation,delete Zi.animationstart.animation),"TransitionEvent"in window||delete Zi.transitionend.transition);function di(t){if(Ac[t])return Ac[t];if(!Zi[t])return t;var n=Zi[t],a;for(a in n)if(n.hasOwnProperty(a)&&a in Zf)return Ac[t]=n[a];return t}var Qf=di("animationend"),Jf=di("animationiteration"),ep=di("animationstart"),c_=di("transitionrun"),u_=di("transitionstart"),d_=di("transitioncancel"),tp=di("transitionend"),np=new Map,Dc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Dc.push("scrollEnd");function Gn(t,n){np.set(t,n),li(n,[t])}var go=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Bn=[],Qi=0,Lc=0;function xo(){for(var t=Qi,n=Lc=Qi=0;n<t;){var a=Bn[n];Bn[n++]=null;var h=Bn[n];Bn[n++]=null;var w=Bn[n];Bn[n++]=null;var E=Bn[n];if(Bn[n++]=null,h!==null&&w!==null){var R=h.pending;R===null?w.next=w:(w.next=R.next,R.next=w),h.pending=w}E!==0&&rp(a,w,E)}}function vo(t,n,a,h){Bn[Qi++]=t,Bn[Qi++]=n,Bn[Qi++]=a,Bn[Qi++]=h,Lc|=h,t.lanes|=h,t=t.alternate,t!==null&&(t.lanes|=h)}function Rc(t,n,a,h){return vo(t,n,a,h),bo(t)}function hi(t,n){return vo(t,null,null,n),bo(t)}function rp(t,n,a){t.lanes|=a;var h=t.alternate;h!==null&&(h.lanes|=a);for(var w=!1,E=t.return;E!==null;)E.childLanes|=a,h=E.alternate,h!==null&&(h.childLanes|=a),E.tag===22&&(t=E.stateNode,t===null||t._visibility&1||(w=!0)),t=E,E=E.return;return t.tag===3?(E=t.stateNode,w&&n!==null&&(w=31-qe(a),t=E.hiddenUpdates,h=t[w],h===null?t[w]=[n]:h.push(n),n.lane=a|536870912),E):null}function bo(t){if(50<ga)throw ga=0,Uu=null,Error(s(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var Ji={};function h_(t,n,a,h){this.tag=t,this.key=a,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=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wn(t,n,a,h){return new h_(t,n,a,h)}function Mc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function dr(t,n){var a=t.alternate;return a===null?(a=wn(t.tag,n,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=n,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,n=t.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function ip(t,n){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,n=a.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function yo(t,n,a,h,w,E){var R=0;if(h=t,typeof t=="function")Mc(t)&&(R=1);else if(typeof t=="string")R=x1(t,a,re.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case I:return t=wn(31,a,n,w),t.elementType=I,t.lanes=E,t;case C:return fi(a.children,w,E,n);case v:R=8,w|=24;break;case b:return t=wn(12,a,n,w|2),t.elementType=b,t.lanes=E,t;case A:return t=wn(13,a,n,w),t.elementType=A,t.lanes=E,t;case N:return t=wn(19,a,n,w),t.elementType=N,t.lanes=E,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case S:R=10;break e;case x:R=9;break e;case j:R=11;break e;case D:R=14;break e;case T:R=16,h=null;break e}R=29,a=Error(s(130,t===null?"null":typeof t,"")),h=null}return n=wn(R,a,n,w),n.elementType=t,n.type=h,n.lanes=E,n}function fi(t,n,a,h){return t=wn(7,t,h,n),t.lanes=a,t}function Oc(t,n,a){return t=wn(6,t,null,n),t.lanes=a,t}function sp(t){var n=wn(18,null,null,0);return n.stateNode=t,n}function Bc(t,n,a){return n=wn(4,t.children!==null?t.children:[],t.key,n),n.lanes=a,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var ap=new WeakMap;function In(t,n){if(typeof t=="object"&&t!==null){var a=ap.get(t);return a!==void 0?a:(n={value:t,source:n,stack:ge(n)},ap.set(t,n),n)}return{value:t,source:n,stack:ge(n)}}var es=[],ts=0,_o=null,Ks=0,zn=[],Hn=0,Lr=null,Zn=1,Qn="";function hr(t,n){es[ts++]=Ks,es[ts++]=_o,_o=t,Ks=n}function op(t,n,a){zn[Hn++]=Zn,zn[Hn++]=Qn,zn[Hn++]=Lr,Lr=t;var h=Zn;t=Qn;var w=32-qe(h)-1;h&=~(1<<w),a+=1;var E=32-qe(n)+w;if(30<E){var R=w-w%5;E=(h&(1<<R)-1).toString(32),h>>=R,w-=R,Zn=1<<32-qe(n)+w|a<<w|h,Qn=E+t}else Zn=1<<E|a<<w|h,Qn=t}function Ic(t){t.return!==null&&(hr(t,1),op(t,1,0))}function zc(t){for(;t===_o;)_o=es[--ts],es[ts]=null,Ks=es[--ts],es[ts]=null;for(;t===Lr;)Lr=zn[--Hn],zn[Hn]=null,Qn=zn[--Hn],zn[Hn]=null,Zn=zn[--Hn],zn[Hn]=null}function lp(t,n){zn[Hn++]=Zn,zn[Hn++]=Qn,zn[Hn++]=Lr,Zn=n.id,Qn=n.overflow,Lr=t}var Jt=null,_t=null,it=!1,Rr=null,Pn=!1,Hc=Error(s(519));function Mr(t){var n=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xs(In(n,t)),Hc}function cp(t){var n=t.stateNode,a=t.type,h=t.memoizedProps;switch(n[Qt]=t,n[fn]=h,a){case"dialog":Je("cancel",n),Je("close",n);break;case"iframe":case"object":case"embed":Je("load",n);break;case"video":case"audio":for(a=0;a<va.length;a++)Je(va[a],n);break;case"source":Je("error",n);break;case"img":case"image":case"link":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"input":Je("invalid",n),Sf(n,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Je("invalid",n);break;case"textarea":Je("invalid",n),Cf(n,h.value,h.defaultValue,h.children)}a=h.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||h.suppressHydrationWarning===!0||Eg(n.textContent,a)?(h.popover!=null&&(Je("beforetoggle",n),Je("toggle",n)),h.onScroll!=null&&Je("scroll",n),h.onScrollEnd!=null&&Je("scrollend",n),h.onClick!=null&&(n.onclick=cr),n=!0):n=!1,n||Mr(t,!0)}function up(t){for(Jt=t.return;Jt;)switch(Jt.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Jt=Jt.return}}function ns(t){if(t!==Jt)return!1;if(!it)return up(t),it=!0,!1;var n=t.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||rd(t.type,t.memoizedProps)),a=!a),a&&_t&&Mr(t),up(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Og(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));_t=Og(t)}else n===27?(n=_t,Yr(t.type)?(t=ld,ld=null,_t=t):_t=n):_t=Jt?Un(t.stateNode.nextSibling):null;return!0}function pi(){_t=Jt=null,it=!1}function Pc(){var t=Rr;return t!==null&&(vn===null?vn=t:vn.push.apply(vn,t),Rr=null),t}function Xs(t){Rr===null?Rr=[t]:Rr.push(t)}var Fc=B(null),mi=null,fr=null;function Or(t,n,a){F(Fc,n._currentValue),n._currentValue=a}function pr(t){t._currentValue=Fc.current,W(Fc)}function Uc(t,n,a){for(;t!==null;){var h=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,h!==null&&(h.childLanes|=n)):h!==null&&(h.childLanes&n)!==n&&(h.childLanes|=n),t===a)break;t=t.return}}function $c(t,n,a,h){var w=t.child;for(w!==null&&(w.return=t);w!==null;){var E=w.dependencies;if(E!==null){var R=w.child;E=E.firstContext;e:for(;E!==null;){var G=E;E=w;for(var J=0;J<n.length;J++)if(G.context===n[J]){E.lanes|=a,G=E.alternate,G!==null&&(G.lanes|=a),Uc(E.return,a,t),h||(R=null);break e}E=G.next}}else if(w.tag===18){if(R=w.return,R===null)throw Error(s(341));R.lanes|=a,E=R.alternate,E!==null&&(E.lanes|=a),Uc(R,a,t),R=null}else R=w.child;if(R!==null)R.return=w;else for(R=w;R!==null;){if(R===t){R=null;break}if(w=R.sibling,w!==null){w.return=R.return,R=w;break}R=R.return}w=R}}function rs(t,n,a,h){t=null;for(var w=n,E=!1;w!==null;){if(!E){if((w.flags&524288)!==0)E=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var R=w.alternate;if(R===null)throw Error(s(387));if(R=R.memoizedProps,R!==null){var G=w.type;Sn(w.pendingProps.value,R.value)||(t!==null?t.push(G):t=[G])}}else if(w===K.current){if(R=w.alternate,R===null)throw Error(s(387));R.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(t!==null?t.push(wa):t=[wa])}w=w.return}t!==null&&$c(n,t,a,h),n.flags|=262144}function So(t){for(t=t.firstContext;t!==null;){if(!Sn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function gi(t){mi=t,fr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function en(t){return dp(mi,t)}function wo(t,n){return mi===null&&gi(t),dp(t,n)}function dp(t,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},fr===null){if(t===null)throw Error(s(308));fr=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else fr=fr.next=n;return a}var f_=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(a,h){t.push(h)}};this.abort=function(){n.aborted=!0,t.forEach(function(a){return a()})}},p_=e.unstable_scheduleCallback,m_=e.unstable_NormalPriority,Ot={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qc(){return{controller:new f_,data:new Map,refCount:0}}function Zs(t){t.refCount--,t.refCount===0&&p_(m_,function(){t.controller.abort()})}var Qs=null,Wc=0,is=0,ss=null;function g_(t,n){if(Qs===null){var a=Qs=[];Wc=0,is=Yu(),ss={status:"pending",value:void 0,then:function(h){a.push(h)}}}return Wc++,n.then(hp,hp),n}function hp(){if(--Wc===0&&Qs!==null){ss!==null&&(ss.status="fulfilled");var t=Qs;Qs=null,is=0,ss=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function x_(t,n){var a=[],h={status:"pending",value:null,reason:null,then:function(w){a.push(w)}};return t.then(function(){h.status="fulfilled",h.value=n;for(var w=0;w<a.length;w++)(0,a[w])(n)},function(w){for(h.status="rejected",h.reason=w,w=0;w<a.length;w++)(0,a[w])(void 0)}),h}var fp=z.S;z.S=function(t,n){Xm=Oe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&g_(t,n),fp!==null&&fp(t,n)};var xi=B(null);function Gc(){var t=xi.current;return t!==null?t:vt.pooledCache}function Co(t,n){n===null?F(xi,xi.current):F(xi,n.pool)}function pp(){var t=Gc();return t===null?null:{parent:Ot._currentValue,pool:t}}var as=Error(s(460)),Vc=Error(s(474)),ko=Error(s(542)),Eo={then:function(){}};function mp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function gp(t,n,a){switch(a=t[a],a===void 0?t.push(n):a!==n&&(n.then(cr,cr),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,vp(t),t;default:if(typeof n.status=="string")n.then(cr,cr);else{if(t=vt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=n,t.status="pending",t.then(function(h){if(n.status==="pending"){var w=n;w.status="fulfilled",w.value=h}},function(h){if(n.status==="pending"){var w=n;w.status="rejected",w.reason=h}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,vp(t),t}throw bi=n,as}}function vi(t){try{var n=t._init;return n(t._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(bi=a,as):a}}var bi=null;function xp(){if(bi===null)throw Error(s(459));var t=bi;return bi=null,t}function vp(t){if(t===as||t===ko)throw Error(s(483))}var os=null,Js=0;function jo(t){var n=Js;return Js+=1,os===null&&(os=[]),gp(os,t,n)}function ea(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function No(t,n){throw n.$$typeof===y?Error(s(525)):(t=Object.prototype.toString.call(n),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function bp(t){function n(ie,te){if(t){var oe=ie.deletions;oe===null?(ie.deletions=[te],ie.flags|=16):oe.push(te)}}function a(ie,te){if(!t)return null;for(;te!==null;)n(ie,te),te=te.sibling;return null}function h(ie){for(var te=new Map;ie!==null;)ie.key!==null?te.set(ie.key,ie):te.set(ie.index,ie),ie=ie.sibling;return te}function w(ie,te){return ie=dr(ie,te),ie.index=0,ie.sibling=null,ie}function E(ie,te,oe){return ie.index=oe,t?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<te?(ie.flags|=67108866,te):oe):(ie.flags|=67108866,te)):(ie.flags|=1048576,te)}function R(ie){return t&&ie.alternate===null&&(ie.flags|=67108866),ie}function G(ie,te,oe,me){return te===null||te.tag!==6?(te=Oc(oe,ie.mode,me),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function J(ie,te,oe,me){var ze=oe.type;return ze===C?he(ie,te,oe.props.children,me,oe.key):te!==null&&(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type)?(te=w(te,oe.props),ea(te,oe),te.return=ie,te):(te=yo(oe.type,oe.key,oe.props,null,ie.mode,me),ea(te,oe),te.return=ie,te)}function le(ie,te,oe,me){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=Bc(oe,ie.mode,me),te.return=ie,te):(te=w(te,oe.children||[]),te.return=ie,te)}function he(ie,te,oe,me,ze){return te===null||te.tag!==7?(te=fi(oe,ie.mode,me,ze),te.return=ie,te):(te=w(te,oe),te.return=ie,te)}function xe(ie,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Oc(""+te,ie.mode,oe),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case _:return oe=yo(te.type,te.key,te.props,null,ie.mode,oe),ea(oe,te),oe.return=ie,oe;case k:return te=Bc(te,ie.mode,oe),te.return=ie,te;case T:return te=vi(te),xe(ie,te,oe)}if(U(te)||Y(te))return te=fi(te,ie.mode,oe,null),te.return=ie,te;if(typeof te.then=="function")return xe(ie,jo(te),oe);if(te.$$typeof===S)return xe(ie,wo(ie,te),oe);No(ie,te)}return null}function ce(ie,te,oe,me){var ze=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return ze!==null?null:G(ie,te,""+oe,me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return oe.key===ze?J(ie,te,oe,me):null;case k:return oe.key===ze?le(ie,te,oe,me):null;case T:return oe=vi(oe),ce(ie,te,oe,me)}if(U(oe)||Y(oe))return ze!==null?null:he(ie,te,oe,me,null);if(typeof oe.then=="function")return ce(ie,te,jo(oe),me);if(oe.$$typeof===S)return ce(ie,te,wo(ie,oe),me);No(ie,oe)}return null}function de(ie,te,oe,me,ze){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ie=ie.get(oe)||null,G(te,ie,""+me,ze);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case _:return ie=ie.get(me.key===null?oe:me.key)||null,J(te,ie,me,ze);case k:return ie=ie.get(me.key===null?oe:me.key)||null,le(te,ie,me,ze);case T:return me=vi(me),de(ie,te,oe,me,ze)}if(U(me)||Y(me))return ie=ie.get(oe)||null,he(te,ie,me,ze,null);if(typeof me.then=="function")return de(ie,te,oe,jo(me),ze);if(me.$$typeof===S)return de(ie,te,oe,wo(te,me),ze);No(te,me)}return null}function De(ie,te,oe,me){for(var ze=null,ct=null,Re=te,Xe=te=0,nt=null;Re!==null&&Xe<oe.length;Xe++){Re.index>Xe?(nt=Re,Re=null):nt=Re.sibling;var ut=ce(ie,Re,oe[Xe],me);if(ut===null){Re===null&&(Re=nt);break}t&&Re&&ut.alternate===null&&n(ie,Re),te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut,Re=nt}if(Xe===oe.length)return a(ie,Re),it&&hr(ie,Xe),ze;if(Re===null){for(;Xe<oe.length;Xe++)Re=xe(ie,oe[Xe],me),Re!==null&&(te=E(Re,te,Xe),ct===null?ze=Re:ct.sibling=Re,ct=Re);return it&&hr(ie,Xe),ze}for(Re=h(Re);Xe<oe.length;Xe++)nt=de(Re,ie,Xe,oe[Xe],me),nt!==null&&(t&&nt.alternate!==null&&Re.delete(nt.key===null?Xe:nt.key),te=E(nt,te,Xe),ct===null?ze=nt:ct.sibling=nt,ct=nt);return t&&Re.forEach(function(Jr){return n(ie,Jr)}),it&&hr(ie,Xe),ze}function Pe(ie,te,oe,me){if(oe==null)throw Error(s(151));for(var ze=null,ct=null,Re=te,Xe=te=0,nt=null,ut=oe.next();Re!==null&&!ut.done;Xe++,ut=oe.next()){Re.index>Xe?(nt=Re,Re=null):nt=Re.sibling;var Jr=ce(ie,Re,ut.value,me);if(Jr===null){Re===null&&(Re=nt);break}t&&Re&&Jr.alternate===null&&n(ie,Re),te=E(Jr,te,Xe),ct===null?ze=Jr:ct.sibling=Jr,ct=Jr,Re=nt}if(ut.done)return a(ie,Re),it&&hr(ie,Xe),ze;if(Re===null){for(;!ut.done;Xe++,ut=oe.next())ut=xe(ie,ut.value,me),ut!==null&&(te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut);return it&&hr(ie,Xe),ze}for(Re=h(Re);!ut.done;Xe++,ut=oe.next())ut=de(Re,ie,Xe,ut.value,me),ut!==null&&(t&&ut.alternate!==null&&Re.delete(ut.key===null?Xe:ut.key),te=E(ut,te,Xe),ct===null?ze=ut:ct.sibling=ut,ct=ut);return t&&Re.forEach(function(N1){return n(ie,N1)}),it&&hr(ie,Xe),ze}function xt(ie,te,oe,me){if(typeof oe=="object"&&oe!==null&&oe.type===C&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:e:{for(var ze=oe.key;te!==null;){if(te.key===ze){if(ze=oe.type,ze===C){if(te.tag===7){a(ie,te.sibling),me=w(te,oe.props.children),me.return=ie,ie=me;break e}}else if(te.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===T&&vi(ze)===te.type){a(ie,te.sibling),me=w(te,oe.props),ea(me,oe),me.return=ie,ie=me;break e}a(ie,te);break}else n(ie,te);te=te.sibling}oe.type===C?(me=fi(oe.props.children,ie.mode,me,oe.key),me.return=ie,ie=me):(me=yo(oe.type,oe.key,oe.props,null,ie.mode,me),ea(me,oe),me.return=ie,ie=me)}return R(ie);case k:e:{for(ze=oe.key;te!==null;){if(te.key===ze)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){a(ie,te.sibling),me=w(te,oe.children||[]),me.return=ie,ie=me;break e}else{a(ie,te);break}else n(ie,te);te=te.sibling}me=Bc(oe,ie.mode,me),me.return=ie,ie=me}return R(ie);case T:return oe=vi(oe),xt(ie,te,oe,me)}if(U(oe))return De(ie,te,oe,me);if(Y(oe)){if(ze=Y(oe),typeof ze!="function")throw Error(s(150));return oe=ze.call(oe),Pe(ie,te,oe,me)}if(typeof oe.then=="function")return xt(ie,te,jo(oe),me);if(oe.$$typeof===S)return xt(ie,te,wo(ie,oe),me);No(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(a(ie,te.sibling),me=w(te,oe),me.return=ie,ie=me):(a(ie,te),me=Oc(oe,ie.mode,me),me.return=ie,ie=me),R(ie)):a(ie,te)}return function(ie,te,oe,me){try{Js=0;var ze=xt(ie,te,oe,me);return os=null,ze}catch(Re){if(Re===as||Re===ko)throw Re;var ct=wn(29,Re,null,ie.mode);return ct.lanes=me,ct.return=ie,ct}finally{}}}var yi=bp(!0),yp=bp(!1),Br=!1;function Yc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ir(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function zr(t,n,a){var h=t.updateQueue;if(h===null)return null;if(h=h.shared,(dt&2)!==0){var w=h.pending;return w===null?n.next=n:(n.next=w.next,w.next=n),h.pending=n,n=bo(t),rp(t,null,a),n}return vo(t,h,n,a),bo(t)}function ta(t,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,df(t,a)}}function Xc(t,n){var a=t.updateQueue,h=t.alternate;if(h!==null&&(h=h.updateQueue,a===h)){var w=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var R={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?w=E=R:E=E.next=R,a=a.next}while(a!==null);E===null?w=E=n:E=E.next=n}else w=E=n;a={baseState:h.baseState,firstBaseUpdate:w,lastBaseUpdate:E,shared:h.shared,callbacks:h.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=n:t.next=n,a.lastBaseUpdate=n}var Zc=!1;function na(){if(Zc){var t=ss;if(t!==null)throw t}}function ra(t,n,a,h){Zc=!1;var w=t.updateQueue;Br=!1;var E=w.firstBaseUpdate,R=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var J=G,le=J.next;J.next=null,R===null?E=le:R.next=le,R=J;var he=t.alternate;he!==null&&(he=he.updateQueue,G=he.lastBaseUpdate,G!==R&&(G===null?he.firstBaseUpdate=le:G.next=le,he.lastBaseUpdate=J))}if(E!==null){var xe=w.baseState;R=0,he=le=J=null,G=E;do{var ce=G.lane&-536870913,de=ce!==G.lane;if(de?(tt&ce)===ce:(h&ce)===ce){ce!==0&&ce===is&&(Zc=!0),he!==null&&(he=he.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var De=t,Pe=G;ce=n;var xt=a;switch(Pe.tag){case 1:if(De=Pe.payload,typeof De=="function"){xe=De.call(xt,xe,ce);break e}xe=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Pe.payload,ce=typeof De=="function"?De.call(xt,xe,ce):De,ce==null)break e;xe=m({},xe,ce);break e;case 2:Br=!0}}ce=G.callback,ce!==null&&(t.flags|=64,de&&(t.flags|=8192),de=w.callbacks,de===null?w.callbacks=[ce]:de.push(ce))}else de={lane:ce,tag:G.tag,payload:G.payload,callback:G.callback,next:null},he===null?(le=he=de,J=xe):he=he.next=de,R|=ce;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;de=G,G=de.next,de.next=null,w.lastBaseUpdate=de,w.shared.pending=null}}while(!0);he===null&&(J=xe),w.baseState=J,w.firstBaseUpdate=le,w.lastBaseUpdate=he,E===null&&(w.shared.lanes=0),$r|=R,t.lanes=R,t.memoizedState=xe}}function _p(t,n){if(typeof t!="function")throw Error(s(191,t));t.call(n)}function Sp(t,n){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)_p(a[t],n)}var ls=B(null),To=B(0);function wp(t,n){t=wr,F(To,t),F(ls,n),wr=t|n.baseLanes}function Qc(){F(To,wr),F(ls,ls.current)}function Jc(){wr=To.current,W(ls),W(To)}var Cn=B(null),Fn=null;function Hr(t){var n=t.alternate;F(Nt,Nt.current&1),F(Cn,t),Fn===null&&(n===null||ls.current!==null||n.memoizedState!==null)&&(Fn=t)}function eu(t){F(Nt,Nt.current),F(Cn,t),Fn===null&&(Fn=t)}function Cp(t){t.tag===22?(F(Nt,Nt.current),F(Cn,t),Fn===null&&(Fn=t)):Pr()}function Pr(){F(Nt,Nt.current),F(Cn,Cn.current)}function kn(t){W(Cn),Fn===t&&(Fn=null),W(Nt)}var Nt=B(0);function Ao(t){for(var n=t;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||ad(a)||od(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var mr=0,Ke=null,mt=null,Bt=null,Do=!1,cs=!1,_i=!1,Lo=0,ia=0,us=null,v_=0;function Et(){throw Error(s(321))}function tu(t,n){if(n===null)return!1;for(var a=0;a<n.length&&a<t.length;a++)if(!Sn(t[a],n[a]))return!1;return!0}function nu(t,n,a,h,w,E){return mr=E,Ke=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,z.H=t===null||t.memoizedState===null?om:xu,_i=!1,E=a(h,w),_i=!1,cs&&(E=Ep(n,a,h,w)),kp(t),E}function kp(t){z.H=oa;var n=mt!==null&&mt.next!==null;if(mr=0,Bt=mt=Ke=null,Do=!1,ia=0,us=null,n)throw Error(s(300));t===null||It||(t=t.dependencies,t!==null&&So(t)&&(It=!0))}function Ep(t,n,a,h){Ke=t;var w=0;do{if(cs&&(us=null),ia=0,cs=!1,25<=w)throw Error(s(301));if(w+=1,Bt=mt=null,t.updateQueue!=null){var E=t.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}z.H=lm,E=n(a,h)}while(cs);return E}function b_(){var t=z.H,n=t.useState()[0];return n=typeof n.then=="function"?sa(n):n,t=t.useState()[0],(mt!==null?mt.memoizedState:null)!==t&&(Ke.flags|=1024),n}function ru(){var t=Lo!==0;return Lo=0,t}function iu(t,n,a){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~a}function su(t){if(Do){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Do=!1}mr=0,Bt=mt=Ke=null,cs=!1,ia=Lo=0,us=null}function dn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Ke.memoizedState=Bt=t:Bt=Bt.next=t,Bt}function Tt(){if(mt===null){var t=Ke.alternate;t=t!==null?t.memoizedState:null}else t=mt.next;var n=Bt===null?Ke.memoizedState:Bt.next;if(n!==null)Bt=n,mt=t;else{if(t===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));mt=t,t={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Bt===null?Ke.memoizedState=Bt=t:Bt=Bt.next=t}return Bt}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sa(t){var n=ia;return ia+=1,us===null&&(us=[]),t=gp(us,t,n),n=Ke,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,z.H=n===null||n.memoizedState===null?om:xu),t}function Mo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return sa(t);if(t.$$typeof===S)return en(t)}throw Error(s(438,String(t)))}function au(t){var n=null,a=Ke.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var h=Ke.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(n={data:h.data.map(function(w){return w.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Ro(),Ke.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(t),h=0;h<t;h++)a[h]=H;return n.index++,a}function gr(t,n){return typeof n=="function"?n(t):n}function Oo(t){var n=Tt();return ou(n,mt,t)}function ou(t,n,a){var h=t.queue;if(h===null)throw Error(s(311));h.lastRenderedReducer=a;var w=t.baseQueue,E=h.pending;if(E!==null){if(w!==null){var R=w.next;w.next=E.next,E.next=R}n.baseQueue=w=E,h.pending=null}if(E=t.baseState,w===null)t.memoizedState=E;else{n=w.next;var G=R=null,J=null,le=n,he=!1;do{var xe=le.lane&-536870913;if(xe!==le.lane?(tt&xe)===xe:(mr&xe)===xe){var ce=le.revertLane;if(ce===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),xe===is&&(he=!0);else if((mr&ce)===ce){le=le.next,ce===is&&(he=!0);continue}else xe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=xe,R=E):J=J.next=xe,Ke.lanes|=ce,$r|=ce;xe=le.action,_i&&a(E,xe),E=le.hasEagerState?le.eagerState:a(E,xe)}else ce={lane:xe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},J===null?(G=J=ce,R=E):J=J.next=ce,Ke.lanes|=xe,$r|=xe;le=le.next}while(le!==null&&le!==n);if(J===null?R=E:J.next=G,!Sn(E,t.memoizedState)&&(It=!0,he&&(a=ss,a!==null)))throw a;t.memoizedState=E,t.baseState=R,t.baseQueue=J,h.lastRenderedState=E}return w===null&&(h.lanes=0),[t.memoizedState,h.dispatch]}function lu(t){var n=Tt(),a=n.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=t;var h=a.dispatch,w=a.pending,E=n.memoizedState;if(w!==null){a.pending=null;var R=w=w.next;do E=t(E,R.action),R=R.next;while(R!==w);Sn(E,n.memoizedState)||(It=!0),n.memoizedState=E,n.baseQueue===null&&(n.baseState=E),a.lastRenderedState=E}return[E,h]}function jp(t,n,a){var h=Ke,w=Tt(),E=it;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=n();var R=!Sn((mt||w).memoizedState,a);if(R&&(w.memoizedState=a,It=!0),w=w.queue,du(Ap.bind(null,h,w,t),[t]),w.getSnapshot!==n||R||Bt!==null&&Bt.memoizedState.tag&1){if(h.flags|=2048,ds(9,{destroy:void 0},Tp.bind(null,h,w,a,n),null),vt===null)throw Error(s(349));E||(mr&127)!==0||Np(h,n,a)}return a}function Np(t,n,a){t.flags|=16384,t={getSnapshot:n,value:a},n=Ke.updateQueue,n===null?(n=Ro(),Ke.updateQueue=n,n.stores=[t]):(a=n.stores,a===null?n.stores=[t]:a.push(t))}function Tp(t,n,a,h){n.value=a,n.getSnapshot=h,Dp(n)&&Lp(t)}function Ap(t,n,a){return a(function(){Dp(n)&&Lp(t)})}function Dp(t){var n=t.getSnapshot;t=t.value;try{var a=n();return!Sn(t,a)}catch{return!0}}function Lp(t){var n=hi(t,2);n!==null&&bn(n,t,2)}function cu(t){var n=dn();if(typeof t=="function"){var a=t;if(t=a(),_i){at(!0);try{a()}finally{at(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:t},n}function Rp(t,n,a,h){return t.baseState=a,ou(t,mt,typeof h=="function"?h:gr)}function y_(t,n,a,h,w){if(zo(t))throw Error(s(485));if(t=n.action,t!==null){var E={payload:w,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){E.listeners.push(R)}};z.T!==null?a(!0):E.isTransition=!1,h(E),a=n.pending,a===null?(E.next=n.pending=E,Mp(n,E)):(E.next=a.next,n.pending=a.next=E)}}function Mp(t,n){var a=n.action,h=n.payload,w=t.state;if(n.isTransition){var E=z.T,R={};z.T=R;try{var G=a(w,h),J=z.S;J!==null&&J(R,G),Op(t,n,G)}catch(le){uu(t,n,le)}finally{E!==null&&R.types!==null&&(E.types=R.types),z.T=E}}else try{E=a(w,h),Op(t,n,E)}catch(le){uu(t,n,le)}}function Op(t,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(h){Bp(t,n,h)},function(h){return uu(t,n,h)}):Bp(t,n,a)}function Bp(t,n,a){n.status="fulfilled",n.value=a,Ip(n),t.state=a,n=t.pending,n!==null&&(a=n.next,a===n?t.pending=null:(a=a.next,n.next=a,Mp(t,a)))}function uu(t,n,a){var h=t.pending;if(t.pending=null,h!==null){h=h.next;do n.status="rejected",n.reason=a,Ip(n),n=n.next;while(n!==h)}t.action=null}function Ip(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function zp(t,n){return n}function Hp(t,n){if(it){var a=vt.formState;if(a!==null){e:{var h=Ke;if(it){if(_t){t:{for(var w=_t,E=Pn;w.nodeType!==8;){if(!E){w=null;break t}if(w=Un(w.nextSibling),w===null){w=null;break t}}E=w.data,w=E==="F!"||E==="F"?w:null}if(w){_t=Un(w.nextSibling),h=w.data==="F!";break e}}Mr(h)}h=!1}h&&(n=a[0])}}return a=dn(),a.memoizedState=a.baseState=n,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zp,lastRenderedState:n},a.queue=h,a=im.bind(null,Ke,h),h.dispatch=a,h=cu(!1),E=gu.bind(null,Ke,!1,h.queue),h=dn(),w={state:n,dispatch:null,action:t,pending:null},h.queue=w,a=y_.bind(null,Ke,w,E,a),w.dispatch=a,h.memoizedState=t,[n,a,!1]}function Pp(t){var n=Tt();return Fp(n,mt,t)}function Fp(t,n,a){if(n=ou(t,n,zp)[0],t=Oo(gr)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var h=sa(n)}catch(R){throw R===as?ko:R}else h=n;n=Tt();var w=n.queue,E=w.dispatch;return a!==n.memoizedState&&(Ke.flags|=2048,ds(9,{destroy:void 0},__.bind(null,w,a),null)),[h,E,t]}function __(t,n){t.action=n}function Up(t){var n=Tt(),a=mt;if(a!==null)return Fp(n,a,t);Tt(),n=n.memoizedState,a=Tt();var h=a.queue.dispatch;return a.memoizedState=t,[n,h,!1]}function ds(t,n,a,h){return t={tag:t,create:a,deps:h,inst:n,next:null},n=Ke.updateQueue,n===null&&(n=Ro(),Ke.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=t.next=t:(h=a.next,a.next=t,t.next=h,n.lastEffect=t),t}function $p(){return Tt().memoizedState}function Bo(t,n,a,h){var w=dn();Ke.flags|=t,w.memoizedState=ds(1|n,{destroy:void 0},a,h===void 0?null:h)}function Io(t,n,a,h){var w=Tt();h=h===void 0?null:h;var E=w.memoizedState.inst;mt!==null&&h!==null&&tu(h,mt.memoizedState.deps)?w.memoizedState=ds(n,E,a,h):(Ke.flags|=t,w.memoizedState=ds(1|n,E,a,h))}function qp(t,n){Bo(8390656,8,t,n)}function du(t,n){Io(2048,8,t,n)}function S_(t){Ke.flags|=4;var n=Ke.updateQueue;if(n===null)n=Ro(),Ke.updateQueue=n,n.events=[t];else{var a=n.events;a===null?n.events=[t]:a.push(t)}}function Wp(t){var n=Tt().memoizedState;return S_({ref:n,nextImpl:t}),function(){if((dt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}function Gp(t,n){return Io(4,2,t,n)}function Vp(t,n){return Io(4,4,t,n)}function Yp(t,n){if(typeof n=="function"){t=t();var a=n(t);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Kp(t,n,a){a=a!=null?a.concat([t]):null,Io(4,4,Yp.bind(null,n,t),a)}function hu(){}function Xp(t,n){var a=Tt();n=n===void 0?null:n;var h=a.memoizedState;return n!==null&&tu(n,h[1])?h[0]:(a.memoizedState=[t,n],t)}function Zp(t,n){var a=Tt();n=n===void 0?null:n;var h=a.memoizedState;if(n!==null&&tu(n,h[1]))return h[0];if(h=t(),_i){at(!0);try{t()}finally{at(!1)}}return a.memoizedState=[h,n],h}function fu(t,n,a){return a===void 0||(mr&1073741824)!==0&&(tt&261930)===0?t.memoizedState=n:(t.memoizedState=a,t=Qm(),Ke.lanes|=t,$r|=t,a)}function Qp(t,n,a,h){return Sn(a,n)?a:ls.current!==null?(t=fu(t,a,h),Sn(t,n)||(It=!0),t):(mr&42)===0||(mr&1073741824)!==0&&(tt&261930)===0?(It=!0,t.memoizedState=a):(t=Qm(),Ke.lanes|=t,$r|=t,n)}function Jp(t,n,a,h,w){var E=X.p;X.p=E!==0&&8>E?E:8;var R=z.T,G={};z.T=G,gu(t,!1,n,a);try{var J=w(),le=z.S;if(le!==null&&le(G,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var he=x_(J,h);aa(t,n,he,Nn(t))}else aa(t,n,h,Nn(t))}catch(xe){aa(t,n,{then:function(){},status:"rejected",reason:xe},Nn())}finally{X.p=E,R!==null&&G.types!==null&&(R.types=G.types),z.T=R}}function w_(){}function pu(t,n,a,h){if(t.tag!==5)throw Error(s(476));var w=em(t).queue;Jp(t,w,n,Q,a===null?w_:function(){return tm(t),a(h)})}function em(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:Q},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:a},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function tm(t){var n=em(t);n.next===null&&(n=t.alternate.memoizedState),aa(t,n.next.queue,{},Nn())}function mu(){return en(wa)}function nm(){return Tt().memoizedState}function rm(){return Tt().memoizedState}function C_(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var a=Nn();t=Ir(a);var h=zr(n,t,a);h!==null&&(bn(h,n,a),ta(h,n,a)),n={cache:qc()},t.payload=n;return}n=n.return}}function k_(t,n,a){var h=Nn();a={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},zo(t)?sm(n,a):(a=Rc(t,n,a,h),a!==null&&(bn(a,t,h),am(a,n,h)))}function im(t,n,a){var h=Nn();aa(t,n,a,h)}function aa(t,n,a,h){var w={lane:h,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(zo(t))sm(n,w);else{var E=t.alternate;if(t.lanes===0&&(E===null||E.lanes===0)&&(E=n.lastRenderedReducer,E!==null))try{var R=n.lastRenderedState,G=E(R,a);if(w.hasEagerState=!0,w.eagerState=G,Sn(G,R))return vo(t,n,w,0),vt===null&&xo(),!1}catch{}finally{}if(a=Rc(t,n,w,h),a!==null)return bn(a,t,h),am(a,n,h),!0}return!1}function gu(t,n,a,h){if(h={lane:2,revertLane:Yu(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},zo(t)){if(n)throw Error(s(479))}else n=Rc(t,a,h,2),n!==null&&bn(n,t,2)}function zo(t){var n=t.alternate;return t===Ke||n!==null&&n===Ke}function sm(t,n){cs=Do=!0;var a=t.pending;a===null?n.next=n:(n.next=a.next,a.next=n),t.pending=n}function am(t,n,a){if((a&4194048)!==0){var h=n.lanes;h&=t.pendingLanes,a|=h,n.lanes=a,df(t,a)}}var oa={readContext:en,use:Mo,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};oa.useEffectEvent=Et;var om={readContext:en,use:Mo,useCallback:function(t,n){return dn().memoizedState=[t,n===void 0?null:n],t},useContext:en,useEffect:qp,useImperativeHandle:function(t,n,a){a=a!=null?a.concat([t]):null,Bo(4194308,4,Yp.bind(null,n,t),a)},useLayoutEffect:function(t,n){return Bo(4194308,4,t,n)},useInsertionEffect:function(t,n){Bo(4,2,t,n)},useMemo:function(t,n){var a=dn();n=n===void 0?null:n;var h=t();if(_i){at(!0);try{t()}finally{at(!1)}}return a.memoizedState=[h,n],h},useReducer:function(t,n,a){var h=dn();if(a!==void 0){var w=a(n);if(_i){at(!0);try{a(n)}finally{at(!1)}}}else w=n;return h.memoizedState=h.baseState=w,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:w},h.queue=t,t=t.dispatch=k_.bind(null,Ke,t),[h.memoizedState,t]},useRef:function(t){var n=dn();return t={current:t},n.memoizedState=t},useState:function(t){t=cu(t);var n=t.queue,a=im.bind(null,Ke,n);return n.dispatch=a,[t.memoizedState,a]},useDebugValue:hu,useDeferredValue:function(t,n){var a=dn();return fu(a,t,n)},useTransition:function(){var t=cu(!1);return t=Jp.bind(null,Ke,t.queue,!0,!1),dn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,a){var h=Ke,w=dn();if(it){if(a===void 0)throw Error(s(407));a=a()}else{if(a=n(),vt===null)throw Error(s(349));(tt&127)!==0||Np(h,n,a)}w.memoizedState=a;var E={value:a,getSnapshot:n};return w.queue=E,qp(Ap.bind(null,h,E,t),[t]),h.flags|=2048,ds(9,{destroy:void 0},Tp.bind(null,h,E,a,n),null),a},useId:function(){var t=dn(),n=vt.identifierPrefix;if(it){var a=Qn,h=Zn;a=(h&~(1<<32-qe(h)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Lo++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=v_++,n="_"+n+"r_"+a.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:mu,useFormState:Hp,useActionState:Hp,useOptimistic:function(t){var n=dn();n.memoizedState=n.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=gu.bind(null,Ke,!0,a),a.dispatch=n,[t,n]},useMemoCache:au,useCacheRefresh:function(){return dn().memoizedState=C_.bind(null,Ke)},useEffectEvent:function(t){var n=dn(),a={impl:t};return n.memoizedState=a,function(){if((dt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},xu={readContext:en,use:Mo,useCallback:Xp,useContext:en,useEffect:du,useImperativeHandle:Kp,useInsertionEffect:Gp,useLayoutEffect:Vp,useMemo:Zp,useReducer:Oo,useRef:$p,useState:function(){return Oo(gr)},useDebugValue:hu,useDeferredValue:function(t,n){var a=Tt();return Qp(a,mt.memoizedState,t,n)},useTransition:function(){var t=Oo(gr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:jp,useId:nm,useHostTransitionStatus:mu,useFormState:Pp,useActionState:Pp,useOptimistic:function(t,n){var a=Tt();return Rp(a,mt,t,n)},useMemoCache:au,useCacheRefresh:rm};xu.useEffectEvent=Wp;var lm={readContext:en,use:Mo,useCallback:Xp,useContext:en,useEffect:du,useImperativeHandle:Kp,useInsertionEffect:Gp,useLayoutEffect:Vp,useMemo:Zp,useReducer:lu,useRef:$p,useState:function(){return lu(gr)},useDebugValue:hu,useDeferredValue:function(t,n){var a=Tt();return mt===null?fu(a,t,n):Qp(a,mt.memoizedState,t,n)},useTransition:function(){var t=lu(gr)[0],n=Tt().memoizedState;return[typeof t=="boolean"?t:sa(t),n]},useSyncExternalStore:jp,useId:nm,useHostTransitionStatus:mu,useFormState:Up,useActionState:Up,useOptimistic:function(t,n){var a=Tt();return mt!==null?Rp(a,mt,t,n):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:au,useCacheRefresh:rm};lm.useEffectEvent=Wp;function vu(t,n,a,h){n=t.memoizedState,a=a(h,n),a=a==null?n:m({},n,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var bu={enqueueSetState:function(t,n,a){t=t._reactInternals;var h=Nn(),w=Ir(h);w.payload=n,a!=null&&(w.callback=a),n=zr(t,w,h),n!==null&&(bn(n,t,h),ta(n,t,h))},enqueueReplaceState:function(t,n,a){t=t._reactInternals;var h=Nn(),w=Ir(h);w.tag=1,w.payload=n,a!=null&&(w.callback=a),n=zr(t,w,h),n!==null&&(bn(n,t,h),ta(n,t,h))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var a=Nn(),h=Ir(a);h.tag=2,n!=null&&(h.callback=n),n=zr(t,h,a),n!==null&&(bn(n,t,a),ta(n,t,a))}};function cm(t,n,a,h,w,E,R){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(h,E,R):n.prototype&&n.prototype.isPureReactComponent?!Vs(a,h)||!Vs(w,E):!0}function um(t,n,a,h){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,h),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,h),n.state!==t&&bu.enqueueReplaceState(n,n.state,null)}function Si(t,n){var a=n;if("ref"in n){a={};for(var h in n)h!=="ref"&&(a[h]=n[h])}if(t=t.defaultProps){a===n&&(a=m({},a));for(var w in t)a[w]===void 0&&(a[w]=t[w])}return a}function dm(t){go(t)}function hm(t){console.error(t)}function fm(t){go(t)}function Ho(t,n){try{var a=t.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(h){setTimeout(function(){throw h})}}function pm(t,n,a){try{var h=t.onCaughtError;h(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function yu(t,n,a){return a=Ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Ho(t,n)},a}function mm(t){return t=Ir(t),t.tag=3,t}function gm(t,n,a,h){var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var E=h.value;t.payload=function(){return w(E)},t.callback=function(){pm(n,a,h)}}var R=a.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(t.callback=function(){pm(n,a,h),typeof w!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})})}function E_(t,n,a,h,w){if(a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(n=a.alternate,n!==null&&rs(n,a,w,!0),a=Cn.current,a!==null){switch(a.tag){case 31:case 13:return Fn===null?Zo():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=w,h===Eo?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([h]):n.add(h),Wu(t,h,w)),!1;case 22:return a.flags|=65536,h===Eo?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([h])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([h]):a.add(h)),Wu(t,h,w)),!1}throw Error(s(435,a.tag))}return Wu(t,h,w),Zo(),!1}if(it)return n=Cn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=w,h!==Hc&&(t=Error(s(422),{cause:h}),Xs(In(t,a)))):(h!==Hc&&(n=Error(s(423),{cause:h}),Xs(In(n,a))),t=t.current.alternate,t.flags|=65536,w&=-w,t.lanes|=w,h=In(h,a),w=yu(t.stateNode,h,w),Xc(t,w),jt!==4&&(jt=2)),!1;var E=Error(s(520),{cause:h});if(E=In(E,a),ma===null?ma=[E]:ma.push(E),jt!==4&&(jt=2),n===null)return!0;h=In(h,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,t=w&-w,a.lanes|=t,t=yu(a.stateNode,h,t),Xc(a,t),!1;case 1:if(n=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(qr===null||!qr.has(E))))return a.flags|=65536,w&=-w,a.lanes|=w,w=mm(w),gm(w,t,a,h),Xc(a,w),!1}a=a.return}while(a!==null);return!1}var _u=Error(s(461)),It=!1;function tn(t,n,a,h){n.child=t===null?yp(n,null,a,h):yi(n,t.child,a,h)}function xm(t,n,a,h,w){a=a.render;var E=n.ref;if("ref"in h){var R={};for(var G in h)G!=="ref"&&(R[G]=h[G])}else R=h;return gi(n),h=nu(t,n,a,R,E,w),G=ru(),t!==null&&!It?(iu(t,n,w),xr(t,n,w)):(it&&G&&Ic(n),n.flags|=1,tn(t,n,h,w),n.child)}function vm(t,n,a,h,w){if(t===null){var E=a.type;return typeof E=="function"&&!Mc(E)&&E.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=E,bm(t,n,E,h,w)):(t=yo(a.type,null,h,n,n.mode,w),t.ref=n.ref,t.return=n,n.child=t)}if(E=t.child,!Tu(t,w)){var R=E.memoizedProps;if(a=a.compare,a=a!==null?a:Vs,a(R,h)&&t.ref===n.ref)return xr(t,n,w)}return n.flags|=1,t=dr(E,h),t.ref=n.ref,t.return=n,n.child=t}function bm(t,n,a,h,w){if(t!==null){var E=t.memoizedProps;if(Vs(E,h)&&t.ref===n.ref)if(It=!1,n.pendingProps=h=E,Tu(t,w))(t.flags&131072)!==0&&(It=!0);else return n.lanes=t.lanes,xr(t,n,w)}return Su(t,n,a,h,w)}function ym(t,n,a,h){var w=h.children,E=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((n.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,t!==null){for(h=n.child=t.child,w=0;h!==null;)w=w|h.lanes|h.childLanes,h=h.sibling;h=w&~E}else h=0,n.child=null;return _m(t,n,E,a,h)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Co(n,E!==null?E.cachePool:null),E!==null?wp(n,E):Qc(),Cp(n);else return h=n.lanes=536870912,_m(t,n,E!==null?E.baseLanes|a:a,a,h)}else E!==null?(Co(n,E.cachePool),wp(n,E),Pr(),n.memoizedState=null):(t!==null&&Co(n,null),Qc(),Pr());return tn(t,n,w,a),n.child}function la(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function _m(t,n,a,h,w){var E=Gc();return E=E===null?null:{parent:Ot._currentValue,pool:E},n.memoizedState={baseLanes:a,cachePool:E},t!==null&&Co(n,null),Qc(),Cp(n),t!==null&&rs(t,n,h,!0),n.childLanes=w,null}function Po(t,n){return n=Uo({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function Sm(t,n,a){return yi(n,t.child,null,a),t=Po(n,n.pendingProps),t.flags|=2,kn(n),n.memoizedState=null,t}function j_(t,n,a){var h=n.pendingProps,w=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(it){if(h.mode==="hidden")return t=Po(n,h),n.lanes=536870912,la(null,t);if(eu(n),(t=_t)?(t=Mg(t,Pn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Lr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=sp(t),a.return=n,n.child=a,Jt=n,_t=null)):t=null,t===null)throw Mr(n);return n.lanes=536870912,null}return Po(n,h)}var E=t.memoizedState;if(E!==null){var R=E.dehydrated;if(eu(n),w)if(n.flags&256)n.flags&=-257,n=Sm(t,n,a);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(s(558));else if(It||rs(t,n,a,!1),w=(a&t.childLanes)!==0,It||w){if(h=vt,h!==null&&(R=hf(h,a),R!==0&&R!==E.retryLane))throw E.retryLane=R,hi(t,R),bn(h,t,R),_u;Zo(),n=Sm(t,n,a)}else t=E.treeContext,_t=Un(R.nextSibling),Jt=n,it=!0,Rr=null,Pn=!1,t!==null&&lp(n,t),n=Po(n,h),n.flags|=4096;return n}return t=dr(t.child,{mode:h.mode,children:h.children}),t.ref=n.ref,n.child=t,t.return=n,t}function Fo(t,n){var a=n.ref;if(a===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(t===null||t.ref!==a)&&(n.flags|=4194816)}}function Su(t,n,a,h,w){return gi(n),a=nu(t,n,a,h,void 0,w),h=ru(),t!==null&&!It?(iu(t,n,w),xr(t,n,w)):(it&&h&&Ic(n),n.flags|=1,tn(t,n,a,w),n.child)}function wm(t,n,a,h,w,E){return gi(n),n.updateQueue=null,a=Ep(n,h,a,w),kp(t),h=ru(),t!==null&&!It?(iu(t,n,E),xr(t,n,E)):(it&&h&&Ic(n),n.flags|=1,tn(t,n,a,E),n.child)}function Cm(t,n,a,h,w){if(gi(n),n.stateNode===null){var E=Ji,R=a.contextType;typeof R=="object"&&R!==null&&(E=en(R)),E=new a(h,E),n.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=bu,n.stateNode=E,E._reactInternals=n,E=n.stateNode,E.props=h,E.state=n.memoizedState,E.refs={},Yc(n),R=a.contextType,E.context=typeof R=="object"&&R!==null?en(R):Ji,E.state=n.memoizedState,R=a.getDerivedStateFromProps,typeof R=="function"&&(vu(n,a,R,h),E.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(R=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),R!==E.state&&bu.enqueueReplaceState(E,E.state,null),ra(n,h,E,w),na(),E.state=n.memoizedState),typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!0}else if(t===null){E=n.stateNode;var G=n.memoizedProps,J=Si(a,G);E.props=J;var le=E.context,he=a.contextType;R=Ji,typeof he=="object"&&he!==null&&(R=en(he));var xe=a.getDerivedStateFromProps;he=typeof xe=="function"||typeof E.getSnapshotBeforeUpdate=="function",G=n.pendingProps!==G,he||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(G||le!==R)&&um(n,E,h,R),Br=!1;var ce=n.memoizedState;E.state=ce,ra(n,h,E,w),na(),le=n.memoizedState,G||ce!==le||Br?(typeof xe=="function"&&(vu(n,a,xe,h),le=n.memoizedState),(J=Br||cm(n,a,J,h,ce,le,R))?(he||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(n.flags|=4194308)):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=h,n.memoizedState=le),E.props=h,E.state=le,E.context=R,h=J):(typeof E.componentDidMount=="function"&&(n.flags|=4194308),h=!1)}else{E=n.stateNode,Kc(t,n),R=n.memoizedProps,he=Si(a,R),E.props=he,xe=n.pendingProps,ce=E.context,le=a.contextType,J=Ji,typeof le=="object"&&le!==null&&(J=en(le)),G=a.getDerivedStateFromProps,(le=typeof G=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(R!==xe||ce!==J)&&um(n,E,h,J),Br=!1,ce=n.memoizedState,E.state=ce,ra(n,h,E,w),na();var de=n.memoizedState;R!==xe||ce!==de||Br||t!==null&&t.dependencies!==null&&So(t.dependencies)?(typeof G=="function"&&(vu(n,a,G,h),de=n.memoizedState),(he=Br||cm(n,a,he,h,ce,de,J)||t!==null&&t.dependencies!==null&&So(t.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(h,de,J),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(h,de,J)),typeof E.componentDidUpdate=="function"&&(n.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof E.componentDidUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),n.memoizedProps=h,n.memoizedState=de),E.props=h,E.state=de,E.context=J,h=he):(typeof E.componentDidUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||R===t.memoizedProps&&ce===t.memoizedState||(n.flags|=1024),h=!1)}return E=h,Fo(t,n),h=(n.flags&128)!==0,E||h?(E=n.stateNode,a=h&&typeof a.getDerivedStateFromError!="function"?null:E.render(),n.flags|=1,t!==null&&h?(n.child=yi(n,t.child,null,w),n.child=yi(n,null,a,w)):tn(t,n,a,w),n.memoizedState=E.state,t=n.child):t=xr(t,n,w),t}function km(t,n,a,h){return pi(),n.flags|=256,tn(t,n,a,h),n.child}var wu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cu(t){return{baseLanes:t,cachePool:pp()}}function ku(t,n,a){return t=t!==null?t.childLanes&~a:0,n&&(t|=jn),t}function Em(t,n,a){var h=n.pendingProps,w=!1,E=(n.flags&128)!==0,R;if((R=E)||(R=t!==null&&t.memoizedState===null?!1:(Nt.current&2)!==0),R&&(w=!0,n.flags&=-129),R=(n.flags&32)!==0,n.flags&=-33,t===null){if(it){if(w?Hr(n):Pr(),(t=_t)?(t=Mg(t,Pn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:Lr!==null?{id:Zn,overflow:Qn}:null,retryLane:536870912,hydrationErrors:null},a=sp(t),a.return=n,n.child=a,Jt=n,_t=null)):t=null,t===null)throw Mr(n);return od(t)?n.lanes=32:n.lanes=536870912,null}var G=h.children;return h=h.fallback,w?(Pr(),w=n.mode,G=Uo({mode:"hidden",children:G},w),h=fi(h,w,a,null),G.return=n,h.return=n,G.sibling=h,n.child=G,h=n.child,h.memoizedState=Cu(a),h.childLanes=ku(t,R,a),n.memoizedState=wu,la(null,h)):(Hr(n),Eu(n,G))}var J=t.memoizedState;if(J!==null&&(G=J.dehydrated,G!==null)){if(E)n.flags&256?(Hr(n),n.flags&=-257,n=ju(t,n,a)):n.memoizedState!==null?(Pr(),n.child=t.child,n.flags|=128,n=null):(Pr(),G=h.fallback,w=n.mode,h=Uo({mode:"visible",children:h.children},w),G=fi(G,w,a,null),G.flags|=2,h.return=n,G.return=n,h.sibling=G,n.child=h,yi(n,t.child,null,a),h=n.child,h.memoizedState=Cu(a),h.childLanes=ku(t,R,a),n.memoizedState=wu,n=la(null,h));else if(Hr(n),od(G)){if(R=G.nextSibling&&G.nextSibling.dataset,R)var le=R.dgst;R=le,h=Error(s(419)),h.stack="",h.digest=R,Xs({value:h,source:null,stack:null}),n=ju(t,n,a)}else if(It||rs(t,n,a,!1),R=(a&t.childLanes)!==0,It||R){if(R=vt,R!==null&&(h=hf(R,a),h!==0&&h!==J.retryLane))throw J.retryLane=h,hi(t,h),bn(R,t,h),_u;ad(G)||Zo(),n=ju(t,n,a)}else ad(G)?(n.flags|=192,n.child=t.child,n=null):(t=J.treeContext,_t=Un(G.nextSibling),Jt=n,it=!0,Rr=null,Pn=!1,t!==null&&lp(n,t),n=Eu(n,h.children),n.flags|=4096);return n}return w?(Pr(),G=h.fallback,w=n.mode,J=t.child,le=J.sibling,h=dr(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,le!==null?G=dr(le,G):(G=fi(G,w,a,null),G.flags|=2),G.return=n,h.return=n,h.sibling=G,n.child=h,la(null,h),h=n.child,G=t.child.memoizedState,G===null?G=Cu(a):(w=G.cachePool,w!==null?(J=Ot._currentValue,w=w.parent!==J?{parent:J,pool:J}:w):w=pp(),G={baseLanes:G.baseLanes|a,cachePool:w}),h.memoizedState=G,h.childLanes=ku(t,R,a),n.memoizedState=wu,la(t.child,h)):(Hr(n),a=t.child,t=a.sibling,a=dr(a,{mode:"visible",children:h.children}),a.return=n,a.sibling=null,t!==null&&(R=n.deletions,R===null?(n.deletions=[t],n.flags|=16):R.push(t)),n.child=a,n.memoizedState=null,a)}function Eu(t,n){return n=Uo({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function Uo(t,n){return t=wn(22,t,null,n),t.lanes=0,t}function ju(t,n,a){return yi(n,t.child,null,a),t=Eu(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function jm(t,n,a){t.lanes|=n;var h=t.alternate;h!==null&&(h.lanes|=n),Uc(t.return,n,a)}function Nu(t,n,a,h,w,E){var R=t.memoizedState;R===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:h,tail:a,tailMode:w,treeForkCount:E}:(R.isBackwards=n,R.rendering=null,R.renderingStartTime=0,R.last=h,R.tail=a,R.tailMode=w,R.treeForkCount=E)}function Nm(t,n,a){var h=n.pendingProps,w=h.revealOrder,E=h.tail;h=h.children;var R=Nt.current,G=(R&2)!==0;if(G?(R=R&1|2,n.flags|=128):R&=1,F(Nt,R),tn(t,n,h,a),h=it?Ks:0,!G&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&jm(t,a,n);else if(t.tag===19)jm(t,a,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(w){case"forwards":for(a=n.child,w=null;a!==null;)t=a.alternate,t!==null&&Ao(t)===null&&(w=a),a=a.sibling;a=w,a===null?(w=n.child,n.child=null):(w=a.sibling,a.sibling=null),Nu(n,!1,w,a,E,h);break;case"backwards":case"unstable_legacy-backwards":for(a=null,w=n.child,n.child=null;w!==null;){if(t=w.alternate,t!==null&&Ao(t)===null){n.child=w;break}t=w.sibling,w.sibling=a,a=w,w=t}Nu(n,!0,a,null,E,h);break;case"together":Nu(n,!1,null,null,void 0,h);break;default:n.memoizedState=null}return n.child}function xr(t,n,a){if(t!==null&&(n.dependencies=t.dependencies),$r|=n.lanes,(a&n.childLanes)===0)if(t!==null){if(rs(t,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(s(153));if(n.child!==null){for(t=n.child,a=dr(t,t.pendingProps),n.child=a,a.return=n;t.sibling!==null;)t=t.sibling,a=a.sibling=dr(t,t.pendingProps),a.return=n;a.sibling=null}return n.child}function Tu(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&So(t)))}function N_(t,n,a){switch(n.tag){case 3:$(n,n.stateNode.containerInfo),Or(n,Ot,t.memoizedState.cache),pi();break;case 27:case 5:ne(n);break;case 4:$(n,n.stateNode.containerInfo);break;case 10:Or(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,eu(n),null;break;case 13:var h=n.memoizedState;if(h!==null)return h.dehydrated!==null?(Hr(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Em(t,n,a):(Hr(n),t=xr(t,n,a),t!==null?t.sibling:null);Hr(n);break;case 19:var w=(t.flags&128)!==0;if(h=(a&n.childLanes)!==0,h||(rs(t,n,a,!1),h=(a&n.childLanes)!==0),w){if(h)return Nm(t,n,a);n.flags|=128}if(w=n.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),F(Nt,Nt.current),h)break;return null;case 22:return n.lanes=0,ym(t,n,a,n.pendingProps);case 24:Or(n,Ot,t.memoizedState.cache)}return xr(t,n,a)}function Tm(t,n,a){if(t!==null)if(t.memoizedProps!==n.pendingProps)It=!0;else{if(!Tu(t,a)&&(n.flags&128)===0)return It=!1,N_(t,n,a);It=(t.flags&131072)!==0}else It=!1,it&&(n.flags&1048576)!==0&&op(n,Ks,n.index);switch(n.lanes=0,n.tag){case 16:e:{var h=n.pendingProps;if(t=vi(n.elementType),n.type=t,typeof t=="function")Mc(t)?(h=Si(t,h),n.tag=1,n=Cm(null,n,t,h,a)):(n.tag=0,n=Su(null,n,t,h,a));else{if(t!=null){var w=t.$$typeof;if(w===j){n.tag=11,n=xm(null,n,t,h,a);break e}else if(w===D){n.tag=14,n=vm(null,n,t,h,a);break e}}throw n=O(t)||t,Error(s(306,n,""))}}return n;case 0:return Su(t,n,n.type,n.pendingProps,a);case 1:return h=n.type,w=Si(h,n.pendingProps),Cm(t,n,h,w,a);case 3:e:{if($(n,n.stateNode.containerInfo),t===null)throw Error(s(387));h=n.pendingProps;var E=n.memoizedState;w=E.element,Kc(t,n),ra(n,h,null,a);var R=n.memoizedState;if(h=R.cache,Or(n,Ot,h),h!==E.cache&&$c(n,[Ot],a,!0),na(),h=R.element,E.isDehydrated)if(E={element:h,isDehydrated:!1,cache:R.cache},n.updateQueue.baseState=E,n.memoizedState=E,n.flags&256){n=km(t,n,h,a);break e}else if(h!==w){w=In(Error(s(424)),n),Xs(w),n=km(t,n,h,a);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(_t=Un(t.firstChild),Jt=n,it=!0,Rr=null,Pn=!0,a=yp(n,null,h,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(pi(),h===w){n=xr(t,n,a);break e}tn(t,n,h,a)}n=n.child}return n;case 26:return Fo(t,n),t===null?(a=Pg(n.type,null,n.pendingProps,null))?n.memoizedState=a:it||(a=n.type,t=n.pendingProps,h=il(ee.current).createElement(a),h[Qt]=n,h[fn]=t,nn(h,a,t),Yt(h),n.stateNode=h):n.memoizedState=Pg(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return ne(n),t===null&&it&&(h=n.stateNode=Ig(n.type,n.pendingProps,ee.current),Jt=n,Pn=!0,w=_t,Yr(n.type)?(ld=w,_t=Un(h.firstChild)):_t=w),tn(t,n,n.pendingProps.children,a),Fo(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&it&&((w=h=_t)&&(h=i1(h,n.type,n.pendingProps,Pn),h!==null?(n.stateNode=h,Jt=n,_t=Un(h.firstChild),Pn=!1,w=!0):w=!1),w||Mr(n)),ne(n),w=n.type,E=n.pendingProps,R=t!==null?t.memoizedProps:null,h=E.children,rd(w,E)?h=null:R!==null&&rd(w,R)&&(n.flags|=32),n.memoizedState!==null&&(w=nu(t,n,b_,null,null,a),wa._currentValue=w),Fo(t,n),tn(t,n,h,a),n.child;case 6:return t===null&&it&&((t=a=_t)&&(a=s1(a,n.pendingProps,Pn),a!==null?(n.stateNode=a,Jt=n,_t=null,t=!0):t=!1),t||Mr(n)),null;case 13:return Em(t,n,a);case 4:return $(n,n.stateNode.containerInfo),h=n.pendingProps,t===null?n.child=yi(n,null,h,a):tn(t,n,h,a),n.child;case 11:return xm(t,n,n.type,n.pendingProps,a);case 7:return tn(t,n,n.pendingProps,a),n.child;case 8:return tn(t,n,n.pendingProps.children,a),n.child;case 12:return tn(t,n,n.pendingProps.children,a),n.child;case 10:return h=n.pendingProps,Or(n,n.type,h.value),tn(t,n,h.children,a),n.child;case 9:return w=n.type._context,h=n.pendingProps.children,gi(n),w=en(w),h=h(w),n.flags|=1,tn(t,n,h,a),n.child;case 14:return vm(t,n,n.type,n.pendingProps,a);case 15:return bm(t,n,n.type,n.pendingProps,a);case 19:return Nm(t,n,a);case 31:return j_(t,n,a);case 22:return ym(t,n,a,n.pendingProps);case 24:return gi(n),h=en(Ot),t===null?(w=Gc(),w===null&&(w=vt,E=qc(),w.pooledCache=E,E.refCount++,E!==null&&(w.pooledCacheLanes|=a),w=E),n.memoizedState={parent:h,cache:w},Yc(n),Or(n,Ot,w)):((t.lanes&a)!==0&&(Kc(t,n),ra(n,null,null,a),na()),w=t.memoizedState,E=n.memoizedState,w.parent!==h?(w={parent:h,cache:h},n.memoizedState=w,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=w),Or(n,Ot,h)):(h=E.cache,Or(n,Ot,h),h!==w.cache&&$c(n,[Ot],a,!0))),tn(t,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(s(156,n.tag))}function vr(t){t.flags|=4}function Au(t,n,a,h,w){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(w&335544128)===w)if(t.stateNode.complete)t.flags|=8192;else if(ng())t.flags|=8192;else throw bi=Eo,Vc}else t.flags&=-16777217}function Am(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Wg(n))if(ng())t.flags|=8192;else throw bi=Eo,Vc}function $o(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?Mt():536870912,t.lanes|=n,ms|=n)}function ca(t,n){if(!it)switch(t.tailMode){case"hidden":n=t.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var h=null;a!==null;)a.alternate!==null&&(h=a),a=a.sibling;h===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:h.sibling=null}}function St(t){var n=t.alternate!==null&&t.alternate.child===t.child,a=0,h=0;if(n)for(var w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags&65011712,h|=w.flags&65011712,w.return=t,w=w.sibling;else for(w=t.child;w!==null;)a|=w.lanes|w.childLanes,h|=w.subtreeFlags,h|=w.flags,w.return=t,w=w.sibling;return t.subtreeFlags|=h,t.childLanes=a,n}function T_(t,n,a){var h=n.pendingProps;switch(zc(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(n),null;case 1:return St(n),null;case 3:return a=n.stateNode,h=null,t!==null&&(h=t.memoizedState.cache),n.memoizedState.cache!==h&&(n.flags|=2048),pr(Ot),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(ns(n)?vr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Pc())),St(n),null;case 26:var w=n.type,E=n.memoizedState;return t===null?(vr(n),E!==null?(St(n),Am(n,E)):(St(n),Au(n,w,null,h,a))):E?E!==t.memoizedState?(vr(n),St(n),Am(n,E)):(St(n),n.flags&=-16777217):(t=t.memoizedProps,t!==h&&vr(n),St(n),Au(n,w,t,h,a)),null;case 27:if(ve(n),a=ee.current,w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}t=re.current,ns(n)?cp(n):(t=Ig(w,h,a),n.stateNode=t,vr(n))}return St(n),null;case 5:if(ve(n),w=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(!h){if(n.stateNode===null)throw Error(s(166));return St(n),null}if(E=re.current,ns(n))cp(n);else{var R=il(ee.current);switch(E){case 1:E=R.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:E=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":E=R.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":E=R.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":E=R.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof h.is=="string"?R.createElement("select",{is:h.is}):R.createElement("select"),h.multiple?E.multiple=!0:h.size&&(E.size=h.size);break;default:E=typeof h.is=="string"?R.createElement(w,{is:h.is}):R.createElement(w)}}E[Qt]=n,E[fn]=h;e:for(R=n.child;R!==null;){if(R.tag===5||R.tag===6)E.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===n)break e;for(;R.sibling===null;){if(R.return===null||R.return===n)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}n.stateNode=E;e:switch(nn(E,w,h),w){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&vr(n)}}return St(n),Au(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,a),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==h&&vr(n);else{if(typeof h!="string"&&n.stateNode===null)throw Error(s(166));if(t=ee.current,ns(n)){if(t=n.stateNode,a=n.memoizedProps,h=null,w=Jt,w!==null)switch(w.tag){case 27:case 5:h=w.memoizedProps}t[Qt]=n,t=!!(t.nodeValue===a||h!==null&&h.suppressHydrationWarning===!0||Eg(t.nodeValue,a)),t||Mr(n,!0)}else t=il(t).createTextNode(h),t[Qt]=n,n.stateNode=t}return St(n),null;case 31:if(a=n.memoizedState,t===null||t.memoizedState!==null){if(h=ns(n),a!==null){if(t===null){if(!h)throw Error(s(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[Qt]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),t=!1}else a=Pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return n.flags&256?(kn(n),n):(kn(n),null);if((n.flags&128)!==0)throw Error(s(558))}return St(n),null;case 13:if(h=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(w=ns(n),h!==null&&h.dehydrated!==null){if(t===null){if(!w)throw Error(s(318));if(w=n.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[Qt]=n}else pi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),w=!1}else w=Pc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=w),w=!0;if(!w)return n.flags&256?(kn(n),n):(kn(n),null)}return kn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=h!==null,t=t!==null&&t.memoizedState!==null,a&&(h=n.child,w=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(w=h.alternate.memoizedState.cachePool.pool),E=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(E=h.memoizedState.cachePool.pool),E!==w&&(h.flags|=2048)),a!==t&&a&&(n.child.flags|=8192),$o(n,n.updateQueue),St(n),null);case 4:return ae(),t===null&&Qu(n.stateNode.containerInfo),St(n),null;case 10:return pr(n.type),St(n),null;case 19:if(W(Nt),h=n.memoizedState,h===null)return St(n),null;if(w=(n.flags&128)!==0,E=h.rendering,E===null)if(w)ca(h,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(E=Ao(t),E!==null){for(n.flags|=128,ca(h,!1),t=E.updateQueue,n.updateQueue=t,$o(n,t),n.subtreeFlags=0,t=a,a=n.child;a!==null;)ip(a,t),a=a.sibling;return F(Nt,Nt.current&1|2),it&&hr(n,h.treeForkCount),n.child}t=t.sibling}h.tail!==null&&Oe()>Yo&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304)}else{if(!w)if(t=Ao(E),t!==null){if(n.flags|=128,w=!0,t=t.updateQueue,n.updateQueue=t,$o(n,t),ca(h,!0),h.tail===null&&h.tailMode==="hidden"&&!E.alternate&&!it)return St(n),null}else 2*Oe()-h.renderingStartTime>Yo&&a!==536870912&&(n.flags|=128,w=!0,ca(h,!1),n.lanes=4194304);h.isBackwards?(E.sibling=n.child,n.child=E):(t=h.last,t!==null?t.sibling=E:n.child=E,h.last=E)}return h.tail!==null?(t=h.tail,h.rendering=t,h.tail=t.sibling,h.renderingStartTime=Oe(),t.sibling=null,a=Nt.current,F(Nt,w?a&1|2:a&1),it&&hr(n,h.treeForkCount),t):(St(n),null);case 22:case 23:return kn(n),Jc(),h=n.memoizedState!==null,t!==null?t.memoizedState!==null!==h&&(n.flags|=8192):h&&(n.flags|=8192),h?(a&536870912)!==0&&(n.flags&128)===0&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),a=n.updateQueue,a!==null&&$o(n,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),h=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(h=n.memoizedState.cachePool.pool),h!==a&&(n.flags|=2048),t!==null&&W(xi),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),pr(Ot),St(n),null;case 25:return null;case 30:return null}throw Error(s(156,n.tag))}function A_(t,n){switch(zc(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return pr(Ot),ae(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return ve(n),null;case 31:if(n.memoizedState!==null){if(kn(n),n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(kn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(s(340));pi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return W(Nt),null;case 4:return ae(),null;case 10:return pr(n.type),null;case 22:case 23:return kn(n),Jc(),t!==null&&W(xi),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return pr(Ot),null;case 25:return null;default:return null}}function Dm(t,n){switch(zc(n),n.tag){case 3:pr(Ot),ae();break;case 26:case 27:case 5:ve(n);break;case 4:ae();break;case 31:n.memoizedState!==null&&kn(n);break;case 13:kn(n);break;case 19:W(Nt);break;case 10:pr(n.type);break;case 22:case 23:kn(n),Jc(),t!==null&&W(xi);break;case 24:pr(Ot)}}function ua(t,n){try{var a=n.updateQueue,h=a!==null?a.lastEffect:null;if(h!==null){var w=h.next;a=w;do{if((a.tag&t)===t){h=void 0;var E=a.create,R=a.inst;h=E(),R.destroy=h}a=a.next}while(a!==w)}}catch(G){ft(n,n.return,G)}}function Fr(t,n,a){try{var h=n.updateQueue,w=h!==null?h.lastEffect:null;if(w!==null){var E=w.next;h=E;do{if((h.tag&t)===t){var R=h.inst,G=R.destroy;if(G!==void 0){R.destroy=void 0,w=n;var J=a,le=G;try{le()}catch(he){ft(w,J,he)}}}h=h.next}while(h!==E)}}catch(he){ft(n,n.return,he)}}function Lm(t){var n=t.updateQueue;if(n!==null){var a=t.stateNode;try{Sp(n,a)}catch(h){ft(t,t.return,h)}}}function Rm(t,n,a){a.props=Si(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(h){ft(t,n,h)}}function da(t,n){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var h=t.stateNode;break;case 30:h=t.stateNode;break;default:h=t.stateNode}typeof a=="function"?t.refCleanup=a(h):a.current=h}}catch(w){ft(t,n,w)}}function Jn(t,n){var a=t.ref,h=t.refCleanup;if(a!==null)if(typeof h=="function")try{h()}catch(w){ft(t,n,w)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(w){ft(t,n,w)}else a.current=null}function Mm(t){var n=t.type,a=t.memoizedProps,h=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&h.focus();break e;case"img":a.src?h.src=a.src:a.srcSet&&(h.srcset=a.srcSet)}}catch(w){ft(t,t.return,w)}}function Du(t,n,a){try{var h=t.stateNode;Q_(h,t.type,a,n),h[fn]=n}catch(w){ft(t,t.return,w)}}function Om(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Yr(t.type)||t.tag===4}function Lu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Om(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Yr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ru(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(t),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=cr));else if(h!==4&&(h===27&&Yr(t.type)&&(a=t.stateNode,n=null),t=t.child,t!==null))for(Ru(t,n,a),t=t.sibling;t!==null;)Ru(t,n,a),t=t.sibling}function qo(t,n,a){var h=t.tag;if(h===5||h===6)t=t.stateNode,n?a.insertBefore(t,n):a.appendChild(t);else if(h!==4&&(h===27&&Yr(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(qo(t,n,a),t=t.sibling;t!==null;)qo(t,n,a),t=t.sibling}function Bm(t){var n=t.stateNode,a=t.memoizedProps;try{for(var h=t.type,w=n.attributes;w.length;)n.removeAttributeNode(w[0]);nn(n,h,a),n[Qt]=t,n[fn]=a}catch(E){ft(t,t.return,E)}}var br=!1,zt=!1,Mu=!1,Im=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function D_(t,n){if(t=t.containerInfo,td=dl,t=Kf(t),jc(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var h=a.getSelection&&a.getSelection();if(h&&h.rangeCount!==0){a=h.anchorNode;var w=h.anchorOffset,E=h.focusNode;h=h.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var R=0,G=-1,J=-1,le=0,he=0,xe=t,ce=null;t:for(;;){for(var de;xe!==a||w!==0&&xe.nodeType!==3||(G=R+w),xe!==E||h!==0&&xe.nodeType!==3||(J=R+h),xe.nodeType===3&&(R+=xe.nodeValue.length),(de=xe.firstChild)!==null;)ce=xe,xe=de;for(;;){if(xe===t)break t;if(ce===a&&++le===w&&(G=R),ce===E&&++he===h&&(J=R),(de=xe.nextSibling)!==null)break;xe=ce,ce=xe.parentNode}xe=de}a=G===-1||J===-1?null:{start:G,end:J}}else a=null}a=a||{start:0,end:0}}else a=null;for(nd={focusedElem:t,selectionRange:a},dl=!1,Kt=n;Kt!==null;)if(n=Kt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Kt=t;else for(;Kt!==null;){switch(n=Kt,E=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a<t.length;a++)w=t[a],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&E!==null){t=void 0,a=n,w=E.memoizedProps,E=E.memoizedState,h=a.stateNode;try{var De=Si(a.type,w);t=h.getSnapshotBeforeUpdate(De,E),h.__reactInternalSnapshotBeforeUpdate=t}catch(Pe){ft(a,a.return,Pe)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,a=t.nodeType,a===9)sd(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":sd(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=n.sibling,t!==null){t.return=n.return,Kt=t;break}Kt=n.return}}function zm(t,n,a){var h=a.flags;switch(a.tag){case 0:case 11:case 15:_r(t,a),h&4&&ua(5,a);break;case 1:if(_r(t,a),h&4)if(t=a.stateNode,n===null)try{t.componentDidMount()}catch(R){ft(a,a.return,R)}else{var w=Si(a.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(w,n,t.__reactInternalSnapshotBeforeUpdate)}catch(R){ft(a,a.return,R)}}h&64&&Lm(a),h&512&&da(a,a.return);break;case 3:if(_r(t,a),h&64&&(t=a.updateQueue,t!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Sp(t,n)}catch(R){ft(a,a.return,R)}}break;case 27:n===null&&h&4&&Bm(a);case 26:case 5:_r(t,a),n===null&&h&4&&Mm(a),h&512&&da(a,a.return);break;case 12:_r(t,a);break;case 31:_r(t,a),h&4&&Fm(t,a);break;case 13:_r(t,a),h&4&&Um(t,a),h&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=P_.bind(null,a),a1(t,a))));break;case 22:if(h=a.memoizedState!==null||br,!h){n=n!==null&&n.memoizedState!==null||zt,w=br;var E=zt;br=h,(zt=n)&&!E?Sr(t,a,(a.subtreeFlags&8772)!==0):_r(t,a),br=w,zt=E}break;case 30:break;default:_r(t,a)}}function Hm(t){var n=t.alternate;n!==null&&(t.alternate=null,Hm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&uc(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var wt=null,mn=!1;function yr(t,n,a){for(a=a.child;a!==null;)Pm(t,n,a),a=a.sibling}function Pm(t,n,a){if($e&&typeof $e.onCommitFiberUnmount=="function")try{$e.onCommitFiberUnmount(Le,a)}catch{}switch(a.tag){case 26:zt||Jn(a,n),yr(t,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:zt||Jn(a,n);var h=wt,w=mn;Yr(a.type)&&(wt=a.stateNode,mn=!1),yr(t,n,a),ya(a.stateNode),wt=h,mn=w;break;case 5:zt||Jn(a,n);case 6:if(h=wt,w=mn,wt=null,yr(t,n,a),wt=h,mn=w,wt!==null)if(mn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(a.stateNode)}catch(E){ft(a,n,E)}else try{wt.removeChild(a.stateNode)}catch(E){ft(a,n,E)}break;case 18:wt!==null&&(mn?(t=wt,Lg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),ws(t)):Lg(wt,a.stateNode));break;case 4:h=wt,w=mn,wt=a.stateNode.containerInfo,mn=!0,yr(t,n,a),wt=h,mn=w;break;case 0:case 11:case 14:case 15:Fr(2,a,n),zt||Fr(4,a,n),yr(t,n,a);break;case 1:zt||(Jn(a,n),h=a.stateNode,typeof h.componentWillUnmount=="function"&&Rm(a,n,h)),yr(t,n,a);break;case 21:yr(t,n,a);break;case 22:zt=(h=zt)||a.memoizedState!==null,yr(t,n,a),zt=h;break;default:yr(t,n,a)}}function Fm(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ws(t)}catch(a){ft(n,n.return,a)}}}function Um(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ws(t)}catch(a){ft(n,n.return,a)}}function L_(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Im),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Im),n;default:throw Error(s(435,t.tag))}}function Wo(t,n){var a=L_(t);n.forEach(function(h){if(!a.has(h)){a.add(h);var w=F_.bind(null,t,h);h.then(w,w)}})}function gn(t,n){var a=n.deletions;if(a!==null)for(var h=0;h<a.length;h++){var w=a[h],E=t,R=n,G=R;e:for(;G!==null;){switch(G.tag){case 27:if(Yr(G.type)){wt=G.stateNode,mn=!1;break e}break;case 5:wt=G.stateNode,mn=!1;break e;case 3:case 4:wt=G.stateNode.containerInfo,mn=!0;break e}G=G.return}if(wt===null)throw Error(s(160));Pm(E,R,w),wt=null,mn=!1,E=w.alternate,E!==null&&(E.return=null),w.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)$m(n,t),n=n.sibling}var Vn=null;function $m(t,n){var a=t.alternate,h=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:gn(n,t),xn(t),h&4&&(Fr(3,t,t.return),ua(3,t),Fr(5,t,t.return));break;case 1:gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),h&64&&br&&(t=t.updateQueue,t!==null&&(h=t.callbacks,h!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?h:a.concat(h))));break;case 26:var w=Vn;if(gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),h&4){var E=a!==null?a.memoizedState:null;if(h=t.memoizedState,a===null)if(h===null)if(t.stateNode===null){e:{h=t.type,a=t.memoizedProps,w=w.ownerDocument||w;t:switch(h){case"title":E=w.getElementsByTagName("title")[0],(!E||E[zs]||E[Qt]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=w.createElement(h),w.head.insertBefore(E,w.querySelector("head > title"))),nn(E,h,a),E[Qt]=t,Yt(E),h=E;break e;case"link":var R=$g("link","href",w).get(h+(a.href||""));if(R){for(var G=0;G<R.length;G++)if(E=R[G],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){R.splice(G,1);break t}}E=w.createElement(h),nn(E,h,a),w.head.appendChild(E);break;case"meta":if(R=$g("meta","content",w).get(h+(a.content||""))){for(G=0;G<R.length;G++)if(E=R[G],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){R.splice(G,1);break t}}E=w.createElement(h),nn(E,h,a),w.head.appendChild(E);break;default:throw Error(s(468,h))}E[Qt]=t,Yt(E),h=E}t.stateNode=h}else qg(w,t.type,t.stateNode);else t.stateNode=Ug(w,h,t.memoizedProps);else E!==h?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,h===null?qg(w,t.type,t.stateNode):Ug(w,h,t.memoizedProps)):h===null&&t.stateNode!==null&&Du(t,t.memoizedProps,a.memoizedProps)}break;case 27:gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),a!==null&&h&4&&Du(t,t.memoizedProps,a.memoizedProps);break;case 5:if(gn(n,t),xn(t),h&512&&(zt||a===null||Jn(a,a.return)),t.flags&32){w=t.stateNode;try{Gi(w,"")}catch(De){ft(t,t.return,De)}}h&4&&t.stateNode!=null&&(w=t.memoizedProps,Du(t,w,a!==null?a.memoizedProps:w)),h&1024&&(Mu=!0);break;case 6:if(gn(n,t),xn(t),h&4){if(t.stateNode===null)throw Error(s(162));h=t.memoizedProps,a=t.stateNode;try{a.nodeValue=h}catch(De){ft(t,t.return,De)}}break;case 3:if(ol=null,w=Vn,Vn=sl(n.containerInfo),gn(n,t),Vn=w,xn(t),h&4&&a!==null&&a.memoizedState.isDehydrated)try{ws(n.containerInfo)}catch(De){ft(t,t.return,De)}Mu&&(Mu=!1,qm(t));break;case 4:h=Vn,Vn=sl(t.stateNode.containerInfo),gn(n,t),xn(t),Vn=h;break;case 12:gn(n,t),xn(t);break;case 31:gn(n,t),xn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 13:gn(n,t),xn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Vo=Oe()),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 22:w=t.memoizedState!==null;var J=a!==null&&a.memoizedState!==null,le=br,he=zt;if(br=le||w,zt=he||J,gn(n,t),zt=he,br=le,xn(t),h&8192)e:for(n=t.stateNode,n._visibility=w?n._visibility&-2:n._visibility|1,w&&(a===null||J||br||zt||wi(t)),a=null,n=t;;){if(n.tag===5||n.tag===26){if(a===null){J=a=n;try{if(E=J.stateNode,w)R=E.style,typeof R.setProperty=="function"?R.setProperty("display","none","important"):R.display="none";else{G=J.stateNode;var xe=J.memoizedProps.style,ce=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;G.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(De){ft(J,J.return,De)}}}else if(n.tag===6){if(a===null){J=n;try{J.stateNode.nodeValue=w?"":J.memoizedProps}catch(De){ft(J,J.return,De)}}}else if(n.tag===18){if(a===null){J=n;try{var de=J.stateNode;w?Rg(de,!0):Rg(J.stateNode,!1)}catch(De){ft(J,J.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}h&4&&(h=t.updateQueue,h!==null&&(a=h.retryQueue,a!==null&&(h.retryQueue=null,Wo(t,a))));break;case 19:gn(n,t),xn(t),h&4&&(h=t.updateQueue,h!==null&&(t.updateQueue=null,Wo(t,h)));break;case 30:break;case 21:break;default:gn(n,t),xn(t)}}function xn(t){var n=t.flags;if(n&2){try{for(var a,h=t.return;h!==null;){if(Om(h)){a=h;break}h=h.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var w=a.stateNode,E=Lu(t);qo(t,E,w);break;case 5:var R=a.stateNode;a.flags&32&&(Gi(R,""),a.flags&=-33);var G=Lu(t);qo(t,G,R);break;case 3:case 4:var J=a.stateNode.containerInfo,le=Lu(t);Ru(t,le,J);break;default:throw Error(s(161))}}catch(he){ft(t,t.return,he)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function qm(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;qm(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function _r(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)zm(t,n.alternate,n),n=n.sibling}function wi(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Fr(4,n,n.return),wi(n);break;case 1:Jn(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Rm(n,n.return,a),wi(n);break;case 27:ya(n.stateNode);case 26:case 5:Jn(n,n.return),wi(n);break;case 22:n.memoizedState===null&&wi(n);break;case 30:wi(n);break;default:wi(n)}t=t.sibling}}function Sr(t,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var h=n.alternate,w=t,E=n,R=E.flags;switch(E.tag){case 0:case 11:case 15:Sr(w,E,a),ua(4,E);break;case 1:if(Sr(w,E,a),h=E,w=h.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(le){ft(h,h.return,le)}if(h=E,w=h.updateQueue,w!==null){var G=h.stateNode;try{var J=w.shared.hiddenCallbacks;if(J!==null)for(w.shared.hiddenCallbacks=null,w=0;w<J.length;w++)_p(J[w],G)}catch(le){ft(h,h.return,le)}}a&&R&64&&Lm(E),da(E,E.return);break;case 27:Bm(E);case 26:case 5:Sr(w,E,a),a&&h===null&&R&4&&Mm(E),da(E,E.return);break;case 12:Sr(w,E,a);break;case 31:Sr(w,E,a),a&&R&4&&Fm(w,E);break;case 13:Sr(w,E,a),a&&R&4&&Um(w,E);break;case 22:E.memoizedState===null&&Sr(w,E,a),da(E,E.return);break;case 30:break;default:Sr(w,E,a)}n=n.sibling}}function Ou(t,n){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&Zs(a))}function Bu(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t))}function Yn(t,n,a,h){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Wm(t,n,a,h),n=n.sibling}function Wm(t,n,a,h){var w=n.flags;switch(n.tag){case 0:case 11:case 15:Yn(t,n,a,h),w&2048&&ua(9,n);break;case 1:Yn(t,n,a,h);break;case 3:Yn(t,n,a,h),w&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Zs(t)));break;case 12:if(w&2048){Yn(t,n,a,h),t=n.stateNode;try{var E=n.memoizedProps,R=E.id,G=E.onPostCommit;typeof G=="function"&&G(R,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(J){ft(n,n.return,J)}}else Yn(t,n,a,h);break;case 31:Yn(t,n,a,h);break;case 13:Yn(t,n,a,h);break;case 23:break;case 22:E=n.stateNode,R=n.alternate,n.memoizedState!==null?E._visibility&2?Yn(t,n,a,h):ha(t,n):E._visibility&2?Yn(t,n,a,h):(E._visibility|=2,hs(t,n,a,h,(n.subtreeFlags&10256)!==0||!1)),w&2048&&Ou(R,n);break;case 24:Yn(t,n,a,h),w&2048&&Bu(n.alternate,n);break;default:Yn(t,n,a,h)}}function hs(t,n,a,h,w){for(w=w&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var E=t,R=n,G=a,J=h,le=R.flags;switch(R.tag){case 0:case 11:case 15:hs(E,R,G,J,w),ua(8,R);break;case 23:break;case 22:var he=R.stateNode;R.memoizedState!==null?he._visibility&2?hs(E,R,G,J,w):ha(E,R):(he._visibility|=2,hs(E,R,G,J,w)),w&&le&2048&&Ou(R.alternate,R);break;case 24:hs(E,R,G,J,w),w&&le&2048&&Bu(R.alternate,R);break;default:hs(E,R,G,J,w)}n=n.sibling}}function ha(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=t,h=n,w=h.flags;switch(h.tag){case 22:ha(a,h),w&2048&&Ou(h.alternate,h);break;case 24:ha(a,h),w&2048&&Bu(h.alternate,h);break;default:ha(a,h)}n=n.sibling}}var fa=8192;function fs(t,n,a){if(t.subtreeFlags&fa)for(t=t.child;t!==null;)Gm(t,n,a),t=t.sibling}function Gm(t,n,a){switch(t.tag){case 26:fs(t,n,a),t.flags&fa&&t.memoizedState!==null&&v1(a,Vn,t.memoizedState,t.memoizedProps);break;case 5:fs(t,n,a);break;case 3:case 4:var h=Vn;Vn=sl(t.stateNode.containerInfo),fs(t,n,a),Vn=h;break;case 22:t.memoizedState===null&&(h=t.alternate,h!==null&&h.memoizedState!==null?(h=fa,fa=16777216,fs(t,n,a),fa=h):fs(t,n,a));break;default:fs(t,n,a)}}function Vm(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function pa(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Kt=h,Km(h,t)}Vm(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Ym(t),t=t.sibling}function Ym(t){switch(t.tag){case 0:case 11:case 15:pa(t),t.flags&2048&&Fr(9,t,t.return);break;case 3:pa(t);break;case 12:pa(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,Go(t)):pa(t);break;default:pa(t)}}function Go(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var h=n[a];Kt=h,Km(h,t)}Vm(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Fr(8,n,n.return),Go(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Go(n));break;default:Go(n)}t=t.sibling}}function Km(t,n){for(;Kt!==null;){var a=Kt;switch(a.tag){case 0:case 11:case 15:Fr(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var h=a.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Zs(a.memoizedState.cache)}if(h=a.child,h!==null)h.return=a,Kt=h;else e:for(a=t;Kt!==null;){h=Kt;var w=h.sibling,E=h.return;if(Hm(h),h===a){Kt=null;break e}if(w!==null){w.return=E,Kt=w;break e}Kt=E}}}var R_={getCacheForType:function(t){var n=en(Ot),a=n.data.get(t);return a===void 0&&(a=t(),n.data.set(t,a)),a},cacheSignal:function(){return en(Ot).controller.signal}},M_=typeof WeakMap=="function"?WeakMap:Map,dt=0,vt=null,Qe=null,tt=0,ht=0,En=null,Ur=!1,ps=!1,Iu=!1,wr=0,jt=0,$r=0,Ci=0,zu=0,jn=0,ms=0,ma=null,vn=null,Hu=!1,Vo=0,Xm=0,Yo=1/0,Ko=null,qr=null,qt=0,Wr=null,gs=null,Cr=0,Pu=0,Fu=null,Zm=null,ga=0,Uu=null;function Nn(){return(dt&2)!==0&&tt!==0?tt&-tt:z.T!==null?Yu():ff()}function Qm(){if(jn===0)if((tt&536870912)===0||it){var t=ye;ye<<=1,(ye&3932160)===0&&(ye=262144),jn=t}else jn=536870912;return t=Cn.current,t!==null&&(t.flags|=32),jn}function bn(t,n,a){(t===vt&&(ht===2||ht===9)||t.cancelPendingCommit!==null)&&(xs(t,0),Gr(t,tt,jn,!1)),Hi(t,a),((dt&2)===0||t!==vt)&&(t===vt&&((dt&2)===0&&(Ci|=a),jt===4&&Gr(t,tt,jn,!1)),er(t))}function Jm(t,n,a){if((dt&6)!==0)throw Error(s(327));var h=!a&&(n&127)===0&&(n&t.expiredLanes)===0||Ue(t,n),w=h?I_(t,n):qu(t,n,!0),E=h;do{if(w===0){ps&&!h&&Gr(t,n,0,!1);break}else{if(a=t.current.alternate,E&&!O_(a)){w=qu(t,n,!1),E=!1;continue}if(w===2){if(E=n,t.errorRecoveryDisabledLanes&E)var R=0;else R=t.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){n=R;e:{var G=t;w=ma;var J=G.current.memoizedState.isDehydrated;if(J&&(xs(G,R).flags|=256),R=qu(G,R,!1),R!==2){if(Iu&&!J){G.errorRecoveryDisabledLanes|=E,Ci|=E,w=4;break e}E=vn,vn=w,E!==null&&(vn===null?vn=E:vn.push.apply(vn,E))}w=R}if(E=!1,w!==2)continue}}if(w===1){xs(t,0),Gr(t,n,0,!0);break}e:{switch(h=t,E=w,E){case 0:case 1:throw Error(s(345));case 4:if((n&4194048)!==n)break;case 6:Gr(h,n,jn,!Ur);break e;case 2:vn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((n&62914560)===n&&(w=Vo+300-Oe(),10<w)){if(Gr(h,n,jn,!Ur),rt(h,0,!0)!==0)break e;Cr=n,h.timeoutHandle=Ag(eg.bind(null,h,a,vn,Ko,Hu,n,jn,Ci,ms,Ur,E,"Throttled",-0,0),w);break e}eg(h,a,vn,Ko,Hu,n,jn,Ci,ms,Ur,E,null,-0,0)}}break}while(!0);er(t)}function eg(t,n,a,h,w,E,R,G,J,le,he,xe,ce,de){if(t.timeoutHandle=-1,xe=n.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:cr},Gm(n,E,xe);var De=(E&62914560)===E?Vo-Oe():(E&4194048)===E?Xm-Oe():0;if(De=b1(xe,De),De!==null){Cr=E,t.cancelPendingCommit=De(lg.bind(null,t,n,E,a,h,w,R,G,J,he,xe,null,ce,de)),Gr(t,E,R,!le);return}}lg(t,n,E,a,h,w,R,G,J)}function O_(t){for(var n=t;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var h=0;h<a.length;h++){var w=a[h],E=w.getSnapshot;w=w.value;try{if(!Sn(E(),w))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Gr(t,n,a,h){n&=~zu,n&=~Ci,t.suspendedLanes|=n,t.pingedLanes&=~n,h&&(t.warmLanes|=n),h=t.expirationTimes;for(var w=n;0<w;){var E=31-qe(w),R=1<<E;h[E]=-1,w&=~R}a!==0&&uf(t,a,n)}function Xo(){return(dt&6)===0?(xa(0),!1):!0}function $u(){if(Qe!==null){if(ht===0)var t=Qe.return;else t=Qe,fr=mi=null,su(t),os=null,Js=0,t=Qe;for(;t!==null;)Dm(t.alternate,t),t=t.return;Qe=null}}function xs(t,n){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,t1(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Cr=0,$u(),vt=t,Qe=a=dr(t.current,null),tt=n,ht=0,En=null,Ur=!1,ps=Ue(t,n),Iu=!1,ms=jn=zu=Ci=$r=jt=0,vn=ma=null,Hu=!1,(n&8)!==0&&(n|=n&32);var h=t.entangledLanes;if(h!==0)for(t=t.entanglements,h&=n;0<h;){var w=31-qe(h),E=1<<w;n|=t[w],h&=~E}return wr=n,xo(),a}function tg(t,n){Ke=null,z.H=oa,n===as||n===ko?(n=xp(),ht=3):n===Vc?(n=xp(),ht=4):ht=n===_u?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,En=n,Qe===null&&(jt=1,Ho(t,In(n,t.current)))}function ng(){var t=Cn.current;return t===null?!0:(tt&4194048)===tt?Fn===null:(tt&62914560)===tt||(tt&536870912)!==0?t===Fn:!1}function rg(){var t=z.H;return z.H=oa,t===null?oa:t}function ig(){var t=z.A;return z.A=R_,t}function Zo(){jt=4,Ur||(tt&4194048)!==tt&&Cn.current!==null||(ps=!0),($r&134217727)===0&&(Ci&134217727)===0||vt===null||Gr(vt,tt,jn,!1)}function qu(t,n,a){var h=dt;dt|=2;var w=rg(),E=ig();(vt!==t||tt!==n)&&(Ko=null,xs(t,n)),n=!1;var R=jt;e:do try{if(ht!==0&&Qe!==null){var G=Qe,J=En;switch(ht){case 8:$u(),R=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(n=!0);var le=ht;if(ht=0,En=null,vs(t,G,J,le),a&&ps){R=0;break e}break;default:le=ht,ht=0,En=null,vs(t,G,J,le)}}B_(),R=jt;break}catch(he){tg(t,he)}while(!0);return n&&t.shellSuspendCounter++,fr=mi=null,dt=h,z.H=w,z.A=E,Qe===null&&(vt=null,tt=0,xo()),R}function B_(){for(;Qe!==null;)sg(Qe)}function I_(t,n){var a=dt;dt|=2;var h=rg(),w=ig();vt!==t||tt!==n?(Ko=null,Yo=Oe()+500,xs(t,n)):ps=Ue(t,n);e:do try{if(ht!==0&&Qe!==null){n=Qe;var E=En;t:switch(ht){case 1:ht=0,En=null,vs(t,n,E,1);break;case 2:case 9:if(mp(E)){ht=0,En=null,ag(n);break}n=function(){ht!==2&&ht!==9||vt!==t||(ht=7),er(t)},E.then(n,n);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:mp(E)?(ht=0,En=null,ag(n)):(ht=0,En=null,vs(t,n,E,7));break;case 5:var R=null;switch(Qe.tag){case 26:R=Qe.memoizedState;case 5:case 27:var G=Qe;if(R?Wg(R):G.stateNode.complete){ht=0,En=null;var J=G.sibling;if(J!==null)Qe=J;else{var le=G.return;le!==null?(Qe=le,Qo(le)):Qe=null}break t}}ht=0,En=null,vs(t,n,E,5);break;case 6:ht=0,En=null,vs(t,n,E,6);break;case 8:$u(),jt=6;break e;default:throw Error(s(462))}}z_();break}catch(he){tg(t,he)}while(!0);return fr=mi=null,z.H=h,z.A=w,dt=a,Qe!==null?0:(vt=null,tt=0,xo(),jt)}function z_(){for(;Qe!==null&&!pe();)sg(Qe)}function sg(t){var n=Tm(t.alternate,t,wr);t.memoizedProps=t.pendingProps,n===null?Qo(t):Qe=n}function ag(t){var n=t,a=n.alternate;switch(n.tag){case 15:case 0:n=wm(a,n,n.pendingProps,n.type,void 0,tt);break;case 11:n=wm(a,n,n.pendingProps,n.type.render,n.ref,tt);break;case 5:su(n);default:Dm(a,n),n=Qe=ip(n,wr),n=Tm(a,n,wr)}t.memoizedProps=t.pendingProps,n===null?Qo(t):Qe=n}function vs(t,n,a,h){fr=mi=null,su(n),os=null,Js=0;var w=n.return;try{if(E_(t,w,n,a,tt)){jt=1,Ho(t,In(a,t.current)),Qe=null;return}}catch(E){if(w!==null)throw Qe=w,E;jt=1,Ho(t,In(a,t.current)),Qe=null;return}n.flags&32768?(it||h===1?t=!0:ps||(tt&536870912)!==0?t=!1:(Ur=t=!0,(h===2||h===9||h===3||h===6)&&(h=Cn.current,h!==null&&h.tag===13&&(h.flags|=16384))),og(n,t)):Qo(n)}function Qo(t){var n=t;do{if((n.flags&32768)!==0){og(n,Ur);return}t=n.return;var a=T_(n.alternate,n,wr);if(a!==null){Qe=a;return}if(n=n.sibling,n!==null){Qe=n;return}Qe=n=t}while(n!==null);jt===0&&(jt=5)}function og(t,n){do{var a=A_(t.alternate,t);if(a!==null){a.flags&=32767,Qe=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(t=t.sibling,t!==null)){Qe=t;return}Qe=t=a}while(t!==null);jt=6,Qe=null}function lg(t,n,a,h,w,E,R,G,J){t.cancelPendingCommit=null;do Jo();while(qt!==0);if((dt&6)!==0)throw Error(s(327));if(n!==null){if(n===t.current)throw Error(s(177));if(E=n.lanes|n.childLanes,E|=Lc,ac(t,a,E,R,G,J),t===vt&&(Qe=vt=null,tt=0),gs=n,Wr=t,Cr=a,Pu=E,Fu=w,Zm=h,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,U_(Te,function(){return fg(),null})):(t.callbackNode=null,t.callbackPriority=0),h=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||h){h=z.T,z.T=null,w=X.p,X.p=2,R=dt,dt|=4;try{D_(t,n,a)}finally{dt=R,X.p=w,z.T=h}}qt=1,cg(),ug(),dg()}}function cg(){if(qt===1){qt=0;var t=Wr,n=gs,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{$m(n,t);var E=nd,R=Kf(t.containerInfo),G=E.focusedElem,J=E.selectionRange;if(R!==G&&G&&G.ownerDocument&&Yf(G.ownerDocument.documentElement,G)){if(J!==null&&jc(G)){var le=J.start,he=J.end;if(he===void 0&&(he=le),"selectionStart"in G)G.selectionStart=le,G.selectionEnd=Math.min(he,G.value.length);else{var xe=G.ownerDocument||document,ce=xe&&xe.defaultView||window;if(ce.getSelection){var de=ce.getSelection(),De=G.textContent.length,Pe=Math.min(J.start,De),xt=J.end===void 0?Pe:Math.min(J.end,De);!de.extend&&Pe>xt&&(R=xt,xt=Pe,Pe=R);var ie=Vf(G,Pe),te=Vf(G,xt);if(ie&&te&&(de.rangeCount!==1||de.anchorNode!==ie.node||de.anchorOffset!==ie.offset||de.focusNode!==te.node||de.focusOffset!==te.offset)){var oe=xe.createRange();oe.setStart(ie.node,ie.offset),de.removeAllRanges(),Pe>xt?(de.addRange(oe),de.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),de.addRange(oe))}}}}for(xe=[],de=G;de=de.parentNode;)de.nodeType===1&&xe.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<xe.length;G++){var me=xe[G];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}dl=!!td,nd=td=null}finally{dt=w,X.p=h,z.T=a}}t.current=n,qt=2}}function ug(){if(qt===2){qt=0;var t=Wr,n=gs,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var h=X.p;X.p=2;var w=dt;dt|=4;try{zm(t,n.alternate,n)}finally{dt=w,X.p=h,z.T=a}}qt=3}}function dg(){if(qt===4||qt===3){qt=0,Ne();var t=Wr,n=gs,a=Cr,h=Zm;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?qt=5:(qt=0,gs=Wr=null,hg(t,t.pendingLanes));var w=t.pendingLanes;if(w===0&&(qr=null),lc(a),n=n.stateNode,$e&&typeof $e.onCommitFiberRoot=="function")try{$e.onCommitFiberRoot(Le,n,void 0,(n.current.flags&128)===128)}catch{}if(h!==null){n=z.T,w=X.p,X.p=2,z.T=null;try{for(var E=t.onRecoverableError,R=0;R<h.length;R++){var G=h[R];E(G.value,{componentStack:G.stack})}}finally{z.T=n,X.p=w}}(Cr&3)!==0&&Jo(),er(t),w=t.pendingLanes,(a&261930)!==0&&(w&42)!==0?t===Uu?ga++:(ga=0,Uu=t):ga=0,xa(0)}}function hg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Zs(n)))}function Jo(){return cg(),ug(),dg(),fg()}function fg(){if(qt!==5)return!1;var t=Wr,n=Pu;Pu=0;var a=lc(Cr),h=z.T,w=X.p;try{X.p=32>a?32:a,z.T=null,a=Fu,Fu=null;var E=Wr,R=Cr;if(qt=0,gs=Wr=null,Cr=0,(dt&6)!==0)throw Error(s(331));var G=dt;if(dt|=4,Ym(E.current),Wm(E,E.current,R,a),dt=G,xa(0,!1),$e&&typeof $e.onPostCommitFiberRoot=="function")try{$e.onPostCommitFiberRoot(Le,E)}catch{}return!0}finally{X.p=w,z.T=h,hg(t,n)}}function pg(t,n,a){n=In(a,n),n=yu(t.stateNode,n,2),t=zr(t,n,2),t!==null&&(Hi(t,2),er(t))}function ft(t,n,a){if(t.tag===3)pg(t,t,a);else for(;n!==null;){if(n.tag===3){pg(n,t,a);break}else if(n.tag===1){var h=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(qr===null||!qr.has(h))){t=In(a,t),a=mm(2),h=zr(n,a,2),h!==null&&(gm(a,h,n,t),Hi(h,2),er(h));break}}n=n.return}}function Wu(t,n,a){var h=t.pingCache;if(h===null){h=t.pingCache=new M_;var w=new Set;h.set(n,w)}else w=h.get(n),w===void 0&&(w=new Set,h.set(n,w));w.has(a)||(Iu=!0,w.add(a),t=H_.bind(null,t,n,a),n.then(t,t))}function H_(t,n,a){var h=t.pingCache;h!==null&&h.delete(n),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,vt===t&&(tt&a)===a&&(jt===4||jt===3&&(tt&62914560)===tt&&300>Oe()-Vo?(dt&2)===0&&xs(t,0):zu|=a,ms===tt&&(ms=0)),er(t)}function mg(t,n){n===0&&(n=Mt()),t=hi(t,n),t!==null&&(Hi(t,n),er(t))}function P_(t){var n=t.memoizedState,a=0;n!==null&&(a=n.retryLane),mg(t,a)}function F_(t,n){var a=0;switch(t.tag){case 31:case 13:var h=t.stateNode,w=t.memoizedState;w!==null&&(a=w.retryLane);break;case 19:h=t.stateNode;break;case 22:h=t.stateNode._retryCache;break;default:throw Error(s(314))}h!==null&&h.delete(n),mg(t,a)}function U_(t,n){return We(t,n)}var el=null,bs=null,Gu=!1,tl=!1,Vu=!1,Vr=0;function er(t){t!==bs&&t.next===null&&(bs===null?el=bs=t:bs=bs.next=t),tl=!0,Gu||(Gu=!0,q_())}function xa(t,n){if(!Vu&&tl){Vu=!0;do for(var a=!1,h=el;h!==null;){if(t!==0){var w=h.pendingLanes;if(w===0)var E=0;else{var R=h.suspendedLanes,G=h.pingedLanes;E=(1<<31-qe(42|t)+1)-1,E&=w&~(R&~G),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,bg(h,E))}else E=tt,E=rt(h,h===vt?E:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(E&3)===0||Ue(h,E)||(a=!0,bg(h,E));h=h.next}while(a);Vu=!1}}function $_(){gg()}function gg(){tl=Gu=!1;var t=0;Vr!==0&&e1()&&(t=Vr);for(var n=Oe(),a=null,h=el;h!==null;){var w=h.next,E=xg(h,n);E===0?(h.next=null,a===null?el=w:a.next=w,w===null&&(bs=a)):(a=h,(t!==0||(E&3)!==0)&&(tl=!0)),h=w}qt!==0&&qt!==5||xa(t),Vr!==0&&(Vr=0)}function xg(t,n){for(var a=t.suspendedLanes,h=t.pingedLanes,w=t.expirationTimes,E=t.pendingLanes&-62914561;0<E;){var R=31-qe(E),G=1<<R,J=w[R];J===-1?((G&a)===0||(G&h)!==0)&&(w[R]=Zt(G,n)):J<=n&&(t.expiredLanes|=G),E&=~G}if(n=vt,a=tt,a=rt(t,t===n?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h=t.callbackNode,a===0||t===n&&(ht===2||ht===9)||t.cancelPendingCommit!==null)return h!==null&&h!==null&&Lt(h),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Ue(t,a)){if(n=a&-a,n===t.callbackPriority)return n;switch(h!==null&&Lt(h),lc(a)){case 2:case 8:a=_e;break;case 32:a=Te;break;case 268435456:a=Ve;break;default:a=Te}return h=vg.bind(null,t),a=We(a,h),t.callbackPriority=n,t.callbackNode=a,n}return h!==null&&h!==null&&Lt(h),t.callbackPriority=2,t.callbackNode=null,2}function vg(t,n){if(qt!==0&&qt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(Jo()&&t.callbackNode!==a)return null;var h=tt;return h=rt(t,t===vt?h:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),h===0?null:(Jm(t,h,n),xg(t,Oe()),t.callbackNode!=null&&t.callbackNode===a?vg.bind(null,t):null)}function bg(t,n){if(Jo())return null;Jm(t,n,!0)}function q_(){n1(function(){(dt&6)!==0?We(ue,$_):gg()})}function Yu(){if(Vr===0){var t=is;t===0&&(t=fe,fe<<=1,(fe&261888)===0&&(fe=256)),Vr=t}return Vr}function yg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:lo(""+t)}function _g(t,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,t.id&&a.setAttribute("form",t.id),n.parentNode.insertBefore(a,n),t=new FormData(t),a.parentNode.removeChild(a),t}function W_(t,n,a,h,w){if(n==="submit"&&a&&a.stateNode===w){var E=yg((w[fn]||null).action),R=h.submitter;R&&(n=(n=R[fn]||null)?yg(n.formAction):R.getAttribute("formAction"),n!==null&&(E=n,R=null));var G=new fo("action","action",null,h,w);t.push({event:G,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Vr!==0){var J=R?_g(w,R):new FormData(w);pu(a,{pending:!0,data:J,method:w.method,action:E},null,J)}}else typeof E=="function"&&(G.preventDefault(),J=R?_g(w,R):new FormData(w),pu(a,{pending:!0,data:J,method:w.method,action:E},E,J))},currentTarget:w}]})}}for(var Ku=0;Ku<Dc.length;Ku++){var Xu=Dc[Ku],G_=Xu.toLowerCase(),V_=Xu[0].toUpperCase()+Xu.slice(1);Gn(G_,"on"+V_)}Gn(Qf,"onAnimationEnd"),Gn(Jf,"onAnimationIteration"),Gn(ep,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(c_,"onTransitionRun"),Gn(u_,"onTransitionStart"),Gn(d_,"onTransitionCancel"),Gn(tp,"onTransitionEnd"),qi("onMouseEnter",["mouseout","mouseover"]),qi("onMouseLeave",["mouseout","mouseover"]),qi("onPointerEnter",["pointerout","pointerover"]),qi("onPointerLeave",["pointerout","pointerover"]),li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),li("onBeforeInput",["compositionend","keypress","textInput","paste"]),li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var va="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(" "),Y_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(va));function Sg(t,n){n=(n&4)!==0;for(var a=0;a<t.length;a++){var h=t[a],w=h.event;h=h.listeners;e:{var E=void 0;if(n)for(var R=h.length-1;0<=R;R--){var G=h[R],J=G.instance,le=G.currentTarget;if(G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){go(he)}w.currentTarget=null,E=J}else for(R=0;R<h.length;R++){if(G=h[R],J=G.instance,le=G.currentTarget,G=G.listener,J!==E&&w.isPropagationStopped())break e;E=G,w.currentTarget=le;try{E(w)}catch(he){go(he)}w.currentTarget=null,E=J}}}}function Je(t,n){var a=n[cc];a===void 0&&(a=n[cc]=new Set);var h=t+"__bubble";a.has(h)||(wg(n,t,2,!1),a.add(h))}function Zu(t,n,a){var h=0;n&&(h|=4),wg(a,t,h,n)}var nl="_reactListening"+Math.random().toString(36).slice(2);function Qu(t){if(!t[nl]){t[nl]=!0,gf.forEach(function(a){a!=="selectionchange"&&(Y_.has(a)||Zu(a,!1,t),Zu(a,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[nl]||(n[nl]=!0,Zu("selectionchange",!1,n))}}function wg(t,n,a,h){switch(Qg(n)){case 2:var w=S1;break;case 8:w=w1;break;default:w=fd}a=w.bind(null,n,a,t),w=void 0,!vc||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(w=!0),h?w!==void 0?t.addEventListener(n,a,{capture:!0,passive:w}):t.addEventListener(n,a,!0):w!==void 0?t.addEventListener(n,a,{passive:w}):t.addEventListener(n,a,!1)}function Ju(t,n,a,h,w){var E=h;if((n&1)===0&&(n&2)===0&&h!==null)e:for(;;){if(h===null)return;var R=h.tag;if(R===3||R===4){var G=h.stateNode.containerInfo;if(G===w)break;if(R===4)for(R=h.return;R!==null;){var J=R.tag;if((J===3||J===4)&&R.stateNode.containerInfo===w)return;R=R.return}for(;G!==null;){if(R=Fi(G),R===null)return;if(J=R.tag,J===5||J===6||J===26||J===27){h=E=R;continue e}G=G.parentNode}}h=h.return}Nf(function(){var le=E,he=gc(a),xe=[];e:{var ce=np.get(t);if(ce!==void 0){var de=fo,De=t;switch(t){case"keypress":if(uo(a)===0)break e;case"keydown":case"keyup":de=F0;break;case"focusin":De="focus",de=Sc;break;case"focusout":De="blur",de=Sc;break;case"beforeblur":case"afterblur":de=Sc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=T0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=q0;break;case Qf:case Jf:case ep:de=L0;break;case tp:de=G0;break;case"scroll":case"scrollend":de=j0;break;case"wheel":de=Y0;break;case"copy":case"cut":case"paste":de=M0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=Rf;break;case"toggle":case"beforetoggle":de=X0}var Pe=(n&4)!==0,xt=!Pe&&(t==="scroll"||t==="scrollend"),ie=Pe?ce!==null?ce+"Capture":null:ce;Pe=[];for(var te=le,oe;te!==null;){var me=te;if(oe=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||oe===null||ie===null||(me=Ps(te,ie),me!=null&&Pe.push(ba(te,me,oe))),xt)break;te=te.return}0<Pe.length&&(ce=new de(ce,De,null,a,he),xe.push({event:ce,listeners:Pe}))}}if((n&7)===0){e:{if(ce=t==="mouseover"||t==="pointerover",de=t==="mouseout"||t==="pointerout",ce&&a!==mc&&(De=a.relatedTarget||a.fromElement)&&(Fi(De)||De[Pi]))break e;if((de||ce)&&(ce=he.window===he?he:(ce=he.ownerDocument)?ce.defaultView||ce.parentWindow:window,de?(De=a.relatedTarget||a.toElement,de=le,De=De?Fi(De):null,De!==null&&(xt=u(De),Pe=De.tag,De!==xt||Pe!==5&&Pe!==27&&Pe!==6)&&(De=null)):(de=null,De=le),de!==De)){if(Pe=Df,me="onMouseLeave",ie="onMouseEnter",te="mouse",(t==="pointerout"||t==="pointerover")&&(Pe=Rf,me="onPointerLeave",ie="onPointerEnter",te="pointer"),xt=de==null?ce:Hs(de),oe=De==null?ce:Hs(De),ce=new Pe(me,te+"leave",de,a,he),ce.target=xt,ce.relatedTarget=oe,me=null,Fi(he)===le&&(Pe=new Pe(ie,te+"enter",De,a,he),Pe.target=oe,Pe.relatedTarget=xt,me=Pe),xt=me,de&&De)t:{for(Pe=K_,ie=de,te=De,oe=0,me=ie;me;me=Pe(me))oe++;me=0;for(var ze=te;ze;ze=Pe(ze))me++;for(;0<oe-me;)ie=Pe(ie),oe--;for(;0<me-oe;)te=Pe(te),me--;for(;oe--;){if(ie===te||te!==null&&ie===te.alternate){Pe=ie;break t}ie=Pe(ie),te=Pe(te)}Pe=null}else Pe=null;de!==null&&Cg(xe,ce,de,Pe,!1),De!==null&&xt!==null&&Cg(xe,xt,De,Pe,!0)}}e:{if(ce=le?Hs(le):window,de=ce.nodeName&&ce.nodeName.toLowerCase(),de==="select"||de==="input"&&ce.type==="file")var ct=Ff;else if(Hf(ce))if(Uf)ct=a_;else{ct=i_;var Re=r_}else de=ce.nodeName,!de||de.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&pc(le.elementType)&&(ct=Ff):ct=s_;if(ct&&(ct=ct(t,le))){Pf(xe,ct,a,he);break e}Re&&Re(t,ce,le),t==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&fc(ce,"number",ce.value)}switch(Re=le?Hs(le):window,t){case"focusin":(Hf(Re)||Re.contentEditable==="true")&&(Xi=Re,Nc=le,Ys=null);break;case"focusout":Ys=Nc=Xi=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,Xf(xe,a,he);break;case"selectionchange":if(l_)break;case"keydown":case"keyup":Xf(xe,a,he)}var Xe;if(Cc)e:{switch(t){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Ki?If(t,a)&&(nt="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(nt="onCompositionStart");nt&&(Mf&&a.locale!=="ko"&&(Ki||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Ki&&(Xe=Tf()):(Dr=he,bc="value"in Dr?Dr.value:Dr.textContent,Ki=!0)),Re=rl(le,nt),0<Re.length&&(nt=new Lf(nt,t,null,a,he),xe.push({event:nt,listeners:Re}),Xe?nt.data=Xe:(Xe=zf(a),Xe!==null&&(nt.data=Xe)))),(Xe=Q0?J0(t,a):e_(t,a))&&(nt=rl(le,"onBeforeInput"),0<nt.length&&(Re=new Lf("onBeforeInput","beforeinput",null,a,he),xe.push({event:Re,listeners:nt}),Re.data=Xe)),W_(xe,t,le,a,he)}Sg(xe,n)})}function ba(t,n,a){return{instance:t,listener:n,currentTarget:a}}function rl(t,n){for(var a=n+"Capture",h=[];t!==null;){var w=t,E=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||E===null||(w=Ps(t,a),w!=null&&h.unshift(ba(t,w,E)),w=Ps(t,n),w!=null&&h.push(ba(t,w,E))),t.tag===3)return h;t=t.return}return[]}function K_(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Cg(t,n,a,h,w){for(var E=n._reactName,R=[];a!==null&&a!==h;){var G=a,J=G.alternate,le=G.stateNode;if(G=G.tag,J!==null&&J===h)break;G!==5&&G!==26&&G!==27||le===null||(J=le,w?(le=Ps(a,E),le!=null&&R.unshift(ba(a,le,J))):w||(le=Ps(a,E),le!=null&&R.push(ba(a,le,J)))),a=a.return}R.length!==0&&t.push({event:n,listeners:R})}var X_=/\r\n?/g,Z_=/\u0000|\uFFFD/g;function kg(t){return(typeof t=="string"?t:""+t).replace(X_,`
|
|
49
49
|
`).replace(Z_,"")}function Eg(t,n){return n=kg(n),kg(t)===n}function gt(t,n,a,h,w,E){switch(a){case"children":typeof h=="string"?n==="body"||n==="textarea"&&h===""||Gi(t,h):(typeof h=="number"||typeof h=="bigint")&&n!=="body"&&Gi(t,""+h);break;case"className":ao(t,"class",h);break;case"tabIndex":ao(t,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":ao(t,a,h);break;case"style":Ef(t,h,E);break;case"data":if(n!=="object"){ao(t,"data",h);break}case"src":case"href":if(h===""&&(n!=="a"||a!=="href")){t.removeAttribute(a);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=lo(""+h),t.setAttribute(a,h);break;case"action":case"formAction":if(typeof h=="function"){t.setAttribute(a,"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 E=="function"&&(a==="formAction"?(n!=="input"&>(t,n,"name",w.name,w,null),gt(t,n,"formEncType",w.formEncType,w,null),gt(t,n,"formMethod",w.formMethod,w,null),gt(t,n,"formTarget",w.formTarget,w,null)):(gt(t,n,"encType",w.encType,w,null),gt(t,n,"method",w.method,w,null),gt(t,n,"target",w.target,w,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){t.removeAttribute(a);break}h=lo(""+h),t.setAttribute(a,h);break;case"onClick":h!=null&&(t.onclick=cr);break;case"onScroll":h!=null&&Je("scroll",t);break;case"onScrollEnd":h!=null&&Je("scrollend",t);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"multiple":t.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":t.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){t.removeAttribute("xlink:href");break}a=lo(""+h),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""+h):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":h===!0?t.setAttribute(a,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?t.setAttribute(a,h):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?t.setAttribute(a,h):t.removeAttribute(a);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?t.removeAttribute(a):t.setAttribute(a,h);break;case"popover":Je("beforetoggle",t),Je("toggle",t),so(t,"popover",h);break;case"xlinkActuate":lr(t,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":lr(t,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":lr(t,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":lr(t,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":lr(t,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":lr(t,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":lr(t,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":lr(t,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":lr(t,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":so(t,"is",h);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=k0.get(a)||a,so(t,a,h))}}function ed(t,n,a,h,w,E){switch(a){case"style":Ef(t,h,E);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(s(61));if(a=h.__html,a!=null){if(w.children!=null)throw Error(s(60));t.innerHTML=a}}break;case"children":typeof h=="string"?Gi(t,h):(typeof h=="number"||typeof h=="bigint")&&Gi(t,""+h);break;case"onScroll":h!=null&&Je("scroll",t);break;case"onScrollEnd":h!=null&&Je("scrollend",t);break;case"onClick":h!=null&&(t.onclick=cr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xf.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(w=a.endsWith("Capture"),n=a.slice(2,w?a.length-7:void 0),E=t[fn]||null,E=E!=null?E[a]:null,typeof E=="function"&&t.removeEventListener(n,E,w),typeof h=="function")){typeof E!="function"&&E!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(n,h,w);break e}a in t?t[a]=h:h===!0?t.setAttribute(a,""):so(t,a,h)}}}function nn(t,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",t),Je("load",t);var h=!1,w=!1,E;for(E in a)if(a.hasOwnProperty(E)){var R=a[E];if(R!=null)switch(E){case"src":h=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,E,R,a,null)}}w&>(t,n,"srcSet",a.srcSet,a,null),h&>(t,n,"src",a.src,a,null);return;case"input":Je("invalid",t);var G=E=R=w=null,J=null,le=null;for(h in a)if(a.hasOwnProperty(h)){var he=a[h];if(he!=null)switch(h){case"name":w=he;break;case"type":R=he;break;case"checked":J=he;break;case"defaultChecked":le=he;break;case"value":E=he;break;case"defaultValue":G=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,n));break;default:gt(t,n,h,he,a,null)}}Sf(t,E,G,J,le,R,w,!1);return;case"select":Je("invalid",t),h=R=E=null;for(w in a)if(a.hasOwnProperty(w)&&(G=a[w],G!=null))switch(w){case"value":E=G;break;case"defaultValue":R=G;break;case"multiple":h=G;default:gt(t,n,w,G,a,null)}n=E,a=R,t.multiple=!!h,n!=null?Wi(t,!!h,n,!1):a!=null&&Wi(t,!!h,a,!0);return;case"textarea":Je("invalid",t),E=w=h=null;for(R in a)if(a.hasOwnProperty(R)&&(G=a[R],G!=null))switch(R){case"value":h=G;break;case"defaultValue":w=G;break;case"children":E=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:gt(t,n,R,G,a,null)}Cf(t,h,w,E);return;case"option":for(J in a)if(a.hasOwnProperty(J)&&(h=a[J],h!=null))switch(J){case"selected":t.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:gt(t,n,J,h,a,null)}return;case"dialog":Je("beforetoggle",t),Je("toggle",t),Je("cancel",t),Je("close",t);break;case"iframe":case"object":Je("load",t);break;case"video":case"audio":for(h=0;h<va.length;h++)Je(va[h],t);break;case"image":Je("error",t),Je("load",t);break;case"details":Je("toggle",t);break;case"embed":case"source":case"link":Je("error",t),Je("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(le in a)if(a.hasOwnProperty(le)&&(h=a[le],h!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,n));default:gt(t,n,le,h,a,null)}return;default:if(pc(n)){for(he in a)a.hasOwnProperty(he)&&(h=a[he],h!==void 0&&ed(t,n,he,h,a,void 0));return}}for(G in a)a.hasOwnProperty(G)&&(h=a[G],h!=null&>(t,n,G,h,a,null))}function Q_(t,n,a,h){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,E=null,R=null,G=null,J=null,le=null,he=null;for(de in a){var xe=a[de];if(a.hasOwnProperty(de)&&xe!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":J=xe;default:h.hasOwnProperty(de)||gt(t,n,de,null,h,xe)}}for(var ce in h){var de=h[ce];if(xe=a[ce],h.hasOwnProperty(ce)&&(de!=null||xe!=null))switch(ce){case"type":E=de;break;case"name":w=de;break;case"checked":le=de;break;case"defaultChecked":he=de;break;case"value":R=de;break;case"defaultValue":G=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,n));break;default:de!==xe&>(t,n,ce,de,h,xe)}}hc(t,R,G,J,le,he,E,w);return;case"select":de=R=G=ce=null;for(E in a)if(J=a[E],a.hasOwnProperty(E)&&J!=null)switch(E){case"value":break;case"multiple":de=J;default:h.hasOwnProperty(E)||gt(t,n,E,null,h,J)}for(w in h)if(E=h[w],J=a[w],h.hasOwnProperty(w)&&(E!=null||J!=null))switch(w){case"value":ce=E;break;case"defaultValue":G=E;break;case"multiple":R=E;default:E!==J&>(t,n,w,E,h,J)}n=G,a=R,h=de,ce!=null?Wi(t,!!a,ce,!1):!!h!=!!a&&(n!=null?Wi(t,!!a,n,!0):Wi(t,!!a,a?[]:"",!1));return;case"textarea":de=ce=null;for(G in a)if(w=a[G],a.hasOwnProperty(G)&&w!=null&&!h.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:gt(t,n,G,null,h,w)}for(R in h)if(w=h[R],E=a[R],h.hasOwnProperty(R)&&(w!=null||E!=null))switch(R){case"value":ce=w;break;case"defaultValue":de=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==E&>(t,n,R,w,h,E)}wf(t,ce,de);return;case"option":for(var De in a)if(ce=a[De],a.hasOwnProperty(De)&&ce!=null&&!h.hasOwnProperty(De))switch(De){case"selected":t.selected=!1;break;default:gt(t,n,De,null,h,ce)}for(J in h)if(ce=h[J],de=a[J],h.hasOwnProperty(J)&&ce!==de&&(ce!=null||de!=null))switch(J){case"selected":t.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:gt(t,n,J,ce,h,de)}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 Pe in a)ce=a[Pe],a.hasOwnProperty(Pe)&&ce!=null&&!h.hasOwnProperty(Pe)&>(t,n,Pe,null,h,ce);for(le in h)if(ce=h[le],de=a[le],h.hasOwnProperty(le)&&ce!==de&&(ce!=null||de!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,n));break;default:gt(t,n,le,ce,h,de)}return;default:if(pc(n)){for(var xt in a)ce=a[xt],a.hasOwnProperty(xt)&&ce!==void 0&&!h.hasOwnProperty(xt)&&ed(t,n,xt,void 0,h,ce);for(he in h)ce=h[he],de=a[he],!h.hasOwnProperty(he)||ce===de||ce===void 0&&de===void 0||ed(t,n,he,ce,h,de);return}}for(var ie in a)ce=a[ie],a.hasOwnProperty(ie)&&ce!=null&&!h.hasOwnProperty(ie)&>(t,n,ie,null,h,ce);for(xe in h)ce=h[xe],de=a[xe],!h.hasOwnProperty(xe)||ce===de||ce==null&&de==null||gt(t,n,xe,ce,h,de)}function jg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function J_(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,a=performance.getEntriesByType("resource"),h=0;h<a.length;h++){var w=a[h],E=w.transferSize,R=w.initiatorType,G=w.duration;if(E&&G&&jg(R)){for(R=0,G=w.responseEnd,h+=1;h<a.length;h++){var J=a[h],le=J.startTime;if(le>G)break;var he=J.transferSize,xe=J.initiatorType;he&&jg(xe)&&(J=J.responseEnd,R+=he*(J<G?1:(G-le)/(J-le)))}if(--h,n+=8*(E+R)/(w.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var td=null,nd=null;function il(t){return t.nodeType===9?t:t.ownerDocument}function Ng(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Tg(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function rd(t,n){return t==="textarea"||t==="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 id=null;function e1(){var t=window.event;return t&&t.type==="popstate"?t===id?!1:(id=t,!0):(id=null,!1)}var Ag=typeof setTimeout=="function"?setTimeout:void 0,t1=typeof clearTimeout=="function"?clearTimeout:void 0,Dg=typeof Promise=="function"?Promise:void 0,n1=typeof queueMicrotask=="function"?queueMicrotask:typeof Dg<"u"?function(t){return Dg.resolve(null).then(t).catch(r1)}:Ag;function r1(t){setTimeout(function(){throw t})}function Yr(t){return t==="head"}function Lg(t,n){var a=n,h=0;do{var w=a.nextSibling;if(t.removeChild(a),w&&w.nodeType===8)if(a=w.data,a==="/$"||a==="/&"){if(h===0){t.removeChild(w),ws(n);return}h--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")h++;else if(a==="html")ya(t.ownerDocument.documentElement);else if(a==="head"){a=t.ownerDocument.head,ya(a);for(var E=a.firstChild;E;){var R=E.nextSibling,G=E.nodeName;E[zs]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=R}}else a==="body"&&ya(t.ownerDocument.body);a=w}while(a);ws(n)}function Rg(t,n){var a=t;t=0;do{var h=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),h&&h.nodeType===8)if(a=h.data,a==="/$"){if(t===0)break;t--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||t++;a=h}while(a)}function sd(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":sd(a),uc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function i1(t,n,a,h){for(;t.nodeType===1;){var w=a;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!h&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(h){if(!t[zs])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(E=t.getAttribute("rel"),E==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(E!==w.rel||t.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||t.getAttribute("title")!==(w.title==null?null:w.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(E=t.getAttribute("src"),(E!==(w.src==null?null:w.src)||t.getAttribute("type")!==(w.type==null?null:w.type)||t.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&E&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var E=w.name==null?null:""+w.name;if(w.type==="hidden"&&t.getAttribute("name")===E)return t}else return t;if(t=Un(t.nextSibling),t===null)break}return null}function s1(t,n,a){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Un(t.nextSibling),t===null))return null;return t}function Mg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Un(t.nextSibling),t===null))return null;return t}function ad(t){return t.data==="$?"||t.data==="$~"}function od(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function a1(t,n){var a=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||a.readyState!=="loading")n();else{var h=function(){n(),a.removeEventListener("DOMContentLoaded",h)};a.addEventListener("DOMContentLoaded",h),t._reactRetry=h}}function Un(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var ld=null;function Og(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="/$"||a==="/&"){if(n===0)return Un(t.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}t=t.nextSibling}return null}function Bg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return t;n--}else a!=="/$"&&a!=="/&"||n++}t=t.previousSibling}return null}function Ig(t,n,a){switch(n=il(a),t){case"html":if(t=n.documentElement,!t)throw Error(s(452));return t;case"head":if(t=n.head,!t)throw Error(s(453));return t;case"body":if(t=n.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function ya(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);uc(t)}var $n=new Map,zg=new Set;function sl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var kr=X.d;X.d={f:o1,r:l1,D:c1,C:u1,L:d1,m:h1,X:p1,S:f1,M:m1};function o1(){var t=kr.f(),n=Xo();return t||n}function l1(t){var n=Ui(t);n!==null&&n.tag===5&&n.type==="form"?tm(n):kr.r(t)}var ys=typeof document>"u"?null:document;function Hg(t,n,a){var h=ys;if(h&&typeof n=="string"&&n){var w=On(n);w='link[rel="'+t+'"][href="'+w+'"]',typeof a=="string"&&(w+='[crossorigin="'+a+'"]'),zg.has(w)||(zg.add(w),t={rel:t,crossOrigin:a,href:n},h.querySelector(w)===null&&(n=h.createElement("link"),nn(n,"link",t),Yt(n),h.head.appendChild(n)))}}function c1(t){kr.D(t),Hg("dns-prefetch",t,null)}function u1(t,n){kr.C(t,n),Hg("preconnect",t,n)}function d1(t,n,a){kr.L(t,n,a);var h=ys;if(h&&t&&n){var w='link[rel="preload"][as="'+On(n)+'"]';n==="image"&&a&&a.imageSrcSet?(w+='[imagesrcset="'+On(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(w+='[imagesizes="'+On(a.imageSizes)+'"]')):w+='[href="'+On(t)+'"]';var E=w;switch(n){case"style":E=_s(t);break;case"script":E=Ss(t)}$n.has(E)||(t=m({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:t,as:n},a),$n.set(E,t),h.querySelector(w)!==null||n==="style"&&h.querySelector(_a(E))||n==="script"&&h.querySelector(Sa(E))||(n=h.createElement("link"),nn(n,"link",t),Yt(n),h.head.appendChild(n)))}}function h1(t,n){kr.m(t,n);var a=ys;if(a&&t){var h=n&&typeof n.as=="string"?n.as:"script",w='link[rel="modulepreload"][as="'+On(h)+'"][href="'+On(t)+'"]',E=w;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Ss(t)}if(!$n.has(E)&&(t=m({rel:"modulepreload",href:t},n),$n.set(E,t),a.querySelector(w)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Sa(E)))return}h=a.createElement("link"),nn(h,"link",t),Yt(h),a.head.appendChild(h)}}}function f1(t,n,a){kr.S(t,n,a);var h=ys;if(h&&t){var w=$i(h).hoistableStyles,E=_s(t);n=n||"default";var R=w.get(E);if(!R){var G={loading:0,preload:null};if(R=h.querySelector(_a(E)))G.loading=5;else{t=m({rel:"stylesheet",href:t,"data-precedence":n},a),(a=$n.get(E))&&cd(t,a);var J=R=h.createElement("link");Yt(J),nn(J,"link",t),J._p=new Promise(function(le,he){J.onload=le,J.onerror=he}),J.addEventListener("load",function(){G.loading|=1}),J.addEventListener("error",function(){G.loading|=2}),G.loading|=4,al(R,n,h)}R={type:"stylesheet",instance:R,count:1,state:G},w.set(E,R)}}}function p1(t,n){kr.X(t,n);var a=ys;if(a&&t){var h=$i(a).hoistableScripts,w=Ss(t),E=h.get(w);E||(E=a.querySelector(Sa(w)),E||(t=m({src:t,async:!0},n),(n=$n.get(w))&&ud(t,n),E=a.createElement("script"),Yt(E),nn(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function m1(t,n){kr.M(t,n);var a=ys;if(a&&t){var h=$i(a).hoistableScripts,w=Ss(t),E=h.get(w);E||(E=a.querySelector(Sa(w)),E||(t=m({src:t,async:!0,type:"module"},n),(n=$n.get(w))&&ud(t,n),E=a.createElement("script"),Yt(E),nn(E,"link",t),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},h.set(w,E))}}function Pg(t,n,a,h){var w=(w=ee.current)?sl(w):null;if(!w)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=_s(a.href),a=$i(w).hoistableStyles,h=a.get(n),h||(h={type:"style",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=_s(a.href);var E=$i(w).hoistableStyles,R=E.get(t);if(R||(w=w.ownerDocument||w,R={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(t,R),(E=w.querySelector(_a(t)))&&!E._p&&(R.instance=E,R.state.loading=5),$n.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},$n.set(t,a),E||g1(w,t,a,R.state))),n&&h===null)throw Error(s(528,""));return R}if(n&&h!==null)throw Error(s(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ss(a),a=$i(w).hoistableScripts,h=a.get(n),h||(h={type:"script",instance:null,count:0,state:null},a.set(n,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function _s(t){return'href="'+On(t)+'"'}function _a(t){return'link[rel="stylesheet"]['+t+"]"}function Fg(t){return m({},t,{"data-precedence":t.precedence,precedence:null})}function g1(t,n,a,h){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?h.loading=1:(n=t.createElement("link"),h.preload=n,n.addEventListener("load",function(){return h.loading|=1}),n.addEventListener("error",function(){return h.loading|=2}),nn(n,"link",a),Yt(n),t.head.appendChild(n))}function Ss(t){return'[src="'+On(t)+'"]'}function Sa(t){return"script[async]"+t}function Ug(t,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var h=t.querySelector('style[data-href~="'+On(a.href)+'"]');if(h)return n.instance=h,Yt(h),h;var w=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return h=(t.ownerDocument||t).createElement("style"),Yt(h),nn(h,"style",w),al(h,a.precedence,t),n.instance=h;case"stylesheet":w=_s(a.href);var E=t.querySelector(_a(w));if(E)return n.state.loading|=4,n.instance=E,Yt(E),E;h=Fg(a),(w=$n.get(w))&&cd(h,w),E=(t.ownerDocument||t).createElement("link"),Yt(E);var R=E;return R._p=new Promise(function(G,J){R.onload=G,R.onerror=J}),nn(E,"link",h),n.state.loading|=4,al(E,a.precedence,t),n.instance=E;case"script":return E=Ss(a.src),(w=t.querySelector(Sa(E)))?(n.instance=w,Yt(w),w):(h=a,(w=$n.get(E))&&(h=m({},a),ud(h,w)),t=t.ownerDocument||t,w=t.createElement("script"),Yt(w),nn(w,"link",h),t.head.appendChild(w),n.instance=w);case"void":return null;default:throw Error(s(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(h=n.instance,n.state.loading|=4,al(h,a.precedence,t));return n.instance}function al(t,n,a){for(var h=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=h.length?h[h.length-1]:null,E=w,R=0;R<h.length;R++){var G=h[R];if(G.dataset.precedence===n)E=G;else if(E!==w)break}E?E.parentNode.insertBefore(t,E.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(t,n.firstChild))}function cd(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function ud(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var ol=null;function $g(t,n,a){if(ol===null){var h=new Map,w=ol=new Map;w.set(a,h)}else w=ol,h=w.get(a),h||(h=new Map,w.set(a,h));if(h.has(t))return h;for(h.set(t,null),a=a.getElementsByTagName(t),w=0;w<a.length;w++){var E=a[w];if(!(E[zs]||E[Qt]||t==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var R=E.getAttribute(n)||"";R=t+R;var G=h.get(R);G?G.push(E):h.set(R,[E])}}return h}function qg(t,n,a){t=t.ownerDocument||t,t.head.insertBefore(a,n==="title"?t.querySelector("head > title"):null)}function x1(t,n,a){if(a===1||n.itemProp!=null)return!1;switch(t){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 t=n.disabled,typeof n.precedence=="string"&&t==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 Wg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function v1(t,n,a,h){if(a.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var w=_s(h.href),E=n.querySelector(_a(w));if(E){n=E._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=ll.bind(t),n.then(t,t)),a.state.loading|=4,a.instance=E,Yt(E);return}E=n.ownerDocument||n,h=Fg(h),(w=$n.get(w))&&cd(h,w),E=E.createElement("link"),Yt(E);var R=E;R._p=new Promise(function(G,J){R.onload=G,R.onerror=J}),nn(E,"link",h),a.instance=E}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=ll.bind(t),n.addEventListener("load",a),n.addEventListener("error",a))}}var dd=0;function b1(t,n){return t.stylesheets&&t.count===0&&ul(t,t.stylesheets),0<t.count||0<t.imgCount?function(a){var h=setTimeout(function(){if(t.stylesheets&&ul(t,t.stylesheets),t.unsuspend){var E=t.unsuspend;t.unsuspend=null,E()}},6e4+n);0<t.imgBytes&&dd===0&&(dd=62500*J_());var w=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&ul(t,t.stylesheets),t.unsuspend)){var E=t.unsuspend;t.unsuspend=null,E()}},(t.imgBytes>dd?50:800)+n);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(h),clearTimeout(w)}}:null}function ll(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ul(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var cl=null;function ul(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,cl=new Map,n.forEach(y1,t),cl=null,ll.call(t))}function y1(t,n){if(!(n.state.loading&4)){var a=cl.get(t);if(a)var h=a.get(null);else{a=new Map,cl.set(t,a);for(var w=t.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<w.length;E++){var R=w[E];(R.nodeName==="LINK"||R.getAttribute("media")!=="not all")&&(a.set(R.dataset.precedence,R),h=R)}h&&a.set(null,h)}w=n.instance,R=w.getAttribute("data-precedence"),E=a.get(R)||h,E===h&&a.set(null,w),a.set(R,w),this.count++,h=ll.bind(this),w.addEventListener("load",h),w.addEventListener("error",h),E?E.parentNode.insertBefore(w,E.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(w,t.firstChild)),n.state.loading|=4}}var wa={$$typeof:S,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function _1(t,n,a,h,w,E,R,G,J){this.tag=1,this.containerInfo=t,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=$t(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$t(0),this.hiddenUpdates=$t(null),this.identifierPrefix=h,this.onUncaughtError=w,this.onCaughtError=E,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function Gg(t,n,a,h,w,E,R,G,J,le,he,xe){return t=new _1(t,n,a,R,J,le,he,xe,G),n=1,E===!0&&(n|=24),E=wn(3,null,null,n),t.current=E,E.stateNode=t,n=qc(),n.refCount++,t.pooledCache=n,n.refCount++,E.memoizedState={element:h,isDehydrated:a,cache:n},Yc(E),t}function Vg(t){return t?(t=Ji,t):Ji}function Yg(t,n,a,h,w,E){w=Vg(w),h.context===null?h.context=w:h.pendingContext=w,h=Ir(n),h.payload={element:a},E=E===void 0?null:E,E!==null&&(h.callback=E),a=zr(t,h,n),a!==null&&(bn(a,t,n),ta(a,t,n))}function Kg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<n?a:n}}function hd(t,n){Kg(t,n),(t=t.alternate)&&Kg(t,n)}function Xg(t){if(t.tag===13||t.tag===31){var n=hi(t,67108864);n!==null&&bn(n,t,67108864),hd(t,67108864)}}function Zg(t){if(t.tag===13||t.tag===31){var n=Nn();n=oc(n);var a=hi(t,n);a!==null&&bn(a,t,n),hd(t,n)}}var dl=!0;function S1(t,n,a,h){var w=z.T;z.T=null;var E=X.p;try{X.p=2,fd(t,n,a,h)}finally{X.p=E,z.T=w}}function w1(t,n,a,h){var w=z.T;z.T=null;var E=X.p;try{X.p=8,fd(t,n,a,h)}finally{X.p=E,z.T=w}}function fd(t,n,a,h){if(dl){var w=pd(h);if(w===null)Ju(t,n,h,hl,a),Jg(t,h);else if(k1(w,t,n,a,h))h.stopPropagation();else if(Jg(t,h),n&4&&-1<C1.indexOf(t)){for(;w!==null;){var E=Ui(w);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var R=Ye(E.pendingLanes);if(R!==0){var G=E;for(G.pendingLanes|=2,G.entangledLanes|=2;R;){var J=1<<31-qe(R);G.entanglements[1]|=J,R&=~J}er(E),(dt&6)===0&&(Yo=Oe()+500,xa(0))}}break;case 31:case 13:G=hi(E,2),G!==null&&bn(G,E,2),Xo(),hd(E,2)}if(E=pd(h),E===null&&Ju(t,n,h,hl,a),E===w)break;w=E}w!==null&&h.stopPropagation()}else Ju(t,n,h,null,a)}}function pd(t){return t=gc(t),md(t)}var hl=null;function md(t){if(hl=null,t=Fi(t),t!==null){var n=u(t);if(n===null)t=null;else{var a=n.tag;if(a===13){if(t=f(n),t!==null)return t;t=null}else if(a===31){if(t=l(n),t!==null)return t;t=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return hl=t,null}function Qg(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(lt()){case ue:return 2;case _e:return 8;case Te:case Be:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var gd=!1,Kr=null,Xr=null,Zr=null,Ca=new Map,ka=new Map,Qr=[],C1="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 Jg(t,n){switch(t){case"focusin":case"focusout":Kr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Zr=null;break;case"pointerover":case"pointerout":Ca.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ka.delete(n.pointerId)}}function Ea(t,n,a,h,w,E){return t===null||t.nativeEvent!==E?(t={blockedOn:n,domEventName:a,eventSystemFlags:h,nativeEvent:E,targetContainers:[w]},n!==null&&(n=Ui(n),n!==null&&Xg(n)),t):(t.eventSystemFlags|=h,n=t.targetContainers,w!==null&&n.indexOf(w)===-1&&n.push(w),t)}function k1(t,n,a,h,w){switch(n){case"focusin":return Kr=Ea(Kr,t,n,a,h,w),!0;case"dragenter":return Xr=Ea(Xr,t,n,a,h,w),!0;case"mouseover":return Zr=Ea(Zr,t,n,a,h,w),!0;case"pointerover":var E=w.pointerId;return Ca.set(E,Ea(Ca.get(E)||null,t,n,a,h,w)),!0;case"gotpointercapture":return E=w.pointerId,ka.set(E,Ea(ka.get(E)||null,t,n,a,h,w)),!0}return!1}function ex(t){var n=Fi(t.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=f(a),n!==null){t.blockedOn=n,pf(t.priority,function(){Zg(a)});return}}else if(n===31){if(n=l(a),n!==null){t.blockedOn=n,pf(t.priority,function(){Zg(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function fl(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var a=pd(t.nativeEvent);if(a===null){a=t.nativeEvent;var h=new a.constructor(a.type,a);mc=h,a.target.dispatchEvent(h),mc=null}else return n=Ui(a),n!==null&&Xg(n),t.blockedOn=a,!1;n.shift()}return!0}function tx(t,n,a){fl(t)&&a.delete(n)}function E1(){gd=!1,Kr!==null&&fl(Kr)&&(Kr=null),Xr!==null&&fl(Xr)&&(Xr=null),Zr!==null&&fl(Zr)&&(Zr=null),Ca.forEach(tx),ka.forEach(tx)}function pl(t,n){t.blockedOn===n&&(t.blockedOn=null,gd||(gd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,E1)))}var ml=null;function nx(t){ml!==t&&(ml=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ml===t&&(ml=null);for(var n=0;n<t.length;n+=3){var a=t[n],h=t[n+1],w=t[n+2];if(typeof h!="function"){if(md(h||a)===null)continue;break}var E=Ui(a);E!==null&&(t.splice(n,3),n-=3,pu(E,{pending:!0,data:w,method:a.method,action:h},h,w))}}))}function ws(t){function n(J){return pl(J,t)}Kr!==null&&pl(Kr,t),Xr!==null&&pl(Xr,t),Zr!==null&&pl(Zr,t),Ca.forEach(n),ka.forEach(n);for(var a=0;a<Qr.length;a++){var h=Qr[a];h.blockedOn===t&&(h.blockedOn=null)}for(;0<Qr.length&&(a=Qr[0],a.blockedOn===null);)ex(a),a.blockedOn===null&&Qr.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(h=0;h<a.length;h+=3){var w=a[h],E=a[h+1],R=w[fn]||null;if(typeof E=="function")R||nx(a);else if(R){var G=null;if(E&&E.hasAttribute("formAction")){if(w=E,R=E[fn]||null)G=R.formAction;else if(md(w)!==null)continue}else G=R.action;typeof G=="function"?a[h+1]=G:(a.splice(h,3),h-=3),nx(a)}}}function rx(){function t(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(R){return w=R})},focusReset:"manual",scroll:"manual"})}function n(){w!==null&&(w(),w=null),h||setTimeout(a,20)}function a(){if(!h&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,w=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){h=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),w!==null&&(w(),w=null)}}}function xd(t){this._internalRoot=t}gl.prototype.render=xd.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(s(409));var a=n.current,h=Nn();Yg(a,h,t,n,null,null)},gl.prototype.unmount=xd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;Yg(t.current,2,null,t,null,null),Xo(),n[Pi]=null}};function gl(t){this._internalRoot=t}gl.prototype.unstable_scheduleHydration=function(t){if(t){var n=ff();t={blockedOn:null,target:t,priority:n};for(var a=0;a<Qr.length&&n!==0&&n<Qr[a].priority;a++);Qr.splice(a,0,t),a===0&&ex(t)}};var ix=r.version;if(ix!=="19.2.4")throw Error(s(527,ix,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=p(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var j1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xl.isDisabled&&xl.supportsFiber)try{Le=xl.inject(j1),$e=xl}catch{}}return Na.createRoot=function(t,n){if(!c(t))throw Error(s(299));var a=!1,h="",w=dm,E=hm,R=fm;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(h=n.identifierPrefix),n.onUncaughtError!==void 0&&(w=n.onUncaughtError),n.onCaughtError!==void 0&&(E=n.onCaughtError),n.onRecoverableError!==void 0&&(R=n.onRecoverableError)),n=Gg(t,1,!1,null,null,a,h,null,w,E,R,rx),t[Pi]=n.current,Qu(t),new xd(n)},Na.hydrateRoot=function(t,n,a){if(!c(t))throw Error(s(299));var h=!1,w="",E=dm,R=hm,G=fm,J=null;return a!=null&&(a.unstable_strictMode===!0&&(h=!0),a.identifierPrefix!==void 0&&(w=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(R=a.onCaughtError),a.onRecoverableError!==void 0&&(G=a.onRecoverableError),a.formState!==void 0&&(J=a.formState)),n=Gg(t,1,!0,n,a??null,h,w,J,E,R,G,rx),n.context=Vg(null),a=n.current,h=Nn(),h=oc(h),w=Ir(h),w.callback=null,zr(a,w,h),a=h,n.current.lanes=a,Hi(n,a),er(n),t[Pi]=n.current,Qu(t),new gl(n)},Na.version="19.2.4",Na}var px;function P1(){if(px)return yd.exports;px=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(r){console.error(r)}}return e(),yd.exports=H1(),yd.exports}var F1=P1();const U1=Pl(F1);function $1(e,r){if(e instanceof RegExp)return{keys:!1,pattern:e};var i,s,c,u,f=[],l="",d=e.split("/");for(d[0]||d.shift();c=d.shift();)i=c[0],i==="*"?(f.push(i),l+=c[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(s=c.indexOf("?",1),u=c.indexOf(".",1),f.push(c.substring(1,~s?s:~u?u:c.length)),l+=~s&&!~u?"(?:/([^/]+?))?":"/([^/]+?)",~u&&(l+=(~s?"?":"")+"\\"+c.substring(u))):l+="/"+c;return{keys:f,pattern:new RegExp("^"+l+(r?"(?=$|/)":"/?$"),"i")}}var Cd={exports:{}},kd={};/**
|
|
50
50
|
* @license React
|
|
51
51
|
* use-sync-external-store-shim.production.js
|
|
@@ -54,7 +54,7 @@ Error generating stack: `+h.message+`
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var mx;function q1(){if(mx)return kd;mx=1;var e=Fl();function r(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function l(m,y){var _=y(),k=s({inst:{value:_,getSnapshot:y}}),C=k[0].inst,v=k[1];return u(function(){C.value=_,C.getSnapshot=y,d(C)&&v({inst:C})},[m,_,y]),c(function(){return d(C)&&v({inst:C}),m(function(){d(C)&&v({inst:C})})},[m]),f(_),_}function d(m){var y=m.getSnapshot;m=m.value;try{var _=y();return!i(m,_)}catch{return!0}}function p(m,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:l;return kd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,kd}var gx;function W1(){return gx||(gx=1,Cd.exports=q1()),Cd.exports}var G1=W1();const V1=O1.useInsertionEffect,Y1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",K1=Y1?P.useLayoutEffect:P.useEffect,X1=V1||K1,sb=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return X1(()=>{r[0]=e}),r[1]},Z1="popstate",gh="pushState",xh="replaceState",Q1="hashchange",xx=[Z1,gh,xh,Q1],J1=e=>{for(const r of xx)addEventListener(r,e);return()=>{for(const r of xx)removeEventListener(r,e)}},ab=(e,r)=>G1.useSyncExternalStore(J1,e,r),vx=()=>location.search,eS=({ssrSearch:e}={})=>ab(vx,e!=null?()=>e:vx),bx=()=>location.pathname,tS=({ssrPath:e}={})=>ab(bx,e!=null?()=>e:bx),nS=(e,{replace:r=!1,state:i=null}={})=>history[r?xh:gh](i,"",e),rS=(e={})=>[tS(e),nS],yx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[yx]>"u"){for(const e of[gh,xh]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,yx,{value:!0})}const iS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",ob=(e="")=>e==="/"?"":e,sS=(e,r)=>e[0]==="~"?e.slice(1):ob(r)+e,aS=(e="",r)=>iS(_x(ob(e)),_x(r)),_x=e=>{try{return decodeURI(e)}catch{return e}},lb={hook:rS,searchHook:eS,parser:$1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},cb=P.createContext(lb),Os=()=>P.useContext(cb),ub={},db=P.createContext(ub),oS=()=>P.useContext(db),Ul=e=>{const[r,i]=e.hook(e);return[aS(e.base,r),sb((s,c)=>e.aroundNav(i,sS(s,e.base),c))]},ar=()=>Ul(Os()),vh=(e,r,i,s)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),f=c.exec(i)||[],[l,...d]=f;return l!==void 0?[!0,(()=>{const p=u!==!1?Object.fromEntries(u.map((m,y)=>[m,d[y]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...s?[l]:[]]:[!1,null]},bh=e=>vh(Os().parser,e,ar()[0]),lS=({children:e,...r})=>{var g,m,y;const i=Os(),s=r.hook?lb:i;let c=s;const[u,f=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=f,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((y=r.hook)==null?void 0:y.searchHook);let l=P.useRef({}),d=l.current,p=d;for(let _ in s){const k=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&k!==p[_]&&(l.current=p={...p}),p[_]=k,(k!==s[_]||k!==c[_])&&(c=p)}return P.createElement(cb.Provider,{value:c,children:e})},Sx=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,cS=e=>{let r=P.useRef(ub);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,c])=>c!==i[s])?e:i},Ta=({path:e,nest:r,match:i,...s})=>{const c=Os(),[u]=Ul(c),[f,l,d]=i??vh(c.parser,e,u,r),p=cS({...oS(),...l});if(!f)return null;const g=d?P.createElement(lS,{base:d},Sx(s,p)):Sx(s,p);return P.createElement(db.Provider,{value:p,children:g})},Ln=P.forwardRef((e,r)=>{const i=Os(),[s,c]=Ul(i),{to:u="",href:f=u,onClick:l,asChild:d,children:p,className:g,replace:m,state:y,transition:_,...k}=e,C=sb(b=>{b.ctrlKey||b.metaKey||b.altKey||b.shiftKey||b.button!==0||(l==null||l(b),b.defaultPrevented||(b.preventDefault(),c(f,e)))}),v=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:v}):P.createElement("a",{...k,onClick:C,href:v,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),hb=e=>Array.isArray(e)?e.flatMap(r=>hb(r&&r.type===P.Fragment?r.props.children:r)):[e],uS=({children:e,location:r})=>{const i=Os(),[s]=Ul(i);for(const c of hb(e)){let u=0;if(P.isValidElement(c)&&(u=vh(i.parser,c.props.path,r||s,c.props.nest))[0])return P.cloneElement(c,{match:u})}return null},wx=e=>{let r;const i=new Set,s=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const y=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(_=>_(r,y))}},c=()=>r,l={setState:s,getState:c,getInitialState:()=>d,subscribe:p=>(i.add(p),()=>i.delete(p))},d=r=e(s,c,l);return l},dS=(e=>e?wx(e):wx),hS=e=>e;function fS(e,r=hS){const i=dn.useSyncExternalStore(e.subscribe,dn.useCallback(()=>r(e.getState()),[e,r]),dn.useCallback(()=>r(e.getInitialState()),[e,r]));return dn.useDebugValue(i),i}const Cx=e=>{const r=dS(e),i=s=>fS(r,s);return Object.assign(i,r),i},Wn=(e=>e?Cx(e):Cx);async function Ce(e,r={}){const i=localStorage.getItem("openfox_token"),s={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...i?{"x-session-token":i}:{}};return fetch(e,{...r,headers:s})}function pS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function fb(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}class mS{constructor(r){tr(this,"ws",null);tr(this,"handlers",new Set);tr(this,"statusHandler",null);tr(this,"baseUrl");tr(this,"isReconnecting",!1);tr(this,"connectingPromise",null);tr(this,"lastCloseCode",0);tr(this,"reconnectAttempts",0);tr(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,c)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const f=setTimeout(()=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING&&(this.ws.close(),c(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var l;clearTimeout(f),this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),s()},this.ws.onclose=l=>{var d,p,g;clearTimeout(f),this.lastCloseCode=l.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),c(new Error(`Connection closed: ${l.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=l=>{clearTimeout(f),console.error("WebSocket error:",l),this.connectingPromise=null,c(l)},this.ws.onmessage=l=>{try{const d=JSON.parse(l.data);pS(d)&&this.handlers.forEach(p=>p(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,c(u)}}),this.connectingPromise))}attemptReconnect(){var c;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(c=this.statusHandler)==null||c.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=fb(),c={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(c)),s}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const gS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Pt=new mS(gS),si=async(e,r,i)=>{try{const s=await Ce(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}};function pb(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let vl=[];const ir=Wn()((e,r)=>{function i(){if(vl.length===0)return;const c=vl;vl=[],e(u=>({logs:[...u.logs,...c]}))}const s=pb(i);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:c=>{r().workdir!==c&&(e({workdir:c,status:null,logs:[],config:null,loading:!0}),c&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server?workdir=${encodeURIComponent(c)}`)).json();e({status:f,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(c)}`)).json();e({config:f.config??null})}catch{}},fetchLogs:async()=>{const c=r().workdir;if(c)try{const l=(await(await Ce(`/api/dev-server/logs?workdir=${encodeURIComponent(c)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:l})}catch{}},start:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/start?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},stop:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/stop?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f})}catch{}},restart:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/restart?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},saveConfig:async c=>{const u=r().workdir;if(u)try{const l=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).json();e({config:l.config??c}),r().fetchStatus()}catch{}},handleMessage:c=>{const u=r().workdir;if(u)switch(c.type){case"devServer.output":{const f=c.payload;if(f.workdir!==u)return;vl.push({stream:f.stream,content:f.content}),s();break}case"devServer.state":{const f=c.payload;if(f.workdir!==u)return;e(l=>({status:l.status?{...l.status,state:f.state,errorMessage:f.errorMessage}:l.status}));break}}}}}),xS=3e4;function vS(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const kt=Wn((e,r)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const i=await Ce("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await Ce("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=Ee.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/activate`,{method:"POST"});if(!u.ok){const l=await u.json();throw new Error(l.error??"Failed to activate provider")}const f=await u.json();return e({activeProviderId:f.activeProviderId,model:f.model,backend:f.backend,providers:c.map(l=>({...l,isActive:l.id===f.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:c})});if(!u.ok){const d=await u.json();throw new Error(d.error??"Failed to update model context")}const f=await u.json(),{providers:l}=r();return e({providers:l.map(d=>d.id===i?{...d,models:d.models.map(p=>p.id===s?{...p,contextWindow:c,source:"user"}:p)}:d),activating:!1}),f.contextState&&Ee.getState().updateContextState(f.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await Ce(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const f=await s.json();throw new Error(f.error??"Failed to refresh models")}const c=await s.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===i?{...f,models:c.models}:f),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const c=setInterval(()=>{s()},xS);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),u=s.find(l=>l.id===c);if(!u)return 2e5;const f=u.models.find(l=>l.id===i);return(f==null?void 0:f.contextWindow)??2e5}})),Gt=Wn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Ce("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await Ce(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const u=await Ce(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const f=await u.json();return((c=r().currentProject)==null?void 0:c.id)===i&&e({currentProject:f.project}),await r().listProjects(),f.project}catch{return null}},deleteProject:async i=>{var s;try{return(await Ce(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let bl=[];const Pa=Wn()((e,r)=>{function i(){if(bl.length===0)return;const c=bl;bl=[],e(u=>{const f={...u.logs};for(const l of c){const d=f[l.processId]??[];f[l.processId]=[...d,{offset:d.length,content:l.content,timestamp:Date.now(),stream:l.stream}]}return{logs:f}})}const s=pb(i);return{processes:[],logs:{},loading:!1,setProcesses:c=>e({processes:c}),addProcess:c=>e(u=>({processes:[...u.processes,c]})),updateProcess:(c,u)=>e(f=>({processes:f.processes.map(l=>l.id===c?{...l,...u}:l)})),removeProcess:c=>e(u=>({processes:u.processes.filter(f=>f.id!==c),logs:Object.fromEntries(Object.entries(u.logs).filter(([f])=>f!==c))})),stopProcess:async(c,u)=>{try{(await Ce(`/api/sessions/${u}/background-process/${c}/stop`,{method:"POST"})).ok&&r().removeProcess(c)}catch{}},appendLog:(c,u,f)=>{bl.push({processId:c,stream:u,content:f}),s()},setLogs:(c,u)=>e(f=>({logs:{...f.logs,[c]:u}})),clearLogs:c=>e(u=>({logs:{...u.logs,[c]:[]}})),handleMessage:(c,u)=>{switch(c){case"backgroundProcess.started":{const{processId:f,name:l,pid:d,status:p}=u;e(g=>({processes:[...g.processes,{id:f,sessionId:"",name:l,command:"",cwd:"",pid:d,status:p,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const f=u.processId,l=u.stream,d=u.content;r().appendLog(f,l,d);break}case"backgroundProcess.exited":{const f=u.processId,l=u.exitCode;e(d=>({processes:d.processes.map(p=>p.id===f?{...p,status:"exited",exitCode:l}:p)}));break}case"backgroundProcess.removed":{const f=u.processId;r().removeProcess(f);break}}}}}),ti={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"};function yl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function kx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const ni=Wn(e=>({settings:{},loading:{},getSetting:async r=>{e(yl(r,!0));try{const s=await(await Ce(`/api/settings/${r}`)).json();return e(kx(r,s.value??"")),s.value}catch{return e(yl(r,!1)),null}},setSetting:async(r,i)=>{e(yl(r,!0));try{const c=await(await Ce(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(kx(r,c.value??""))}catch{e(yl(r,!1))}}})),bS=[{key:"complete",label:"Task Complete",description:"When an agent finishes its work"},{key:"waiting_for_user",label:"Waiting for Input",description:"When the agent needs your input"},{key:"phase_done",label:"Phase Done",description:"When a build phase completes successfully"},{key:"phase_blocked",label:"Phase Blocked",description:"When a build phase is blocked and needs intervention"},{key:"new_message",label:"New Message",description:"When a new assistant message starts arriving"}],yS=[{url:"/sounds/notification.mp3",label:"Notification"},{url:"/sounds/waiting-for-user.mp3",label:"Waiting for User"},{url:"/sounds/achievement.mp3",label:"Achievement"},{url:"/sounds/intervention.mp3",label:"Intervention"},{url:"/sounds/typing.mp3",label:"Typing"}],mb={complete:"/sounds/notification.mp3",waiting_for_user:"/sounds/waiting-for-user.mp3",phase_done:"/sounds/achievement.mp3",phase_blocked:"/sounds/intervention.mp3",new_message:"/sounds/typing.mp3"},ri={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},gb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Qd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ri},waiting_for_user:{...ri},phase_done:{...ri},phase_blocked:{...ri},new_message:{...gb}},agentOverrides:{}};function xb(e,r,i){var u;const s=e.events[r];if(!i)return s;const c=(u=e.agentOverrides[i])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const Ti=Wn((e,r)=>({settings:Qd,loaded:!1,load:()=>{ni.getState().getSetting(ti.NOTIFICATION_SETTINGS);const s=ni.subscribe(u=>{const f=u.settings[ti.NOTIFICATION_SETTINGS];if(f!==void 0)try{const l=JSON.parse(f);e({settings:Ex(l),loaded:!0})}catch{e({loaded:!0})}}),c=ni.getState().settings[ti.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:Ex(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),Ed(i)},updateEvent:(i,s)=>{const c=r().settings,u={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:u}),Ed(u)},updateAgentOverride:(i,s,c)=>{var d;const u=r().settings,f={...u.agentOverrides};if(c===null){if(f[i]){const p={...f[i]};delete p[s],Object.keys(p).length===0?delete f[i]:f[i]=p}}else f[i]={...f[i],[s]:{...((d=f[i])==null?void 0:d[s])??{},...c}};const l={...u,agentOverrides:f};e({settings:l}),Ed(l)}}));function Ed(e){ni.getState().setSetting(ti.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Ex(e){var r,i,s,c,u;return{soundEnabled:e.soundEnabled??Qd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Qd.browserNotificationEnabled,events:{complete:{...ri,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ri,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ri,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ri,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...gb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const jx=new Map;function _S(e){let r=jx.get(e);return r||(r=new Audio(e),r.volume=.5,jx.set(e,r)),r}let vb=typeof Notification<"u"?Notification.permission:"denied";function SS(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(vb=e,e))}const wS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},CS={complete:"The agent has finished its work.",waiting_for_user:"The agent needs your input to continue.",phase_done:"The build phase completed successfully.",phase_blocked:"The build phase is blocked and needs intervention.",new_message:"A new assistant message is arriving."};function kS(e){typeof Notification>"u"||vb==="granted"&&(document.hasFocus()||new Notification(wS[e],{body:CS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function Ja(e,r){const{settings:i}=Ti.getState(),s=xb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??mb[e],u=_S(c);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&kS(e)}const ES=e=>Ja("complete",e),jS=e=>Ja("phase_done",e),NS=e=>Ja("phase_blocked",e),Nx=e=>Ja("waiting_for_user",e),TS=e=>Ja("new_message",e);let Aa=!1,nr=null;const jd=new Set,Ht={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ds=null,an=null;function Nd(){Ds===null&&(Ds=requestAnimationFrame(()=>{Ds=null,an==null||an()}))}function ki(){Ds!==null&&(cancelAnimationFrame(Ds),Ds=null)}function At(e,r){return r!==null&&e.sessionId===r}function AS(e,r,i){return e.id!==void 0||At(e,r)||i===!0&&e.sessionId!==void 0}function DS(e,r){return e.includes(r)?e:[...e,r]}function Da(e,r){return e.filter(i=>i!==r)}function LS(e,r){const i=e.find(c=>c.id===r.id),s=i?{...i,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length}:{id:r.id,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,createdAt:"",updatedAt:"",criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(c=>c.id===r.id?s:c):[s,...e]}function RS(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,u=r.find(f=>f.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??s.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const Tx=new Map;function za(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,s=e.sessions.find(f=>f.id===r),c=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function MS(e,r){if(e.type==="chat.done"){const i=e.payload,s=za(r,e.sessionId),c=i.agentType??s;i.reason==="complete"&&ES(c),i.reason==="waiting_for_user"&&Nx(c);return}if(e.type==="chat.path_confirmation"){const i=za(r,e.sessionId);Nx(i);return}if(e.type==="task.completed"){const i=za(r,e.sessionId);jS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Tx.get(e.sessionId)??null;if(Tx.set(e.sessionId,i.phase),s===i.phase)return;const c=za(r,e.sessionId);i.phase==="blocked"&&NS(c)}}const Ee=Wn((e,r)=>(an=()=>{const i=Ht;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!c&&!u)return;const f=i.deltaContent,l=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(p=>{var m;const g=p.streamingMessage;if(g&&g.id===i.messageId){let y={...g};if(s&&(y.content=y.content+f),c&&(y.thinkingContent=(y.thinkingContent??"")+l),u){const _=new Set;y.toolCalls=(m=y.toolCalls)==null?void 0:m.map(C=>{const v=d.filter(b=>b.callId===C.id);return v.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...v.map(b=>({stream:b.stream,content:b.content}))]})});const k=d.filter(C=>!_.has(C.callId));k.length>0&&Ht.toolOutput.push(...k)}return{streamingMessage:y}}if(u){const y=new Set,_=p.messages.map(C=>{var b;if(C.id!==i.messageId)return C;const v=(b=C.toolCalls)==null?void 0:b.map(x=>{const S=d.filter(j=>j.callId===x.id);return S.length===0?x:(y.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:v}}),k=d.filter(C=>!y.has(C.callId));return k.length>0&&Ht.toolOutput.push(...k),{messages:_}}return p})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await Ce("/api/auth")).json()).requiresAuth}catch{}if(s&&!Pt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Pt.onStatusChange(c=>{e({connectionStatus:c}),c==="connected"&&r().listSessions(void 0)});try{if(await Pt.connect(),!Aa){Aa=!0;const c=r().handleServerMessage;nr=Pt.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Pt.getLastCloseCode();if(!Pt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Pt.disconnect(),nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{Pt.disconnect(),nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await s.json();Pt.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Gt.getState(),{fetchConfig:f}=kt.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Pt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await Ce("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Pt.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(ki(),e({currentSession:null,unreadSessionIds:Da(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Da(r().unreadSessionIds,i)});const c=await Ce(`/api/sessions/${i}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Pt.send("session.load",{sessionId:i});try{const f=await Ce(`/api/sessions/${i}/background-processes`);if(f.ok){const l=await f.json();Pa.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const f=await(await Ce(`/api/sessions?${c.toString()}`)).json();e({sessions:f.sessions??[],sessionsHasMore:i?f.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(s.sessions.length)),c.set("projectId",i);const f=await(await Ce(`/api/sessions?${c.toString()}`)).json();e(l=>({sessions:[...l.sessions,...f.sessions??[]],sessionsHasMore:f.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await Ce(`/api/sessions/${i}`,{method:"DELETE"})).ok?(await r().listSessions(),((s=r().currentSession)==null?void 0:s.id)===i&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async i=>{try{return(await Ce(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{ki(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Da(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u){e({streamingMessageId:null});try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c==null?void 0:c.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){ki(),an==null||an(),e({abortInProgress:!0});try{await Ce(`/api/sessions/${i}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await Ce(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),c&&(u.workflowId=c),Pt.send("runner.launch",u)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(i,s,c)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),c&&c.length>0&&(u.attachments=c),Pt.send("mode.accept",u)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Pt.send("context.compact",{})},setSessionProvider:async(i,s)=>{var c;try{const u=(c=r().currentSession)==null?void 0:c.id;if(!u)return null;const f=await Ce(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!f.ok)return null;const l=await f.json();return e({currentSession:l.session,messages:l.messages??[],contextState:l.contextState}),l.session}catch{return null}},updateContextState:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const c={...s.subAgentContextStates};return delete c[i],{subAgentContextStates:c}})},confirmPath:async(i,s,c=!1)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{await Ce(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{var u;const c=(u=r().currentSession)==null?void 0:u.id;if(c){try{await Ce(`/api/sessions/${c}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,answer:s})})}catch(f){console.error("Error answering question:",f)}e({pendingQuestion:null})}},queueAsap:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const f=await(await Ce(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();f.queueState&&e({queuedMessages:f.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var f,l,d,p,g,m,y,_,k,C,v,b,x,S,j,A,N,D,T,I,H,V,Y,q;const s=r();MS(i,s);const c=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const O=i.sessionId;!O||O===c||e(U=>({unreadSessionIds:DS(U.unreadSessionIds,O)}))};switch(i.type){case"session.state":{const O=i.payload;if(!AS(i,c,s.pendingSessionCreate))break;ki();const U=O.messages.find(L=>L.isStreaming)??null,z=r().pendingSessionCreate===!0,X=O.pendingConfirmations??[],M=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:O.session,sessions:LS(r().sessions,O.session),unreadSessionIds:Da(r().unreadSessionIds,O.session.id),messages:O.messages,streamingMessageId:(U==null?void 0:U.id)??null,streamingMessage:U,currentTodos:[],pendingPathConfirmation:M,error:null,...z?{pendingSessionCreate:O.session.id}:{}}),O.session.providerId&&O.session.providerModel){const L=kt.getState();L.providers.find(W=>W.id===O.session.providerId)&&L.syncFromSession(O.session.providerId,O.session.providerModel)}break}case"session.list":{const O=i.payload;e(U=>({sessions:RS(O.sessions,U.sessions,U.currentSession)}));break}case"session.deleted":{const O=i.payload;e(U=>({unreadSessionIds:Da(U.unreadSessionIds,O.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const O=i.payload,U=i.sessionId,z=(l=r().currentSession)==null?void 0:l.id,X=U&&U!==z;e(Q=>({sessions:Q.sessions.map(M=>M.id===U?{...M,isRunning:O.isRunning}:M)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,isRunning:O.isRunning}:null,...O.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!At(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const O=i.payload;e(U=>U.messages.some(z=>z.id===O.message.id)?U:{messages:[...U.messages,O.message],streamingMessageId:O.message.isStreaming?O.message.id:U.streamingMessageId,streamingMessage:O.message.isStreaming?O.message:U.streamingMessage});break}case"chat.message_updated":{if(!At(i,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const O=i.payload,U=O.updates.isStreaming===!1&&r().streamingMessageId===O.messageId;U&&(ki(),an==null||an()),e(z=>{const X=z.streamingMessage,Q=U;if(X&&X.id===O.messageId){const M={...X,...O.updates};return{messages:z.messages.map(L=>L.id===O.messageId?M:L),streamingMessageId:Q?null:z.streamingMessageId,streamingMessage:Q?null:{...X,...O.updates}}}return{messages:z.messages.map(M=>M.id===O.messageId?{...M,...O.updates}:M),streamingMessageId:Q?null:z.streamingMessageId}});break}case"chat.delta":{if(!At(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const O=i.payload;if(!jd.has(O.messageId)){jd.add(O.messageId);const U=za(r(),i.sessionId);TS(U)}Ht.messageId=O.messageId,Ht.deltaContent+=O.content,Nd();break}case"chat.thinking":{if(!At(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const O=i.payload;Ht.messageId=O.messageId,Ht.thinkingContent+=O.content,Nd();break}case"chat.tool_preparing":{if(!At(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const O=i.payload;e(U=>{const z=U.streamingMessage;return z&&z.id===O.messageId?{streamingMessage:{...z,preparingToolCalls:[...z.preparingToolCalls??[],{index:O.index,name:O.name}]}}:{messages:U.messages.map(X=>X.id===O.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:O.index,name:O.name}]}:X)}});break}case"chat.tool_call":{if(!At(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const O=i.payload,U=z=>{var M;const X=(M=z.preparingToolCalls)==null?void 0:M.filter((L,B)=>{var W;return L.name===O.tool?(W=z.preparingToolCalls)==null?void 0:W.slice(0,B).some(re=>re.name===O.tool):!0}),Q=Ht.toolOutput.filter(L=>L.callId===O.callId);return Q.length>0&&(Ht.toolOutput=Ht.toolOutput.filter(L=>L.callId!==O.callId)),{...z,toolCalls:[...z.toolCalls??[],{id:O.callId,name:O.tool,arguments:O.args,startedAt:Date.now(),...Q.length>0?{streamingOutput:Q.map(L=>({stream:L.stream,content:L.content}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(z=>{const X=z.streamingMessage;return X&&X.id===O.messageId?{streamingMessage:U(X)}:{messages:z.messages.map(Q=>Q.id===O.messageId?U(Q):Q)}});break}case"chat.tool_output":{if(!At(i,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const O=i.payload;Ht.messageId=O.messageId,Ht.toolOutput.push({messageId:O.messageId,callId:O.callId,stream:O.stream,content:O.output}),Nd();break}case"chat.tool_result":{if(!At(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const O=i.payload,U=z=>{var Q;const X=(Q=z.toolCalls)==null?void 0:Q.map(M=>M.id===O.callId?{...M,result:O.result}:M);return{...z,toolCalls:X}};e(z=>{const X=z.streamingMessage;return X&&X.id===O.messageId?{streamingMessage:U(X)}:{messages:z.messages.map(Q=>Q.id===O.messageId?U(Q):Q)}});break}case"chat.vision_fallback":{if(!At(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const O=i.payload;e(U=>{const z=`${O.messageId}-${O.attachmentId}`,X={...U.visionFallbackByMessage};return X[z]={type:O.type,attachmentId:O.attachmentId,filename:O.filename,description:O.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!At(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const O=i.payload;e({currentTodos:O.todos});break}case"chat.summary":{if(!At(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,summary:O.summary}:null}));break}case"chat.progress":{if(!At(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const O=i.payload;console.log("Progress:",O.message,O.phase);break}case"chat.format_retry":{if(!At(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const O=i.payload;console.log("Format retry:",O.attempt,"/",O.maxAttempts);break}case"chat.done":{if(!At(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}ki(),an==null||an();const O=i.payload,U=O.stats;Ht.messageId=null,Ht.deltaContent="",Ht.thinkingContent="",Ht.toolOutput=[],jd.delete(O.messageId),e(z=>{const X=z.streamingMessage,Q=X&&X.id===O.messageId?{...X,isStreaming:!1,stats:U??X.stats}:null;return{messages:z.messages.map(M=>M.id===O.messageId?Q??{...M,isStreaming:!1,stats:U??M.stats}:M),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!At(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}ki(),an==null||an();const O=i.payload;console.error("Chat error:",O.error,"recoverable:",O.recoverable),O.recoverable||(Ht.messageId=null,Ht.deltaContent="",Ht.thinkingContent="",Ht.toolOutput=[]),e(U=>({error:{code:"CHAT_ERROR",message:O.error},streamingMessageId:O.recoverable?U.streamingMessageId:null,...O.recoverable?{}:{messages:U.streamingMessage?U.messages.map(z=>z.id===U.streamingMessage.id?U.streamingMessage:z):U.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!At(i,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const O=i.payload;e({pendingPathConfirmation:{callId:O.callId,tool:O.tool,paths:O.paths,workdir:O.workdir,reason:O.reason}});break}case"chat.ask_user":{if(!At(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const O=i.payload;e({pendingQuestion:{callId:O.callId,question:O.question}});break}case"mode.changed":{if(!At(i,((I=r().currentSession)==null?void 0:I.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,mode:O.mode}:null}));break}case"phase.changed":{const O=i.payload,U=i.sessionId,z=(H=r().currentSession)==null?void 0:H.id,X=U&&U!==z;e(Q=>({sessions:Q.sessions.map(M=>M.id===U?{...M,phase:O.phase}:M)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,phase:O.phase}:null}));break}case"criteria.updated":{if(!At(i,((V=r().currentSession)==null?void 0:V.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,criteria:O.criteria}:null}));break}case"context.state":{const O=i.payload,U=At(i,((Y=r().currentSession)==null?void 0:Y.id)??null);O.subAgentId?U&&r().updateSubAgentContextState(O.subAgentId,O.context):U?e({contextState:O.context}):u();break}case"session.name_generated":{const O=i.payload,U=i.sessionId,z=(q=r().currentSession)==null?void 0:q.id;e(X=>{const Q=X.sessions.map(L=>L.id===U?{...L,title:O.name,updatedAt:new Date().toISOString()}:L),M=z===U?X.currentSession?{...X.currentSession,title:O.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Q,currentSession:M}});break}case"queue.state":{const O=i.payload;e({queuedMessages:O.messages});break}case"devServer.output":case"devServer.state":{ir.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Pa.getState().handleMessage(i.type,i.payload);break}case"error":{const O=i.payload;console.error("Server error:",O),e({error:{code:O.code,message:O.message},streamingMessageId:null});break}}}}));function bb(){return Ee(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function OS(){return Ee(e=>e.queuedMessages)}function BS(){return Ee(e=>e.abortInProgress)}function IS(){const e=Ee(s=>s.connect),r=Ee(s=>s.connectionStatus),i=Ti(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Jd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}function Ax(e,r){const i=Pt.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Jd(),type:e,payload:r}))}const sr=Wn((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:i=>e({isOpen:i}),toggleOpen:()=>e(i=>({isOpen:!i.isOpen})),setWorkdir:i=>e({workdir:i}),fetchSessions:async()=>{try{const i=await Ce("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Pt.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of s)c.send(JSON.stringify({id:Jd(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await Ce("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const c=await s.json();e(f=>({sessions:[...f.sessions,c]}));const u=Pt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:Jd(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Ax("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{Ax("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await Ce(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const u=c.sessions.filter(f=>f.id!==s);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Pt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&sr.getState().handleMessage(e)});const yh=P.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},c)=>o.jsx("button",{ref:c,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));yh.displayName="IconButton";const zS="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z",Mi=P.forwardRef((e,r)=>o.jsx(yh,{ref:r,icon:zS,title:"Edit",...e}));Mi.displayName="EditButton";const HS="M6 18L18 6M6 6l12 12",$l=P.forwardRef((e,r)=>o.jsx(yh,{ref:r,icon:HS,...e}));$l.displayName="CloseButton";var ql=ib();function ln({isOpen:e,onClose:r,title:i,children:s,size:c="md"}){const u=P.useRef(null),f=P.useRef(null),l=P.useCallback(p=>{p.key==="Escape"&&r()},[r]);if(P.useEffect(()=>{var p,g;return e?(f.current=document.activeElement,(p=u.current)==null||p.focus(),document.body.style.overflow="hidden"):((g=f.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),P.useEffect(()=>{if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,l]),!e)return null;const d={sm:"max-w-sm md:max-w-sm",md:"max-w-[90vw] md:max-w-md",lg:"max-w-[90vw] md:max-w-2xl h-[80vh]",xl:"max-w-[90vw] md:max-w-4xl h-[80vh]",full:"max-w-[95vw] h-[90vh]"};return ql.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{ref:u,tabIndex:-1,className:`relative w-full ${d[c]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:i}),o.jsx($l,{onClick:r,className:"flex-shrink-0","aria-label":"Close modal"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const st=P.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-white hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},d={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return o.jsx("button",{ref:u,className:`${f} ${l[e]} ${d[r]} ${i}`,...c,children:s})});st.displayName="Button";function PS({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:i,onChange:u=>{const f=u.target.value;s(f===r?null:f)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:yS.map(({url:u,label:f})=>o.jsx("option",{value:u,title:f,children:f.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const Dx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function FS(){const e=Ti(d=>d.settings),r=Ti(d=>d.update),i=Ti(d=>d.updateEvent),s=Ti(d=>d.updateAgentOverride),c=Ti(d=>d.load);P.useEffect(()=>{c()},[c]);const u=async()=>{await SS()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?i(p,{[g]:m}):s(d,p,{[g]:m})},l=(d,p,g)=>{d==="general"?i(p,{customSoundUrl:g}):s(d,p,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Lx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Lx,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?u():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&o.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),Dx.map(d=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),o.jsx("tbody",{children:bS.map(d=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),Dx.map(p=>{const g=xb(e,d.key,p.key==="general"?void 0:p.key),m=mb[d.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:y=>f(p.key,d.key,"soundEnabled",y.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:y=>f(p.key,d.key,"browserNotification",y.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(PS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:y=>l(p.key,d.key,y)})]})},p.key)})]},d.key))})]})})]})]})}function Lx({label:e,description:r,checked:i,onChange:s}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}async function _h(e,r){r({loading:!0});try{const s=await(await Ce(e)).json();r({defaults:s.defaults??[],userItems:s.userItems??[],loading:!1})}catch{r({loading:!1})}}const Er=Wn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await _h("/api/skills",e)},toggleSkill:async i=>{try{const c=await(await Ce(`/api/skills/${i}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===i?{...f,enabled:c.enabled}:f),userItems:u.userItems.map(f=>f.id===i?{...f,enabled:c.enabled}:f)}))}catch{}},fetchSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/skills/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await si("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const c=await si("PUT",`/api/skills/${i}`,s);return c.success&&await r().fetchSkills(),c},deleteSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async i=>{try{const s=await Ce(`/api/skills/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Sh(){const[e,r]=P.useState({id:null,type:null}),i=P.useCallback(u=>r({id:u,type:"delete"}),[]),s=P.useCallback(()=>r({id:null,type:null}),[]),c=P.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:i,clearConfirm:s,isConfirming:c}}function wh({onConfirm:e,onCancel:r}){return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),o.jsx("button",{onClick:r,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function Ch({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})}function Wa({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}function Ai({label:e,value:r,onChange:i,placeholder:s,readOnly:c,hint:u,mono:f}){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&o.jsx("span",{className:"text-text-muted ml-1",children:u})]}),o.jsx("input",{value:r,onChange:l=>i(l.target.value),readOnly:c,placeholder:s,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${f?"font-mono":""} ${c?"opacity-60":""}`})]})}function US({onCancel:e,onSave:r,saving:i,saveDisabled:s}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function kh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function yb({description:e,onNew:r,newLabel:i="+ New"}){return o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:e}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function _b({isBuiltIn:e,isConfirmingDelete:r,onView:i,onEdit:s,onDuplicate:c,onDelete:u,children:f}){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:f}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&i&&o.jsx("button",{onClick:i,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Wa,{onClick:c}),!e&&s&&o.jsx(Mi,{onClick:s}),!e&&(r?o.jsx(wh,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Ch,{onClick:()=>u==null?void 0:u()}))]})]})}function $S({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d}){return o.jsxs(_b,{isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:r}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),i&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:i})]})}function Sb({loading:e,hasItems:r,loadingLabel:i,emptyLabel:s,children:c}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:i}):r?o.jsx("div",{className:"space-y-4",children:c}):s?o.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function wb({name:e,id:r,nameLabel:i="Name",idLabel:s="ID",namePlaceholder:c="My Item",idPlaceholder:u="my-item",nameHint:f,readOnlyId:l=!1,readOnlyHint:d="(read-only)",onNameChange:p,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:i,value:e,onChange:p,placeholder:c,hint:f}),o.jsx(Ai,{label:s,value:r,onChange:g,readOnly:l,placeholder:u,hint:l?d:void 0,mono:!0})]})}function Cb(e={}){const{initialData:r={}}=e,[i,s]=P.useState("list"),[c,u]=P.useState(null),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(r),y=P.useCallback(()=>{m(r),l(""),u(null)},[r]),_=P.useCallback(b=>{s(b),b==="list"&&y()},[y]),k=P.useCallback(b=>{m(x=>typeof b=="function"?b(x):b)},[]),C=P.useCallback((b,x={})=>{u(b),s("edit"),m({...x}),l("")},[]),v=P.useCallback(()=>{u(null),s("edit"),m(r),l("")},[r]);return{view:i,editingId:c,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:l,setFormData:k,setSaving:p,resetForm:y,startEditing:C,startNew:v}}function Rx({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsx($S,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f})}function qS({isOpen:e}){const r=Er(O=>O.defaults),i=Er(O=>O.userItems),s=Er(O=>O.loading),c=Er(O=>O.fetchSkills),u=Er(O=>O.fetchSkill),f=Er(O=>O.fetchDefaultContent),l=Er(O=>O.createSkill),d=Er(O=>O.updateSkill),p=Er(O=>O.deleteSkill),{view:g,editingId:m,formError:y,saving:_,formData:k,setView:C,setEditingId:v,setFormError:b,setFormData:x,setSaving:S}=Cb(),{clearConfirm:j}=Sh();P.useEffect(()=>{e&&(c(),C("list"),v(null),j())},[e,c,j]);const A=(O,U,z,X)=>{x({name:X??O.metadata.name,id:z??O.metadata.id,description:O.metadata.description??"",version:O.metadata.version??"1.0.0",prompt:O.prompt,isReadOnly:U})},N=async O=>{if(r.some(z=>z.id===O)){const z=await f(O);if(!z)return;A(z,!0),v(O),b(""),C("edit")}else{const z=await u(O);if(!z)return;A(z,!0),v(O),b(""),C("edit")}},D=async O=>{const z=r.some(Q=>Q.id===O)?await f(O):await u(O);if(!z)return;const X=`${O}-copy-${Date.now()}`;A(z,!1,X,`${z.metadata.name} (copy)`),v(null),b(""),C("edit")},T=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},I=async O=>{const U=await u(O);U&&(A(U,!1),v(O),b(""),C("edit"))},H=async O=>{await p(O),j()},V=async()=>{const O=m??k.id;if(!O||!k.name||!k.prompt){b("Name, ID, and prompt are required.");return}S(!0),b("");const U={metadata:{id:O,name:k.name,description:k.description,version:k.version},prompt:k.prompt},z=m?await d(m,U):await l(U);if(S(!1),!z.success){b(z.error??"Failed to save skill.");return}C("list")},Y=O=>{x(U=>({...U,name:O})),m||x(U=>({...U,id:O.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},q=k.isReadOnly;return g==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:q?k.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),y&&o.jsx(kh,{message:y}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(wb,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:Y,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:k.description,onChange:O=>x(U=>({...U,description:O})),placeholder:"What this skill does...",readOnly:q}),o.jsx(Ai,{label:"Version",value:k.version,onChange:O=>x(U=>({...U,version:O})),placeholder:"1.0.0",readOnly:q})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:k.prompt,onChange:O=>x(U=>({...U,prompt:O.target.value})),readOnly:q,placeholder:"The system prompt for this skill...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),q?o.jsx(st,{variant:"primary",onClick:()=>{x(O=>({...O,name:O.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),v(null)},children:"Duplicate & Customize"}):o.jsx(st,{variant:"primary",onClick:V,disabled:_||!k.name||!k.id||!k.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(yb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:T}),o.jsxs(Sb,{loading:s,hasItems:r.length>0||i.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[r.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:r.map(O=>o.jsx(Rx,{skill:O,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(O.id),onDuplicate:()=>D(O.id)},O.id))})]}),i.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:i.map(O=>o.jsx(Rx,{skill:O,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(O.id),onEdit:()=>I(O.id),onDuplicate:()=>D(O.id),onDelete:()=>H(O.id)},O.id))})]})]})]})}function WS({isOpen:e,onClose:r}){const[i,s]=P.useState("instructions");return o.jsx(ln,{isOpen:e,onClose:r,title:"Settings",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[o.jsx(_l,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(_l,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(_l,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(_l,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(VS,{isOpen:e}),i==="skills"&&o.jsx(qS,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(FS,{})}),i==="advanced"&&o.jsx(GS,{onClose:r})]})})}function GS({onClose:e}){const[,r]=ar();function i(){e(),r("/onboarding")}return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),o.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),o.jsx(st,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function _l({label:e,active:r,onClick:i}){return o.jsx("button",{onClick:i,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function VS({isOpen:e}){const r=ni(v=>v.settings),i=ni(v=>v.loading),s=ni(v=>v.getSetting),c=ni(v=>v.setSetting),u=r[ti.GLOBAL_INSTRUCTIONS]??"",f=i[ti.GLOBAL_INSTRUCTIONS]??!1,[l,d]=P.useState(u),[p,g]=P.useState(!1),[m,y]=P.useState(!1);P.useEffect(()=>{e&&s(ti.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{y(!0),c(ti.GLOBAL_INSTRUCTIONS,l),y(!1),g(!1)},k=()=>{d(u),g(!1)},C=f||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:l,onChange:v=>{d(v.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:k,disabled:!p,children:"Discard"}),o.jsx(st,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Td={exports:{}},Mx;function YS(){return Mx||(Mx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,S,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(x,S){return function(j,A){S(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=d(9042),y=d(9924),_=d(844),k=d(4725),C=d(2585),v=d(3656);let b=l.AccessibilityManager=class extends _.Disposable{constructor(x,S,j,A){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=A,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
57
|
+
*/var mx;function q1(){if(mx)return kd;mx=1;var e=Fl();function r(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var i=typeof Object.is=="function"?Object.is:r,s=e.useState,c=e.useEffect,u=e.useLayoutEffect,f=e.useDebugValue;function l(m,y){var _=y(),k=s({inst:{value:_,getSnapshot:y}}),C=k[0].inst,v=k[1];return u(function(){C.value=_,C.getSnapshot=y,d(C)&&v({inst:C})},[m,_,y]),c(function(){return d(C)&&v({inst:C}),m(function(){d(C)&&v({inst:C})})},[m]),f(_),_}function d(m){var y=m.getSnapshot;m=m.value;try{var _=y();return!i(m,_)}catch{return!0}}function p(m,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:l;return kd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,kd}var gx;function W1(){return gx||(gx=1,Cd.exports=q1()),Cd.exports}var G1=W1();const V1=O1.useInsertionEffect,Y1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",K1=Y1?P.useLayoutEffect:P.useEffect,X1=V1||K1,sb=e=>{const r=P.useRef([e,(...i)=>r[0](...i)]).current;return X1(()=>{r[0]=e}),r[1]},Z1="popstate",gh="pushState",xh="replaceState",Q1="hashchange",xx=[Z1,gh,xh,Q1],J1=e=>{for(const r of xx)addEventListener(r,e);return()=>{for(const r of xx)removeEventListener(r,e)}},ab=(e,r)=>G1.useSyncExternalStore(J1,e,r),vx=()=>location.search,eS=({ssrSearch:e}={})=>ab(vx,e!=null?()=>e:vx),bx=()=>location.pathname,tS=({ssrPath:e}={})=>ab(bx,e!=null?()=>e:bx),nS=(e,{replace:r=!1,state:i=null}={})=>history[r?xh:gh](i,"",e),rS=(e={})=>[tS(e),nS],yx=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[yx]>"u"){for(const e of[gh,xh]){const r=history[e];history[e]=function(){const i=r.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),i}}Object.defineProperty(window,yx,{value:!0})}const iS=(e,r)=>r.toLowerCase().indexOf(e.toLowerCase())?"~"+r:r.slice(e.length)||"/",ob=(e="")=>e==="/"?"":e,sS=(e,r)=>e[0]==="~"?e.slice(1):ob(r)+e,aS=(e="",r)=>iS(_x(ob(e)),_x(r)),_x=e=>{try{return decodeURI(e)}catch{return e}},lb={hook:rS,searchHook:eS,parser:$1,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e,aroundNav:(e,r,i)=>e(r,i)},cb=P.createContext(lb),Os=()=>P.useContext(cb),ub={},db=P.createContext(ub),oS=()=>P.useContext(db),Ul=e=>{const[r,i]=e.hook(e);return[aS(e.base,r),sb((s,c)=>e.aroundNav(i,sS(s,e.base),c))]},ar=()=>Ul(Os()),vh=(e,r,i,s)=>{const{pattern:c,keys:u}=r instanceof RegExp?{keys:!1,pattern:r}:e(r||"*",s),f=c.exec(i)||[],[l,...d]=f;return l!==void 0?[!0,(()=>{const p=u!==!1?Object.fromEntries(u.map((m,y)=>[m,d[y]])):f.groups;let g={...d};return p&&Object.assign(g,p),g})(),...s?[l]:[]]:[!1,null]},bh=e=>vh(Os().parser,e,ar()[0]),lS=({children:e,...r})=>{var g,m,y;const i=Os(),s=r.hook?lb:i;let c=s;const[u,f=r.ssrSearch??""]=((g=r.ssrPath)==null?void 0:g.split("?"))??[];u&&(r.ssrSearch=f,r.ssrPath=u),r.hrefs=r.hrefs??((m=r.hook)==null?void 0:m.hrefs),r.searchHook=r.searchHook??((y=r.hook)==null?void 0:y.searchHook);let l=P.useRef({}),d=l.current,p=d;for(let _ in s){const k=_==="base"?s[_]+(r[_]??""):r[_]??s[_];d===p&&k!==p[_]&&(l.current=p={...p}),p[_]=k,(k!==s[_]||k!==c[_])&&(c=p)}return P.createElement(cb.Provider,{value:c,children:e})},Sx=({children:e,component:r},i)=>r?P.createElement(r,{params:i}):typeof e=="function"?e(i):e,cS=e=>{let r=P.useRef(ub);const i=r.current;return r.current=Object.keys(e).length!==Object.keys(i).length||Object.entries(e).some(([s,c])=>c!==i[s])?e:i},Ta=({path:e,nest:r,match:i,...s})=>{const c=Os(),[u]=Ul(c),[f,l,d]=i??vh(c.parser,e,u,r),p=cS({...oS(),...l});if(!f)return null;const g=d?P.createElement(lS,{base:d},Sx(s,p)):Sx(s,p);return P.createElement(db.Provider,{value:p,children:g})},Ln=P.forwardRef((e,r)=>{const i=Os(),[s,c]=Ul(i),{to:u="",href:f=u,onClick:l,asChild:d,children:p,className:g,replace:m,state:y,transition:_,...k}=e,C=sb(b=>{b.ctrlKey||b.metaKey||b.altKey||b.shiftKey||b.button!==0||(l==null||l(b),b.defaultPrevented||(b.preventDefault(),c(f,e)))}),v=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return d&&P.isValidElement(p)?P.cloneElement(p,{onClick:C,href:v}):P.createElement("a",{...k,onClick:C,href:v,className:g!=null&&g.call?g(s===f):g,children:p,ref:r})}),hb=e=>Array.isArray(e)?e.flatMap(r=>hb(r&&r.type===P.Fragment?r.props.children:r)):[e],uS=({children:e,location:r})=>{const i=Os(),[s]=Ul(i);for(const c of hb(e)){let u=0;if(P.isValidElement(c)&&(u=vh(i.parser,c.props.path,r||s,c.props.nest))[0])return P.cloneElement(c,{match:u})}return null},wx=e=>{let r;const i=new Set,s=(p,g)=>{const m=typeof p=="function"?p(r):p;if(!Object.is(m,r)){const y=r;r=g??(typeof m!="object"||m===null)?m:Object.assign({},r,m),i.forEach(_=>_(r,y))}},c=()=>r,l={setState:s,getState:c,getInitialState:()=>d,subscribe:p=>(i.add(p),()=>i.delete(p))},d=r=e(s,c,l);return l},dS=(e=>e?wx(e):wx),hS=e=>e;function fS(e,r=hS){const i=on.useSyncExternalStore(e.subscribe,on.useCallback(()=>r(e.getState()),[e,r]),on.useCallback(()=>r(e.getInitialState()),[e,r]));return on.useDebugValue(i),i}const Cx=e=>{const r=dS(e),i=s=>fS(r,s);return Object.assign(i,r),i},Wn=(e=>e?Cx(e):Cx);async function Ce(e,r={}){const i=localStorage.getItem("openfox_token"),s={...r.headers instanceof Headers?Object.fromEntries(r.headers.entries()):r.headers,...i?{"x-session-token":i}:{}};return fetch(e,{...r,headers:s})}function pS(e){return typeof e=="object"&&e!==null&&"type"in e&&"payload"in e}function fb(){if(typeof crypto<"u"&&crypto.randomUUID)try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}class mS{constructor(r){tr(this,"ws",null);tr(this,"handlers",new Set);tr(this,"statusHandler",null);tr(this,"baseUrl");tr(this,"isReconnecting",!1);tr(this,"connectingPromise",null);tr(this,"lastCloseCode",0);tr(this,"reconnectAttempts",0);tr(this,"manualReconnectScheduled",!1);this.baseUrl=r}getUrl(){const r=localStorage.getItem("openfox_token");if(r){const i=this.baseUrl.includes("?")?"&":"?";return`${this.baseUrl}${i}token=${encodeURIComponent(r)}`}return this.baseUrl}setToken(r){localStorage.setItem("openfox_token",r)}clearToken(){localStorage.removeItem("openfox_token")}hasToken(){return!!localStorage.getItem("openfox_token")}getLastCloseCode(){return this.lastCloseCode}onStatusChange(r){this.statusHandler=r}connect(){var r,i;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN?Promise.resolve():(this.lastCloseCode=0,this.isReconnecting=!1,this.connectingPromise&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.CONNECTING?this.connectingPromise:(this.connectingPromise=new Promise((s,c)=>{try{const u=this.getUrl();this.ws=new WebSocket(u);const f=setTimeout(()=>{var l;((l=this.ws)==null?void 0:l.readyState)===WebSocket.CONNECTING&&(this.ws.close(),c(new Error("Connection timeout")))},5e3);this.ws.onopen=()=>{var l;clearTimeout(f),this.isReconnecting=!1,this.connectingPromise=null,(l=this.statusHandler)==null||l.call(this,"connected"),s()},this.ws.onclose=l=>{var d,p,g;clearTimeout(f),this.lastCloseCode=l.code,((d=this.ws)==null?void 0:d.readyState)===WebSocket.CONNECTING?(this.connectingPromise=null,(p=this.statusHandler)==null||p.call(this,"disconnected"),c(new Error(`Connection closed: ${l.code}`))):(this.connectingPromise=null,(g=this.statusHandler)==null||g.call(this,"disconnected"),this.attemptReconnect())},this.ws.onerror=l=>{clearTimeout(f),console.error("WebSocket error:",l),this.connectingPromise=null,c(l)},this.ws.onmessage=l=>{try{const d=JSON.parse(l.data);pS(d)&&this.handlers.forEach(p=>p(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}}}catch(u){this.connectingPromise=null,c(u)}}),this.connectingPromise))}attemptReconnect(){var c;if(([1e3,1005,1006,4e3].includes(this.lastCloseCode)||this.lastCloseCode===0)&&this.hasToken()){console.log("[WS] Auth failure or initial failure with token - not auto-reconnecting, awaiting user action");return}if(this.isReconnecting||this.manualReconnectScheduled)return;this.isReconnecting=!0,(c=this.statusHandler)==null||c.call(this,"reconnecting");const s=Math.min(1e3*Math.pow(2,this.reconnectAttempts||0),3e4);this.reconnectAttempts=(this.reconnectAttempts||0)+1,setTimeout(()=>{this.isReconnecting=!1,this.manualReconnectScheduled=!1,this.connect().catch(()=>{})},s)}reconnect(){this.manualReconnectScheduled=!0,this.isReconnecting=!1,this.lastCloseCode=0,this.connectingPromise=null,this.connect().catch(()=>{})}disconnect(){this.isReconnecting=!1,this.reconnectAttempts=0,this.ws&&(this.ws.close(),this.ws=null)}resetReconnectAttempts(){this.reconnectAttempts=0}send(r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");const s=fb(),c={id:s,type:r,payload:i};return this.ws.send(JSON.stringify(c)),s}subscribe(r){return this.handlers.add(r),()=>this.handlers.delete(r)}get isConnected(){var r;return((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN}}const gS=`ws://${window.location.hostname}:${window.location.port||"10469"}/ws`,Pt=new mS(gS),si=async(e,r,i)=>{try{const s=await Ce(r,{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});return s.ok?{success:!0}:{success:!1,error:(await s.json()).error}}catch{return{success:!1,error:"Network error"}}};function pb(e){let r=null;function i(){r===null&&(r=requestAnimationFrame(()=>{r=null,e()}))}return i}let vl=[];const ir=Wn()((e,r)=>{function i(){if(vl.length===0)return;const c=vl;vl=[],e(u=>({logs:[...u.logs,...c]}))}const s=pb(i);return{workdir:null,status:null,logs:[],config:null,loading:!1,setWorkdir:c=>{r().workdir!==c&&(e({workdir:c,status:null,logs:[],config:null,loading:!0}),c&&(r().fetchStatus(),r().fetchConfig()))},fetchStatus:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server?workdir=${encodeURIComponent(c)}`)).json();e({status:f,loading:!1})}catch{e({loading:!1})}},fetchConfig:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(c)}`)).json();e({config:f.config??null})}catch{}},fetchLogs:async()=>{const c=r().workdir;if(c)try{const l=(await(await Ce(`/api/dev-server/logs?workdir=${encodeURIComponent(c)}`)).json()).logs.map(d=>({stream:d.stream,content:d.content}));e({logs:l})}catch{}},start:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/start?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},stop:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/stop?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f})}catch{}},restart:async()=>{const c=r().workdir;if(c)try{const f=await(await Ce(`/api/dev-server/restart?workdir=${encodeURIComponent(c)}`,{method:"POST"})).json();e({status:f,logs:[]})}catch{}},saveConfig:async c=>{const u=r().workdir;if(u)try{const l=await(await Ce(`/api/dev-server/config?workdir=${encodeURIComponent(u)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})).json();e({config:l.config??c}),r().fetchStatus()}catch{}},handleMessage:c=>{const u=r().workdir;if(u)switch(c.type){case"devServer.output":{const f=c.payload;if(f.workdir!==u)return;vl.push({stream:f.stream,content:f.content}),s();break}case"devServer.state":{const f=c.payload;if(f.workdir!==u)return;e(l=>({status:l.status?{...l.status,state:f.state,errorMessage:f.errorMessage}:l.status}));break}}}}}),xS=3e4;function vS(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return""}}const kt=Wn((e,r)=>({version:null,model:null,maxContext:2e5,llmUrl:null,llmStatus:"unknown",backend:"unknown",providers:[],activeProviderId:null,defaultModelSelection:null,loading:!1,activating:!1,error:null,autoRefreshInterval:null,fetchConfig:async()=>{e({loading:!0,error:null});try{const i=await Ce("/api/config");if(!i.ok)throw new Error("Failed to fetch config");const s=await i.json();e({version:s.version,model:s.model,maxContext:s.maxContext,llmUrl:s.llmUrl,llmStatus:s.llmStatus,backend:s.backend,providers:s.providers??[],activeProviderId:s.activeProviderId??null,defaultModelSelection:s.defaultModelSelection??null,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Unknown error",loading:!1})}},refreshModel:async()=>{try{const i=await Ce("/api/model/refresh",{method:"POST"});if(!i.ok)throw new Error("Failed to refresh model");const s=await i.json(),u=Ee.getState().currentSession;if(u!=null&&u.providerId&&u.providerModel){e({llmStatus:s.llmStatus,backend:s.backend});return}e({model:s.model,llmStatus:s.llmStatus,backend:s.backend})}catch(i){console.error("Failed to refresh model:",i)}},activateProvider:async i=>{const{activeProviderId:s,providers:c}=r();if(i===s)return!0;e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/activate`,{method:"POST"});if(!u.ok){const l=await u.json();throw new Error(l.error??"Failed to activate provider")}const f=await u.json();return e({activeProviderId:f.activeProviderId,model:f.model,backend:f.backend,providers:c.map(l=>({...l,isActive:l.id===f.activeProviderId})),activating:!1}),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to switch provider",activating:!1}),!1}},syncFromSession:(i,s)=>{const{providers:c}=r();e({activeProviderId:i,model:s,defaultModelSelection:`${i}/${s}`,providers:c.map(u=>({...u,isActive:u.id===i}))})},updateModelContext:async(i,s,c)=>{e({activating:!0,error:null});try{const u=await Ce(`/api/providers/${i}/models/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contextWindow:c})});if(!u.ok){const d=await u.json();throw new Error(d.error??"Failed to update model context")}const f=await u.json(),{providers:l}=r();return e({providers:l.map(d=>d.id===i?{...d,models:d.models.map(p=>p.id===s?{...p,contextWindow:c,source:"user"}:p)}:d),activating:!1}),f.contextState&&Ee.getState().updateContextState(f.contextState),!0}catch(u){return e({error:u instanceof Error?u.message:"Failed to update model context",activating:!1}),!1}},refreshProviderModels:async i=>{e({activating:!0,error:null});try{const s=await Ce(`/api/providers/${i}/refresh`,{method:"POST"});if(!s.ok){const f=await s.json();throw new Error(f.error??"Failed to refresh models")}const c=await s.json(),{providers:u}=r();return e({providers:u.map(f=>f.id===i?{...f,models:c.models}:f),activating:!1}),!0}catch(s){return e({error:s instanceof Error?s.message:"Failed to refresh models",activating:!1}),!1}},startAutoRefresh:()=>{const{autoRefreshInterval:i,refreshModel:s}=r();if(i)return;const c=setInterval(()=>{s()},xS);e({autoRefreshInterval:c})},stopAutoRefresh:()=>{const{autoRefreshInterval:i}=r();i&&(clearInterval(i),e({autoRefreshInterval:null}))},getActiveProvider:()=>{const{providers:i,activeProviderId:s}=r();return i.find(c=>c.id===s)},getModelContext:i=>{const{providers:s,activeProviderId:c}=r(),u=s.find(l=>l.id===c);if(!u)return 2e5;const f=u.models.find(l=>l.id===i);return(f==null?void 0:f.contextWindow)??2e5}})),Gt=Wn((e,r)=>({projects:[],currentProject:null,loading:!1,listProjects:async()=>{e({loading:!0});try{const s=await(await Ce("/api/projects")).json();e({projects:s.projects??[],loading:!1})}catch{e({loading:!1})}},createProject:async(i,s)=>{try{const c=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,workdir:s})});if(!c.ok)return null;const u=await c.json();return await r().listProjects(),u.project}catch{return null}},loadProject:async i=>{try{const s=await Ce(`/api/projects/${i}`);if(!s.ok)return null;const c=await s.json();return e({currentProject:c.project}),r().projects.length===0&&await r().listProjects(),c.project}catch{return null}},updateProject:async(i,s)=>{var c;try{const u=await Ce(`/api/projects/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok)return null;const f=await u.json();return((c=r().currentProject)==null?void 0:c.id)===i&&e({currentProject:f.project}),await r().listProjects(),f.project}catch{return null}},deleteProject:async i=>{var s;try{return(await Ce(`/api/projects/${i}`,{method:"DELETE"})).ok?(await r().listProjects(),((s=r().currentProject)==null?void 0:s.id)===i&&e({currentProject:null}),!0):!1}catch{return!1}},clearProject:()=>{e({currentProject:null})}}));let bl=[];const Pa=Wn()((e,r)=>{function i(){if(bl.length===0)return;const c=bl;bl=[],e(u=>{const f={...u.logs};for(const l of c){const d=f[l.processId]??[];f[l.processId]=[...d,{offset:d.length,content:l.content,timestamp:Date.now(),stream:l.stream}]}return{logs:f}})}const s=pb(i);return{processes:[],logs:{},loading:!1,setProcesses:c=>e({processes:c}),addProcess:c=>e(u=>({processes:[...u.processes,c]})),updateProcess:(c,u)=>e(f=>({processes:f.processes.map(l=>l.id===c?{...l,...u}:l)})),removeProcess:c=>e(u=>({processes:u.processes.filter(f=>f.id!==c),logs:Object.fromEntries(Object.entries(u.logs).filter(([f])=>f!==c))})),stopProcess:async(c,u)=>{try{(await Ce(`/api/sessions/${u}/background-process/${c}/stop`,{method:"POST"})).ok&&r().removeProcess(c)}catch{}},appendLog:(c,u,f)=>{bl.push({processId:c,stream:u,content:f}),s()},setLogs:(c,u)=>e(f=>({logs:{...f.logs,[c]:u}})),clearLogs:c=>e(u=>({logs:{...u.logs,[c]:[]}})),handleMessage:(c,u)=>{switch(c){case"backgroundProcess.started":{const{processId:f,name:l,pid:d,status:p}=u;e(g=>({processes:[...g.processes,{id:f,sessionId:"",name:l,command:"",cwd:"",pid:d,status:p,exitCode:null,createdAt:Date.now(),startedAt:Date.now(),endedAt:null}]}));break}case"backgroundProcess.output":{const f=u.processId,l=u.stream,d=u.content;r().appendLog(f,l,d);break}case"backgroundProcess.exited":{const f=u.processId,l=u.exitCode;e(d=>({processes:d.processes.map(p=>p.id===f?{...p,status:"exited",exitCode:l}:p)}));break}case"backgroundProcess.removed":{const f=u.processId;r().removeProcess(f);break}}}}}),ti={GLOBAL_INSTRUCTIONS:"global_instructions",NOTIFICATION_SETTINGS:"notification_settings"};function yl(e,r){return i=>({loading:{...i.loading,[e]:r}})}function kx(e,r){return i=>({settings:{...i.settings,[e]:r},loading:{...i.loading,[e]:!1}})}const ni=Wn(e=>({settings:{},loading:{},getSetting:async r=>{e(yl(r,!0));try{const s=await(await Ce(`/api/settings/${r}`)).json();return e(kx(r,s.value??"")),s.value}catch{return e(yl(r,!1)),null}},setSetting:async(r,i)=>{e(yl(r,!0));try{const c=await(await Ce(`/api/settings/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:i})})).json();e(kx(r,c.value??""))}catch{e(yl(r,!1))}}})),bS=[{key:"complete",label:"Task Complete",description:"When an agent finishes its work"},{key:"waiting_for_user",label:"Waiting for Input",description:"When the agent needs your input"},{key:"phase_done",label:"Phase Done",description:"When a build phase completes successfully"},{key:"phase_blocked",label:"Phase Blocked",description:"When a build phase is blocked and needs intervention"},{key:"new_message",label:"New Message",description:"When a new assistant message starts arriving"}],yS=[{url:"/sounds/notification.mp3",label:"Notification"},{url:"/sounds/waiting-for-user.mp3",label:"Waiting for User"},{url:"/sounds/achievement.mp3",label:"Achievement"},{url:"/sounds/intervention.mp3",label:"Intervention"},{url:"/sounds/typing.mp3",label:"Typing"}],mb={complete:"/sounds/notification.mp3",waiting_for_user:"/sounds/waiting-for-user.mp3",phase_done:"/sounds/achievement.mp3",phase_blocked:"/sounds/intervention.mp3",new_message:"/sounds/typing.mp3"},ri={soundEnabled:!0,browserNotification:!1,customSoundUrl:null},gb={soundEnabled:!1,browserNotification:!1,customSoundUrl:null},Qd={soundEnabled:!0,browserNotificationEnabled:!1,events:{complete:{...ri},waiting_for_user:{...ri},phase_done:{...ri},phase_blocked:{...ri},new_message:{...gb}},agentOverrides:{}};function xb(e,r,i){var u;const s=e.events[r];if(!i)return s;const c=(u=e.agentOverrides[i])==null?void 0:u[r];return c?{soundEnabled:c.soundEnabled??s.soundEnabled,browserNotification:c.browserNotification??s.browserNotification,customSoundUrl:c.customSoundUrl!==void 0?c.customSoundUrl:s.customSoundUrl}:s}const Ti=Wn((e,r)=>({settings:Qd,loaded:!1,load:()=>{ni.getState().getSetting(ti.NOTIFICATION_SETTINGS);const s=ni.subscribe(u=>{const f=u.settings[ti.NOTIFICATION_SETTINGS];if(f!==void 0)try{const l=JSON.parse(f);e({settings:Ex(l),loaded:!0})}catch{e({loaded:!0})}}),c=ni.getState().settings[ti.NOTIFICATION_SETTINGS];if(c)try{const u=JSON.parse(c);e({settings:Ex(u),loaded:!0})}catch{e({loaded:!0})}return s},update:i=>{e({settings:i}),Ed(i)},updateEvent:(i,s)=>{const c=r().settings,u={...c,events:{...c.events,[i]:{...c.events[i],...s}}};e({settings:u}),Ed(u)},updateAgentOverride:(i,s,c)=>{var d;const u=r().settings,f={...u.agentOverrides};if(c===null){if(f[i]){const p={...f[i]};delete p[s],Object.keys(p).length===0?delete f[i]:f[i]=p}}else f[i]={...f[i],[s]:{...((d=f[i])==null?void 0:d[s])??{},...c}};const l={...u,agentOverrides:f};e({settings:l}),Ed(l)}}));function Ed(e){ni.getState().setSetting(ti.NOTIFICATION_SETTINGS,JSON.stringify(e))}function Ex(e){var r,i,s,c,u;return{soundEnabled:e.soundEnabled??Qd.soundEnabled,browserNotificationEnabled:e.browserNotificationEnabled??Qd.browserNotificationEnabled,events:{complete:{...ri,...(r=e.events)==null?void 0:r.complete},waiting_for_user:{...ri,...(i=e.events)==null?void 0:i.waiting_for_user},phase_done:{...ri,...(s=e.events)==null?void 0:s.phase_done},phase_blocked:{...ri,...(c=e.events)==null?void 0:c.phase_blocked},new_message:{...gb,...(u=e.events)==null?void 0:u.new_message}},agentOverrides:e.agentOverrides??{}}}const jx=new Map;function _S(e){let r=jx.get(e);return r||(r=new Audio(e),r.volume=.5,jx.set(e,r)),r}let vb=typeof Notification<"u"?Notification.permission:"denied";function SS(){return typeof Notification>"u"?Promise.resolve("denied"):Notification.requestPermission().then(e=>(vb=e,e))}const wS={complete:"Task Complete",waiting_for_user:"Waiting for Input",phase_done:"Phase Complete",phase_blocked:"Phase Blocked",new_message:"New Message"},CS={complete:"The agent has finished its work.",waiting_for_user:"The agent needs your input to continue.",phase_done:"The build phase completed successfully.",phase_blocked:"The build phase is blocked and needs intervention.",new_message:"A new assistant message is arriving."};function kS(e){typeof Notification>"u"||vb==="granted"&&(document.hasFocus()||new Notification(wS[e],{body:CS[e],icon:"/fox.svg",tag:`openfox-${e}`}))}function Ja(e,r){const{settings:i}=Ti.getState(),s=xb(i,e,r);if(i.soundEnabled&&s.soundEnabled){const c=s.customSoundUrl??mb[e],u=_S(c);u.currentTime=0,u.play().catch(()=>{})}i.browserNotificationEnabled&&s.browserNotification&&kS(e)}const ES=e=>Ja("complete",e),jS=e=>Ja("phase_done",e),NS=e=>Ja("phase_blocked",e),Nx=e=>Ja("waiting_for_user",e),TS=e=>Ja("new_message",e);let Aa=!1,nr=null;const jd=new Set,Ht={messageId:null,deltaContent:"",thinkingContent:"",toolOutput:[]};let Ds=null,an=null;function Nd(){Ds===null&&(Ds=requestAnimationFrame(()=>{Ds=null,an==null||an()}))}function ki(){Ds!==null&&(cancelAnimationFrame(Ds),Ds=null)}function At(e,r){return r!==null&&e.sessionId===r}function AS(e,r,i){return e.id!==void 0||At(e,r)||i===!0&&e.sessionId!==void 0}function DS(e,r){return e.includes(r)?e:[...e,r]}function Da(e,r){return e.filter(i=>i!==r)}function LS(e,r){const i=e.find(c=>c.id===r.id),s=i?{...i,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,messageCount:r.messages.length,criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length}:{id:r.id,projectId:r.projectId,workdir:r.workdir,mode:r.mode,phase:r.phase,isRunning:r.isRunning,createdAt:"",updatedAt:"",criteriaCount:r.criteria.length,criteriaCompleted:r.criteria.filter(c=>c.status.type==="passed").length,messageCount:r.messages.length};return i?e.map(c=>c.id===r.id?s:c):[s,...e]}function RS(e,r,i){return e.map(s=>{const c=(i==null?void 0:i.id)===s.id?i:null,u=r.find(f=>f.id===s.id);return{...s,title:s.title??(u==null?void 0:u.title),mode:(c==null?void 0:c.mode)??(u==null?void 0:u.mode)??s.mode,phase:(c==null?void 0:c.phase)??(u==null?void 0:u.phase)??s.phase,isRunning:(c==null?void 0:c.isRunning)??(u==null?void 0:u.isRunning)??s.isRunning,messageCount:s.messageCount,recentUserPrompts:s.recentUserPrompts}})}const Tx=new Map;function za(e,r){var u;const i=r===((u=e.currentSession)==null?void 0:u.id)?e.currentSession:null,s=e.sessions.find(f=>f.id===r),c=(i==null?void 0:i.mode)??(s==null?void 0:s.mode);return c==="planner"?"planner":c==="builder"?"build":"planner"}function MS(e,r){if(e.type==="chat.done"){const i=e.payload,s=za(r,e.sessionId),c=i.agentType??s;i.reason==="complete"&&ES(c),i.reason==="waiting_for_user"&&Nx(c);return}if(e.type==="chat.path_confirmation"){const i=za(r,e.sessionId);Nx(i);return}if(e.type==="task.completed"){const i=za(r,e.sessionId);jS(i);return}if(e.type==="phase.changed"&&e.sessionId){const i=e.payload,s=Tx.get(e.sessionId)??null;if(Tx.set(e.sessionId,i.phase),s===i.phase)return;const c=za(r,e.sessionId);i.phase==="blocked"&&NS(c)}}const Ee=Wn((e,r)=>(an=()=>{const i=Ht;if(!i.messageId)return;const s=i.deltaContent.length>0,c=i.thinkingContent.length>0,u=i.toolOutput.length>0;if(!s&&!c&&!u)return;const f=i.deltaContent,l=i.thinkingContent,d=i.toolOutput;i.deltaContent="",i.thinkingContent="",i.toolOutput=[],e(p=>{var m;const g=p.streamingMessage;if(g&&g.id===i.messageId){let y={...g};if(s&&(y.content=y.content+f),c&&(y.thinkingContent=(y.thinkingContent??"")+l),u){const _=new Set;y.toolCalls=(m=y.toolCalls)==null?void 0:m.map(C=>{const v=d.filter(b=>b.callId===C.id);return v.length===0?C:(_.add(C.id),{...C,streamingOutput:[...C.streamingOutput??[],...v.map(b=>({stream:b.stream,content:b.content}))]})});const k=d.filter(C=>!_.has(C.callId));k.length>0&&Ht.toolOutput.push(...k)}return{streamingMessage:y}}if(u){const y=new Set,_=p.messages.map(C=>{var b;if(C.id!==i.messageId)return C;const v=(b=C.toolCalls)==null?void 0:b.map(x=>{const S=d.filter(j=>j.callId===x.id);return S.length===0?x:(y.add(x.id),{...x,streamingOutput:[...x.streamingOutput??[],...S.map(j=>({stream:j.stream,content:j.content}))]})});return{...C,toolCalls:v}}),k=d.filter(C=>!y.has(C.callId));return k.length>0&&Ht.toolOutput.push(...k),{messages:_}}return p})},{connectionStatus:"disconnected",showPasswordModal:!1,passwordModalRetry:!1,sessions:[],currentSession:null,unreadSessionIds:[],messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,subAgentContextStates:{},pendingPathConfirmation:null,pendingQuestion:null,visionFallbackByMessage:{},queuedMessages:[],abortInProgress:!1,error:null,sessionsHasMore:!0,sessionsPaginationLoading:!1,pendingSessionCreate:!1,connect:async()=>{const i=r().connectionStatus;if(i==="connected"||i==="reconnecting")return;e({connectionStatus:"reconnecting"});let s=!1;try{s=(await(await Ce("/api/auth")).json()).requiresAuth}catch{}if(s&&!Pt.hasToken()){e({showPasswordModal:!0,passwordModalRetry:!1,connectionStatus:"reconnecting"});return}Pt.onStatusChange(c=>{e({connectionStatus:c}),c==="connected"&&r().listSessions(void 0)});try{if(await Pt.connect(),!Aa){Aa=!0;const c=r().handleServerMessage;nr=Pt.subscribe(c)}}catch(c){console.error("Failed to connect:",c);const u=Pt.getLastCloseCode();if(!Pt.hasToken()&&(u===1006||u===4e3)){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"disconnected"})}},reconnect:()=>{Pt.disconnect(),nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"reconnecting"}),r().connect()},disconnect:()=>{Pt.disconnect(),nr&&(nr(),nr=null),Aa=!1,e({connectionStatus:"disconnected",showPasswordModal:!1})},submitPassword:async i=>{try{const s=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:i})});if(!s.ok){e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"});return}const{token:c}=await s.json();Pt.setToken(c),e({showPasswordModal:!1}),r().connect();const{listProjects:u}=Gt.getState(),{fetchConfig:f}=kt.getState();u(),f(),r().connect()}catch{e({showPasswordModal:!0,passwordModalRetry:!0,connectionStatus:"reconnecting"})}},cancelPassword:()=>{Pt.clearToken(),e({showPasswordModal:!1,connectionStatus:"disconnected"})},createSession:async(i,s)=>{try{e({pendingSessionCreate:!0});const c=await Ce("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:i,title:s})});if(!c.ok)return e({pendingSessionCreate:!1}),null;const u=await c.json();return Pt.send("session.load",{sessionId:u.session.id}),u.session}catch{return e({pendingSessionCreate:!1}),null}},loadSession:async i=>{try{const s=r().currentSession;!s||s.id!==i?(ki(),e({currentSession:null,unreadSessionIds:Da(r().unreadSessionIds,i),subAgentContextStates:{},messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,pendingPathConfirmation:null,queuedMessages:[],abortInProgress:!1,error:null})):e({unreadSessionIds:Da(r().unreadSessionIds,i)});const c=await Ce(`/api/sessions/${i}`);if(!c.ok)return;const u=await c.json();e({currentSession:u.session,messages:u.messages??[],contextState:u.contextState,queuedMessages:u.queueState??[]}),Pt.send("session.load",{sessionId:i});try{const f=await Ce(`/api/sessions/${i}/background-processes`);if(f.ok){const l=await f.json();Pa.getState().setProcesses(l.processes??[])}}catch{}}catch{}},listSessions:async(i,s=20)=>{try{const c=new URLSearchParams;c.set("limit",String(s)),i&&c.set("projectId",i);const f=await(await Ce(`/api/sessions?${c.toString()}`)).json();e({sessions:f.sessions??[],sessionsHasMore:i?f.hasMore??!1:!0})}catch{}},loadMoreSessions:async i=>{const s=r();if(!(s.sessionsPaginationLoading||!s.sessionsHasMore)){e({sessionsPaginationLoading:!0});try{const c=new URLSearchParams;c.set("limit","20"),c.set("offset",String(s.sessions.length)),c.set("projectId",i);const f=await(await Ce(`/api/sessions?${c.toString()}`)).json();e(l=>({sessions:[...l.sessions,...f.sessions??[]],sessionsHasMore:f.hasMore??!1,sessionsPaginationLoading:!1}))}catch{e({sessionsPaginationLoading:!1})}}},deleteSession:async i=>{var s;try{return(await Ce(`/api/sessions/${i}`,{method:"DELETE"})).ok?(await r().listSessions(),((s=r().currentSession)==null?void 0:s.id)===i&&r().clearSession(),!0):!1}catch{return!1}},deleteAllSessions:async i=>{try{return(await Ce(`/api/projects/${i}/sessions`,{method:"DELETE"})).ok?(await r().listSessions(),!0):!1}catch{return!1}},clearSession:()=>{ki(),e(i=>({currentSession:null,messages:[],streamingMessageId:null,streamingMessage:null,currentTodos:[],contextState:null,unreadSessionIds:i.currentSession?Da(i.unreadSessionIds,i.currentSession.id):i.unreadSessionIds}))},sendMessage:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u){e({streamingMessageId:null});try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c==null?void 0:c.messageKind})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error sending message:",l)}}},stopGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i&&!r().abortInProgress){ki(),an==null||an(),e({abortInProgress:!0});try{await Ce(`/api/sessions/${i}/stop`,{method:"POST"})}catch(c){console.error("Error stopping generation:",c)}}},continueGeneration:async()=>{var s;const i=(s=r().currentSession)==null?void 0:s.id;if(i){e({streamingMessageId:null});try{await Ce(`/api/sessions/${i}/continue`,{method:"POST"})}catch(c){console.error("Error continuing generation:",c)}}},launchRunner:(i,s,c)=>{e({streamingMessageId:null});const u={};i!=null&&i.trim()&&(u.content=i),s&&s.length>0&&(u.attachments=s),c&&(u.workflowId=c),Pt.send("runner.launch",u)},switchMode:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/mode`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:i})});if(!u.ok){console.error("Failed to switch mode:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching mode:",u)}},switchDangerLevel:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/danger-level`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dangerLevel:i})});if(!u.ok){console.error("Failed to switch danger level:",await u.json());return}const f=await u.json();f.session&&e({currentSession:f.session})}catch(u){console.error("Error switching danger level:",u)}},acceptAndBuild:(i,s,c)=>{e({streamingMessageId:null});const u={};i&&(u.workflowId=i),s!=null&&s.trim()&&(u.content=s),c&&c.length>0&&(u.attachments=c),Pt.send("mode.accept",u)},editCriteria:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const u=await Ce(`/api/sessions/${s}/criteria`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({criteria:i})});u.ok||console.error("Failed to update criteria:",await u.json())}catch(u){console.error("Error updating criteria:",u)}},compactContext:()=>{Pt.send("context.compact",{})},setSessionProvider:async(i,s)=>{var c;try{const u=(c=r().currentSession)==null?void 0:c.id;if(!u)return null;const f=await Ce(`/api/sessions/${u}/provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerId:i,...s?{model:s}:{}})});if(!f.ok)return null;const l=await f.json();return e({currentSession:l.session,messages:l.messages??[],contextState:l.contextState}),l.session}catch{return null}},updateContextState:i=>{e({contextState:i})},updateSubAgentContextState:(i,s)=>{e(c=>({subAgentContextStates:{...c.subAgentContextStates,[i]:s}}))},clearSubAgentContextState:i=>{e(s=>{const c={...s.subAgentContextStates};return delete c[i],{subAgentContextStates:c}})},confirmPath:async(i,s,c=!1)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{await Ce(`/api/sessions/${u}/confirm-path`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,approved:s,alwaysAllow:c})})}catch(l){console.error("Error confirming path:",l)}},answerQuestion:async(i,s)=>{var u;const c=(u=r().currentSession)==null?void 0:u.id;if(c){try{await Ce(`/api/sessions/${c}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callId:i,answer:s})})}catch(f){console.error("Error answering question:",f)}e({pendingQuestion:null})}},queueAsap:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing ASAP message:",l)}},queueCompletion:async(i,s,c)=>{var f;const u=(f=r().currentSession)==null?void 0:f.id;if(u)try{const d=await(await Ce(`/api/sessions/${u}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i,attachments:s,messageKind:c})})).json();d.queueState&&e({queuedMessages:d.queueState})}catch(l){console.error("Error queueing completion message:",l)}},cancelQueued:async i=>{var c;const s=(c=r().currentSession)==null?void 0:c.id;if(s)try{const f=await(await Ce(`/api/sessions/${s}/queue/${i}`,{method:"DELETE"})).json();f.queueState&&e({queuedMessages:f.queueState})}catch(u){console.error("Error canceling queued message:",u)}},clearError:()=>{e({error:null})},resetPendingSessionCreate:()=>{e({pendingSessionCreate:!1})},handleServerMessage:i=>{var f,l,d,p,g,m,y,_,k,C,v,b,x,S,j,A,N,D,T,I,H,V,Y,q;const s=r();MS(i,s);const c=((f=s.currentSession)==null?void 0:f.id)??null,u=()=>{const O=i.sessionId;!O||O===c||e(U=>({unreadSessionIds:DS(U.unreadSessionIds,O)}))};switch(i.type){case"session.state":{const O=i.payload;if(!AS(i,c,s.pendingSessionCreate))break;ki();const U=O.messages.find(L=>L.isStreaming)??null,z=r().pendingSessionCreate===!0,X=O.pendingConfirmations??[],M=s.pendingPathConfirmation??(X.length>0?X[0]??null:null);if(e({currentSession:O.session,sessions:LS(r().sessions,O.session),unreadSessionIds:Da(r().unreadSessionIds,O.session.id),messages:O.messages,streamingMessageId:(U==null?void 0:U.id)??null,streamingMessage:U,currentTodos:[],pendingPathConfirmation:M,error:null,...z?{pendingSessionCreate:O.session.id}:{}}),O.session.providerId&&O.session.providerModel){const L=kt.getState();L.providers.find(W=>W.id===O.session.providerId)&&L.syncFromSession(O.session.providerId,O.session.providerModel)}break}case"session.list":{const O=i.payload;e(U=>({sessions:RS(O.sessions,U.sessions,U.currentSession)}));break}case"session.deleted":{const O=i.payload;e(U=>({unreadSessionIds:Da(U.unreadSessionIds,O.sessionId)})),r().listSessions();break}case"session.deletedAll":{r().listSessions();break}case"session.running":{const O=i.payload,U=i.sessionId,z=(l=r().currentSession)==null?void 0:l.id,X=U&&U!==z;e(Q=>({sessions:Q.sessions.map(M=>M.id===U?{...M,isRunning:O.isRunning}:M)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,isRunning:O.isRunning}:null,...O.isRunning?{}:{abortInProgress:!1,queuedMessages:[]}}));break}case"chat.message":{if(!At(i,((d=r().currentSession)==null?void 0:d.id)??null)){u();break}const O=i.payload;e(U=>U.messages.some(z=>z.id===O.message.id)?U:{messages:[...U.messages,O.message],streamingMessageId:O.message.isStreaming?O.message.id:U.streamingMessageId,streamingMessage:O.message.isStreaming?O.message:U.streamingMessage});break}case"chat.message_updated":{if(!At(i,((p=r().currentSession)==null?void 0:p.id)??null)){u();break}const O=i.payload,U=O.updates.isStreaming===!1&&r().streamingMessageId===O.messageId;U&&(ki(),an==null||an()),e(z=>{const X=z.streamingMessage,Q=U;if(X&&X.id===O.messageId){const M={...X,...O.updates};return{messages:z.messages.map(L=>L.id===O.messageId?M:L),streamingMessageId:Q?null:z.streamingMessageId,streamingMessage:Q?null:{...X,...O.updates}}}return{messages:z.messages.map(M=>M.id===O.messageId?{...M,...O.updates}:M),streamingMessageId:Q?null:z.streamingMessageId}});break}case"chat.delta":{if(!At(i,((g=r().currentSession)==null?void 0:g.id)??null)){u();break}const O=i.payload;if(!jd.has(O.messageId)){jd.add(O.messageId);const U=za(r(),i.sessionId);TS(U)}Ht.messageId=O.messageId,Ht.deltaContent+=O.content,Nd();break}case"chat.thinking":{if(!At(i,((m=r().currentSession)==null?void 0:m.id)??null)){u();break}const O=i.payload;Ht.messageId=O.messageId,Ht.thinkingContent+=O.content,Nd();break}case"chat.tool_preparing":{if(!At(i,((y=r().currentSession)==null?void 0:y.id)??null)){u();break}const O=i.payload;e(U=>{const z=U.streamingMessage;return z&&z.id===O.messageId?{streamingMessage:{...z,preparingToolCalls:[...z.preparingToolCalls??[],{index:O.index,name:O.name}]}}:{messages:U.messages.map(X=>X.id===O.messageId?{...X,preparingToolCalls:[...X.preparingToolCalls??[],{index:O.index,name:O.name}]}:X)}});break}case"chat.tool_call":{if(!At(i,((_=r().currentSession)==null?void 0:_.id)??null)){u();break}const O=i.payload,U=z=>{var M;const X=(M=z.preparingToolCalls)==null?void 0:M.filter((L,B)=>{var W;return L.name===O.tool?(W=z.preparingToolCalls)==null?void 0:W.slice(0,B).some(re=>re.name===O.tool):!0}),Q=Ht.toolOutput.filter(L=>L.callId===O.callId);return Q.length>0&&(Ht.toolOutput=Ht.toolOutput.filter(L=>L.callId!==O.callId)),{...z,toolCalls:[...z.toolCalls??[],{id:O.callId,name:O.tool,arguments:O.args,startedAt:Date.now(),...Q.length>0?{streamingOutput:Q.map(L=>({stream:L.stream,content:L.content}))}:{}}],...X&&X.length>0?{preparingToolCalls:X}:{preparingToolCalls:void 0}}};e(z=>{const X=z.streamingMessage;return X&&X.id===O.messageId?{streamingMessage:U(X)}:{messages:z.messages.map(Q=>Q.id===O.messageId?U(Q):Q)}});break}case"chat.tool_output":{if(!At(i,((k=r().currentSession)==null?void 0:k.id)??null)){u();break}const O=i.payload;Ht.messageId=O.messageId,Ht.toolOutput.push({messageId:O.messageId,callId:O.callId,stream:O.stream,content:O.output}),Nd();break}case"chat.tool_result":{if(!At(i,((C=r().currentSession)==null?void 0:C.id)??null)){u();break}const O=i.payload,U=z=>{var Q;const X=(Q=z.toolCalls)==null?void 0:Q.map(M=>M.id===O.callId?{...M,result:O.result}:M);return{...z,toolCalls:X}};e(z=>{const X=z.streamingMessage;return X&&X.id===O.messageId?{streamingMessage:U(X)}:{messages:z.messages.map(Q=>Q.id===O.messageId?U(Q):Q)}});break}case"chat.vision_fallback":{if(!At(i,((v=r().currentSession)==null?void 0:v.id)??null)){u();break}const O=i.payload;e(U=>{const z=`${O.messageId}-${O.attachmentId}`,X={...U.visionFallbackByMessage};return X[z]={type:O.type,attachmentId:O.attachmentId,filename:O.filename,description:O.description},{visionFallbackByMessage:X}});break}case"chat.todo":{if(!At(i,((b=r().currentSession)==null?void 0:b.id)??null)){u();break}const O=i.payload;e({currentTodos:O.todos});break}case"chat.summary":{if(!At(i,((x=r().currentSession)==null?void 0:x.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,summary:O.summary}:null}));break}case"chat.progress":{if(!At(i,((S=r().currentSession)==null?void 0:S.id)??null)){u();break}const O=i.payload;console.log("Progress:",O.message,O.phase);break}case"chat.format_retry":{if(!At(i,((j=r().currentSession)==null?void 0:j.id)??null)){u();break}const O=i.payload;console.log("Format retry:",O.attempt,"/",O.maxAttempts);break}case"chat.done":{if(!At(i,((A=r().currentSession)==null?void 0:A.id)??null)){u();break}ki(),an==null||an();const O=i.payload,U=O.stats;Ht.messageId=null,Ht.deltaContent="",Ht.thinkingContent="",Ht.toolOutput=[],jd.delete(O.messageId),e(z=>{const X=z.streamingMessage,Q=X&&X.id===O.messageId?{...X,isStreaming:!1,stats:U??X.stats}:null;return{messages:z.messages.map(M=>M.id===O.messageId?Q??{...M,isStreaming:!1,stats:U??M.stats}:M),streamingMessageId:null,streamingMessage:null,visionFallbackByMessage:{}}});break}case"chat.error":{if(!At(i,((N=r().currentSession)==null?void 0:N.id)??null)){u();break}ki(),an==null||an();const O=i.payload;console.error("Chat error:",O.error,"recoverable:",O.recoverable),O.recoverable||(Ht.messageId=null,Ht.deltaContent="",Ht.thinkingContent="",Ht.toolOutput=[]),e(U=>({error:{code:"CHAT_ERROR",message:O.error},streamingMessageId:O.recoverable?U.streamingMessageId:null,...O.recoverable?{}:{messages:U.streamingMessage?U.messages.map(z=>z.id===U.streamingMessage.id?U.streamingMessage:z):U.messages,streamingMessage:null}}));break}case"chat.path_confirmation":{if(!At(i,((D=r().currentSession)==null?void 0:D.id)??null)){u();break}const O=i.payload;e({pendingPathConfirmation:{callId:O.callId,tool:O.tool,paths:O.paths,workdir:O.workdir,reason:O.reason}});break}case"chat.ask_user":{if(!At(i,((T=r().currentSession)==null?void 0:T.id)??null)){u();return}const O=i.payload;e({pendingQuestion:{callId:O.callId,question:O.question}});break}case"mode.changed":{if(!At(i,((I=r().currentSession)==null?void 0:I.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,mode:O.mode}:null}));break}case"phase.changed":{const O=i.payload,U=i.sessionId,z=(H=r().currentSession)==null?void 0:H.id,X=U&&U!==z;e(Q=>({sessions:Q.sessions.map(M=>M.id===U?{...M,phase:O.phase}:M)})),X||e(Q=>({currentSession:Q.currentSession?{...Q.currentSession,phase:O.phase}:null}));break}case"criteria.updated":{if(!At(i,((V=r().currentSession)==null?void 0:V.id)??null)){u();break}const O=i.payload;e(U=>({currentSession:U.currentSession?{...U.currentSession,criteria:O.criteria}:null}));break}case"context.state":{const O=i.payload,U=At(i,((Y=r().currentSession)==null?void 0:Y.id)??null);O.subAgentId?U&&r().updateSubAgentContextState(O.subAgentId,O.context):U?e({contextState:O.context}):u();break}case"session.name_generated":{const O=i.payload,U=i.sessionId,z=(q=r().currentSession)==null?void 0:q.id;e(X=>{const Q=X.sessions.map(L=>L.id===U?{...L,title:O.name,updatedAt:new Date().toISOString()}:L),M=z===U?X.currentSession?{...X.currentSession,title:O.name,updatedAt:new Date().toISOString()}:null:X.currentSession;return{sessions:Q,currentSession:M}});break}case"queue.state":{const O=i.payload;e({queuedMessages:O.messages});break}case"devServer.output":case"devServer.state":{ir.getState().handleMessage(i);break}case"backgroundProcess.started":case"backgroundProcess.output":case"backgroundProcess.exited":case"backgroundProcess.removed":{Pa.getState().handleMessage(i.type,i.payload);break}case"error":{const O=i.payload;console.error("Server error:",O),e({error:{code:O.code,message:O.message},streamingMessageId:null});break}}}}));function bb(){return Ee(e=>{var r;return((r=e.currentSession)==null?void 0:r.isRunning)??!1})}function OS(){return Ee(e=>e.queuedMessages)}function BS(){return Ee(e=>e.abortInProgress)}function IS(){const e=Ee(s=>s.connect),r=Ee(s=>s.connectionStatus),i=Ti(s=>s.load);return P.useEffect(()=>{e()},[e]),P.useEffect(()=>{r==="connected"&&i()},[r,i]),{connectionStatus:r}}function Jd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const r=Math.random()*16|0;return(e==="x"?r:r&3|8).toString(16)})}function Ax(e,r){const i=Pt.ws;!i||i.readyState!==WebSocket.OPEN||i.send(JSON.stringify({id:Jd(),type:e,payload:r}))}const sr=Wn((e,r)=>({isOpen:!1,sessions:[],workdir:null,setOpen:i=>e({isOpen:i}),toggleOpen:()=>e(i=>({isOpen:!i.isOpen})),setWorkdir:i=>e({workdir:i}),fetchSessions:async()=>{try{const i=await Ce("/api/terminals");if(i.ok){const s=await i.json();e({sessions:s});const c=Pt.ws;if(c&&c.readyState===WebSocket.OPEN)for(const u of s)c.send(JSON.stringify({id:Jd(),type:"terminal.subscribe",payload:{sessionId:u.id}}))}}catch(i){console.error("Failed to fetch terminals:",i)}},createSession:async i=>{try{const s=await Ce("/api/terminals",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:i??r().workdir??void 0})});if(s.ok){const c=await s.json();e(f=>({sessions:[...f.sessions,c]}));const u=Pt.ws;u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({id:Jd(),type:"terminal.subscribe",payload:{sessionId:c.id}}))}}catch(s){console.error("Failed to create terminal:",s)}},writeSession:(i,s)=>{Ax("terminal.write",{sessionId:i,data:s})},resizeSession:(i,s,c)=>{Ax("terminal.resize",{sessionId:i,cols:s,rows:c})},killSession:async i=>{try{(await Ce(`/api/terminals/${i}`,{method:"DELETE"})).ok&&e(c=>({sessions:c.sessions.filter(u=>u.id!==i)}))}catch(s){console.error("Failed to kill terminal:",s)}},handleMessage:i=>{switch(i.type){case"terminal.exit":{const{sessionId:s}=i.payload||{};s&&e(c=>{const u=c.sessions.filter(f=>f.id!==s);return u.length===0&&c.isOpen?{sessions:[],isOpen:!1}:{sessions:u}});break}}}}));Pt.subscribe(e=>{var r;(r=e.type)!=null&&r.startsWith("terminal.")&&sr.getState().handleMessage(e)});const yh=P.forwardRef(({icon:e,iconSize:r="w-3.5 h-3.5",className:i="",...s},c)=>o.jsx("button",{ref:c,type:"button",className:`p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors ${i}`,...s,children:o.jsx("svg",{className:r,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:e})})}));yh.displayName="IconButton";const zS="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z",Mi=P.forwardRef((e,r)=>o.jsx(yh,{ref:r,icon:zS,title:"Edit",...e}));Mi.displayName="EditButton";const HS="M6 18L18 6M6 6l12 12",$l=P.forwardRef((e,r)=>o.jsx(yh,{ref:r,icon:HS,...e}));$l.displayName="CloseButton";var ql=ib();function cn({isOpen:e,onClose:r,title:i,children:s,size:c="md"}){const u=P.useRef(null),f=P.useRef(null),l=P.useCallback(p=>{p.key==="Escape"&&r()},[r]);if(P.useEffect(()=>{var p,g;return e?(f.current=document.activeElement,(p=u.current)==null||p.focus(),document.body.style.overflow="hidden"):((g=f.current)==null||g.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}},[e]),P.useEffect(()=>{if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,l]),!e)return null;const d={sm:"max-w-sm md:max-w-sm",md:"max-w-[90vw] md:max-w-md",lg:"max-w-[90vw] md:max-w-2xl h-[80vh]",xl:"max-w-[90vw] md:max-w-4xl h-[80vh]",full:"max-w-[95vw] h-[90vh]"};return ql.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),o.jsxs("div",{ref:u,tabIndex:-1,className:`relative w-full ${d[c]} bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]`,children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary truncate",children:i}),o.jsx($l,{onClick:r,className:"flex-shrink-0","aria-label":"Close modal"})]}),o.jsx("div",{className:"p-4 overflow-y-auto flex-1 min-h-0",children:s})]})]}),document.body)}const st=P.forwardRef(({variant:e="secondary",size:r="md",className:i="",children:s,...c},u)=>{const f="rounded font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",l={primary:"bg-accent-primary/25 text-white hover:bg-accent-primary/40",secondary:"bg-bg-tertiary text-text-primary hover:bg-border",danger:"bg-accent-error text-white hover:bg-accent-error/80"},d={sm:"px-1.5 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"};return o.jsx("button",{ref:u,className:`${f} ${l[e]} ${d[r]} ${i}`,...c,children:s})});st.displayName="Button";function PS({value:e,defaultUrl:r,disabled:i,onChange:s}){const c=e??r;return o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:c,disabled:i,onChange:u=>{const f=u.target.value;s(f===r?null:f)},className:"appearance-none bg-bg-tertiary border border-border rounded px-1.5 pr-5 text-xs focus:outline-none focus:ring-1 focus:ring-accent-primary disabled:opacity-40 cursor-pointer",style:{width:"60px"},children:yS.map(({url:u,label:f})=>o.jsx("option",{value:u,title:f,children:f.split(" ")[0]},u))}),o.jsx("svg",{className:"absolute right-0.5 top-1/2 -translate-y-1/2 w-3 h-3 pointer-events-none text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}const Dx=[{key:"general",label:"General"},{key:"build",label:"Agent"},{key:"sub-agent",label:"Sub-agent"}];function FS(){const e=Ti(d=>d.settings),r=Ti(d=>d.update),i=Ti(d=>d.updateEvent),s=Ti(d=>d.updateAgentOverride),c=Ti(d=>d.load);P.useEffect(()=>{c()},[c]);const u=async()=>{await SS()==="granted"&&r({...e,browserNotificationEnabled:!0})},f=(d,p,g,m)=>{d==="general"?i(p,{[g]:m}):s(d,p,{[g]:m})},l=(d,p,g)=>{d==="general"?i(p,{customSoundUrl:g}):s(d,p,{customSoundUrl:g})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Master Controls"}),o.jsx(Lx,{label:"Sound notifications",description:"Play sounds when events occur",checked:e.soundEnabled,onChange:d=>r({...e,soundEnabled:d})}),o.jsx(Lx,{label:"Browser notifications",description:"Show desktop notifications when the window is not focused",checked:e.browserNotificationEnabled,onChange:d=>{d&&typeof Notification<"u"&&Notification.permission!=="granted"?u():r({...e,browserNotificationEnabled:d})}}),typeof Notification<"u"&&Notification.permission==="denied"&&e.browserNotificationEnabled&&o.jsx("p",{className:"text-xs text-accent-error ml-6",children:"Browser notifications are blocked. Please enable them in your browser settings."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"Notification Settings"}),o.jsx("div",{className:"border border-border rounded overflow-hidden",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-bg-tertiary",children:o.jsxs("tr",{className:"border-b border-border",children:[o.jsx("th",{className:"text-left px-3 py-2 text-text-primary font-medium w-40",children:"Event"}),Dx.map(d=>o.jsx("th",{className:"text-center px-2 py-2 text-text-primary font-medium",children:d.label},d.key))]})}),o.jsx("tbody",{children:bS.map(d=>o.jsxs("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-secondary/50",children:[o.jsx("td",{className:"px-3 py-2",children:o.jsx("div",{className:"text-text-primary text-xs",children:d.label})}),Dx.map(p=>{const g=xb(e,d.key,p.key==="general"?void 0:p.key),m=mb[d.key];return o.jsx("td",{className:"px-2 py-2 align-top",children:o.jsxs("div",{className:"flex flex-col items-center gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.soundEnabled,onChange:y=>f(p.key,d.key,"soundEnabled",y.target.checked),disabled:!e.soundEnabled,className:"rounded border-border",title:"Sound"})}),o.jsx("label",{className:"flex items-center gap-1 text-text-secondary",children:o.jsx("input",{type:"checkbox",checked:g.browserNotification,onChange:y=>f(p.key,d.key,"browserNotification",y.target.checked),disabled:!e.browserNotificationEnabled,className:"rounded border-border",title:"Browser"})})]}),g.soundEnabled&&e.soundEnabled&&o.jsx(PS,{value:g.customSoundUrl,defaultUrl:m,disabled:!e.soundEnabled,onChange:y=>l(p.key,d.key,y)})]})},p.key)})]},d.key))})]})})]})]})}function Lx({label:e,description:r,checked:i,onChange:s}){return o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[o.jsx("div",{className:"pt-0.5",children:o.jsx("div",{className:`relative w-9 h-5 rounded-full transition-colors ${i?"bg-accent-primary":"bg-bg-tertiary border border-border"}`,onClick:c=>{c.preventDefault(),s(!i)},children:o.jsx("div",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm text-text-primary group-hover:text-accent-primary transition-colors",children:e}),o.jsx("div",{className:"text-xs text-text-muted",children:r})]})]})}async function _h(e,r){r({loading:!0});try{const s=await(await Ce(e)).json();r({defaults:s.defaults??[],userItems:s.userItems??[],loading:!1})}catch{r({loading:!1})}}const Er=Wn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchSkills:async()=>{await _h("/api/skills",e)},toggleSkill:async i=>{try{const c=await(await Ce(`/api/skills/${i}/toggle`,{method:"POST"})).json();e(u=>({defaults:u.defaults.map(f=>f.id===i?{...f,enabled:c.enabled}:f),userItems:u.userItems.map(f=>f.id===i?{...f,enabled:c.enabled}:f)}))}catch{}},fetchSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/skills/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createSkill:async i=>{const s=await si("POST","/api/skills",i);return s.success&&await r().fetchSkills(),s},updateSkill:async(i,s)=>{const c=await si("PUT",`/api/skills/${i}`,s);return c.success&&await r().fetchSkills(),c},deleteSkill:async i=>{try{const s=await Ce(`/api/skills/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateSkill:async i=>{try{const s=await Ce(`/api/skills/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchSkills(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Sh(){const[e,r]=P.useState({id:null,type:null}),i=P.useCallback(u=>r({id:u,type:"delete"}),[]),s=P.useCallback(()=>r({id:null,type:null}),[]),c=P.useCallback((u,f)=>e.id===u&&e.type===f,[e.id,e.type]);return{requestDelete:i,clearConfirm:s,isConfirming:c}}function wh({onConfirm:e,onCancel:r}){return o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{onClick:e,className:"px-1.5 py-0.5 rounded text-xs hover:opacity-90 transition-colors bg-accent-error/20 text-accent-error hover:bg-accent-error/30",children:"Delete"}),o.jsx("button",{onClick:r,className:"px-1.5 py-0.5 rounded text-text-muted text-xs hover:bg-bg-primary transition-colors",children:"Cancel"})]})}function Ch({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-accent-error transition-colors",title:"Delete",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})}function Wa({onClick:e}){return o.jsx("button",{onClick:e,className:"p-1.5 rounded hover:bg-bg-primary text-text-muted hover:text-text-primary transition-colors",title:"Duplicate",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}function Ai({label:e,value:r,onChange:i,placeholder:s,readOnly:c,hint:u,mono:f}){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:[e,u&&o.jsx("span",{className:"text-text-muted ml-1",children:u})]}),o.jsx("input",{value:r,onChange:l=>i(l.target.value),readOnly:c,placeholder:s,className:`w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary ${f?"font-mono":""} ${c?"opacity-60":""}`})]})}function US({onCancel:e,onSave:r,saving:i,saveDisabled:s}){return o.jsxs("div",{className:"flex justify-end gap-2 pt-2 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:e,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:r,disabled:i||s,children:i?"Saving...":"Save"})]})}function kh({message:e}){return o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded",children:e})}function yb({description:e,onNew:r,newLabel:i="+ New"}){return o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:e}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:r,children:i})})]})}function _b({isBuiltIn:e,isConfirmingDelete:r,onView:i,onEdit:s,onDuplicate:c,onDelete:u,children:f}){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:f}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e&&i&&o.jsx("button",{onClick:i,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Wa,{onClick:c}),!e&&s&&o.jsx(Mi,{onClick:s}),!e&&(r?o.jsx(wh,{onConfirm:()=>{u==null||u()},onCancel:()=>{}}):o.jsx(Ch,{onClick:()=>u==null?void 0:u()}))]})]})}function $S({id:e,name:r,description:i,isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d}){return o.jsxs(_b,{isBuiltIn:s,isConfirmingDelete:c,onView:u,onEdit:f,onDuplicate:l,onDelete:d,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:r}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e})]}),i&&o.jsx("p",{className:"text-text-muted text-xs truncate",children:i})]})}function Sb({loading:e,hasItems:r,loadingLabel:i,emptyLabel:s,children:c}){return e&&!r?o.jsx("div",{className:"text-text-muted text-sm",children:i}):r?o.jsx("div",{className:"space-y-4",children:c}):s?o.jsx("div",{className:"text-text-muted text-sm",children:s}):null}function wb({name:e,id:r,nameLabel:i="Name",idLabel:s="ID",namePlaceholder:c="My Item",idPlaceholder:u="my-item",nameHint:f,readOnlyId:l=!1,readOnlyHint:d="(read-only)",onNameChange:p,onIdChange:g}){return o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:i,value:e,onChange:p,placeholder:c,hint:f}),o.jsx(Ai,{label:s,value:r,onChange:g,readOnly:l,placeholder:u,hint:l?d:void 0,mono:!0})]})}function Cb(e={}){const{initialData:r={}}=e,[i,s]=P.useState("list"),[c,u]=P.useState(null),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(r),y=P.useCallback(()=>{m(r),l(""),u(null)},[r]),_=P.useCallback(b=>{s(b),b==="list"&&y()},[y]),k=P.useCallback(b=>{m(x=>typeof b=="function"?b(x):b)},[]),C=P.useCallback((b,x={})=>{u(b),s("edit"),m({...x}),l("")},[]),v=P.useCallback(()=>{u(null),s("edit"),m(r),l("")},[r]);return{view:i,editingId:c,formError:f,saving:d,formData:g,setView:_,setEditingId:u,setFormError:l,setFormData:k,setSaving:p,resetForm:y,startEditing:C,startNew:v}}function Rx({skill:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsx($S,{id:e.id,name:e.name,description:e.description,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f})}function qS({isOpen:e}){const r=Er(O=>O.defaults),i=Er(O=>O.userItems),s=Er(O=>O.loading),c=Er(O=>O.fetchSkills),u=Er(O=>O.fetchSkill),f=Er(O=>O.fetchDefaultContent),l=Er(O=>O.createSkill),d=Er(O=>O.updateSkill),p=Er(O=>O.deleteSkill),{view:g,editingId:m,formError:y,saving:_,formData:k,setView:C,setEditingId:v,setFormError:b,setFormData:x,setSaving:S}=Cb(),{clearConfirm:j}=Sh();P.useEffect(()=>{e&&(c(),C("list"),v(null),j())},[e,c,j]);const A=(O,U,z,X)=>{x({name:X??O.metadata.name,id:z??O.metadata.id,description:O.metadata.description??"",version:O.metadata.version??"1.0.0",prompt:O.prompt,isReadOnly:U})},N=async O=>{if(r.some(z=>z.id===O)){const z=await f(O);if(!z)return;A(z,!0),v(O),b(""),C("edit")}else{const z=await u(O);if(!z)return;A(z,!0),v(O),b(""),C("edit")}},D=async O=>{const z=r.some(Q=>Q.id===O)?await f(O):await u(O);if(!z)return;const X=`${O}-copy-${Date.now()}`;A(z,!1,X,`${z.metadata.name} (copy)`),v(null),b(""),C("edit")},T=()=>{x({name:"",id:"",description:"",version:"1.0.0",prompt:"",isReadOnly:!1}),C("edit")},I=async O=>{const U=await u(O);U&&(A(U,!1),v(O),b(""),C("edit"))},H=async O=>{await p(O),j()},V=async()=>{const O=m??k.id;if(!O||!k.name||!k.prompt){b("Name, ID, and prompt are required.");return}S(!0),b("");const U={metadata:{id:O,name:k.name,description:k.description,version:k.version},prompt:k.prompt},z=m?await d(m,U):await l(U);if(S(!1),!z.success){b(z.error??"Failed to save skill.");return}C("list")},Y=O=>{x(U=>({...U,name:O})),m||x(U=>({...U,id:O.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}))},q=k.isReadOnly;return g==="edit"?o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:q?k.name:m?"Edit Skill":"New Skill"}),o.jsx("button",{onClick:()=>C("list"),className:"text-text-muted hover:text-text-primary",children:"Cancel"})]}),y&&o.jsx(kh,{message:y}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(wb,{name:k.name,id:k.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Skill",idPlaceholder:"my-skill",readOnlyId:!0,onNameChange:Y,onIdChange:()=>{}}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:k.description,onChange:O=>x(U=>({...U,description:O})),placeholder:"What this skill does...",readOnly:q}),o.jsx(Ai,{label:"Version",value:k.version,onChange:O=>x(U=>({...U,version:O})),placeholder:"1.0.0",readOnly:q})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:k.prompt,onChange:O=>x(U=>({...U,prompt:O.target.value})),readOnly:q,placeholder:"The system prompt for this skill...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:()=>C("list"),children:"Cancel"}),q?o.jsx(st,{variant:"primary",onClick:()=>{x(O=>({...O,name:O.name+" (copy)",id:`${m}-copy-${Date.now()}`,isReadOnly:!1})),v(null)},children:"Duplicate & Customize"}):o.jsx(st,{variant:"primary",onClick:V,disabled:_||!k.name||!k.id||!k.prompt,children:_?"Saving...":"Save"})]})]}):o.jsxs("div",{children:[o.jsx(yb,{description:"Skills provide domain-specific knowledge that agents can load on demand.",onNew:T}),o.jsxs(Sb,{loading:s,hasItems:r.length>0||i.length>0,loadingLabel:"Loading skills...",emptyLabel:"No skills created yet.",children:[r.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:r.map(O=>o.jsx(Rx,{skill:O,isBuiltIn:!0,isConfirmingDelete:!1,onView:()=>N(O.id),onDuplicate:()=>D(O.id)},O.id))})]}),i.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:i.map(O=>o.jsx(Rx,{skill:O,isBuiltIn:!1,isConfirmingDelete:!1,onView:()=>N(O.id),onEdit:()=>I(O.id),onDuplicate:()=>D(O.id),onDelete:()=>H(O.id)},O.id))})]})]})]})}function WS({isOpen:e,onClose:r}){const[i,s]=P.useState("instructions");return o.jsx(cn,{isOpen:e,onClose:r,title:"Settings",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex border-b border-border mb-4 -mt-1",children:[o.jsx(_l,{label:"Instructions",active:i==="instructions",onClick:()=>s("instructions")}),o.jsx(_l,{label:"Skills",active:i==="skills",onClick:()=>s("skills")}),o.jsx(_l,{label:"Notifications",active:i==="notifications",onClick:()=>s("notifications")}),o.jsx(_l,{label:"Advanced",active:i==="advanced",onClick:()=>s("advanced")})]}),i==="instructions"&&o.jsx(VS,{isOpen:e}),i==="skills"&&o.jsx(qS,{isOpen:e}),i==="notifications"&&o.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:o.jsx(FS,{})}),i==="advanced"&&o.jsx(GS,{onClose:r})]})})}function GS({onClose:e}){const[,r]=ar();function i(){e(),r("/onboarding")}return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-text-primary mb-1",children:"Onboarding"}),o.jsx("p",{className:"text-sm text-text-muted mb-4",children:"Reset your OpenFox setup and go through the initial configuration again."}),o.jsx(st,{variant:"secondary",onClick:i,children:"Launch Onboarding"})]})})}function _l({label:e,active:r,onClick:i}){return o.jsx("button",{onClick:i,className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r?"border-accent-primary text-accent-primary":"border-transparent text-text-muted hover:text-text-secondary hover:border-border"}`,children:e})}function VS({isOpen:e}){const r=ni(v=>v.settings),i=ni(v=>v.loading),s=ni(v=>v.getSetting),c=ni(v=>v.setSetting),u=r[ti.GLOBAL_INSTRUCTIONS]??"",f=i[ti.GLOBAL_INSTRUCTIONS]??!1,[l,d]=P.useState(u),[p,g]=P.useState(!1),[m,y]=P.useState(!1);P.useEffect(()=>{e&&s(ti.GLOBAL_INSTRUCTIONS)},[e,s]),P.useEffect(()=>{d(u),g(!1)},[u]);const _=async()=>{y(!0),c(ti.GLOBAL_INSTRUCTIONS,l),y(!1),g(!1)},k=()=>{d(u),g(!1)},C=f||m;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-2",children:"Global Instructions"}),o.jsx("p",{className:"text-sm text-text-muted mb-2",children:"These instructions are injected into every prompt, regardless of project."}),o.jsx("textarea",{value:l,onChange:v=>{d(v.target.value),g(!0)},placeholder:"Enter global instructions that apply to all projects...",className:"w-full h-64 px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:C})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:k,disabled:!p,children:"Discard"}),o.jsx(st,{variant:"primary",onClick:_,disabled:!p||C,children:m?"Saving...":"Save"})]})]})}var Td={exports:{}},Mx;function YS(){return Mx||(Mx=1,(function(e,r){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(f,l,d){var p=this&&this.__decorate||function(x,S,j,A){var N,D=arguments.length,T=D<3?S:A===null?A=Object.getOwnPropertyDescriptor(S,j):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(x,S,j,A);else for(var I=x.length-1;I>=0;I--)(N=x[I])&&(T=(D<3?N(T):D>3?N(S,j,T):N(S,j))||T);return D>3&&T&&Object.defineProperty(S,j,T),T},g=this&&this.__param||function(x,S){return function(j,A){S(j,A,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=d(9042),y=d(9924),_=d(844),k=d(4725),C=d(2585),v=d(3656);let b=l.AccessibilityManager=class extends _.Disposable{constructor(x,S,j,A){super(),this._terminal=x,this._coreBrowserService=j,this._renderService=A,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let N=0;N<this._terminal.rows;N++)this._rowElements[N]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[N]);if(this._topBoundaryFocusListener=N=>this._handleBoundaryFocus(N,0),this._bottomBoundaryFocusListener=N=>this._handleBoundaryFocus(N,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((N=>this._handleResize(N.rows)))),this.register(this._terminal.onRender((N=>this._refreshRows(N.start,N.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((N=>this._handleChar(N)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
58
58
|
`)))),this.register(this._terminal.onA11yTab((N=>this._handleTab(N)))),this.register(this._terminal.onKey((N=>this._handleKey(N.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,_.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let S=0;S<x;S++)this._handleChar(" ")}_handleChar(x){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===`
|
|
59
59
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,S){this._liveRegionDebouncer.refresh(x,S,this._terminal.rows)}_renderRows(x,S){const j=this._terminal.buffer,A=j.lines.length.toString();for(let N=x;N<=S;N++){const D=j.lines.get(j.ydisp+N),T=[],I=(D==null?void 0:D.translateToString(!0,void 0,void 0,T))||"",H=(j.ydisp+N+1).toString(),V=this._rowElements[N];V&&(I.length===0?(V.innerText=" ",this._rowColumns.set(V,[0,1])):(V.textContent=I,this._rowColumns.set(V,T)),V.setAttribute("aria-posinset",H),V.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,S){const j=x.target,A=this._rowElements[S===0?1:this._rowElements.length-2];if(j.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==A)return;let N,D;if(S===0?(N=j,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(N=this._rowElements.shift(),D=j,this._rowContainer.removeChild(N)),N.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const T=this._createAccessibilityTreeNode();this._rowElements.unshift(T),this._rowContainer.insertAdjacentElement("afterbegin",T)}else{const T=this._createAccessibilityTreeNode();this._rowElements.push(T),this._rowContainer.appendChild(T)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:x.anchorNode,offset:x.anchorOffset},j={node:x.focusNode,offset:x.focusOffset};if((S.node.compareDocumentPosition(j.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===j.node&&S.offset>j.offset)&&([S,j]=[j,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const A=this._rowElements.slice(-1)[0];if(j.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(j={node:A,offset:((I=A.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(j.node))return;const N=({node:H,offset:V})=>{const Y=H instanceof Text?H.parentNode:H;let q=parseInt(Y==null?void 0:Y.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const O=this._rowColumns.get(Y);if(!O)return console.warn("columns is null. Race condition?"),null;let U=V<O.length?O[V]:O.slice(-1)[0]+1;return U>=this._terminal.cols&&(++q,U=0),{row:q,column:U}},D=N(S),T=N(j);if(D&&T){if(D.row>T.row||D.row===T.row&&D.column>=T.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(T.row-D.row)*this._terminal.cols-D.column+T.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>x;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x<this._terminal.rows;x++)this._refreshRowDimensions(this._rowElements[x])}}_refreshRowDimensions(x){x.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=p([g(1,C.IInstantiationService),g(2,k.ICoreBrowserService),g(3,k.IRenderService)],b)},3614:(f,l)=>{function d(y){return y.replace(/\r?\n/g,"\r")}function p(y,_){return _?"\x1B[200~"+y+"\x1B[201~":y}function g(y,_,k,C){y=p(y=d(y),k.decPrivateModes.bracketedPasteMode&&C.rawOptions.ignoreBracketedPasteMode!==!0),k.triggerDataEvent(y,!0),_.value=""}function m(y,_,k){const C=k.getBoundingClientRect(),v=y.clientX-C.left-10,b=y.clientY-C.top-10;_.style.width="20px",_.style.height="20px",_.style.left=`${v}px`,_.style.top=`${b}px`,_.style.zIndex="1000",_.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=d,l.bracketTextForPaste=p,l.copyHandler=function(y,_){y.clipboardData&&y.clipboardData.setData("text/plain",_.selectionText),y.preventDefault()},l.handlePasteEvent=function(y,_,k,C){y.stopPropagation(),y.clipboardData&&g(y.clipboardData.getData("text/plain"),_,k,C)},l.paste=g,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(y,_,k,C,v){m(y,_,k),v&&C.rightClickSelect(y),_.value=C.selectionText,_.select()}},7239:(f,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const p=d(1505);l.ColorContrastCache=class{constructor(){this._color=new p.TwoKeyMap,this._css=new p.TwoKeyMap}setCss(g,m,y){this._css.set(g,m,y)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,y){this._color.set(g,m,y)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(d,p,g,m){d.addEventListener(p,g,m);let y=!1;return{dispose:()=>{y||(y=!0,d.removeEventListener(p,g,m))}}}},3551:function(f,l,d){var p=this&&this.__decorate||function(b,x,S,j){var A,N=arguments.length,D=N<3?x:j===null?j=Object.getOwnPropertyDescriptor(x,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,j);else for(var T=b.length-1;T>=0;T--)(A=b[T])&&(D=(N<3?A(D):N>3?A(x,S,D):A(x,S))||D);return N>3&&D&&Object.defineProperty(x,S,D),D},g=this&&this.__param||function(b,x){return function(S,j){x(S,j,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=d(3656),y=d(8460),_=d(844),k=d(2585),C=d(4725);let v=l.Linkifier=class extends _.Disposable{get currentLink(){return this._currentLink}constructor(b,x,S,j,A){super(),this._element=b,this._mouseService=x,this._renderService=S,this._bufferService=j,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,_.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,_.toDisposable)((()=>{var N;this._lastMouseEvent=void 0,(N=this._activeProviderReplies)==null||N.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const S=b.composedPath();for(let j=0;j<S.length;j++){const A=S[j];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&x.x===this._lastBufferCell.x&&x.y===this._lastBufferCell.y||(this._handleHover(x),this._lastBufferCell=x)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,x){var j,A;this._activeProviderReplies&&x||((j=this._activeProviderReplies)==null||j.forEach((N=>{N==null||N.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[N,D]of this._linkProviderService.linkProviders.entries())x?(A=this._activeProviderReplies)!=null&&A.get(N)&&(S=this._checkLinkProviderResult(N,b,S)):D.provideLinks(b.y,(T=>{var H,V;if(this._isMouseOut)return;const I=T==null?void 0:T.map((Y=>({link:Y})));(H=this._activeProviderReplies)==null||H.set(N,I),S=this._checkLinkProviderResult(N,b,S),((V=this._activeProviderReplies)==null?void 0:V.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,x){const S=new Set;for(let j=0;j<x.size;j++){const A=x.get(j);if(A)for(let N=0;N<A.length;N++){const D=A[N],T=D.link.range.start.y<b?0:D.link.range.start.x,I=D.link.range.end.y>b?this._bufferService.cols:D.link.range.end.x;for(let H=T;H<=I;H++){if(S.has(H)){A.splice(N--,1);break}S.add(H)}}}}_checkLinkProviderResult(b,x,S){var N;if(!this._activeProviderReplies)return S;const j=this._activeProviderReplies.get(b);let A=!1;for(let D=0;D<b;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(A=!0);if(!A&&j){const D=j.find((T=>this._linkAtPosition(T.link,x)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;D<this._activeProviderReplies.size;D++){const T=(N=this._activeProviderReplies.get(D))==null?void 0:N.find((I=>this._linkAtPosition(I.link,x)));if(T){S=!0,this._handleNewLink(T);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,x){this._currentLink&&this._lastMouseEvent&&(!b||!x||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,_.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(b.link,x)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.pointerCursor},set:S=>{var j;(j=this._currentLink)!=null&&j.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,j;return(j=(S=this._currentLink)==null?void 0:S.state)==null?void 0:j.decorations.underline},set:S=>{var j,A,N;(j=this._currentLink)!=null&&j.state&&((N=(A=this._currentLink)==null?void 0:A.state)==null?void 0:N.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const j=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=j&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(j,A),this._lastMouseEvent)){const N=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);N&&this._askForLink(N,!1)}}))))}_linkHover(b,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(S,x.text)}_fireUnderlineEvent(b,x){const S=b.range,j=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-j-1,S.end.x,S.end.y-j-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(b,x,S){var j;(j=this._currentLink)!=null&&j.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(S,x.text)}_linkAtPosition(b,x){const S=b.range.start.y*this._bufferService.cols+b.range.start.x,j=b.range.end.y*this._bufferService.cols+b.range.end.x,A=x.y*this._bufferService.cols+x.x;return S<=A&&A<=j}_positionFromMouseEvent(b,x,S){const j=S.getCoords(b,x,this._bufferService.cols,this._bufferService.rows);if(j)return{x:j[0],y:j[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,x,S,j,A){return{x1:b,y1:x,x2:S,y2:j,cols:this._bufferService.cols,fg:A}}};l.Linkifier=v=p([g(1,C.IMouseService),g(2,C.IRenderService),g(3,k.IBufferService),g(4,C.ILinkProviderService)],v)},9042:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(f,l,d){var p=this&&this.__decorate||function(C,v,b,x){var S,j=arguments.length,A=j<3?v:x===null?x=Object.getOwnPropertyDescriptor(v,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,b,x);else for(var N=C.length-1;N>=0;N--)(S=C[N])&&(A=(j<3?S(A):j>3?S(v,b,A):S(v,b))||A);return j>3&&A&&Object.defineProperty(v,b,A),A},g=this&&this.__param||function(C,v){return function(b,x){v(b,x,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=d(511),y=d(2585);let _=l.OscLinkProvider=class{constructor(C,v,b){this._bufferService=C,this._optionsService=v,this._oscLinkService=b}provideLinks(C,v){var I;const b=this._bufferService.buffer.lines.get(C-1);if(!b)return void v(void 0);const x=[],S=this._optionsService.rawOptions.linkHandler,j=new m.CellData,A=b.getTrimmedLength();let N=-1,D=-1,T=!1;for(let H=0;H<A;H++)if(D!==-1||b.hasContent(H)){if(b.loadCell(H,j),j.hasExtendedAttrs()&&j.extended.urlId){if(D===-1){D=H,N=j.extended.urlId;continue}T=j.extended.urlId!==N}else D!==-1&&(T=!0);if(T||D!==-1&&H===A-1){const V=(I=this._oscLinkService.getLinkData(N))==null?void 0:I.uri;if(V){const Y={start:{x:D+1,y:C},end:{x:H+(T||H!==A-1?0:1),y:C}};let q=!1;if(!(S!=null&&S.allowNonHttpProtocols))try{const O=new URL(V);["http:","https:"].includes(O.protocol)||(q=!0)}catch{q=!0}q||x.push({text:V,range:Y,activate:(O,U)=>S?S.activate(O,U,Y):k(0,U),hover:(O,U)=>{var z;return(z=S==null?void 0:S.hover)==null?void 0:z.call(S,O,U,Y)},leave:(O,U)=>{var z;return(z=S==null?void 0:S.leave)==null?void 0:z.call(S,O,U,Y)}})}T=!1,j.hasExtendedAttrs()&&j.extended.urlId?(D=H,N=j.extended.urlId):(D=-1,N=-1)}}v(x)}};function k(C,v){if(confirm(`Do you want to navigate to ${v}?
|
|
60
60
|
|
|
@@ -73,7 +73,7 @@ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b)
|
|
|
73
73
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
74
74
|
* http://bellard.org/jslinux/
|
|
75
75
|
* Copyright (c) 2011 Fabrice Bellard
|
|
76
|
-
*/var XS=2,ZS=1,QS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),f={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},l=f.top+f.bottom,d=f.right+f.left,p=s-l,g=c-d-r;return{cols:Math.max(XS,Math.floor(g/e.css.cell.width)),rows:Math.max(ZS,Math.floor(p/e.css.cell.height))}}};function JS({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=P.useRef(null),u=P.useRef(e),f=P.useRef(null),l=P.useRef(null),d=sr(g=>g.writeSession),p=sr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!c.current)return;const g=new KS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new QS;g.loadAddon(m),f.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(c.current);const y=c.current.querySelector(".xterm");y&&(y.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var v;m.fit&&m.fit();const C=(v=f.current)==null?void 0:v.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(c.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const k=Pt.subscribe(C=>{var v,b;if(C.type==="terminal.output"&&((v=C.payload)==null?void 0:v.sessionId)===u.current){const x=(b=C.payload)==null?void 0:b.data;x&&g.write(x)}});return()=>{k(),_.disconnect(),l.current&&clearTimeout(l.current),g.dispose(),f.current=null}},[e,d,p]),o.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[o.jsx("div",{}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.5 0 0 1 0-.708z"})})})]}),o.jsx("div",{ref:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function ew(e){return e===1?"grid-cols-1":e===2?"grid-cols-1 lg:grid-cols-2":"grid-cols-1 lg:grid-cols-2 xl:grid-cols-3"}function tw({isOpen:e,onClose:r,onFocusChat:i}){const s=sr(C=>C.createSession),c=sr(C=>C.killSession),u=sr(C=>C.sessions),f=sr(C=>C.setWorkdir),l=sr(C=>C.fetchSessions),d=Gt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),y=P.useRef(!1),_=P.useRef(!1),k=P.useCallback(()=>{r(),i()},[r,i]);return P.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),P.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),P.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,s())},[e,u.length,p,s]),P.useEffect(()=>{e?(y.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{y.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=v=>{y.current||(v.key==="Escape"||v.key==="²"||v.key==="`")&&(v.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:k}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.key==="²"||C.key==="`")&&(C.preventDefault(),k())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>s(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>{r(),i()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:p?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${ew(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(JS,{sessionId:C.id,onClose:()=>c(C.id),onEscape:k,autoFocus:u.length===1},C.id))})})]})]}):null}function eo({items:e,trigger:r,minWidth:i="120px"}){const[s,c]=P.useState(!1),[u,f]=P.useState(null),l=P.useRef(null),d=P.useRef(null);P.useEffect(()=>{function y(_){d.current&&!d.current.contains(_.target)&&c(!1)}return s&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[s]);const p=P.useCallback(()=>{if(!l.current)return;const y=l.current.getBoundingClientRect(),_=200,C=window.innerHeight-y.bottom<_;f({top:C?y.top-_-4:y.bottom+4,left:y.left,alignToTop:C})},[]),g=y=>{y.stopPropagation(),s||p(),c(!s)},m=u&&o.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((y,_)=>{const k=o.jsxs(o.Fragment,{children:[y.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:y.icon}),y.label]});return y.href?o.jsx(Ln,{href:y.href,onClick:C=>{var v;(v=y.onClick)==null||v.call(y,C),c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${y.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_):o.jsx("button",{onClick:C=>{var v;(v=y.onClick)==null||v.call(y,C),y.closeOnClick!==!1&&c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${y.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:l,onClick:g,children:r})}),s&&ql.createPortal(m,document.body)]})}function Eb({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Wl({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function jb(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${s} ${c}/${u}/${f}`}function Gl(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function nw(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),f=Gl(e);if(u===0)return`today ${f}`;if(u===1)return`yesterday ${f}`;if(u<7)return`${u} days ago ${f}`;{const l=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${l}/${d}/${p} ${f}`}}function Nb(e){const r=new Date(e);return{year:r.getFullYear(),month:String(r.getMonth()+1).padStart(2,"0"),day:String(r.getDate()).padStart(2,"0")}}function rw(e){const{year:r,month:i,day:s}=Nb(e);return`${r}-${i}-${s}`}function Tb(e){const r=new Map;for(const c of e){const u=rw(c.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(c)}for(const[c,u]of r)u.sort((f,l)=>{const d=new Date(f.updatedAt).getTime();return new Date(l.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((c,u)=>u.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function iw({items:e,trigger:r,isActive:i=!1}){const[s,c]=P.useState(!1),u=P.useRef(null);return P.useEffect(()=>{function f(l){u.current&&!u.current.contains(l.target)&&c(!1)}if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${i?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof r=="string"?o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,o.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:{transform:s?"rotate(180deg)":void 0},children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&e.length>0&&o.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((f,l)=>{const d=f.label&&typeof f.label=="object"&&f.label.type===Ln?f.label:null;if(d){const p=d.props.href||"";return o.jsxs(Ln,{href:p,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,d.props.children]},l)}return f.href?o.jsxs("a",{href:f.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l):o.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),c(!1)},className:"flex items-center gap-2 px-3 py-2 text-sm w-full text-left border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l)})})]})}function sw({projects:e,currentProject:r}){const i=Gt(u=>u.loadProject),c=[...e].sort((u,f)=>u.name.localeCompare(f.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(Wl,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(eo,{items:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx(Eb,{})]}),minWidth:"250px"})}function aw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const c=r.filter(f=>f.projectId===e.id).sort((f,l)=>new Date(l.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(Ln,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...c.map(f=>({label:o.jsx(Ln,{href:`/p/${e.id}/s/${f.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:f.title??f.id.slice(0,8)})}),icon:f.id===(i==null?void 0:i.id)?o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0})),{label:o.jsxs(Ln,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(iw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function ow({sessions:e,currentProject:r,currentSession:i}){var d;const s=Ee(p=>p.loadSession),c=e.filter(p=>p.projectId===r.id).slice(0,15),u=Tb(c),f=[];f.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[p,g]of u){const m=g[0];if(m){f.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:jb(m.updatedAt)}),onClick:()=>{}});for(const y of g)f.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:y.title??y.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Gl(y.updatedAt)})]}),icon:y.id===(i==null?void 0:i.id)?o.jsx(Wl,{}):void 0,href:`/p/${r.id}/s/${y.id}`,onClick:()=>{s(y.id)}})}}const l=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(eo,{items:f,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:l,"data-testid":"header-session-dropdown",children:[l,o.jsx(Eb,{})]}),minWidth:"280px"})}function lw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[c]=ar(),u=c.startsWith("/p/"),f=/^\/p\/[^/]+\/s\/[^/]+$/.test(c),l=Ee(v=>v.currentSession),d=Ee(v=>v.sessions),p=Gt(v=>v.currentProject),g=Gt(v=>v.projects),m=kt(v=>v.startAutoRefresh),y=kt(v=>v.stopAutoRefresh),_=sr(v=>v.setOpen),k=sr(v=>v.isOpen),C=P.useCallback(()=>{const v=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');v&&v.focus()},[]);return P.useEffect(()=>{const v=b=>{(b.key==="²"||b.key==="`")&&(b.preventDefault(),k||_(!0))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[k,_]),P.useEffect(()=>(m(),()=>y()),[m,y]),o.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&u&&o.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),o.jsx(Ln,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),p&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(sw,{projects:g,currentProject:p})}),o.jsx("span",{className:"md:hidden",children:o.jsx(aw,{currentProject:p,sessions:d,currentSession:l,projectIdFromUrl:u&&c.split("/")[2]||null},p==null?void 0:p.id)}),o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(ow,{sessions:d,currentProject:p,currentSession:l})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>_(!k),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${k?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (²)",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3 1h10v1H5V6zm10 7H5v1h10v-1zm-10 2H5v1h10v-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}),r&&f&&o.jsx("button",{onClick:r,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),o.jsx(WS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(tw,{isOpen:k,onClose:()=>_(!1),onFocusChat:C})]})}function cw({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:u,value:f,isLoading:l=!1,onSave:d}){const[p,g]=P.useState(f),[m,y]=P.useState(!1),[_,k]=P.useState(!1);P.useEffect(()=>{g(f),y(!1)},[f]);const C=S=>{g(S.target.value),y(!0)},v=async()=>{k(!0),await d(p),k(!1),y(!1),r()},b=()=>{g(f),y(!1),r()},x=l||_;return o.jsx(ln,{isOpen:e,onClose:b,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:c}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:p,onChange:C,placeholder:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:x})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:b,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:v,disabled:!m||x,children:_?"Saving...":"Save"})]})]})})}function uw({isOpen:e,onClose:r,project:i}){const s=Gt(u=>u.updateProject),c=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(cw,{isOpen:e,onClose:r,title:`${i.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:i.customInstructions??"",onSave:c})}const dw={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Rs({onClick:e,className:r="",size:i="md",variant:s="default"}){const c=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx("button",{onClick:e,className:`${c} ${r}`,title:"Close",children:o.jsx("svg",{className:dw[i],fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}function Ab({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=ar(),[c,u]=P.useState(!1),f=Ee(j=>j.sessions),l=Ee(j=>j.currentSession),d=Ee(j=>j.unreadSessionIds),p=Ee(j=>j.deleteSession),g=Ee(j=>j.deleteAllSessions),m=Ee(j=>j.loadMoreSessions),y=Ee(j=>j.sessionsHasMore),_=Ee(j=>j.sessionsPaginationLoading),k=Gt(j=>j.currentProject),C=P.useRef(null),v=P.useCallback(()=>{y&&!_&&k&&m(k.id)},[y,_,k,m]);P.useEffect(()=>{if(!C.current||!y)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&v()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[y,v]);const b=f.filter(j=>j.projectId===(k==null?void 0:k.id)),x=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(p(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},S=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&i&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("aside",{className:`
|
|
76
|
+
*/var XS=2,ZS=1,QS=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let r=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),c=Math.max(0,parseInt(i.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),f={top:parseInt(u.getPropertyValue("padding-top")),bottom:parseInt(u.getPropertyValue("padding-bottom")),right:parseInt(u.getPropertyValue("padding-right")),left:parseInt(u.getPropertyValue("padding-left"))},l=f.top+f.bottom,d=f.right+f.left,p=s-l,g=c-d-r;return{cols:Math.max(XS,Math.floor(g/e.css.cell.width)),rows:Math.max(ZS,Math.floor(p/e.css.cell.height))}}};function JS({sessionId:e,onClose:r,onEscape:i,autoFocus:s}){const c=P.useRef(null),u=P.useRef(e),f=P.useRef(null),l=P.useRef(null),d=sr(g=>g.writeSession),p=sr(g=>g.resizeSession);return P.useEffect(()=>{u.current=e},[e]),P.useEffect(()=>{if(!i)return;const g=m=>{(m.key==="²"||m.key==="`")&&(m.preventDefault(),m.stopPropagation(),i())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i]),P.useEffect(()=>{if(!c.current)return;const g=new KS.Terminal({fontFamily:'"JetBrains Mono", monospace',fontSize:13,theme:{background:"#1a1a1a",foreground:"#e0e0e0",cursor:"#ffffff",cursorAccent:"#1a1a1a"},cursorBlink:!0,cursorStyle:"bar",convertEol:!0}),m=new QS;g.loadAddon(m),f.current={term:g,fitAddon:m},c.current.addEventListener("keydown",C=>{(C.key==="²"||C.key==="`")&&i&&(C.preventDefault(),C.stopPropagation(),i())}),g.open(c.current);const y=c.current.querySelector(".xterm");y&&(y.style.padding="8px"),m.fit(),s&&setTimeout(()=>{g.focus()},150);const _=new ResizeObserver(()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{requestAnimationFrame(()=>{var v;m.fit&&m.fit();const C=(v=f.current)==null?void 0:v.term;C&&C.cols>0&&C.rows>0&&p(u.current,C.cols,C.rows)})},100)});_.observe(c.current),g.onData(C=>{if((C==="\x1B"||C==="²"||C==="`")&&i){i();return}d(u.current,C)}),g.onKey(C=>{(C.key==="\x1B"||C.key==="²"||C.key==="`")&&i&&(C.domEvent.stopPropagation(),i())});const k=Pt.subscribe(C=>{var v,b;if(C.type==="terminal.output"&&((v=C.payload)==null?void 0:v.sessionId)===u.current){const x=(b=C.payload)==null?void 0:b.data;x&&g.write(x)}});return()=>{k(),_.disconnect(),l.current&&clearTimeout(l.current),g.dispose(),f.current=null}},[e,d,p]),o.jsxs("div",{className:"flex flex-col h-full bg-[#1a1a1a]",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-2 py-1 bg-[#252525] border-b border-[#333]",children:[o.jsx("div",{}),o.jsx("button",{onClick:r,className:"p-1 rounded hover:bg-[#333] text-[#888] hover:text-[#ccc] transition-colors",title:"Close terminal",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.55.5 0 0 1 0-.708z"})})})]}),o.jsx("div",{ref:c,className:"flex-1 relative overflow-hidden",tabIndex:0,onKeyDown:g=>{(g.key==="²"||g.key==="`")&&i&&(g.preventDefault(),g.stopPropagation(),i())}})]})}function ew(e){return e===1?"grid-cols-1":e===2?"grid-cols-1 lg:grid-cols-2":"grid-cols-1 lg:grid-cols-2 xl:grid-cols-3"}function tw({isOpen:e,onClose:r,onFocusChat:i}){const s=sr(C=>C.createSession),c=sr(C=>C.killSession),u=sr(C=>C.sessions),f=sr(C=>C.setWorkdir),l=sr(C=>C.fetchSessions),d=Gt(C=>C.currentProject),[p,g]=P.useState(!0),m=P.useRef(null),y=P.useRef(!1),_=P.useRef(!1),k=P.useCallback(()=>{r(),i()},[r,i]);return P.useEffect(()=>{d!=null&&d.workdir&&f(d.workdir)},[d==null?void 0:d.workdir,f]),P.useEffect(()=>{e&&(g(!0),l().finally(()=>g(!1)))},[e,l]),P.useEffect(()=>{e&&u.length===0&&!p&&!_.current&&(_.current=!0,s())},[e,u.length,p,s]),P.useEffect(()=>{e?(y.current=!0,setTimeout(()=>{var C;(C=m.current)==null||C.focus(),setTimeout(()=>{y.current=!1},200)},100)):_.current=!1},[e]),P.useEffect(()=>{if(!e)return;const C=v=>{y.current||(v.key==="Escape"||v.key==="²"||v.key==="`")&&(v.preventDefault(),r(),i())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,r,i]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-x-0 top-[50vh] bottom-0 z-[100] bg-black/40",style:{pointerEvents:"auto"},onClick:k}),o.jsxs("div",{ref:m,tabIndex:-1,className:"fixed inset-x-0 top-0 z-[100] h-[50vh] bg-bg-primary border-b border-border flex flex-col animate-slide-down outline-none",onClick:C=>C.stopPropagation(),onKeyDown:C=>{(C.key==="Escape"||C.key==="²"||C.key==="`")&&(C.preventDefault(),k())},children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Terminal"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>s(),className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"New terminal",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>{r(),i()},className:"p-2 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Close (Esc)",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:p?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:"Loading..."}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-full text-text-muted",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-4",children:"No terminal sessions"}),o.jsx("button",{onClick:()=>s(),className:"px-4 py-2 bg-accent-primary/25 text-white rounded hover:bg-accent-primary/40 transition-colors",children:"Create Terminal"})]})}):o.jsx("div",{className:`grid ${ew(u.length)} gap-2 h-full auto-rows-fr`,children:u.map(C=>o.jsx(JS,{sessionId:C.id,onClose:()=>c(C.id),onEscape:k,autoFocus:u.length===1},C.id))})})]})]}):null}function eo({items:e,trigger:r,minWidth:i="120px"}){const[s,c]=P.useState(!1),[u,f]=P.useState(null),l=P.useRef(null),d=P.useRef(null);P.useEffect(()=>{function y(_){d.current&&!d.current.contains(_.target)&&c(!1)}return s&&document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[s]);const p=P.useCallback(()=>{if(!l.current)return;const y=l.current.getBoundingClientRect(),_=200,C=window.innerHeight-y.bottom<_;f({top:C?y.top-_-4:y.bottom+4,left:y.left,alignToTop:C})},[]),g=y=>{y.stopPropagation(),s||p(),c(!s)},m=u&&o.jsx("div",{ref:d,"data-testid":"session-dropdown-menu",className:`fixed bg-bg-secondary border border-border rounded shadow-lg z-50 ${u.alignToTop?"mb-1":"mt-1"}`,style:{top:u.top,left:u.left,minWidth:i},children:e.map((y,_)=>{const k=o.jsxs(o.Fragment,{children:[y.icon&&o.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:y.icon}),y.label]});return y.href?o.jsx(Ln,{href:y.href,onClick:C=>{var v;(v=y.onClick)==null||v.call(y,C),c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${y.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_):o.jsx("button",{onClick:C=>{var v;(v=y.onClick)==null||v.call(y,C),y.closeOnClick!==!1&&c(!1)},className:`w-full px-3 py-2 text-left text-sm hover:bg-bg-tertiary transition-colors flex items-center gap-2 ${y.danger?"text-accent-error hover:bg-accent-error/10":"text-text-primary"} ${_!==e.length-1?"border-b border-border":""}`,children:k},_)})});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",children:o.jsx("div",{ref:l,onClick:g,children:r})}),s&&ql.createPortal(m,document.body)]})}function Eb({className:e="w-3 h-3"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Wl({className:e="w-4 h-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function jb(e){const r=new Date(e),s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][r.getDay()],c=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),f=String(r.getDate()).padStart(2,"0");return`${s} ${c}/${u}/${f}`}function Gl(e){const r=new Date(e),i=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${i}:${s}`}function nw(e){const r=new Date(e),i=new Date,s=new Date(i.getFullYear(),i.getMonth(),i.getDate()),c=new Date(r.getFullYear(),r.getMonth(),r.getDate()),u=Math.floor((s.getTime()-c.getTime())/(1e3*60*60*24)),f=Gl(e);if(u===0)return`today ${f}`;if(u===1)return`yesterday ${f}`;if(u<7)return`${u} days ago ${f}`;{const l=r.getFullYear(),d=String(r.getMonth()+1).padStart(2,"0"),p=String(r.getDate()).padStart(2,"0");return`${l}/${d}/${p} ${f}`}}function Nb(e){const r=new Date(e);return{year:r.getFullYear(),month:String(r.getMonth()+1).padStart(2,"0"),day:String(r.getDate()).padStart(2,"0")}}function rw(e){const{year:r,month:i,day:s}=Nb(e);return`${r}-${i}-${s}`}function Tb(e){const r=new Map;for(const c of e){const u=rw(c.updatedAt);r.has(u)||r.set(u,[]),r.get(u).push(c)}for(const[c,u]of r)u.sort((f,l)=>{const d=new Date(f.updatedAt).getTime();return new Date(l.updatedAt).getTime()-d});const i=Array.from(r.keys()).sort((c,u)=>u.localeCompare(c)),s=new Map;for(const c of i)s.set(c,r.get(c));return s}function iw({items:e,trigger:r,isActive:i=!1}){const[s,c]=P.useState(!1),u=P.useRef(null);return P.useEffect(()=>{function f(l){u.current&&!u.current.contains(l.target)&&c(!1)}if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:`flex items-center gap-1 px-1.5 py-0.5 rounded transition-colors ${i?"bg-bg-tertiary":"hover:bg-bg-tertiary"}`,children:[typeof r=="string"?o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:r}):r,o.jsx("svg",{className:"w-3 h-3 text-text-muted flex-shrink-0 transition-transform",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,style:{transform:s?"rotate(180deg)":void 0},children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),s&&e.length>0&&o.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:e.map((f,l)=>{const d=f.label&&typeof f.label=="object"&&f.label.type===Ln?f.label:null;if(d){const p=d.props.href||"";return o.jsxs(Ln,{href:p,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,d.props.children]},l)}return f.href?o.jsxs("a",{href:f.href,className:"flex items-center gap-2 px-3 py-2 text-sm border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l):o.jsxs("button",{type:"button",onClick:()=>{var p;(p=f.onClick)==null||p.call(f),c(!1)},className:"flex items-center gap-2 px-3 py-2 text-sm w-full text-left border-b border-border hover:bg-bg-tertiary transition-colors",children:[f.icon,f.label]},l)})})]})}function sw({projects:e,currentProject:r}){const i=Gt(u=>u.loadProject),c=[...e].sort((u,f)=>u.name.localeCompare(f.name)).map(u=>({label:u.name,icon:u.id===r.id?o.jsx(Wl,{}):void 0,href:`/p/${u.id}`,onClick:()=>{i(u.id)}}));return o.jsx(eo,{items:c,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:r.name,children:[r.name,o.jsx(Eb,{})]}),minWidth:"250px"})}function aw({currentProject:e,sessions:r,currentSession:i,projectIdFromUrl:s}){if(!(e!=null&&e.id)||e.id!==s)return null;const c=r.filter(f=>f.projectId===e.id).sort((f,l)=>new Date(l.updatedAt).getTime()-new Date(f.updatedAt).getTime()).slice(0,5),u=[{label:o.jsxs(Ln,{href:`/p/${e.id}/new`,className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-3 h-3 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New Session"})]})},...c.map(f=>({label:o.jsx(Ln,{href:`/p/${e.id}/s/${f.id}`,className:"flex items-center gap-2 truncate text-sm",children:o.jsx("span",{children:f.title??f.id.slice(0,8)})}),icon:f.id===(i==null?void 0:i.id)?o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):void 0})),{label:o.jsxs(Ln,{href:"/",className:"flex items-center gap-2 text-text-muted hover:text-text-primary",children:[o.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),o.jsx("span",{className:"text-sm",children:"Projects"})]})}];return o.jsx(iw,{items:u,trigger:o.jsx("span",{className:"text-sm text-text-secondary font-medium",children:e.name})})}function ow({sessions:e,currentProject:r,currentSession:i}){var d;const s=Ee(p=>p.loadSession),c=e.filter(p=>p.projectId===r.id).slice(0,15),u=Tb(c),f=[];f.push({label:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 text-accent-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),o.jsx("span",{className:"text-sm",children:"New session"})]}),href:`/p/${r.id}/new`,onClick:()=>{}});for(const[p,g]of u){const m=g[0];if(m){f.push({label:o.jsx("div",{className:"px-3 py-2 text-text-muted text-xs font-medium cursor-default",children:jb(m.updatedAt)}),onClick:()=>{}});for(const y of g)f.push({label:o.jsxs("div",{className:"min-w-[160px]",children:[o.jsx("div",{className:"truncate text-sm",children:y.title??y.id.slice(0,8)}),o.jsx("div",{className:"text-text-muted text-xs",children:Gl(y.updatedAt)})]}),icon:y.id===(i==null?void 0:i.id)?o.jsx(Wl,{}):void 0,href:`/p/${r.id}/s/${y.id}`,onClick:()=>{s(y.id)}})}}const l=i?((d=i.metadata)==null?void 0:d.title)??i.id.slice(0,8):"No session selected";return o.jsx(eo,{items:f,trigger:o.jsxs("button",{className:"text-text-secondary hover:text-text-primary hover:underline text-sm truncate flex items-center gap-1",title:l,"data-testid":"header-session-dropdown",children:[l,o.jsx(Eb,{})]}),minWidth:"280px"})}function lw({onMenuClick:e,onCriteriaToggle:r}){const[i,s]=P.useState(!1),[c]=ar(),u=c.startsWith("/p/"),f=/^\/p\/[^/]+\/s\/[^/]+$/.test(c),l=Ee(v=>v.currentSession),d=Ee(v=>v.sessions),p=Gt(v=>v.currentProject),g=Gt(v=>v.projects),m=kt(v=>v.startAutoRefresh),y=kt(v=>v.stopAutoRefresh),_=sr(v=>v.setOpen),k=sr(v=>v.isOpen),C=P.useCallback(()=>{const v=document.querySelector('textarea[placeholder*="What would you like to build"], textarea[placeholder*="Send a message"]');v&&v.focus()},[]);return P.useEffect(()=>{const v=b=>{(b.key==="²"||b.key==="`")&&(b.preventDefault(),k||_(!0))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[k,_]),P.useEffect(()=>(m(),()=>y()),[m,y]),o.jsxs("header",{className:"h-8 bg-bg-secondary border-b border-border flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e&&u&&o.jsx("button",{onClick:e,className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle session list",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),o.jsx(Ln,{href:"/",className:"text-accent-primary font-semibold text-base hover:underline flex-shrink-0 hidden md:inline",children:"OpenFox"}),p&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(sw,{projects:g,currentProject:p})}),o.jsx("span",{className:"md:hidden",children:o.jsx(aw,{currentProject:p,sessions:d,currentSession:l,projectIdFromUrl:u&&c.split("/")[2]||null},p==null?void 0:p.id)}),o.jsx("span",{className:"hidden md:inline text-text-muted flex-shrink-0",children:"/"}),o.jsx("span",{className:"hidden md:inline",children:o.jsx(ow,{sessions:d,currentProject:p,currentSession:l})})]})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u&&o.jsx("button",{onClick:()=>_(!k),className:`p-2.5 rounded hover:bg-bg-tertiary transition-colors ${k?"text-accent-primary":"text-text-muted hover:text-text-primary"}`,title:"Toggle terminal (²)",children:o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v10a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm3 1h10v1H5V6zm10 7H5v1h10v-1zm-10 2H5v1h10v-1z",clipRule:"evenodd"})})}),o.jsx("button",{onClick:()=>s(!0),className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Settings",children:o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx("button",{onClick:()=>{localStorage.removeItem("openfox_token"),window.location.reload()},className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Logout",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}),r&&f&&o.jsx("button",{onClick:r,className:"p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Toggle summary sidebar",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),o.jsx(WS,{isOpen:i,onClose:()=>s(!1)}),o.jsx(tw,{isOpen:k,onClose:()=>_(!1),onFocusChat:C})]})}function cw({isOpen:e,onClose:r,title:i,label:s,description:c,placeholder:u,value:f,isLoading:l=!1,onSave:d}){const[p,g]=P.useState(f),[m,y]=P.useState(!1),[_,k]=P.useState(!1);P.useEffect(()=>{g(f),y(!1)},[f]);const C=S=>{g(S.target.value),y(!0)},v=async()=>{k(!0),await d(p),k(!1),y(!1),r()},b=()=>{g(f),y(!1),r()},x=l||_;return o.jsx(cn,{isOpen:e,onClose:b,title:i,size:"lg",children:o.jsxs("div",{className:"flex flex-col h-full -mt-1",children:[o.jsx("label",{className:"block text-sm font-medium text-text-primary mb-1 flex-shrink-0",children:s}),o.jsx("p",{className:"text-sm text-text-muted mb-3 flex-shrink-0",children:c}),o.jsx("div",{className:"flex-1 min-h-[150px]",children:o.jsx("textarea",{value:p,onChange:C,placeholder:u,className:"w-full h-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary",disabled:x})}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:b,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:v,disabled:!m||x,children:_?"Saving...":"Save"})]})]})})}function uw({isOpen:e,onClose:r,project:i}){const s=Gt(u=>u.updateProject),c=async u=>{s(i.id,{customInstructions:u||null}),await new Promise(f=>setTimeout(f,100))};return o.jsx(cw,{isOpen:e,onClose:r,title:`${i.name} Settings`,label:"Project Instructions",description:"These instructions are injected into prompts when working in this project. They are applied after global instructions but before AGENTS.md files.",placeholder:"Enter project-specific instructions...",value:i.customInstructions??"",onSave:c})}const dw={sm:"w-3 h-3",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"};function Rs({onClick:e,className:r="",size:i="md",variant:s="default"}){const c=s==="overlay"?"bg-accent-error text-white rounded-full flex items-center justify-center hover:bg-accent-error/80 transition-colors":s==="sidebar"?"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors":s==="modal"?"text-text-muted hover:text-text-primary transition-colors":"hover:text-white transition-colors";return o.jsx("button",{onClick:e,className:`${c} ${r}`,title:"Close",children:o.jsx("svg",{className:dw[i],fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})}function Ab({projectId:e,isOpen:r=!0,onClose:i}){const[,s]=ar(),[c,u]=P.useState(!1),f=Ee(j=>j.sessions),l=Ee(j=>j.currentSession),d=Ee(j=>j.unreadSessionIds),p=Ee(j=>j.deleteSession),g=Ee(j=>j.deleteAllSessions),m=Ee(j=>j.loadMoreSessions),y=Ee(j=>j.sessionsHasMore),_=Ee(j=>j.sessionsPaginationLoading),k=Gt(j=>j.currentProject),C=P.useRef(null),v=P.useCallback(()=>{y&&!_&&k&&m(k.id)},[y,_,k,m]);P.useEffect(()=>{if(!C.current||!y)return;const j=new IntersectionObserver(A=>{const N=A[0];N&&N.isIntersecting&&v()},{threshold:.1});return j.observe(C.current),()=>j.disconnect()},[y,v]);const b=f.filter(j=>j.projectId===(k==null?void 0:k.id)),x=(j,A)=>{A==null||A.stopPropagation(),confirm("Delete this session?")&&(p(j),(l==null?void 0:l.id)===j&&s(`/p/${e}`))},S=()=>{confirm("Delete all sessions in this project? This cannot be undone.")&&(g(e),s(`/p/${e}`))};return o.jsxs(o.Fragment,{children:[r&&i&&o.jsx("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("aside",{className:`
|
|
77
77
|
${r?"md:w-[300px] md:shrink-0":"md:w-0 md:shrink-0 md:overflow-hidden"}
|
|
78
78
|
md:relative md:h-auto md:translate-x-0
|
|
79
79
|
|
|
@@ -81,14 +81,15 @@ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b)
|
|
|
81
81
|
w-[300px] bg-bg-secondary border-r border-border flex flex-col
|
|
82
82
|
transition-all duration-300 ease-in-out
|
|
83
83
|
${r?"translate-x-0":"-translate-x-full"}
|
|
84
|
-
`,children:[o.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[o.jsx(Ln,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(eo,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:S,danger:!0}],trigger:o.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),i&&o.jsx(Rs,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(uw,{isOpen:c,onClose:()=>u(!1),project:k}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:hw(b,l,d,x,e)}),_&&o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),o.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function hw(e,r,i,s,c){const u=Tb(e);return Array.from(u).map(([f,l])=>{const d=l[0];return d?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:jb(d.updatedAt)}),l.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.includes(p.id),y=p.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:o.jsxs(Ln,{href:`/p/${c}/s/${p.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),o.jsx(eo,{items:[{label:"Delete session",onClick:_=>s(p.id,_),danger:!0}],trigger:o.jsx("button",{onClick:_=>_.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[y?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Gl(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Ox=["⠋","⠙","⠹","⠸","⠼","⠴"];function fw(){var l;const e=Gt(d=>d.currentProject),r=Ee(d=>d.currentSession),i=bb(),s=!1,c=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Ox.length,f()},150),f()):(u.current&&(clearInterval(u.current),u.current=null),f()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[i,e,r,s]);const f=()=>{var m;const p=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Ox[c.current]} `:"";e&&p?document.title=`${g}${e.name} - ${p} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((l=r==null?void 0:r.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Vl=P.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...r}));Vl.displayName="Input";function pw({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),r()};return o.jsx(ln,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",o.jsx("span",{className:"font-semibold text-text-primary",children:i})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(st,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function mw(e){return!e||e.trim()===""?{valid:!1,error:"Project name cannot be empty"}:/^[a-zA-Z0-9._-]+$/.test(e)?{valid:!0}:{valid:!1,error:"Project name can only contain letters, numbers, hyphens, underscores, and dots"}}function gw({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(""),[u,f]=P.useState(null),[l,d]=P.useState(!1),[p,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(Ce("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),c(""),f(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const y=P.useCallback(async C=>{C.preventDefault();const v=mw(s);if(!v.valid){f(v.error);return}d(!0),f(null);const b=`${p}/${s}`;try{const x=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:b})});if(!x.ok){const A=await x.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await x.json()).project;r(),i(`/p/${j.id}`)}catch(x){f(x instanceof Error?x.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=P.useCallback(()=>{c(""),f(null),r()},[r]),k=s?`${p}/${s}`:"";return o.jsx(ln,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Vl,{ref:m,id:"project-name",value:s,onChange:C=>{c(C.target.value),f(null)},placeholder:"my-project",disabled:l,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:k})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:_,disabled:l,children:"Cancel"}),o.jsx(st,{type:"submit",variant:"primary",disabled:l||!s.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create"})]})]})})}const xw={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Yl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${xw[e]} ${r}`})}function vw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Yl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function Db({onSelect:e,onClose:r,initialPath:i}){const[s,c]=P.useState(null),[u,f]=P.useState(!0),l=P.useCallback(async k=>{f(!0);try{const C=k?`/api/directories?path=${encodeURIComponent(k)}`:"/api/directories",b=await(await Ce(C)).json();c(b)}catch(C){console.error("Failed to load directories:",C)}finally{f(!1)}},[]);P.useEffect(()=>{l(i)},[i,l]);const d=k=>{l(k)},p=k=>{e(k)},m=((s==null?void 0:s.current)??"").split("/").filter(Boolean),_=m.map((k,C)=>({name:k,path:"/"+m.slice(0,C+1).join("/")}));return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:r,children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Select Folder"}),o.jsx($l,{onClick:r,className:"hover:bg-bg-tertiary"})]}),s&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[_.map((k,C)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>d(k.path),className:`px-1 ${C===_.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:k.name})]},k.path)),_.length===0&&o.jsx("button",{onClick:()=>d("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(Yl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>d(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("span",{children:".."})]}),s==null?void 0:s.directories.map(k=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>d(k.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{children:k.name})]}),o.jsx("button",{onClick:()=>p(k.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},k.path)),(s==null?void 0:s.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"p-4 border-t border-border space-y-2",children:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>p(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})})}async function Ad(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await Ce(i)).json()}function bw({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(!1),[u,f]=P.useState(""),[l,d]=P.useState(null),[p,g]=P.useState(!1),[m,y]=P.useState(null),_=Gt(M=>M.projects),k=Gt(M=>M.createProject),C=Gt(M=>M.listProjects),v=Gt(M=>M.deleteProject),[b,x]=P.useState(null),[S,j]=P.useState(-1),[A,N]=P.useState(null),[D,T]=P.useState(!1),I=P.useRef([]);P.useEffect(()=>{Ce("/api/config").then(M=>M.json()).then(M=>{M.workdir&&y(M.workdir)})},[]);const H=P.useCallback(async M=>{g(!0);try{const L=await Ad(M,m??void 0);d(L)}catch(L){console.error("Failed to load directories:",L)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Ad(m),C())},[e,m,H,C]);const V=(l==null?void 0:l.directories.filter(M=>u===""||M.name.toLowerCase().includes(u.toLowerCase())))??[],Y=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...V.map(M=>({type:"directory",path:M.path,name:M.name}))],q=M=>{i(`/p/${M}`),r()},O=(M,L)=>{L.stopPropagation(),N(M)},U=()=>{A&&(v(A.id),N(null))},z=M=>{const L=M.split("/").filter(Boolean).pop()??"";k(L,M),C(),x(M)};P.useEffect(()=>{if(b){const M=_.find(L=>L.workdir===b);M&&(i(`/p/${M.id}`),r(),x(null))}},[_,b,i,r]),P.useEffect(()=>{j(Y.length>0?0:-1)},[u,Y.length]);const X=M=>{f(""),Ad(M)},Q=P.useCallback(M=>{if(!e)return;if(M.key==="Escape"){r();return}if(!["ArrowDown","ArrowUp","Enter"].includes(M.key))return;const L=document.activeElement;if(!(!L||L.tagName!=="INPUT")){if(M.preventDefault(),M.key==="ArrowDown")j(B=>{const W=B+1;return W>=Y.length?0:W});else if(M.key==="ArrowUp")j(B=>{const W=B-1;return W<0?Y.length-1:W});else if(M.key==="Enter"&&S>=0&&S<Y.length){const B=Y[S];(B==null?void 0:B.type)==="parent"?X(B.path):B&&z(B.path)}}},[e,Y.length,S,X,z,r]);return P.useEffect(()=>{if(e)return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[e,Q]),P.useEffect(()=>{S>=0&&I.current[S]&&I.current[S].scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-[90vw] md:max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),o.jsx(Rs,{onClick:r,variant:"modal",size:"lg"})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",children:[o.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:_.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):o.jsx("div",{className:"divide-y divide-border",children:_.map(M=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>q(M.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:M.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:M.workdir})]})]}),o.jsx("button",{onClick:L=>O(M,L),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},M.id))})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>T(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(Vl,{value:u,onChange:M=>f(M.target.value),placeholder:"Filter directories...",className:"w-full"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:p?o.jsx("div",{className:"p-8 text-center text-text-muted",children:o.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):Y.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:Y.map((M,L)=>o.jsxs("button",{ref:B=>{I.current[L]=B},onClick:()=>M.type==="parent"?X(M.path):z(M.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${L===S?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{className:"flex-1",children:M.name})]},M.path))})})]})]}),o.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[o.jsx(st,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"})]})]}),s&&o.jsx(gw,{isOpen:s,onClose:()=>c(!1)}),A&&o.jsx(pw,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:U}),D&&o.jsx(Db,{initialPath:m??void 0,onSelect:M=>{z(M),T(!1)},onClose:()=>T(!1)})]}):null}function yw(){const[e,r]=P.useState(!1),i=Ee(g=>g.sessions),s=Gt(g=>g.projects),c=Gt(g=>g.listProjects),u=Ee(g=>g.listSessions),f=Ee(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(c(),u())},[f,c,u]);const l=[...s].sort((g,m)=>{const y=i.filter(v=>v.workdir.startsWith(g.workdir)),_=i.filter(v=>v.workdir.startsWith(m.workdir)),k=y.length>0?new Date(y.reduce((v,b)=>new Date(b.updatedAt)>new Date(v.updatedAt)?b:v).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((v,b)=>new Date(b.updatedAt)>new Date(v.updatedAt)?b:v).updatedAt).getTime():new Date(m.updatedAt).getTime())-k}),d=g=>{const m=s.find(y=>y.id===g);return m?i.filter(y=>y.workdir.startsWith(m.workdir)).sort((y,_)=>new Date(_.updatedAt).getTime()-new Date(y.updatedAt).getTime()).slice(0,5):[]},p=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[o.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),o.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),o.jsx(st,{variant:"primary",onClick:p,children:"Open Project"})]}),l.map(g=>{const m=d(g.id);return o.jsx("div",{className:"mb-6 md:mb-8",children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[o.jsxs(Ln,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(Ln,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(y=>{const _=s.find(C=>y.workdir.startsWith(C.workdir)),k=_?`/p/${_.id}/s/${y.id}`:"#";return o.jsx(Ln,{href:k,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:y.title??y.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:nw(y.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[y.messageCount," msgs"]})]})]})},y.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),l.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(bw,{isOpen:e,onClose:()=>r(!1)})]})}function _w(){const[,e]=bh("/p/:projectId/new"),[,r]=ar(),i=e==null?void 0:e.projectId,s=Ee(c=>c.createSession);return P.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function Sw(){const e=Gt(r=>r.currentProject);return o.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-md",children:[o.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),o.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),o.jsxs("div",{className:"flex flex-col gap-3",children:[e&&o.jsx(Ln,{href:`/p/${e.id}/new`,className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),o.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const La=e=>Math.round(e*10)/10;function eh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function ww(e){return`${e.providerId}::${e.model}`}function Cw(e){return`${e.providerName} > ${e.model}`}function Bx(e){let r=0,i=0,s=0,c=0,u=0,f=0;const l=[],d=[];let p=0;for(const[y,_]of e.entries()){const k=_.stats,C=eh(k);r+=k.totalTime,i+=k.toolTime,s+=k.prefillTokens,c+=k.generationTokens;const v=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,b=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=v,f+=b,l.push({messageId:_.id,timestamp:_.timestamp,...C,mode:k.mode,responseIndex:y+1,prefillTokens:k.prefillTokens,generationTokens:k.generationTokens,prefillSpeed:k.prefillSpeed,generationSpeed:k.generationSpeed,totalTime:k.totalTime,aiTime:k.totalTime-k.toolTime,toolTime:k.toolTime});const x=k.llmCalls??[];for(const S of x)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:k.mode,responseIndex:y+1,sessionCallIndex:p,callIndex:S.callIndex,promptTokens:S.promptTokens,completionTokens:S.completionTokens,ttft:S.ttft,completionTime:S.completionTime,prefillSpeed:S.prefillSpeed,generationSpeed:S.generationSpeed,totalTime:S.totalTime})}const g=u>0?La(s/u):0,m=f>0?La(c/f):0;return{totalTime:La(r),aiTime:La(r-i),toolTime:La(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:l,callDataPoints:d}}function kw(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,u)=>new Date(c.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const c of r){const u=ww(eh(c.stats)),f=i.get(u)??[];i.set(u,[...f,c])}const s=Array.from(i.entries()).map(([c,u])=>{const f=eh(u[0].stats),l=Bx(u);return{...f,key:c,label:Cw(f),...l}});return{...Bx(r),modelGroups:s}}function Ew(e){return P.useMemo(()=>kw(e),[e])}function jw(e){const[r,i]=P.useState(null),[s,c]=P.useState(!0),[u,f]=P.useState(null),l=e||"";return P.useEffect(()=>{if(!l){c(!1);return}let d=!0,p=null;const g=async()=>{try{const y=await(await Ce(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();d&&(i(y.branch),f(y.error||null),c(!1))}catch(m){d&&(f(m instanceof Error?m.message:"Failed to fetch branch"),c(!1))}};return g(),p=setInterval(g,3e3),()=>{d=!1,p&&clearInterval(p)}},[l]),{branch:r,loading:s,error:u}}function Ll(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Ix(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Nw(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=Math.round(e%60);return`${r}m${i}s`}const Tw="modulepreload",Aw=function(e){return"/"+e},zx={},Dw=function(r,i,s){let c=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));c=f(i.map(p=>{if(p=Aw(p),p in zx)return;zx[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":Tw,g||(y.as="script"),y.crossOrigin="",y.href=p,d&&y.setAttribute("nonce",d),document.head.appendChild(y),g)return new Promise((_,k)=>{y.addEventListener("load",_),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=f,window.dispatchEvent(l),!l.defaultPrevented)throw f}return c.then(f=>{for(const l of f||[])l.status==="rejected"&&u(l.reason);return r().catch(u)})},Hx=["▁","▂","▃","▄","▅","▆","▇","█"];function Lw(e,r,i){if(i===r)return 4;const s=(e-r)/(i-r);return Math.min(7,Math.max(0,Math.round(s*7)))}function Rw(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function Mw(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,y)=>m.x-y.x),s=i[0].x,c=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),f=Math.max(...i.map(m=>m.y)),{minY:l,maxY:d}=Rw(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const y=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),_=g.get(y)??[];g.set(y,[..._,m.y])}for(const[m,y]of g){const _=Math.max(...y);p[m]=Hx[Lw(_,l,d)]??Hx[0]}return{blocks:p.join(""),minX:s,maxX:c,minY:l,maxY:d}}function Px(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Fx({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:u,showAxes:f=!0,formatY:l=Px,formatX:d=Px}){const p=P.useMemo(()=>{const g=Mw(e,r),m=Math.max(r*6,240),y=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:y+(S.x-g.minX)/(g.maxX-g.minX)*(m-y*2),A=g.maxY===g.minY?i/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(i-_*2);return{...S,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),v=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?i/2:_+(g.maxY-S)/(g.maxY-g.minY)*(i-_*2)}));return{...g,chartWidth:m,points:C,path:v,gridLines:x}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),o.jsxs("div",{className:"flex gap-3",children:[f&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:p.gridLines.map(g=>o.jsx("span",{children:l(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${p.chartWidth} ${i}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[p.gridLines.map(g=>o.jsx("line",{x1:"0",x2:p.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),p.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:i-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),p.points.length>1&&o.jsx("path",{d:p.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),p.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${l(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),f&&o.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[o.jsx("span",{className:"w-12"}),o.jsxs("span",{className:"flex-1 flex justify-between",children:[o.jsx("span",{children:d(p.minX)}),o.jsx("span",{children:c}),o.jsx("span",{children:d(p.maxX)})]})]}),u&&f&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function Ow({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:c=60}){const u=e.map(l=>({x:l.x,y:l.ppSpeed})),f=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(Fx,{data:u,width:c,label:r,xLabel:s}),o.jsx(Fx,{data:f,width:c,label:i,xLabel:s})]})}function Bw(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function Iw(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(r=>({x:r.responseIndex,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function zw(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(r=>({x:r.promptTokens,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function Hw(e){return e.callDataPoints.length>0?zw(e):Iw(e)}function Dd(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=e%60;return`${r}m ${i.toFixed(0)}s`}function Di(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ha(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Pw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Di(r)} ctx`:`${Di(r)}-${Di(i)} ctx`}function Rl(e){return`${Ha(e)} t/s`}function Lb(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Fw(e){return{exportedAt:new Date().toISOString(),providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model,label:e.label,summary:{totalTime:e.totalTime,aiTime:e.aiTime,toolTime:e.toolTime,prefillTokens:e.prefillTokens,generationTokens:e.generationTokens,avgPrefillSpeed:e.avgPrefillSpeed,avgGenerationSpeed:e.avgGenerationSpeed,responseCount:e.responseCount,llmCallCount:e.llmCallCount},responses:e.dataPoints.map(r=>({responseIndex:r.responseIndex,timestamp:r.timestamp,mode:r.mode,prefillTokens:r.prefillTokens,generationTokens:r.generationTokens,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime,aiTime:r.aiTime,toolTime:r.toolTime})),llmCalls:e.callDataPoints.map(r=>({sessionCallIndex:r.sessionCallIndex,responseIndex:r.responseIndex,callIndex:r.callIndex,timestamp:r.timestamp,mode:r.mode,promptTokens:r.promptTokens,completionTokens:r.completionTokens,ttft:r.ttft,completionTime:r.completionTime,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime}))}}function Uw({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[c,u]=P.useState({}),[f,l]=P.useState(()=>{var k;return((k=i.modelGroups[0])==null?void 0:k.key)??""});P.useEffect(()=>{var k;i.modelGroups.some(C=>C.key===f)||l(((k=i.modelGroups[0])==null?void 0:k.key)??"")},[f,i.modelGroups]);const d=P.useMemo(()=>i.modelGroups.find(k=>k.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=P.useMemo(()=>d?Bw(d):[],[d]),g=P.useMemo(()=>d?Hw(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),y=P.useCallback(()=>{if(!d)return;const k=Fw(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(s.current)try{const k=(await Dw(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[])).default,C=await k(s.current,{backgroundColor:"#1a1a1a",scale:2}),v=document.createElement("a");v.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,v.href=C.toDataURL("image/png"),v.click()}catch(k){console.error("Failed to export PNG:",k),y()}},[y]);return o.jsx(ln,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:s,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(k=>o.jsx("button",{onClick:()=>l(k.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${k.key===(d==null?void 0:d.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:k.label,children:k.label},k.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(jr,{label:"AI Time",value:Dd(d.aiTime)}),o.jsx(jr,{label:"Total Time",value:Dd(d.totalTime)}),o.jsx(jr,{label:"Tool Time",value:Dd(d.toolTime)}),o.jsx(jr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(jr,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(jr,{label:"Prefill Tokens",value:Di(d.prefillTokens),subValue:`@ ${Ha(d.avgPrefillSpeed)} tok/s`}),o.jsx(jr,{label:"Gen Tokens",value:Di(d.generationTokens),subValue:`@ ${Ha(d.avgGenerationSpeed)} tok/s`}),o.jsx(jr,{label:"Avg PP Speed",value:`${Ha(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(jr,{label:"Avg TG Speed",value:`${Ha(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:y,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),o.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:o.jsx(Ow,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:p.map((k,C)=>o.jsxs(P.Fragment,{children:[o.jsx($w,{row:k,index:C,isExpanded:c[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(c[k.messageId]??!1)&&k.calls.map((v,b)=>o.jsx(qw,{dataPoint:v,index:b},`${v.messageId}-${v.callIndex}`))]},k.messageId))})]})})]})]})})}function jr({label:e,value:r,subValue:i}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),o.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),i&&o.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function $w({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?Pw(e.calls.map(u=>u.promptTokens)):`${Di(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Lb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?i?"v":">":""})]})}function qw({dataPoint:e,index:r}){return o.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[o.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Lb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Di(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),o.jsx("td",{className:"px-2 py-2"})]})}const Ww={pending:{icon:"○",color:"text-text-muted",label:"Pending"},in_progress:{icon:"●",color:"text-accent-warning",label:"In Progress",animate:!0},completed:{icon:"◉",color:"text-purple-400",label:"Completed"},passed:{icon:"✓",color:"text-accent-success",label:"Passed"},failed:{icon:"✗",color:"text-accent-error",label:"Failed"}},Gw=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(c=>i[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(c=>{const u=Ww[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[c]})]},c)})})]})});function Vw({isOpen:e,onClose:r}){const i=ir(_=>_.config),s=ir(_=>_.saveConfig),[c,u]=P.useState(""),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),p((i==null?void 0:i.hotReload)??!1))},[e,i]);const y=async()=>{!c.trim()||!f.trim()||(m(!0),await s({command:c.trim(),url:f.trim(),hotReload:d}),m(!1),r())};return o.jsx(ln,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:c,onChange:_=>u(_.target.value),placeholder:"npm run dev"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),o.jsx("input",{className:"input w-full",type:"text",value:f,onChange:_=>l(_.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:_=>p(_.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:y,disabled:g||!c.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const Ux={30:"text-black",31:"text-red-400",32:"text-accent-success",33:"text-accent-warning",34:"text-blue-400",35:"text-purple-400",36:"text-cyan-400",37:"text-gray-300",90:"text-gray-500",91:"text-red-500",92:"text-green-500",93:"text-yellow-400",94:"text-blue-500",95:"text-pink-400",96:"text-cyan-500",97:"text-white"},Yw={40:"bg-black",41:"bg-red-900",42:"bg-green-900",43:"bg-yellow-900",44:"bg-blue-900",45:"bg-purple-900",46:"bg-cyan-900",47:"bg-gray-700"},$x={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},Kw="text-text-primary";function Xw(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const p=e.slice(s,u.index);p&&r.push({text:p,className:c})}const f=u[1];if(!f)continue;const l=f.split(";").map(Number);if(l.length===0||l[0]===0){c="text-text-primary";continue}const d=[];for(const p of l)if(p>=30&&p<=37){const g=Ux[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=Yw[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=Ux[p];g&&d.push(g)}else if(p in $x){const g=$x[p];g&&d.push(g)}else p===39?d.push(Kw):p===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(c=d.join(" ")),s=i.lastIndex}if(s<e.length){const f=e.slice(s);f&&r.push({text:f,className:c})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:Zw(e),className:"text-text-primary"}]}}function Zw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Ga(e){var i,s;const r=Xw(e);return r.length===1&&((i=r[0])==null?void 0:i.className)==="text-text-primary"?(s=r[0])==null?void 0:s.text:r.map((c,u)=>dn.createElement("span",{key:u,className:c.className},c.text))}const Rb=P.memo(function({title:r,logs:i,onClose:s,preClassName:c="flex-1 overflow-auto p-4 text-sm font-mono text-text-primary"}){const u=P.useRef(null);return P.useEffect(()=>{const f=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s]),P.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s,children:o.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:f=>f.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary truncate",children:r}),o.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),o.jsx("pre",{ref:u,className:c,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((f,l)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Ga(f.content)},l))})]})})}),Qw=P.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:c,onClose:u}){const[f,l]=P.useState(null),d=P.useRef(null);return P.useEffect(()=>{var g;const p=(g=i.current)==null?void 0:g.getBoundingClientRect();p&&l({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[i]),P.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),f?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:f.bottom,right:f.right,width:f.width*2,maxHeight:f.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((p,g)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:Ga(p.content)},g))}),o.jsx("button",{onClick:()=>{u(),c()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:f.bottom+8,right:f.right+8},children:"Expand"})]}):null}),Jw=P.memo(function({workdir:r}){const i=ir(H=>H.setWorkdir),s=ir(H=>H.status),c=ir(H=>H.config),u=ir(H=>H.logs),f=ir(H=>H.start),l=ir(H=>H.stop),d=ir(H=>H.fetchLogs),[p,g]=P.useState(!1),[m,y]=P.useState(!1),[_,k]=P.useState(!1),[C,v]=P.useState(!1),b=P.useRef(null),x=P.useRef(null),S=P.useRef(null),j=P.useRef(null),A=(s==null?void 0:s.state)??"off",N=c!==null,D=A==="running"||A==="warning";P.useEffect(()=>{i(r??null)},[r,i]),P.useEffect(()=>{D&&d()},[D,d]),P.useEffect(()=>{S.current&&D&&(S.current.scrollTop=S.current.scrollHeight)},[u,D]);const T=()=>{D?l():f()},I=o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})});return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:I})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):o.jsx("button",{onClick:T,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{x.current&&clearTimeout(x.current),b.current=setTimeout(()=>{k(!0),v(!1)},500)},onMouseLeave:()=>{b.current&&clearTimeout(b.current),v(!0),x.current=setTimeout(()=>k(!1),150)},children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((H,V)=>o.jsx("span",{className:H.stream==="stderr"?"text-accent-warning":"",children:Ga(H.content)},V))}),(_||C)&&j.current&&ql.createPortal(o.jsx(Qw,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>y(!0),onClose:()=>k(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(Vw,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(Rb,{title:"Dev Server Logs",logs:u,onClose:()=>y(!1)})]})}),e2=P.memo(function({isOpen:r,onClose:i,processName:s,logs:c}){return r?o.jsx(Rb,{title:s,logs:c,onClose:i,preClassName:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary whitespace-pre-wrap"}):null}),t2=P.memo(function({sessionId:r}){var _;const i=Pa(k=>k.processes),s=Pa(k=>k.stopProcess),[c,u]=P.useState(null),[f,l]=P.useState([]),d=i.filter(k=>k.status!=="exited"),p=d.filter(k=>k.status==="running").length;if(i.length===0)return null;const g=k=>{switch(k){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=k=>{const C=Pa.getState().logs[k]??[];l(C.map(v=>({content:v.content,stream:v.stream}))),u(k)},y=k=>{r&&s(k,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(k=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(k.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:k.name,children:k.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",k.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(k.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>y(k.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},k.id))}),c&&o.jsx(e2,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((_=d.find(k=>k.id===c))==null?void 0:_.name)??"",logs:f})]})});function qx({summary:e,messages:r,workdir:i}){const[s,c]=P.useState(!1),u=Ew(r),{branch:f}=jw(i),l=kt(p=>p.version),d=Ee(p=>p.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:Nw(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ix(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ix(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(Uw,{isOpen:s,onClose:()=>c(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(Gw,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(Jw,{workdir:i}),o.jsx(t2,{sessionId:d==null?void 0:d.id}),l&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",l]})]})]})}function n2({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const c=Ee(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:o.jsx(qx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
|
|
84
|
+
`,children:[o.jsxs("div",{className:"p-4 border-b border-border flex gap-2",children:[o.jsx(Ln,{href:`/p/${e}/new`,className:"flex-1 block text-center rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-1.5 text-sm","data-testid":"sidebar-new-session-button",children:"+ New Session"}),o.jsx(eo,{items:[{label:"Edit project settings",onClick:()=>u(!0)},{label:"Delete all sessions",onClick:S,danger:!0}],trigger:o.jsx("button",{className:"flex-shrink-0 p-2.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})}),i&&o.jsx(Rs,{onClick:i,className:"md:hidden",variant:"sidebar",size:"md"})]}),k&&o.jsx(uw,{isOpen:c,onClose:()=>u(!1),project:k}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"No sessions"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"divide-y divide-border",children:hw(b,l,d,x,e)}),_&&o.jsx("div",{className:"p-4 text-center text-text-muted text-xs",children:"Loading more..."}),o.jsx("div",{ref:C,className:"h-px"})]})})]})]})}function hw(e,r,i,s,c){const u=Tb(e);return Array.from(u).map(([f,l])=>{const d=l[0];return d?o.jsxs("div",{children:[o.jsx("div",{className:"px-4 py-2 bg-bg-tertiary/30 text-text-muted text-xs font-medium",children:jb(d.updatedAt)}),l.map(p=>{const g=(r==null?void 0:r.id)===p.id,m=i.includes(p.id),y=p.isRunning;return o.jsx("div",{className:`w-full px-4 py-3 text-left hover:bg-bg-tertiary/50 transition-colors group ${g?"bg-bg-tertiary":""}`,children:o.jsxs(Ln,{href:`/p/${c}/s/${p.id}`,className:`block ${g?"text-accent-primary":"text-text-primary"} hover:text-accent-primary`,children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsx("span",{className:`font-medium truncate text-sm ${g?"text-accent-primary":"text-text-primary"}`,children:p.title??p.id.slice(0,6)}),o.jsx(eo,{items:[{label:"Delete session",onClick:_=>s(p.id,_),danger:!0}],trigger:o.jsx("button",{onClick:_=>_.preventDefault(),className:"p-1.5 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-all",title:"Options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})})})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[y?o.jsxs("svg",{"aria-label":"Session running",className:"w-3 h-3 text-blue-400 animate-spin flex-shrink-0",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("title",{children:"Running"}),o.jsx("circle",{className:"opacity-30",cx:"12",cy:"12",r:"9",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M21 12a9 9 0 00-9-9",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]}):m&&!g?o.jsx("span",{"aria-label":"Unread activity",title:"Unread activity",className:"w-2 h-2 rounded-full bg-amber-400 flex-shrink-0"}):null,o.jsx("span",{className:"text-text-muted text-xs flex-shrink-0",children:Gl(p.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs flex-shrink-0",children:[p.messageCount," messages"]})]})]})},p.id)})]},f):null})}const Ox=["⠋","⠙","⠹","⠸","⠼","⠴"];function fw(){var l;const e=Gt(d=>d.currentProject),r=Ee(d=>d.currentSession),i=bb(),s=!1,c=P.useRef(0),u=P.useRef(null);P.useEffect(()=>(i?(u.current=window.setInterval(()=>{c.current=(c.current+1)%Ox.length,f()},150),f()):(u.current&&(clearInterval(u.current),u.current=null),f()),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[i,e,r,s]);const f=()=>{var m;const p=(m=r==null?void 0:r.metadata)==null?void 0:m.title,g=i?`${Ox[c.current]} `:"";e&&p?document.title=`${g}${e.name} - ${p} | OpenFox`:e?document.title=`${g}${e.name} | OpenFox`:document.title=`${g}OpenFox`};return typeof window<"u"&&((l=r==null?void 0:r.metadata)!=null&&l.title)&&window.document.documentElement.setAttribute("data-session-title",r.metadata.title),null}const Vl=P.forwardRef(({className:e="",...r},i)=>o.jsx("input",{ref:i,className:`bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 focus:border-accent-primary ${e}`,...r}));Vl.displayName="Input";function pw({isOpen:e,onClose:r,projectName:i,onConfirm:s}){const c=()=>{s(),r()};return o.jsx(cn,{isOpen:e,onClose:r,title:"Delete Project",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-text-secondary",children:["This will permanently delete the project ",o.jsx("span",{className:"font-semibold text-text-primary",children:i})," and all its sessions from OpenFox. The project files on disk will remain untouched."]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"}),o.jsx(st,{variant:"danger",onClick:c,children:"Delete"})]})]})})}function mw(e){return!e||e.trim()===""?{valid:!1,error:"Project name cannot be empty"}:/^[a-zA-Z0-9._-]+$/.test(e)?{valid:!0}:{valid:!1,error:"Project name can only contain letters, numbers, hyphens, underscores, and dots"}}function gw({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(""),[u,f]=P.useState(null),[l,d]=P.useState(!1),[p,g]=P.useState(""),m=P.useRef(null);P.useEffect(()=>{e&&(Ce("/api/config").then(C=>C.json()).then(C=>{C.workdir&&g(C.workdir)}),c(""),f(null),d(!1),setTimeout(()=>{var C;(C=m.current)==null||C.focus()},100))},[e]);const y=P.useCallback(async C=>{C.preventDefault();const v=mw(s);if(!v.valid){f(v.error);return}d(!0),f(null);const b=`${p}/${s}`;try{const x=await Ce("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,workdir:b})});if(!x.ok){const A=await x.json().catch(()=>({}));throw new Error(A.error||"Failed to create project")}const j=(await x.json()).project;r(),i(`/p/${j.id}`)}catch(x){f(x instanceof Error?x.message:"Failed to create project"),d(!1)}},[s,i,r,p]),_=P.useCallback(()=>{c(""),f(null),r()},[r]),k=s?`${p}/${s}`:"";return o.jsx(cn,{isOpen:e,onClose:_,title:"Create New Project",size:"sm",children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"project-name",className:"block text-sm font-medium text-text-secondary mb-2",children:"Project Name"}),o.jsx(Vl,{ref:m,id:"project-name",value:s,onChange:C=>{c(C.target.value),f(null)},placeholder:"my-project",disabled:l,className:"w-full"}),s&&o.jsxs("div",{className:"mt-2 text-xs text-text-muted",children:["Full path: ",o.jsx("span",{className:"font-mono",children:k})]}),u&&o.jsx("div",{className:"mt-3 p-3 bg-accent-error/10 border border-accent-error/30 rounded text-sm text-accent-error",children:u})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:_,disabled:l,children:"Cancel"}),o.jsx(st,{type:"submit",variant:"primary",disabled:l||!s.trim(),className:"min-w-[100px]",children:l?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create"})]})]})})}const xw={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};function Yl({size:e="md",className:r=""}){return o.jsx("div",{className:`animate-spin border-2 border-accent-primary border-t-transparent rounded-full ${xw[e]} ${r}`})}function vw({text:e,...r}){return o.jsxs("div",{className:"text-center",children:[o.jsx(Yl,{...r,className:"mx-auto mb-4"}),e&&o.jsx("div",{className:"text-text-secondary",children:e})]})}function Db({onSelect:e,onClose:r,initialPath:i}){const[s,c]=P.useState(null),[u,f]=P.useState(!0),l=P.useCallback(async k=>{f(!0);try{const C=k?`/api/directories?path=${encodeURIComponent(k)}`:"/api/directories",b=await(await Ce(C)).json();c(b)}catch(C){console.error("Failed to load directories:",C)}finally{f(!1)}},[]);P.useEffect(()=>{l(i)},[i,l]);const d=k=>{l(k)},p=k=>{e(k)},m=((s==null?void 0:s.current)??"").split("/").filter(Boolean),_=m.map((k,C)=>({name:k,path:"/"+m.slice(0,C+1).join("/")}));return o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",onClick:r,children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Select Folder"}),o.jsx($l,{onClick:r,className:"hover:bg-bg-tertiary"})]}),s&&o.jsx("div",{className:"px-3 py-2 bg-bg-tertiary/30 border-b border-border",children:o.jsxs("div",{className:"flex items-center text-xs overflow-x-auto",children:[_.map((k,C)=>o.jsxs("span",{className:"flex items-center shrink-0",children:[o.jsx("span",{className:"text-text-muted",children:"/"}),o.jsx("button",{onClick:()=>d(k.path),className:`px-1 ${C===_.length-1?"text-accent-primary font-medium":"text-text-secondary hover:text-accent-primary"}`,children:k.name})]},k.path)),_.length===0&&o.jsx("button",{onClick:()=>d("/"),className:"text-text-muted hover:text-accent-primary",children:"/"})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:u?o.jsx("div",{className:"p-8 text-center",children:o.jsx(Yl,{size:"sm"})}):o.jsxs("div",{className:"divide-y divide-border",children:[(s==null?void 0:s.parent)&&o.jsxs("button",{onClick:()=>d(s.parent),className:"w-full p-3 flex items-center gap-3 hover:bg-bg-tertiary/50 text-text-muted",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),o.jsx("span",{children:".."})]}),s==null?void 0:s.directories.map(k=>o.jsxs("div",{className:"group flex items-center gap-2 hover:bg-bg-tertiary/50",children:[o.jsxs("button",{onClick:()=>d(k.path),className:"flex-1 p-3 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{children:k.name})]}),o.jsx("button",{onClick:()=>p(k.path),className:"px-3 py-1 text-xs bg-accent-primary/10 text-accent-primary rounded opacity-0 group-hover:opacity-100 transition-opacity mr-3",children:"Select"})]},k.path)),(s==null?void 0:s.directories.length)===0&&o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:"No subdirectories"})]})}),o.jsxs("div",{className:"p-4 border-t border-border space-y-2",children:[(s==null?void 0:s.current)&&o.jsx("button",{onClick:()=>p(s.current),className:"w-full px-4 py-2 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Select this folder"}),o.jsx("button",{onClick:r,className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]})]})})}async function Ad(e,r){let i="/api/directories";return e?i=`/api/directories?path=${encodeURIComponent(e)}`:r&&(i=`/api/directories?path=${encodeURIComponent(r)}`),(await Ce(i)).json()}function bw({isOpen:e,onClose:r}){const[,i]=ar(),[s,c]=P.useState(!1),[u,f]=P.useState(""),[l,d]=P.useState(null),[p,g]=P.useState(!1),[m,y]=P.useState(null),_=Gt(M=>M.projects),k=Gt(M=>M.createProject),C=Gt(M=>M.listProjects),v=Gt(M=>M.deleteProject),[b,x]=P.useState(null),[S,j]=P.useState(-1),[A,N]=P.useState(null),[D,T]=P.useState(!1),I=P.useRef([]);P.useEffect(()=>{Ce("/api/config").then(M=>M.json()).then(M=>{M.workdir&&y(M.workdir)})},[]);const H=P.useCallback(async M=>{g(!0);try{const L=await Ad(M,m??void 0);d(L)}catch(L){console.error("Failed to load directories:",L)}finally{g(!1)}},[m]);P.useEffect(()=>{e&&m&&(Ad(m),C())},[e,m,H,C]);const V=(l==null?void 0:l.directories.filter(M=>u===""||M.name.toLowerCase().includes(u.toLowerCase())))??[],Y=[...l!=null&&l.parent&&!u?[{type:"parent",path:l.parent,name:".."}]:[],...V.map(M=>({type:"directory",path:M.path,name:M.name}))],q=M=>{i(`/p/${M}`),r()},O=(M,L)=>{L.stopPropagation(),N(M)},U=()=>{A&&(v(A.id),N(null))},z=M=>{const L=M.split("/").filter(Boolean).pop()??"";k(L,M),C(),x(M)};P.useEffect(()=>{if(b){const M=_.find(L=>L.workdir===b);M&&(i(`/p/${M.id}`),r(),x(null))}},[_,b,i,r]),P.useEffect(()=>{j(Y.length>0?0:-1)},[u,Y.length]);const X=M=>{f(""),Ad(M)},Q=P.useCallback(M=>{if(!e)return;if(M.key==="Escape"){r();return}if(!["ArrowDown","ArrowUp","Enter"].includes(M.key))return;const L=document.activeElement;if(!(!L||L.tagName!=="INPUT")){if(M.preventDefault(),M.key==="ArrowDown")j(B=>{const W=B+1;return W>=Y.length?0:W});else if(M.key==="ArrowUp")j(B=>{const W=B-1;return W<0?Y.length-1:W});else if(M.key==="Enter"&&S>=0&&S<Y.length){const B=Y[S];(B==null?void 0:B.type)==="parent"?X(B.path):B&&z(B.path)}}},[e,Y.length,S,X,z,r]);return P.useEffect(()=>{if(e)return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[e,Q]),P.useEffect(()=>{S>=0&&I.current[S]&&I.current[S].scrollIntoView({behavior:"smooth",block:"nearest"})},[S]),e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50",children:[o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg w-full max-w-[90vw] md:max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Open Project"}),o.jsx(Rs,{onClick:r,variant:"modal",size:"lg"})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-[400px]",children:[o.jsxs("div",{className:"w-1/2 border-r border-border flex flex-col",children:[o.jsx("div",{className:"p-3 border-b border-border bg-bg-tertiary/30",children:o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Recent Projects"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:_.length===0?o.jsx("div",{className:"p-4 text-center text-text-muted text-sm",children:"No recent projects"}):o.jsx("div",{className:"divide-y divide-border",children:_.map(M=>o.jsxs("div",{className:"group flex items-center gap-3 p-3 hover:bg-bg-tertiary/50 transition-colors",children:[o.jsxs("button",{onClick:()=>q(M.id),className:"flex-1 flex items-center gap-3 text-left",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:M.name}),o.jsx("div",{className:"text-xs text-text-muted truncate",children:M.workdir})]})]}),o.jsx("button",{onClick:L=>O(M,L),className:"opacity-0 group-hover:opacity-100 text-accent-error/70 hover:text-accent-error p-1 transition-opacity",title:"Delete project",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},M.id))})})]}),o.jsxs("div",{className:"w-1/2 flex flex-col",children:[o.jsxs("div",{className:"p-3 border-b border-border bg-bg-tertiary/30 flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-sm text-text-secondary",children:"Browse Projects"}),o.jsx("button",{onClick:()=>T(!0),className:"text-xs text-accent-primary hover:underline",children:"Open in dialog"})]}),o.jsx("div",{className:"p-3 border-b border-border",children:o.jsx(Vl,{value:u,onChange:M=>f(M.target.value),placeholder:"Filter directories...",className:"w-full"})}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:p?o.jsx("div",{className:"p-8 text-center text-text-muted",children:o.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full mx-auto"})}):Y.length===0?o.jsx("div",{className:"p-8 text-center text-text-muted text-sm",children:u?"No matching directories":"No subdirectories"}):o.jsx("div",{className:"divide-y divide-border",children:Y.map((M,L)=>o.jsxs("button",{ref:B=>{I.current[L]=B},onClick:()=>M.type==="parent"?X(M.path):z(M.path),className:`w-full p-3 flex items-center gap-3 text-left transition-colors ${L===S?"bg-accent-primary/20 text-accent-primary":"hover:bg-bg-tertiary/50"}`,children:[o.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{className:"flex-1",children:M.name})]},M.path))})})]})]}),o.jsxs("div",{className:"p-4 border-t border-border flex justify-between gap-2",children:[o.jsx(st,{variant:"secondary",onClick:()=>c(!0),children:"Create Project"}),o.jsx(st,{variant:"secondary",onClick:r,children:"Cancel"})]})]}),s&&o.jsx(gw,{isOpen:s,onClose:()=>c(!1)}),A&&o.jsx(pw,{isOpen:!0,onClose:()=>N(null),projectName:A.name,onConfirm:U}),D&&o.jsx(Db,{initialPath:m??void 0,onSelect:M=>{z(M),T(!1)},onClose:()=>T(!1)})]}):null}function yw(){const[e,r]=P.useState(!1),i=Ee(g=>g.sessions),s=Gt(g=>g.projects),c=Gt(g=>g.listProjects),u=Ee(g=>g.listSessions),f=Ee(g=>g.connectionStatus);P.useEffect(()=>{f==="connected"&&(c(),u())},[f,c,u]);const l=[...s].sort((g,m)=>{const y=i.filter(v=>v.workdir.startsWith(g.workdir)),_=i.filter(v=>v.workdir.startsWith(m.workdir)),k=y.length>0?new Date(y.reduce((v,b)=>new Date(b.updatedAt)>new Date(v.updatedAt)?b:v).updatedAt).getTime():new Date(g.updatedAt).getTime();return(_.length>0?new Date(_.reduce((v,b)=>new Date(b.updatedAt)>new Date(v.updatedAt)?b:v).updatedAt).getTime():new Date(m.updatedAt).getTime())-k}),d=g=>{const m=s.find(y=>y.id===g);return m?i.filter(y=>y.workdir.startsWith(m.workdir)).sort((y,_)=>new Date(_.updatedAt).getTime()-new Date(y.updatedAt).getTime()).slice(0,5):[]},p=()=>{r(!0)};return o.jsxs("div",{className:"flex-1 flex flex-col overflow-y-auto",children:[o.jsxs("div",{className:"max-w-5xl mx-auto w-full p-4 md:p-8",children:[o.jsxs("div",{className:"mb-6 md:mb-8 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold text-accent-primary",children:"OpenFox"}),o.jsx("p",{className:"text-text-secondary",children:"Local LLM-powered coding assistant with contract-driven execution"})]}),o.jsx(st,{variant:"primary",onClick:p,children:"Open Project"})]}),l.map(g=>{const m=d(g.id);return o.jsx("div",{className:"mb-6 md:mb-8",children:o.jsxs("div",{className:"bg-bg-secondary border border-border rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"p-3 md:p-4 border-b border-border flex items-center justify-between gap-2",children:[o.jsxs(Ln,{href:`/p/${g.id}`,className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity flex-1",children:[o.jsx("svg",{className:"w-5 h-5 text-accent-primary flex-shrink-0",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})}),o.jsx("span",{className:"text-text-primary font-semibold",children:g.name})]}),o.jsx(Ln,{href:`/p/${g.id}/new`,className:"rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-1.5 py-1 text-xs",children:"+ New Session"})]}),o.jsx("div",{className:"divide-y divide-border",children:m.length>0?m.map(y=>{const _=s.find(C=>y.workdir.startsWith(C.workdir)),k=_?`/p/${_.id}/s/${y.id}`:"#";return o.jsx(Ln,{href:k,className:"block p-3 md:p-4 hover:bg-bg-tertiary/50 cursor-pointer transition-colors",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx("div",{className:"text-sm text-text-muted truncate",children:y.title??y.id.slice(0,8)})})}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-text-muted text-xs",children:nw(y.updatedAt)}),o.jsxs("span",{className:"text-text-muted text-xs",children:[y.messageCount," msgs"]})]})]})},y.id)}):o.jsx("div",{className:"p-3 md:p-4 text-text-muted text-sm",children:"No sessions yet"})})]})},g.id)}),l.length===0&&o.jsx("div",{className:"text-center py-12 text-text-muted",children:"No projects yet. Open a project to get started."})]}),e&&o.jsx(bw,{isOpen:e,onClose:()=>r(!1)})]})}function _w(){const[,e]=bh("/p/:projectId/new"),[,r]=ar(),i=e==null?void 0:e.projectId,s=Ee(c=>c.createSession);return P.useEffect(()=>{i&&(async()=>{const u=await s(i);r(u?`/p/${i}/s/${u.id}`:`/p/${i}`)})()},[i,s,r]),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function Sw(){const e=Gt(r=>r.currentProject);return o.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:o.jsxs("div",{className:"max-w-md",children:[o.jsx("h2",{className:"text-xl font-semibold text-text-primary mb-2",children:(e==null?void 0:e.name)??"Project"}),o.jsx("p",{className:"text-text-secondary mb-6",children:"No session selected"}),o.jsxs("div",{className:"flex flex-col gap-3",children:[e&&o.jsx(Ln,{href:`/p/${e.id}/new`,className:"block w-full rounded font-medium transition-colors bg-accent-primary/25 text-white hover:bg-accent-primary/40 px-3 py-2 text-center",children:"Create New Session"}),o.jsx("p",{className:"text-sm text-text-muted",children:"Or select an existing session from the sidebar"})]})]})})}const La=e=>Math.round(e*10)/10;function eh(e){return{providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model}}function ww(e){return`${e.providerId}::${e.model}`}function Cw(e){return`${e.providerName} > ${e.model}`}function Bx(e){let r=0,i=0,s=0,c=0,u=0,f=0;const l=[],d=[];let p=0;for(const[y,_]of e.entries()){const k=_.stats,C=eh(k);r+=k.totalTime,i+=k.toolTime,s+=k.prefillTokens,c+=k.generationTokens;const v=k.prefillSpeed>0?k.prefillTokens/k.prefillSpeed:0,b=k.generationSpeed>0?k.generationTokens/k.generationSpeed:0;u+=v,f+=b,l.push({messageId:_.id,timestamp:_.timestamp,...C,mode:k.mode,responseIndex:y+1,prefillTokens:k.prefillTokens,generationTokens:k.generationTokens,prefillSpeed:k.prefillSpeed,generationSpeed:k.generationSpeed,totalTime:k.totalTime,aiTime:k.totalTime-k.toolTime,toolTime:k.toolTime});const x=k.llmCalls??[];for(const S of x)p+=1,d.push({messageId:_.id,timestamp:S.timestamp??_.timestamp,providerId:S.providerId,providerName:S.providerName,backend:S.backend,model:S.model,mode:k.mode,responseIndex:y+1,sessionCallIndex:p,callIndex:S.callIndex,promptTokens:S.promptTokens,completionTokens:S.completionTokens,ttft:S.ttft,completionTime:S.completionTime,prefillSpeed:S.prefillSpeed,generationSpeed:S.generationSpeed,totalTime:S.totalTime})}const g=u>0?La(s/u):0,m=f>0?La(c/f):0;return{totalTime:La(r),aiTime:La(r-i),toolTime:La(i),prefillTokens:s,generationTokens:c,avgPrefillSpeed:g,avgGenerationSpeed:m,responseCount:e.length,llmCallCount:d.length,dataPoints:l,callDataPoints:d}}function kw(e){const r=e.filter(c=>c.stats!==void 0&&c.stats!==null).sort((c,u)=>new Date(c.timestamp).getTime()-new Date(u.timestamp).getTime());if(r.length===0)return null;const i=new Map;for(const c of r){const u=ww(eh(c.stats)),f=i.get(u)??[];i.set(u,[...f,c])}const s=Array.from(i.entries()).map(([c,u])=>{const f=eh(u[0].stats),l=Bx(u);return{...f,key:c,label:Cw(f),...l}});return{...Bx(r),modelGroups:s}}function Ew(e){return P.useMemo(()=>kw(e),[e])}function jw(e){const[r,i]=P.useState(null),[s,c]=P.useState(!0),[u,f]=P.useState(null),l=e||"";return P.useEffect(()=>{if(!l){c(!1);return}let d=!0,p=null;const g=async()=>{try{const y=await(await Ce(`/api/branch?workdir=${encodeURIComponent(l)}`)).json();d&&(i(y.branch),f(y.error||null),c(!1))}catch(m){d&&(f(m instanceof Error?m.message:"Failed to fetch branch"),c(!1))}};return g(),p=setInterval(g,3e3),()=>{d=!1,p&&clearInterval(p)}},[l]),{branch:r,loading:s,error:u}}function Ll(e){return e.toLocaleString("en-US").replace(/,/g," ")}function Ix(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Nw(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=Math.round(e%60);return`${r}m${i}s`}const Tw="modulepreload",Aw=function(e){return"/"+e},zx={},Dw=function(r,i,s){let c=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));c=f(i.map(p=>{if(p=Aw(p),p in zx)return;zx[p]=!0;const g=p.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":Tw,g||(y.as="script"),y.crossOrigin="",y.href=p,d&&y.setAttribute("nonce",d),document.head.appendChild(y),g)return new Promise((_,k)=>{y.addEventListener("load",_),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function u(f){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=f,window.dispatchEvent(l),!l.defaultPrevented)throw f}return c.then(f=>{for(const l of f||[])l.status==="rejected"&&u(l.reason);return r().catch(u)})},Hx=["▁","▂","▃","▄","▅","▆","▇","█"];function Lw(e,r,i){if(i===r)return 4;const s=(e-r)/(i-r);return Math.min(7,Math.max(0,Math.round(s*7)))}function Rw(e,r){if(e===r){const c=Math.max(Math.abs(e)*.05,1);return{minY:e-c,maxY:r+c}}const i=r-e,s=Math.max(i*.1,.1);return{minY:e-s,maxY:r+s}}function Mw(e,r){if(e.length===0||r<=0)return{blocks:"",minX:0,maxX:0,minY:0,maxY:0};const i=[...e].sort((m,y)=>m.x-y.x),s=i[0].x,c=i[i.length-1].x,u=Math.min(...i.map(m=>m.y)),f=Math.max(...i.map(m=>m.y)),{minY:l,maxY:d}=Rw(u,f),p=Array.from({length:r},()=>" "),g=new Map;for(const m of i){const y=c===s?0:Math.round((m.x-s)/(c-s)*(r-1)),_=g.get(y)??[];g.set(y,[..._,m.y])}for(const[m,y]of g){const _=Math.max(...y);p[m]=Hx[Lw(_,l,d)]??Hx[0]}return{blocks:p.join(""),minX:s,maxX:c,minY:l,maxY:d}}function Px(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Fx({data:e,width:r=60,height:i=78,label:s,xLabel:c,yLabel:u,showAxes:f=!0,formatY:l=Px,formatX:d=Px}){const p=P.useMemo(()=>{const g=Mw(e,r),m=Math.max(r*6,240),y=10,_=8,C=[...e].sort((S,j)=>S.x-j.x).map(S=>{const j=g.maxX===g.minX?m/2:y+(S.x-g.minX)/(g.maxX-g.minX)*(m-y*2),A=g.maxY===g.minY?i/2:_+(g.maxY-S.y)/(g.maxY-g.minY)*(i-_*2);return{...S,cx:j,cy:A,leftPercent:j/m*100,topPercent:A/i*100}}),v=C.map((S,j)=>`${j===0?"M":"L"} ${S.cx.toFixed(1)} ${S.cy.toFixed(1)}`).join(" "),x=[g.maxY,(g.maxY+g.minY)/2,g.minY].map(S=>({value:S,y:g.maxY===g.minY?i/2:_+(g.maxY-S)/(g.maxY-g.minY)*(i-_*2)}));return{...g,chartWidth:m,points:C,path:v,gridLines:x}},[e,i,r]);return e.length===0?o.jsxs("div",{className:"font-mono text-text-muted text-xs",children:[s&&o.jsx("div",{className:"mb-1",children:s}),o.jsx("div",{children:"No data"})]}):o.jsxs("div",{className:"font-mono text-xs",children:[s&&o.jsx("div",{className:"text-text-secondary mb-2",children:s}),o.jsxs("div",{className:"flex gap-3",children:[f&&o.jsx("div",{className:"w-12 h-[78px] flex flex-col justify-between text-right text-text-muted",children:p.gridLines.map(g=>o.jsx("span",{children:l(g.value)},`${g.value}-${g.y}`))}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"relative h-[78px]",children:[o.jsxs("svg",{viewBox:`0 0 ${p.chartWidth} ${i}`,className:"w-full h-[78px] overflow-visible",preserveAspectRatio:"none","aria-hidden":"true",children:[p.gridLines.map(g=>o.jsx("line",{x1:"0",x2:p.chartWidth,y1:g.y,y2:g.y,stroke:"currentColor",strokeDasharray:"3 4",className:"text-border/60"},`grid-${g.y}`)),p.points.map(g=>o.jsx("line",{x1:g.cx,x2:g.cx,y1:i-4,y2:g.cy,stroke:"currentColor",className:"text-border/40"},`guide-${g.cx}-${g.cy}`)),p.points.length>1&&o.jsx("path",{d:p.path,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-accent-primary/45"})]}),p.points.map(g=>o.jsx("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${g.leftPercent}%`,top:`${g.topPercent}%`},title:`${d(g.x)} -> ${l(g.y)}`,children:o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-primary/20 flex items-center justify-center",children:o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})})},`point-${g.x}-${g.y}`))]})})]}),f&&o.jsxs("div",{className:"flex items-start gap-3 text-text-muted mt-1",children:[o.jsx("span",{className:"w-12"}),o.jsxs("span",{className:"flex-1 flex justify-between",children:[o.jsx("span",{children:d(p.minX)}),o.jsx("span",{children:c}),o.jsx("span",{children:d(p.maxX)})]})]}),u&&f&&o.jsx("div",{className:"text-text-muted mt-1 text-center",children:u})]})}function Ow({data:e,prefillLabel:r="Prefill Speed (tok/s) by Response",generationLabel:i="Generation Speed (tok/s) by Response",xLabel:s="response",width:c=60}){const u=e.map(l=>({x:l.x,y:l.ppSpeed})),f=e.map(l=>({x:l.x,y:l.tgSpeed}));return o.jsxs("div",{className:"space-y-5",children:[o.jsx(Fx,{data:u,width:c,label:r,xLabel:s}),o.jsx(Fx,{data:f,width:c,label:i,xLabel:s})]})}function Bw(e){const r=new Map;for(const i of e.callDataPoints){const s=r.get(i.messageId)??[];r.set(i.messageId,[...s,i])}return e.dataPoints.map(i=>{const s=[...r.get(i.messageId)??[]].sort((c,u)=>c.callIndex-u.callIndex);return{...i,callCount:s.length,calls:s,isExpandable:s.length>1}})}function Iw(e){return{mode:"responses",xLabel:"response",prefillLabel:"Prefill Speed (tok/s) by Response",generationLabel:"Generation Speed (tok/s) by Response",points:e.dataPoints.map(r=>({x:r.responseIndex,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function zw(e){return{mode:"calls",xLabel:"context",prefillLabel:"Prefill Speed (tok/s) vs Context",generationLabel:"Generation Speed (tok/s) vs Context",points:e.callDataPoints.map(r=>({x:r.promptTokens,ppSpeed:r.prefillSpeed,tgSpeed:r.generationSpeed}))}}function Hw(e){return e.callDataPoints.length>0?zw(e):Iw(e)}function Dd(e){if(e<60)return`${e.toFixed(1)}s`;const r=Math.floor(e/60),i=e%60;return`${r}m ${i.toFixed(0)}s`}function Di(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toString()}function Ha(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function Pw(e){if(e.length===0)return"0 ctx";const r=Math.min(...e),i=Math.max(...e);return r===i?`${Di(r)} ctx`:`${Di(r)}-${Di(i)} ctx`}function Rl(e){return`${Ha(e)} t/s`}function Lb(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}catch{return e}}function Fw(e){return{exportedAt:new Date().toISOString(),providerId:e.providerId,providerName:e.providerName,backend:e.backend,model:e.model,label:e.label,summary:{totalTime:e.totalTime,aiTime:e.aiTime,toolTime:e.toolTime,prefillTokens:e.prefillTokens,generationTokens:e.generationTokens,avgPrefillSpeed:e.avgPrefillSpeed,avgGenerationSpeed:e.avgGenerationSpeed,responseCount:e.responseCount,llmCallCount:e.llmCallCount},responses:e.dataPoints.map(r=>({responseIndex:r.responseIndex,timestamp:r.timestamp,mode:r.mode,prefillTokens:r.prefillTokens,generationTokens:r.generationTokens,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime,aiTime:r.aiTime,toolTime:r.toolTime})),llmCalls:e.callDataPoints.map(r=>({sessionCallIndex:r.sessionCallIndex,responseIndex:r.responseIndex,callIndex:r.callIndex,timestamp:r.timestamp,mode:r.mode,promptTokens:r.promptTokens,completionTokens:r.completionTokens,ttft:r.ttft,completionTime:r.completionTime,prefillSpeed:r.prefillSpeed,generationSpeed:r.generationSpeed,totalTime:r.totalTime}))}}function Uw({isOpen:e,onClose:r,stats:i}){const s=P.useRef(null),[c,u]=P.useState({}),[f,l]=P.useState(()=>{var k;return((k=i.modelGroups[0])==null?void 0:k.key)??""});P.useEffect(()=>{var k;i.modelGroups.some(C=>C.key===f)||l(((k=i.modelGroups[0])==null?void 0:k.key)??"")},[f,i.modelGroups]);const d=P.useMemo(()=>i.modelGroups.find(k=>k.key===f)??i.modelGroups[0],[f,i.modelGroups]),p=P.useMemo(()=>d?Bw(d):[],[d]),g=P.useMemo(()=>d?Hw(d):{mode:"responses",xLabel:"response",prefillLabel:"",generationLabel:"",points:[]},[d]),m=P.useCallback(k=>{u(C=>({...C,[k]:!C[k]}))},[]),y=P.useCallback(()=>{if(!d)return;const k=Fw(d);navigator.clipboard.writeText(JSON.stringify(k,null,2)).catch(C=>console.error("Failed to copy:",C))},[d]),_=P.useCallback(async()=>{if(s.current)try{const k=(await Dw(async()=>{const{default:b}=await import("./html2canvas.esm-QH1iLAAe.js");return{default:b}},[])).default,C=await k(s.current,{backgroundColor:"#1a1a1a",scale:2}),v=document.createElement("a");v.download=`openfox-stats-${new Date().toISOString().slice(0,10)}.png`,v.href=C.toDataURL("image/png"),v.click()}catch(k){console.error("Failed to export PNG:",k),y()}},[y]);return o.jsx(cn,{isOpen:e,onClose:r,title:"Session Stats",size:"lg",children:o.jsxs("div",{ref:s,className:"space-y-6",children:[o.jsx("section",{children:o.jsx("div",{className:"flex flex-wrap gap-2",children:i.modelGroups.map(k=>o.jsx("button",{onClick:()=>l(k.key),className:`px-3 py-1.5 rounded border text-xs transition-colors ${k.key===(d==null?void 0:d.key)?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border text-text-muted hover:text-text-primary hover:bg-bg-tertiary/40"}`,title:k.label,children:k.label},k.key))})}),d&&o.jsxs("section",{children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:"Summary"}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[o.jsx(jr,{label:"AI Time",value:Dd(d.aiTime)}),o.jsx(jr,{label:"Total Time",value:Dd(d.totalTime)}),o.jsx(jr,{label:"Tool Time",value:Dd(d.toolTime)}),o.jsx(jr,{label:"Responses",value:d.responseCount.toString()}),o.jsx(jr,{label:"LLM Calls",value:d.llmCallCount.toString()})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-3",children:[o.jsx(jr,{label:"Prefill Tokens",value:Di(d.prefillTokens),subValue:`@ ${Ha(d.avgPrefillSpeed)} tok/s`}),o.jsx(jr,{label:"Gen Tokens",value:Di(d.generationTokens),subValue:`@ ${Ha(d.avgGenerationSpeed)} tok/s`}),o.jsx(jr,{label:"Avg PP Speed",value:`${Ha(d.avgPrefillSpeed)}`,subValue:"tok/s"}),o.jsx(jr,{label:"Avg TG Speed",value:`${Ha(d.avgGenerationSpeed)}`,subValue:"tok/s"})]})]}),d&&g.points.length>1&&o.jsxs("section",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-secondary uppercase tracking-wide",children:"Performance Progression"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:y,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Copy JSON"}),o.jsx("button",{onClick:_,className:"px-2 py-1 text-xs text-text-muted hover:text-text-primary hover:bg-bg-tertiary rounded transition-colors",children:"Save PNG"})]})]}),o.jsx("div",{className:"bg-bg-tertiary/50 rounded p-4",children:o.jsx(Ow,{data:g.points,width:50,prefillLabel:g.prefillLabel,generationLabel:g.generationLabel,xLabel:g.xLabel})})]}),d&&o.jsxs("section",{children:[o.jsxs("h3",{className:"text-sm font-semibold text-text-secondary mb-3 uppercase tracking-wide",children:["Response Log (",d.responseCount," responses)"]}),o.jsx("div",{className:"overflow-y-auto bg-bg-tertiary/30 rounded",children:o.jsxs("table",{className:"w-full table-fixed border-separate border-spacing-0 text-xs",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"w-[7%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[10%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[14%]"}),o.jsx("col",{className:"w-[11%]"}),o.jsx("col",{className:"w-[2%]"})]}),o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted/80",children:[o.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"#"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"At"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Time"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Context"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"PP t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"TG t/s"}),o.jsx("th",{className:"px-2 py-2 text-center font-medium",children:"Calls"}),o.jsx("th",{className:"px-2 py-2"})]})}),o.jsx("tbody",{children:p.map((k,C)=>o.jsxs(P.Fragment,{children:[o.jsx($w,{row:k,index:C,isExpanded:c[k.messageId]??!1,onToggle:k.isExpandable?()=>m(k.messageId):void 0}),(c[k.messageId]??!1)&&k.calls.map((v,b)=>o.jsx(qw,{dataPoint:v,index:b},`${v.messageId}-${v.callIndex}`))]},k.messageId))})]})})]})]})})}function jr({label:e,value:r,subValue:i}){return o.jsxs("div",{className:"bg-bg-tertiary/50 rounded p-3",children:[o.jsx("div",{className:"text-text-muted text-xs mb-1",children:e}),o.jsx("div",{className:"text-text-primary text-lg font-semibold",children:r}),i&&o.jsx("div",{className:"text-text-muted text-xs",children:i})]})}function $w({row:e,index:r,isExpanded:i,onToggle:s}){const c=e.calls.length>0?Pw(e.calls.map(u=>u.promptTokens)):`${Di(e.prefillTokens)} ctx`;return o.jsxs("tr",{onClick:s,className:`${r%2===0?"bg-bg-tertiary/20":""} ${s?"cursor-pointer hover:bg-bg-tertiary/35 transition-colors":""}`,children:[o.jsx("td",{className:"px-3 py-2 text-center text-text-muted align-middle",children:e.responseIndex}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Lb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:c.replace(/ ctx$/,"")}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callCount}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:e.isExpandable?i?"v":">":""})]})}function qw({dataPoint:e,index:r}){return o.jsxs("tr",{className:`${r%2===0?"bg-bg-tertiary/10":"bg-bg-tertiary/5"}`,children:[o.jsxs("td",{className:"px-3 py-2 pl-6 text-center text-text-muted align-middle border-l border-border/60",children:["c",e.callIndex]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:Lb(e.timestamp)}),o.jsxs("td",{className:"px-2 py-2 text-center text-text-muted align-middle whitespace-nowrap",children:[e.totalTime.toFixed(1),"s"]}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Di(e.promptTokens)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.prefillSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-primary font-mono align-middle whitespace-nowrap",children:Rl(e.generationSpeed)}),o.jsx("td",{className:"px-2 py-2 text-center text-text-muted font-mono align-middle whitespace-nowrap",children:e.callIndex}),o.jsx("td",{className:"px-2 py-2"})]})}const Ww={pending:{icon:"○",color:"text-text-muted",label:"Pending"},in_progress:{icon:"●",color:"text-accent-warning",label:"In Progress",animate:!0},completed:{icon:"◉",color:"text-purple-400",label:"Completed"},passed:{icon:"✓",color:"text-accent-success",label:"Passed"},failed:{icon:"✗",color:"text-accent-error",label:"Failed"}},Gw=P.memo(function({criteria:r}){if(r.length===0)return o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No criteria yet"});const i={pending:0,in_progress:0,completed:0,passed:0,failed:0};for(const c of r){const u=c.status.type;u in i&&i[u]++}const s=Object.keys(i).filter(c=>i[c]>0);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:"font-semibold text-text-primary",children:"Total:"}),o.jsx("span",{className:"text-text-secondary",children:r.length})]}),o.jsx("div",{className:"space-y-1",children:s.map(c=>{const u=Ww[c];return o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx("span",{className:`${u.color} ${u.animate?"animate-pulse":""} text-sm leading-tight`,children:u.icon}),o.jsxs("span",{className:"text-text-muted",children:[u.label,":"]}),o.jsx("span",{className:"text-text-primary font-medium",children:i[c]})]},c)})})]})});function Vw({isOpen:e,onClose:r}){const i=ir(_=>_.config),s=ir(_=>_.saveConfig),[c,u]=P.useState(""),[f,l]=P.useState(""),[d,p]=P.useState(!1),[g,m]=P.useState(!1);P.useEffect(()=>{e&&(u((i==null?void 0:i.command)??""),l((i==null?void 0:i.url)??""),p((i==null?void 0:i.hotReload)??!1))},[e,i]);const y=async()=>{!c.trim()||!f.trim()||(m(!0),await s({command:c.trim(),url:f.trim(),hotReload:d}),m(!1),r())};return o.jsx(cn,{isOpen:e,onClose:r,title:"Dev Server Config",size:"sm",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Command"}),o.jsx("input",{className:"input w-full",type:"text",value:c,onChange:_=>u(_.target.value),placeholder:"npm run dev"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Dev URL"}),o.jsx("input",{className:"input w-full",type:"text",value:f,onChange:_=>l(_.target.value),placeholder:"http://localhost:3000"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"checkbox",id:"hotReload",checked:d,onChange:_=>p(_.target.checked),className:"rounded border-border bg-bg-tertiary"}),o.jsx("label",{htmlFor:"hotReload",className:"text-xs text-text-secondary",children:"Hot Reload"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:y,disabled:g||!c.trim()||!f.trim(),children:g?"Saving...":"Save"})]})]})})}const Ux={30:"text-black",31:"text-red-400",32:"text-accent-success",33:"text-accent-warning",34:"text-blue-400",35:"text-purple-400",36:"text-cyan-400",37:"text-gray-300",90:"text-gray-500",91:"text-red-500",92:"text-green-500",93:"text-yellow-400",94:"text-blue-500",95:"text-pink-400",96:"text-cyan-500",97:"text-white"},Yw={40:"bg-black",41:"bg-red-900",42:"bg-green-900",43:"bg-yellow-900",44:"bg-blue-900",45:"bg-purple-900",46:"bg-cyan-900",47:"bg-gray-700"},$x={1:"font-bold",2:"opacity-75",4:"underline",7:"bg-bg-secondary"},Kw="text-text-primary";function Xw(e){const r=[],i=/\x1b\[([0-9;]+)m/g;let s=0,c="text-text-primary",u;try{for(;(u=i.exec(e))!==null;){if(u.index>s){const p=e.slice(s,u.index);p&&r.push({text:p,className:c})}const f=u[1];if(!f)continue;const l=f.split(";").map(Number);if(l.length===0||l[0]===0){c="text-text-primary";continue}const d=[];for(const p of l)if(p>=30&&p<=37){const g=Ux[p];g&&d.push(g)}else if(p>=40&&p<=47){const g=Yw[p];g&&d.push(g)}else if(p>=90&&p<=97){const g=Ux[p];g&&d.push(g)}else if(p in $x){const g=$x[p];g&&d.push(g)}else p===39?d.push(Kw):p===49&&(c=c.split(" ").filter(g=>!g.startsWith("bg-")).join(" "));d.length>0&&(c=d.join(" ")),s=i.lastIndex}if(s<e.length){const f=e.slice(s);f&&r.push({text:f,className:c})}return r}catch(f){return console.warn("ANSI parsing failed, stripping codes:",f),[{text:Zw(e),className:"text-text-primary"}]}}function Zw(e){return e.replace(/\x1b\[([0-9;]+)m/g,"")}function Ga(e){const r=Xw(e),i=[];return r.forEach((s,c)=>{const u=s.text.split(`
|
|
85
|
+
`);u.forEach((f,l)=>{i.push(on.createElement("span",{key:`${c}-${l}`,className:s.className,style:{display:"inline-block",whiteSpace:"pre-wrap"}},f)),l<u.length-1&&i.push(on.createElement("br",{key:`${c}-${l}-br`}))})}),i.length===1?i[0]:i}const Rb=P.memo(function({title:r,logs:i,onClose:s,preClassName:c="flex-1 overflow-auto p-4 text-sm font-mono text-text-primary"}){const u=P.useRef(null);return P.useEffect(()=>{const f=l=>{l.key==="Escape"&&s()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[s]),P.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[i]),o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s,children:o.jsxs("div",{className:"relative w-[90vw] h-[90vh] bg-bg-primary rounded-lg border border-border flex flex-col",onClick:f=>f.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary truncate",children:r}),o.jsx("button",{onClick:s,className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",children:o.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),o.jsx("pre",{ref:u,className:c,children:i.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):i.map((f,l)=>o.jsx("span",{className:f.stream==="stderr"?"text-accent-warning":"",children:Ga(f.content)},l))})]})})}),Qw=P.memo(function({logs:r,anchorRef:i,isHiding:s,onExpand:c,onClose:u}){const[f,l]=P.useState(null),d=P.useRef(null);return P.useEffect(()=>{var g;const p=(g=i.current)==null?void 0:g.getBoundingClientRect();p&&l({bottom:window.innerHeight-p.bottom,right:window.innerWidth-p.right,width:p.width,height:p.height})},[i]),P.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[r]),f?o.jsxs("div",{className:"relative",children:[o.jsx("pre",{ref:d,className:"fixed z-50 text-sm font-mono text-text-primary bg-bg-primary p-2 rounded border border-border overflow-auto transition-all duration-150 ease-out select-text",style:{bottom:f.bottom,right:f.right,width:f.width*2,maxHeight:f.height*3,transformOrigin:"bottom right",transform:s?"scale(0.01)":"scale(1)",opacity:s?0:1},children:r.map((p,g)=>o.jsx("span",{className:p.stream==="stderr"?"text-accent-warning":"",children:Ga(p.content)},g))}),o.jsx("button",{onClick:()=>{u(),c()},className:"fixed z-50 px-2 py-1 rounded text-xs font-medium bg-accent-primary/30 text-white hover:bg-accent-primary/50 transition-colors duration-150",style:{bottom:f.bottom+8,right:f.right+8},children:"Expand"})]}):null}),Jw=P.memo(function({workdir:r}){const i=ir(H=>H.setWorkdir),s=ir(H=>H.status),c=ir(H=>H.config),u=ir(H=>H.logs),f=ir(H=>H.start),l=ir(H=>H.stop),d=ir(H=>H.fetchLogs),[p,g]=P.useState(!1),[m,y]=P.useState(!1),[_,k]=P.useState(!1),[C,v]=P.useState(!1),b=P.useRef(null),x=P.useRef(null),S=P.useRef(null),j=P.useRef(null),A=(s==null?void 0:s.state)??"off",N=c!==null,D=A==="running"||A==="warning";P.useEffect(()=>{i(r??null)},[r,i]),P.useEffect(()=>{D&&d()},[D,d]),P.useEffect(()=>{S.current&&D&&(S.current.scrollTop=S.current.scrollHeight)},[u,D]);const T=()=>{D?l():f()},I=o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M8 0a8.2 8.2 0 0 1 .701.031C9.444.095 9.99.645 10.16 1.29l.288 1.107c.018.066.079.158.212.224.231.114.454.243.668.386.123.082.233.09.299.071l1.1-.303c.652-.18 1.37.008 1.755.653a8.043 8.043 0 0 1 .683 1.18c.227.568.096 1.26-.378 1.726l-.812.804a.312.312 0 0 0-.081.283c.024.166.04.335.04.507s-.016.341-.04.507a.312.312 0 0 0 .08.283l.813.804c.474.466.605 1.158.378 1.726a8.07 8.07 0 0 1-.683 1.18c-.385.645-1.103.833-1.755.653l-1.1-.303c-.066-.019-.176-.011-.299.071a5.1 5.1 0 0 1-.668.386c-.133.066-.194.158-.211.224l-.29 1.107c-.168.645-.714 1.196-1.458 1.26a8.094 8.094 0 0 1-1.402 0c-.744-.064-1.29-.615-1.458-1.26l-.29-1.107a.426.426 0 0 0-.211-.224 5.11 5.11 0 0 1-.668-.386c-.123-.082-.233-.09-.299-.071l-1.1.303c-.652.18-1.37-.008-1.755-.653a8.044 8.044 0 0 1-.683-1.18c-.227-.568-.096-1.26.378-1.726l.812-.804a.312.312 0 0 0 .081-.283A5.18 5.18 0 0 1 2.3 8c0-.172.016-.341.04-.507a.312.312 0 0 0-.08-.283l-.813-.804C.973 5.94.842 5.248 1.069 4.68c.181-.452.395-.882.683-1.18.385-.645 1.103-.833 1.755-.653l1.1.303c.066.019.176.011.299-.071.214-.143.437-.272.668-.386a.426.426 0 0 0 .211-.224l.29-1.107C6.009.645 6.556.095 7.299.03 7.53.01 7.764 0 8 0Zm0 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z"})});return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 ${A==="running"?"bg-accent-success":A==="warning"?"bg-accent-warning":A==="error"?"bg-accent-error":"bg-text-muted"}`}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Dev Server"})]}),o.jsx("button",{onClick:()=>g(!0),className:"p-1.5 rounded hover:bg-bg-tertiary transition-colors text-text-muted",title:"Configure dev server",children:I})]}),N?o.jsxs(o.Fragment,{children:[A==="running"||A==="warning"?o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("button",{onClick:T,className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-primary hover:bg-border transition-colors",children:[o.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),"Stop"]}),(s==null?void 0:s.url)&&o.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-1.5 rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",title:s.url,children:[o.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M6.5 3.5H3a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1h8.5a1 1 0 0 0 1-1V9.5"}),o.jsx("path",{d:"M9.5 2h4.5v4.5"}),o.jsx("path",{d:"M14 2L7.5 8.5"})]}),"Open"]})]}):o.jsx("button",{onClick:T,className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-accent-primary/25 text-white hover:bg-accent-primary/40 transition-colors",children:"Start"}),D&&o.jsxs("div",{ref:j,className:"relative",onMouseEnter:()=>{x.current&&clearTimeout(x.current),b.current=setTimeout(()=>{k(!0),v(!1)},500)},onMouseLeave:()=>{b.current&&clearTimeout(b.current),v(!0),x.current=setTimeout(()=>k(!1),150)},children:[o.jsx("pre",{ref:S,className:"text-sm bg-bg-primary p-2 rounded overflow-auto max-h-[200px] border border-border",children:u.length===0?o.jsx("span",{className:"text-text-muted",children:"No output yet"}):u.map((H,V)=>o.jsx("span",{className:H.stream==="stderr"?"text-accent-warning":"",children:Ga(H.content)},V))}),(_||C)&&j.current&&ql.createPortal(o.jsx(Qw,{logs:u,anchorRef:j,isHiding:C,onExpand:()=>y(!0),onClose:()=>k(!1)}),document.body)]})]}):o.jsx("button",{onClick:()=>g(!0),className:"w-full rounded font-medium text-sm px-3 py-1.5 bg-bg-tertiary text-text-muted hover:bg-border transition-colors",children:"Configure"}),o.jsx(Vw,{isOpen:p,onClose:()=>g(!1)}),m&&o.jsx(Rb,{title:"Dev Server Logs",logs:u,onClose:()=>y(!1)})]})}),e2=P.memo(function({isOpen:r,onClose:i,processName:s,logs:c}){return r?o.jsx(Rb,{title:s,logs:c,onClose:i,preClassName:"flex-1 overflow-auto p-4 text-sm font-mono text-text-primary whitespace-pre-wrap"}):null}),t2=P.memo(function({sessionId:r}){var _;const i=Pa(k=>k.processes),s=Pa(k=>k.stopProcess),[c,u]=P.useState(null),[f,l]=P.useState([]),d=i.filter(k=>k.status!=="exited"),p=d.filter(k=>k.status==="running").length;if(i.length===0)return null;const g=k=>{switch(k){case"running":return"bg-accent-success";case"starting":return"bg-accent-warning";case"stopping":return"bg-accent-warning";case"exited":return"bg-text-muted";default:return"bg-text-muted"}},m=k=>{const C=Pa.getState().logs[k]??[];l(C.map(v=>({content:v.content,stream:v.stream}))),u(k)},y=k=>{r&&s(k,r)};return o.jsxs("div",{className:"mt-2 pt-3 border-t border-border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full flex-shrink-0 bg-accent-primary"}),o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Background"}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",p," running)"]})]})}),o.jsx("div",{className:"space-y-2",children:d.map(k=>o.jsx("div",{className:"border border-border rounded p-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${g(k.status)}`}),o.jsx("span",{className:"text-sm text-text-primary truncate",title:k.name,children:k.name}),o.jsxs("span",{className:"text-xs text-text-muted",children:["[",k.status,"]"]})]}),o.jsxs("div",{className:"flex gap-1 ml-2",children:[o.jsx("button",{onClick:()=>m(k.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-border text-text-secondary transition-colors",title:"View logs",children:"Logs"}),o.jsx("button",{onClick:()=>y(k.id),className:"px-2 py-1 text-xs rounded bg-bg-tertiary hover:bg-accent-error/20 text-text-secondary hover:text-accent-error transition-colors",title:"Stop process",children:"Stop"})]})]})},k.id))}),c&&o.jsx(e2,{isOpen:!!c,onClose:()=>{u(null),l([])},processName:((_=d.find(k=>k.id===c))==null?void 0:_.name)??"",logs:f})]})});function qx({summary:e,messages:r,workdir:i}){const[s,c]=P.useState(!1),u=Ew(r),{branch:f}=jw(i),l=kt(p=>p.version),d=Ee(p=>p.currentSession);return o.jsxs("div",{className:"flex flex-col h-full",children:[u&&o.jsxs("div",{className:"mb-4",children:[o.jsx("button",{onClick:()=>c(!0),className:"w-full flex items-center justify-center px-3 py-2 rounded bg-bg-tertiary hover:bg-bg-secondary transition-colors",title:"View detailed response and call-level stats",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[o.jsx("span",{className:"text-text-secondary",children:Nw(u.aiTime)}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ix(u.avgPrefillSpeed)}),o.jsx("span",{children:"pp"}),o.jsx("span",{className:"w-px h-3 bg-border"}),o.jsx("span",{className:"text-text-secondary",children:Ix(u.avgGenerationSpeed)}),o.jsx("span",{children:"tg"})]})}),o.jsx(Uw,{isOpen:s,onClose:()=>c(!1),stats:u})]}),o.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Summary"})}),e?o.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e}):o.jsx("div",{className:"text-text-muted text-sm text-center py-2",children:"No summary yet"}),o.jsxs("div",{className:"mt-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-2",children:"Progress"}),o.jsx(Gw,{criteria:(d==null?void 0:d.criteria)??[]})]})]}),f&&o.jsxs("div",{className:"mt-4 flex items-center gap-2 text-sm",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0 text-text-muted",viewBox:"0 0 16 16",fill:"currentColor",children:o.jsx("path",{d:"M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"})}),o.jsx("span",{className:"truncate text-text-secondary",title:f,children:f})]}),o.jsx(Jw,{workdir:i}),o.jsx(t2,{sessionId:d==null?void 0:d.id}),l&&o.jsxs("div",{className:"mt-4 pt-4 border-t border-border text-center text-xs text-text-muted",children:[o.jsx("a",{href:"https://github.com/co-l/openfox",target:"_blank",rel:"noopener noreferrer",className:"hover:text-accent-primary transition-colors",children:"OpenFox"})," - ",o.jsxs("span",{children:["v",l]})]})]})}function n2({children:e,criteriaSidebarOpen:r=!0,onCriteriaSidebarToggle:i,messages:s}){const c=Ee(u=>u.currentSession);return o.jsxs("div",{className:"relative h-full overflow-hidden",children:[r&&o.jsx("div",{className:"fixed md:hidden inset-0 bg-black/50 z-40",onClick:i}),o.jsxs("div",{className:"flex h-full",children:[o.jsx("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:e}),r?o.jsx("aside",{className:"hidden md:block w-[320px] shrink-0 border-l border-border p-4 overflow-y-auto bg-bg-secondary",children:o.jsx(qx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})}):o.jsx("aside",{className:"hidden md:block w-0 shrink-0 overflow-hidden border-l-0"}),o.jsx("aside",{className:`
|
|
85
86
|
md:hidden
|
|
86
87
|
p-4 overflow-y-auto bg-bg-secondary
|
|
87
88
|
transition-all duration-300 ease-in-out
|
|
88
89
|
fixed right-0 top-[32px] h-[calc(100vh-32px)] z-50
|
|
89
90
|
${r?"w-[320px] translate-x-0 border-l border-border":"w-[320px] translate-x-full"}
|
|
90
91
|
`,children:o.jsx(qx,{summary:(c==null?void 0:c.summary)??null,messages:s,workdir:c==null?void 0:c.workdir})})]})]})}function r2(e,r){return r||e>85?"bg-accent-error":e>60?"bg-accent-warning":"bg-accent-success"}function Mb({percent:e,dangerZone:r=!1,size:i="md",className:s=""}){const c=i==="sm"?"w-12":"w-20",u=i==="sm"?"h-1":"h-1.5";return o.jsx("div",{className:`${u} bg-bg-tertiary rounded-full overflow-hidden ${c} ${s}`,children:o.jsx("div",{className:`h-full transition-all duration-300 ${r2(e,r)}`,style:{width:`${Math.min(e,100)}%`}})})}function i2({dangerZone:e,size:r="md"}){return e?o.jsx("span",{className:"text-accent-error animate-pulse text-[10px] font-medium",children:"Low!"}):null}function Wx(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function s2(){const e=Ee(p=>p.contextState),r=Ee(p=>p.currentSession),i=Ee(p=>p.compactContext);if(!e||!r)return null;const{currentTokens:s,maxTokens:c,compactionCount:u,dangerZone:f}=e,l=Math.round(s/c*100),d=r.isRunning;return o.jsx("div",{className:"flex-shrink-0 px-4 py-1.5 border-b border-border bg-bg-secondary/50",children:o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-sm",children:[o.jsx("span",{className:"text-text-muted",children:"Context:"}),o.jsxs("span",{className:Wx(l,f),children:[Ll(s)," / ",Ll(c)]}),o.jsxs("span",{className:Wx(l,f),children:["(",l,"%)"]})]}),o.jsx(Mb,{percent:l,dangerZone:f}),o.jsx(i2,{dangerZone:f}),u>0&&o.jsxs("span",{className:"text-[10px] text-text-muted bg-bg-tertiary px-1 py-0.5 rounded",children:[u,"x"]}),o.jsx(st,{variant:"secondary",size:"md",onClick:i,disabled:d,title:d?"Cannot compact while running":"Compact context",className:f?"border-accent-error text-accent-error hover:bg-accent-error/10":"",children:"Compact"})]})})})}function Gx(e){const r=[],i=String(e||"");let s=i.indexOf(","),c=0,u=!1;for(;!u;){s===-1&&(s=i.length,u=!0);const f=i.slice(c,s).trim();(f||!u)&&r.push(f),c=s+1,s=i.indexOf(",",c)}return r}function a2(e,r){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const o2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,l2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c2={};function Vx(e,r){return(c2.jsx?l2:o2).test(e)}const u2=/[ \t\n\f\r]/g;function d2(e){return typeof e=="object"?e.type==="text"?Yx(e.value):!1:Yx(e)}function Yx(e){return e.replace(u2,"")===""}class to{constructor(r,i,s){this.normal=i,this.property=r,s&&(this.space=s)}}to.prototype.normal={};to.prototype.property={};to.prototype.space=void 0;function Ob(e,r){const i={},s={};for(const c of e)Object.assign(i,c.property),Object.assign(s,c.normal);return new to(i,s,r)}function Va(e){return e.toLowerCase()}class _n{constructor(r,i){this.attribute=i,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 h2=0;const Ze=Oi(),Ft=Oi(),th=Oi(),Se=Oi(),yt=Oi(),Ls=Oi(),An=Oi();function Oi(){return 2**++h2}const nh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ze,booleanish:Ft,commaOrSpaceSeparated:An,commaSeparated:Ls,number:Se,overloadedBoolean:th,spaceSeparated:yt},Symbol.toStringTag,{value:"Module"})),Ld=Object.keys(nh);class Eh extends _n{constructor(r,i,s,c){let u=-1;if(super(r,i),Kx(this,"space",c),typeof s=="number")for(;++u<Ld.length;){const f=Ld[u];Kx(this,Ld[u],(s&nh[f])===nh[f])}}}Eh.prototype.defined=!0;function Kx(e,r,i){i&&(e[r]=i)}function Bs(e){const r={},i={};for(const[s,c]of Object.entries(e.properties)){const u=new Eh(s,e.transform(e.attributes||{},s),c,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(u.mustUseProperty=!0),r[s]=u,i[Va(s)]=s,i[Va(u.attribute)]=s}return new to(r,i,e.space)}const Bb=Bs({properties:{ariaActiveDescendant:null,ariaAtomic:Ft,ariaAutoComplete:null,ariaBusy:Ft,ariaChecked:Ft,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:Ft,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:Ft,ariaFlowTo:yt,ariaGrabbed:Ft,ariaHasPopup:null,ariaHidden:Ft,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:Se,ariaLive:null,ariaModal:Ft,ariaMultiLine:Ft,ariaMultiSelectable:Ft,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Ft,ariaReadOnly:Ft,ariaRelevant:null,ariaRequired:Ft,ariaRoleDescription:yt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Ft,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,r){return r==="role"?r:"aria-"+r.slice(4).toLowerCase()}});function Ib(e,r){return r in e?e[r]:r}function zb(e,r){return Ib(e,r.toLowerCase())}const f2=Bs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ls,acceptCharset:yt,accessKey:yt,action:null,allow:null,allowFullScreen:Ze,allowPaymentRequest:Ze,allowUserMedia:Ze,alt:null,as:null,async:Ze,autoCapitalize:null,autoComplete:yt,autoFocus:Ze,autoPlay:Ze,blocking:yt,capture:null,charSet:null,checked:Ze,cite:null,className:yt,cols:Se,colSpan:null,content:null,contentEditable:Ft,controls:Ze,controlsList:yt,coords:Se|Ls,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ze,defer:Ze,dir:null,dirName:null,disabled:Ze,download:th,draggable:Ft,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ze,formTarget:null,headers:yt,height:Se,hidden:th,high:Se,href:null,hrefLang:null,htmlFor:yt,httpEquiv:yt,id:null,imageSizes:null,imageSrcSet:null,inert:Ze,inputMode:null,integrity:null,is:null,isMap:Ze,itemId:null,itemProp:yt,itemRef:yt,itemScope:Ze,itemType:yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ze,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ze,muted:Ze,name:null,nonce:null,noModule:Ze,noValidate:Ze,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:Ze,optimum:Se,pattern:null,ping:yt,placeholder:null,playsInline:Ze,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ze,referrerPolicy:null,rel:yt,required:Ze,reversed:Ze,rows:Se,rowSpan:Se,sandbox:yt,scope:null,scoped:Ze,seamless:Ze,selected:Ze,shadowRootClonable:Ze,shadowRootDelegatesFocus:Ze,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Ft,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ze,useMap:null,value:Ft,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ze,declare:Ze,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ze,noHref:Ze,noShade:Ze,noWrap:Ze,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Ft,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ze,disableRemotePlayback:Ze,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:zb}),p2=Bs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:An,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:yt,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ze,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Ls,g2:Ls,glyphName:Ls,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:An,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:An,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:An,rev:An,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:An,requiredFeatures:An,requiredFonts:An,requiredFormats:An,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:An,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:An,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:An,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ib}),Hb=Bs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,r){return"xlink:"+r.slice(5).toLowerCase()}}),Pb=Bs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zb}),Fb=Bs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,r){return"xml:"+r.slice(3).toLowerCase()}}),m2={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"},g2=/[A-Z]/g,Xx=/-[a-z]/g,x2=/^data[-\w.:]+$/i;function Ub(e,r){const i=Va(r);let s=r,c=_n;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&x2.test(r)){if(r.charAt(4)==="-"){const u=r.slice(5).replace(Xx,b2);s="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=r.slice(4);if(!Xx.test(u)){let f=u.replace(g2,v2);f.charAt(0)!=="-"&&(f="-"+f),r="data"+f}}c=Eh}return new c(s,r)}function v2(e){return"-"+e.toLowerCase()}function b2(e){return e.charAt(1).toUpperCase()}const $b=Ob([Bb,f2,Hb,Pb,Fb],"html"),Kl=Ob([Bb,p2,Hb,Pb,Fb],"svg");function Zx(e){const r=String(e||"").trim();return r?r.split(/[ \t\n\r\f]+/g):[]}function y2(e){return e.join(" ").trim()}var Cs={},Rd,Qx;function _2(){if(Qx)return Rd;Qx=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
|
|
91
|
-
`,p="/",g="*",m="",y="comment",_="declaration";function k(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var x=1,S=1;function j(O){var U=O.match(r);U&&(x+=U.length);var z=O.lastIndexOf(d);S=~z?O.length-z:S+O.length}function A(){var O={line:x,column:S};return function(U){return U.position=new N(O),I(),U}}function N(O){this.start=O,this.end={line:x,column:S},this.source=b.source}N.prototype.content=v;function D(O){var U=new Error(b.source+":"+x+":"+S+": "+O);if(U.reason=O,U.filename=b.source,U.line=x,U.column=S,U.source=v,!b.silent)throw U}function T(O){var U=O.exec(v);if(U){var z=U[0];return j(z),v=v.slice(z.length),U}}function I(){T(i)}function H(O){var U;for(O=O||[];U=V();)U!==!1&&O.push(U);return O}function V(){var O=A();if(!(p!=v.charAt(0)||g!=v.charAt(1))){for(var U=2;m!=v.charAt(U)&&(g!=v.charAt(U)||p!=v.charAt(U+1));)++U;if(U+=2,m===v.charAt(U-1))return D("End of comment missing");var z=v.slice(2,U-2);return S+=2,j(z),v=v.slice(U),S+=2,O({type:y,comment:z})}}function Y(){var O=A(),U=T(s);if(U){if(V(),!T(c))return D("property missing ':'");var z=T(u),X=O({type:_,property:C(U[0].replace(e,m)),value:z?C(z[0].replace(e,m)):m});return T(f),X}}function q(){var O=[];H(O);for(var U;U=Y();)U!==!1&&(O.push(U),H(O));return O}return I(),q()}function C(v){return v?v.replace(l,m):m}return Rd=k,Rd}var Jx;function S2(){if(Jx)return Cs;Jx=1;var e=Cs&&Cs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.default=i;const r=e(_2());function i(s,c){let u=null;if(!s||typeof s!="string")return u;const f=(0,r.default)(s),l=typeof c=="function";return f.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:g}=d;l?c(p,g,d):g&&(u=u||{},u[p]=g)}),u}return Cs}var Ra={},ev;function w2(){if(ev)return Ra;ev=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(p){return!p||i.test(p)||e.test(p)},f=function(p,g){return g.toUpperCase()},l=function(p,g){return"".concat(g,"-")},d=function(p,g){return g===void 0&&(g={}),u(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(c,l):p=p.replace(s,l),p.replace(r,f))};return Ra.camelCase=d,Ra}var Ma,tv;function C2(){if(tv)return Ma;tv=1;var e=Ma&&Ma.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(S2()),i=w2();function s(c,u){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(l,d){l&&d&&(f[(0,i.camelCase)(l,u)]=d)}),f}return s.default=s,Ma=s,Ma}var k2=C2();const E2=Pl(k2),qb=Wb("end"),jh=Wb("start");function Wb(e){return r;function r(i){const s=i&&i.position&&i.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function j2(e){const r=jh(e),i=qb(e);if(r&&i)return{start:r,end:i}}function Fa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nv(e.position):"start"in e||"end"in e?nv(e):"line"in e||"column"in e?rh(e):""}function rh(e){return rv(e&&e.line)+":"+rv(e&&e.column)}function nv(e){return rh(e&&e.start)+"-"+rh(e&&e.end)}function rv(e){return e&&typeof e=="number"?e:1}class cn extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",u={},f=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?c=r:!u.cause&&r&&(f=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const l=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=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=Fa(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=f&&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}}cn.prototype.file="";cn.prototype.name="";cn.prototype.reason="";cn.prototype.message="";cn.prototype.stack="";cn.prototype.column=void 0;cn.prototype.line=void 0;cn.prototype.ancestors=void 0;cn.prototype.cause=void 0;cn.prototype.fatal=void 0;cn.prototype.place=void 0;cn.prototype.ruleId=void 0;cn.prototype.source=void 0;const Nh={}.hasOwnProperty,N2=new Map,T2=/[A-Z]/g,A2=new Set(["table","tbody","thead","tfoot","tr"]),D2=new Set(["td","th"]),Gb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L2(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=P2(i,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");s=H2(i,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Kl:$b,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Vb(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function Vb(e,r,i){if(r.type==="element")return R2(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return M2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return B2(e,r,i);if(r.type==="mdxjsEsm")return O2(e,r);if(r.type==="root")return I2(e,r,i);if(r.type==="text")return z2(e,r)}function R2(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=Kl,e.schema=c),e.ancestors.push(r);const u=Kb(e,r.tagName,!1),f=F2(e,r);let l=Ah(e,r);return A2.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!d2(d):!0})),Yb(e,f,u,r),Th(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function M2(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Ya(e,r.position)}function O2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Ya(e,r.position)}function B2(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=Kl,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:Kb(e,r.name,!0),f=U2(e,r),l=Ah(e,r);return Yb(e,f,u,r),Th(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function I2(e,r,i){const s={};return Th(s,Ah(e,r)),e.create(r,e.Fragment,s,i)}function z2(e,r){return r.value}function Yb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Th(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function H2(e,r,i){return s;function s(c,u,f,l){const p=Array.isArray(f.children)?i:r;return l?p(u,f,l):p(u,f)}}function P2(e,r){return i;function i(s,c,u,f){const l=Array.isArray(u.children),d=jh(s);return r(c,u,f,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function F2(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&Nh.call(r.properties,c)){const u=$2(e,c,r.properties[c]);if(u){const[f,l]=u;e.tableCellAlignToStyle&&f==="align"&&typeof l=="string"&&D2.has(r.tagName)?s=l:i[f]=l}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function U2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const f=u.expression;f.type;const l=f.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else Ya(e,r.position);else{const c=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else Ya(e,r.position);else u=s.value===null?!0:s.value;i[c]=u}return i}function Ah(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:N2;for(;++s<r.children.length;){const u=r.children[s];let f;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const p=c.get(d)||0;f=d+"-"+p,c.set(d,p+1)}}const l=Vb(e,u,f);l!==void 0&&i.push(l)}return i}function $2(e,r,i){const s=Ub(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?a2(i):y2(i)),s.property==="style"){let c=typeof i=="object"?i:q2(e,String(i));return e.stylePropertyNameCase==="css"&&(c=W2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?m2[s.property]||s.property:s.attribute,i]}}function q2(e,r){try{return E2(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new cn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=Gb+"#cannot-parse-style-attribute",c}}function Kb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,f;for(;++u<c.length;){const l=Vx(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:l,computed:!!(u&&l.type==="Literal"),optional:!1}:l}s=f}else s=Vx(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return Nh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ya(e)}function Ya(e,r){const i=new cn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Gb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function W2(e){const r={};let i;for(i in e)Nh.call(e,i)&&(r[G2(i)]=e[i]);return r}function G2(e){let r=e.replace(T2,V2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function V2(e){return"-"+e.toLowerCase()}const Md={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"]},Y2={};function Dh(e,r){const i=Y2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Xb(e,s,c)}function Xb(e,r,i){if(K2(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return iv(e.children,r,i)}return Array.isArray(e)?iv(e,r,i):""}function iv(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=Xb(e[c],r,i);return s.join("")}function K2(e){return!!(e&&typeof e=="object")}const sv=document.createElement("i");function Ka(e){const r="&"+e+";";sv.innerHTML=r;const i=sv.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Rn(e,r,i,s){const c=e.length;let u=0,f;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,i=i>0?i:0,s.length<1e4)f=Array.from(s),f.unshift(r,i),e.splice(...f);else for(i&&e.splice(r,i);u<s.length;)f=s.slice(u,u+1e4),f.unshift(r,0),e.splice(...f),u+=1e4,r+=1e4}function qn(e,r){return e.length>0?(Rn(e,e.length,0,r),e):r}const av={}.hasOwnProperty;function Zb(e){const r={};let i=-1;for(;++i<e.length;)X2(r,e[i]);return r}function X2(e,r){let i;for(i in r){const c=(av.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){av.call(c,f)||(c[f]=[]);const l=u[f];Z2(c[f],Array.isArray(l)?l:l?[l]:[])}}}function Z2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Rn(e,0,0,s)}function Qb(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn=ai(/[A-Za-z]/),on=ai(/[\dA-Za-z]/),Q2=ai(/[#-'*+\--9=?A-Z^-~]/);function Ml(e){return e!==null&&(e<32||e===127)}const ih=ai(/\d/),J2=ai(/[\dA-Fa-f]/),eC=ai(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const Xl=ai(new RegExp("\\p{P}|\\p{S}","u")),Ri=ai(/\s/);function ai(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Is(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const u=e.charCodeAt(i);let f="";if(u===37&&on(e.charCodeAt(i+1))&&on(e.charCodeAt(i+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const l=e.charCodeAt(i+1);u<56320&&l>56319&&l<57344?(f=String.fromCharCode(u,l),c=1):f="�"}else f=String.fromCharCode(u);f&&(r.push(e.slice(s,i),encodeURIComponent(f)),s=i+c+1,f=""),c&&(i+=c,c=0)}return r.join("")+e.slice(s)}function ot(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return et(d)?(e.enter(i),l(d)):r(d)}function l(d){return et(d)&&u++<c?(e.consume(d),l):(e.exit(i),r(d))}}const tC={tokenize:nC};function nC(e){const r=e.attempt(this.parser.constructs.contentInitial,s,c);let i;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ot(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),u(l)}function u(l){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,f(l)}function f(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return He(l)?(e.consume(l),e.exit("chunkText"),u):(e.consume(l),f)}}const rC={tokenize:iC},ov={tokenize:sC};function iC(e){const r=this,i=[];let s=0,c,u,f;return l;function l(S){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,p)(S)}return p(S)}function d(S){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&x();const j=r.events.length;let A=j,N;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){N=r.events[A][1].end;break}b(s);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return Rn(r.events,A+1,0,r.events.slice(j)),r.events.length=D,p(S)}return l(S)}function p(S){if(s===i.length){if(!c)return y(S);if(c.currentConstruct&&c.currentConstruct.concrete)return k(S);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(ov,g,m)(S)}function g(S){return c&&x(),b(s),y(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,k(S)}function y(S){return r.containerState={},e.attempt(ov,_,k)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),y(S)}function k(S){if(S===null){c&&x(),b(0),e.consume(S);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),C(S)}function C(S){if(S===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return He(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(S),C)}function v(S,j){const A=r.sliceStream(S);if(j&&A.push(null),S.previous=u,u&&(u.next=S),u=S,c.defineSkip(S.start),c.write(A),r.parser.lazy[S.start.line]){let N=c.events.length;for(;N--;)if(c.events[N][1].start.offset<f&&(!c.events[N][1].end||c.events[N][1].end.offset>f))return;const D=r.events.length;let T=D,I,H;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(I){H=r.events[T][1].end;break}I=!0}for(b(s),N=D;N<r.events.length;)r.events[N][1].end={...H},N++;Rn(r.events,T+1,0,r.events.slice(D)),r.events.length=N}}function b(S){let j=i.length;for(;j-- >S;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=S}function x(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function sC(e,r,i){return ot(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ms(e){if(e===null||bt(e)||Ri(e))return 1;if(Xl(e))return 2}function Zl(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const sh={name:"attention",resolveAll:aC,tokenize:oC};function aC(e,r){let i=-1,s,c,u,f,l,d,p,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},y={...e[i][1].start};lv(m,-d),lv(y,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:y},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},c={type:d>1?"strong":"emphasis",start:{...f.start},end:{...l.end}},e[s][1].end={...f.start},e[i][1].start={...l.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=qn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=qn(p,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=qn(p,Zl(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=qn(p,[["exit",u,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,p=qn(p,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Rn(e,s-1,i-s+3,p),i=s+p.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function oC(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=Ms(s);let u;return f;function f(d){return u=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===u)return e.consume(d),l;const p=e.exit("attentionSequence"),g=Ms(d),m=!g||g===2&&c||i.includes(d),y=!c||c===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(c||!y)),p._close=!!(u===42?y:y&&(g||!m)),r(d)}}function lv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const lC={name:"autolink",tokenize:cC};function cC(e,r,i){let s=0;return c;function c(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(_){return hn(_)?(e.consume(_),f):_===64?i(_):p(_)}function f(_){return _===43||_===45||_===46||on(_)?(s=1,l(_)):p(_)}function l(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||on(_))&&s++<32?(e.consume(_),l):(s=0,p(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):_===null||_===32||_===60||Ml(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):Q2(_)?(e.consume(_),p):i(_)}function g(_){return on(_)?m(_):i(_)}function m(_){return _===46?(e.consume(_),s=0,g):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):y(_)}function y(_){if((_===45||on(_))&&s++<63){const k=_===45?y:m;return e.consume(_),k}return i(_)}}const no={partial:!0,tokenize:uC};function uC(e,r,i){return s;function s(u){return et(u)?ot(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||He(u)?r(u):i(u)}}const Jb={continuation:{tokenize:hC},exit:fC,name:"blockQuote",tokenize:dC};function dC(e,r,i){const s=this;return c;function c(f){if(f===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(f),e.exit("blockQuoteMarker"),u}return i(f)}function u(f){return et(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function hC(e,r,i){const s=this;return c;function c(f){return et(f)?ot(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(Jb,r,i)(f)}}function fC(e){e.exit("blockQuote")}const ey={name:"characterEscape",tokenize:pC};function pC(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return eC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const ty={name:"characterReference",tokenize:mC};function mC(e,r,i){const s=this;let c=0,u,f;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),u=31,f=on,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,f=J2,g):(e.enter("characterReferenceValue"),u=7,f=ih,g(m))}function g(m){if(m===59&&c){const y=e.exit("characterReferenceValue");return f===on&&!Ka(s.sliceSerialize(y))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&c++<u?(e.consume(m),g):i(m)}}const cv={partial:!0,tokenize:xC},uv={concrete:!0,name:"codeFenced",tokenize:gC};function gC(e,r,i){const s=this,c={partial:!0,tokenize:A};let u=0,f=0,l;return d;function d(N){return p(N)}function p(N){const D=s.events[s.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===l?(f++,e.consume(N),g):f<3?i(N):(e.exit("codeFencedFenceSequence"),et(N)?ot(e,m,"whitespace")(N):m(N))}function m(N){return N===null||He(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(cv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):et(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,_,"whitespace")(N)):N===96&&N===l?i(N):(e.consume(N),y)}function _(N){return N===null||He(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?i(N):(e.consume(N),k)}function C(N){return e.attempt(c,j,v)(N)}function v(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),b}function b(N){return u>0&&et(N)?ot(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||He(N)?e.check(cv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||He(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,D,T){let I=0;return H;function H(U){return N.enter("lineEnding"),N.consume(U),N.exit("lineEnding"),V}function V(U){return N.enter("codeFencedFence"),et(U)?ot(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):Y(U)}function Y(U){return U===l?(N.enter("codeFencedFenceSequence"),q(U)):T(U)}function q(U){return U===l?(I++,N.consume(U),q):I>=f?(N.exit("codeFencedFenceSequence"),et(U)?ot(N,O,"whitespace")(U):O(U)):T(U)}function O(U){return U===null||He(U)?(N.exit("codeFencedFence"),D(U)):T(U)}}}function xC(e,r,i){const s=this;return c;function c(f){return f===null?i(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}const Od={name:"codeIndented",tokenize:bC},vC={partial:!0,tokenize:yC};function bC(e,r,i){const s=this;return c;function c(p){return e.enter("codeIndented"),ot(e,u,"linePrefix",5)(p)}function u(p){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(p):i(p)}function f(p){return p===null?d(p):He(p)?e.attempt(vC,f,d)(p):(e.enter("codeFlowValue"),l(p))}function l(p){return p===null||He(p)?(e.exit("codeFlowValue"),f(p)):(e.consume(p),l)}function d(p){return e.exit("codeIndented"),r(p)}}function yC(e,r,i){const s=this;return c;function c(f){return s.parser.lazy[s.now().line]?i(f):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):ot(e,u,"linePrefix",5)(f)}function u(f){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):He(f)?c(f):i(f)}}const _C={name:"codeText",previous:wC,resolve:SC,tokenize:CC};function SC(e){let r=e.length-4,i=3,s,c;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)c===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(c=s):(s===r||e[s][1].type==="lineEnding")&&(e[c][1].type="codeTextData",s!==c+2&&(e[c][1].end=e[s-1][1].end,e.splice(c+2,s-c-2),r-=s-c-2,s=c+2),c=void 0);return e}function wC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function CC(e,r,i){let s=0,c,u;return f;function f(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?i(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),c=0,g(m)):He(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||He(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),c++,g):c===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class kC{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,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&Oa(this.left,s),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),Oa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Oa(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 i=this.left.splice(r,Number.POSITIVE_INFINITY);Oa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Oa(this.left,i.reverse())}}}function Oa(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function ny(e){const r={};let i=-1,s,c,u,f,l,d,p;const g=new kC(e);for(;++i<g.length;){for(;i in r;)i=r[i];if(s=g.get(i),i&&s[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,EC(g,i)),i=r[i],p=!0);else if(s[1]._container){for(u=i,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(s[1].end={...g.get(c)[1].start},l=g.slice(c,i),l.unshift(s),g.splice(c,i-c+1,l))}}return Rn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function EC(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const u=[];let f=i._tokenizer;f||(f=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const l=f.events,d=[],p={};let g,m,y=-1,_=i,k=0,C=0;const v=[C];for(;_;){for(;e.get(++c)[1]!==_;);u.push(c),_._tokenizer||(g=s.sliceStream(_),_.next||g.push(null),m&&f.defineSkip(_.start),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=i;++y<l.length;)l[y][0]==="exit"&&l[y-1][0]==="enter"&&l[y][1].type===l[y-1][1].type&&l[y][1].start.line!==l[y][1].end.line&&(C=y+1,v.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):v.pop(),y=v.length;y--;){const b=l.slice(v[y],v[y+1]),x=u.pop();d.push([x,x+b.length-1]),e.splice(x,2,b)}for(d.reverse(),y=-1;++y<d.length;)p[k+d[y][0]]=k+d[y][1],k+=d[y][1]-d[y][0]-1;return p}const jC={resolve:TC,tokenize:AC},NC={partial:!0,tokenize:DC};function TC(e){return ny(e),e}function AC(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):He(l)?e.check(NC,f,u)(l):(e.consume(l),c)}function u(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function f(l){return e.consume(l),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,c}}function DC(e,r,i){const s=this;return c;function c(f){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,u,"linePrefix")}function u(f){if(f===null||He(f))return i(f);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):e.interrupt(s.parser.constructs.flow,i,r)(f)}}function ry(e,r,i,s,c,u,f,l,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(b){return b===60?(e.enter(s),e.enter(c),e.enter(u),e.consume(b),e.exit(u),y):b===null||b===32||b===41||Ml(b)?i(b):(e.enter(s),e.enter(f),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(b))}function y(b){return b===62?(e.enter(u),e.consume(b),e.exit(u),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(b))}function _(b){return b===62?(e.exit("chunkString"),e.exit(l),y(b)):b===null||b===60||He(b)?i(b):(e.consume(b),b===92?k:_)}function k(b){return b===60||b===62||b===92?(e.consume(b),_):_(b)}function C(b){return!g&&(b===null||b===41||bt(b))?(e.exit("chunkString"),e.exit(l),e.exit(f),e.exit(s),r(b)):g<p&&b===40?(e.consume(b),g++,C):b===41?(e.consume(b),g--,C):b===null||b===32||b===40||Ml(b)?i(b):(e.consume(b),b===92?v:C)}function v(b){return b===40||b===41||b===92?(e.consume(b),C):C(b)}}function iy(e,r,i,s,c,u){const f=this;let l=0,d;return p;function p(_){return e.enter(s),e.enter(c),e.consume(_),e.exit(c),e.enter(u),g}function g(_){return l>999||_===null||_===91||_===93&&!d||_===94&&!l&&"_hiddenFootnoteSupport"in f.parser.constructs?i(_):_===93?(e.exit(u),e.enter(c),e.consume(_),e.exit(c),e.exit(s),r):He(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||He(_)||l++>999?(e.exit("chunkString"),g(_)):(e.consume(_),d||(d=!et(_)),_===92?y:m)}function y(_){return _===91||_===92||_===93?(e.consume(_),l++,m):m(_)}}function sy(e,r,i,s,c,u){let f;return l;function l(y){return y===34||y===39||y===40?(e.enter(s),e.enter(c),e.consume(y),e.exit(c),f=y===40?41:y,d):i(y)}function d(y){return y===f?(e.enter(c),e.consume(y),e.exit(c),e.exit(s),r):(e.enter(u),p(y))}function p(y){return y===f?(e.exit(u),d(f)):y===null?i(y):He(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ot(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===f||y===null||He(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?m:g)}function m(y){return y===f||y===92?(e.consume(y),g):g(y)}}function Ua(e,r){let i;return s;function s(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):et(c)?ot(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const LC={name:"definition",tokenize:MC},RC={partial:!0,tokenize:OC};function MC(e,r,i){const s=this;let c;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return iy.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return c=Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):i(_)}function d(_){return bt(_)?Ua(e,p)(_):p(_)}function p(_){return ry(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(RC,m,m)(_)}function m(_){return et(_)?ot(e,y,"whitespace")(_):y(_)}function y(_){return _===null||He(_)?(e.exit("definition"),s.parser.defined.push(c),r(_)):i(_)}}function OC(e,r,i){return s;function s(l){return bt(l)?Ua(e,c)(l):i(l)}function c(l){return sy(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function u(l){return et(l)?ot(e,f,"whitespace")(l):f(l)}function f(l){return l===null||He(l)?r(l):i(l)}}const BC={name:"hardBreakEscape",tokenize:IC};function IC(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return He(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const zC={name:"headingAtx",resolve:HC,tokenize:PC};function HC(e,r){let i=e.length-2,s=3,c,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Rn(e,s,i-s+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function PC(e,r,i){let s=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&s++<6?(e.consume(g),f):g===null||bt(g)?(e.exit("atxHeadingSequence"),l(g)):i(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||He(g)?(e.exit("atxHeading"),r(g)):et(g)?ot(e,l,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),l(g))}function p(g){return g===null||g===35||bt(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),p)}}const FC=["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"],dv=["pre","script","style","textarea"],UC={concrete:!0,name:"htmlFlow",resolveTo:WC,tokenize:GC},$C={partial:!0,tokenize:YC},qC={partial:!0,tokenize:VC};function WC(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function GC(e,r,i){const s=this;let c,u,f,l,d;return p;function p(F){return g(F)}function g(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),m}function m(F){return F===33?(e.consume(F),y):F===47?(e.consume(F),u=!0,C):F===63?(e.consume(F),c=3,s.interrupt?r:L):hn(F)?(e.consume(F),f=String.fromCharCode(F),v):i(F)}function y(F){return F===45?(e.consume(F),c=2,_):F===91?(e.consume(F),c=5,l=0,k):hn(F)?(e.consume(F),c=4,s.interrupt?r:L):i(F)}function _(F){return F===45?(e.consume(F),s.interrupt?r:L):i(F)}function k(F){const re="CDATA[";return F===re.charCodeAt(l++)?(e.consume(F),l===re.length?s.interrupt?r:Y:k):i(F)}function C(F){return hn(F)?(e.consume(F),f=String.fromCharCode(F),v):i(F)}function v(F){if(F===null||F===47||F===62||bt(F)){const re=F===47,Z=f.toLowerCase();return!re&&!u&&dv.includes(Z)?(c=1,s.interrupt?r(F):Y(F)):FC.includes(f.toLowerCase())?(c=6,re?(e.consume(F),b):s.interrupt?r(F):Y(F)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):u?x(F):S(F))}return F===45||on(F)?(e.consume(F),f+=String.fromCharCode(F),v):i(F)}function b(F){return F===62?(e.consume(F),s.interrupt?r:Y):i(F)}function x(F){return et(F)?(e.consume(F),x):H(F)}function S(F){return F===47?(e.consume(F),H):F===58||F===95||hn(F)?(e.consume(F),j):et(F)?(e.consume(F),S):H(F)}function j(F){return F===45||F===46||F===58||F===95||on(F)?(e.consume(F),j):A(F)}function A(F){return F===61?(e.consume(F),N):et(F)?(e.consume(F),A):S(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?i(F):F===34||F===39?(e.consume(F),d=F,D):et(F)?(e.consume(F),N):T(F)}function D(F){return F===d?(e.consume(F),d=null,I):F===null||He(F)?i(F):(e.consume(F),D)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||bt(F)?A(F):(e.consume(F),T)}function I(F){return F===47||F===62||et(F)?S(F):i(F)}function H(F){return F===62?(e.consume(F),V):i(F)}function V(F){return F===null||He(F)?Y(F):et(F)?(e.consume(F),V):i(F)}function Y(F){return F===45&&c===2?(e.consume(F),z):F===60&&c===1?(e.consume(F),X):F===62&&c===4?(e.consume(F),B):F===63&&c===3?(e.consume(F),L):F===93&&c===5?(e.consume(F),M):He(F)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check($C,W,q)(F)):F===null||He(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),Y)}function q(F){return e.check(qC,O,W)(F)}function O(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),U}function U(F){return F===null||He(F)?q(F):(e.enter("htmlFlowData"),Y(F))}function z(F){return F===45?(e.consume(F),L):Y(F)}function X(F){return F===47?(e.consume(F),f="",Q):Y(F)}function Q(F){if(F===62){const re=f.toLowerCase();return dv.includes(re)?(e.consume(F),B):Y(F)}return hn(F)&&f.length<8?(e.consume(F),f+=String.fromCharCode(F),Q):Y(F)}function M(F){return F===93?(e.consume(F),L):Y(F)}function L(F){return F===62?(e.consume(F),B):F===45&&c===2?(e.consume(F),L):Y(F)}function B(F){return F===null||He(F)?(e.exit("htmlFlowData"),W(F)):(e.consume(F),B)}function W(F){return e.exit("htmlFlow"),r(F)}}function VC(e,r,i){const s=this;return c;function c(f){return He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):i(f)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}function YC(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(no,r,i)}}const KC={name:"htmlText",tokenize:XC};function XC(e,r,i){const s=this;let c,u,f;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),A):L===63?(e.consume(L),S):hn(L)?(e.consume(L),T):i(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,k):hn(L)?(e.consume(L),x):i(L)}function g(L){return L===45?(e.consume(L),_):i(L)}function m(L){return L===null?i(L):L===45?(e.consume(L),y):He(L)?(f=m,X(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?z(L):L===45?y(L):m(L)}function k(L){const B="CDATA[";return L===B.charCodeAt(u++)?(e.consume(L),u===B.length?C:k):i(L)}function C(L){return L===null?i(L):L===93?(e.consume(L),v):He(L)?(f=C,X(L)):(e.consume(L),C)}function v(L){return L===93?(e.consume(L),b):C(L)}function b(L){return L===62?z(L):L===93?(e.consume(L),b):C(L)}function x(L){return L===null||L===62?z(L):He(L)?(f=x,X(L)):(e.consume(L),x)}function S(L){return L===null?i(L):L===63?(e.consume(L),j):He(L)?(f=S,X(L)):(e.consume(L),S)}function j(L){return L===62?z(L):S(L)}function A(L){return hn(L)?(e.consume(L),N):i(L)}function N(L){return L===45||on(L)?(e.consume(L),N):D(L)}function D(L){return He(L)?(f=D,X(L)):et(L)?(e.consume(L),D):z(L)}function T(L){return L===45||on(L)?(e.consume(L),T):L===47||L===62||bt(L)?I(L):i(L)}function I(L){return L===47?(e.consume(L),z):L===58||L===95||hn(L)?(e.consume(L),H):He(L)?(f=I,X(L)):et(L)?(e.consume(L),I):z(L)}function H(L){return L===45||L===46||L===58||L===95||on(L)?(e.consume(L),H):V(L)}function V(L){return L===61?(e.consume(L),Y):He(L)?(f=V,X(L)):et(L)?(e.consume(L),V):I(L)}function Y(L){return L===null||L===60||L===61||L===62||L===96?i(L):L===34||L===39?(e.consume(L),c=L,q):He(L)?(f=Y,X(L)):et(L)?(e.consume(L),Y):(e.consume(L),O)}function q(L){return L===c?(e.consume(L),c=void 0,U):L===null?i(L):He(L)?(f=q,X(L)):(e.consume(L),q)}function O(L){return L===null||L===34||L===39||L===60||L===61||L===96?i(L):L===47||L===62||bt(L)?I(L):(e.consume(L),O)}function U(L){return L===47||L===62||bt(L)?I(L):i(L)}function z(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):i(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Q}function Q(L){return et(L)?ot(e,M,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):M(L)}function M(L){return e.enter("htmlTextData"),f(L)}}const Lh={name:"labelEnd",resolveAll:ek,resolveTo:tk,tokenize:nk},ZC={tokenize:rk},QC={tokenize:ik},JC={tokenize:sk};function ek(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",r+=c}}return e.length!==i.length&&Rn(e,0,e.length,i),e}function tk(e,r){let i=e.length,s=0,c,u,f,l;for(;i--;)if(c=e[i][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(f=i);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[u][1].start},end:{...e[f][1].end}},g={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[f-2][1].start}};return l=[["enter",d,r],["enter",p,r]],l=qn(l,e.slice(u+1,u+s+3)),l=qn(l,[["enter",g,r]]),l=qn(l,Zl(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),l=qn(l,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),l=qn(l,e.slice(f+1)),l=qn(l,[["exit",d,r]]),Rn(e,u,e.length,l),e}function nk(e,r,i){const s=this;let c=s.events.length,u,f;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){u=s.events[c][1];break}return l;function l(y){return u?u._inactive?m(y):(f=s.parser.defined.includes(Xn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),d):i(y)}function d(y){return y===40?e.attempt(ZC,g,f?g:m)(y):y===91?e.attempt(QC,g,f?p:m)(y):f?g(y):m(y)}function p(y){return e.attempt(JC,g,m)(y)}function g(y){return r(y)}function m(y){return u._balanced=!0,i(y)}}function rk(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return bt(m)?Ua(e,u)(m):u(m)}function u(m){return m===41?g(m):ry(e,f,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return bt(m)?Ua(e,d)(m):g(m)}function l(m){return i(m)}function d(m){return m===34||m===39||m===40?sy(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return bt(m)?Ua(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function ik(e,r,i){const s=this;return c;function c(l){return iy.call(s,e,u,f,"reference","referenceMarker","referenceString")(l)}function u(l){return s.parser.defined.includes(Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function f(l){return i(l)}}function sk(e,r,i){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):i(u)}}const ak={name:"labelStartImage",resolveAll:Lh.resolveAll,tokenize:ok};function ok(e,r,i){const s=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),u}function u(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),f):i(l)}function f(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const lk={name:"labelStartLink",resolveAll:Lh.resolveAll,tokenize:ck};function ck(e,r,i){const s=this;return c;function c(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(f):r(f)}}const Bd={name:"lineEnding",tokenize:uk};function uk(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ot(e,r,"linePrefix")}}const Nl={name:"thematicBreak",tokenize:dk};function dk(e,r,i){let s=0,c;return u;function u(p){return e.enter("thematicBreak"),f(p)}function f(p){return c=p,l(p)}function l(p){return p===c?(e.enter("thematicBreakSequence"),d(p)):s>=3&&(p===null||He(p))?(e.exit("thematicBreak"),r(p)):i(p)}function d(p){return p===c?(e.consume(p),s++,d):(e.exit("thematicBreakSequence"),et(p)?ot(e,l,"whitespace")(p):l(p))}}const yn={continuation:{tokenize:mk},exit:xk,name:"list",tokenize:pk},hk={partial:!0,tokenize:vk},fk={partial:!0,tokenize:gk};function pk(e,r,i){const s=this,c=s.events[s.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return l;function l(_){const k=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:ih(_)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Nl,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return ih(_)&&++f<10?(e.consume(_),d):(!s.interrupt||f<2)&&(s.containerState.marker?_===s.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),p(_)):i(_)}function p(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||_,e.check(no,s.interrupt?i:g,e.attempt(hk,y,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,y(_)}function m(_){return et(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),y):i(_)}function y(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function mk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(no,c,u);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ot(e,r,"listItemIndent",s.containerState.size+1)(l)}function u(l){return s.containerState.furtherBlankLines||!et(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,f(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(fk,r,f)(l))}function f(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,ot(e,e.attempt(yn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function gk(e,r,i){const s=this;return ot(e,c,"listItemIndent",s.containerState.size+1);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===s.containerState.size?r(u):i(u)}}function xk(e){e.exit(this.containerState.type)}function vk(e,r,i){const s=this;return ot(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=s.events[s.events.length-1];return!et(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const hv={name:"setextUnderline",resolveTo:bk,tokenize:yk};function bk(e,r){let i=e.length,s,c,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const f={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",f,r]),e.splice(u+1,0,["exit",e[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=f,e.push(["exit",f,r]),e}function yk(e,r,i){const s=this;let c;return u;function u(p){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),c=p,f(p)):i(p)}function f(p){return e.enter("setextHeadingLineSequence"),l(p)}function l(p){return p===c?(e.consume(p),l):(e.exit("setextHeadingLineSequence"),et(p)?ot(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||He(p)?(e.exit("setextHeadingLine"),r(p)):i(p)}}const _k={tokenize:Sk};function Sk(e){const r=this,i=e.attempt(no,s,e.attempt(this.parser.constructs.flowInitial,c,ot(e,e.attempt(this.parser.constructs.flow,c,e.attempt(jC,c)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const wk={resolveAll:oy()},Ck=ay("string"),kk=ay("text");function ay(e){return{resolveAll:oy(e==="text"?Ek:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],u=i.attempt(c,f,l);return f;function f(g){return p(g)?u(g):l(g)}function l(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),d}function d(g){return p(g)?(i.exit("data"),u(g)):(i.consume(g),d)}function p(g){if(g===null)return!0;const m=c[g];let y=-1;if(m)for(;++y<m.length;){const _=m[y];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function oy(e){return r;function r(i,s){let c=-1,u;for(;++c<=i.length;)u===void 0?i[c]&&i[c][1].type==="data"&&(u=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==u+2&&(i[u][1].end=i[c-1][1].end,i.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(i,s):i}}function Ek(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);let u=c.length,f=-1,l=0,d;for(;u--;){const p=c[u];if(typeof p=="string"){for(f=p.length;p.charCodeAt(f-1)===32;)l++,f--;if(f)break;f=-1}else if(p===-2)d=!0,l++;else if(p!==-1){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(l=0),l){const p={type:i===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:s.start._bufferIndex+f,_index:s.start._index+u,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return e}const jk={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:Jb},Nk={91:LC},Tk={[-2]:Od,[-1]:Od,32:Od},Ak={35:zC,42:Nl,45:[hv,Nl],60:UC,61:hv,95:Nl,96:uv,126:uv},Dk={38:ty,92:ey},Lk={[-5]:Bd,[-4]:Bd,[-3]:Bd,33:ak,38:ty,42:sh,60:[lC,KC],91:lk,92:[BC,ey],93:Lh,95:sh,96:_C},Rk={null:[sh,wk]},Mk={null:[42,95]},Ok={null:[]},Bk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Mk,contentInitial:Nk,disable:Ok,document:jk,flow:Ak,flowInitial:Tk,insideSpan:Rk,string:Dk,text:Lk},Symbol.toStringTag,{value:"Module"}));function Ik(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},u=[];let f=[],l=[];const d={attempt:D(A),check:D(N),consume:x,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(V){return f=qn(f,V),v(),f[f.length-1]!==null?[]:(T(r,0),p.events=Zl(u,p.events,p),p.events)}function y(V,Y){return Hk(_(V),Y)}function _(V){return zk(f,V)}function k(){const{_bufferIndex:V,_index:Y,line:q,column:O,offset:U}=s;return{_bufferIndex:V,_index:Y,line:q,column:O,offset:U}}function C(V){c[V.line]=V.column,H()}function v(){let V;for(;s._index<f.length;){const Y=f[s._index];if(typeof Y=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<Y.length;)b(Y.charCodeAt(s._bufferIndex));else b(Y)}}function b(V){g=g(V)}function x(V){He(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,H()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===f[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=V}function S(V,Y){const q=Y||{};return q.type=V,q.start=k(),p.events.push(["enter",q,p]),l.push(q),q}function j(V){const Y=l.pop();return Y.end=k(),p.events.push(["exit",Y,p]),Y}function A(V,Y){T(V,Y.from)}function N(V,Y){Y.restore()}function D(V,Y){return q;function q(O,U,z){let X,Q,M,L;return Array.isArray(O)?W(O):"tokenize"in O?W([O]):B(O);function B(ee){return K;function K($){const ae=$!==null&&ee[$],ne=$!==null&&ee.null,ve=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(ve)($)}}function W(ee){return X=ee,Q=0,ee.length===0?z:F(ee[Q])}function F(ee){return K;function K($){return L=I(),M=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Z():ee.tokenize.call(Y?Object.assign(Object.create(p),Y):p,d,re,Z)($)}}function re(ee){return V(M,L),U}function Z(ee){return L.restore(),++Q<X.length?F(X[Q]):z}}}function T(V,Y){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Rn(p.events,Y,p.events.length-Y,V.resolve(p.events.slice(Y),p)),V.resolveTo&&(p.events=V.resolveTo(p.events,p))}function I(){const V=k(),Y=p.previous,q=p.currentConstruct,O=p.events.length,U=Array.from(l);return{from:O,restore:z};function z(){s=V,p.previous=Y,p.currentConstruct=q,p.events.length=O,l=U,H()}}function H(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function zk(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let f;if(i===c)f=[e[i].slice(s,u)];else{if(f=e.slice(i,c),s>-1){const l=f[0];typeof l=="string"?f[0]=l.slice(s):f.shift()}u>0&&f.push(e[c].slice(0,u))}return f}function Hk(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const u=e[i];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
92
|
+
`,p="/",g="*",m="",y="comment",_="declaration";function k(v,b){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];b=b||{};var x=1,S=1;function j(O){var U=O.match(r);U&&(x+=U.length);var z=O.lastIndexOf(d);S=~z?O.length-z:S+O.length}function A(){var O={line:x,column:S};return function(U){return U.position=new N(O),I(),U}}function N(O){this.start=O,this.end={line:x,column:S},this.source=b.source}N.prototype.content=v;function D(O){var U=new Error(b.source+":"+x+":"+S+": "+O);if(U.reason=O,U.filename=b.source,U.line=x,U.column=S,U.source=v,!b.silent)throw U}function T(O){var U=O.exec(v);if(U){var z=U[0];return j(z),v=v.slice(z.length),U}}function I(){T(i)}function H(O){var U;for(O=O||[];U=V();)U!==!1&&O.push(U);return O}function V(){var O=A();if(!(p!=v.charAt(0)||g!=v.charAt(1))){for(var U=2;m!=v.charAt(U)&&(g!=v.charAt(U)||p!=v.charAt(U+1));)++U;if(U+=2,m===v.charAt(U-1))return D("End of comment missing");var z=v.slice(2,U-2);return S+=2,j(z),v=v.slice(U),S+=2,O({type:y,comment:z})}}function Y(){var O=A(),U=T(s);if(U){if(V(),!T(c))return D("property missing ':'");var z=T(u),X=O({type:_,property:C(U[0].replace(e,m)),value:z?C(z[0].replace(e,m)):m});return T(f),X}}function q(){var O=[];H(O);for(var U;U=Y();)U!==!1&&(O.push(U),H(O));return O}return I(),q()}function C(v){return v?v.replace(l,m):m}return Rd=k,Rd}var Jx;function S2(){if(Jx)return Cs;Jx=1;var e=Cs&&Cs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Cs,"__esModule",{value:!0}),Cs.default=i;const r=e(_2());function i(s,c){let u=null;if(!s||typeof s!="string")return u;const f=(0,r.default)(s),l=typeof c=="function";return f.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:g}=d;l?c(p,g,d):g&&(u=u||{},u[p]=g)}),u}return Cs}var Ra={},ev;function w2(){if(ev)return Ra;ev=1,Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,r=/-([a-z])/g,i=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,u=function(p){return!p||i.test(p)||e.test(p)},f=function(p,g){return g.toUpperCase()},l=function(p,g){return"".concat(g,"-")},d=function(p,g){return g===void 0&&(g={}),u(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(c,l):p=p.replace(s,l),p.replace(r,f))};return Ra.camelCase=d,Ra}var Ma,tv;function C2(){if(tv)return Ma;tv=1;var e=Ma&&Ma.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},r=e(S2()),i=w2();function s(c,u){var f={};return!c||typeof c!="string"||(0,r.default)(c,function(l,d){l&&d&&(f[(0,i.camelCase)(l,u)]=d)}),f}return s.default=s,Ma=s,Ma}var k2=C2();const E2=Pl(k2),qb=Wb("end"),jh=Wb("start");function Wb(e){return r;function r(i){const s=i&&i.position&&i.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function j2(e){const r=jh(e),i=qb(e);if(r&&i)return{start:r,end:i}}function Fa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nv(e.position):"start"in e||"end"in e?nv(e):"line"in e||"column"in e?rh(e):""}function rh(e){return rv(e&&e.line)+":"+rv(e&&e.column)}function nv(e){return rh(e&&e.start)+"-"+rh(e&&e.end)}function rv(e){return e&&typeof e=="number"?e:1}class un extends Error{constructor(r,i,s){super(),typeof i=="string"&&(s=i,i=void 0);let c="",u={},f=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof r=="string"?c=r:!u.cause&&r&&(f=!0,c=r.message,u.cause=r),!u.ruleId&&!u.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?u.ruleId=s:(u.source=s.slice(0,d),u.ruleId=s.slice(d+1))}if(!u.place&&u.ancestors&&u.ancestors){const d=u.ancestors[u.ancestors.length-1];d&&(u.place=d.position)}const l=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=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=l?l.line:void 0,this.name=Fa(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=f&&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}}un.prototype.file="";un.prototype.name="";un.prototype.reason="";un.prototype.message="";un.prototype.stack="";un.prototype.column=void 0;un.prototype.line=void 0;un.prototype.ancestors=void 0;un.prototype.cause=void 0;un.prototype.fatal=void 0;un.prototype.place=void 0;un.prototype.ruleId=void 0;un.prototype.source=void 0;const Nh={}.hasOwnProperty,N2=new Map,T2=/[A-Z]/g,A2=new Set(["table","tbody","thead","tfoot","tr"]),D2=new Set(["td","th"]),Gb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L2(e,r){if(!r||r.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=r.filePath||void 0;let s;if(r.development){if(typeof r.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=P2(i,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");s=H2(i,r.jsx,r.jsxs)}const c={Fragment:r.Fragment,ancestors:[],components:r.components||{},create:s,elementAttributeNameCase:r.elementAttributeNameCase||"react",evaluater:r.createEvaluater?r.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:r.ignoreInvalidStyle||!1,passKeys:r.passKeys!==!1,passNode:r.passNode||!1,schema:r.space==="svg"?Kl:$b,stylePropertyNameCase:r.stylePropertyNameCase||"dom",tableCellAlignToStyle:r.tableCellAlignToStyle!==!1},u=Vb(c,e,void 0);return u&&typeof u!="string"?u:c.create(e,c.Fragment,{children:u||void 0},void 0)}function Vb(e,r,i){if(r.type==="element")return R2(e,r,i);if(r.type==="mdxFlowExpression"||r.type==="mdxTextExpression")return M2(e,r);if(r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement")return B2(e,r,i);if(r.type==="mdxjsEsm")return O2(e,r);if(r.type==="root")return I2(e,r,i);if(r.type==="text")return z2(e,r)}function R2(e,r,i){const s=e.schema;let c=s;r.tagName.toLowerCase()==="svg"&&s.space==="html"&&(c=Kl,e.schema=c),e.ancestors.push(r);const u=Kb(e,r.tagName,!1),f=F2(e,r);let l=Ah(e,r);return A2.has(r.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!d2(d):!0})),Yb(e,f,u,r),Th(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function M2(e,r){if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Ya(e,r.position)}function O2(e,r){if(r.data&&r.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(r.data.estree);Ya(e,r.position)}function B2(e,r,i){const s=e.schema;let c=s;r.name==="svg"&&s.space==="html"&&(c=Kl,e.schema=c),e.ancestors.push(r);const u=r.name===null?e.Fragment:Kb(e,r.name,!0),f=U2(e,r),l=Ah(e,r);return Yb(e,f,u,r),Th(f,l),e.ancestors.pop(),e.schema=s,e.create(r,u,f,i)}function I2(e,r,i){const s={};return Th(s,Ah(e,r)),e.create(r,e.Fragment,s,i)}function z2(e,r){return r.value}function Yb(e,r,i,s){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(r.node=s)}function Th(e,r){if(r.length>0){const i=r.length>1?r:r[0];i&&(e.children=i)}}function H2(e,r,i){return s;function s(c,u,f,l){const p=Array.isArray(f.children)?i:r;return l?p(u,f,l):p(u,f)}}function P2(e,r){return i;function i(s,c,u,f){const l=Array.isArray(u.children),d=jh(s);return r(c,u,f,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function F2(e,r){const i={};let s,c;for(c in r.properties)if(c!=="children"&&Nh.call(r.properties,c)){const u=$2(e,c,r.properties[c]);if(u){const[f,l]=u;e.tableCellAlignToStyle&&f==="align"&&typeof l=="string"&&D2.has(r.tagName)?s=l:i[f]=l}}if(s){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return i}function U2(e,r){const i={};for(const s of r.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const u=s.data.estree.body[0];u.type;const f=u.expression;f.type;const l=f.properties[0];l.type,Object.assign(i,e.evaluater.evaluateExpression(l.argument))}else Ya(e,r.position);else{const c=s.name;let u;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,u=e.evaluater.evaluateExpression(l.expression)}else Ya(e,r.position);else u=s.value===null?!0:s.value;i[c]=u}return i}function Ah(e,r){const i=[];let s=-1;const c=e.passKeys?new Map:N2;for(;++s<r.children.length;){const u=r.children[s];let f;if(e.passKeys){const d=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(d){const p=c.get(d)||0;f=d+"-"+p,c.set(d,p+1)}}const l=Vb(e,u,f);l!==void 0&&i.push(l)}return i}function $2(e,r,i){const s=Ub(e.schema,r);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=s.commaSeparated?a2(i):y2(i)),s.property==="style"){let c=typeof i=="object"?i:q2(e,String(i));return e.stylePropertyNameCase==="css"&&(c=W2(c)),["style",c]}return[e.elementAttributeNameCase==="react"&&s.space?m2[s.property]||s.property:s.attribute,i]}}function q2(e,r){try{return E2(r,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,c=new un("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=Gb+"#cannot-parse-style-attribute",c}}function Kb(e,r,i){let s;if(!i)s={type:"Literal",value:r};else if(r.includes(".")){const c=r.split(".");let u=-1,f;for(;++u<c.length;){const l=Vx(c[u])?{type:"Identifier",name:c[u]}:{type:"Literal",value:c[u]};f=f?{type:"MemberExpression",object:f,property:l,computed:!!(u&&l.type==="Literal"),optional:!1}:l}s=f}else s=Vx(r)&&!/^[a-z]/.test(r)?{type:"Identifier",name:r}:{type:"Literal",value:r};if(s.type==="Literal"){const c=s.value;return Nh.call(e.components,c)?e.components[c]:c}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ya(e)}function Ya(e,r){const i=new un("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:r,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Gb+"#cannot-handle-mdx-estrees-without-createevaluater",i}function W2(e){const r={};let i;for(i in e)Nh.call(e,i)&&(r[G2(i)]=e[i]);return r}function G2(e){let r=e.replace(T2,V2);return r.slice(0,3)==="ms-"&&(r="-"+r),r}function V2(e){return"-"+e.toLowerCase()}const Md={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"]},Y2={};function Dh(e,r){const i=Y2,s=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,c=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Xb(e,s,c)}function Xb(e,r,i){if(K2(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(r&&"alt"in e&&e.alt)return e.alt;if("children"in e)return iv(e.children,r,i)}return Array.isArray(e)?iv(e,r,i):""}function iv(e,r,i){const s=[];let c=-1;for(;++c<e.length;)s[c]=Xb(e[c],r,i);return s.join("")}function K2(e){return!!(e&&typeof e=="object")}const sv=document.createElement("i");function Ka(e){const r="&"+e+";";sv.innerHTML=r;const i=sv.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===r?!1:i}function Rn(e,r,i,s){const c=e.length;let u=0,f;if(r<0?r=-r>c?0:c+r:r=r>c?c:r,i=i>0?i:0,s.length<1e4)f=Array.from(s),f.unshift(r,i),e.splice(...f);else for(i&&e.splice(r,i);u<s.length;)f=s.slice(u,u+1e4),f.unshift(r,0),e.splice(...f),u+=1e4,r+=1e4}function qn(e,r){return e.length>0?(Rn(e,e.length,0,r),e):r}const av={}.hasOwnProperty;function Zb(e){const r={};let i=-1;for(;++i<e.length;)X2(r,e[i]);return r}function X2(e,r){let i;for(i in r){const c=(av.call(e,i)?e[i]:void 0)||(e[i]={}),u=r[i];let f;if(u)for(f in u){av.call(c,f)||(c[f]=[]);const l=u[f];Z2(c[f],Array.isArray(l)?l:l?[l]:[])}}}function Z2(e,r){let i=-1;const s=[];for(;++i<r.length;)(r[i].add==="after"?e:s).push(r[i]);Rn(e,0,0,s)}function Qb(e,r){const i=Number.parseInt(e,r);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Xn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hn=ai(/[A-Za-z]/),ln=ai(/[\dA-Za-z]/),Q2=ai(/[#-'*+\--9=?A-Z^-~]/);function Ml(e){return e!==null&&(e<32||e===127)}const ih=ai(/\d/),J2=ai(/[\dA-Fa-f]/),eC=ai(/[!-/:-@[-`{-~]/);function He(e){return e!==null&&e<-2}function bt(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const Xl=ai(new RegExp("\\p{P}|\\p{S}","u")),Ri=ai(/\s/);function ai(e){return r;function r(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Is(e){const r=[];let i=-1,s=0,c=0;for(;++i<e.length;){const u=e.charCodeAt(i);let f="";if(u===37&&ln(e.charCodeAt(i+1))&&ln(e.charCodeAt(i+2)))c=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(f=String.fromCharCode(u));else if(u>55295&&u<57344){const l=e.charCodeAt(i+1);u<56320&&l>56319&&l<57344?(f=String.fromCharCode(u,l),c=1):f="�"}else f=String.fromCharCode(u);f&&(r.push(e.slice(s,i),encodeURIComponent(f)),s=i+c+1,f=""),c&&(i+=c,c=0)}return r.join("")+e.slice(s)}function ot(e,r,i,s){const c=s?s-1:Number.POSITIVE_INFINITY;let u=0;return f;function f(d){return et(d)?(e.enter(i),l(d)):r(d)}function l(d){return et(d)&&u++<c?(e.consume(d),l):(e.exit(i),r(d))}}const tC={tokenize:nC};function nC(e){const r=e.attempt(this.parser.constructs.contentInitial,s,c);let i;return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ot(e,r,"linePrefix")}function c(l){return e.enter("paragraph"),u(l)}function u(l){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,f(l)}function f(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return He(l)?(e.consume(l),e.exit("chunkText"),u):(e.consume(l),f)}}const rC={tokenize:iC},ov={tokenize:sC};function iC(e){const r=this,i=[];let s=0,c,u,f;return l;function l(S){if(s<i.length){const j=i[s];return r.containerState=j[1],e.attempt(j[0].continuation,d,p)(S)}return p(S)}function d(S){if(s++,r.containerState._closeFlow){r.containerState._closeFlow=void 0,c&&x();const j=r.events.length;let A=j,N;for(;A--;)if(r.events[A][0]==="exit"&&r.events[A][1].type==="chunkFlow"){N=r.events[A][1].end;break}b(s);let D=j;for(;D<r.events.length;)r.events[D][1].end={...N},D++;return Rn(r.events,A+1,0,r.events.slice(j)),r.events.length=D,p(S)}return l(S)}function p(S){if(s===i.length){if(!c)return y(S);if(c.currentConstruct&&c.currentConstruct.concrete)return k(S);r.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return r.containerState={},e.check(ov,g,m)(S)}function g(S){return c&&x(),b(s),y(S)}function m(S){return r.parser.lazy[r.now().line]=s!==i.length,f=r.now().offset,k(S)}function y(S){return r.containerState={},e.attempt(ov,_,k)(S)}function _(S){return s++,i.push([r.currentConstruct,r.containerState]),y(S)}function k(S){if(S===null){c&&x(),b(0),e.consume(S);return}return c=c||r.parser.flow(r.now()),e.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:u}),C(S)}function C(S){if(S===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return He(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,r.interrupt=void 0,l):(e.consume(S),C)}function v(S,j){const A=r.sliceStream(S);if(j&&A.push(null),S.previous=u,u&&(u.next=S),u=S,c.defineSkip(S.start),c.write(A),r.parser.lazy[S.start.line]){let N=c.events.length;for(;N--;)if(c.events[N][1].start.offset<f&&(!c.events[N][1].end||c.events[N][1].end.offset>f))return;const D=r.events.length;let T=D,I,H;for(;T--;)if(r.events[T][0]==="exit"&&r.events[T][1].type==="chunkFlow"){if(I){H=r.events[T][1].end;break}I=!0}for(b(s),N=D;N<r.events.length;)r.events[N][1].end={...H},N++;Rn(r.events,T+1,0,r.events.slice(D)),r.events.length=N}}function b(S){let j=i.length;for(;j-- >S;){const A=i[j];r.containerState=A[1],A[0].exit.call(r,e)}i.length=S}function x(){c.write([null]),u=void 0,c=void 0,r.containerState._closeFlow=void 0}}function sC(e,r,i){return ot(e,e.attempt(this.parser.constructs.document,r,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ms(e){if(e===null||bt(e)||Ri(e))return 1;if(Xl(e))return 2}function Zl(e,r,i){const s=[];let c=-1;for(;++c<e.length;){const u=e[c].resolveAll;u&&!s.includes(u)&&(r=u(r,i),s.push(u))}return r}const sh={name:"attention",resolveAll:aC,tokenize:oC};function aC(e,r){let i=-1,s,c,u,f,l,d,p,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(s=i;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&r.sliceSerialize(e[s][1]).charCodeAt(0)===r.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[s][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const m={...e[s][1].end},y={...e[i][1].start};lv(m,-d),lv(y,d),f={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:y},u={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[i][1].start}},c={type:d>1?"strong":"emphasis",start:{...f.start},end:{...l.end}},e[s][1].end={...f.start},e[i][1].start={...l.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=qn(p,[["enter",e[s][1],r],["exit",e[s][1],r]])),p=qn(p,[["enter",c,r],["enter",f,r],["exit",f,r],["enter",u,r]]),p=qn(p,Zl(r.parser.constructs.insideSpan.null,e.slice(s+1,i),r)),p=qn(p,[["exit",u,r],["enter",l,r],["exit",l,r],["exit",c,r]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,p=qn(p,[["enter",e[i][1],r],["exit",e[i][1],r]])):g=0,Rn(e,s-1,i-s+3,p),i=s+p.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function oC(e,r){const i=this.parser.constructs.attentionMarkers.null,s=this.previous,c=Ms(s);let u;return f;function f(d){return u=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===u)return e.consume(d),l;const p=e.exit("attentionSequence"),g=Ms(d),m=!g||g===2&&c||i.includes(d),y=!c||c===2&&g||i.includes(s);return p._open=!!(u===42?m:m&&(c||!y)),p._close=!!(u===42?y:y&&(g||!m)),r(d)}}function lv(e,r){e.column+=r,e.offset+=r,e._bufferIndex+=r}const lC={name:"autolink",tokenize:cC};function cC(e,r,i){let s=0;return c;function c(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(_){return hn(_)?(e.consume(_),f):_===64?i(_):p(_)}function f(_){return _===43||_===45||_===46||ln(_)?(s=1,l(_)):p(_)}function l(_){return _===58?(e.consume(_),s=0,d):(_===43||_===45||_===46||ln(_))&&s++<32?(e.consume(_),l):(s=0,p(_))}function d(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):_===null||_===32||_===60||Ml(_)?i(_):(e.consume(_),d)}function p(_){return _===64?(e.consume(_),g):Q2(_)?(e.consume(_),p):i(_)}function g(_){return ln(_)?m(_):i(_)}function m(_){return _===46?(e.consume(_),s=0,g):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),r):y(_)}function y(_){if((_===45||ln(_))&&s++<63){const k=_===45?y:m;return e.consume(_),k}return i(_)}}const no={partial:!0,tokenize:uC};function uC(e,r,i){return s;function s(u){return et(u)?ot(e,c,"linePrefix")(u):c(u)}function c(u){return u===null||He(u)?r(u):i(u)}}const Jb={continuation:{tokenize:hC},exit:fC,name:"blockQuote",tokenize:dC};function dC(e,r,i){const s=this;return c;function c(f){if(f===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(f),e.exit("blockQuoteMarker"),u}return i(f)}function u(f){return et(f)?(e.enter("blockQuotePrefixWhitespace"),e.consume(f),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),r):(e.exit("blockQuotePrefix"),r(f))}}function hC(e,r,i){const s=this;return c;function c(f){return et(f)?ot(e,u,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f):u(f)}function u(f){return e.attempt(Jb,r,i)(f)}}function fC(e){e.exit("blockQuote")}const ey={name:"characterEscape",tokenize:pC};function pC(e,r,i){return s;function s(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),c}function c(u){return eC(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),r):i(u)}}const ty={name:"characterReference",tokenize:mC};function mC(e,r,i){const s=this;let c=0,u,f;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),d}function d(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),u=31,f=ln,g(m))}function p(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,f=J2,g):(e.enter("characterReferenceValue"),u=7,f=ih,g(m))}function g(m){if(m===59&&c){const y=e.exit("characterReferenceValue");return f===ln&&!Ka(s.sliceSerialize(y))?i(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),r)}return f(m)&&c++<u?(e.consume(m),g):i(m)}}const cv={partial:!0,tokenize:xC},uv={concrete:!0,name:"codeFenced",tokenize:gC};function gC(e,r,i){const s=this,c={partial:!0,tokenize:A};let u=0,f=0,l;return d;function d(N){return p(N)}function p(N){const D=s.events[s.events.length-1];return u=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(N)}function g(N){return N===l?(f++,e.consume(N),g):f<3?i(N):(e.exit("codeFencedFenceSequence"),et(N)?ot(e,m,"whitespace")(N):m(N))}function m(N){return N===null||He(N)?(e.exit("codeFencedFence"),s.interrupt?r(N):e.check(cv,C,j)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):et(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,_,"whitespace")(N)):N===96&&N===l?i(N):(e.consume(N),y)}function _(N){return N===null||He(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(N))}function k(N){return N===null||He(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?i(N):(e.consume(N),k)}function C(N){return e.attempt(c,j,v)(N)}function v(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),b}function b(N){return u>0&&et(N)?ot(e,x,"linePrefix",u+1)(N):x(N)}function x(N){return N===null||He(N)?e.check(cv,C,j)(N):(e.enter("codeFlowValue"),S(N))}function S(N){return N===null||He(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),S)}function j(N){return e.exit("codeFenced"),r(N)}function A(N,D,T){let I=0;return H;function H(U){return N.enter("lineEnding"),N.consume(U),N.exit("lineEnding"),V}function V(U){return N.enter("codeFencedFence"),et(U)?ot(N,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):Y(U)}function Y(U){return U===l?(N.enter("codeFencedFenceSequence"),q(U)):T(U)}function q(U){return U===l?(I++,N.consume(U),q):I>=f?(N.exit("codeFencedFenceSequence"),et(U)?ot(N,O,"whitespace")(U):O(U)):T(U)}function O(U){return U===null||He(U)?(N.exit("codeFencedFence"),D(U)):T(U)}}}function xC(e,r,i){const s=this;return c;function c(f){return f===null?i(f):(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}const Od={name:"codeIndented",tokenize:bC},vC={partial:!0,tokenize:yC};function bC(e,r,i){const s=this;return c;function c(p){return e.enter("codeIndented"),ot(e,u,"linePrefix",5)(p)}function u(p){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?f(p):i(p)}function f(p){return p===null?d(p):He(p)?e.attempt(vC,f,d)(p):(e.enter("codeFlowValue"),l(p))}function l(p){return p===null||He(p)?(e.exit("codeFlowValue"),f(p)):(e.consume(p),l)}function d(p){return e.exit("codeIndented"),r(p)}}function yC(e,r,i){const s=this;return c;function c(f){return s.parser.lazy[s.now().line]?i(f):He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):ot(e,u,"linePrefix",5)(f)}function u(f){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):He(f)?c(f):i(f)}}const _C={name:"codeText",previous:wC,resolve:SC,tokenize:CC};function SC(e){let r=e.length-4,i=3,s,c;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[r][1].type==="lineEnding"||e[r][1].type==="space")){for(s=i;++s<r;)if(e[s][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(s=i-1,r++;++s<=r;)c===void 0?s!==r&&e[s][1].type!=="lineEnding"&&(c=s):(s===r||e[s][1].type==="lineEnding")&&(e[c][1].type="codeTextData",s!==c+2&&(e[c][1].end=e[s-1][1].end,e.splice(c+2,s-c-2),r-=s-c-2,s=c+2),c=void 0);return e}function wC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function CC(e,r,i){let s=0,c,u;return f;function f(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),d(m))}function d(m){return m===null?i(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),d):m===96?(u=e.enter("codeTextSequence"),c=0,g(m)):He(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("codeTextData"),p(m))}function p(m){return m===null||m===32||m===96||He(m)?(e.exit("codeTextData"),d(m)):(e.consume(m),p)}function g(m){return m===96?(e.consume(m),c++,g):c===s?(e.exit("codeTextSequence"),e.exit("codeText"),r(m)):(u.type="codeTextData",p(m))}}class kC{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,i){const s=i??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(r,s):r>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-r+this.left.length).reverse():this.left.slice(r).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(r,i,s){const c=i||0;this.setCursor(Math.trunc(r));const u=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return s&&Oa(this.left,s),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),Oa(this.left,r)}unshift(r){this.setCursor(0),this.right.push(r)}unshiftMany(r){this.setCursor(0),Oa(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 i=this.left.splice(r,Number.POSITIVE_INFINITY);Oa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-r,Number.POSITIVE_INFINITY);Oa(this.left,i.reverse())}}}function Oa(e,r){let i=0;if(r.length<1e4)e.push(...r);else for(;i<r.length;)e.push(...r.slice(i,i+1e4)),i+=1e4}function ny(e){const r={};let i=-1,s,c,u,f,l,d,p;const g=new kC(e);for(;++i<g.length;){for(;i in r;)i=r[i];if(s=g.get(i),i&&s[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,u=0,u<d.length&&d[u][1].type==="lineEndingBlank"&&(u+=2),u<d.length&&d[u][1].type==="content"))for(;++u<d.length&&d[u][1].type!=="content";)d[u][1].type==="chunkText"&&(d[u][1]._isInFirstContentOfListItem=!0,u++);if(s[0]==="enter")s[1].contentType&&(Object.assign(r,EC(g,i)),i=r[i],p=!0);else if(s[1]._container){for(u=i,c=void 0;u--;)if(f=g.get(u),f[1].type==="lineEnding"||f[1].type==="lineEndingBlank")f[0]==="enter"&&(c&&(g.get(c)[1].type="lineEndingBlank"),f[1].type="lineEnding",c=u);else if(!(f[1].type==="linePrefix"||f[1].type==="listItemIndent"))break;c&&(s[1].end={...g.get(c)[1].start},l=g.slice(c,i),l.unshift(s),g.splice(c,i-c+1,l))}}return Rn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function EC(e,r){const i=e.get(r)[1],s=e.get(r)[2];let c=r-1;const u=[];let f=i._tokenizer;f||(f=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(f._contentTypeTextTrailing=!0));const l=f.events,d=[],p={};let g,m,y=-1,_=i,k=0,C=0;const v=[C];for(;_;){for(;e.get(++c)[1]!==_;);u.push(c),_._tokenizer||(g=s.sliceStream(_),_.next||g.push(null),m&&f.defineSkip(_.start),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=!0),f.write(g),_._isInFirstContentOfListItem&&(f._gfmTasklistFirstContentOfListItem=void 0)),m=_,_=_.next}for(_=i;++y<l.length;)l[y][0]==="exit"&&l[y-1][0]==="enter"&&l[y][1].type===l[y-1][1].type&&l[y][1].start.line!==l[y][1].end.line&&(C=y+1,v.push(C),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(f.events=[],_?(_._tokenizer=void 0,_.previous=void 0):v.pop(),y=v.length;y--;){const b=l.slice(v[y],v[y+1]),x=u.pop();d.push([x,x+b.length-1]),e.splice(x,2,b)}for(d.reverse(),y=-1;++y<d.length;)p[k+d[y][0]]=k+d[y][1],k+=d[y][1]-d[y][0]-1;return p}const jC={resolve:TC,tokenize:AC},NC={partial:!0,tokenize:DC};function TC(e){return ny(e),e}function AC(e,r){let i;return s;function s(l){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),c(l)}function c(l){return l===null?u(l):He(l)?e.check(NC,f,u)(l):(e.consume(l),c)}function u(l){return e.exit("chunkContent"),e.exit("content"),r(l)}function f(l){return e.consume(l),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,c}}function DC(e,r,i){const s=this;return c;function c(f){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,u,"linePrefix")}function u(f){if(f===null||He(f))return i(f);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?r(f):e.interrupt(s.parser.constructs.flow,i,r)(f)}}function ry(e,r,i,s,c,u,f,l,d){const p=d||Number.POSITIVE_INFINITY;let g=0;return m;function m(b){return b===60?(e.enter(s),e.enter(c),e.enter(u),e.consume(b),e.exit(u),y):b===null||b===32||b===41||Ml(b)?i(b):(e.enter(s),e.enter(f),e.enter(l),e.enter("chunkString",{contentType:"string"}),C(b))}function y(b){return b===62?(e.enter(u),e.consume(b),e.exit(u),e.exit(c),e.exit(s),r):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(b))}function _(b){return b===62?(e.exit("chunkString"),e.exit(l),y(b)):b===null||b===60||He(b)?i(b):(e.consume(b),b===92?k:_)}function k(b){return b===60||b===62||b===92?(e.consume(b),_):_(b)}function C(b){return!g&&(b===null||b===41||bt(b))?(e.exit("chunkString"),e.exit(l),e.exit(f),e.exit(s),r(b)):g<p&&b===40?(e.consume(b),g++,C):b===41?(e.consume(b),g--,C):b===null||b===32||b===40||Ml(b)?i(b):(e.consume(b),b===92?v:C)}function v(b){return b===40||b===41||b===92?(e.consume(b),C):C(b)}}function iy(e,r,i,s,c,u){const f=this;let l=0,d;return p;function p(_){return e.enter(s),e.enter(c),e.consume(_),e.exit(c),e.enter(u),g}function g(_){return l>999||_===null||_===91||_===93&&!d||_===94&&!l&&"_hiddenFootnoteSupport"in f.parser.constructs?i(_):_===93?(e.exit(u),e.enter(c),e.consume(_),e.exit(c),e.exit(s),r):He(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||_===91||_===93||He(_)||l++>999?(e.exit("chunkString"),g(_)):(e.consume(_),d||(d=!et(_)),_===92?y:m)}function y(_){return _===91||_===92||_===93?(e.consume(_),l++,m):m(_)}}function sy(e,r,i,s,c,u){let f;return l;function l(y){return y===34||y===39||y===40?(e.enter(s),e.enter(c),e.consume(y),e.exit(c),f=y===40?41:y,d):i(y)}function d(y){return y===f?(e.enter(c),e.consume(y),e.exit(c),e.exit(s),r):(e.enter(u),p(y))}function p(y){return y===f?(e.exit(u),d(f)):y===null?i(y):He(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),ot(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===f||y===null||He(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?m:g)}function m(y){return y===f||y===92?(e.consume(y),g):g(y)}}function Ua(e,r){let i;return s;function s(c){return He(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i=!0,s):et(c)?ot(e,s,i?"linePrefix":"lineSuffix")(c):r(c)}}const LC={name:"definition",tokenize:MC},RC={partial:!0,tokenize:OC};function MC(e,r,i){const s=this;let c;return u;function u(_){return e.enter("definition"),f(_)}function f(_){return iy.call(s,e,l,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return c=Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),d):i(_)}function d(_){return bt(_)?Ua(e,p)(_):p(_)}function p(_){return ry(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function g(_){return e.attempt(RC,m,m)(_)}function m(_){return et(_)?ot(e,y,"whitespace")(_):y(_)}function y(_){return _===null||He(_)?(e.exit("definition"),s.parser.defined.push(c),r(_)):i(_)}}function OC(e,r,i){return s;function s(l){return bt(l)?Ua(e,c)(l):i(l)}function c(l){return sy(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function u(l){return et(l)?ot(e,f,"whitespace")(l):f(l)}function f(l){return l===null||He(l)?r(l):i(l)}}const BC={name:"hardBreakEscape",tokenize:IC};function IC(e,r,i){return s;function s(u){return e.enter("hardBreakEscape"),e.consume(u),c}function c(u){return He(u)?(e.exit("hardBreakEscape"),r(u)):i(u)}}const zC={name:"headingAtx",resolve:HC,tokenize:PC};function HC(e,r){let i=e.length-2,s=3,c,u;return e[s][1].type==="whitespace"&&(s+=2),i-2>s&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(s===i-1||i-4>s&&e[i-2][1].type==="whitespace")&&(i-=s+1===i?2:4),i>s&&(c={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},u={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},Rn(e,s,i-s+1,[["enter",c,r],["enter",u,r],["exit",u,r],["exit",c,r]])),e}function PC(e,r,i){let s=0;return c;function c(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),f(g)}function f(g){return g===35&&s++<6?(e.consume(g),f):g===null||bt(g)?(e.exit("atxHeadingSequence"),l(g)):i(g)}function l(g){return g===35?(e.enter("atxHeadingSequence"),d(g)):g===null||He(g)?(e.exit("atxHeading"),r(g)):et(g)?ot(e,l,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function d(g){return g===35?(e.consume(g),d):(e.exit("atxHeadingSequence"),l(g))}function p(g){return g===null||g===35||bt(g)?(e.exit("atxHeadingText"),l(g)):(e.consume(g),p)}}const FC=["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"],dv=["pre","script","style","textarea"],UC={concrete:!0,name:"htmlFlow",resolveTo:WC,tokenize:GC},$C={partial:!0,tokenize:YC},qC={partial:!0,tokenize:VC};function WC(e){let r=e.length;for(;r--&&!(e[r][0]==="enter"&&e[r][1].type==="htmlFlow"););return r>1&&e[r-2][1].type==="linePrefix"&&(e[r][1].start=e[r-2][1].start,e[r+1][1].start=e[r-2][1].start,e.splice(r-2,2)),e}function GC(e,r,i){const s=this;let c,u,f,l,d;return p;function p(F){return g(F)}function g(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),m}function m(F){return F===33?(e.consume(F),y):F===47?(e.consume(F),u=!0,C):F===63?(e.consume(F),c=3,s.interrupt?r:L):hn(F)?(e.consume(F),f=String.fromCharCode(F),v):i(F)}function y(F){return F===45?(e.consume(F),c=2,_):F===91?(e.consume(F),c=5,l=0,k):hn(F)?(e.consume(F),c=4,s.interrupt?r:L):i(F)}function _(F){return F===45?(e.consume(F),s.interrupt?r:L):i(F)}function k(F){const re="CDATA[";return F===re.charCodeAt(l++)?(e.consume(F),l===re.length?s.interrupt?r:Y:k):i(F)}function C(F){return hn(F)?(e.consume(F),f=String.fromCharCode(F),v):i(F)}function v(F){if(F===null||F===47||F===62||bt(F)){const re=F===47,Z=f.toLowerCase();return!re&&!u&&dv.includes(Z)?(c=1,s.interrupt?r(F):Y(F)):FC.includes(f.toLowerCase())?(c=6,re?(e.consume(F),b):s.interrupt?r(F):Y(F)):(c=7,s.interrupt&&!s.parser.lazy[s.now().line]?i(F):u?x(F):S(F))}return F===45||ln(F)?(e.consume(F),f+=String.fromCharCode(F),v):i(F)}function b(F){return F===62?(e.consume(F),s.interrupt?r:Y):i(F)}function x(F){return et(F)?(e.consume(F),x):H(F)}function S(F){return F===47?(e.consume(F),H):F===58||F===95||hn(F)?(e.consume(F),j):et(F)?(e.consume(F),S):H(F)}function j(F){return F===45||F===46||F===58||F===95||ln(F)?(e.consume(F),j):A(F)}function A(F){return F===61?(e.consume(F),N):et(F)?(e.consume(F),A):S(F)}function N(F){return F===null||F===60||F===61||F===62||F===96?i(F):F===34||F===39?(e.consume(F),d=F,D):et(F)?(e.consume(F),N):T(F)}function D(F){return F===d?(e.consume(F),d=null,I):F===null||He(F)?i(F):(e.consume(F),D)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||bt(F)?A(F):(e.consume(F),T)}function I(F){return F===47||F===62||et(F)?S(F):i(F)}function H(F){return F===62?(e.consume(F),V):i(F)}function V(F){return F===null||He(F)?Y(F):et(F)?(e.consume(F),V):i(F)}function Y(F){return F===45&&c===2?(e.consume(F),z):F===60&&c===1?(e.consume(F),X):F===62&&c===4?(e.consume(F),B):F===63&&c===3?(e.consume(F),L):F===93&&c===5?(e.consume(F),M):He(F)&&(c===6||c===7)?(e.exit("htmlFlowData"),e.check($C,W,q)(F)):F===null||He(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),Y)}function q(F){return e.check(qC,O,W)(F)}function O(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),U}function U(F){return F===null||He(F)?q(F):(e.enter("htmlFlowData"),Y(F))}function z(F){return F===45?(e.consume(F),L):Y(F)}function X(F){return F===47?(e.consume(F),f="",Q):Y(F)}function Q(F){if(F===62){const re=f.toLowerCase();return dv.includes(re)?(e.consume(F),B):Y(F)}return hn(F)&&f.length<8?(e.consume(F),f+=String.fromCharCode(F),Q):Y(F)}function M(F){return F===93?(e.consume(F),L):Y(F)}function L(F){return F===62?(e.consume(F),B):F===45&&c===2?(e.consume(F),L):Y(F)}function B(F){return F===null||He(F)?(e.exit("htmlFlowData"),W(F)):(e.consume(F),B)}function W(F){return e.exit("htmlFlow"),r(F)}}function VC(e,r,i){const s=this;return c;function c(f){return He(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):i(f)}function u(f){return s.parser.lazy[s.now().line]?i(f):r(f)}}function YC(e,r,i){return s;function s(c){return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),e.attempt(no,r,i)}}const KC={name:"htmlText",tokenize:XC};function XC(e,r,i){const s=this;let c,u,f;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),p):L===47?(e.consume(L),A):L===63?(e.consume(L),S):hn(L)?(e.consume(L),T):i(L)}function p(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),u=0,k):hn(L)?(e.consume(L),x):i(L)}function g(L){return L===45?(e.consume(L),_):i(L)}function m(L){return L===null?i(L):L===45?(e.consume(L),y):He(L)?(f=m,X(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),_):m(L)}function _(L){return L===62?z(L):L===45?y(L):m(L)}function k(L){const B="CDATA[";return L===B.charCodeAt(u++)?(e.consume(L),u===B.length?C:k):i(L)}function C(L){return L===null?i(L):L===93?(e.consume(L),v):He(L)?(f=C,X(L)):(e.consume(L),C)}function v(L){return L===93?(e.consume(L),b):C(L)}function b(L){return L===62?z(L):L===93?(e.consume(L),b):C(L)}function x(L){return L===null||L===62?z(L):He(L)?(f=x,X(L)):(e.consume(L),x)}function S(L){return L===null?i(L):L===63?(e.consume(L),j):He(L)?(f=S,X(L)):(e.consume(L),S)}function j(L){return L===62?z(L):S(L)}function A(L){return hn(L)?(e.consume(L),N):i(L)}function N(L){return L===45||ln(L)?(e.consume(L),N):D(L)}function D(L){return He(L)?(f=D,X(L)):et(L)?(e.consume(L),D):z(L)}function T(L){return L===45||ln(L)?(e.consume(L),T):L===47||L===62||bt(L)?I(L):i(L)}function I(L){return L===47?(e.consume(L),z):L===58||L===95||hn(L)?(e.consume(L),H):He(L)?(f=I,X(L)):et(L)?(e.consume(L),I):z(L)}function H(L){return L===45||L===46||L===58||L===95||ln(L)?(e.consume(L),H):V(L)}function V(L){return L===61?(e.consume(L),Y):He(L)?(f=V,X(L)):et(L)?(e.consume(L),V):I(L)}function Y(L){return L===null||L===60||L===61||L===62||L===96?i(L):L===34||L===39?(e.consume(L),c=L,q):He(L)?(f=Y,X(L)):et(L)?(e.consume(L),Y):(e.consume(L),O)}function q(L){return L===c?(e.consume(L),c=void 0,U):L===null?i(L):He(L)?(f=q,X(L)):(e.consume(L),q)}function O(L){return L===null||L===34||L===39||L===60||L===61||L===96?i(L):L===47||L===62||bt(L)?I(L):(e.consume(L),O)}function U(L){return L===47||L===62||bt(L)?I(L):i(L)}function z(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),r):i(L)}function X(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Q}function Q(L){return et(L)?ot(e,M,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):M(L)}function M(L){return e.enter("htmlTextData"),f(L)}}const Lh={name:"labelEnd",resolveAll:ek,resolveTo:tk,tokenize:nk},ZC={tokenize:rk},QC={tokenize:ik},JC={tokenize:sk};function ek(e){let r=-1;const i=[];for(;++r<e.length;){const s=e[r][1];if(i.push(e[r]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const c=s.type==="labelImage"?4:2;s.type="data",r+=c}}return e.length!==i.length&&Rn(e,0,e.length,i),e}function tk(e,r){let i=e.length,s=0,c,u,f,l;for(;i--;)if(c=e[i][1],u){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;e[i][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(f){if(e[i][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(u=i,c.type!=="labelLink")){s=2;break}}else c.type==="labelEnd"&&(f=i);const d={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[u][1].start},end:{...e[f][1].end}},g={type:"labelText",start:{...e[u+s+2][1].end},end:{...e[f-2][1].start}};return l=[["enter",d,r],["enter",p,r]],l=qn(l,e.slice(u+1,u+s+3)),l=qn(l,[["enter",g,r]]),l=qn(l,Zl(r.parser.constructs.insideSpan.null,e.slice(u+s+4,f-3),r)),l=qn(l,[["exit",g,r],e[f-2],e[f-1],["exit",p,r]]),l=qn(l,e.slice(f+1)),l=qn(l,[["exit",d,r]]),Rn(e,u,e.length,l),e}function nk(e,r,i){const s=this;let c=s.events.length,u,f;for(;c--;)if((s.events[c][1].type==="labelImage"||s.events[c][1].type==="labelLink")&&!s.events[c][1]._balanced){u=s.events[c][1];break}return l;function l(y){return u?u._inactive?m(y):(f=s.parser.defined.includes(Xn(s.sliceSerialize({start:u.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),d):i(y)}function d(y){return y===40?e.attempt(ZC,g,f?g:m)(y):y===91?e.attempt(QC,g,f?p:m)(y):f?g(y):m(y)}function p(y){return e.attempt(JC,g,m)(y)}function g(y){return r(y)}function m(y){return u._balanced=!0,i(y)}}function rk(e,r,i){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),c}function c(m){return bt(m)?Ua(e,u)(m):u(m)}function u(m){return m===41?g(m):ry(e,f,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function f(m){return bt(m)?Ua(e,d)(m):g(m)}function l(m){return i(m)}function d(m){return m===34||m===39||m===40?sy(e,p,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function p(m){return bt(m)?Ua(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),r):i(m)}}function ik(e,r,i){const s=this;return c;function c(l){return iy.call(s,e,u,f,"reference","referenceMarker","referenceString")(l)}function u(l){return s.parser.defined.includes(Xn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?r(l):i(l)}function f(l){return i(l)}}function sk(e,r,i){return s;function s(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),c}function c(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),r):i(u)}}const ak={name:"labelStartImage",resolveAll:Lh.resolveAll,tokenize:ok};function ok(e,r,i){const s=this;return c;function c(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),u}function u(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),f):i(l)}function f(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(l):r(l)}}const lk={name:"labelStartLink",resolveAll:Lh.resolveAll,tokenize:ck};function ck(e,r,i){const s=this;return c;function c(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelLink"),u}function u(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?i(f):r(f)}}const Bd={name:"lineEnding",tokenize:uk};function uk(e,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ot(e,r,"linePrefix")}}const Nl={name:"thematicBreak",tokenize:dk};function dk(e,r,i){let s=0,c;return u;function u(p){return e.enter("thematicBreak"),f(p)}function f(p){return c=p,l(p)}function l(p){return p===c?(e.enter("thematicBreakSequence"),d(p)):s>=3&&(p===null||He(p))?(e.exit("thematicBreak"),r(p)):i(p)}function d(p){return p===c?(e.consume(p),s++,d):(e.exit("thematicBreakSequence"),et(p)?ot(e,l,"whitespace")(p):l(p))}}const yn={continuation:{tokenize:mk},exit:xk,name:"list",tokenize:pk},hk={partial:!0,tokenize:vk},fk={partial:!0,tokenize:gk};function pk(e,r,i){const s=this,c=s.events[s.events.length-1];let u=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,f=0;return l;function l(_){const k=s.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!s.containerState.marker||_===s.containerState.marker:ih(_)){if(s.containerState.type||(s.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(Nl,i,p)(_):p(_);if(!s.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(_)}return i(_)}function d(_){return ih(_)&&++f<10?(e.consume(_),d):(!s.interrupt||f<2)&&(s.containerState.marker?_===s.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),p(_)):i(_)}function p(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||_,e.check(no,s.interrupt?i:g,e.attempt(hk,y,m))}function g(_){return s.containerState.initialBlankLine=!0,u++,y(_)}function m(_){return et(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),y):i(_)}function y(_){return s.containerState.size=u+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,r(_)}}function mk(e,r,i){const s=this;return s.containerState._closeFlow=void 0,e.check(no,c,u);function c(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ot(e,r,"listItemIndent",s.containerState.size+1)(l)}function u(l){return s.containerState.furtherBlankLines||!et(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,f(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(fk,r,f)(l))}function f(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,ot(e,e.attempt(yn,r,i),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function gk(e,r,i){const s=this;return ot(e,c,"listItemIndent",s.containerState.size+1);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="listItemIndent"&&f[2].sliceSerialize(f[1],!0).length===s.containerState.size?r(u):i(u)}}function xk(e){e.exit(this.containerState.type)}function vk(e,r,i){const s=this;return ot(e,c,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(u){const f=s.events[s.events.length-1];return!et(u)&&f&&f[1].type==="listItemPrefixWhitespace"?r(u):i(u)}}const hv={name:"setextUnderline",resolveTo:bk,tokenize:yk};function bk(e,r){let i=e.length,s,c,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(c=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const f={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",u?(e.splice(c,0,["enter",f,r]),e.splice(u+1,0,["exit",e[s][1],r]),e[s][1].end={...e[u][1].end}):e[s][1]=f,e.push(["exit",f,r]),e}function yk(e,r,i){const s=this;let c;return u;function u(p){let g=s.events.length,m;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){m=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),c=p,f(p)):i(p)}function f(p){return e.enter("setextHeadingLineSequence"),l(p)}function l(p){return p===c?(e.consume(p),l):(e.exit("setextHeadingLineSequence"),et(p)?ot(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||He(p)?(e.exit("setextHeadingLine"),r(p)):i(p)}}const _k={tokenize:Sk};function Sk(e){const r=this,i=e.attempt(no,s,e.attempt(this.parser.constructs.flowInitial,c,ot(e,e.attempt(this.parser.constructs.flow,c,e.attempt(jC,c)),"linePrefix")));return i;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),r.currentConstruct=void 0,i}function c(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),r.currentConstruct=void 0,i}}const wk={resolveAll:oy()},Ck=ay("string"),kk=ay("text");function ay(e){return{resolveAll:oy(e==="text"?Ek:void 0),tokenize:r};function r(i){const s=this,c=this.parser.constructs[e],u=i.attempt(c,f,l);return f;function f(g){return p(g)?u(g):l(g)}function l(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),d}function d(g){return p(g)?(i.exit("data"),u(g)):(i.consume(g),d)}function p(g){if(g===null)return!0;const m=c[g];let y=-1;if(m)for(;++y<m.length;){const _=m[y];if(!_.previous||_.previous.call(s,s.previous))return!0}return!1}}}function oy(e){return r;function r(i,s){let c=-1,u;for(;++c<=i.length;)u===void 0?i[c]&&i[c][1].type==="data"&&(u=c,c++):(!i[c]||i[c][1].type!=="data")&&(c!==u+2&&(i[u][1].end=i[c-1][1].end,i.splice(u+2,c-u-2),c=u+2),u=void 0);return e?e(i,s):i}}function Ek(e,r){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],c=r.sliceStream(s);let u=c.length,f=-1,l=0,d;for(;u--;){const p=c[u];if(typeof p=="string"){for(f=p.length;p.charCodeAt(f-1)===32;)l++,f--;if(f)break;f=-1}else if(p===-2)d=!0,l++;else if(p!==-1){u++;break}}if(r._contentTypeTextTrailing&&i===e.length&&(l=0),l){const p={type:i===e.length||d||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?f:s.start._bufferIndex+f,_index:s.start._index+u,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(i,0,["enter",p,r],["exit",p,r]),i+=2)}i++}return e}const jk={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:Jb},Nk={91:LC},Tk={[-2]:Od,[-1]:Od,32:Od},Ak={35:zC,42:Nl,45:[hv,Nl],60:UC,61:hv,95:Nl,96:uv,126:uv},Dk={38:ty,92:ey},Lk={[-5]:Bd,[-4]:Bd,[-3]:Bd,33:ak,38:ty,42:sh,60:[lC,KC],91:lk,92:[BC,ey],93:Lh,95:sh,96:_C},Rk={null:[sh,wk]},Mk={null:[42,95]},Ok={null:[]},Bk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Mk,contentInitial:Nk,disable:Ok,document:jk,flow:Ak,flowInitial:Tk,insideSpan:Rk,string:Dk,text:Lk},Symbol.toStringTag,{value:"Module"}));function Ik(e,r,i){let s={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const c={},u=[];let f=[],l=[];const d={attempt:D(A),check:D(N),consume:x,enter:S,exit:j,interrupt:D(N,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:_,write:m};let g=r.tokenize.call(p,d);return r.resolveAll&&u.push(r),p;function m(V){return f=qn(f,V),v(),f[f.length-1]!==null?[]:(T(r,0),p.events=Zl(u,p.events,p),p.events)}function y(V,Y){return Hk(_(V),Y)}function _(V){return zk(f,V)}function k(){const{_bufferIndex:V,_index:Y,line:q,column:O,offset:U}=s;return{_bufferIndex:V,_index:Y,line:q,column:O,offset:U}}function C(V){c[V.line]=V.column,H()}function v(){let V;for(;s._index<f.length;){const Y=f[s._index];if(typeof Y=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<Y.length;)b(Y.charCodeAt(s._bufferIndex));else b(Y)}}function b(V){g=g(V)}function x(V){He(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,H()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===f[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=V}function S(V,Y){const q=Y||{};return q.type=V,q.start=k(),p.events.push(["enter",q,p]),l.push(q),q}function j(V){const Y=l.pop();return Y.end=k(),p.events.push(["exit",Y,p]),Y}function A(V,Y){T(V,Y.from)}function N(V,Y){Y.restore()}function D(V,Y){return q;function q(O,U,z){let X,Q,M,L;return Array.isArray(O)?W(O):"tokenize"in O?W([O]):B(O);function B(ee){return K;function K($){const ae=$!==null&&ee[$],ne=$!==null&&ee.null,ve=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(ve)($)}}function W(ee){return X=ee,Q=0,ee.length===0?z:F(ee[Q])}function F(ee){return K;function K($){return L=I(),M=ee,ee.partial||(p.currentConstruct=ee),ee.name&&p.parser.constructs.disable.null.includes(ee.name)?Z():ee.tokenize.call(Y?Object.assign(Object.create(p),Y):p,d,re,Z)($)}}function re(ee){return V(M,L),U}function Z(ee){return L.restore(),++Q<X.length?F(X[Q]):z}}}function T(V,Y){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Rn(p.events,Y,p.events.length-Y,V.resolve(p.events.slice(Y),p)),V.resolveTo&&(p.events=V.resolveTo(p.events,p))}function I(){const V=k(),Y=p.previous,q=p.currentConstruct,O=p.events.length,U=Array.from(l);return{from:O,restore:z};function z(){s=V,p.previous=Y,p.currentConstruct=q,p.events.length=O,l=U,H()}}function H(){s.line in c&&s.column<2&&(s.column=c[s.line],s.offset+=c[s.line]-1)}}function zk(e,r){const i=r.start._index,s=r.start._bufferIndex,c=r.end._index,u=r.end._bufferIndex;let f;if(i===c)f=[e[i].slice(s,u)];else{if(f=e.slice(i,c),s>-1){const l=f[0];typeof l=="string"?f[0]=l.slice(s):f.shift()}u>0&&f.push(e[c].slice(0,u))}return f}function Hk(e,r){let i=-1;const s=[];let c;for(;++i<e.length;){const u=e[i];let f;if(typeof u=="string")f=u;else switch(u){case-5:{f="\r";break}case-4:{f=`
|
|
92
93
|
`;break}case-3:{f=`\r
|
|
93
94
|
`;break}case-2:{f=r?" ":" ";break}case-1:{if(!r&&c)continue;f=" ";break}default:f=String.fromCharCode(u)}c=u===-2,s.push(f)}return s.join("")}function Pk(e){const s={constructs:Zb([Bk,...(e||{}).extensions||[]]),content:c(tC),defined:[],document:c(rC),flow:c(_k),lazy:{},string:c(Ck),text:c(kk)};return s;function c(u){return f;function f(l){return Ik(s,u,l)}}}function Fk(e){for(;!ny(e););return e}const fv=/[\0\t\n\r]/g;function Uk(){let e=1,r="",i=!0,s;return c;function c(u,f,l){const d=[];let p,g,m,y,_;for(u=r+(typeof u=="string"?u.toString():new TextDecoder(f||void 0).decode(u)),m=0,r="",i&&(u.charCodeAt(0)===65279&&m++,i=void 0);m<u.length;){if(fv.lastIndex=m,p=fv.exec(u),y=p&&p.index!==void 0?p.index:u.length,_=u.charCodeAt(y),!p){r=u.slice(m);break}if(_===10&&m===y&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<y&&(d.push(u.slice(m,y)),e+=y-m),_){case 0:{d.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,d.push(-2);e++<g;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}m=y+1}return l&&(s&&d.push(-5),r&&d.push(r),d.push(null)),d}}const $k=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qk(e){return e.replace($k,Wk)}function Wk(e,r,i){if(r)return r;if(i.charCodeAt(0)===35){const c=i.charCodeAt(1),u=c===120||c===88;return Qb(i.slice(u?2:1),u?16:10)}return Ka(i)||e}const ly={}.hasOwnProperty;function Gk(e,r,i){return r&&typeof r=="object"&&(i=r,r=void 0),Vk(i)(Fk(Pk(i).document().write(Uk()(e,r,!0))))}function Vk(e){const r={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:I,autolinkEmail:I,atxHeading:u(Ie),blockQuote:u(ne),characterEscape:I,characterReference:I,codeFenced:u(ve),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:u(ve,f),codeText:u(be,f),codeTextData:I,data:I,codeFlowValue:I,definition:u(Ae),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:u(Me),hardBreakEscape:u(Fe),hardBreakTrailing:u(Fe),htmlFlow:u(ke,f),htmlFlowData:I,htmlText:u(ke,f),htmlTextData:I,image:u(ge),label:f,link:u(je),listItem:u(Lt),listItemValue:y,listOrdered:u(We,m),listUnordered:u(We),paragraph:u(pe),reference:F,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:u(Ie),strong:u(Ne),thematicBreak:u(lt)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:ae,autolinkProtocol:$,blockQuote:d(),characterEscapeValue:H,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:ee,characterReference:K,codeFenced:d(v),codeFencedFence:C,codeFencedFenceInfo:_,codeFencedFenceMeta:k,codeFlowValue:H,codeIndented:d(b),codeText:d(U),codeTextData:H,data:H,definition:d(),definitionDestinationString:j,definitionLabelString:x,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(Y),hardBreakTrailing:d(Y),htmlFlow:d(q),htmlFlowData:H,htmlText:d(O),htmlTextData:H,image:d(X),label:M,labelText:Q,lineEnding:V,link:d(z),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:re,resourceDestinationString:L,resourceTitleString:B,resource:W,setextHeading:d(T),setextHeadingLineSequence:D,setextHeadingText:N,strong:d(),thematicBreak:d()}};cy(r,(e||{}).mdastExtensions||[]);const i={};return s;function s(ue){let _e={type:"root",children:[]};const Te={stack:[_e],tokenStack:[],config:r,enter:l,exit:p,buffer:f,resume:g,data:i},Be=[];let Ve=-1;for(;++Ve<ue.length;)if(ue[Ve][1].type==="listOrdered"||ue[Ve][1].type==="listUnordered")if(ue[Ve][0]==="enter")Be.push(Ve);else{const Ct=Be.pop();Ve=c(ue,Ct,Ve)}for(Ve=-1;++Ve<ue.length;){const Ct=r[ue[Ve][0]];ly.call(Ct,ue[Ve][1].type)&&Ct[ue[Ve][1].type].call(Object.assign({sliceSerialize:ue[Ve][2].sliceSerialize},Te),ue[Ve][1])}if(Te.tokenStack.length>0){const Ct=Te.tokenStack[Te.tokenStack.length-1];(Ct[1]||pv).call(Te,void 0,Ct[0])}for(_e.position={start:ei(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:ei(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<r.transforms.length;)_e=r.transforms[Ve](_e)||_e;return _e}function c(ue,_e,Te){let Be=_e-1,Ve=-1,Ct=!1,se,Le,$e,at;for(;++Be<=Te;){const qe=ue[Be];switch(qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qe[0]==="enter"?Ve++:Ve--,at=void 0;break}case"lineEndingBlank":{qe[0]==="enter"&&(se&&!at&&!Ve&&!$e&&($e=Be),at=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:at=void 0}if(!Ve&&qe[0]==="enter"&&qe[1].type==="listItemPrefix"||Ve===-1&&qe[0]==="exit"&&(qe[1].type==="listUnordered"||qe[1].type==="listOrdered")){if(se){let Ut=Be;for(Le=void 0;Ut--;){const Rt=ue[Ut];if(Rt[1].type==="lineEnding"||Rt[1].type==="lineEndingBlank"){if(Rt[0]==="exit")continue;Le&&(ue[Le][1].type="lineEndingBlank",Ct=!0),Rt[1].type="lineEnding",Le=Ut}else if(!(Rt[1].type==="linePrefix"||Rt[1].type==="blockQuotePrefix"||Rt[1].type==="blockQuotePrefixWhitespace"||Rt[1].type==="blockQuoteMarker"||Rt[1].type==="listItemIndent"))break}$e&&(!Le||$e<Le)&&(se._spread=!0),se.end=Object.assign({},Le?ue[Le][1].start:qe[1].end),ue.splice(Le||Be,0,["exit",se,qe[2]]),Be++,Te++}if(qe[1].type==="listItemPrefix"){const Ut={type:"listItem",_spread:!1,start:Object.assign({},qe[1].start),end:void 0};se=Ut,ue.splice(Be,0,["enter",Ut,qe[2]]),Be++,Te++,$e=void 0,at=!0}}}return ue[_e][1]._spread=Ct,Te}function u(ue,_e){return Te;function Te(Be){l.call(this,ue(Be),Be),_e&&_e.call(this,Be)}}function f(){this.stack.push({type:"fragment",children:[]})}function l(ue,_e,Te){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([_e,Te||void 0]),ue.position={start:ei(_e.start),end:void 0}}function d(ue){return _e;function _e(Te){ue&&ue.call(this,Te),p.call(this,Te)}}function p(ue,_e){const Te=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==ue.type&&(_e?_e.call(this,ue,Be[0]):(Be[1]||pv).call(this,ue,Be[0]));else throw new Error("Cannot close `"+ue.type+"` ("+Fa({start:ue.start,end:ue.end})+"): it’s not open");Te.position.end=ei(ue.end)}function g(){return Dh(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(ue){if(this.data.expectingFirstListItemValue){const _e=this.stack[this.stack.length-2];_e.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function _(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.lang=ue}function k(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue.replace(/(\r?\n|\r)$/g,"")}function x(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=Xn(this.sliceSerialize(ue)).toLowerCase()}function S(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function j(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function A(ue){const _e=this.stack[this.stack.length-1];if(!_e.depth){const Te=this.sliceSerialize(ue).length;_e.depth=Te}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function D(ue){const _e=this.stack[this.stack.length-1];_e.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function I(ue){const Te=this.stack[this.stack.length-1].children;let Be=Te[Te.length-1];(!Be||Be.type!=="text")&&(Be=Oe(),Be.position={start:ei(ue.start),end:void 0},Te.push(Be)),this.stack.push(Be)}function H(ue){const _e=this.stack.pop();_e.value+=this.sliceSerialize(ue),_e.position.end=ei(ue.end)}function V(ue){const _e=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=_e.children[_e.children.length-1];Te.position.end=ei(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&r.canContainEols.includes(_e.type)&&(I.call(this,ue),H.call(this,ue))}function Y(){this.data.atHardBreak=!0}function q(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function O(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function U(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.value=ue}function z(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function X(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const _e=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=_e,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function Q(ue){const _e=this.sliceSerialize(ue),Te=this.stack[this.stack.length-2];Te.label=qk(_e),Te.identifier=Xn(_e).toLowerCase()}function M(){const ue=this.stack[this.stack.length-1],_e=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Be=ue.children;Te.children=Be}else Te.alt=_e}function L(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.url=ue}function B(){const ue=this.resume(),_e=this.stack[this.stack.length-1];_e.title=ue}function W(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function re(ue){const _e=this.resume(),Te=this.stack[this.stack.length-1];Te.label=_e,Te.identifier=Xn(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function Z(ue){this.data.characterReferenceType=ue.type}function ee(ue){const _e=this.sliceSerialize(ue),Te=this.data.characterReferenceType;let Be;Te?(Be=Qb(_e,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=Ka(_e);const Ve=this.stack[this.stack.length-1];Ve.value+=Be}function K(ue){const _e=this.stack.pop();_e.position.end=ei(ue.end)}function $(ue){H.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url=this.sliceSerialize(ue)}function ae(ue){H.call(this,ue);const _e=this.stack[this.stack.length-1];_e.url="mailto:"+this.sliceSerialize(ue)}function ne(){return{type:"blockquote",children:[]}}function ve(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function Ae(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function Ie(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function ke(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function We(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Lt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function pe(){return{type:"paragraph",children:[]}}function Ne(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function lt(){return{type:"thematicBreak"}}}function ei(e){return{line:e.line,column:e.column,offset:e.offset}}function cy(e,r){let i=-1;for(;++i<r.length;){const s=r[i];Array.isArray(s)?cy(e,s):Yk(e,s)}}function Yk(e,r){let i;for(i in r)if(ly.call(r,i))switch(i){case"canContainEols":{const s=r[i];s&&e[i].push(...s);break}case"transforms":{const s=r[i];s&&e[i].push(...s);break}case"enter":case"exit":{const s=r[i];s&&Object.assign(e[i],s);break}}}function pv(e,r){throw e?new Error("Cannot close `"+e.type+"` ("+Fa({start:e.start,end:e.end})+"): a different token (`"+r.type+"`, "+Fa({start:r.start,end:r.end})+") is open"):new Error("Cannot close document, a token (`"+r.type+"`, "+Fa({start:r.start,end:r.end})+") is still open")}function Kk(e){const r=this;r.parser=i;function i(s){return Gk(s,{...r.data("settings"),...e,extensions:r.data("micromarkExtensions")||[],mdastExtensions:r.data("fromMarkdownExtensions")||[]})}}function Xk(e,r){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(r),!0)};return e.patch(r,i),e.applyData(r,i)}function Zk(e,r){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(r,i),[e.applyData(r,i),{type:"text",value:`
|
|
94
95
|
`}]}function Qk(e,r){const i=r.value?r.value+`
|
|
@@ -100,7 +101,7 @@ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b)
|
|
|
100
101
|
`});++s<e.length;)s&&i.push({type:"text",value:`
|
|
101
102
|
`}),i.push(e[s]);return r&&e.length>0&&i.push({type:"text",value:`
|
|
102
103
|
`}),i}function _v(e){let r=0,i=e.charCodeAt(r);for(;i===9||i===32;)r++,i=e.charCodeAt(r);return e.slice(r)}function Sv(e,r){const i=zE(e,r),s=i.one(e,void 0),c=NE(i),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return c&&u.children.push({type:"text",value:`
|
|
103
|
-
`},c),u}function $E(e,r){return e&&"run"in e?async function(i,s){const c=Sv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return Sv(i,{file:s,...e||r})}}function wv(e){if(e)throw e}var Id,Cv;function qE(){if(Cv)return Id;Cv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},u=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},f=function(p,g){i&&g.name==="__proto__"?i(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},l=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(s)return s(p,g).value}else return;return p[g]};return Id=function d(){var p,g,m,y,_,k,C=arguments[0],v=1,b=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},v=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});v<b;++v)if(p=arguments[v],p!=null)for(g in p)m=l(C,g),y=l(p,g),C!==y&&(x&&y&&(u(y)||(_=c(y)))?(_?(_=!1,k=m&&c(m)?m:[]):k=m&&u(m)?m:{},f(C,{name:g,newValue:d(x,k,y)})):typeof y<"u"&&f(C,{name:g,newValue:y}));return C},Id}var WE=qE();const zd=Pl(WE);function lh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function GE(){const e=[],r={run:i,use:s};return r;function i(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);l(null,...c);function l(d,...p){const g=e[++u];let m=-1;if(d){f(d);return}for(;++m<c.length;)(p[m]===null||p[m]===void 0)&&(p[m]=c[m]);c=p,g?VE(g,l)(...p):f(null,...p)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function VE(e,r){let i;return s;function s(...f){const l=e.length>f.length;let d;l&&f.push(c);try{d=e.apply(this,f)}catch(p){const g=p;if(l&&i)throw g;return c(g)}l||(d&&d.then&&typeof d.then=="function"?d.then(u,c):d instanceof Error?c(d):u(d))}function c(f,...l){i||(i=!0,r(f,...l))}function u(f){c(null,f)}}const rr={basename:YE,dirname:KE,extname:XE,join:ZE,sep:"/"};function YE(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');ro(e);let i=0,s=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else s<0&&(u=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let f=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else f<0&&(u=!0,f=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(s=c):(l=-1,s=f));return i===s?s=f:s<0&&(s=e.length),e.slice(i,s)}function KE(e){if(ro(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function XE(e){ro(e);let r=e.length,i=-1,s=0,c=-1,u=0,f;for(;r--;){const l=e.codePointAt(r);if(l===47){if(f){s=r+1;break}continue}i<0&&(f=!0,i=r+1),l===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||i<0||u===0||u===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function ZE(...e){let r=-1,i;for(;++r<e.length;)ro(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":QE(i)}function QE(e){ro(e);const r=e.codePointAt(0)===47;let i=JE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function JE(e,r){let i="",s=0,c=-1,u=0,f=-1,l,d;for(;++f<=e.length;){if(f<e.length)l=e.codePointAt(f);else{if(l===47)break;l=47}if(l===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",s=0):(i=i.slice(0,d),s=i.length-1-i.lastIndexOf("/")),c=f,u=0;continue}}else if(i.length>0){i="",s=0,c=f,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(c+1,f):i=e.slice(c+1,f),s=f-c-1;c=f,u=0}else l===46&&u>-1?u++:u=-1}return i}function ro(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ej={cwd:tj};function tj(){return"/"}function ch(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nj(e){if(typeof e=="string")e=new URL(e);else if(!ch(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return rj(e)}function rj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const Hd=["history","path","basename","stem","extname","dirname"];class xy{constructor(r){let i;r?ch(r)?i={path:r}:typeof r=="string"||ij(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":ej.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Hd.length;){const u=Hd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let c;for(c in i)Hd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?rr.basename(this.path):void 0}set basename(r){Fd(r,"basename"),Pd(r,"basename"),this.path=rr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?rr.dirname(this.path):void 0}set dirname(r){kv(this.basename,"dirname"),this.path=rr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?rr.extname(this.path):void 0}set extname(r){if(Pd(r,"extname"),kv(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=rr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){ch(r)&&(r=nj(r)),Fd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?rr.basename(this.path,this.extname):void 0}set stem(r){Fd(r,"stem"),Pd(r,"stem"),this.path=rr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const c=this.message(r,i,s);throw c.fatal=!0,c}info(r,i,s){const c=this.message(r,i,s);return c.fatal=void 0,c}message(r,i,s){const c=new cn(r,i,s);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Pd(e,r){if(e&&e.includes(rr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+rr.sep+"`")}function Fd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function kv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function ij(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sj=(function(e){const s=this.constructor.prototype,c=s[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),aj={}.hasOwnProperty;class zh extends sj{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=GE()}copy(){const r=new zh;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(zd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(qd("data",this.frozen),this.namespace[r]=i,this):aj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(qd("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[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=i.call(r,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Cl(r),s=this.parser||this.Parser;return Ud("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Ud("process",this.parser||this.Parser),$d("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(u,f){const l=Cl(r),d=s.parse(l);s.run(d,l,function(g,m,y){if(g||!m||!y)return p(g);const _=m,k=s.stringify(_,y);cj(k)?y.value=k:y.result=k,p(g,y)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Ud("processSync",this.parser||this.Parser),$d("processSync",this.compiler||this.Compiler),this.process(r,c),jv("processSync","process",i),s;function c(u,f){i=!0,wv(u),s=f}}run(r,i,s){Ev(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(f,l){const d=Cl(i);c.run(r,d,p);function p(g,m,y){const _=m||r;g?l(g):f?f(_):s(void 0,_,y)}}}runSync(r,i){let s=!1,c;return this.run(r,i,u),jv("runSync","run",s),c;function u(f,l){wv(f),c=l,s=!0}}stringify(r,i){this.freeze();const s=Cl(i),c=this.compiler||this.Compiler;return $d("stringify",c),Ev(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if(qd("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?l(r):f(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(p){if(typeof p=="function")d(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;d(g,m)}else f(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function f(p){if(!("plugins"in p)&&!("settings"in p))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");l(p.plugins),p.settings&&(c.settings=zd(!0,c.settings,p.settings))}function l(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function d(p,g){let m=-1,y=-1;for(;++m<s.length;)if(s[m][0]===p){y=m;break}if(y===-1)s.push([p,...g]);else if(g.length>0){let[_,...k]=g;const C=s[y][1];lh(C)&&lh(_)&&(_=zd(!0,C,_)),s[y]=[p,_,...k]}}}}const oj=new zh().freeze();function Ud(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $d(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qd(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ev(e){if(!lh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Cl(e){return lj(e)?e:new xy(e)}function lj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cj(e){return typeof e=="string"||uj(e)}function uj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nv=[],Tv={allowDangerousHtml:!0},hj=/^(https?|ircs?|mailto|xmpp)$/i,fj=[{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 pj(e){const r=mj(e),i=gj(e);return xj(r.runSync(r.parse(i),i),e)}function mj(e){const r=e.rehypePlugins||Nv,i=e.remarkPlugins||Nv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Tv}:Tv;return oj().use(Kk).use(i).use($E,s).use(r)}function gj(e){const r=e.children||"",i=new xy;return typeof r=="string"&&(i.value=r),i}function xj(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,u=r.disallowedElements,f=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||vj;for(const g of fj)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+dj+g.id,void 0);return Ih(e,p),L2(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return f?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in Md)if(Object.hasOwn(Md,_)&&Object.hasOwn(g.properties,_)){const k=g.properties[_],C=Md[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(k||""),_,g))}}if(g.type==="element"){let _=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!_&&s&&typeof m=="number"&&(_=!s(g,m,y)),_&&y&&typeof m=="number")return l&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function vj(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||i!==-1&&r>i||s!==-1&&r>s||hj.test(e.slice(0,r))?e:""}function Av(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function bj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function yj(e,r,i){const c=Jl((i||{}).ignore||[]),u=_j(r);let f=-1;for(;++f<u.length;)gy(e,"text",l);function l(p,g){let m=-1,y;for(;++m<g.length;){const _=g[m],k=y?y.children:void 0;if(c(_,k?k.indexOf(_):void 0,y))return;y=_}if(y)return d(p,g)}function d(p,g){const m=g[g.length-1],y=u[f][0],_=u[f][1];let k=0;const v=m.children.indexOf(p);let b=!1,x=[];y.lastIndex=0;let S=y.exec(p.value);for(;S;){const j=S.index,A={index:S.index,input:S.input,stack:[...g,p]};let N=_(...S,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?y.lastIndex=j+1:(k!==j&&x.push({type:"text",value:p.value.slice(k,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),k=j+S[0].length,b=!0),!y.global)break;S=y.exec(p.value)}return b?(k<p.value.length&&x.push({type:"text",value:p.value.slice(k)}),m.children.splice(v,1,...x)):x=[p],v+x.length}}function _j(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const c=i[s];r.push([Sj(c[0]),wj(c[1])])}return r}function Sj(e){return typeof e=="string"?new RegExp(bj(e),"g"):e}function wj(e){return typeof e=="function"?e:function(){return e}}const Wd="phrasing",Gd=["autolink","link","image","label"];function Cj(){return{transforms:[Dj],enter:{literalAutolink:Ej,literalAutolinkEmail:Vd,literalAutolinkHttp:Vd,literalAutolinkWww:Vd},exit:{literalAutolink:Aj,literalAutolinkEmail:Tj,literalAutolinkHttp:jj,literalAutolinkWww:Nj}}}function kj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Wd,notInConstruct:Gd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Wd,notInConstruct:Gd},{character:":",before:"[ps]",after:"\\/",inConstruct:Wd,notInConstruct:Gd}]}}function Ej(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vd(e){this.config.enter.autolinkProtocol.call(this,e)}function jj(e){this.config.exit.autolinkProtocol.call(this,e)}function Nj(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function Tj(e){this.config.exit.autolinkEmail.call(this,e)}function Aj(e){this.exit(e)}function Dj(e){yj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Lj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Rj]],{ignore:["link","linkReference"]})}function Lj(e,r,i,s,c){let u="";if(!vy(c)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Mj(i)))return!1;const f=Oj(i+s);if(!f[0])return!1;const l={type:"link",title:null,url:u+r+f[0],children:[{type:"text",value:r+f[0]}]};return f[1]?[l,{type:"text",value:f[1]}]:l}function Rj(e,r,i,s){return!vy(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Mj(e){const r=e.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 Oj(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const c=Av(e,"(");let u=Av(e,")");for(;s!==-1&&c>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function vy(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ri(i)||Xl(i))&&(!r||i!==47)}by.peek=qj;function Bj(){this.buffer()}function Ij(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function zj(){this.buffer()}function Hj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Fj(e){this.exit(e)}function Uj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function $j(e){this.exit(e)}function qj(){return"["}function by(e,r,i,s){const c=i.createTracker(s);let u=c.move("[^");const f=i.enter("footnoteReference"),l=i.enter("reference");return u+=c.move(i.safe(i.associationId(e),{after:"]",before:u})),l(),f(),u+=c.move("]"),u}function Wj(){return{enter:{gfmFootnoteCallString:Bj,gfmFootnoteCall:Ij,gfmFootnoteDefinitionLabelString:zj,gfmFootnoteDefinition:Hj},exit:{gfmFootnoteCallString:Pj,gfmFootnoteCall:Fj,gfmFootnoteDefinitionLabelString:Uj,gfmFootnoteDefinition:$j}}}function Gj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:by},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,c,u,f){const l=u.createTracker(f);let d=l.move("[^");const p=u.enter("footnoteDefinition"),g=u.enter("label");return d+=l.move(u.safe(u.associationId(s),{before:d,after:"]"})),g(),d+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),d+=l.move((r?`
|
|
104
|
+
`},c),u}function $E(e,r){return e&&"run"in e?async function(i,s){const c=Sv(i,{file:s,...r});await e.run(c,s)}:function(i,s){return Sv(i,{file:s,...e||r})}}function wv(e){if(e)throw e}var Id,Cv;function qE(){if(Cv)return Id;Cv=1;var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=function(p){return typeof Array.isArray=="function"?Array.isArray(p):r.call(p)==="[object Array]"},u=function(p){if(!p||r.call(p)!=="[object Object]")return!1;var g=e.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!g&&!m)return!1;var y;for(y in p);return typeof y>"u"||e.call(p,y)},f=function(p,g){i&&g.name==="__proto__"?i(p,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):p[g.name]=g.newValue},l=function(p,g){if(g==="__proto__")if(e.call(p,g)){if(s)return s(p,g).value}else return;return p[g]};return Id=function d(){var p,g,m,y,_,k,C=arguments[0],v=1,b=arguments.length,x=!1;for(typeof C=="boolean"&&(x=C,C=arguments[1]||{},v=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});v<b;++v)if(p=arguments[v],p!=null)for(g in p)m=l(C,g),y=l(p,g),C!==y&&(x&&y&&(u(y)||(_=c(y)))?(_?(_=!1,k=m&&c(m)?m:[]):k=m&&u(m)?m:{},f(C,{name:g,newValue:d(x,k,y)})):typeof y<"u"&&f(C,{name:g,newValue:y}));return C},Id}var WE=qE();const zd=Pl(WE);function lh(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function GE(){const e=[],r={run:i,use:s};return r;function i(...c){let u=-1;const f=c.pop();if(typeof f!="function")throw new TypeError("Expected function as last argument, not "+f);l(null,...c);function l(d,...p){const g=e[++u];let m=-1;if(d){f(d);return}for(;++m<c.length;)(p[m]===null||p[m]===void 0)&&(p[m]=c[m]);c=p,g?VE(g,l)(...p):f(null,...p)}}function s(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return e.push(c),r}}function VE(e,r){let i;return s;function s(...f){const l=e.length>f.length;let d;l&&f.push(c);try{d=e.apply(this,f)}catch(p){const g=p;if(l&&i)throw g;return c(g)}l||(d&&d.then&&typeof d.then=="function"?d.then(u,c):d instanceof Error?c(d):u(d))}function c(f,...l){i||(i=!0,r(f,...l))}function u(f){c(null,f)}}const rr={basename:YE,dirname:KE,extname:XE,join:ZE,sep:"/"};function YE(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');ro(e);let i=0,s=-1,c=e.length,u;if(r===void 0||r.length===0||r.length>e.length){for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else s<0&&(u=!0,s=c+1);return s<0?"":e.slice(i,s)}if(r===e)return"";let f=-1,l=r.length-1;for(;c--;)if(e.codePointAt(c)===47){if(u){i=c+1;break}}else f<0&&(u=!0,f=c+1),l>-1&&(e.codePointAt(c)===r.codePointAt(l--)?l<0&&(s=c):(l=-1,s=f));return i===s?s=f:s<0&&(s=e.length),e.slice(i,s)}function KE(e){if(ro(e),e.length===0)return".";let r=-1,i=e.length,s;for(;--i;)if(e.codePointAt(i)===47){if(s){r=i;break}}else s||(s=!0);return r<0?e.codePointAt(0)===47?"/":".":r===1&&e.codePointAt(0)===47?"//":e.slice(0,r)}function XE(e){ro(e);let r=e.length,i=-1,s=0,c=-1,u=0,f;for(;r--;){const l=e.codePointAt(r);if(l===47){if(f){s=r+1;break}continue}i<0&&(f=!0,i=r+1),l===46?c<0?c=r:u!==1&&(u=1):c>-1&&(u=-1)}return c<0||i<0||u===0||u===1&&c===i-1&&c===s+1?"":e.slice(c,i)}function ZE(...e){let r=-1,i;for(;++r<e.length;)ro(e[r]),e[r]&&(i=i===void 0?e[r]:i+"/"+e[r]);return i===void 0?".":QE(i)}function QE(e){ro(e);const r=e.codePointAt(0)===47;let i=JE(e,!r);return i.length===0&&!r&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),r?"/"+i:i}function JE(e,r){let i="",s=0,c=-1,u=0,f=-1,l,d;for(;++f<=e.length;){if(f<e.length)l=e.codePointAt(f);else{if(l===47)break;l=47}if(l===47){if(!(c===f-1||u===1))if(c!==f-1&&u===2){if(i.length<2||s!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",s=0):(i=i.slice(0,d),s=i.length-1-i.lastIndexOf("/")),c=f,u=0;continue}}else if(i.length>0){i="",s=0,c=f,u=0;continue}}r&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(c+1,f):i=e.slice(c+1,f),s=f-c-1;c=f,u=0}else l===46&&u>-1?u++:u=-1}return i}function ro(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ej={cwd:tj};function tj(){return"/"}function ch(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function nj(e){if(typeof e=="string")e=new URL(e);else if(!ch(e)){const r=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw r.code="ERR_INVALID_ARG_TYPE",r}if(e.protocol!=="file:"){const r=new TypeError("The URL must be of scheme file");throw r.code="ERR_INVALID_URL_SCHEME",r}return rj(e)}function rj(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const r=e.pathname;let i=-1;for(;++i<r.length;)if(r.codePointAt(i)===37&&r.codePointAt(i+1)===50){const s=r.codePointAt(i+2);if(s===70||s===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(r)}const Hd=["history","path","basename","stem","extname","dirname"];class xy{constructor(r){let i;r?ch(r)?i={path:r}:typeof r=="string"||ij(r)?i={value:r}:i=r:i={},this.cwd="cwd"in i?"":ej.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Hd.length;){const u=Hd[s];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let c;for(c in i)Hd.includes(c)||(this[c]=i[c])}get basename(){return typeof this.path=="string"?rr.basename(this.path):void 0}set basename(r){Fd(r,"basename"),Pd(r,"basename"),this.path=rr.join(this.dirname||"",r)}get dirname(){return typeof this.path=="string"?rr.dirname(this.path):void 0}set dirname(r){kv(this.basename,"dirname"),this.path=rr.join(r||"",this.basename)}get extname(){return typeof this.path=="string"?rr.extname(this.path):void 0}set extname(r){if(Pd(r,"extname"),kv(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=rr.join(this.dirname,this.stem+(r||""))}get path(){return this.history[this.history.length-1]}set path(r){ch(r)&&(r=nj(r)),Fd(r,"path"),this.path!==r&&this.history.push(r)}get stem(){return typeof this.path=="string"?rr.basename(this.path,this.extname):void 0}set stem(r){Fd(r,"stem"),Pd(r,"stem"),this.path=rr.join(this.dirname||"",r+(this.extname||""))}fail(r,i,s){const c=this.message(r,i,s);throw c.fatal=!0,c}info(r,i,s){const c=this.message(r,i,s);return c.fatal=void 0,c}message(r,i,s){const c=new un(r,i,s);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(r){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(r||void 0).decode(this.value)}}function Pd(e,r){if(e&&e.includes(rr.sep))throw new Error("`"+r+"` cannot be a path: did not expect `"+rr.sep+"`")}function Fd(e,r){if(!e)throw new Error("`"+r+"` cannot be empty")}function kv(e,r){if(!e)throw new Error("Setting `"+r+"` requires `path` to be set too")}function ij(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sj=(function(e){const s=this.constructor.prototype,c=s[e],u=function(){return c.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),aj={}.hasOwnProperty;class zh extends sj{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=GE()}copy(){const r=new zh;let i=-1;for(;++i<this.attachers.length;){const s=this.attachers[i];r.use(...s)}return r.data(zd(!0,{},this.namespace)),r}data(r,i){return typeof r=="string"?arguments.length===2?(qd("data",this.frozen),this.namespace[r]=i,this):aj.call(this.namespace,r)&&this.namespace[r]||void 0:r?(qd("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[i,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const c=i.call(r,...s);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(r){this.freeze();const i=Cl(r),s=this.parser||this.Parser;return Ud("parse",s),s(String(i),i)}process(r,i){const s=this;return this.freeze(),Ud("process",this.parser||this.Parser),$d("process",this.compiler||this.Compiler),i?c(void 0,i):new Promise(c);function c(u,f){const l=Cl(r),d=s.parse(l);s.run(d,l,function(g,m,y){if(g||!m||!y)return p(g);const _=m,k=s.stringify(_,y);cj(k)?y.value=k:y.result=k,p(g,y)});function p(g,m){g||!m?f(g):u?u(m):i(void 0,m)}}}processSync(r){let i=!1,s;return this.freeze(),Ud("processSync",this.parser||this.Parser),$d("processSync",this.compiler||this.Compiler),this.process(r,c),jv("processSync","process",i),s;function c(u,f){i=!0,wv(u),s=f}}run(r,i,s){Ev(r),this.freeze();const c=this.transformers;return!s&&typeof i=="function"&&(s=i,i=void 0),s?u(void 0,s):new Promise(u);function u(f,l){const d=Cl(i);c.run(r,d,p);function p(g,m,y){const _=m||r;g?l(g):f?f(_):s(void 0,_,y)}}}runSync(r,i){let s=!1,c;return this.run(r,i,u),jv("runSync","run",s),c;function u(f,l){wv(f),c=l,s=!0}}stringify(r,i){this.freeze();const s=Cl(i),c=this.compiler||this.Compiler;return $d("stringify",c),Ev(r),c(r,s)}use(r,...i){const s=this.attachers,c=this.namespace;if(qd("use",this.frozen),r!=null)if(typeof r=="function")d(r,i);else if(typeof r=="object")Array.isArray(r)?l(r):f(r);else throw new TypeError("Expected usable value, not `"+r+"`");return this;function u(p){if(typeof p=="function")d(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[g,...m]=p;d(g,m)}else f(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function f(p){if(!("plugins"in p)&&!("settings"in p))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");l(p.plugins),p.settings&&(c.settings=zd(!0,c.settings,p.settings))}function l(p){let g=-1;if(p!=null)if(Array.isArray(p))for(;++g<p.length;){const m=p[g];u(m)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function d(p,g){let m=-1,y=-1;for(;++m<s.length;)if(s[m][0]===p){y=m;break}if(y===-1)s.push([p,...g]);else if(g.length>0){let[_,...k]=g;const C=s[y][1];lh(C)&&lh(_)&&(_=zd(!0,C,_)),s[y]=[p,_,...k]}}}}const oj=new zh().freeze();function Ud(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $d(e,r){if(typeof r!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qd(e,r){if(r)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ev(e){if(!lh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jv(e,r,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+r+"` instead")}function Cl(e){return lj(e)?e:new xy(e)}function lj(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cj(e){return typeof e=="string"||uj(e)}function uj(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dj="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nv=[],Tv={allowDangerousHtml:!0},hj=/^(https?|ircs?|mailto|xmpp)$/i,fj=[{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 pj(e){const r=mj(e),i=gj(e);return xj(r.runSync(r.parse(i),i),e)}function mj(e){const r=e.rehypePlugins||Nv,i=e.remarkPlugins||Nv,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Tv}:Tv;return oj().use(Kk).use(i).use($E,s).use(r)}function gj(e){const r=e.children||"",i=new xy;return typeof r=="string"&&(i.value=r),i}function xj(e,r){const i=r.allowedElements,s=r.allowElement,c=r.components,u=r.disallowedElements,f=r.skipHtml,l=r.unwrapDisallowed,d=r.urlTransform||vj;for(const g of fj)Object.hasOwn(r,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+dj+g.id,void 0);return Ih(e,p),L2(e,{Fragment:o.Fragment,components:c,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function p(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return f?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let _;for(_ in Md)if(Object.hasOwn(Md,_)&&Object.hasOwn(g.properties,_)){const k=g.properties[_],C=Md[_];(C===null||C.includes(g.tagName))&&(g.properties[_]=d(String(k||""),_,g))}}if(g.type==="element"){let _=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!_&&s&&typeof m=="number"&&(_=!s(g,m,y)),_&&y&&typeof m=="number")return l&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function vj(e){const r=e.indexOf(":"),i=e.indexOf("?"),s=e.indexOf("#"),c=e.indexOf("/");return r===-1||c!==-1&&r>c||i!==-1&&r>i||s!==-1&&r>s||hj.test(e.slice(0,r))?e:""}function Av(e,r){const i=String(e);if(typeof r!="string")throw new TypeError("Expected character");let s=0,c=i.indexOf(r);for(;c!==-1;)s++,c=i.indexOf(r,c+r.length);return s}function bj(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function yj(e,r,i){const c=Jl((i||{}).ignore||[]),u=_j(r);let f=-1;for(;++f<u.length;)gy(e,"text",l);function l(p,g){let m=-1,y;for(;++m<g.length;){const _=g[m],k=y?y.children:void 0;if(c(_,k?k.indexOf(_):void 0,y))return;y=_}if(y)return d(p,g)}function d(p,g){const m=g[g.length-1],y=u[f][0],_=u[f][1];let k=0;const v=m.children.indexOf(p);let b=!1,x=[];y.lastIndex=0;let S=y.exec(p.value);for(;S;){const j=S.index,A={index:S.index,input:S.input,stack:[...g,p]};let N=_(...S,A);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?y.lastIndex=j+1:(k!==j&&x.push({type:"text",value:p.value.slice(k,j)}),Array.isArray(N)?x.push(...N):N&&x.push(N),k=j+S[0].length,b=!0),!y.global)break;S=y.exec(p.value)}return b?(k<p.value.length&&x.push({type:"text",value:p.value.slice(k)}),m.children.splice(v,1,...x)):x=[p],v+x.length}}function _j(e){const r=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<i.length;){const c=i[s];r.push([Sj(c[0]),wj(c[1])])}return r}function Sj(e){return typeof e=="string"?new RegExp(bj(e),"g"):e}function wj(e){return typeof e=="function"?e:function(){return e}}const Wd="phrasing",Gd=["autolink","link","image","label"];function Cj(){return{transforms:[Dj],enter:{literalAutolink:Ej,literalAutolinkEmail:Vd,literalAutolinkHttp:Vd,literalAutolinkWww:Vd},exit:{literalAutolink:Aj,literalAutolinkEmail:Tj,literalAutolinkHttp:jj,literalAutolinkWww:Nj}}}function kj(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Wd,notInConstruct:Gd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Wd,notInConstruct:Gd},{character:":",before:"[ps]",after:"\\/",inConstruct:Wd,notInConstruct:Gd}]}}function Ej(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Vd(e){this.config.enter.autolinkProtocol.call(this,e)}function jj(e){this.config.exit.autolinkProtocol.call(this,e)}function Nj(e){this.config.exit.data.call(this,e);const r=this.stack[this.stack.length-1];r.type,r.url="http://"+this.sliceSerialize(e)}function Tj(e){this.config.exit.autolinkEmail.call(this,e)}function Aj(e){this.exit(e)}function Dj(e){yj(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Lj],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Rj]],{ignore:["link","linkReference"]})}function Lj(e,r,i,s,c){let u="";if(!vy(c)||(/^w/i.test(r)&&(i=r+i,r="",u="http://"),!Mj(i)))return!1;const f=Oj(i+s);if(!f[0])return!1;const l={type:"link",title:null,url:u+r+f[0],children:[{type:"text",value:r+f[0]}]};return f[1]?[l,{type:"text",value:f[1]}]:l}function Rj(e,r,i,s){return!vy(s,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+r+"@"+i,children:[{type:"text",value:r+"@"+i}]}}function Mj(e){const r=e.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 Oj(e){const r=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!r)return[e,void 0];e=e.slice(0,r.index);let i=r[0],s=i.indexOf(")");const c=Av(e,"(");let u=Av(e,")");for(;s!==-1&&c>u;)e+=i.slice(0,s+1),i=i.slice(s+1),s=i.indexOf(")"),u++;return[e,i]}function vy(e,r){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ri(i)||Xl(i))&&(!r||i!==47)}by.peek=qj;function Bj(){this.buffer()}function Ij(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function zj(){this.buffer()}function Hj(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function Fj(e){this.exit(e)}function Uj(e){const r=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Xn(this.sliceSerialize(e)).toLowerCase(),i.label=r}function $j(e){this.exit(e)}function qj(){return"["}function by(e,r,i,s){const c=i.createTracker(s);let u=c.move("[^");const f=i.enter("footnoteReference"),l=i.enter("reference");return u+=c.move(i.safe(i.associationId(e),{after:"]",before:u})),l(),f(),u+=c.move("]"),u}function Wj(){return{enter:{gfmFootnoteCallString:Bj,gfmFootnoteCall:Ij,gfmFootnoteDefinitionLabelString:zj,gfmFootnoteDefinition:Hj},exit:{gfmFootnoteCallString:Pj,gfmFootnoteCall:Fj,gfmFootnoteDefinitionLabelString:Uj,gfmFootnoteDefinition:$j}}}function Gj(e){let r=!1;return e&&e.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:i,footnoteReference:by},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(s,c,u,f){const l=u.createTracker(f);let d=l.move("[^");const p=u.enter("footnoteDefinition"),g=u.enter("label");return d+=l.move(u.safe(u.associationId(s),{before:d,after:"]"})),g(),d+=l.move("]:"),s.children&&s.children.length>0&&(l.shift(4),d+=l.move((r?`
|
|
104
105
|
`:" ")+u.indentLines(u.containerFlow(s,l.current()),r?yy:Vj))),p(),d}}function Vj(e,r,i){return r===0?e:yy(e,r,i)}function yy(e,r,i){return(i?"":" ")+e}const Yj=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_y.peek=Jj;function Kj(){return{canContainEols:["delete"],enter:{strikethrough:Zj},exit:{strikethrough:Qj}}}function Xj(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Yj}],handlers:{delete:_y}}}function Zj(e){this.enter({type:"delete",children:[]},e)}function Qj(e){this.exit(e)}function _y(e,r,i,s){const c=i.createTracker(s),u=i.enter("strikethrough");let f=c.move("~~");return f+=i.containerPhrasing(e,{...c.current(),before:f,after:"~"}),f+=c.move("~~"),u(),f}function Jj(){return"~"}function eN(e){return e.length}function tN(e,r){const i=r||{},s=(i.align||[]).concat(),c=i.stringLength||eN,u=[],f=[],l=[],d=[];let p=0,g=-1;for(;++g<e.length;){const C=[],v=[];let b=-1;for(e[g].length>p&&(p=e[g].length);++b<e[g].length;){const x=nN(e[g][b]);if(i.alignDelimiters!==!1){const S=c(x);v[b]=S,(d[b]===void 0||S>d[b])&&(d[b]=S)}C.push(x)}f[g]=C,l[g]=v}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<p;)u[m]=Dv(s[m]);else{const C=Dv(s);for(;++m<p;)u[m]=C}m=-1;const y=[],_=[];for(;++m<p;){const C=u[m];let v="",b="";C===99?(v=":",b=":"):C===108?v=":":C===114&&(b=":");let x=i.alignDelimiters===!1?1:Math.max(1,d[m]-v.length-b.length);const S=v+"-".repeat(x)+b;i.alignDelimiters!==!1&&(x=v.length+x+b.length,x>d[m]&&(d[m]=x),_[m]=x),y[m]=S}f.splice(1,0,y),l.splice(1,0,_),g=-1;const k=[];for(;++g<f.length;){const C=f[g],v=l[g];m=-1;const b=[];for(;++m<p;){const x=C[m]||"";let S="",j="";if(i.alignDelimiters!==!1){const A=d[m]-(v[m]||0),N=u[m];N===114?S=" ".repeat(A):N===99?A%2?(S=" ".repeat(A/2+.5),j=" ".repeat(A/2-.5)):(S=" ".repeat(A/2),j=S):j=" ".repeat(A)}i.delimiterStart!==!1&&!m&&b.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&x==="")&&(i.delimiterStart!==!1||m)&&b.push(" "),i.alignDelimiters!==!1&&b.push(S),b.push(x),i.alignDelimiters!==!1&&b.push(j),i.padding!==!1&&b.push(" "),(i.delimiterEnd!==!1||m!==p-1)&&b.push("|")}k.push(i.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return k.join(`
|
|
105
106
|
`)}function nN(e){return e==null?"":String(e)}function Dv(e){const r=typeof e=="string"?e.codePointAt(0):0;return r===67||r===99?99:r===76||r===108?108:r===82||r===114?114:0}function rN(e,r,i,s){const c=i.enter("blockquote"),u=i.createTracker(s);u.move("> "),u.shift(2);const f=i.indentLines(i.containerFlow(e,u.current()),iN);return c(),f}function iN(e,r,i){return">"+(i?"":" ")+e}function sN(e,r){return Lv(e,r.inConstruct,!0)&&!Lv(e,r.notInConstruct,!1)}function Lv(e,r,i){if(typeof r=="string"&&(r=[r]),!r||r.length===0)return i;let s=-1;for(;++s<r.length;)if(e.includes(r[s]))return!0;return!1}function Rv(e,r,i,s){let c=-1;for(;++c<i.unsafe.length;)if(i.unsafe[c].character===`
|
|
106
107
|
`&&sN(i.stack,i.unsafe[c]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
@@ -115,12 +116,12 @@ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b)
|
|
|
115
116
|
`))+1))}const f="#".repeat(c),l=i.enter("headingAtx"),d=i.enter("phrasing");u.move(f+" ");let p=i.containerPhrasing(e,{before:"# ",after:`
|
|
116
117
|
`,...u.current()});return/^[\t ]/.test(p)&&(p=Xa(p.charCodeAt(0))+p.slice(1)),p=p?f+" "+p:f,i.options.closeAtx&&(p+=" "+f),d(),l(),p}wy.peek=gN;function wy(e){return e.value||""}function gN(){return"<"}Cy.peek=xN;function Cy(e,r,i,s){const c=Hh(i),u=c==='"'?"Quote":"Apostrophe",f=i.enter("image");let l=i.enter("label");const d=i.createTracker(s);let p=d.move("![");return p+=d.move(i.safe(e.alt,{before:p,after:"]",...d.current()})),p+=d.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),p+=d.move("<"),p+=d.move(i.safe(e.url,{before:p,after:">",...d.current()})),p+=d.move(">")):(l=i.enter("destinationRaw"),p+=d.move(i.safe(e.url,{before:p,after:e.title?" ":")",...d.current()}))),l(),e.title&&(l=i.enter(`title${u}`),p+=d.move(" "+c),p+=d.move(i.safe(e.title,{before:p,after:c,...d.current()})),p+=d.move(c),l()),p+=d.move(")"),f(),p}function xN(){return"!"}ky.peek=vN;function ky(e,r,i,s){const c=e.referenceType,u=i.enter("imageReference");let f=i.enter("label");const l=i.createTracker(s);let d=l.move("![");const p=i.safe(e.alt,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return f(),i.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function vN(){return"!"}Ey.peek=bN;function Ey(e,r,i){let s=e.value||"",c="`",u=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(s);)c+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++u<i.unsafe.length;){const f=i.unsafe[u],l=i.compilePattern(f);let d;if(f.atBreak)for(;d=l.exec(s);){let p=d.index;s.charCodeAt(p)===10&&s.charCodeAt(p-1)===13&&p--,s=s.slice(0,p)+" "+s.slice(d.index+1)}}return c+s+c}function bN(){return"`"}function jy(e,r){const i=Dh(e);return!!(!r.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Ny.peek=yN;function Ny(e,r,i,s){const c=Hh(i),u=c==='"'?"Quote":"Apostrophe",f=i.createTracker(s);let l,d;if(jy(e,i)){const g=i.stack;i.stack=[],l=i.enter("autolink");let m=f.move("<");return m+=f.move(i.containerPhrasing(e,{before:m,after:">",...f.current()})),m+=f.move(">"),l(),i.stack=g,m}l=i.enter("link"),d=i.enter("label");let p=f.move("[");return p+=f.move(i.containerPhrasing(e,{before:p,after:"](",...f.current()})),p+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=i.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(i.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(d=i.enter("destinationRaw"),p+=f.move(i.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=i.enter(`title${u}`),p+=f.move(" "+c),p+=f.move(i.safe(e.title,{before:p,after:c,...f.current()})),p+=f.move(c),d()),p+=f.move(")"),l(),p}function yN(e,r,i){return jy(e,i)?"<":"["}Ty.peek=_N;function Ty(e,r,i,s){const c=e.referenceType,u=i.enter("linkReference");let f=i.enter("label");const l=i.createTracker(s);let d=l.move("[");const p=i.containerPhrasing(e,{before:d,after:"]",...l.current()});d+=l.move(p+"]["),f();const g=i.stack;i.stack=[],f=i.enter("reference");const m=i.safe(i.associationId(e),{before:d,after:"]",...l.current()});return f(),i.stack=g,u(),c==="full"||!p||p!==m?d+=l.move(m+"]"):c==="shortcut"?d=d.slice(0,-1):d+=l.move("]"),d}function _N(){return"["}function Ph(e){const r=e.options.bullet||"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bullet`, expected `*`, `+`, or `-`");return r}function SN(e){const r=Ph(e),i=e.options.bulletOther;if(!i)return r==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===r)throw new Error("Expected `bullet` (`"+r+"`) and `bulletOther` (`"+i+"`) to be different");return i}function wN(e){const r=e.options.bulletOrdered||".";if(r!=="."&&r!==")")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOrdered`, expected `.` or `)`");return r}function Ay(e){const r=e.options.rule||"*";if(r!=="*"&&r!=="-"&&r!=="_")throw new Error("Cannot serialize rules with `"+r+"` for `options.rule`, expected `*`, `-`, or `_`");return r}function CN(e,r,i,s){const c=i.enter("list"),u=i.bulletCurrent;let f=e.ordered?wN(i):Ph(i);const l=e.ordered?f==="."?")":".":SN(i);let d=r&&i.bulletLastUsed?f===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((f==="*"||f==="-")&&g&&(!g.children||!g.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(d=!0),Ay(i)===f&&g){let m=-1;for(;++m<e.children.length;){const y=e.children[m];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(f=l),i.bulletCurrent=f;const p=i.containerFlow(e,s);return i.bulletLastUsed=f,i.bulletCurrent=u,c(),p}function kN(e){const r=e.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 EN(e,r,i,s){const c=kN(i);let u=i.bulletCurrent||Ph(i);r&&r.type==="list"&&r.ordered&&(u=(typeof r.start=="number"&&r.start>-1?r.start:1)+(i.options.incrementListMarker===!1?0:r.children.indexOf(e))+u);let f=u.length+1;(c==="tab"||c==="mixed"&&(r&&r.type==="list"&&r.spread||e.spread))&&(f=Math.ceil(f/4)*4);const l=i.createTracker(s);l.move(u+" ".repeat(f-u.length)),l.shift(f);const d=i.enter("listItem"),p=i.indentLines(i.containerFlow(e,l.current()),g);return d(),p;function g(m,y,_){return y?(_?"":" ".repeat(f))+m:(_?u:u+" ".repeat(f-u.length))+m}}function jN(e,r,i,s){const c=i.enter("paragraph"),u=i.enter("phrasing"),f=i.containerPhrasing(e,s);return u(),c(),f}const NN=Jl(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function TN(e,r,i,s){return(e.children.some(function(f){return NN(f)})?i.containerPhrasing:i.containerFlow).call(i,e,s)}function AN(e){const r=e.options.strong||"*";if(r!=="*"&&r!=="_")throw new Error("Cannot serialize strong with `"+r+"` for `options.strong`, expected `*`, or `_`");return r}Dy.peek=DN;function Dy(e,r,i,s){const c=AN(i),u=i.enter("strong"),f=i.createTracker(s),l=f.move(c+c);let d=f.move(i.containerPhrasing(e,{after:c,before:l,...f.current()}));const p=d.charCodeAt(0),g=Il(s.before.charCodeAt(s.before.length-1),p,c);g.inside&&(d=Xa(p)+d.slice(1));const m=d.charCodeAt(d.length-1),y=Il(s.after.charCodeAt(0),m,c);y.inside&&(d=d.slice(0,-1)+Xa(m));const _=f.move(c+c);return u(),i.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},l+d+_}function DN(e,r,i){return i.options.strong||"*"}function LN(e,r,i,s){return i.safe(e.value,s)}function RN(e){const r=e.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 MN(e,r,i){const s=(Ay(i)+(i.options.ruleSpaces?" ":"")).repeat(RN(i));return i.options.ruleSpaces?s.slice(0,-1):s}const Ly={blockquote:rN,break:Rv,code:cN,definition:dN,emphasis:Sy,hardBreak:Rv,heading:mN,html:wy,image:Cy,imageReference:ky,inlineCode:Ey,link:Ny,linkReference:Ty,list:CN,listItem:EN,paragraph:jN,root:TN,strong:Dy,text:LN,thematicBreak:MN};function ON(){return{enter:{table:BN,tableData:Mv,tableHeader:Mv,tableRow:zN},exit:{codeText:HN,table:IN,tableData:Yd,tableHeader:Yd,tableRow:Yd}}}function BN(e){const r=e._align;this.enter({type:"table",align:r.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function IN(e){this.exit(e),this.data.inTable=void 0}function zN(e){this.enter({type:"tableRow",children:[]},e)}function Yd(e){this.exit(e)}function Mv(e){this.enter({type:"tableCell",children:[]},e)}function HN(e){let r=this.resume();this.data.inTable&&(r=r.replace(/\\([\\|])/g,PN));const i=this.stack[this.stack.length-1];i.type,i.value=r,this.exit(e)}function PN(e,r){return r==="|"?r:e}function FN(e){const r=e||{},i=r.tableCellPadding,s=r.tablePipeAlign,c=r.stringLength,u=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
117
118
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:f,tableCell:d,tableRow:l}};function f(_,k,C,v){return p(g(_,C,v),_.align)}function l(_,k,C,v){const b=m(_,C,v),x=p([b]);return x.slice(0,x.indexOf(`
|
|
118
|
-
`))}function d(_,k,C,v){const b=C.enter("tableCell"),x=C.enter("phrasing"),S=C.containerPhrasing(_,{...v,before:u,after:u});return x(),b(),S}function p(_,k){return tN(_,{align:k,alignDelimiters:s,padding:i,stringLength:c})}function g(_,k,C){const v=_.children;let b=-1;const x=[],S=k.enter("table");for(;++b<v.length;)x[b]=m(v[b],k,C);return S(),x}function m(_,k,C){const v=_.children;let b=-1;const x=[],S=k.enter("tableRow");for(;++b<v.length;)x[b]=d(v[b],_,k,C);return S(),x}function y(_,k,C){let v=Ly.inlineCode(_,k,C);return C.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function UN(){return{exit:{taskListCheckValueChecked:Ov,taskListCheckValueUnchecked:Ov,paragraph:qN}}}function $N(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:WN}}}function Ov(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function qN(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const c=r.children;let u=-1,f;for(;++u<c.length;){const l=c[u];if(l.type==="paragraph"){f=l;break}}f===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function WN(e,r,i,s){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);u&&l.move(f);let d=Ly.listItem(e,r,i,{...s,...l.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function GN(){return[Cj(),Wj(),Kj(),ON(),UN()]}function VN(e){return{extensions:[kj(),Gj(e),Xj(),FN(e),$N()]}}const YN={tokenize:e3,partial:!0},Ry={tokenize:t3,partial:!0},My={tokenize:n3,partial:!0},Oy={tokenize:r3,partial:!0},KN={tokenize:i3,partial:!0},By={name:"wwwAutolink",tokenize:QN,previous:zy},Iy={name:"protocolAutolink",tokenize:JN,previous:Hy},Tr={name:"emailAutolink",tokenize:ZN,previous:Py},or={};function XN(){return{text:or}}let Ei=48;for(;Ei<123;)or[Ei]=Tr,Ei++,Ei===58?Ei=65:Ei===91&&(Ei=97);or[43]=Tr;or[45]=Tr;or[46]=Tr;or[95]=Tr;or[72]=[Tr,Iy];or[104]=[Tr,Iy];or[87]=[Tr,By];or[119]=[Tr,By];function ZN(e,r,i){const s=this;let c,u;return f;function f(m){return!uh(m)||!Py.call(s,s.previous)||Fh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return uh(m)?(e.consume(m),l):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(KN,g,p)(m):m===45||m===95||on(m)?(u=!0,e.consume(m),d):g(m)}function p(m){return e.consume(m),c=!0,d}function g(m){return u&&c&&hn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function QN(e,r,i){const s=this;return c;function c(f){return f!==87&&f!==119||!zy.call(s,s.previous)||Fh(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(YN,e.attempt(Ry,e.attempt(My,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function JN(e,r,i){const s=this;let c="",u=!1;return f;function f(m){return(m===72||m===104)&&Hy.call(s,s.previous)&&!Fh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(m)}function l(m){if(hn(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const y=c.toLowerCase();if(y==="http"||y==="https")return e.consume(m),d}return i(m)}function d(m){return m===47?(e.consume(m),u?p:(u=!0,d)):i(m)}function p(m){return m===null||Ml(m)||bt(m)||Ri(m)||Xl(m)?i(m):e.attempt(Ry,e.attempt(My,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function e3(e,r,i){let s=0;return c;function c(f){return(f===87||f===119)&&s<3?(s++,e.consume(f),c):f===46&&s===3?(e.consume(f),u):i(f)}function u(f){return f===null?i(f):r(f)}}function t3(e,r,i){let s,c,u;return f;function f(p){return p===46||p===95?e.check(Oy,d,l)(p):p===null||bt(p)||Ri(p)||p!==45&&Xl(p)?d(p):(u=!0,e.consume(p),f)}function l(p){return p===95?s=!0:(c=s,s=void 0),e.consume(p),f}function d(p){return c||s||!u?i(p):r(p)}}function n3(e,r){let i=0,s=0;return c;function c(f){return f===40?(i++,e.consume(f),c):f===41&&s<i?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?e.check(Oy,r,u)(f):f===null||bt(f)||Ri(f)?r(f):(e.consume(f),c)}function u(f){return f===41&&s++,e.consume(f),c}}function r3(e,r,i){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||bt(l)||Ri(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||bt(l)||Ri(l)?r(l):s(l)}function u(l){return hn(l)?f(l):i(l)}function f(l){return l===59?(e.consume(l),s):hn(l)?(e.consume(l),f):i(l)}}function i3(e,r,i){return s;function s(u){return e.consume(u),c}function c(u){return on(u)?i(u):r(u)}}function zy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function Hy(e){return!hn(e)}function Py(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||on(e)}function Fh(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const s3={tokenize:f3,partial:!0};function a3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:u3,continuation:{tokenize:d3},exit:h3}},text:{91:{name:"gfmFootnoteCall",tokenize:c3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o3,resolveTo:l3}}}}function o3(e,r,i){const s=this;let c=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f;for(;c--;){const d=s.events[c][1];if(d.type==="labelImage"){f=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return l;function l(d){if(!f||!f._balanced)return i(d);const p=Xn(s.sliceSerialize({start:f.end,end:s.now()}));return p.codePointAt(0)!==94||!u.includes(p.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function l3(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},l=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",f,r],["exit",f,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...l),e}function c3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,f;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?i(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(u>999||m===93&&!f||m===null||m===91||bt(m))return i(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return c.includes(Xn(s.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return bt(m)||(f=!0),u++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,p):p(m)}}function u3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,l;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(k)}function g(k){if(f>999||k===93&&!l||k===null||k===91||bt(k))return i(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Xn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return bt(k)||(l=!0),f++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),f++,g):g(k)}function y(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),c.includes(u)||c.push(u),ot(e,_,"gfmFootnoteDefinitionWhitespace")):i(k)}function _(k){return r(k)}}function d3(e,r,i){return e.check(no,r,e.attempt(s3,r,i))}function h3(e){e.exit("gfmFootnoteDefinition")}function f3(e,r,i){const s=this;return ot(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(u):i(u)}}function p3(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(f,l){let d=-1;for(;++d<f.length;)if(f[d][0]==="enter"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._close){let p=d;for(;p--;)if(f[p][0]==="exit"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._open&&f[d][1].end.offset-f[d][1].start.offset===f[p][1].end.offset-f[p][1].start.offset){f[d][1].type="strikethroughSequence",f[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[p][1].start),end:Object.assign({},f[d][1].end)},m={type:"strikethroughText",start:Object.assign({},f[p][1].end),end:Object.assign({},f[d][1].start)},y=[["enter",g,l],["enter",f[p][1],l],["exit",f[p][1],l],["enter",m,l]],_=l.parser.constructs.insideSpan.null;_&&Rn(y,y.length,0,Zl(_,f.slice(p+1,d),l)),Rn(y,y.length,0,[["exit",m,l],["enter",f[d][1],l],["exit",f[d][1],l],["exit",g,l]]),Rn(f,p-1,d-p+3,y),d=p+y.length-2;break}}for(d=-1;++d<f.length;)f[d][1].type==="strikethroughSequenceTemporary"&&(f[d][1].type="data");return f}function u(f,l,d){const p=this.previous,g=this.events;let m=0;return y;function y(k){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(f.enter("strikethroughSequenceTemporary"),_(k))}function _(k){const C=Ms(p);if(k===126)return m>1?d(k):(f.consume(k),m++,_);if(m<2&&!i)return d(k);const v=f.exit("strikethroughSequenceTemporary"),b=Ms(k);return v._open=!b||b===2&&!!C,v._close=!C||C===2&&!!b,l(k)}}}class m3{constructor(){this.map=[]}add(r,i,s){g3(this,r,i,s)}consume(r){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let c=s.pop();for(;c;){for(const u of c)r.push(u);c=s.pop()}this.map.length=0}}function g3(e,r,i,s){let c=0;if(!(i===0&&s.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=i,e.map[c][2].push(...s);return}c+=1}e.map.push([r,i,s])}}function x3(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function v3(){return{flow:{null:{name:"table",tokenize:b3,resolveAll:y3}}}}function b3(e,r,i){const s=this;let c=0,u=0,f;return l;function l(H){let V=s.events.length-1;for(;V>-1;){const O=s.events[V][1].type;if(O==="lineEnding"||O==="linePrefix")V--;else break}const Y=V>-1?s.events[V][1].type:null,q=Y==="tableHead"||Y==="tableRow"?N:d;return q===N&&s.parser.lazy[s.now().line]?i(H):q(H)}function d(H){return e.enter("tableHead"),e.enter("tableRow"),p(H)}function p(H){return H===124||(f=!0,u+=1),g(H)}function g(H){return H===null?i(H):He(H)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),_):i(H):et(H)?ot(e,g,"whitespace")(H):(u+=1,f&&(f=!1,c+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),f=!0,g):(e.enter("data"),m(H)))}function m(H){return H===null||H===124||bt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?y:m)}function y(H){return H===92||H===124?(e.consume(H),m):m(H)}function _(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(H):(e.enter("tableDelimiterRow"),f=!1,et(H)?ot(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):k(H))}function k(H){return H===45||H===58?v(H):H===124?(f=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return et(H)?ot(e,v,"whitespace")(H):v(H)}function v(H){return H===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),b):H===45?(u+=1,b(H)):H===null||He(H)?j(H):A(H)}function b(H){return H===45?(e.enter("tableDelimiterFiller"),x(H)):A(H)}function x(H){return H===45?(e.consume(H),x):H===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(H))}function S(H){return et(H)?ot(e,j,"whitespace")(H):j(H)}function j(H){return H===124?k(H):H===null||He(H)?!f||c!==u?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(H)):A(H)}function A(H){return i(H)}function N(H){return e.enter("tableRow"),D(H)}function D(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),D):H===null||He(H)?(e.exit("tableRow"),r(H)):et(H)?ot(e,D,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||bt(H)?(e.exit("data"),D(H)):(e.consume(H),H===92?I:T)}function I(H){return H===92||H===124?(e.consume(H),T):T(H)}}function y3(e,r){let i=-1,s=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],l=!1,d=0,p,g,m;const y=new m3;for(;++i<e.length;){const _=e[i],k=_[1];_[0]==="enter"?k.type==="tableHead"?(l=!1,d!==0&&(Bv(y,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(i,0,[["enter",p,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[0,0,0,0],f=[0,i+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(i,0,[["enter",g,r]])),c=k.type==="tableDelimiterRow"?2:g?3:1):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=kl(y,r,u,c,void 0,m),u=[0,0,0,0]),f[2]=i)):k.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(f[0]=f[1],m=kl(y,r,u,c,void 0,m)),u=f,f=[u[1],i,0,0])):k.type==="tableHead"?(l=!0,d=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=kl(y,r,u,c,i,m)):f[1]!==0&&(m=kl(y,r,f,c,i,m)),c=0):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&Bv(y,r,d,p,g),y.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=x3(r.events,i))}return e}function kl(e,r,i,s,c,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(u.end=Object.assign({},Ts(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Ts(r.events,i[1]);if(u={type:f,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const p=Ts(r.events,i[2]),g=Ts(r.events,i[3]),m={type:l,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const y=r.events[i[2]],_=r.events[i[3]];if(y[1].end=Object.assign({},_[1].end),y[1].type="chunkText",y[1].contentType="text",i[3]>i[2]+1){const k=i[2]+1,C=i[3]-i[2]-1;e.add(k,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},Ts(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function Bv(e,r,i,s,c){const u=[],f=Ts(r.events,i);c&&(c.end=Object.assign({},f),u.push(["exit",c,r])),s.end=Object.assign({},f),u.push(["exit",s,r]),e.add(i+1,0,u)}function Ts(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const _3={name:"tasklistCheck",tokenize:w3};function S3(){return{text:{91:_3}}}function w3(e,r,i){const s=this;return c;function c(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return bt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),f):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),f):i(d)}function f(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):i(d)}function l(d){return He(d)?r(d):et(d)?e.check({tokenize:C3},r,i)(d):i(d)}}function C3(e,r,i){return ot(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function k3(e){return Zb([XN(),a3(),p3(e),v3(),S3()])}const E3={};function j3(e){const r=this,i=e||E3,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(k3(i)),u.push(GN()),f.push(VN(i))}function N3(e,r){if(e==null)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;i[s]=e[s]}return i}function T3(e,r){if(e==null)return{};var i,s,c=N3(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function dh(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,s=Array(r);i<r;i++)s[i]=e[i];return s}function A3(e){if(Array.isArray(e))return dh(e)}function D3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function L3(e,r){if(e){if(typeof e=="string")return dh(e,r);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?dh(e,r):void 0}}function R3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
119
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hh(e){return A3(e)||D3(e)||L3(e)||R3()}function Za(e){"@babel/helpers - typeof";return Za=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Za(e)}function M3(e,r){if(Za(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Za(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function O3(e){var r=M3(e,"string");return Za(r)=="symbol"?r:r+""}function Fy(e,r,i){return(r=O3(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},fh.apply(null,arguments)}function Iv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function As(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Iv(Object(i),!0).forEach(function(s){Fy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Iv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function B3(e){var r=e.length;if(r===0||r===1)return e;if(r===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(r===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(r>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var Kd={};function I3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Kd[r]||(Kd[r]=B3(e)),Kd[r]}function z3(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),c=I3(s);return c.reduce(function(u,f){return As(As({},u),i[f])},r)}function zv(e){return e.join(" ")}function H3(e,r){var i=0;return function(s){return i+=1,s.map(function(c,u){return Uy({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function Uy(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,u=e.useInlineStyles,f=e.key,l=r.properties,d=r.type,p=r.tagName,g=r.value;if(d==="text")return g;if(p){var m=H3(i,u),y;if(!u)y=As(As({},l),{},{className:zv(l.className)});else{var _=Object.keys(i).reduce(function(b,x){return x.split(".").forEach(function(S){b.includes(S)||b.push(S)}),b},[]),k=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&k.concat(l.className.filter(function(b){return!_.includes(b)}));y=As(As({},l),{},{className:zv(C)||void 0,style:z3(l.className,Object.assign({},l.style,c),i)})}var v=m(r.children);return
|
|
120
|
-
`))})}function W3(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,f=u===void 0?{}:u,l=e.startingLineNumber;return
|
|
119
|
+
`))}function d(_,k,C,v){const b=C.enter("tableCell"),x=C.enter("phrasing"),S=C.containerPhrasing(_,{...v,before:u,after:u});return x(),b(),S}function p(_,k){return tN(_,{align:k,alignDelimiters:s,padding:i,stringLength:c})}function g(_,k,C){const v=_.children;let b=-1;const x=[],S=k.enter("table");for(;++b<v.length;)x[b]=m(v[b],k,C);return S(),x}function m(_,k,C){const v=_.children;let b=-1;const x=[],S=k.enter("tableRow");for(;++b<v.length;)x[b]=d(v[b],_,k,C);return S(),x}function y(_,k,C){let v=Ly.inlineCode(_,k,C);return C.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function UN(){return{exit:{taskListCheckValueChecked:Ov,taskListCheckValueUnchecked:Ov,paragraph:qN}}}function $N(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:WN}}}function Ov(e){const r=this.stack[this.stack.length-2];r.type,r.checked=e.type==="taskListCheckValueChecked"}function qN(e){const r=this.stack[this.stack.length-2];if(r&&r.type==="listItem"&&typeof r.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const s=i.children[0];if(s&&s.type==="text"){const c=r.children;let u=-1,f;for(;++u<c.length;){const l=c[u];if(l.type==="paragraph"){f=l;break}}f===i&&(s.value=s.value.slice(1),s.value.length===0?i.children.shift():i.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,i.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function WN(e,r,i,s){const c=e.children[0],u=typeof e.checked=="boolean"&&c&&c.type==="paragraph",f="["+(e.checked?"x":" ")+"] ",l=i.createTracker(s);u&&l.move(f);let d=Ly.listItem(e,r,i,{...s,...l.current()});return u&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),d;function p(g){return g+f}}function GN(){return[Cj(),Wj(),Kj(),ON(),UN()]}function VN(e){return{extensions:[kj(),Gj(e),Xj(),FN(e),$N()]}}const YN={tokenize:e3,partial:!0},Ry={tokenize:t3,partial:!0},My={tokenize:n3,partial:!0},Oy={tokenize:r3,partial:!0},KN={tokenize:i3,partial:!0},By={name:"wwwAutolink",tokenize:QN,previous:zy},Iy={name:"protocolAutolink",tokenize:JN,previous:Hy},Tr={name:"emailAutolink",tokenize:ZN,previous:Py},or={};function XN(){return{text:or}}let Ei=48;for(;Ei<123;)or[Ei]=Tr,Ei++,Ei===58?Ei=65:Ei===91&&(Ei=97);or[43]=Tr;or[45]=Tr;or[46]=Tr;or[95]=Tr;or[72]=[Tr,Iy];or[104]=[Tr,Iy];or[87]=[Tr,By];or[119]=[Tr,By];function ZN(e,r,i){const s=this;let c,u;return f;function f(m){return!uh(m)||!Py.call(s,s.previous)||Fh(s.events)?i(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return uh(m)?(e.consume(m),l):m===64?(e.consume(m),d):i(m)}function d(m){return m===46?e.check(KN,g,p)(m):m===45||m===95||ln(m)?(u=!0,e.consume(m),d):g(m)}function p(m){return e.consume(m),c=!0,d}function g(m){return u&&c&&hn(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),r(m)):i(m)}}function QN(e,r,i){const s=this;return c;function c(f){return f!==87&&f!==119||!zy.call(s,s.previous)||Fh(s.events)?i(f):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(YN,e.attempt(Ry,e.attempt(My,u),i),i)(f))}function u(f){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),r(f)}}function JN(e,r,i){const s=this;let c="",u=!1;return f;function f(m){return(m===72||m===104)&&Hy.call(s,s.previous)&&!Fh(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),c+=String.fromCodePoint(m),e.consume(m),l):i(m)}function l(m){if(hn(m)&&c.length<5)return c+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const y=c.toLowerCase();if(y==="http"||y==="https")return e.consume(m),d}return i(m)}function d(m){return m===47?(e.consume(m),u?p:(u=!0,d)):i(m)}function p(m){return m===null||Ml(m)||bt(m)||Ri(m)||Xl(m)?i(m):e.attempt(Ry,e.attempt(My,g),i)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),r(m)}}function e3(e,r,i){let s=0;return c;function c(f){return(f===87||f===119)&&s<3?(s++,e.consume(f),c):f===46&&s===3?(e.consume(f),u):i(f)}function u(f){return f===null?i(f):r(f)}}function t3(e,r,i){let s,c,u;return f;function f(p){return p===46||p===95?e.check(Oy,d,l)(p):p===null||bt(p)||Ri(p)||p!==45&&Xl(p)?d(p):(u=!0,e.consume(p),f)}function l(p){return p===95?s=!0:(c=s,s=void 0),e.consume(p),f}function d(p){return c||s||!u?i(p):r(p)}}function n3(e,r){let i=0,s=0;return c;function c(f){return f===40?(i++,e.consume(f),c):f===41&&s<i?u(f):f===33||f===34||f===38||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===60||f===63||f===93||f===95||f===126?e.check(Oy,r,u)(f):f===null||bt(f)||Ri(f)?r(f):(e.consume(f),c)}function u(f){return f===41&&s++,e.consume(f),c}}function r3(e,r,i){return s;function s(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),s):l===38?(e.consume(l),u):l===93?(e.consume(l),c):l===60||l===null||bt(l)||Ri(l)?r(l):i(l)}function c(l){return l===null||l===40||l===91||bt(l)||Ri(l)?r(l):s(l)}function u(l){return hn(l)?f(l):i(l)}function f(l){return l===59?(e.consume(l),s):hn(l)?(e.consume(l),f):i(l)}}function i3(e,r,i){return s;function s(u){return e.consume(u),c}function c(u){return ln(u)?i(u):r(u)}}function zy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bt(e)}function Hy(e){return!hn(e)}function Py(e){return!(e===47||uh(e))}function uh(e){return e===43||e===45||e===46||e===95||ln(e)}function Fh(e){let r=e.length,i=!1;for(;r--;){const s=e[r][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){i=!0;break}if(s._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const s3={tokenize:f3,partial:!0};function a3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:u3,continuation:{tokenize:d3},exit:h3}},text:{91:{name:"gfmFootnoteCall",tokenize:c3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:o3,resolveTo:l3}}}}function o3(e,r,i){const s=this;let c=s.events.length;const u=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let f;for(;c--;){const d=s.events[c][1];if(d.type==="labelImage"){f=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return l;function l(d){if(!f||!f._balanced)return i(d);const p=Xn(s.sliceSerialize({start:f.end,end:s.now()}));return p.codePointAt(0)!==94||!u.includes(p.slice(1))?i(d):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),r(d))}}function l3(e,r){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},e[e.length-1][1].start)},f={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},l=[e[i+1],e[i+2],["enter",s,r],e[i+3],e[i+4],["enter",c,r],["exit",c,r],["enter",u,r],["enter",f,r],["exit",f,r],["exit",u,r],e[e.length-2],e[e.length-1],["exit",s,r]];return e.splice(i,e.length-i+1,...l),e}function c3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u=0,f;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?i(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(u>999||m===93&&!f||m===null||m===91||bt(m))return i(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return c.includes(Xn(s.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),r):i(m)}return bt(m)||(f=!0),u++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),u++,p):p(m)}}function u3(e,r,i){const s=this,c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let u,f=0,l;return d;function d(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):i(k)}function g(k){if(f>999||k===93&&!l||k===null||k===91||bt(k))return i(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Xn(s.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return bt(k)||(l=!0),f++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),f++,g):g(k)}function y(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),c.includes(u)||c.push(u),ot(e,_,"gfmFootnoteDefinitionWhitespace")):i(k)}function _(k){return r(k)}}function d3(e,r,i){return e.check(no,r,e.attempt(s3,r,i))}function h3(e){e.exit("gfmFootnoteDefinition")}function f3(e,r,i){const s=this;return ot(e,c,"gfmFootnoteDefinitionIndent",5);function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="gfmFootnoteDefinitionIndent"&&f[2].sliceSerialize(f[1],!0).length===4?r(u):i(u)}}function p3(e){let i=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:u,resolveAll:c};return i==null&&(i=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function c(f,l){let d=-1;for(;++d<f.length;)if(f[d][0]==="enter"&&f[d][1].type==="strikethroughSequenceTemporary"&&f[d][1]._close){let p=d;for(;p--;)if(f[p][0]==="exit"&&f[p][1].type==="strikethroughSequenceTemporary"&&f[p][1]._open&&f[d][1].end.offset-f[d][1].start.offset===f[p][1].end.offset-f[p][1].start.offset){f[d][1].type="strikethroughSequence",f[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},f[p][1].start),end:Object.assign({},f[d][1].end)},m={type:"strikethroughText",start:Object.assign({},f[p][1].end),end:Object.assign({},f[d][1].start)},y=[["enter",g,l],["enter",f[p][1],l],["exit",f[p][1],l],["enter",m,l]],_=l.parser.constructs.insideSpan.null;_&&Rn(y,y.length,0,Zl(_,f.slice(p+1,d),l)),Rn(y,y.length,0,[["exit",m,l],["enter",f[d][1],l],["exit",f[d][1],l],["exit",g,l]]),Rn(f,p-1,d-p+3,y),d=p+y.length-2;break}}for(d=-1;++d<f.length;)f[d][1].type==="strikethroughSequenceTemporary"&&(f[d][1].type="data");return f}function u(f,l,d){const p=this.previous,g=this.events;let m=0;return y;function y(k){return p===126&&g[g.length-1][1].type!=="characterEscape"?d(k):(f.enter("strikethroughSequenceTemporary"),_(k))}function _(k){const C=Ms(p);if(k===126)return m>1?d(k):(f.consume(k),m++,_);if(m<2&&!i)return d(k);const v=f.exit("strikethroughSequenceTemporary"),b=Ms(k);return v._open=!b||b===2&&!!C,v._close=!C||C===2&&!!b,l(k)}}}class m3{constructor(){this.map=[]}add(r,i,s){g3(this,r,i,s)}consume(r){if(this.map.sort(function(u,f){return u[0]-f[0]}),this.map.length===0)return;let i=this.map.length;const s=[];for(;i>0;)i-=1,s.push(r.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),r.length=this.map[i][0];s.push(r.slice()),r.length=0;let c=s.pop();for(;c;){for(const u of c)r.push(u);c=s.pop()}this.map.length=0}}function g3(e,r,i,s){let c=0;if(!(i===0&&s.length===0)){for(;c<e.map.length;){if(e.map[c][0]===r){e.map[c][1]+=i,e.map[c][2].push(...s);return}c+=1}e.map.push([r,i,s])}}function x3(e,r){let i=!1;const s=[];for(;r<e.length;){const c=e[r];if(i){if(c[0]==="enter")c[1].type==="tableContent"&&s.push(e[r+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(e[r-1][1].type==="tableDelimiterMarker"){const u=s.length-1;s[u]=s[u]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(i=!0);r+=1}return s}function v3(){return{flow:{null:{name:"table",tokenize:b3,resolveAll:y3}}}}function b3(e,r,i){const s=this;let c=0,u=0,f;return l;function l(H){let V=s.events.length-1;for(;V>-1;){const O=s.events[V][1].type;if(O==="lineEnding"||O==="linePrefix")V--;else break}const Y=V>-1?s.events[V][1].type:null,q=Y==="tableHead"||Y==="tableRow"?N:d;return q===N&&s.parser.lazy[s.now().line]?i(H):q(H)}function d(H){return e.enter("tableHead"),e.enter("tableRow"),p(H)}function p(H){return H===124||(f=!0,u+=1),g(H)}function g(H){return H===null?i(H):He(H)?u>1?(u=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),_):i(H):et(H)?ot(e,g,"whitespace")(H):(u+=1,f&&(f=!1,c+=1),H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),f=!0,g):(e.enter("data"),m(H)))}function m(H){return H===null||H===124||bt(H)?(e.exit("data"),g(H)):(e.consume(H),H===92?y:m)}function y(H){return H===92||H===124?(e.consume(H),m):m(H)}function _(H){return s.interrupt=!1,s.parser.lazy[s.now().line]?i(H):(e.enter("tableDelimiterRow"),f=!1,et(H)?ot(e,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):k(H))}function k(H){return H===45||H===58?v(H):H===124?(f=!0,e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),C):A(H)}function C(H){return et(H)?ot(e,v,"whitespace")(H):v(H)}function v(H){return H===58?(u+=1,f=!0,e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),b):H===45?(u+=1,b(H)):H===null||He(H)?j(H):A(H)}function b(H){return H===45?(e.enter("tableDelimiterFiller"),x(H)):A(H)}function x(H){return H===45?(e.consume(H),x):H===58?(f=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(H),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S(H))}function S(H){return et(H)?ot(e,j,"whitespace")(H):j(H)}function j(H){return H===124?k(H):H===null||He(H)?!f||c!==u?A(H):(e.exit("tableDelimiterRow"),e.exit("tableHead"),r(H)):A(H)}function A(H){return i(H)}function N(H){return e.enter("tableRow"),D(H)}function D(H){return H===124?(e.enter("tableCellDivider"),e.consume(H),e.exit("tableCellDivider"),D):H===null||He(H)?(e.exit("tableRow"),r(H)):et(H)?ot(e,D,"whitespace")(H):(e.enter("data"),T(H))}function T(H){return H===null||H===124||bt(H)?(e.exit("data"),D(H)):(e.consume(H),H===92?I:T)}function I(H){return H===92||H===124?(e.consume(H),T):T(H)}}function y3(e,r){let i=-1,s=!0,c=0,u=[0,0,0,0],f=[0,0,0,0],l=!1,d=0,p,g,m;const y=new m3;for(;++i<e.length;){const _=e[i],k=_[1];_[0]==="enter"?k.type==="tableHead"?(l=!1,d!==0&&(Bv(y,r,d,p,g),g=void 0,d=0),p={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(i,0,[["enter",p,r]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(s=!0,m=void 0,u=[0,0,0,0],f=[0,i+1,0,0],l&&(l=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(i,0,[["enter",g,r]])),c=k.type==="tableDelimiterRow"?2:g?3:1):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(s=!1,f[2]===0&&(u[1]!==0&&(f[0]=f[1],m=kl(y,r,u,c,void 0,m),u=[0,0,0,0]),f[2]=i)):k.type==="tableCellDivider"&&(s?s=!1:(u[1]!==0&&(f[0]=f[1],m=kl(y,r,u,c,void 0,m)),u=f,f=[u[1],i,0,0])):k.type==="tableHead"?(l=!0,d=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(d=i,u[1]!==0?(f[0]=f[1],m=kl(y,r,u,c,i,m)):f[1]!==0&&(m=kl(y,r,f,c,i,m)),c=0):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(f[3]=i)}for(d!==0&&Bv(y,r,d,p,g),y.consume(r.events),i=-1;++i<r.events.length;){const _=r.events[i];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=x3(r.events,i))}return e}function kl(e,r,i,s,c,u){const f=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",l="tableContent";i[0]!==0&&(u.end=Object.assign({},Ts(r.events,i[0])),e.add(i[0],0,[["exit",u,r]]));const d=Ts(r.events,i[1]);if(u={type:f,start:Object.assign({},d),end:Object.assign({},d)},e.add(i[1],0,[["enter",u,r]]),i[2]!==0){const p=Ts(r.events,i[2]),g=Ts(r.events,i[3]),m={type:l,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",m,r]]),s!==2){const y=r.events[i[2]],_=r.events[i[3]];if(y[1].end=Object.assign({},_[1].end),y[1].type="chunkText",y[1].contentType="text",i[3]>i[2]+1){const k=i[2]+1,C=i[3]-i[2]-1;e.add(k,C,[])}}e.add(i[3]+1,0,[["exit",m,r]])}return c!==void 0&&(u.end=Object.assign({},Ts(r.events,c)),e.add(c,0,[["exit",u,r]]),u=void 0),u}function Bv(e,r,i,s,c){const u=[],f=Ts(r.events,i);c&&(c.end=Object.assign({},f),u.push(["exit",c,r])),s.end=Object.assign({},f),u.push(["exit",s,r]),e.add(i+1,0,u)}function Ts(e,r){const i=e[r],s=i[0]==="enter"?"start":"end";return i[1][s]}const _3={name:"tasklistCheck",tokenize:w3};function S3(){return{text:{91:_3}}}function w3(e,r,i){const s=this;return c;function c(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?i(d):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),u)}function u(d){return bt(d)?(e.enter("taskListCheckValueUnchecked"),e.consume(d),e.exit("taskListCheckValueUnchecked"),f):d===88||d===120?(e.enter("taskListCheckValueChecked"),e.consume(d),e.exit("taskListCheckValueChecked"),f):i(d)}function f(d){return d===93?(e.enter("taskListCheckMarker"),e.consume(d),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):i(d)}function l(d){return He(d)?r(d):et(d)?e.check({tokenize:C3},r,i)(d):i(d)}}function C3(e,r,i){return ot(e,s,"whitespace");function s(c){return c===null?i(c):r(c)}}function k3(e){return Zb([XN(),a3(),p3(e),v3(),S3()])}const E3={};function j3(e){const r=this,i=e||E3,s=r.data(),c=s.micromarkExtensions||(s.micromarkExtensions=[]),u=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),f=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);c.push(k3(i)),u.push(GN()),f.push(VN(i))}function N3(e,r){if(e==null)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(r.indexOf(s)!==-1)continue;i[s]=e[s]}return i}function T3(e,r){if(e==null)return{};var i,s,c=N3(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s<u.length;s++)i=u[s],r.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(c[i]=e[i])}return c}function dh(e,r){(r==null||r>e.length)&&(r=e.length);for(var i=0,s=Array(r);i<r;i++)s[i]=e[i];return s}function A3(e){if(Array.isArray(e))return dh(e)}function D3(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function L3(e,r){if(e){if(typeof e=="string")return dh(e,r);var i={}.toString.call(e).slice(8,-1);return i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set"?Array.from(e):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?dh(e,r):void 0}}function R3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
120
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hh(e){return A3(e)||D3(e)||L3(e)||R3()}function Za(e){"@babel/helpers - typeof";return Za=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Za(e)}function M3(e,r){if(Za(e)!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var s=i.call(e,r);if(Za(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function O3(e){var r=M3(e,"string");return Za(r)=="symbol"?r:r+""}function Fy(e,r,i){return(r=O3(r))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var i=arguments[r];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},fh.apply(null,arguments)}function Iv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function As(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Iv(Object(i),!0).forEach(function(s){Fy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Iv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function B3(e){var r=e.length;if(r===0||r===1)return e;if(r===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(r===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(r>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var Kd={};function I3(e){if(e.length===0||e.length===1)return e;var r=e.join(".");return Kd[r]||(Kd[r]=B3(e)),Kd[r]}function z3(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,s=e.filter(function(u){return u!=="token"}),c=I3(s);return c.reduce(function(u,f){return As(As({},u),i[f])},r)}function zv(e){return e.join(" ")}function H3(e,r){var i=0;return function(s){return i+=1,s.map(function(c,u){return Uy({node:c,stylesheet:e,useInlineStyles:r,key:"code-segment-".concat(i,"-").concat(u)})})}}function Uy(e){var r=e.node,i=e.stylesheet,s=e.style,c=s===void 0?{}:s,u=e.useInlineStyles,f=e.key,l=r.properties,d=r.type,p=r.tagName,g=r.value;if(d==="text")return g;if(p){var m=H3(i,u),y;if(!u)y=As(As({},l),{},{className:zv(l.className)});else{var _=Object.keys(i).reduce(function(b,x){return x.split(".").forEach(function(S){b.includes(S)||b.push(S)}),b},[]),k=l.className&&l.className.includes("token")?["token"]:[],C=l.className&&k.concat(l.className.filter(function(b){return!_.includes(b)}));y=As(As({},l),{},{className:zv(C)||void 0,style:z3(l.className,Object.assign({},l.style,c),i)})}var v=m(r.children);return on.createElement(p,fh({key:f},y),v)}}const P3=(function(e,r){var i=e.listLanguages();return i.indexOf(r)!==-1});var F3=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function Hv(e,r){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);r&&(s=s.filter(function(c){return Object.getOwnPropertyDescriptor(e,c).enumerable})),i.push.apply(i,s)}return i}function ii(e){for(var r=1;r<arguments.length;r++){var i=arguments[r]!=null?arguments[r]:{};r%2?Hv(Object(i),!0).forEach(function(s){Fy(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Hv(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var U3=/\n/g;function $3(e){return e.match(U3)}function q3(e){var r=e.lines,i=e.startingLineNumber,s=e.style;return r.map(function(c,u){var f=u+i;return on.createElement("span",{key:"line-".concat(u),className:"react-syntax-highlighter-line-number",style:typeof s=="function"?s(f):s},"".concat(f,`
|
|
121
|
+
`))})}function W3(e){var r=e.codeString,i=e.codeStyle,s=e.containerStyle,c=s===void 0?{float:"left",paddingRight:"10px"}:s,u=e.numberStyle,f=u===void 0?{}:u,l=e.startingLineNumber;return on.createElement("code",{style:Object.assign({},i,c)},q3({lines:r.replace(/\n$/,"").split(`
|
|
121
122
|
`),style:f,startingLineNumber:l}))}function G3(e){return"".concat(e.toString().length,".25em")}function $y(e,r){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:r},children:[{type:"text",value:e}]}}function qy(e,r,i){var s={display:"inline-block",minWidth:G3(i),paddingRight:"1em",textAlign:"right",userSelect:"none"},c=typeof e=="function"?e(r):e,u=ii(ii({},s),c);return u}function Tl(e){var r=e.children,i=e.lineNumber,s=e.lineNumberStyle,c=e.largestLineNumber,u=e.showInlineLineNumbers,f=e.lineProps,l=f===void 0?{}:f,d=e.className,p=d===void 0?[]:d,g=e.showLineNumbers,m=e.wrapLongLines,y=e.wrapLines,_=y===void 0?!1:y,k=_?ii({},typeof l=="function"?l(i):l):{};if(k.className=k.className?[].concat(hh(k.className.trim().split(/\s+/)),hh(p)):p,i&&u){var C=qy(s,i,c);r.unshift($y(i,C))}return m&g&&(k.style=ii({display:"flex"},k.style)),{type:"element",tagName:"span",properties:k,children:r}}function Wy(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var s=0;s<e.length;s++){var c=e[s];if(c.type==="text")i.push(Tl({children:[c],className:hh(new Set(r))}));else if(c.children){var u,f=r.concat(((u=c.properties)===null||u===void 0?void 0:u.className)||[]);Wy(c.children,f).forEach(function(l){return i.push(l)})}}return i}function V3(e,r,i,s,c,u,f,l,d){var p,g=Wy(e.value),m=[],y=-1,_=0;function k(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return Tl({children:A,lineNumber:N,lineNumberStyle:l,largestLineNumber:f,showInlineLineNumbers:c,lineProps:i,className:D,showLineNumbers:s,wrapLongLines:d,wrapLines:r})}function C(A,N){if(s&&N&&c){var D=qy(l,N,f);A.unshift($y(N,D))}return A}function v(A,N){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return r||D.length>0?k(A,N,D):C(A,N)}for(var b=function(){var N=g[_],D=N.children[0].value,T=$3(D);if(T){var I=D.split(`
|
|
122
123
|
`);I.forEach(function(H,V){var Y=s&&m.length+u,q={type:"text",value:"".concat(H,`
|
|
123
|
-
`)};if(V===0){var O=g.slice(y+1,_).concat(Tl({children:[q],className:N.properties.className})),U=v(O,Y);m.push(U)}else if(V===I.length-1){var z=g[_+1]&&g[_+1].children&&g[_+1].children[0],X={type:"text",value:"".concat(H)};if(z){var Q=Tl({children:[X],className:N.properties.className});g.splice(_+1,0,Q)}else{var M=[X],L=v(M,Y,N.properties.className);m.push(L)}}else{var B=[q],W=v(B,Y,N.properties.className);m.push(W)}}),y=_}_++};_<g.length;)b();if(y!==g.length-1){var x=g.slice(y+1,g.length);if(x&&x.length){var S=s&&m.length+u,j=v(x,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function Y3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,u){return Uy({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function Gy(e){return e&&typeof e.highlightAuto<"u"}function K3(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(Gy(r)){var u=P3(r,i);return i==="text"?{value:c,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function X3(e,r){return function(s){var c,u,f=s.language,l=s.children,d=s.style,p=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,y=s.codeTagProps,_=y===void 0?{className:f?"language-".concat(f):void 0,style:ii(ii({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:y,k=s.useInlineStyles,C=k===void 0?!0:k,v=s.showLineNumbers,b=v===void 0?!1:v,x=s.showInlineLineNumbers,S=x===void 0?!0:x,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,D=s.lineNumberStyle,T=D===void 0?{}:D,I=s.wrapLines,H=s.wrapLongLines,V=H===void 0?!1:H,Y=s.lineProps,q=Y===void 0?{}:Y,O=s.renderer,U=s.PreTag,z=U===void 0?"pre":U,X=s.CodeTag,Q=X===void 0?"code":X,M=s.code,L=M===void 0?(Array.isArray(l)?l[0]:l)||"":M,B=s.astGenerator,W=T3(s,F3);B=B||e;var F=b?dn.createElement(W3,{containerStyle:N,codeStyle:_.style||{},numberStyle:T,startingLineNumber:A,codeString:L}):null,re=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Z=Gy(B)?"hljs":"prismjs",ee=C?Object.assign({},W,{style:Object.assign({},re,m)}):Object.assign({},W,{className:W.className?"".concat(Z," ").concat(W.className):Z,style:Object.assign({},m)});if(V?_.style=ii({whiteSpace:"pre-wrap"},_.style):_.style=ii({whiteSpace:"pre"},_.style),!B)return dn.createElement(z,ee,F,dn.createElement(Q,_,L));(I===void 0&&O||V)&&(I=!0),O=O||Y3;var K=[{type:"text",value:L}],$=K3({astGenerator:B,language:f,code:L,defaultCodeValue:K});$.language===null&&($.value=K);var ae=(c=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,ne=A+ae,ve=V3($,I,q,b,S,A,ne,T,V);return dn.createElement(z,ee,dn.createElement(Q,_,!S&&F,O({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Pv=/[#.]/g;function Z3(e,r){const i=e||"",s={};let c=0,u,f;for(;c<i.length;){Pv.lastIndex=c;const l=Pv.exec(i),d=i.slice(c,l?l.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:f=d,c+=d.length),l&&(u=l[0],c++)}return{type:"element",tagName:f||r||"div",properties:s,children:[]}}function Vy(e,r,i){const s=i?t5(i):void 0;function c(u,f,...l){let d;if(u==null){d={type:"root",children:[]};const p=f;l.unshift(p)}else{d=Z3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,Q3(f))l.unshift(f);else for(const[m,y]of Object.entries(f))J3(e,d.properties,m,y)}for(const p of l)ph(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return c}function Q3(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const c=r[s];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const u=c;for(const f of u)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function J3(e,r,i,s){const c=Ub(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?c.spaceSeparated?u=Zx(s):c.commaSeparated?u=Gx(s):c.commaOrSpaceSeparated?u=Zx(Gx(s).join(" ")):u=Fv(c,c.property,s):Array.isArray(s)?u=[...s]:u=c.property==="style"?e5(s):String(s);if(Array.isArray(u)){const f=[];for(const l of u)f.push(Fv(c,c.property,l));u=f}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function ph(e,r){if(r!=null)if(typeof r=="number"||typeof r=="string")e.push({type:"text",value:String(r)});else if(Array.isArray(r))for(const i of r)ph(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?ph(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Fv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Va(i)===Va(r)))return!0}return i}function e5(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function t5(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const n5=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],r5=Vy($b,"div");Vy(Kl,"g",n5);const i5=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Uv={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function Yy(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function s5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function a5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function $v(e){return a5(e)||Yy(e)}const o5=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function l5(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let u=0,f=-1,l="",d,p;i.position&&("start"in i.position||"indent"in i.position?(p=i.position.indent,d=i.position.start):d=i.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,y=k(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const b=e.charCodeAt(u+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||s&&b===s){l+=String.fromCharCode(_),m++;continue}const x=u+1;let S=x,j=x,A;if(b===35){j=++S;const q=e.charCodeAt(j);q===88||q===120?(A="hexadecimal",j=++S):A="decimal"}else A="named";let N="",D="",T="";const I=A==="named"?$v:A==="decimal"?Yy:s5;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!I(q))break;T+=String.fromCharCode(q),A==="named"&&i5.includes(T)&&(N=T,D=Ka(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?Ka(T):!1;q&&(N=T,D=q)}let V=1+j-x,Y="";if(!(!H&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,V);else if(A==="named"){if(H&&!D)C(5,1);else if(N!==T&&(j=S+N.length,V=1+j-S,H=!1),!H){const q=N?1:3;if(i.attribute){const O=e.charCodeAt(j);O===61?(C(q,V),D=""):$v(O)?D="":C(q,V)}else C(q,V)}Y=D}else{H||C(2,V);let q=Number.parseInt(T,A==="hexadecimal"?16:10);if(c5(q))C(7,V),Y="�";else if(q in Uv)C(6,V),Y=Uv[q];else{let O="";u5(q)&&C(6,V),q>65535&&(q-=65536,O+=String.fromCharCode(q>>>10|55296),q=56320|q&1023),Y=O+String.fromCharCode(q)}}if(Y){v(),y=k(),u=j-1,m+=j-x+1,c.push(Y);const q=k();q.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:y,end:q},e.slice(x-1,j)),y=q}else T=e.slice(x-1,j),l+=T,m+=T.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?v():(l+=String.fromCharCode(_),m++);return c.join("");function k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(b,x){let S;i.warning&&(S=k(),S.column+=x,S.offset+=x,i.warning.call(i.warningContext||void 0,o5[b],S,b))}function v(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:y,end:k()}),l="")}}function c5(e){return e>=55296&&e<=57343||e>1114111}function u5(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var d5=0,El={},Xt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++d5}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(Xt.util.type(r)){case"Object":if(c=Xt.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return c=Xt.util.objId(r),i[c]?i[c]:(s=[],i[c]=s,r.forEach(function(f,l){s[l]=e(f,i)}),s);default:return r}}},languages:{plain:El,plaintext:El,text:El,txt:El,extend:function(e,r){var i=Xt.util.clone(Xt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Xt.languages;var c=s[e],u={};for(var f in c)if(c.hasOwnProperty(f)){if(f==r)for(var l in i)i.hasOwnProperty(l)&&(u[l]=i[l]);i.hasOwnProperty(f)||(u[f]=c[f])}var d=s[e];return s[e]=u,Xt.languages.DFS(Xt.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,c){c=c||{};var u=Xt.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var l=r[f],d=Xt.util.type(l);d==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,i,null,c)):d==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,i,f,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Xt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Xt.tokenize(s.code,s.grammar),Xt.hooks.run("after-tokenize",s),qa.stringify(Xt.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var c=new h5;return Al(c,c.head,e),Ky(e,c,r,c.head,0),p5(c)},hooks:{all:{},add:function(e,r){var i=Xt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Xt.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:qa};function qa(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function qv(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function Ky(e,r,i,s,c,u){for(var f in i)if(!(!i.hasOwnProperty(f)||!i[f])){var l=i[f];l=Array.isArray(l)?l:[l];for(var d=0;d<l.length;++d){if(u&&u.cause==f+","+d)return;var p=l[d],g=p.inside,m=!!p.lookbehind,y=!!p.greedy,_=p.alias;if(y&&!p.pattern.global){var k=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,k+"g")}for(var C=p.pattern||p,v=s.next,b=c;v!==r.tail&&!(u&&b>=u.reach);b+=v.value.length,v=v.next){var x=v.value;if(r.length>e.length)return;if(!(x instanceof qa)){var S=1,j;if(y){if(j=qv(C,b,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=b;for(N+=v.value.length;T>=N;)v=v.next,N+=v.value.length;if(N-=v.value.length,b=N,v.value instanceof qa)continue;for(var D=v;D!==r.tail&&(N<A||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,x=e.slice(b,N),j.index-=b}else if(j=qv(C,0,x,m),!j)continue;var T=j.index,I=j[0],H=x.slice(0,T),V=x.slice(T+I.length),Y=b+x.length;u&&Y>u.reach&&(u.reach=Y);var q=v.prev;H&&(q=Al(r,q,H),b+=H.length),f5(r,q,S);var O=new qa(f,g?Xt.tokenize(I,g):I,_,I);if(v=Al(r,q,O),V&&Al(r,v,V),S>1){var U={cause:f+","+d,reach:Y};Ky(e,r,i,v.prev,b,U),u&&U.reach>u.reach&&(u.reach=U.reach)}}}}}}function h5(){var e={value:null,prev:null,next:null},r={value:null,prev:e,next:null};e.next=r,this.head=e,this.tail=r,this.length=0}function Al(e,r,i){var s=r.next,c={value:i,prev:r,next:s};return r.next=c,s.prev=c,e.length++,c}function f5(e,r,i){for(var s=r.next,c=0;c<i&&s!==e.tail;c++)s=s.next;r.next=s,s.prev=r,e.length-=c}function p5(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const Xy=Xt;function Zy(){}Zy.prototype=Xy;const Vt=new Zy;Vt.highlight=m5;Vt.register=g5;Vt.alias=x5;Vt.registered=v5;Vt.listLanguages=b5;Vt.util.encode=y5;Vt.Token.stringify=mh;function m5(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let i,s;if(r&&typeof r=="object")i=r;else{if(s=r,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn(Vt.languages,s))i=Vt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:Xy.highlight.call(Vt,e,i,s)}}function g5(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Vt.languages,e.displayName)||e(Vt)}function x5(e,r){const i=Vt.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let c;for(c in s)if(Object.hasOwn(s,c)){const u=s[c],f=typeof u=="string"?[u]:u;let l=-1;for(;++l<f.length;)i[f[l]]=i[c]}}function v5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Vt.languages,e)}function b5(){const e=Vt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function mh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&s.push(mh(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:mh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Vt.hooks.run("wrap",i),r5(i.tag+"."+i.classes.join("."),_5(i.attributes),i.content)}function y5(e){return e}function _5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=l5(e[r]));return e}var pt=X3(Vt,{});pt.registerLanguage=function(e,r){return Vt.register(r)};pt.alias=function(e,r){return Vt.alias(e,r)};Bi.displayName="markup";Bi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Bi(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var f={};f[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",f)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,i){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:e.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}tc.displayName="css";tc.aliases=[];function tc(e){(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Ii.displayName="clike";Ii.aliases=[];function Ii(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}io.displayName="javascript";io.aliases=["js"];function io(e){e.register(Ii),e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Uh.displayName="sql";Uh.aliases=[];function Uh(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}nc.displayName="c";nc.aliases=[];function nc(e){e.register(Ii),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}$h.displayName="cpp";$h.aliases=[];function $h(e){e.register(nc),(function(r){var i=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return i.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:i,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return s})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(e)}qh.displayName="bash";qh.aliases=["sh","shell"];function qh(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],f=c.variable[1].inside,l=0;l<u.length;l++)f[u[l]]=r.languages.bash[u[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Wh.displayName="yaml";Wh.aliases=["yml"];function Wh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),f=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return c})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+f+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(f),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}Gh.displayName="markdown";Gh.aliases=["md"];function Gh(e){e.register(Bi),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),f=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;r.languages.markdown=r.languages.extend("markup",{}),r.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:r.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+u+f+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+f+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+f+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(d){l!==d&&(r.languages.markdown[l].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function d(p){if(!(!p||typeof p=="string"))for(var g=0,m=p.length;g<m;g++){var y=p[g];if(y.type!=="code"){d(y.content);continue}var _=y.content[1],k=y.content[3];if(_&&k&&_.type==="code-language"&&k.type==="code-block"&&typeof _.content=="string"){var C=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var v="language-"+C;k.alias?typeof k.alias=="string"?k.alias=[k.alias,v]:k.alias.push(v):k.alias=[v]}}}d(l.tokens)}),r.hooks.add("wrap",function(l){if(l.type==="code-block"){for(var d="",p=0,g=l.classes.length;p<g;p++){var m=l.classes[p],y=/language-(.+)/.exec(m);if(y){d=y[1];break}}var _=r.languages[d];if(_)l.content=r.highlight(l.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=k,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(k);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[d],d))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}Vh.displayName="ruby";Vh.aliases=["rb"];function Vh(e){e.register(Ii),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var i={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",c=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+c),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+c+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}Yh.displayName="diff";Yh.aliases=[];function Yh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+c+`].*(?:\r
|
|
124
|
+
`)};if(V===0){var O=g.slice(y+1,_).concat(Tl({children:[q],className:N.properties.className})),U=v(O,Y);m.push(U)}else if(V===I.length-1){var z=g[_+1]&&g[_+1].children&&g[_+1].children[0],X={type:"text",value:"".concat(H)};if(z){var Q=Tl({children:[X],className:N.properties.className});g.splice(_+1,0,Q)}else{var M=[X],L=v(M,Y,N.properties.className);m.push(L)}}else{var B=[q],W=v(B,Y,N.properties.className);m.push(W)}}),y=_}_++};_<g.length;)b();if(y!==g.length-1){var x=g.slice(y+1,g.length);if(x&&x.length){var S=s&&m.length+u,j=v(x,S);m.push(j)}}return r?m:(p=[]).concat.apply(p,m)}function Y3(e){var r=e.rows,i=e.stylesheet,s=e.useInlineStyles;return r.map(function(c,u){return Uy({node:c,stylesheet:i,useInlineStyles:s,key:"code-segment-".concat(u)})})}function Gy(e){return e&&typeof e.highlightAuto<"u"}function K3(e){var r=e.astGenerator,i=e.language,s=e.code,c=e.defaultCodeValue;if(Gy(r)){var u=P3(r,i);return i==="text"?{value:c,language:"text"}:u?r.highlight(i,s):r.highlightAuto(s)}try{return i&&i!=="text"?{value:r.highlight(s,i)}:{value:c}}catch{return{value:c}}}function X3(e,r){return function(s){var c,u,f=s.language,l=s.children,d=s.style,p=d===void 0?r:d,g=s.customStyle,m=g===void 0?{}:g,y=s.codeTagProps,_=y===void 0?{className:f?"language-".concat(f):void 0,style:ii(ii({},p['code[class*="language-"]']),p['code[class*="language-'.concat(f,'"]')])}:y,k=s.useInlineStyles,C=k===void 0?!0:k,v=s.showLineNumbers,b=v===void 0?!1:v,x=s.showInlineLineNumbers,S=x===void 0?!0:x,j=s.startingLineNumber,A=j===void 0?1:j,N=s.lineNumberContainerStyle,D=s.lineNumberStyle,T=D===void 0?{}:D,I=s.wrapLines,H=s.wrapLongLines,V=H===void 0?!1:H,Y=s.lineProps,q=Y===void 0?{}:Y,O=s.renderer,U=s.PreTag,z=U===void 0?"pre":U,X=s.CodeTag,Q=X===void 0?"code":X,M=s.code,L=M===void 0?(Array.isArray(l)?l[0]:l)||"":M,B=s.astGenerator,W=T3(s,F3);B=B||e;var F=b?on.createElement(W3,{containerStyle:N,codeStyle:_.style||{},numberStyle:T,startingLineNumber:A,codeString:L}):null,re=p.hljs||p['pre[class*="language-"]']||{backgroundColor:"#fff"},Z=Gy(B)?"hljs":"prismjs",ee=C?Object.assign({},W,{style:Object.assign({},re,m)}):Object.assign({},W,{className:W.className?"".concat(Z," ").concat(W.className):Z,style:Object.assign({},m)});if(V?_.style=ii({whiteSpace:"pre-wrap"},_.style):_.style=ii({whiteSpace:"pre"},_.style),!B)return on.createElement(z,ee,F,on.createElement(Q,_,L));(I===void 0&&O||V)&&(I=!0),O=O||Y3;var K=[{type:"text",value:L}],$=K3({astGenerator:B,language:f,code:L,defaultCodeValue:K});$.language===null&&($.value=K);var ae=(c=(u=L.match(/\n/g))===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0,ne=A+ae,ve=V3($,I,q,b,S,A,ne,T,V);return on.createElement(z,ee,on.createElement(Q,_,!S&&F,O({rows:ve,stylesheet:p,useInlineStyles:C})))}}const Pv=/[#.]/g;function Z3(e,r){const i=e||"",s={};let c=0,u,f;for(;c<i.length;){Pv.lastIndex=c;const l=Pv.exec(i),d=i.slice(c,l?l.index:i.length);d&&(u?u==="#"?s.id=d:Array.isArray(s.className)?s.className.push(d):s.className=[d]:f=d,c+=d.length),l&&(u=l[0],c++)}return{type:"element",tagName:f||r||"div",properties:s,children:[]}}function Vy(e,r,i){const s=i?t5(i):void 0;function c(u,f,...l){let d;if(u==null){d={type:"root",children:[]};const p=f;l.unshift(p)}else{d=Z3(u,r);const p=d.tagName.toLowerCase(),g=s?s.get(p):void 0;if(d.tagName=g||p,Q3(f))l.unshift(f);else for(const[m,y]of Object.entries(f))J3(e,d.properties,m,y)}for(const p of l)ph(d.children,p);return d.type==="element"&&d.tagName==="template"&&(d.content={type:"root",children:d.children},d.children=[]),d}return c}function Q3(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const r=e,i=Object.keys(e);for(const s of i){const c=r[s];if(c&&typeof c=="object"){if(!Array.isArray(c))return!0;const u=c;for(const f of u)if(typeof f!="number"&&typeof f!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function J3(e,r,i,s){const c=Ub(e,i);let u;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;u=s}else typeof s=="boolean"?u=s:typeof s=="string"?c.spaceSeparated?u=Zx(s):c.commaSeparated?u=Gx(s):c.commaOrSpaceSeparated?u=Zx(Gx(s).join(" ")):u=Fv(c,c.property,s):Array.isArray(s)?u=[...s]:u=c.property==="style"?e5(s):String(s);if(Array.isArray(u)){const f=[];for(const l of u)f.push(Fv(c,c.property,l));u=f}c.property==="className"&&Array.isArray(r.className)&&(u=r.className.concat(u)),r[c.property]=u}}function ph(e,r){if(r!=null)if(typeof r=="number"||typeof r=="string")e.push({type:"text",value:String(r)});else if(Array.isArray(r))for(const i of r)ph(e,i);else if(typeof r=="object"&&"type"in r)r.type==="root"?ph(e,r.children):e.push(r);else throw new Error("Expected node, nodes, or string, got `"+r+"`")}function Fv(e,r,i){if(typeof i=="string"){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(i===""||Va(i)===Va(r)))return!0}return i}function e5(e){const r=[];for(const[i,s]of Object.entries(e))r.push([i,s].join(": "));return r.join("; ")}function t5(e){const r=new Map;for(const i of e)r.set(i.toLowerCase(),i);return r}const n5=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],r5=Vy($b,"div");Vy(Kl,"g",n5);const i5=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Uv={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function Yy(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=48&&r<=57}function s5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=102||r>=65&&r<=70||r>=48&&r<=57}function a5(e){const r=typeof e=="string"?e.charCodeAt(0):e;return r>=97&&r<=122||r>=65&&r<=90}function $v(e){return a5(e)||Yy(e)}const o5=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function l5(e,r){const i={},s=typeof i.additional=="string"?i.additional.charCodeAt(0):i.additional,c=[];let u=0,f=-1,l="",d,p;i.position&&("start"in i.position||"indent"in i.position?(p=i.position.indent,d=i.position.start):d=i.position);let g=(d?d.line:0)||1,m=(d?d.column:0)||1,y=k(),_;for(u--;++u<=e.length;)if(_===10&&(m=(p?p[f]:0)||1),_=e.charCodeAt(u),_===38){const b=e.charCodeAt(u+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||s&&b===s){l+=String.fromCharCode(_),m++;continue}const x=u+1;let S=x,j=x,A;if(b===35){j=++S;const q=e.charCodeAt(j);q===88||q===120?(A="hexadecimal",j=++S):A="decimal"}else A="named";let N="",D="",T="";const I=A==="named"?$v:A==="decimal"?Yy:s5;for(j--;++j<=e.length;){const q=e.charCodeAt(j);if(!I(q))break;T+=String.fromCharCode(q),A==="named"&&i5.includes(T)&&(N=T,D=Ka(T))}let H=e.charCodeAt(j)===59;if(H){j++;const q=A==="named"?Ka(T):!1;q&&(N=T,D=q)}let V=1+j-x,Y="";if(!(!H&&i.nonTerminated===!1))if(!T)A!=="named"&&C(4,V);else if(A==="named"){if(H&&!D)C(5,1);else if(N!==T&&(j=S+N.length,V=1+j-S,H=!1),!H){const q=N?1:3;if(i.attribute){const O=e.charCodeAt(j);O===61?(C(q,V),D=""):$v(O)?D="":C(q,V)}else C(q,V)}Y=D}else{H||C(2,V);let q=Number.parseInt(T,A==="hexadecimal"?16:10);if(c5(q))C(7,V),Y="�";else if(q in Uv)C(6,V),Y=Uv[q];else{let O="";u5(q)&&C(6,V),q>65535&&(q-=65536,O+=String.fromCharCode(q>>>10|55296),q=56320|q&1023),Y=O+String.fromCharCode(q)}}if(Y){v(),y=k(),u=j-1,m+=j-x+1,c.push(Y);const q=k();q.offset++,i.reference&&i.reference.call(i.referenceContext||void 0,Y,{start:y,end:q},e.slice(x-1,j)),y=q}else T=e.slice(x-1,j),l+=T,m+=T.length,u=j-1}else _===10&&(g++,f++,m=0),Number.isNaN(_)?v():(l+=String.fromCharCode(_),m++);return c.join("");function k(){return{line:g,column:m,offset:u+((d?d.offset:0)||0)}}function C(b,x){let S;i.warning&&(S=k(),S.column+=x,S.offset+=x,i.warning.call(i.warningContext||void 0,o5[b],S,b))}function v(){l&&(c.push(l),i.text&&i.text.call(i.textContext||void 0,l,{start:y,end:k()}),l="")}}function c5(e){return e>=55296&&e<=57343||e>1114111}function u5(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var d5=0,El={},Xt={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++d5}),e.__id},clone:function e(r,i){i=i||{};var s,c;switch(Xt.util.type(r)){case"Object":if(c=Xt.util.objId(r),i[c])return i[c];s={},i[c]=s;for(var u in r)r.hasOwnProperty(u)&&(s[u]=e(r[u],i));return s;case"Array":return c=Xt.util.objId(r),i[c]?i[c]:(s=[],i[c]=s,r.forEach(function(f,l){s[l]=e(f,i)}),s);default:return r}}},languages:{plain:El,plaintext:El,text:El,txt:El,extend:function(e,r){var i=Xt.util.clone(Xt.languages[e]);for(var s in r)i[s]=r[s];return i},insertBefore:function(e,r,i,s){s=s||Xt.languages;var c=s[e],u={};for(var f in c)if(c.hasOwnProperty(f)){if(f==r)for(var l in i)i.hasOwnProperty(l)&&(u[l]=i[l]);i.hasOwnProperty(f)||(u[f]=c[f])}var d=s[e];return s[e]=u,Xt.languages.DFS(Xt.languages,function(p,g){g===d&&p!=e&&(this[p]=u)}),u},DFS:function e(r,i,s,c){c=c||{};var u=Xt.util.objId;for(var f in r)if(r.hasOwnProperty(f)){i.call(r,f,r[f],s||f);var l=r[f],d=Xt.util.type(l);d==="Object"&&!c[u(l)]?(c[u(l)]=!0,e(l,i,null,c)):d==="Array"&&!c[u(l)]&&(c[u(l)]=!0,e(l,i,f,c))}}},plugins:{},highlight:function(e,r,i){var s={code:e,grammar:r,language:i};if(Xt.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=Xt.tokenize(s.code,s.grammar),Xt.hooks.run("after-tokenize",s),qa.stringify(Xt.util.encode(s.tokens),s.language)},tokenize:function(e,r){var i=r.rest;if(i){for(var s in i)r[s]=i[s];delete r.rest}var c=new h5;return Al(c,c.head,e),Ky(e,c,r,c.head,0),p5(c)},hooks:{all:{},add:function(e,r){var i=Xt.hooks.all;i[e]=i[e]||[],i[e].push(r)},run:function(e,r){var i=Xt.hooks.all[e];if(!(!i||!i.length))for(var s=0,c;c=i[s++];)c(r)}},Token:qa};function qa(e,r,i,s){this.type=e,this.content=r,this.alias=i,this.length=(s||"").length|0}function qv(e,r,i,s){e.lastIndex=r;var c=e.exec(i);if(c&&s&&c[1]){var u=c[1].length;c.index+=u,c[0]=c[0].slice(u)}return c}function Ky(e,r,i,s,c,u){for(var f in i)if(!(!i.hasOwnProperty(f)||!i[f])){var l=i[f];l=Array.isArray(l)?l:[l];for(var d=0;d<l.length;++d){if(u&&u.cause==f+","+d)return;var p=l[d],g=p.inside,m=!!p.lookbehind,y=!!p.greedy,_=p.alias;if(y&&!p.pattern.global){var k=p.pattern.toString().match(/[imsuy]*$/)[0];p.pattern=RegExp(p.pattern.source,k+"g")}for(var C=p.pattern||p,v=s.next,b=c;v!==r.tail&&!(u&&b>=u.reach);b+=v.value.length,v=v.next){var x=v.value;if(r.length>e.length)return;if(!(x instanceof qa)){var S=1,j;if(y){if(j=qv(C,b,e,m),!j||j.index>=e.length)break;var T=j.index,A=j.index+j[0].length,N=b;for(N+=v.value.length;T>=N;)v=v.next,N+=v.value.length;if(N-=v.value.length,b=N,v.value instanceof qa)continue;for(var D=v;D!==r.tail&&(N<A||typeof D.value=="string");D=D.next)S++,N+=D.value.length;S--,x=e.slice(b,N),j.index-=b}else if(j=qv(C,0,x,m),!j)continue;var T=j.index,I=j[0],H=x.slice(0,T),V=x.slice(T+I.length),Y=b+x.length;u&&Y>u.reach&&(u.reach=Y);var q=v.prev;H&&(q=Al(r,q,H),b+=H.length),f5(r,q,S);var O=new qa(f,g?Xt.tokenize(I,g):I,_,I);if(v=Al(r,q,O),V&&Al(r,v,V),S>1){var U={cause:f+","+d,reach:Y};Ky(e,r,i,v.prev,b,U),u&&U.reach>u.reach&&(u.reach=U.reach)}}}}}}function h5(){var e={value:null,prev:null,next:null},r={value:null,prev:e,next:null};e.next=r,this.head=e,this.tail=r,this.length=0}function Al(e,r,i){var s=r.next,c={value:i,prev:r,next:s};return r.next=c,s.prev=c,e.length++,c}function f5(e,r,i){for(var s=r.next,c=0;c<i&&s!==e.tail;c++)s=s.next;r.next=s,s.prev=r,e.length-=c}function p5(e){for(var r=[],i=e.head.next;i!==e.tail;)r.push(i.value),i=i.next;return r}const Xy=Xt;function Zy(){}Zy.prototype=Xy;const Vt=new Zy;Vt.highlight=m5;Vt.register=g5;Vt.alias=x5;Vt.registered=v5;Vt.listLanguages=b5;Vt.util.encode=y5;Vt.Token.stringify=mh;function m5(e,r){if(typeof e!="string")throw new TypeError("Expected `string` for `value`, got `"+e+"`");let i,s;if(r&&typeof r=="object")i=r;else{if(s=r,typeof s!="string")throw new TypeError("Expected `string` for `name`, got `"+s+"`");if(Object.hasOwn(Vt.languages,s))i=Vt.languages[s];else throw new Error("Unknown language: `"+s+"` is not registered")}return{type:"root",children:Xy.highlight.call(Vt,e,i,s)}}function g5(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(Vt.languages,e.displayName)||e(Vt)}function x5(e,r){const i=Vt.languages;let s={};typeof e=="string"?r&&(s[e]=r):s=e;let c;for(c in s)if(Object.hasOwn(s,c)){const u=s[c],f=typeof u=="string"?[u]:u;let l=-1;for(;++l<f.length;)i[f[l]]=i[c]}}function v5(e){if(typeof e!="string")throw new TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(Vt.languages,e)}function b5(){const e=Vt.languages,r=[];let i;for(i in e)Object.hasOwn(e,i)&&typeof e[i]=="object"&&r.push(i);return r}function mh(e,r){if(typeof e=="string")return{type:"text",value:e};if(Array.isArray(e)){const s=[];let c=-1;for(;++c<e.length;)e[c]!==null&&e[c]!==void 0&&e[c]!==""&&s.push(mh(e[c],r));return s}const i={attributes:{},classes:["token",e.type],content:mh(e.content,r),language:r,tag:"span",type:e.type};return e.alias&&i.classes.push(...typeof e.alias=="string"?[e.alias]:e.alias),Vt.hooks.run("wrap",i),r5(i.tag+"."+i.classes.join("."),_5(i.attributes),i.content)}function y5(e){return e}function _5(e){let r;for(r in e)Object.hasOwn(e,r)&&(e[r]=l5(e[r]));return e}var pt=X3(Vt,{});pt.registerLanguage=function(e,r){return Vt.register(r)};pt.alias=function(e,r){return Vt.alias(e,r)};Bi.displayName="markup";Bi.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function Bi(e){e.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(i,s){var c={};c["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[s]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var u={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};u["language-"+s]={pattern:/[\s\S]+/,inside:e.languages[s]};var f={};f[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:u},e.languages.insertBefore("markup","cdata",f)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(r,i){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:e.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}tc.displayName="css";tc.aliases=[];function tc(e){(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(e)}Ii.displayName="clike";Ii.aliases=[];function Ii(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}io.displayName="javascript";io.aliases=["js"];function io(e){e.register(Ii),e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Uh.displayName="sql";Uh.aliases=[];function Uh(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}nc.displayName="c";nc.aliases=[];function nc(e){e.register(Ii),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}$h.displayName="cpp";$h.aliases=[];function $h(e){e.register(nc),(function(r){var i=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,s=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return i.source});r.languages.cpp=r.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:i,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),r.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return s})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),r.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:r.languages.cpp}}}}),r.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),r.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:r.languages.extend("cpp",{})}}),r.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},r.languages.cpp["base-clause"])})(e)}qh.displayName="bash";qh.aliases=["sh","shell"];function qh(e){(function(r){var i="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",s={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},c={bash:s,environment:{pattern:RegExp("\\$"+i),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+i),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};r.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+i),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:c},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:s}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:c},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:c.entity}}],environment:{pattern:RegExp("\\$?"+i),alias:"constant"},variable:c.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},s.inside=r.languages.bash;for(var u=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],f=c.variable[1].inside,l=0;l<u.length;l++)f[u[l]]=r.languages.bash[u[l]];r.languages.sh=r.languages.bash,r.languages.shell=r.languages.bash})(e)}Wh.displayName="yaml";Wh.aliases=["yml"];function Wh(e){(function(r){var i=/[*&][^\s[\]{},]+/,s=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,c="(?:"+s.source+"(?:[ ]+"+i.source+")?|"+i.source+"(?:[ ]+"+s.source+")?)",u=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),f=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(d,p){p=(p||"").replace(/m/g,"")+"m";var g=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<value>>/g,function(){return d});return RegExp(g,p)}r.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return c})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return c}).replace(/<<key>>/g,function(){return"(?:"+u+"|"+f+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(f),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:s,important:i,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},r.languages.yml=r.languages.yaml})(e)}Gh.displayName="markdown";Gh.aliases=["md"];function Gh(e){e.register(Bi),(function(r){var i=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function s(l){return l=l.replace(/<inner>/g,function(){return i}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var c=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,u=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return c}),f=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;r.languages.markdown=r.languages.extend("markup",{}),r.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:r.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+u+f+"(?:"+u+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+u+f+")(?:"+u+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(c),inside:r.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+u+")"+f+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+u+"$"),inside:{"table-header":{pattern:RegExp(c),alias:"important",inside:r.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:s(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:s(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:s(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:s(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(d){l!==d&&(r.languages.markdown[l].inside.content.inside[d]=r.languages.markdown[d])})}),r.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function d(p){if(!(!p||typeof p=="string"))for(var g=0,m=p.length;g<m;g++){var y=p[g];if(y.type!=="code"){d(y.content);continue}var _=y.content[1],k=y.content[3];if(_&&k&&_.type==="code-language"&&k.type==="code-block"&&typeof _.content=="string"){var C=_.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");C=(/[a-z][\w-]*/i.exec(C)||[""])[0].toLowerCase();var v="language-"+C;k.alias?typeof k.alias=="string"?k.alias=[k.alias,v]:k.alias.push(v):k.alias=[v]}}}d(l.tokens)}),r.hooks.add("wrap",function(l){if(l.type==="code-block"){for(var d="",p=0,g=l.classes.length;p<g;p++){var m=l.classes[p],y=/language-(.+)/.exec(m);if(y){d=y[1];break}}var _=r.languages[d];if(_)l.content=r.highlight(l.content.value,_,d);else if(d&&d!=="none"&&r.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);l.attributes.id=k,r.plugins.autoloader.loadLanguages(d,function(){var C=document.getElementById(k);C&&(C.innerHTML=r.highlight(C.textContent,r.languages[d],d))})}}}),RegExp(r.languages.markup.tag.pattern.source,"gi"),r.languages.md=r.languages.markdown})(e)}Vh.displayName="ruby";Vh.aliases=["rb"];function Vh(e){e.register(Ii),(function(r){r.languages.ruby=r.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),r.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var i={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:r.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete r.languages.ruby.function;var s="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",c=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;r.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+s+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:i,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+c),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+c+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),r.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+s),greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:i,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+s),greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:i,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete r.languages.ruby.string,r.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),r.languages.rb=r.languages.ruby})(e)}Yh.displayName="diff";Yh.aliases=[];function Yh(e){(function(r){r.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var i={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(i).forEach(function(s){var c=i[s],u=[];/^\w+$/.test(s)||u.push(/\w+/.exec(s)[0]),s==="diff"&&u.push("bold"),r.languages.diff[s]={pattern:RegExp("^(?:["+c+`].*(?:\r
|
|
124
125
|
?|
|
|
125
126
|
|(?![\\s\\S])))+`,"m"),alias:u,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(s)[0]}}}}),Object.defineProperty(r.languages.diff,"PREFIXES",{value:i})})(e)}Kh.displayName="docker";Kh.aliases=["dockerfile"];function Kh(e){(function(r){var i=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,s=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return i}),c=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,u=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return c}),f={pattern:RegExp(c),greedy:!0},l={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function d(p,g){return p=p.replace(/<OPT>/g,function(){return u}).replace(/<SP>/g,function(){return s}),RegExp(p,g)}r.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:d(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[f,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:d(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:d(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:l,string:f,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:l},r.languages.dockerfile=r.languages.docker})(e)}Xh.displayName="go";Xh.aliases=[];function Xh(e){e.register(Ii),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}Zh.displayName="graphql";Zh.aliases=[];function Zh(e){e.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:e.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},e.hooks.add("after-tokenize",function(i){if(i.language!=="graphql")return;var s=i.tokens.filter(function(v){return typeof v!="string"&&v.type!=="comment"&&v.type!=="scalar"}),c=0;function u(v){return s[c+v]}function f(v,b){b=b||0;for(var x=0;x<v.length;x++){var S=u(x+b);if(!S||S.type!==v[x])return!1}return!0}function l(v,b){for(var x=1,S=c;S<s.length;S++){var j=s[S],A=j.content;if(j.type==="punctuation"&&typeof A=="string"){if(v.test(A))x++;else if(b.test(A)&&(x--,x===0))return S}}return-1}function d(v,b){var x=v.alias;x?Array.isArray(x)||(v.alias=x=[x]):v.alias=x=[],x.push(b)}for(;c<s.length;){var p=s[c++];if(p.type==="keyword"&&p.content==="mutation"){var g=[];if(f(["definition-mutation","punctuation"])&&u(1).content==="("){c+=2;var m=l(/^\($/,/^\)$/);if(m===-1)continue;for(;c<m;c++){var y=u(0);y.type==="variable"&&(d(y,"variable-input"),g.push(y.content))}c=m+1}if(f(["punctuation","property-query"])&&u(0).content==="{"&&(c++,d(u(0),"property-mutation"),g.length>0)){var _=l(/^\{$/,/^\}$/);if(_===-1)continue;for(var k=c;k<_;k++){var C=s[k];C.type==="variable"&&g.indexOf(C.content)>=0&&d(C,"variable-input")}}}}})}Qh.displayName="scss";Qh.aliases=[];function Qh(e){e.register(tc),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}Jh.displayName="json";Jh.aliases=["webmanifest"];function Jh(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}ef.displayName="java";ef.aliases=[];function ef(e){e.register(Ii),(function(r){var i=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,s=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,c={pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};r.languages.java=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[c,{pattern:RegExp(/(^|[^\w.])/.source+s+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:c.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+s+/[A-Z]\w*\b/.source),lookbehind:!0,inside:c.inside}],keyword:i,function:[r.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),r.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),r.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":c,keyword:i,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+s+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:c.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+s+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:c.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return i.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}rc.displayName="typescript";rc.aliases=["ts"];function rc(e){e.register(io),(function(r){r.languages.typescript=r.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),r.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete r.languages.typescript.parameter,delete r.languages.typescript["literal-property"];var i=r.languages.extend("typescript",{});delete i["class-name"],r.languages.typescript["class-name"].inside=i,r.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:i}}}}),r.languages.ts=r.languages.typescript})(e)}tf.displayName="python";tf.aliases=["py"];function tf(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}ic.displayName="jsx";ic.aliases=[];function ic(e){e.register(io),e.register(Bi),(function(r){var i=r.util.clone(r.languages.javascript),s=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,c=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,u=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function f(p,g){return p=p.replace(/<S>/g,function(){return s}).replace(/<BRACES>/g,function(){return c}).replace(/<SPREAD>/g,function(){return u}),RegExp(p,g)}u=f(u).source,r.languages.jsx=r.languages.extend("markup",i),r.languages.jsx.tag.pattern=f(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),r.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,r.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,r.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,r.languages.jsx.tag.inside.comment=i.comment,r.languages.insertBefore("inside","attr-name",{spread:{pattern:f(/<SPREAD>/.source),inside:r.languages.jsx}},r.languages.jsx.tag),r.languages.insertBefore("inside","special-attr",{script:{pattern:f(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:r.languages.jsx}}},r.languages.jsx.tag);var l=function(p){return p?typeof p=="string"?p:typeof p.content=="string"?p.content:p.content.map(l).join(""):""},d=function(p){for(var g=[],m=0;m<p.length;m++){var y=p[m],_=!1;if(typeof y!="string"&&(y.type==="tag"&&y.content[0]&&y.content[0].type==="tag"?y.content[0].content[0].content==="</"?g.length>0&&g[g.length-1].tagName===l(y.content[0].content[1])&&g.pop():y.content[y.content.length-1].content==="/>"||g.push({tagName:l(y.content[0].content[1]),openedBraces:0}):g.length>0&&y.type==="punctuation"&&y.content==="{"?g[g.length-1].openedBraces++:g.length>0&&g[g.length-1].openedBraces>0&&y.type==="punctuation"&&y.content==="}"?g[g.length-1].openedBraces--:_=!0),(_||typeof y=="string")&&g.length>0&&g[g.length-1].openedBraces===0){var k=l(y);m<p.length-1&&(typeof p[m+1]=="string"||p[m+1].type==="plain-text")&&(k+=l(p[m+1]),p.splice(m+1,1)),m>0&&(typeof p[m-1]=="string"||p[m-1].type==="plain-text")&&(k=l(p[m-1])+k,p.splice(m-1,1),m--),p[m]=new r.Token("plain-text",k,null,k)}y.content&&typeof y.content!="string"&&d(y.content)}};r.hooks.add("after-tokenize",function(p){p.language!=="jsx"&&p.language!=="tsx"||d(p.tokens)})})(e)}nf.displayName="tsx";nf.aliases=[];function nf(e){e.register(ic),e.register(rc),(function(r){var i=r.util.clone(r.languages.typescript);r.languages.tsx=r.languages.extend("jsx",i),delete r.languages.tsx.parameter,delete r.languages.tsx["literal-property"];var s=r.languages.tsx.tag;s.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+s.pattern.source+")",s.pattern.flags),s.lookbehind=!0})(e)}rf.displayName="rust";rf.aliases=[];function rf(e){(function(r){for(var i=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,s=0;s<2;s++)i=i.replace(/<self>/g,function(){return i});i=i.replace(/<self>/g,function(){return/[^\s\S]/.source}),r.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+i),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},r.languages.rust["closure-params"].inside.rest=r.languages.rust,r.languages.rust.attribute.inside.string=r.languages.rust.string})(e)}sf.displayName="toml";sf.aliases=[];function sf(e){(function(r){var i=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function s(c){return c.replace(/__/g,function(){return i})}r.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(s(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(s(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(e)}const Dl={'code[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(220, 13%, 18%)",color:"hsl(220, 14%, 71%)",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"]::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'code[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},'pre[class*="language-"] *::selection':{background:"hsl(220, 13%, 28%)",color:"inherit",textShadow:"none"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},prolog:{color:"hsl(220, 10%, 40%)"},cdata:{color:"hsl(220, 10%, 40%)"},doctype:{color:"hsl(220, 14%, 71%)"},punctuation:{color:"hsl(220, 14%, 71%)"},entity:{color:"hsl(220, 14%, 71%)",cursor:"help"},"attr-name":{color:"hsl(29, 54%, 61%)"},"class-name":{color:"hsl(29, 54%, 61%)"},boolean:{color:"hsl(29, 54%, 61%)"},constant:{color:"hsl(29, 54%, 61%)"},number:{color:"hsl(29, 54%, 61%)"},atrule:{color:"hsl(29, 54%, 61%)"},keyword:{color:"hsl(286, 60%, 67%)"},property:{color:"hsl(355, 65%, 65%)"},tag:{color:"hsl(355, 65%, 65%)"},symbol:{color:"hsl(355, 65%, 65%)"},deleted:{color:"hsl(355, 65%, 65%)"},important:{color:"hsl(355, 65%, 65%)"},selector:{color:"hsl(95, 38%, 62%)"},string:{color:"hsl(95, 38%, 62%)"},char:{color:"hsl(95, 38%, 62%)"},builtin:{color:"hsl(95, 38%, 62%)"},inserted:{color:"hsl(95, 38%, 62%)"},regex:{color:"hsl(95, 38%, 62%)"},"attr-value":{color:"hsl(95, 38%, 62%)"},"attr-value > .token.punctuation":{color:"hsl(95, 38%, 62%)"},variable:{color:"hsl(207, 82%, 66%)"},operator:{color:"hsl(207, 82%, 66%)"},function:{color:"hsl(207, 82%, 66%)"},url:{color:"hsl(187, 47%, 55%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(220, 14%, 71%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(220, 14%, 71%)"},".language-css .token.selector":{color:"hsl(355, 65%, 65%)"},".language-css .token.property":{color:"hsl(220, 14%, 71%)"},".language-css .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.function":{color:"hsl(187, 47%, 55%)"},".language-css .token.url > .token.string.url":{color:"hsl(95, 38%, 62%)"},".language-css .token.important":{color:"hsl(286, 60%, 67%)"},".language-css .token.atrule .token.rule":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.operator":{color:"hsl(286, 60%, 67%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(5, 48%, 51%)"},".language-json .token.operator":{color:"hsl(220, 14%, 71%)"},".language-json .token.null.keyword":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.url":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.operator":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(220, 14%, 71%)"},".language-markdown .token.url > .token.content":{color:"hsl(207, 82%, 66%)"},".language-markdown .token.url > .token.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.url-reference.url":{color:"hsl(187, 47%, 55%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(220, 10%, 40%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(95, 38%, 62%)"},".language-markdown .token.bold .token.content":{color:"hsl(29, 54%, 61%)"},".language-markdown .token.italic .token.content":{color:"hsl(286, 60%, 67%)"},".language-markdown .token.strike .token.content":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.list.punctuation":{color:"hsl(355, 65%, 65%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(355, 65%, 65%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.cr:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.lf:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"token.space:before":{color:"hsla(220, 14%, 71%, 0.15)",textShadow:"none"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 9%, 55%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(220, 13%, 28%)",color:"hsl(220, 14%, 71%)"},".line-highlight.line-highlight":{background:"hsla(220, 100%, 80%, 0.04)"},".line-highlight.line-highlight:before":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(220, 13%, 26%)",color:"hsl(220, 14%, 71%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(220, 100%, 80%, 0.04)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".command-line .command-line-prompt":{borderRightColor:"hsla(220, 14%, 71%, 0.15)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(220, 14%, 45%)"},".command-line .command-line-prompt > span:before":{color:"hsl(220, 14%, 45%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(355, 65%, 65%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(95, 38%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(207, 82%, 66%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(286, 60%, 67%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(286, 60%, 67%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(224, 13%, 17%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(224, 13%, 17%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(224, 13%, 17%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(224, 13%, 17%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(219, 13%, 22%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(219, 13%, 22%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(220, 14%, 71%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(220, 14%, 71%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(220, 14%, 71%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(220, 14%, 71%)"}};pt.registerLanguage("typescript",rc);pt.registerLanguage("javascript",io);pt.registerLanguage("tsx",nf);pt.registerLanguage("jsx",ic);pt.registerLanguage("python",tf);pt.registerLanguage("bash",qh);pt.registerLanguage("json",Jh);pt.registerLanguage("css",tc);pt.registerLanguage("html",Bi);pt.registerLanguage("markup",Bi);pt.registerLanguage("xml",Bi);pt.registerLanguage("sql",Uh);pt.registerLanguage("yaml",Wh);pt.registerLanguage("markdown",Gh);pt.registerLanguage("diff",Yh);pt.registerLanguage("rust",rf);pt.registerLanguage("go",Xh);pt.registerLanguage("java",ef);pt.registerLanguage("c",nc);pt.registerLanguage("cpp",$h);pt.registerLanguage("ruby",Vh);pt.registerLanguage("toml",sf);pt.registerLanguage("scss",Qh);pt.registerLanguage("graphql",Zh);pt.registerLanguage("docker",Kh);function Qy(e=2e3){const[r,i]=P.useState(!1),s=P.useCallback(async c=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(c);else{const u=document.createElement("textarea");u.value=c,u.style.position="fixed",u.style.left="-9999px",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}i(!0),setTimeout(()=>i(!1),e)}catch(u){console.error("Failed to copy:",u)}},[e]);return{copied:r,copy:s}}const S5={code({className:e,children:r,...i}){const s=/language-(\w+)/.exec(e||"");if(!s&&!String(r).includes(`
|
|
126
127
|
`))return o.jsx("code",{className:"bg-bg-tertiary px-1 py-0.5 rounded text-accent-secondary font-mono text-xs",...i,children:r});const u=(s==null?void 0:s[1])||"text",f=String(r).replace(/\n$/,""),{copied:l,copy:d}=Qy();return o.jsxs("div",{className:"relative group my-1.5 rounded overflow-hidden",children:[o.jsxs("div",{className:"absolute bottom-0 right-0 flex items-center gap-2 px-2 py-1 text-xs text-text-muted/70 bg-bg-tertiary/60 rounded-tl rounded-tr z-10",children:[o.jsx("span",{children:u}),o.jsx("button",{type:"button",onClick:p=>{p.preventDefault(),p.stopPropagation(),d(f)},className:"opacity-0 group-hover:opacity-100 transition-opacity hover:text-text-primary p-0.5",title:"Copy code",children:l?o.jsx(Wl,{}):o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),o.jsx("div",{className:"overflow-x-auto",children:o.jsx(pt,{style:Dl,language:u,PreTag:"div",customStyle:{margin:0,fontSize:"0.75rem"},codeTagProps:{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"}},children:f})})]})},p({children:e}){return o.jsx("p",{className:"mb-1.5 last:mb-0 leading-tight",children:e})},ul({children:e}){return o.jsx("ul",{className:"list-disc list-inside mb-1.5 space-y-0.5",children:e})},ol({children:e}){return o.jsx("ol",{className:"list-decimal list-inside mb-1.5 space-y-0.5",children:e})},li({children:e}){return o.jsx("li",{className:"text-text-primary text-sm list-item",children:e})},h1({children:e}){return o.jsx("h1",{className:"text-base font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h2({children:e}){return o.jsx("h2",{className:"text-sm font-bold mb-1.5 mt-2 first:mt-0 text-sky-400",children:e})},h3({children:e}){return o.jsx("h3",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},h4({children:e}){return o.jsx("h4",{className:"text-sm font-bold mb-1.5 mt-1.5 first:mt-0 text-sky-400",children:e})},strong({children:e}){return o.jsx("strong",{className:"font-bold text-amber-400",children:e})},a({href:e,children:r}){return o.jsx("a",{href:e,className:"text-accent-primary hover:underline text-sm",target:"_blank",rel:"noopener noreferrer",children:r})},blockquote({children:e}){return o.jsx("blockquote",{className:"border-l-2 border-accent-primary pl-2 my-1.5 text-text-secondary italic text-sm",children:e})},table({children:e}){return o.jsx("div",{className:"overflow-x-auto my-1.5",children:o.jsx("table",{className:"min-w-full border border-border",children:e})})},th({children:e}){return o.jsx("th",{className:"border border-border bg-bg-tertiary px-2 py-1 text-left font-semibold text-sm",children:e})},td({children:e}){return o.jsx("td",{className:"border border-border px-2 py-1 text-sm",children:e})},hr(){return o.jsx("hr",{className:"border-border my-2"})},input({checked:e,...r}){return o.jsx("input",{type:"checkbox",checked:e,disabled:!0,className:"mr-1.5 w-3.5 h-3.5",...r})}},zi=P.memo(function({content:r,className:i=""}){const s=P.useMemo(()=>{let c=w5(r);return c=C5(c),c},[r]);return o.jsx("div",{className:`markdown-content [&_li>p]:inline ${i}`,children:o.jsx(pj,{remarkPlugins:[j3],components:S5,children:s})})});function w5(e){let r=e.replace(/^(\s*)•\s/gm,"$1- ");return r=r.replace(/^(\d+)\.\s*\n(?=\S)/gm,"$1. "),r}function C5(e){const r=/```/g,i=e.match(r);if(((i==null?void 0:i.length)??0)%2===1){const c=e.lastIndexOf("```");return e.slice(c+3).includes(`
|
|
@@ -133,8 +134,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
133
134
|
`),m=g.filter(y=>!y.startsWith(`
|
|
134
135
|
[`)&&!y.startsWith("[")).map(y=>y.replace(/^\d+: /,"")).join(`
|
|
135
136
|
`);return o.jsx("div",{className:`rounded overflow-hidden border border-border ${c?"":"max-h-[45vh]"} overflow-y-auto`,children:o.jsxs("div",{className:"grid grid-cols-[2.5rem_1fr]",children:[o.jsx("div",{className:"bg-bg-tertiary text-text-muted text-xs font-mono text-right pr-2 select-none py-0.5",children:g.filter(y=>!y.startsWith(`
|
|
136
|
-
[`)&&!y.startsWith("[")).map((y,_)=>{const k=y.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(Qa,{code:m,language:l,variant:"block"})})]})})}),I5={error:{icon:"✗",color:"text-accent-error",bg:"bg-red-500/10",border:"border-red-500/30"},warning:{icon:"⚠",color:"text-accent-warning",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},info:{icon:"ℹ",color:"text-accent-info",bg:"bg-blue-500/10",border:"border-blue-500/30"},hint:{icon:"💡",color:"text-text-muted",bg:"bg-gray-500/10",border:"border-gray-500/30"}},Wv=P.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=r.filter(u=>u.severity==="warning"),c=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,f)=>{const l=I5[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},f)})})]})}),z5=P.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:u,result:f,error:l,durationMs:d}){const p=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[c,u]),P.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const y=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,k=u==="pending"?(c==null?void 0:c.map(C=>C.content).join(""))??"":f??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[o.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),o.jsx("code",{className:"text-text-primary break-all",children:r})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[_.toFixed(1),"s / ",y,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(k||u==="pending")&&o.jsx("pre",{ref:p,className:`text-xs bg-bg-primary p-2 rounded overflow-auto max-h-64 ${u==="pending"?"border border-accent-warning/30":""}`,children:u==="pending"&&c?c.map((C,v)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Ga(C.content)},v)):Ga(k)}),u==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function H5(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function P5({confirmation:e}){const r=Ee(g=>g.confirmPath),i=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:c,description:u}=H5(e.reason),f=e.reason==="sensitive_file"||e.reason==="both",l=f?"border-red-500/50":"border-amber-500/50",d=f?"bg-red-500/10":"bg-amber-500/10",p=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${l} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:`w-4 h-4 ${f?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${f?"text-red-400":"text-amber-400"}`,children:c}),o.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${f?"text-red-300":"text-amber-300"} break-all`,children:g},m))})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>r(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),o.jsx("button",{onClick:()=>r(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-white transition-colors",children:"Allow"}),o.jsx("button",{onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-red-600 hover:bg-red-700 text-white transition-colors",title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function F5(e,r){if(e==="read_file"){const s=String(r.path??""),c=r.offset,u=r.limit,f=[];return c!==void 0&&c!==1&&f.push(`offset=${c}`),u!==void 0&&f.push(`limit=${u}`),f.length>0?`${s} [${f.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(r.path??"");if(e==="run_command"||e==="bash")return String(r.command??"");if(e==="return_value"){const s=String(r.content??"");return s.length>60?s.slice(0,60)+"...":s}const i=JSON.stringify(r);return i.length>50?i.slice(0,50)+"...":i}function Gv(e,r,i){return F5(e,r)}function U5(e){return JSON.stringify(e,null,2)}const $5={pending:{icon:"●",color:"text-accent-warning",animate:!0},success:{icon:"✓",color:"text-accent-success",animate:!1},error:{icon:"✗",color:"text-accent-error",animate:!1},interrupted:{icon:"✗",color:"text-red-400",animate:!1}},q5=P.memo(function({tool:r,args:i,status:s,variant:c="compact",result:u,error:f,durationMs:l,diagnostics:d,editContext:p,startedAt:g,streamingOutput:m,metadata:y,callId:_}){const k=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",v=r==="read_file",b=r==="return_value",[x,S]=P.useState(k||C||b),j=$5[s],A=Ee(D=>D.pendingPathConfirmation),N=s==="pending"&&A&&_&&A.callId===_?A:null;return c==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[o.jsx(Jy,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Gv(r,i)}),o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):o.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[o.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>S(!x),children:[o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.icon}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:Gv(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:x?"▼":"▶"})]}),N&&o.jsx(P5,{confirmation:N}),(x||v)&&o.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(z5,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:m,status:s,result:u,error:f,durationMs:l}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[p&&p.regions.length>0?o.jsx(L5,{regions:p.regions,filePath:String(i.path??"")}):o.jsx(A5,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Wv,{diagnostics:d})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(D5,{content:String(i.content??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Wv,{diagnostics:d})]}),r==="read_file"&&s==="success"&&o.jsx(B5,{result:u,metadata:y,filePath:String(i.path??""),heightExpanded:x}),r==="return_value"&&(()=>{const D=(m==null?void 0:m.map(I=>I.content).join(""))??"",T=s==="pending"&&D?D:String(i.content??"");return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),o.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:T})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:U5(i)})]}),s==="success"&&u!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",l!==void 0&&` (${l}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:u||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&l!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",l,"ms"]}),s==="error"&&f&&r!=="run_command"&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:f})]})]})]})}),W5={read_file:"Reading file",write_file:"Writing file",edit_file:"Editing file",run_command:"Running command",glob:"Searching files",grep:"Searching content",ask_user:"Asking user",criterion:"Managing criterion",todo_write:"Updating tasks"};function G5(e){return W5[e]??`Preparing ${e}`}const V5=P.memo(function({name:r}){const i=G5(r);return o.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:o.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[o.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),o.jsx(Jy,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[i,"..."]})]})})}),Y5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},K5=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const c=Y5[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(c==null?void 0:c.color)??"text-text-muted"} ${c!=null&&c.animate?"animate-pulse":""} text-sm leading-tight`,children:(c==null?void 0:c.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Vv={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},n0=P.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(u=>[u.id,u]))??[]),c=r.find(u=>{var f,l;return u.arguments.action==="get"&&((f=u.result)==null?void 0:f.success)&&((l=u.result)==null?void 0:l.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{children:c?(()=>{const u=c.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((l,d)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(zi,{content:`[${l.id}] ${l.description}`})})]},l.id??d))}catch{return r.map((f,l)=>o.jsx(Yv,{tc:f,index:l,criteriaMap:s},f.id??l))}})():r.map((u,f)=>o.jsx(Yv,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function Yv({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,c=s&&Vv[s]?Vv[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=s==="remove",l=u.id,d=u.description,p=l?i.get(l):void 0,g=d??(p==null?void 0:p.description)??(f&&l?`[${l}]`:"Criterion updated"),m=u.reason,y=s==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${c.color} text-sm leading-tight flex-shrink-0`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:f?"line-through text-text-muted":"",children:o.jsx(zi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${y?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function X5(e){return e==="criterion"}const Z5="#6b7280";function zl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??Z5}const Wt=Wn(e=>{const r=async()=>{await _h("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/agents/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{const s=await si("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const c=await si("PUT",`/api/agents/${i}`,s);return c.success&&await r(),c},deleteAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async i=>{try{const s=await Ce(`/api/agents/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function Q5(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const c of e)c.type==="tool_call"&&X5(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function J5(e,r){if(e.segments&&e.segments.length>0)return eT(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const i=[];if(e.thinkingContent&&i.push({type:"thinking",content:e.thinkingContent}),e.content&&i.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)i.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)i.push({type:"preparing_tool_call",preparing:s});return r&&e.stats&&i.push({type:"stats",stats:e.stats}),i}function eT(e,r,i,s,c){const u=[],f=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":u.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&u.push({type:"thinking",content:l.content});break;case"tool_call":{const d=f.get(l.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const l of i)u.push({type:"preparing_tool_call",preparing:l});return c&&s&&u.push({type:"stats",stats:s}),u}const af=P.memo(function({message:r,showStats:i=!0}){const s=Ee(p=>{var g;return(g=p.currentSession)==null?void 0:g.criteria}),c=Wt(p=>p.defaults),u=Wt(p=>p.userItems),f=[...c,...u],l=J5(r,i),d=Q5(l);return d.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[d.map((p,g)=>{var m,y;switch(p.type){case"thinking":return o.jsx(k5,{content:p.content},g);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(zi,{content:p.content})},g);case"preparing_tool_call":return o.jsx(V5,{name:p.preparing.name},`preparing-${p.preparing.index}`);case"tool_call":{const _=p.toolCall,k=_.result;if(_.name==="todo_write"){const b=_.arguments.todos,x=Array.isArray(b)?b:[];return o.jsx(K5,{todos:x},g)}const C=(m=k==null?void 0:k.output)==null?void 0:m.includes("[interrupted by user]"),v=k?C?"interrupted":k.success?"success":"error":"pending";return o.jsx(q5,{tool:_.name,args:_.arguments,status:v,variant:"expandable",result:k==null?void 0:k.output,error:k==null?void 0:k.error,durationMs:k==null?void 0:k.durationMs,diagnostics:k==null?void 0:k.diagnostics,editContext:k==null?void 0:k.editContext,startedAt:_.startedAt,streamingOutput:_.streamingOutput,metadata:k==null?void 0:k.metadata,callId:_.id},g)}case"criteria_group":return o.jsx(n0,{toolCalls:p.toolCalls,criteria:s},g);case"stats":{const _=p.stats,k=((y=_.model.split("/").pop())==null?void 0:y.split("-").slice(0,2).join("-"))??_.model,C=zl(f,_.mode),v=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toString(),b=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:k}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:C},children:_.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_.totalTime.toFixed(1),"s"]}),_.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[v(_.prefillTokens)," @ ",b(_.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[v(_.generationTokens)," @ ",b(_.generationSpeed)," tg"]}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},g)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsx("span",{children:"Aborted"})]})]})})}),Dt=Wn((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Ce("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Ce("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/workflows/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await si("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const c=await si("PUT",`/api/workflows/${i}`,s);return c.success&&await r().fetchWorkflows(),c},deleteWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Hl(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}function tT(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),i=Math.round(e%60);return i>0?`${r}m ${i}s`:`${r}m`}function nT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const rT=P.memo(function({data:r}){var f;const i=Dt(l=>l.defaults),s=Dt(l=>l.userItems),u=((f=[...i,...s].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Hl(u,.3),backgroundColor:Hl(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:u,viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ia,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ia,{label:"Total time",value:tT(r.totalTimeSeconds)}),o.jsx(Ia,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ia,{label:"Tokens",value:nT(r.totalTokensGenerated)}),o.jsx(Ia,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ia({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[o.jsx("div",{className:"text-sm text-text-muted",children:e}),o.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const iT=P.memo(function({data:r}){var f;const i=Dt(l=>l.defaults),s=Dt(l=>l.userItems),u=((f=[...i,...s].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Hl(u,.3),backgroundColor:Hl(u,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:u,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function sT({attachments:e,messageId:r}){const[i,s]=P.useState(null),c=Ee(g=>g.visionFallbackByMessage),u=Ee(g=>g.messages),f=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const y=u[m];if(y&&y.role==="assistant")return y.id}return null},[u,r]),l=g=>{s(g)},d=()=>{s(null)},p=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(f){const y=`${f}-${g}`;return c[y]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=p(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>l(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},g.id)})}),i&&o.jsx(t0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function aT({isOpen:e,onClose:r,promptContext:i}){const[s,c]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=f=>{c(l=>({...l,[f]:!l[f]}))};return o.jsx(ln,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(Es,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(Es,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((f,l)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:f.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:f.source}),f.toolCallId&&o.jsx("span",{className:"font-mono",children:f.toolCallId}),f.attachments&&f.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[f.attachments.length," attachment",f.attachments.length===1?"":"s"]})]}),f.attachments&&f.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:f.attachments.map(d=>d.filename).join(", ")}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:f.content||"(empty)"})]},`${f.role}-${l}`))})}),o.jsx(Es,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((f,l)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:f.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:f.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(f.parameters,null,2)})]},`${f.name}-${l}`))]})}),o.jsx(Es,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(Es,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((f,l)=>o.jsx(oT,{file:f,expanded:s[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(Es,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:i.systemPrompt})})]})})}function oT({file:e,expanded:r,onToggle:i}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),o.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&o.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&o.jsx("div",{className:"border-t border-border/50 p-2",children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function Es({title:e,expanded:r,onToggle:i,badge:s,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:c})]})}function lT({content:e,promptContext:r,align:i="right"}){const[s,c]=P.useState(!1),[u,f]=P.useState(!1),[l,d]=P.useState(!1),p=P.useRef(null);P.useEffect(()=>{const y=_=>{p.current&&!p.current.contains(_.target)&&c(!1)};return s&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const y=document.createElement("textarea");y.value=e,y.style.position="fixed",y.style.left="-999999px",document.body.appendChild(y),y.select(),document.execCommand("copy"),document.body.removeChild(y)}d(!0),c(!1),window.setTimeout(()=>d(!1),1500)}catch(y){console.error("Failed to copy:",y)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[l&&o.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),o.jsxs("div",{ref:p,className:"relative",children:[o.jsx("button",{onClick:()=>c(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&o.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${m?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:g,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{f(!0),c(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"Inspect"]})]})]})]}),r&&o.jsx(aT,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function cT({message:e}){const[r,i]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",f=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[f]??"injected",p=f==="workflow"||f==="subagent";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${p?"":"cursor-pointer"}`,style:{backgroundColor:c},onClick:()=>!p&&i(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!p&&i(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!p&&i(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),p&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${c}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(ln,{isOpen:r,onClose:()=>i(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f,")"]})]}),o.jsx("div",{className:"h-full min-h-96",children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function uT({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",c=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&o.jsx(lT,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-white"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(sT,{attachments:e.attachments,messageId:e.id})]})]})}const r0=P.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",u=r.role==="assistant",f=r.role==="system",l=r.role==="tool";if(u)return o.jsx(af,{message:r,showStats:i});if(f&&r.isCompacted)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[o.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),o.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
|
|
137
|
-
`,"")})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const d=JSON.parse(r.content);return o.jsx(iT,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(rT,{data:d})}catch{}return r.messageKind==="context-reset"?o.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{children:r.content}),o.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?o.jsx(cT,{message:r}):c?o.jsx(uT,{message:r,promptContext:s}):o.jsx("div",{className:"flex justify-start feed-item",children:o.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:o.jsx(zi,{content:r.content})})})}),i0=(e,r)=>{const i=P.useRef(!0),[s,c]=P.useState(!0),u=()=>{const f=e.current;f&&(f.scrollTop=f.scrollHeight)};return P.useEffect(()=>{const f=e.current;if(!f)return;const l=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{f.scrollHeight-f.scrollTop-f.offsetHeight<100&&(i.current=!0,c(!0))}));return}i.current=!1,c(!1)},d=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),p=setInterval(()=>{i.current&&u()},1e3);return f.addEventListener("wheel",l,{passive:!0}),d.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>{f.removeEventListener("wheel",l),d.disconnect(),clearInterval(p)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,c(!0),u()},isAutoScrollActive:s,setAutoScroll:f=>{i.current=f,c(f),f&&u()}}},dT={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function hT(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function Kv(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function fT({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:c}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:Kv(u,c),children:[Ll(r),"/",Ll(i)]}),o.jsxs("span",{className:Kv(u,c),children:["(",u,"%)"]}),o.jsx(Mb,{percent:u,dangerZone:c,size:"sm"}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const pT=P.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:c}){const u=P.useRef(null),f=P.useRef(null),[l,d]=P.useState(!1),p=Wt(A=>A.defaults),g=Wt(A=>A.userItems),m=[...p,...g],y=Ee(A=>A.subAgentContextStates[s]),{isAutoScrollActive:_,setAutoScroll:k}=i0(f,null);P.useEffect(()=>{c||k(!0)},[c]);const C=P.useCallback(()=>{const A=!l;d(A),A&&setTimeout(()=>{var N;(N=u.current)==null||N.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),v=m.find(A=>A.id===i),b=(v==null?void 0:v.name)??dT[i]??i,x=zl(m,i),S=hT(x),j=r.filter(A=>A.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:S,children:[o.jsx("span",{className:"text-xs font-medium",children:b}),o.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:y&&o.jsx(fT,{contextState:y})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>k(!_),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${_?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:C,children:[l?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:f,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:j.map(A=>A.role==="assistant"?o.jsx(af,{message:A,showStats:!0},A.id):o.jsx(r0,{message:A,isLastAssistantMessage:!1},A.id))})]})});function mT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function gT({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsxs(_b,{isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),o.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(l=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:l},l)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function Xv({title:e,agents:r,subagents:i,isBuiltIn:s,onView:c,onDuplicate:u,onEdit:f,onDelete:l}){if(r.length===0&&i.length===0)return null;const d=p=>o.jsx(gT,{agent:p,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>c(p.id),onEdit:s?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:s?void 0:()=>l==null?void 0:l(p.id)},p.id);return o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),o.jsxs("div",{className:"space-y-2",children:[r.map(d),i.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),o.jsx("div",{className:"space-y-2",children:i.map(d)})]})]})]})}function xT({isOpen:e,onClose:r,initialEditId:i}){const s=Wt(pe=>pe.defaults),c=Wt(pe=>pe.userItems),u=Wt(pe=>pe.loading),f=Wt(pe=>pe.fetchAgents),l=Wt(pe=>pe.fetchAgent),d=Wt(pe=>pe.fetchDefaultContent),p=Wt(pe=>pe.createAgent),g=Wt(pe=>pe.updateAgent),m=Wt(pe=>pe.deleteAgent),[y,_]=P.useState("list"),[k,C]=P.useState(null),[v,b]=P.useState(!1),[x,S]=P.useState(""),[j,A]=P.useState(""),[N,D]=P.useState(""),[T,I]=P.useState(!0),[H,V]=P.useState([]),[Y,q]=P.useState("#6b7280"),[O,U]=P.useState(""),[z,X]=P.useState(""),[Q,M]=P.useState(!1),[L,B]=P.useState([]);function W(pe){const Ne=new Map;for(const Oe of pe){const lt=Oe.indexOf(":");if(lt===-1)Ne.set(Oe,new Set);else{const ue=Oe.slice(0,lt),Te=Oe.slice(lt+1).split(",").filter(Boolean);Ne.set(ue,new Set(Te))}}return Ne}function F(pe){const Ne=[];for(const[Oe,lt]of pe)lt.size===0?Ne.push(Oe):Ne.push(`${Oe}:${[...lt].join(",")}`);return Ne}const re=W(H),Z=(pe,Ne)=>{const Oe=new Map(re),lt=Oe.get(pe)||new Set,ue=new Set(lt);ue.has(Ne)?ue.delete(Ne):ue.add(Ne),ue.size===0?Oe.set(pe,new Set):Oe.set(pe,ue),V(F(Oe))},ee=pe=>{const Ne=new Map(re);Ne.has(pe)?Ne.delete(pe):Ne.set(pe,new Set),V(F(Ne))},K=pe=>{S(pe.metadata.name),A(pe.metadata.id),D(pe.metadata.description),I(pe.metadata.subagent),V(pe.metadata.allowedTools),q(pe.metadata.color??"#6b7280"),U(pe.prompt),X("")},$=(pe,Ne,Oe)=>{S(pe.metadata.name+" (copy)"),A(`${Ne}-copy-${Date.now()}`),D(pe.metadata.description),I(pe.metadata.subagent),V(pe.metadata.allowedTools),q(pe.metadata.color??"#6b7280"),U(pe.prompt),X(""),C(null),b(!1),_("edit")},ae=(pe,Ne)=>{K(pe),C(Ne),b(!0),_("edit")};P.useEffect(()=>{e&&(f(),Ce("/api/tools").then(pe=>pe.json()).then(pe=>B(pe.tools||[])).catch(()=>B([])),i?s.some(Ne=>Ne.id===i)?d(i).then(Ne=>{Ne&&$(Ne,i)}):l(i).then(Ne=>{Ne&&(K(Ne),C(i),b(!1),_("edit"))}):(_("list"),C(null),b(!1)))},[e,f,l,d,i]);const ne=async pe=>{if(s.some(Oe=>Oe.id===pe)){const Oe=await d(pe);if(!Oe)return;ae(Oe,pe)}else{const Oe=await l(pe);if(!Oe)return;ae(Oe,pe)}},ve=async pe=>{const Ne=await d(pe);Ne&&$(Ne,pe)},be=()=>{C(null),S(""),A(""),D(""),I(!0),V(["read_file"]),q("#6b7280"),U(""),X(""),b(!1),_("edit")},Ae=async pe=>{const Ne=await l(pe);Ne&&(K(Ne),C(pe),b(!1),_("edit"))},Me=async pe=>{await m(pe)},Ie=async()=>{const pe=k??j;if(!pe||!x||!O){X("Name and prompt are required.");return}M(!0),X("");const Ne={metadata:{id:pe,name:x,description:N,subagent:T,allowedTools:H,color:Y},prompt:O},Oe=k?await g(k,Ne):await p(Ne);if(M(!1),!Oe.success){X(Oe.error??"Failed to save agent.");return}i?r():_("list")},Fe=()=>{i?r():(_("list"),b(!1))},ke=pe=>{S(pe),k||A(mT(pe))},ge=s.filter(pe=>pe.subagent),je=s.filter(pe=>!pe.subagent),We=c.filter(pe=>pe.subagent),Lt=c.filter(pe=>!pe.subagent);return y==="edit"?o.jsx(ln,{isOpen:e,onClose:Fe,title:v?`${x}`:k?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[z&&o.jsx(kh,{message:z}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Name",value:x,onChange:ke,placeholder:"My Agent",readOnly:v}),o.jsx(Ai,{label:"ID",value:j,onChange:A,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:v}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>!v&&I(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!v&&I(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${v?"pointer-events-none opacity-60":""}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:Y,onChange:pe=>!v&&q(pe.target.value),disabled:v,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(pe=>{const Ne=re.has(pe.name),Oe=pe.actions.length>0,lt=re.get(pe.name)||new Set,ue=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:pe.name}),Oe&&o.jsx("span",{className:`text-[10px] ${Ne&<.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},pe.name);return Oe?v?o.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[o.jsx("span",{children:pe.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},pe.name):o.jsx(eo,{trigger:ue,minWidth:"160px",items:[...pe.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${pe.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${pe.name}-${_e}`,checked:lt.has(_e),onChange:()=>Z(pe.name,_e),disabled:v,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:Ne?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Ne)ee(pe.name);else{const _e=new Map(re);_e.set(pe.name,new Set(pe.actions)),V(F(_e))}}}]},pe.name):o.jsx("button",{onClick:()=>!v&&ee(pe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:pe.name})},pe.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:O,onChange:pe=>!v&&U(pe.target.value),readOnly:v,placeholder:"Instructions for this agent...",className:`flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary ${v?"opacity-60":""}`})]}),o.jsx(US,{onCancel:Fe,onSave:Ie,saving:Q,saveDisabled:!x||!O||v}),v&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(st,{variant:"primary",onClick:()=>{S(x+" (copy)"),A(`${k}-copy-${Date.now()}`),C(null),b(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(ln,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsx(Xv,{title:"Built-in",agents:je,subagents:ge,isBuiltIn:!0,onView:ne,onDuplicate:ve}),c.length>0&&o.jsx(Xv,{title:"Custom",agents:Lt,subagents:We,isBuiltIn:!1,onView:ne,onDuplicate:ve,onEdit:Ae,onDelete:Me})]})]})}function vT(){const e=Ee(b=>{var x;return(x=b.currentSession)==null?void 0:x.mode}),r=Ee(b=>b.switchMode),i=Wt(b=>b.defaults),s=Wt(b=>b.userItems),c=Wt(b=>b.fetchAgents),u=[...i,...s],[f,l]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),y=P.useRef(null);if(P.useEffect(()=>{c()},[c]),P.useEffect(()=>{function b(x){y.current&&!y.current.contains(x.target)&&l(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]),!e)return null;const _=u.filter(b=>!b.subagent),k=_.find(b=>b.id===e),C=(k==null?void 0:k.name)??e,v=zl(u,e);return o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{type:"button",onClick:()=>l(!f),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:v},children:C}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${f?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&_.length>0&&o.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[_.map(b=>{const x=b.id===e,S=zl(u,b.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${x?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{x||r(b.id),l(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:S},children:b.name}),x&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:j=>{j.stopPropagation(),l(!1),m(b.id),p(!0)}})]},b.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{l(!1),p(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),o.jsx(xT,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function bT(){const e=Ee(s=>s.currentSession),r=Ee(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function yT({question:e}){const r=Ee(p=>p.answerQuestion),i=P.useRef(null),s=P.useRef(null),[c,u]=P.useState(""),f=P.useCallback(p=>{p.key},[]);P.useEffect(()=>{var p;return s.current=document.activeElement,(p=i.current)==null||p.focus(),document.body.style.overflow="hidden",()=>{var g;(g=s.current)==null||g.focus(),document.body.style.overflow=""}},[]),P.useEffect(()=>(document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)),[f]);const l=()=>{r(e.callId,c)},d=p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),l())};return ql.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),o.jsxs("div",{ref:i,tabIndex:-1,className:"relative w-full max-w-[90vw] md:max-w-md bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]",children:[o.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.592.115-1.207.532-1.207 1.093 0 .56.41.978 1.002 1.093 1.728.332 3.006 1.507 3.006 2.907 0 1.657-1.79 3-4 3-1.742 0-3.223-.835-3.772-2m-3.772 2v-2m1.772-12h1.594l1.414 1.414M3 12h.01M21 12h.01M12 3v2m0 14v2M3 6h.01M21 6h.01M3 18h.01M21 18h.01"})}),o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),o.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:c,onChange:p=>u(p.target.value),onKeyDown:d,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[o.jsx(st,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(st,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})]}),document.body)}function _T(){const e=Ee(s=>s.connectionStatus),r=Ee(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
|
|
137
|
+
[`)&&!y.startsWith("[")).map((y,_)=>{const k=y.match(/^(\d+): /);return o.jsx("div",{className:"leading-[1.5rem]",children:k?k[1]:_+1},_)})}),o.jsx("div",{className:"min-w-0 overflow-x-hidden py-0.5",children:o.jsx(Qa,{code:m,language:l,variant:"block"})})]})})}),I5={error:{icon:"✗",color:"text-accent-error",bg:"bg-red-500/10",border:"border-red-500/30"},warning:{icon:"⚠",color:"text-accent-warning",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},info:{icon:"ℹ",color:"text-accent-info",bg:"bg-blue-500/10",border:"border-blue-500/30"},hint:{icon:"💡",color:"text-text-muted",bg:"bg-gray-500/10",border:"border-gray-500/30"}},Wv=P.memo(function({diagnostics:r}){if(r.length===0)return null;const i=r.filter(u=>u.severity==="error"),s=r.filter(u=>u.severity==="warning"),c=r.filter(u=>u.severity==="info"||u.severity==="hint");return o.jsxs("div",{className:"rounded border border-border overflow-hidden mt-2",children:[o.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-bg-tertiary border-b border-border",children:[o.jsx("span",{className:"text-xs font-medium text-text-secondary",children:"LSP Diagnostics"}),i.length>0&&o.jsxs("span",{className:"text-xs text-accent-error font-medium",children:[i.length," error",i.length!==1?"s":""]}),s.length>0&&o.jsxs("span",{className:"text-xs text-accent-warning font-medium",children:[s.length," warning",s.length!==1?"s":""]}),c.length>0&&o.jsxs("span",{className:"text-xs text-text-muted",children:[c.length," info"]})]}),o.jsx("div",{className:"max-h-48 overflow-y-auto",children:r.map((u,f)=>{const l=I5[u.severity];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${l.bg} border-b border-border last:border-b-0`,children:[o.jsx("span",{className:`${l.color} text-xs flex-shrink-0 w-4 text-center`,children:l.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["Ln ",u.range.start.line+1,":",u.range.start.character+1]}),u.code&&o.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:["[",u.code,"]"]})]}),o.jsx("div",{className:"text-xs text-text-primary break-words",children:u.message})]})]},f)})})]})}),z5=P.memo(function({command:r,timeout:i,startedAt:s,streamingOutput:c,status:u,result:f,error:l,durationMs:d}){const p=P.useRef(null),[g,m]=P.useState(0);P.useEffect(()=>{p.current&&u==="pending"&&(p.current.scrollTop=p.current.scrollHeight)},[c,u]),P.useEffect(()=>{if(u!=="pending"||!s)return;const C=setInterval(()=>{m(Date.now()-s)},100);return()=>clearInterval(C)},[u,s]);const y=i/1e3,_=u==="pending"?g/1e3:(d??0)/1e3,k=u==="pending"?(c==null?void 0:c.map(C=>C.content).join(""))??"":f??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs flex-1 min-w-0",children:[o.jsx("span",{className:"text-text-muted flex-shrink-0",children:"$"}),o.jsx("code",{className:"text-text-primary break-all",children:r})]}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted flex-shrink-0",children:[u==="pending"&&o.jsx("span",{className:"animate-pulse text-accent-warning",children:"running"}),u==="interrupted"&&o.jsx("span",{className:"text-red-400",children:"interrupted"}),o.jsxs("span",{className:u==="pending"?"text-text-secondary":"text-text-muted",children:[_.toFixed(1),"s / ",y,"s"]})]})]}),u==="pending"&&o.jsx("div",{className:"h-1 bg-bg-tertiary rounded overflow-hidden",children:o.jsx("div",{className:"h-full bg-accent-warning transition-all duration-100",style:{width:`${Math.min(100,g/i*100)}%`}})}),(k||u==="pending")&&o.jsx("pre",{ref:p,className:`text-xs bg-bg-primary p-2 rounded max-h-64 overflow-y-auto ${u==="pending"?"border border-accent-warning/30":""}`,style:{overflowX:"hidden",whiteSpace:"normal"},children:u==="pending"&&c?c.map((C,v)=>o.jsx("span",{className:C.stream==="stderr"?"text-accent-warning":"",children:Ga(C.content)},v)):Ga(k)}),u==="error"&&l&&o.jsx("div",{className:"text-xs text-accent-error bg-accent-error/10 p-2 rounded",children:l}),u!=="pending"&&d!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",(d/1e3).toFixed(2),"s"]})]})});function H5(e){switch(e){case"sensitive_file":return{title:"Sensitive File Access",description:"Accessing files that may contain secrets"};case"both":return{title:"Sensitive File Access",description:"Accessing sensitive files outside project"};case"dangerous_command":return{title:"Dangerous Command",description:"Running potentially dangerous command"};case"outside_workdir":default:return{title:"Path Access Request",description:"Accessing paths outside project directory"}}}function P5({confirmation:e}){const r=Ee(g=>g.confirmPath),i=Ee(g=>g.currentSession),s=Ee(g=>g.switchDangerLevel),{title:c,description:u}=H5(e.reason),f=e.reason==="sensitive_file"||e.reason==="both",l=f?"border-red-500/50":"border-amber-500/50",d=f?"bg-red-500/10":"bg-amber-500/10",p=()=>{i!=null&&i.id&&s("dangerous"),r(e.callId,!0,!1)};return o.jsxs("div",{className:`border ${l} ${d} rounded p-3 my-2`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:`w-4 h-4 ${f?"text-red-400":"text-amber-400"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:`text-sm font-medium ${f?"text-red-400":"text-amber-400"}`,children:c}),o.jsx("div",{className:"text-xs text-text-muted",children:u})]})]}),o.jsxs("div",{className:"text-xs text-text-muted mb-2",children:[o.jsx("span",{className:"font-medium",children:e.tool})," ","wants to access:"]}),o.jsx("div",{className:"bg-bg-primary rounded p-2 mb-3 max-h-24 overflow-y-auto",children:o.jsx("ul",{className:"space-y-0.5",children:e.paths.map((g,m)=>o.jsx("li",{className:`text-xs font-mono ${f?"text-red-300":"text-amber-300"} break-all`,children:g},m))})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>r(e.callId,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-bg-tertiary hover:bg-bg-tertiary/80 text-text-secondary border border-border transition-colors",children:"Deny"}),o.jsx("button",{onClick:()=>r(e.callId,!0,!1),className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-accent-primary hover:bg-accent-primary/80 text-white transition-colors",children:"Allow"}),o.jsx("button",{onClick:p,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded bg-red-600 hover:bg-red-700 text-white transition-colors",title:"Enable dangerous mode and allow this request",children:"Allow Everything"})]})]})}function F5(e,r){if(e==="read_file"){const s=String(r.path??""),c=r.offset,u=r.limit,f=[];return c!==void 0&&c!==1&&f.push(`offset=${c}`),u!==void 0&&f.push(`limit=${u}`),f.length>0?`${s} [${f.join(", ")}]`:s}if(e==="write_file"||e==="edit_file")return String(r.path??"");if(e==="run_command"||e==="bash")return String(r.command??"");if(e==="return_value"){const s=String(r.content??"");return s.length>60?s.slice(0,60)+"...":s}const i=JSON.stringify(r);return i.length>50?i.slice(0,50)+"...":i}function Gv(e,r,i){return F5(e,r)}function U5(e){return JSON.stringify(e,null,2)}const $5={pending:{icon:"●",color:"text-accent-warning",animate:!0},success:{icon:"✓",color:"text-accent-success",animate:!1},error:{icon:"✗",color:"text-accent-error",animate:!1},interrupted:{icon:"✗",color:"text-red-400",animate:!1}},q5=P.memo(function({tool:r,args:i,status:s,variant:c="compact",result:u,error:f,durationMs:l,diagnostics:d,editContext:p,startedAt:g,streamingOutput:m,metadata:y,callId:_}){const k=r==="edit_file"||r==="write_file",C=r==="run_command"&&s==="pending",v=r==="read_file",b=r==="return_value",[x,S]=P.useState(k||C||b),j=$5[s],A=Ee(D=>D.pendingPathConfirmation),N=s==="pending"&&A&&_&&A.callId===_?A:null;return c==="compact"?o.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-bg-tertiary rounded px-2 py-1.5",children:[o.jsx(Jy,{tool:r}),o.jsx("span",{className:"text-accent-primary font-medium",children:r}),o.jsx("span",{className:"text-text-muted truncate flex-1",children:Gv(r,i)}),o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:s==="pending"?"...":"done"})]}):o.jsxs("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0",children:[o.jsxs("button",{className:"w-full flex items-center gap-1.5 p-2 bg-bg-tertiary hover:bg-bg-tertiary/80 text-left",onClick:()=>S(!x),children:[o.jsx("span",{className:`${j.color} ${j.animate?"animate-pulse":""}`,children:j.icon}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsx("span",{className:"text-text-muted text-xs flex-1 truncate",children:Gv(r,i)}),o.jsx("span",{className:"text-text-muted text-xs",children:x?"▼":"▶"})]}),N&&o.jsx(P5,{confirmation:N}),(x||v)&&o.jsxs("div",{className:"p-2 bg-bg-secondary border-t border-border space-y-2 min-w-0",children:[r==="run_command"&&o.jsx(z5,{command:String(i.command??""),timeout:i.timeout??12e4,startedAt:g,streamingOutput:m,status:s,result:u,error:f,durationMs:l}),r==="edit_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[p&&p.regions.length>0?o.jsx(L5,{regions:p.regions,filePath:String(i.path??"")}):o.jsx(A5,{oldString:String(i.old_string??""),newString:String(i.new_string??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Wv,{diagnostics:d})]}),r==="write_file"&&s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(D5,{content:String(i.content??""),filePath:String(i.path??"")}),d&&d.length>0&&o.jsx(Wv,{diagnostics:d})]}),r==="read_file"&&s==="success"&&o.jsx(B5,{result:u,metadata:y,filePath:String(i.path??""),heightExpanded:x}),r==="return_value"&&(()=>{const D=(m==null?void 0:m.map(I=>I.content).join(""))??"",T=s==="pending"&&D?D:String(i.content??"");return o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-primary font-medium mb-1 uppercase tracking-wide",children:"Sub-Agent Summary"}),o.jsx("div",{className:"text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:T})})]})})(),r!=="edit_file"&&r!=="write_file"&&r!=="run_command"&&r!=="read_file"&&r!=="return_value"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-text-muted mb-0.5",children:"Arguments:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto",children:U5(i)})]}),s==="success"&&u!==void 0&&o.jsxs("div",{children:[o.jsxs("div",{className:"text-[10px] text-text-muted mb-0.5",children:["Result",l!==void 0&&` (${l}ms)`,":"]}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded overflow-x-auto max-h-32",children:u||"No output"})]})]}),s==="success"&&(r==="edit_file"||r==="write_file"||r==="read_file")&&l!==void 0&&o.jsxs("div",{className:"text-[10px] text-text-muted",children:["Completed in ",l,"ms"]}),s==="error"&&f&&r!=="run_command"&&o.jsxs("div",{children:[o.jsx("div",{className:"text-[10px] text-accent-error mb-0.5",children:"Error:"}),o.jsx("pre",{className:"text-xs bg-bg-primary p-1.5 rounded text-accent-error",children:f})]})]})]})}),W5={read_file:"Reading file",write_file:"Writing file",edit_file:"Editing file",run_command:"Running command",glob:"Searching files",grep:"Searching content",ask_user:"Asking user",criterion:"Managing criterion",todo_write:"Updating tasks"};function G5(e){return W5[e]??`Preparing ${e}`}const V5=P.memo(function({name:r}){const i=G5(r);return o.jsx("div",{className:"border border-border rounded overflow-hidden my-1 min-w-0 animate-pulse",children:o.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-bg-tertiary",children:[o.jsx("span",{className:"text-accent-warning animate-pulse",children:"..."}),o.jsx(Jy,{tool:r}),o.jsx("span",{className:"font-mono text-accent-primary text-sm",children:r}),o.jsxs("span",{className:"text-text-muted text-xs flex-1",children:[i,"..."]})]})})}),Y5={pending:{icon:"○",color:"text-text-muted"},in_progress:{icon:"●",color:"text-accent-warning",animate:!0},completed:{icon:"✓",color:"text-accent-success"}},K5=P.memo(function({todos:r}){return Array.isArray(r)?r.length===0?o.jsx("div",{className:"text-xs text-text-muted italic my-1",children:"No tasks"}):o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Tasks"})}),o.jsx("div",{children:r.map((i,s)=>{const c=Y5[i.status];return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${s>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${(c==null?void 0:c.color)??"text-text-muted"} ${c!=null&&c.animate?"animate-pulse":""} text-sm leading-tight`,children:(c==null?void 0:c.icon)??"○"}),o.jsx("span",{className:`text-sm leading-tight ${i.status==="completed"?"text-text-muted":"text-text-primary"}`,children:i.content})]},s)})})]}):o.jsx("div",{className:"text-xs text-accent-warning italic my-1",children:"⚠️ Invalid todos data"})}),Vv={add:{icon:"○",color:"text-text-muted"},update:{icon:"○",color:"text-text-muted"},remove:{icon:"○",color:"text-text-muted"},complete:{icon:"◉",color:"text-purple-400"},pass:{icon:"✓",color:"text-accent-success"},fail:{icon:"✗",color:"text-accent-error"},get:{icon:"○",color:"text-text-muted"}},n0=P.memo(function({toolCalls:r,criteria:i}){if(r.length===0)return null;const s=new Map((i==null?void 0:i.map(u=>[u.id,u]))??[]),c=r.find(u=>{var f,l;return u.arguments.action==="get"&&((f=u.result)==null?void 0:f.success)&&((l=u.result)==null?void 0:l.output)});return o.jsxs("div",{className:"my-1 rounded border border-border bg-bg-tertiary overflow-hidden",children:[o.jsx("div",{className:"px-2 py-1.5 border-b border-border bg-bg-secondary",children:o.jsx("span",{className:"text-xs font-medium text-text-muted",children:"Acceptance Criteria"})}),o.jsx("div",{children:c?(()=>{const u=c.result.output;if(u==="No criteria defined yet.")return o.jsxs("div",{className:"flex items-start gap-2 px-2 py-1.5",children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0 text-text-muted text-sm",children:"No criteria defined yet."})]});try{return JSON.parse(u).map((l,d)=>o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${d>0?"border-t border-border":""}`,children:[o.jsx("span",{className:"text-text-muted text-sm leading-tight flex-shrink-0",children:"○"}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsx(zi,{content:`[${l.id}] ${l.description}`})})]},l.id??d))}catch{return r.map((f,l)=>o.jsx(Yv,{tc:f,index:l,criteriaMap:s},f.id??l))}})():r.map((u,f)=>o.jsx(Yv,{tc:u,index:f,criteriaMap:s},u.id??f))})]})});function Yv({tc:e,index:r,criteriaMap:i}){const s=e.arguments.action,c=s&&Vv[s]?Vv[s]:{icon:"○",color:"text-text-muted"},u=e.arguments,f=s==="remove",l=u.id,d=u.description,p=l?i.get(l):void 0,g=d??(p==null?void 0:p.description)??(f&&l?`[${l}]`:"Criterion updated"),m=u.reason,y=s==="fail";return o.jsxs("div",{className:`flex items-start gap-2 px-2 py-1.5 ${r>0?"border-t border-border":""}`,children:[o.jsx("span",{className:`${c.color} text-sm leading-tight flex-shrink-0`,children:c.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:f?"line-through text-text-muted":"",children:o.jsx(zi,{content:g})}),m&&o.jsxs("div",{className:`mt-1 text-sm ${y?"text-accent-error":"text-text-muted"}`,children:[o.jsx("span",{className:"text-text-muted",children:"└ "}),'"',m,'"']})]})]})}function X5(e){return e==="criterion"}const Z5="#6b7280";function zl(e,r){var i;return((i=e.find(s=>s.id===r))==null?void 0:i.color)??Z5}const Wt=Wn(e=>{const r=async()=>{await _h("/api/agents",e)};return{defaults:[],userItems:[],loading:!1,fetchAgents:r,fetchAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/agents/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createAgent:async i=>{const s=await si("POST","/api/agents",i);return s.success&&await r(),s},updateAgent:async(i,s)=>{const c=await si("PUT",`/api/agents/${i}`,s);return c.success&&await r(),c},deleteAgent:async i=>{try{const s=await Ce(`/api/agents/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateAgent:async i=>{try{const s=await Ce(`/api/agents/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}});function Q5(e){const r=[];let i=[];const s=()=>{i.length>0&&(r.push({type:"criteria_group",toolCalls:i}),i=[])};for(const c of e)c.type==="tool_call"&&X5(c.toolCall.name)?i.push(c.toolCall):(s(),r.push(c));return s(),r}function J5(e,r){if(e.segments&&e.segments.length>0)return eT(e.segments,e.toolCalls??[],e.preparingToolCalls??[],e.stats,r);const i=[];if(e.thinkingContent&&i.push({type:"thinking",content:e.thinkingContent}),e.content&&i.push({type:"text",content:e.content}),e.toolCalls)for(const s of e.toolCalls)i.push({type:"tool_call",toolCall:s});if(e.preparingToolCalls)for(const s of e.preparingToolCalls)i.push({type:"preparing_tool_call",preparing:s});return r&&e.stats&&i.push({type:"stats",stats:e.stats}),i}function eT(e,r,i,s,c){const u=[],f=new Map(r.map(l=>[l.id,l]));for(const l of e)switch(l.type){case"text":u.push({type:"text",content:l.content});break;case"thinking":l.content&&l.content.trim().length>0&&u.push({type:"thinking",content:l.content});break;case"tool_call":{const d=f.get(l.toolCallId);d&&u.push({type:"tool_call",toolCall:d});break}}for(const l of i)u.push({type:"preparing_tool_call",preparing:l});return c&&s&&u.push({type:"stats",stats:s}),u}const af=P.memo(function({message:r,showStats:i=!0}){const s=Ee(p=>{var g;return(g=p.currentSession)==null?void 0:g.criteria}),c=Wt(p=>p.defaults),u=Wt(p=>p.userItems),f=[...c,...u],l=J5(r,i),d=Q5(l);return d.length===0?null:o.jsx("div",{className:"feed-item",children:o.jsxs("div",{className:"min-w-0",children:[d.map((p,g)=>{var m,y;switch(p.type){case"thinking":return o.jsx(k5,{content:p.content},g);case"text":return o.jsx("div",{className:"prose prose-sm prose-invert max-w-none",children:o.jsx(zi,{content:p.content})},g);case"preparing_tool_call":return o.jsx(V5,{name:p.preparing.name},`preparing-${p.preparing.index}`);case"tool_call":{const _=p.toolCall,k=_.result;if(_.name==="todo_write"){const b=_.arguments.todos,x=Array.isArray(b)?b:[];return o.jsx(K5,{todos:x},g)}const C=(m=k==null?void 0:k.output)==null?void 0:m.includes("[interrupted by user]"),v=k?C?"interrupted":k.success?"success":"error":"pending";return o.jsx(q5,{tool:_.name,args:_.arguments,status:v,variant:"expandable",result:k==null?void 0:k.output,error:k==null?void 0:k.error,durationMs:k==null?void 0:k.durationMs,diagnostics:k==null?void 0:k.diagnostics,editContext:k==null?void 0:k.editContext,startedAt:_.startedAt,streamingOutput:_.streamingOutput,metadata:k==null?void 0:k.metadata,callId:_.id},g)}case"criteria_group":return o.jsx(n0,{toolCalls:p.toolCalls,criteria:s},g);case"stats":{const _=p.stats,k=((y=_.model.split("/").pop())==null?void 0:y.split("-").slice(0,2).join("-"))??_.model,C=zl(f,_.mode),v=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toString(),b=x=>x>=1e3?`${(x/1e3).toFixed(1)}k`:x.toFixed(1);return o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted mt-3",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:"text-text-secondary",children:k}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsx("span",{style:{color:C},children:_.mode}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_.totalTime.toFixed(1),"s"]}),_.toolTime>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[_.toolTime.toFixed(1),"s tools"]})]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[v(_.prefillTokens)," @ ",b(_.prefillSpeed)," pp"]}),o.jsx("span",{className:"text-text-muted",children:"·"}),o.jsxs("span",{children:[v(_.generationTokens)," @ ",b(_.generationSpeed)," tg"]}),o.jsx("span",{className:"flex-1 h-px bg-border"})]},g)}}}),r.partial&&o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-warning mt-1",children:[o.jsx("svg",{className:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),o.jsx("span",{children:"Aborted"})]})]})})}),Dt=Wn((e,r)=>({defaults:[],userItems:[],activeWorkflowId:"default",loading:!1,templateVariables:[],fetchTemplateVariables:async()=>{try{const s=await(await Ce("/api/workflows/template-variables")).json();e({templateVariables:s.variables??[]})}catch{}},fetchWorkflows:async()=>{e({loading:!0});try{const s=await(await Ce("/api/workflows")).json();e({defaults:s.defaults??[],userItems:s.userItems??[],activeWorkflowId:s.activeWorkflowId??"default",loading:!1})}catch{e({loading:!1})}},fetchWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/workflows/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createWorkflow:async i=>{const s=await si("POST","/api/workflows",i);return s.success&&await r().fetchWorkflows(),s},updateWorkflow:async(i,s)=>{const c=await si("PUT",`/api/workflows/${i}`,s);return c.success&&await r().fetchWorkflows(),c},deleteWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateWorkflow:async i=>{try{const s=await Ce(`/api/workflows/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchWorkflows(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function Hl(e,r){const i=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),c=parseInt(e.slice(5,7),16);return`rgba(${i},${s},${c},${r})`}function tT(e){if(e<60)return`${e}s`;const r=Math.floor(e/60),i=Math.round(e%60);return i>0?`${r}m ${i}s`:`${r}m`}function nT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const rT=P.memo(function({data:r}){var f;const i=Dt(l=>l.defaults),s=Dt(l=>l.userItems),u=((f=[...i,...s].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#8b949e";return o.jsxs("div",{className:"feed-item rounded p-3 border",style:{borderColor:Hl(u,.3),backgroundColor:Hl(u,.08)},children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:u,viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName??"Task Completed"})]}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2",children:[o.jsx(Ia,{label:"Iterations",value:String(r.iterations)}),o.jsx(Ia,{label:"Total time",value:tT(r.totalTimeSeconds)}),o.jsx(Ia,{label:"Tool calls",value:String(r.totalToolCalls)}),o.jsx(Ia,{label:"Tokens",value:nT(r.totalTokensGenerated)}),o.jsx(Ia,{label:"Speed",value:r.avgGenerationSpeed>0?`${r.avgGenerationSpeed} tok/s`:"-"})]})]})});function Ia({label:e,value:r}){return o.jsxs("div",{className:"bg-bg-primary/50 rounded px-2 py-1",children:[o.jsx("div",{className:"text-sm text-text-muted",children:e}),o.jsx("div",{className:"text-sm text-text-primary font-medium",children:r})]})}const iT=P.memo(function({data:r}){var f;const i=Dt(l=>l.defaults),s=Dt(l=>l.userItems),u=((f=[...i,...s].find(l=>l.id===r.workflowId))==null?void 0:f.color)??r.workflowColor??"#6b7280";return o.jsxs("div",{className:"feed-item flex items-center gap-2 px-3 py-2 rounded border",style:{borderColor:Hl(u,.3),backgroundColor:Hl(u,.08)},children:[o.jsx("svg",{className:"w-3 h-3 shrink-0",fill:u,viewBox:"0 0 24 24",children:o.jsx("path",{d:"M8 5v14l11-7z"})}),o.jsx("span",{className:"text-sm font-medium",style:{color:u},children:r.workflowName}),o.jsx("span",{className:"text-text-muted text-sm",children:"started"})]})});function sT({attachments:e,messageId:r}){const[i,s]=P.useState(null),c=Ee(g=>g.visionFallbackByMessage),u=Ee(g=>g.messages),f=P.useMemo(()=>{const g=u.findIndex(m=>m.id===r);if(g===-1)return null;for(let m=g+1;m<u.length;m++){const y=u[m];if(y&&y.role==="assistant")return y.id}return null},[u,r]),l=g=>{s(g)},d=()=>{s(null)},p=g=>{const m=`${r}-${g}`;if(c[m])return c[m];if(f){const y=`${f}-${g}`;return c[y]}return null};return e.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:e.map(g=>{const m=p(g.id);return o.jsxs("div",{className:"relative inline-block",children:[o.jsxs("button",{onClick:()=>l(g.data),className:"group relative inline-block",title:g.filename,disabled:(m==null?void 0:m.type)==="start",children:[o.jsx("img",{src:g.data,alt:g.filename,className:"max-w-[256px] max-h-[256px] object-contain rounded-lg border border-border hover:border-accent-primary transition-colors cursor-pointer"}),(m==null?void 0:m.type)==="start"&&o.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center rounded-lg",children:o.jsx("span",{className:"text-xs text-text-primary animate-pulse",children:"Describing image..."})})]}),(m==null?void 0:m.type)==="done"&&m.description&&o.jsxs("div",{className:"mt-2 p-2 bg-bg-tertiary rounded text-xs text-text-secondary max-w-[256px]",children:[m.description.slice(0,200),m.description.length>200?"...":""]})]},g.id)})}),i&&o.jsx(t0,{src:i,alt:"Attached image",isOpen:!0,onClose:d})]})}function aT({isOpen:e,onClose:r,promptContext:i}){const[s,c]=P.useState({systemPrompt:!1,messages:!0,tools:!0,requestOptions:!0,injectedFiles:!0,userMessage:!0}),u=f=>{c(l=>({...l,[f]:!l[f]}))};return o.jsx(cn,{isOpen:e,onClose:r,title:"Prompt Inspector",size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx(Es,{title:"User Message",expanded:s.userMessage??!0,onToggle:()=>u("userMessage"),children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto",children:i.userMessage||"(empty)"})}),i.messages.length>0&&o.jsx(Es,{title:`Prompt Messages (${i.messages.length})`,expanded:s.messages??!0,onToggle:()=>u("messages"),children:o.jsx("div",{className:"space-y-2",children:i.messages.map((f,l)=>o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-bg-tertiary/50 text-xs text-text-muted",children:[o.jsx("span",{className:"font-mono text-text-primary",children:f.role}),o.jsx("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:f.source}),f.toolCallId&&o.jsx("span",{className:"font-mono",children:f.toolCallId}),f.attachments&&f.attachments.length>0&&o.jsxs("span",{className:"rounded bg-bg-tertiary px-1.5 py-0.5",children:[f.attachments.length," attachment",f.attachments.length===1?"":"s"]})]}),f.attachments&&f.attachments.length>0&&o.jsx("div",{className:"border-b border-border px-3 py-2 text-xs text-text-muted",children:f.attachments.map(d=>d.filename).join(", ")}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded-b p-3 max-h-64 overflow-auto font-mono",children:f.content||"(empty)"})]},`${f.role}-${l}`))})}),o.jsx(Es,{title:`Tools (${i.tools.length})`,expanded:s.tools??!0,onToggle:()=>u("tools"),children:o.jsxs("div",{className:"space-y-2",children:[i.tools.length===0&&o.jsx("div",{className:"text-sm text-text-muted",children:"No tools sent with this request."}),i.tools.map((f,l)=>o.jsxs("div",{className:"bg-bg-tertiary rounded p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("span",{className:"font-mono text-sm text-text-primary",children:f.name}),o.jsx("span",{className:"text-xs text-text-muted",children:"parameters"})]}),o.jsx("div",{className:"text-sm text-text-secondary",children:f.description}),o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-48 overflow-auto font-mono",children:JSON.stringify(f.parameters,null,2)})]},`${f.name}-${l}`))]})}),o.jsx(Es,{title:"Request Options",expanded:s.requestOptions??!0,onToggle:()=>u("requestOptions"),children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-48 overflow-auto font-mono lowercase",children:JSON.stringify(i.requestOptions,null,2)})}),i.injectedFiles.length>0&&o.jsx(Es,{title:`Injected Files (${i.injectedFiles.length})`,expanded:s.injectedFiles??!0,onToggle:()=>u("injectedFiles"),children:o.jsx("div",{className:"space-y-2",children:i.injectedFiles.map((f,l)=>o.jsx(oT,{file:f,expanded:s[`file-${l}`]??!1,onToggle:()=>u(`file-${l}`)},l))})}),o.jsx(Es,{title:"System Prompt",expanded:s.systemPrompt??!1,onToggle:()=>u("systemPrompt"),badge:`${Math.round(i.systemPrompt.length/1e3)}K chars`,children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-3 max-h-96 overflow-auto font-mono",children:i.systemPrompt})})]})})}function oT({file:e,expanded:r,onToggle:i}){return o.jsxs("div",{className:"bg-bg-tertiary rounded overflow-hidden",children:[o.jsxs("button",{onClick:i,className:"w-full flex items-center gap-2 p-2 hover:bg-bg-primary/30 transition-colors",children:[o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${e.source==="global"?"bg-purple-500/20 text-purple-400":e.source==="project"?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"}`,children:e.source}),o.jsx("span",{className:"text-sm text-text-primary font-mono truncate flex-1 text-left",children:e.path}),e.content&&o.jsxs("span",{className:"text-xs text-text-muted",children:[Math.round(e.content.length/1e3),"K chars"]})]}),r&&e.content&&o.jsx("div",{className:"border-t border-border/50 p-2",children:o.jsx("pre",{className:"text-xs text-text-secondary whitespace-pre-wrap max-h-64 overflow-auto font-mono",children:e.content})})]})}function Es({title:e,expanded:r,onToggle:i,badge:s,children:c}){return o.jsxs("div",{className:"border border-border rounded overflow-hidden",children:[o.jsx("button",{onClick:i,className:"w-full flex items-center justify-between p-3 bg-bg-tertiary/50 hover:bg-bg-tertiary transition-colors",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:`w-4 h-4 text-text-muted transition-transform ${r?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),o.jsx("span",{className:"font-medium text-text-primary",children:e}),s&&o.jsx("span",{className:"text-xs text-text-muted bg-bg-tertiary px-1.5 py-0.5 rounded",children:s})]})}),r&&o.jsx("div",{className:"p-3 border-t border-border",children:c})]})}function lT({content:e,promptContext:r,align:i="right"}){const[s,c]=P.useState(!1),[u,f]=P.useState(!1),[l,d]=P.useState(!1),p=P.useRef(null);P.useEffect(()=>{const y=_=>{p.current&&!p.current.contains(_.target)&&c(!1)};return s&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);const g=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{const y=document.createElement("textarea");y.value=e,y.style.position="fixed",y.style.left="-999999px",document.body.appendChild(y),y.select(),document.execCommand("copy"),document.body.removeChild(y)}d(!0),c(!1),window.setTimeout(()=>d(!1),1500)}catch(y){console.error("Failed to copy:",y)}},m=i==="right";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`flex items-start gap-1.5 ${m?"":"order-first"}`,children:[l&&o.jsx("svg",{className:"w-4 h-4 text-accent-success",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),o.jsxs("div",{ref:p,className:"relative",children:[o.jsx("button",{onClick:()=>c(!s),className:"p-1 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary",title:"Message options",children:o.jsxs("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("circle",{cx:"12",cy:"5",r:"2"}),o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}),s&&o.jsxs("div",{className:`absolute top-full mt-1 bg-bg-secondary border border-border rounded shadow-xl z-50 py-1 min-w-36 ${m?"right-0":"left-0"}`,children:[o.jsxs("button",{onClick:g,className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Copy"]}),r&&o.jsxs("button",{onClick:()=>{f(!0),c(!1)},className:"w-full px-3 py-1.5 text-left text-sm text-text-primary hover:bg-bg-tertiary flex items-center gap-2",children:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"Inspect"]})]})]})]}),r&&o.jsx(aT,{isOpen:u,onClose:()=>f(!1),promptContext:r})]})}function cT({message:e}){const[r,i]=P.useState(!1);if(e.messageKind!=="auto-prompt")return null;const s=e.metadata,c=(s==null?void 0:s.color)??"#6b7280",u=(s==null?void 0:s.name)??"Agent",f=(s==null?void 0:s.type)??"agent",d={agent:"definition injected",workflow:"instructions",compaction:"prompt injected",subagent:"instructions"}[f]??"injected",p=f==="workflow"||f==="subagent";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[10px] text-text-muted font-mono mt-3 mb-4",children:[o.jsx("span",{className:"flex-1 h-px bg-border"}),o.jsx("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${p?"":"cursor-pointer"}`,style:{backgroundColor:c},onClick:()=>!p&&i(!0)}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",style:{color:c},onClick:()=>!p&&i(!0),children:u}),o.jsx("span",{children:"·"}),o.jsx("span",{className:p?"":"cursor-pointer hover:text-text-secondary transition-colors",onClick:()=>!p&&i(!0),children:d}),o.jsx("span",{className:"flex-1 h-px bg-border"})]}),p&&o.jsx("div",{className:"flex justify-center feed-item mb-4",children:o.jsx("div",{className:"max-w-[75%] rounded p-3 bg-bg-tertiary/50 text-text-secondary text-sm",style:{borderLeft:`3px solid ${c}`},children:o.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:e.content})})}),o.jsx(cn,{isOpen:r,onClose:()=>i(!1),title:`${u} Prompt`,size:"lg",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:c}}),o.jsx("span",{className:"text-sm text-text-primary font-medium",children:u}),o.jsxs("span",{className:"text-xs text-text-muted",children:["(",f,")"]})]}),o.jsx("div",{className:"h-full min-h-96",children:o.jsx("pre",{className:"text-sm text-text-secondary whitespace-pre-wrap bg-bg-tertiary rounded p-4 h-full min-h-96 overflow-auto font-mono",children:e.content})})]})})]})}function uT({message:e,promptContext:r}){const i=e.messageKind==="auto-prompt",s=e.messageKind==="command",c=e.isSystemGenerated;return o.jsxs("div",{className:"flex justify-end items-start gap-1.5 feed-item",children:[!c&&o.jsx(lT,{content:e.content,promptContext:r,align:"right"}),o.jsxs("div",{className:`max-w-[75%] rounded p-2 ${c?s?"bg-teal-500/10 border border-teal-500/30":i?"bg-slate-500/10 border border-slate-500/30":"bg-amber-500/10 border border-amber-500/30":"bg-accent-primary/15 text-white"}`,children:[c&&o.jsx("span",{className:`text-[10px] block mb-0.5 ${s?"text-teal-400":i?"text-slate-400":"text-amber-400"}`,children:s?"Command":i?"Auto":"System"}),o.jsx("div",{className:`whitespace-pre-wrap text-sm ${c?`${s?"text-teal-200":i?"text-slate-200":"text-amber-200 italic"}`:""}`,children:e.content}),e.attachments&&e.attachments.length>0&&o.jsx(sT,{attachments:e.attachments,messageId:e.id})]})]})}const r0=P.memo(function({message:r,isLastAssistantMessage:i=!1,promptContext:s}){const c=r.role==="user",u=r.role==="assistant",f=r.role==="system",l=r.role==="tool";if(u)return o.jsx(af,{message:r,showStats:i});if(f&&r.isCompacted)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/50 border border-border rounded p-2",children:[o.jsx("div",{className:"text-text-muted text-xs mb-0.5",children:"[Compacted]"}),o.jsx("div",{className:"text-text-secondary text-xs whitespace-pre-wrap",children:r.content.replace(`[COMPACTED HISTORY]
|
|
138
|
+
`,"")})]});if(l)return o.jsxs("div",{className:"feed-item bg-bg-tertiary/30 border-l-2 border-accent-primary rounded-r p-2",children:[o.jsxs("div",{className:"text-accent-primary text-xs mb-0.5",children:["Tool: ",r.toolName]}),o.jsxs("pre",{className:"text-text-secondary text-xs whitespace-pre-wrap overflow-x-auto max-h-32",children:[r.content.slice(0,500),r.content.length>500&&"..."]})]});if(r.messageKind==="workflow-started")try{const d=JSON.parse(r.content);return o.jsx(iT,{data:d})}catch{}if(r.messageKind==="task-completed")try{const d=JSON.parse(r.content);return o.jsx(rT,{data:d})}catch{}return r.messageKind==="context-reset"?o.jsxs("div",{className:"flex items-center gap-4 mb-6 text-text-muted text-xs uppercase tracking-wide",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{children:r.content}),o.jsx("div",{className:"flex-1 border-t border-border"})]}):r.messageKind==="auto-prompt"&&r.isSystemGenerated?o.jsx(cT,{message:r}):c?o.jsx(uT,{message:r,promptContext:s}):o.jsx("div",{className:"flex justify-start feed-item",children:o.jsx("div",{className:"max-w-[75%] rounded p-2 bg-bg-tertiary text-text-primary",children:o.jsx(zi,{content:r.content})})})}),i0=(e,r)=>{const i=P.useRef(!0),[s,c]=P.useState(!0),u=()=>{const f=e.current;f&&(f.scrollTop=f.scrollHeight)};return P.useEffect(()=>{const f=e.current;if(!f)return;const l=g=>{if(g.deltaY>0){requestAnimationFrame(()=>requestAnimationFrame(()=>{f.scrollHeight-f.scrollTop-f.offsetHeight<100&&(i.current=!0,c(!0))}));return}i.current=!1,c(!1)},d=new MutationObserver(()=>{i.current&&requestAnimationFrame(u)}),p=setInterval(()=>{i.current&&u()},1e3);return f.addEventListener("wheel",l,{passive:!0}),d.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>{f.removeEventListener("wheel",l),d.disconnect(),clearInterval(p)}},[r==null?void 0:r.id]),{force_scroll_to_bottom:()=>{i.current=!0,c(!0),u()},isAutoScrollActive:s,setAutoScroll:f=>{i.current=f,c(f),f&&u()}}},dT={verifier:"Verification",code_reviewer:"Code Review",test_generator:"Test Generation",debugger:"Debug"};function hT(e){return{backgroundColor:`${e}20`,color:e,borderColor:`${e}4d`}}function Kv(e,r){return r||e>85?"text-accent-error":e>60?"text-accent-warning":"text-text-muted"}function fT({contextState:e}){const{currentTokens:r,maxTokens:i,compactionCount:s,dangerZone:c}=e,u=Math.round(r/i*100);return o.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[o.jsxs("span",{className:Kv(u,c),children:[Ll(r),"/",Ll(i)]}),o.jsxs("span",{className:Kv(u,c),children:["(",u,"%)"]}),o.jsx(Mb,{percent:u,dangerZone:c,size:"sm"}),c&&o.jsx("span",{className:"text-accent-error animate-pulse",children:"Low!"}),s>0&&o.jsxs("span",{className:"text-text-muted bg-bg-tertiary px-1 rounded",children:[s,"x"]})]})}const pT=P.memo(function({messages:r,subAgentType:i,subAgentId:s,isStreaming:c}){const u=P.useRef(null),f=P.useRef(null),[l,d]=P.useState(!1),p=Wt(A=>A.defaults),g=Wt(A=>A.userItems),m=[...p,...g],y=Ee(A=>A.subAgentContextStates[s]),{isAutoScrollActive:_,setAutoScroll:k}=i0(f,null);P.useEffect(()=>{c||k(!0)},[c]);const C=P.useCallback(()=>{const A=!l;d(A),A&&setTimeout(()=>{var N;(N=u.current)==null||N.scrollIntoView({block:"start",behavior:"smooth"})},220)},[l]),v=m.find(A=>A.id===i),b=(v==null?void 0:v.name)??dT[i]??i,x=zl(m,i),S=hT(x),j=r.filter(A=>A.role!=="tool");return o.jsxs("div",{ref:u,className:"feed-item border border-border rounded overflow-hidden bg-bg-secondary",children:[o.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1 border-b relative",style:S,children:[o.jsx("span",{className:"text-xs font-medium",children:b}),o.jsx("div",{className:"absolute left-1/2 -translate-x-1/2",children:y&&o.jsx(fT,{contextState:y})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{type:"button",className:"text-sm text-text-muted hover:text-text-primary flex items-center gap-1.5",onClick:()=>k(!_),children:[o.jsx("span",{className:`w-1 h-1 rounded-full ${_?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsxs("button",{type:"button",className:"text-[10px] px-1.5 py-0.5 rounded bg-bg-tertiary",onClick:C,children:[l?"▼":"▶"," Expand"]})]})]}),o.jsx("div",{ref:f,className:`${l?"max-h-[calc(100vh-10rem)]":"max-h-80"} overflow-y-auto p-2 transition-[max-height] duration-200`,children:j.map(A=>A.role==="assistant"?o.jsx(af,{message:A,showStats:!0},A.id):o.jsx(r0,{message:A,isLastAssistantMessage:!1},A.id))})]})});function mT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function gT({agent:e,isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f}){return o.jsxs(_b,{isBuiltIn:r,isConfirmingDelete:i,onView:s,onEdit:c,onDuplicate:u,onDelete:f,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color??"#6b7280"}}),o.jsx("span",{className:"text-text-primary text-sm font-medium",children:e.name}),o.jsx("span",{className:"text-text-muted text-xs font-mono",children:e.id}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-bg-primary text-text-muted",children:"Built-in"})]}),e.description&&o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:e.description}),o.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowedTools.slice(0,5).map(l=>o.jsx("span",{className:"text-[10px] font-mono text-text-muted bg-bg-primary px-1 py-0.5 rounded",children:l},l)),e.allowedTools.length>5&&o.jsxs("span",{className:"text-[10px] text-text-muted",children:["+",e.allowedTools.length-5," more"]})]})]})}function Xv({title:e,agents:r,subagents:i,isBuiltIn:s,onView:c,onDuplicate:u,onEdit:f,onDelete:l}){if(r.length===0&&i.length===0)return null;const d=p=>o.jsx(gT,{agent:p,isBuiltIn:s,isConfirmingDelete:!1,onView:()=>c(p.id),onEdit:s?void 0:()=>f==null?void 0:f(p.id),onDuplicate:()=>u(p.id),onDelete:s?void 0:()=>l==null?void 0:l(p.id)},p.id);return o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:e}),o.jsxs("div",{className:"space-y-2",children:[r.map(d),i.length>0&&o.jsxs("div",{className:"mt-3",children:[o.jsx("div",{className:"text-xs text-text-muted uppercase tracking-wider mb-1.5",children:"Sub-agents"}),o.jsx("div",{className:"space-y-2",children:i.map(d)})]})]})]})}function xT({isOpen:e,onClose:r,initialEditId:i}){const s=Wt(pe=>pe.defaults),c=Wt(pe=>pe.userItems),u=Wt(pe=>pe.loading),f=Wt(pe=>pe.fetchAgents),l=Wt(pe=>pe.fetchAgent),d=Wt(pe=>pe.fetchDefaultContent),p=Wt(pe=>pe.createAgent),g=Wt(pe=>pe.updateAgent),m=Wt(pe=>pe.deleteAgent),[y,_]=P.useState("list"),[k,C]=P.useState(null),[v,b]=P.useState(!1),[x,S]=P.useState(""),[j,A]=P.useState(""),[N,D]=P.useState(""),[T,I]=P.useState(!0),[H,V]=P.useState([]),[Y,q]=P.useState("#6b7280"),[O,U]=P.useState(""),[z,X]=P.useState(""),[Q,M]=P.useState(!1),[L,B]=P.useState([]);function W(pe){const Ne=new Map;for(const Oe of pe){const lt=Oe.indexOf(":");if(lt===-1)Ne.set(Oe,new Set);else{const ue=Oe.slice(0,lt),Te=Oe.slice(lt+1).split(",").filter(Boolean);Ne.set(ue,new Set(Te))}}return Ne}function F(pe){const Ne=[];for(const[Oe,lt]of pe)lt.size===0?Ne.push(Oe):Ne.push(`${Oe}:${[...lt].join(",")}`);return Ne}const re=W(H),Z=(pe,Ne)=>{const Oe=new Map(re),lt=Oe.get(pe)||new Set,ue=new Set(lt);ue.has(Ne)?ue.delete(Ne):ue.add(Ne),ue.size===0?Oe.set(pe,new Set):Oe.set(pe,ue),V(F(Oe))},ee=pe=>{const Ne=new Map(re);Ne.has(pe)?Ne.delete(pe):Ne.set(pe,new Set),V(F(Ne))},K=pe=>{S(pe.metadata.name),A(pe.metadata.id),D(pe.metadata.description),I(pe.metadata.subagent),V(pe.metadata.allowedTools),q(pe.metadata.color??"#6b7280"),U(pe.prompt),X("")},$=(pe,Ne,Oe)=>{S(pe.metadata.name+" (copy)"),A(`${Ne}-copy-${Date.now()}`),D(pe.metadata.description),I(pe.metadata.subagent),V(pe.metadata.allowedTools),q(pe.metadata.color??"#6b7280"),U(pe.prompt),X(""),C(null),b(!1),_("edit")},ae=(pe,Ne)=>{K(pe),C(Ne),b(!0),_("edit")};P.useEffect(()=>{e&&(f(),Ce("/api/tools").then(pe=>pe.json()).then(pe=>B(pe.tools||[])).catch(()=>B([])),i?s.some(Ne=>Ne.id===i)?d(i).then(Ne=>{Ne&&$(Ne,i)}):l(i).then(Ne=>{Ne&&(K(Ne),C(i),b(!1),_("edit"))}):(_("list"),C(null),b(!1)))},[e,f,l,d,i]);const ne=async pe=>{if(s.some(Oe=>Oe.id===pe)){const Oe=await d(pe);if(!Oe)return;ae(Oe,pe)}else{const Oe=await l(pe);if(!Oe)return;ae(Oe,pe)}},ve=async pe=>{const Ne=await d(pe);Ne&&$(Ne,pe)},be=()=>{C(null),S(""),A(""),D(""),I(!0),V(["read_file"]),q("#6b7280"),U(""),X(""),b(!1),_("edit")},Ae=async pe=>{const Ne=await l(pe);Ne&&(K(Ne),C(pe),b(!1),_("edit"))},Me=async pe=>{await m(pe)},Ie=async()=>{const pe=k??j;if(!pe||!x||!O){X("Name and prompt are required.");return}M(!0),X("");const Ne={metadata:{id:pe,name:x,description:N,subagent:T,allowedTools:H,color:Y},prompt:O},Oe=k?await g(k,Ne):await p(Ne);if(M(!1),!Oe.success){X(Oe.error??"Failed to save agent.");return}i?r():_("list")},Fe=()=>{i?r():(_("list"),b(!1))},ke=pe=>{S(pe),k||A(mT(pe))},ge=s.filter(pe=>pe.subagent),je=s.filter(pe=>!pe.subagent),We=c.filter(pe=>pe.subagent),Lt=c.filter(pe=>!pe.subagent);return y==="edit"?o.jsx(cn,{isOpen:e,onClose:Fe,title:v?`${x}`:k?"Edit Agent":"New Agent",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3",children:[z&&o.jsx(kh,{message:z}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Name",value:x,onChange:ke,placeholder:"My Agent",readOnly:v}),o.jsx(Ai,{label:"ID",value:j,onChange:A,readOnly:!0,placeholder:"my_agent",hint:"(read-only)",mono:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Ai,{label:"Description",value:N,onChange:D,placeholder:"What this agent does",readOnly:v}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Type"}),o.jsxs("div",{className:"flex items-center gap-3 h-[34px]",children:[o.jsx("button",{onClick:()=>!v&&I(!0),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-accent-primary/25 text-accent-primary":"bg-bg-tertiary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none opacity-60":""}`,children:"Sub-agent"}),o.jsx("button",{onClick:()=>!v&&I(!1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${T?"bg-bg-tertiary text-text-muted hover:text-text-secondary":"bg-accent-primary/25 text-accent-primary"} ${v?"pointer-events-none opacity-60":""}`,children:"Top-level"}),o.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[o.jsx("label",{className:"text-xs text-text-secondary",children:"Color"}),o.jsx("input",{type:"color",value:Y,onChange:pe=>!v&&q(pe.target.value),disabled:v,className:"w-6 h-6 rounded cursor-pointer border border-border bg-transparent"})]})]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Tools"}),o.jsx("div",{className:"flex flex-wrap gap-1.5 p-2 bg-bg-tertiary border border-border rounded max-h-32 overflow-y-auto",children:L.map(pe=>{const Ne=re.has(pe.name),Oe=pe.actions.length>0,lt=re.get(pe.name)||new Set,ue=o.jsxs("button",{className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted"}`,children:[o.jsx("span",{children:pe.name}),Oe&&o.jsx("span",{className:`text-[10px] ${Ne&<.size>0?"text-accent-primary":"text-text-muted"}`,children:"*"})]},pe.name);return Oe?v?o.jsxs("button",{className:"px-1.5 py-0.5 rounded text-xs font-mono flex items-center gap-1 bg-bg-primary text-text-muted pointer-events-none opacity-60",children:[o.jsx("span",{children:pe.name}),o.jsx("span",{className:"text-[10px]",children:"*"})]},pe.name):o.jsx(eo,{trigger:ue,minWidth:"160px",items:[...pe.actions.map(_e=>({label:o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",htmlFor:`${pe.name}-${_e}`,children:[o.jsx("input",{type:"checkbox",id:`${pe.name}-${_e}`,checked:lt.has(_e),onChange:()=>Z(pe.name,_e),disabled:v,className:"w-3 h-3 rounded accent-accent-primary"}),o.jsx("span",{children:_e})]}),closeOnClick:!1})),{label:Ne?"Deselect all":"Select all",closeOnClick:!1,onClick:()=>{if(Ne)ee(pe.name);else{const _e=new Map(re);_e.set(pe.name,new Set(pe.actions)),V(F(_e))}}}]},pe.name):o.jsx("button",{onClick:()=>!v&&ee(pe.name),className:`px-1.5 py-0.5 rounded text-xs font-mono transition-colors flex items-center gap-1 ${Ne?"bg-accent-primary/25 text-accent-primary":"bg-bg-primary text-text-muted hover:text-text-secondary"} ${v?"pointer-events-none":"cursor-pointer"}`,children:o.jsx("span",{children:pe.name})},pe.name)})})]})]}),o.jsxs("div",{className:"flex-1 min-h-[150px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Prompt"}),o.jsx("textarea",{value:O,onChange:pe=>!v&&U(pe.target.value),readOnly:v,placeholder:"Instructions for this agent...",className:`flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary ${v?"opacity-60":""}`})]}),o.jsx(US,{onCancel:Fe,onSave:Ie,saving:Q,saveDisabled:!x||!O||v}),v&&o.jsx("div",{className:"flex justify-end mt-2",children:o.jsx(st,{variant:"primary",onClick:()=>{S(x+" (copy)"),A(`${k}-copy-${Date.now()}`),C(null),b(!1)},children:"Duplicate & Customize"})})]})}):o.jsxs(cn,{isOpen:e,onClose:r,title:"Agents",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Agents define behavior, tools, and prompts for top-level modes and sub-agents."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:be,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading agents..."}):s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No agents defined."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsx(Xv,{title:"Built-in",agents:je,subagents:ge,isBuiltIn:!0,onView:ne,onDuplicate:ve}),c.length>0&&o.jsx(Xv,{title:"Custom",agents:Lt,subagents:We,isBuiltIn:!1,onView:ne,onDuplicate:ve,onEdit:Ae,onDelete:Me})]})]})}function vT(){const e=Ee(b=>{var x;return(x=b.currentSession)==null?void 0:x.mode}),r=Ee(b=>b.switchMode),i=Wt(b=>b.defaults),s=Wt(b=>b.userItems),c=Wt(b=>b.fetchAgents),u=[...i,...s],[f,l]=P.useState(!1),[d,p]=P.useState(!1),[g,m]=P.useState(null),y=P.useRef(null);if(P.useEffect(()=>{c()},[c]),P.useEffect(()=>{function b(x){y.current&&!y.current.contains(x.target)&&l(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]),!e)return null;const _=u.filter(b=>!b.subagent),k=_.find(b=>b.id===e),C=(k==null?void 0:k.name)??e,v=zl(u,e);return o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{type:"button",onClick:()=>l(!f),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors",title:"Switch agent",children:[o.jsx("span",{className:"text-sm font-medium",style:{color:v},children:C}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${f?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),f&&_.length>0&&o.jsxs("div",{className:"absolute bottom-full left-0 mb-1 w-56 bg-bg-secondary border border-border rounded-lg shadow-lg overflow-hidden z-50",children:[_.map(b=>{const x=b.id===e,S=zl(u,b.id);return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors group ${x?"bg-bg-tertiary":"hover:bg-bg-tertiary cursor-pointer"}`,children:[o.jsxs("button",{type:"button",onClick:()=>{x||r(b.id),l(!1)},className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"font-medium",style:{color:S},children:b.name}),x&&o.jsx("svg",{className:"w-3.5 h-3.5 text-text-muted ml-auto",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:j=>{j.stopPropagation(),l(!1),m(b.id),p(!0)}})]},b.id)}),o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:()=>{l(!1),p(!0)},className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:"Manage Agents..."})})]}),o.jsx(xT,{isOpen:d,onClose:()=>{p(!1),m(null)},initialEditId:g})]})}function bT(){const e=Ee(s=>s.currentSession),r=Ee(s=>s.switchDangerLevel);if(!e)return null;const i=e.dangerLevel??"normal";return o.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-bg-tertiary/50",children:[o.jsx("button",{type:"button",onClick:()=>r("normal"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="normal"?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Normal mode - requires path confirmation",children:"Normal"}),o.jsx("button",{type:"button",onClick:()=>r("dangerous"),className:`px-2 py-0.5 text-xs font-medium rounded transition-colors ${i==="dangerous"?"bg-red-500/20 text-red-400":"text-text-muted hover:text-text-primary hover:bg-bg-tertiary"}`,title:"Dangerous mode - bypasses all confirmations",children:"Dangerous"})]})}function yT({question:e}){const r=Ee(p=>p.answerQuestion),i=P.useRef(null),s=P.useRef(null),[c,u]=P.useState(""),f=P.useCallback(p=>{p.key},[]);P.useEffect(()=>{var p;return s.current=document.activeElement,(p=i.current)==null||p.focus(),document.body.style.overflow="hidden",()=>{var g;(g=s.current)==null||g.focus(),document.body.style.overflow=""}},[]),P.useEffect(()=>(document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)),[f]);const l=()=>{r(e.callId,c)},d=p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),l())};return ql.createPortal(o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),o.jsxs("div",{ref:i,tabIndex:-1,className:"relative w-full max-w-[90vw] md:max-w-md bg-bg-secondary border border-border rounded shadow-xl flex flex-col max-h-[90vh]",children:[o.jsx("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("svg",{className:"w-5 h-5 text-text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.592.115-1.207.532-1.207 1.093 0 .56.41.978 1.002 1.093 1.728.332 3.006 1.507 3.006 2.907 0 1.657-1.79 3-4 3-1.742 0-3.223-.835-3.772-2m-3.772 2v-2m1.772-12h1.594l1.414 1.414M3 12h.01M21 12h.01M12 3v2m0 14v2M3 6h.01M21 6h.01M3 18h.01M21 18h.01"})}),o.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Question from Agent"})]})}),o.jsxs("div",{className:"p-4 overflow-y-auto flex-1 min-h-0 space-y-4",children:[o.jsx("p",{className:"text-sm text-text-primary",children:e.question}),o.jsx("textarea",{value:c,onChange:p=>u(p.target.value),onKeyDown:d,placeholder:"Type your answer here...",className:"w-full min-h-[120px] px-3 py-2 bg-bg-tertiary border border-border rounded text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-accent-primary/50 resize-y",autoFocus:!0})]}),o.jsxs("div",{className:"px-4 py-3 border-t border-border flex justify-end gap-2 flex-shrink-0",children:[o.jsx(st,{variant:"secondary",size:"sm",onClick:()=>r(e.callId,""),children:"Skip"}),o.jsx(st,{variant:"primary",size:"sm",onClick:l,children:"Send Answer"})]})]})]}),document.body)}function _T(){const e=Ee(s=>s.connectionStatus),r=Ee(s=>s.reconnect);if(e==="connected")return null;const i=e==="reconnecting";return o.jsxs("div",{className:`
|
|
138
139
|
flex items-center justify-between px-4 py-2
|
|
139
140
|
text-sm font-medium
|
|
140
141
|
${i?"bg-amber-500/15 border-b border-amber-500/30 text-amber-300":"bg-red-500/15 border-b border-red-500/30 text-red-300"}
|
|
@@ -145,6 +146,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
145
146
|
`,children:i?"Reconnecting...":"Reconnect"})]})}function ST(){const e=BS(),r=e?"bg-amber-400":"bg-accent-primary";return o.jsxs("div",{className:"flex items-center gap-3 text-xs text-text-muted py-2",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsxs("span",{className:"flex gap-0.5",children:[o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"0ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"150ms"}}),o.jsx("span",{className:`w-1 h-1 rounded-full animate-bounce ${r}`,style:{animationDelay:"300ms"}})]}),o.jsx("span",{className:"text-text-secondary",children:e?"Running... (abort in progress)":"Running"})]}),!e&&o.jsx("span",{className:"text-text-muted",children:"esc to interrupt"})]})}function wT({attachment:e,onRemove:r}){const i=s=>s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1048576).toFixed(1)} MB`;return o.jsxs("div",{className:"relative inline-flex flex-col items-center p-2 bg-bg-tertiary rounded-lg border border-border",children:[o.jsx(Rs,{onClick:()=>r(e.id),className:"absolute -top-2 -right-2",size:"sm",variant:"overlay","aria-label":`Remove ${e.filename}`}),o.jsx("img",{src:e.data,alt:e.filename,className:"w-16 h-16 object-cover rounded-md bg-bg-secondary"}),o.jsx("div",{className:"mt-1 text-xs text-text-muted text-center max-w-16 truncate",title:e.filename,children:e.filename}),o.jsx("div",{className:"text-[10px] text-text-muted",children:i(e.size)})]})}function CT({history:e,selectedIndex:r,onSelect:i,onEscape:s,onNavigate:c}){const u=P.useRef(null),f=P.useRef(null);P.useEffect(()=>{f.current&&u.current&&f.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[r]);const l=p=>{switch(p.key){case"Enter":p.preventDefault(),e[r]&&i(e[r].content);break;case"Escape":p.preventDefault(),s();break;case"ArrowUp":p.preventDefault(),c("up");break;case"ArrowDown":p.preventDefault(),c("down");break}},d=p=>{i(p)};return o.jsx("div",{ref:u,role:"list",className:"mb-2 p-2 bg-bg-secondary border border-border rounded-lg overflow-y-auto max-h-64",onKeyDown:l,children:e.map((p,g)=>o.jsxs("div",{ref:g===r?f:null,role:"listitem",onClick:()=>d(p.content),className:`
|
|
146
147
|
p-2 rounded cursor-pointer transition-colors
|
|
147
148
|
${g===r?"bg-accent-primary/20 border border-accent-primary":"hover:bg-bg-tertiary"}
|
|
148
|
-
`,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[p.formattedTimestamp,p.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:p.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:p.trimmedContent})]},p.id))})}const kT={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function ET(e,r={}){const i={...kT,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=i.maxSizeBytes){const c=await e.arrayBuffer(),u=RT(c),f=`data:${e.type};base64,${u}`,l=await s0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await jT(e,i)}async function jT(e,r){const i=await TT(e),s=await s0(i),{width:c,height:u}=NT(s.width,s.height,r.maxWidth,r.maxHeight),f=AT();f.width=c,f.height=u;const l=f.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,c,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Zv(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Zv(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function NT(e,r,i,s){const c=e/r;return e>r&&e>i?{width:i,height:Math.round(i/c)}:r>e&&r>s?{width:Math.round(s*c),height:s}:{width:e,height:r}}function TT(e){return new Promise((r,i)=>{const s=LT(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function s0(e){return new Promise((r,i)=>{const s=DT(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function AT(){var r;const e=of();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function DT(){const e=of();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function LT(){const e=of();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function of(){return globalThis}function RT(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const c=r[s];c!==void 0&&(i+=String.fromCharCode(c))}return btoa(i)}function Zv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function MT(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function OT(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Qv(e.size)}). Maximum size is ${Qv(r)}.`}:{valid:!0}}function Qv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Xd(e,r,i,s={}){const{maxSizeBytes:c=50*1024*1024,filename:u}=s;if(!MT(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=OT(e,c);if(!f.valid){i(f.error??"Image file is too large");return}try{const l=await ET(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:fb(),filename:u??e.name,mimeType:l.mimeType,size:l.size,data:l.dataUrl};r(d)}catch(l){const d=l instanceof Error?l.message??"Failed to process image":"Failed to process image";i(d)}}function BT(e){const r={};let i=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){i=s.id;continue}s.role==="assistant"&&s.promptContext&&i&&r[i]===void 0&&(r[i]=s.promptContext)}return r}function IT({isOpen:e,onClose:r,providerId:i,model:s}){const[c,u]=P.useState(s.contextWindow),[f,l]=P.useState(!1),d=kt(m=>m.updateModelContext);if(P.useEffect(()=>{u(s.contextWindow)},[s]),!e)return null;const p=async()=>{c<1024||c>1e7||(l(!0),await d(i,s.id,c),l(!1),r())},g=()=>{u(s.contextWindow),r()};return o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[o.jsx("div",{className:"px-6 py-4 border-b border-border",children:o.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),o.jsxs("div",{className:"px-6 py-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),o.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:s.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),o.jsx("input",{type:"number",min:1024,max:1e7,value:c,onChange:m=>u(parseInt(m.target.value)||0),className:"w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary"}),o.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),o.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[o.jsx("button",{type:"button",onClick:g,disabled:f,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),o.jsx("button",{type:"button",onClick:p,disabled:f||c<1024||c>1e7,className:"px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Saving...":"Save"})]})]})})}function zT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function HT(){var U;const[,e]=ar(),r=Ee(z=>z.currentSession),i=Ee(z=>z.setSessionProvider),[s,c]=P.useState(!1),[u,f]=P.useState([]),[l,d]=P.useState(null),p=P.useRef(null),[g,m]=P.useState(null),y=P.useRef(new Set),_=kt(z=>z.providers),k=kt(z=>z.activeProviderId),C=kt(z=>z.model);kt(z=>z.backend);const v=kt(z=>z.llmStatus),b=kt(z=>z.activating),x=kt(z=>z.activateProvider),S=kt(z=>z.refreshModel),j=kt(z=>z.refreshProviderModels);P.useEffect(()=>{function z(X){p.current&&!p.current.contains(X.target)&&(c(!1),f([]),y.current=new Set)}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]),P.useEffect(()=>{if(s){const z=_.map(X=>X.id);f(z),z.forEach(X=>{y.current.has(X)||(y.current.add(X),D(X))})}},[s,_]),_.find(z=>z.id===k);const A=v==="disconnected",N=C?((U=C.split("/").pop())==null?void 0:U.replace(/-/g," "))??C:"detecting...",D=async z=>{d(z);try{await j(z)}catch{}finally{d(null)}},T=z=>{u.includes(z.id)?f(u.filter(X=>X!==z.id)):(f([...u,z.id]),D(z.id))},I=async z=>{if(z.id===k){T(z);return}r?(i(z.id,void 0),kt.getState().syncFromSession(z.id,""),c(!1),f([])):await x(z.id)&&(c(!1),f([]))},H=z=>{T(z)},V=async(z,X)=>{z.stopPropagation(),y.current.delete(X),await j(X),await D(X)},Y=(z,X)=>{m({providerId:z,model:X})},q=()=>{m(null)},O=async(z,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",z,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(z,X),kt.getState().syncFromSession(z,X),f([]),c(!1);return}d("activating");try{(await Ce(`/api/providers/${z}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:X})})).ok&&(await kt.getState().fetchConfig(),f([]),c(!1))}catch{}finally{d(null)}};return _.length===0?o.jsxs("button",{type:"button",onClick:()=>S(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:A?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:p,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[o.jsx("div",{className:"py-1",children:_.map(z=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${z.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${b?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!b&&I(z),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${z.id===k?"text-accent-primary":"text-text-primary"}`,children:z.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:z.backend!=="auto"&&vS(z.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[z.id===k?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),V(Q,z.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${l===z.id?"animate-spin":""} ${z.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),H(z)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(z.id)?"rotate-180":""} ${z.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(z.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===z.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=z.models)!=null&&X.length?z.models.map(Q=>{var M;return o.jsxs("button",{type:"button",onClick:()=>O(z.id,Q.id),disabled:l==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${l==="activating"?"opacity-50 cursor-wait":""} ${C===Q.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((M=Q.id.split("/").pop())==null?void 0:M.replace(/-/g," "))??Q.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:zT(Q.contextWindow)}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),Y(z.id,Q)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})})]}),C===Q.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},Q.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},z.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(IT,{isOpen:!0,onClose:q,providerId:g.providerId,model:g.model})]})}const Dn=Wn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await _h("/api/commands",e)},fetchCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/commands/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await si("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const c=await si("PUT",`/api/commands/${i}`,s);return c.success&&await r().fetchCommands(),c},deleteCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async i=>{try{const s=await Ce(`/api/commands/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function PT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const FT="M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z";function UT({onClick:e}){return o.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:FT})})})}function a0({isOpen:e,onClose:r,initialEditId:i}){const s=Dn(ge=>ge.defaults),c=Dn(ge=>ge.userItems),u=Dn(ge=>ge.loading),f=Dn(ge=>ge.fetchCommands),l=Dn(ge=>ge.fetchCommand),d=Dn(ge=>ge.fetchDefaultContent),p=Dn(ge=>ge.createCommand),g=Dn(ge=>ge.updateCommand),m=Dn(ge=>ge.deleteCommand),[y,_]=P.useState(null),[k,C]=P.useState(null),{view:v,editingId:b,formError:x,saving:S,formData:j,setView:A,setEditingId:N,setFormError:D,setFormData:T,setSaving:I}=Cb(),{requestDelete:H,clearConfirm:V,isConfirming:Y}=Sh(),q=P.useRef(!1),O=Wt(ge=>ge.defaults),U=Wt(ge=>ge.userItems),z=Wt(ge=>ge.fetchAgents),Q=[...O,...U].filter(ge=>!ge.subagent),M=P.useRef(f),L=P.useRef(z),B=P.useRef(l),W=P.useRef(d),F=P.useRef(i),re=P.useRef(A),Z=P.useRef(N),ee=P.useRef(D),K=P.useRef(V);P.useEffect(()=>{M.current=f,L.current=z,B.current=l,W.current=d,F.current=i,re.current=A,Z.current=N,ee.current=D,K.current=V}),P.useEffect(()=>{if(e)if(M.current(),L.current(),q.current||(K.current(),q.current=!0),F.current){const ge=s.some(je=>je.id===F.current);re.current("edit"),Z.current(F.current),ee.current(""),ge?W.current(F.current).then(je=>{je&&T({name:je.metadata.name+" (copy)",id:`${F.current}-copy-${Date.now()}`,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!0})}):B.current(F.current).then(je=>{je&&T({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1})})}else re.current("list"),Z.current(null);else q.current=!1},[e]);const $=async ge=>{_(ge);const je=await d(ge);C((je==null?void 0:je.prompt)??null)},ae=async ge=>{if(s.some(We=>We.id===ge)){const We=await d(ge);We&&(N(null),T({name:`${We.metadata.name} (copy)`,id:`${ge}-copy-${Date.now()}`,prompt:We.prompt,agentMode:We.metadata.agentMode??"",isDefault:!0}),D(""),A("edit"))}else{const We=await l(ge);We&&(N(null),T({name:`${We.metadata.name} (copy)`,id:`${ge}-copy-${Date.now()}`,prompt:We.prompt,agentMode:We.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))}},ne=()=>{T({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),A("edit")},ve=async ge=>{const je=await l(ge);je&&(N(ge),T({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))},be=async ge=>{await m(ge),V()},Ae=async()=>{const ge=b??j.id;if(!ge||!j.name||!j.prompt){D("Name and message are required.");return}I(!0),D("");const je={metadata:{id:ge,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},We=b?await g(b,je):await p(je);if(I(!1),!We.success){D(We.error??"Failed to save command.");return}i?r():A("list")},Me=()=>{i?r():(A("list"),_(null),C(null))},Ie=ge=>{T(je=>({...je,name:ge})),(!b||j.isDefault)&&T(je=>({...je,id:PT(ge)}))},Fe=()=>{_(null),C(null),A("list")},ke=()=>{y&&(_(null),A("edit"),N(y),d(y).then(ge=>{ge&&T({name:`${ge.metadata.name} (copy)`,id:`${y}-copy-${Date.now()}`,prompt:ge.prompt,agentMode:ge.metadata.agentMode??"",isDefault:!0})}))};if(y){const ge=s.find(je=>je.id===y);return o.jsx(ln,{isOpen:e,onClose:Fe,title:`Default: ${(ge==null?void 0:ge.name)??y}`,size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),o.jsx("span",{className:"font-mono",children:y})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:ge==null?void 0:ge.name})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(ge==null?void 0:ge.agentMode)||"None"})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:k??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Fe,children:"Close"}),o.jsx(st,{variant:"primary",onClick:ke,children:"Duplicate & Customize"})]})]})})}return v==="edit"?o.jsx(ln,{isOpen:e,onClose:Me,title:b?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[x&&o.jsx(kh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(wb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!b&&!j.isDefault,onNameChange:Ie,onIdChange:ge=>T(je=>({...je,id:ge}))}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",o.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),o.jsxs("select",{value:j.agentMode,onChange:ge=>T(je=>({...je,agentMode:ge.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[o.jsx("option",{value:"",children:"None (keep current mode)"}),Q.map(ge=>o.jsx("option",{value:ge.id,children:ge.name},ge.id))]})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:j.prompt,onChange:ge=>T(je=>({...je,prompt:ge.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Me,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:Ae,disabled:S||!j.name||!j.prompt,children:S?"Saving...":"Save"})]})]})}):o.jsxs(ln,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(yb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:ne}),o.jsxs(Sb,{loading:u,hasItems:s.length>0||c.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(ge=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(UT,{onClick:()=>$(ge.id)}),o.jsx(Wa,{onClick:()=>ae(ge.id)})]})]},ge.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(ge=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Mi,{onClick:()=>ve(ge.id)}),o.jsx(Wa,{onClick:()=>ae(ge.id)}),Y(ge.id,"delete")?o.jsx(wh,{onConfirm:()=>be(ge.id),onCancel:V}):o.jsx(Ch,{onClick:()=>H(ge.id)})]})]},ge.id))})]})]})]})}function o0({items:e,isOpen:r,onOpen:i,onClose:s,filterFn:c}){const[u,f]=P.useState(""),[l,d]=P.useState(0),p=P.useRef(null),g=P.useRef(null);P.useEffect(()=>{r&&(f(""),d(0),requestAnimationFrame(()=>{var v;return(v=g.current)==null?void 0:v.focus()}))},[r]),P.useEffect(()=>{if(!r)return;const v=b=>{p.current&&!p.current.contains(b.target)&&s()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r,s]);const m=P.useCallback(()=>{r?s():i()},[r,i,s]),y=P.useCallback(v=>{f(v),d(0)},[]),_=P.useCallback(v=>{const b=e.filter(x=>c(x,u));switch(v.key){case"ArrowDown":v.preventDefault(),d(x=>Math.min(x+1,b.length-1));break;case"ArrowUp":v.preventDefault(),d(x=>Math.max(x-1,0));break;case"Enter":v.preventDefault();break;case"Escape":v.preventDefault(),s();break}},[e,u,c,s]),k=P.useCallback(()=>{d(0)},[]),C=e.filter(v=>c(v,u));return{isOpen:r,search:u,selectedIndex:l,filtered:C,containerRef:p,searchRef:g,handleToggle:m,handleSearchChange:y,handleKeyDown:_,setSelectedIndex:d,resetSelection:k}}function l0({label:e,isOpen:r,onClick:i,className:s=""}){return o.jsxs("button",{type:"button",onClick:i,className:`flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors ${s}`,children:[e,o.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})}function c0({value:e,onChange:r,onKeyDown:i,ref:s,placeholder:c}){return o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:s,value:e,onChange:u=>r(u.target.value),onKeyDown:i,placeholder:c,className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})})}function u0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function d0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function h0({label:e,onClick:r}){return o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:r,className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:e})})}function $T({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[c,u]=P.useState(!1),[f,l]=P.useState(null),d=Dn(D=>D.defaults),p=Dn(D=>D.userItems),g=Dn(D=>D.fetchCommands),m=[...d,...p],{isOpen:y,search:_,selectedIndex:k,filtered:C,containerRef:v,searchRef:b,handleToggle:x,handleSearchChange:S,handleKeyDown:j}=o0({items:m,isOpen:c,onOpen:()=>u(!0),onClose:()=>u(!1),filterFn:(D,T)=>!T||D.name.toLowerCase().includes(T.toLowerCase())});P.useEffect(()=>{c&&g()},[c,g]);const A=async D=>{const T=await Dn.getState().fetchCommand(D);T&&e(T.prompt,T.metadata.agentMode,i,s),u(!1)},N=()=>{u(!1),r()};return o.jsxs("div",{ref:v,className:"relative",children:[o.jsx(l0,{label:"Commands",isOpen:y,onClick:x}),y&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:j,children:[o.jsx(c0,{value:_,onChange:S,onKeyDown:j,ref:b,placeholder:"Search commands..."}),o.jsx(u0,{children:C.length===0?o.jsx(d0,{hasItems:m.length>0,message:"No commands yet"}):C.map((D,T)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${T===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>A(D.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:D.name})}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:I=>{I.stopPropagation(),u(!1),l(D.id)}})]},D.id))}),o.jsx(h0,{label:"Manage Commands...",onClick:N})]}),o.jsx(a0,{isOpen:!!f,onClose:()=>l(null),initialEditId:f})]})}function qT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function WT(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const GT=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],f0={all_criteria_passed:"All passed",all_criteria_completed_or_passed:"All completed",any_criteria_blocked:"Blocked",has_pending_criteria:"Pending/Failed",step_result:"Result",always:"Always"},p0=[{value:"all_criteria_passed",label:"All criteria passed"},{value:"all_criteria_completed_or_passed",label:"All criteria completed or passed"},{value:"any_criteria_blocked",label:"Any criteria blocked (retry limit)"},{value:"has_pending_criteria",label:"Has pending or failed criteria"},{value:"step_result",label:"Step result is..."},{value:"always",label:"Always (fallback)"}],ji=150,Nr=54,js=80,Tn=30,Ns=70,Jv=100,Ni=50,jl=50,eb=4;function lf(e,r){if(e.type==="agent"){const i=r.find(s=>s.id===e.toolMode);return{name:(i==null?void 0:i.name)??(e.toolMode||"Agent"),color:(i==null?void 0:i.color)||"#3b82f6"}}if(e.type==="sub_agent"){const i=r.find(s=>s.id===e.subAgentType);return{name:(i==null?void 0:i.name)??(e.subAgentType||"Sub-Agent"),color:(i==null?void 0:i.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function VT(e,r,i,s){const c=jl+Ni+ji+Jv+ji+Ni+jl,u=c/2,f=jl+Ni+ji/2,l=jl+Ni+ji+Jv+ji/2,d=[],p=[],g=new Map,m=e.filter(O=>O.type==="agent"||O.type==="shell"),y=e.filter(O=>O.type==="sub_agent"),_=y.length>0,k=_?f:u,C=m.length>0?l:u,v=Ni+Tn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:v,w:js,h:Tn}),g.set("$start",{cx:k,cy:v,w:js,h:Tn}),e.length===0){const O=v+Tn/2+Ns*2+Tn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:O,w:js,h:Tn}),g.set("$done",{cx:k,cy:O,w:js,h:Tn}),{nodes:d,edges:p,width:c,height:O+Tn/2+Ni,posMap:g}}const b=v+Tn/2+Ns,x=(O,U)=>{O.forEach((z,X)=>{const Q=b+X*(Nr+Ns)+Nr/2,{name:M,color:L}=lf(z,s);d.push({id:z.id,type:"step",label:M,color:L,cx:U,cy:Q,w:ji,h:Nr}),g.set(z.id,{cx:U,cy:Q,w:ji,h:Nr})})};x(m,k),x(y,C);const S=m.length>0?b+(m.length-1)*(Nr+Ns)+Nr/2:v,j=_?b+(y.length-1)*(Nr+Ns)+Nr/2:v,A=Math.max(S,j)+Nr/2+Ns+Tn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:A,w:js,h:Tn}),g.set("$done",{cx:k,cy:A,w:js,h:Tn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const O of e)O.transitions.forEach((U,z)=>{if(!U.goto||!g.has(U.goto))return;const X=g.get(O.id),Q=g.get(U.goto),M=U.when.type==="step_result"?`${U.when.result}`:f0[U.when.type]??U.when.type,L=O.id===U.goto;let B;L?B="back":Q.cy>X.cy+1?B="down":Q.cy<X.cy-1?B="back":B="same",N.push({from:O.id,to:U.goto,label:M,edgeKey:`${O.id}:${z}`,direction:B,backEdgeIndex:B==="back"?D++:0})});const T=new Map,I=new Map,H=new Map,V=new Map;for(const O of N)O.direction==="down"&&(T.set(O.from,(T.get(O.from)??0)+1),I.set(O.to,(I.get(O.to)??0)+1));const Y=new Map,q=new Map;for(const O of N){if(O.direction!=="same")continue;const U=[O.from,O.to].sort().join("|");Y.set(U,(Y.get(U)??0)+1)}for(const O of N){if(O.direction==="back"||O.direction==="same"){let B=0;if(O.direction==="same"){const W=[O.from,O.to].sort().join("|");B=q.get(W)??0,q.set(W,B+1)}p.push({...O,fromPort:0,toPort:0,sameEdgeIndex:B});continue}const U=T.get(O.from)??1,z=I.get(O.to)??1,X=H.get(O.from)??0,Q=V.get(O.to)??0;H.set(O.from,X+1),V.set(O.to,Q+1);const M=U===1?0:-.6+1.2*X/(U-1),L=z===1?0:-.6+1.2*Q/(z-1);p.push({...O,fromPort:M,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:p,width:c,height:A+Tn/2+Ni,posMap:g}}function YT({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:u,isReadOnly:f,onSelectNode:l,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:y,onDeleteTransition:_}){const k=P.useRef(null),C=P.useRef(!1),[v,b]=P.useState(null),[x,S]=P.useState(null),[j,A]=P.useState(null),{nodes:N,edges:D,width:T,height:I,posMap:H}=P.useMemo(()=>VT(e,r,c,u),[e,r,c,u]),V=P.useCallback(Z=>{var ne;const ee=k.current;if(!ee)return{x:0,y:0};const K=ee.createSVGPoint();K.x=Z.clientX,K.y=Z.clientY;const $=(ne=ee.getScreenCTM())==null?void 0:ne.inverse();if(!$)return{x:0,y:0};const ae=K.matrixTransform($);return{x:ae.x,y:ae.y}},[]),Y=P.useCallback(Z=>!Z||!x||Z==="$start"?!1:x.type==="reconnect-from"?Z!=="$done":!0,[x]),q=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"new",fromNodeId:ee,mouseX:K.x,mouseY:K.y})},[V,f]),O=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:K.x,mouseY:K.y})},[V,f]),U=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:K.x,mouseY:K.y})},[V,f]),z=P.useCallback(Z=>{if(!x)return;const ee=V(Z);S(K=>K?{...K,mouseX:ee.x,mouseY:ee.y}:null)},[x,V]),X=P.useCallback(()=>{x&&(C.current=!0,j&&Y(j)&&(x.type==="new"?g(x.fromNodeId,j):x.type==="reconnect-to"?m(x.edgeKey,j):x.type==="reconnect-from"&&y(x.edgeKey,j)),S(null),A(null))},[x,j,Y,g,m,y]),Q=P.useCallback(()=>{if(C.current){C.current=!1;return}l(null),d(null)},[l,d]);P.useEffect(()=>{if(f)return;const Z=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&s&&s!=="start"&&(ee.preventDefault(),_(s),d(null))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[f,s,_,d]);const M=Z=>{const ee=H.get(Z.from),K=H.get(Z.to);if(!ee||!K)return null;let $,ae,ne,ve="middle",be,Ae;if(Z.direction==="down"){const Me=ee.cx+Z.fromPort*(ee.w/2-10),Ie=ee.cy+ee.h/2,Fe=K.cx+Z.toPort*(K.w/2-10),ke=K.cy-K.h/2,ge=ke-Ie,je=Fe-Me;$=`M ${Me} ${Ie} C ${Me} ${Ie+ge*.4}, ${Fe-je*.2} ${ke-ge*.1}, ${Fe} ${ke}`,ae=Me+(Fe-Me)*.5,ne=Ie+ge*.6,be={x:Me,y:Ie},Ae={x:Fe,y:ke}}else if(Z.direction==="back"){const Me=Z.from===Z.to,Ie=ee.cx>=T/2,Fe=Z.backEdgeIndex*16,ke=Ie?T-20-Fe:20+Fe;if(Me){const ge=ee.cx>=T/2,je=30+Z.backEdgeIndex*14,We=ee.cy-ee.h/2,Lt=ge?ee.cx+ee.w/2:ee.cx-ee.w/2,pe=ge?Lt+je:Lt-je,Ne=ee.cx+(ge?ee.w/4:-ee.w/4),Oe=We-20-Z.backEdgeIndex*10;$=`M ${Lt} ${ee.cy} C ${pe} ${ee.cy}, ${pe} ${Oe}, ${Ne} ${We}`,ae=pe+10,ne=Oe+4,ve="middle",be={x:Lt,y:ee.cy},Ae={x:Ne,y:We}}else{const ge=Ie?ee.cx+ee.w/2:ee.cx-ee.w/2,je=K.cx+(Ie?K.w/4:-K.w/4),We=Math.min(ee.cy,K.cy)-K.h/2-18-Z.backEdgeIndex*14;$=`M ${ge} ${ee.cy} L ${ke} ${ee.cy} L ${ke} ${We} L ${je} ${We} L ${je} ${K.cy-K.h/2}`,ae=ke,ne=(ee.cy+We)/2,ve=Ie?"start":"end",be={x:ge,y:ee.cy},Ae={x:je,y:K.cy-K.h/2}}}else{const Me=K.cx>ee.cx,Ie=Z.sameEdgeIndex===0?-12:12,Fe=Me?ee.cx+ee.w/2:ee.cx-ee.w/2,ke=Me?K.cx-K.w/2:K.cx+K.w/2,ge=ee.cy+Ie,je=K.cy+Ie,We=(Fe+ke)/2;$=`M ${Fe} ${ge} C ${We} ${ge}, ${We} ${je}, ${ke} ${je}`,ae=We,ne=(ge+je)/2-6,be={x:Fe,y:ge},Ae={x:ke,y:je}}return{path:$,labelX:ae,labelY:ne,labelAnchor:ve,fromPt:be,toPt:Ae}},L=(Z,ee)=>{const K=M(Z);if(!K)return null;const{path:$,labelX:ae,labelY:ne,labelAnchor:ve}=K,be=s===Z.edgeKey,Ae=Z.label&&!(Z.from==="$start"&&Z.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Me=>{Me.stopPropagation(),d(be?null:Z.edgeKey)}}),o.jsx("path",{d:$,fill:"none",stroke:be?"#58a6ff":"#484f58",strokeWidth:be?2.2:1.2,markerEnd:be?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Ae&&o.jsx("text",{x:ae+(ve==="start"?5:ve==="end"?-5:0),y:ne+3,textAnchor:ve,className:"text-[8px]",fill:be?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Z.label})]},ee)},B=()=>{if(!s||x)return null;const Z=D.find(ne=>ne.edgeKey===s);if(!Z)return null;const ee=M(Z);if(!ee)return null;const{fromPt:K,toPt:$}=ee,ae=6;return o.jsxs(o.Fragment,{children:[Z.edgeKey!=="start"&&o.jsx("circle",{cx:K.x,cy:K.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>U(ne,Z)}),o.jsx("circle",{cx:$.x,cy:$.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>O(ne,Z)})]})},W=()=>{if(!x)return null;let Z,ee,K,$;if(x.type==="reconnect-from"){const ve=H.get(x.fixedTargetId);if(!ve)return null;Z=x.mouseX,ee=x.mouseY,K=ve.cx,$=ve.cy-ve.h/2}else{const ve=H.get(x.fromNodeId);if(!ve)return null;Z=ve.cx,ee=ve.cy+ve.h/2,K=x.mouseX,$=x.mouseY}const ae=$-ee,ne=Math.abs(ae)>10?`M ${Z} ${ee} C ${Z} ${ee+ae*.4}, ${K} ${$-ae*.4}, ${K} ${$}`:`M ${Z} ${ee} L ${K} ${$}`;return o.jsx("path",{d:ne,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},F=Z=>{const ee=Z.cy+Z.h/2,K=(x==null?void 0:x.fromNodeId)===Z.id;return o.jsx("circle",{cx:Z.cx,cy:ee,r:eb,fill:K?"#58a6ff":"#1c2128",stroke:K?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:K?1:.5,className:"cursor-crosshair",onMouseDown:$=>q($,Z.id)})},re=Z=>{const ee=Z.cy-Z.h/2,K=x&&j===Z.id&&Y(Z.id);return o.jsx("circle",{cx:Z.cx,cy:ee,r:eb,fill:K?"#3fb950":"#1c2128",stroke:K?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:K?1:.5})};return o.jsxs("svg",{ref:k,viewBox:`0 0 ${T} ${I}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:z,onMouseUp:X,onClick:Q,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Z,ee)=>L(Z,ee)),N.map(Z=>{const ee=i===Z.id,K=Z.cx-Z.w/2,$=Z.cy-Z.h/2,ae=v===Z.id,ne=x&&j===Z.id&&Y(Z.id);if(Z.type==="terminal"){const be=Z.id==="$start",Ae=be?"#58a6ff":"#3fb950",Me=be,Ie=!be;return o.jsxs("g",{onClick:Fe=>{Fe.stopPropagation(),be&&!f&&d("start")},className:be&&!f?"cursor-pointer":void 0,children:[ne&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),be&&s==="start"&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:K,y:$,width:Z.w,height:Z.h,rx:Z.h/2,fill:Ae,fillOpacity:.08,stroke:Ae,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:Ae,className:"text-[10px] font-medium",pointerEvents:"none",children:Z.label}),Me&&F(Z),Ie&&re(Z)]},Z.id)}const ve=Z.color??"#6b7280";return o.jsxs("g",{onClick:be=>{be.stopPropagation(),f||l(ee?null:Z.id)},onMouseEnter:()=>b(Z.id),onMouseLeave:()=>b(null),className:f?void 0:"cursor-pointer",children:[ne&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:K,y:$,width:Z.w,height:Z.h,rx:10,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Z.label}),!f&&F(Z),!f&&re(Z),ae&&!x&&!f&&o.jsxs("g",{onClick:be=>{be.stopPropagation(),p(Z.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:K+Z.w-2,cy:$+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:K+Z.w-5,y1:$-1,x2:K+Z.w+1,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:K+Z.w+1,y1:$-1,x2:K+Z.w-5,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Z.id)}),x&&N.map(Z=>Y(Z.id)?o.jsx("rect",{x:Z.cx-Z.w/2-8,y:Z.cy-Z.h/2-8,width:Z.w+16,height:Z.h+16,fill:"transparent",rx:12,onMouseEnter:()=>A(Z.id),onMouseLeave:()=>A(null),onMouseUp:ee=>{ee.stopPropagation(),X()}},`drop-${Z.id}`):null),W(),B()]})}const Kn="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",Li="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",rn="block text-[11px] text-text-secondary mb-0.5";function KT({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:u,onDelete:f}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?c.find(p=>p.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(l==null?void 0:l.results)&&l.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"font-medium text-text-primary",children:e}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Condition"}),o.jsx("select",{value:i.type,onChange:p=>{u(p.target.value==="step_result"?{type:"step_result",result:"success"}:{type:p.target.value})},className:Li,children:p0.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Result"}),d?o.jsx("select",{value:i.result??l.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Li,children:l.results.map(p=>o.jsx("option",{value:p,children:p},p))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:p=>u({type:"step_result",result:p.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Zd({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>o.jsx("button",{type:"button",onClick:()=>r(i.name),title:i.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${i.name}}}`},i.name))})}function XT({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:u,onRemove:f,onSetEntry:l}){const{color:d,name:p}=lf(e,i);return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:p}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,y=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=i.find(k=>!k.subagent);u({...e,type:m,phase:y,toolMode:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=i.find(k=>k.subagent);u({...e,type:m,phase:y,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:y,name:"Shell"})},className:Li,children:GT.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(y=>y.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:i.filter(g=>!g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(y=>y.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:[o.jsx("option",{value:"",children:"— select —"}),i.filter(g=>g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Kn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Kn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Kn} font-mono text-xs`})]})]})]}),o.jsx("div",{className:"pt-1 border-t border-border/50",children:o.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const tb=[];function m0({isOpen:e,onClose:r,initialEditId:i}){const s=Dt(fe=>fe.defaults),c=Dt(fe=>fe.userItems),u=Dt(fe=>fe.loading),f=Dt(fe=>fe.templateVariables),l=Dt(fe=>fe.fetchWorkflows),d=Dt(fe=>fe.fetchWorkflow),p=Dt(fe=>fe.fetchDefaultContent),g=Dt(fe=>fe.fetchTemplateVariables),m=Dt(fe=>fe.createWorkflow),y=Dt(fe=>fe.updateWorkflow),_=Dt(fe=>fe.deleteWorkflow),{requestDelete:k,clearConfirm:C,isConfirming:v}=Sh(),[b,x]=P.useState("list"),[S,j]=P.useState(null),[A,N]=P.useState(!1),[D,T]=P.useState(null),[I,H]=P.useState(null),[V,Y]=P.useState(""),[q,O]=P.useState(""),[U,z]=P.useState(""),[X,Q]=P.useState("1.0.0"),[M,L]=P.useState("#3b82f6"),[B,W]=P.useState(""),[F,re]=P.useState(50),[Z,ee]=P.useState(tb),[K,$]=P.useState({type:"always"}),[ae,ne]=P.useState(""),[ve,be]=P.useState(!1),[Ae,Me]=P.useState([]),[Ie]=P.useState(null);P.useEffect(()=>{e&&(l(),g(),Ce("/api/agents").then(fe=>fe.json()).then(fe=>Me(fe.agents??[])).catch(()=>{}),T(null),H(null),i?s.some(ye=>ye.id===i)?p(i).then(ye=>{ye&&(Y(ye.metadata.name+" (copy)"),O(`${i}-copy-${Date.now()}`),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),j(null),N(!1),x("edit"))}):d(i).then(ye=>{ye&&(Y(ye.metadata.name),O(ye.metadata.id),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),j(i),N(!1),x("edit"))}):(x("list"),j(null),N(!1)))},[e,l,d,p,g,i]);const Fe=async fe=>{const ye=await d(fe);ye&&(j(fe),Y(ye.metadata.name),O(ye.metadata.id),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),T(null),H(null),x("edit"))},ke=async()=>{var rt;const fe=S??q;if(!fe||!V)return ne("Name is required."),!1;if(Z.length===0)return ne("Add at least one step."),!1;let ye=B;if(!ye||!Z.some(Ue=>Ue.id===ye)){if(ye=((rt=Z.find(Ue=>Ue.id))==null?void 0:rt.id)??"",!ye)return ne("All steps need an ID."),!1;W(ye)}be(!0),ne("");const we={metadata:{id:fe,name:V,description:U,version:X||"1.0.0",color:M},entryStep:ye,settings:{maxIterations:F},steps:Z,startCondition:K},Ye=S?await y(S,we):await m(we);return be(!1),Ye.success?(S||j(fe),!0):(ne(Ye.error??"Failed to save."),!1)},ge=async()=>{await ke()},je=async()=>{await ke()&&(i?r():x("list"))},We=()=>{i?r():x("list")},Lt=fe=>{Y(fe),S||O(qT(fe))},pe=async fe=>{if(s.some(we=>we.id===fe)){const we=await p(fe);if(!we)return;Y(we.metadata.name),O(we.metadata.id),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(fe),N(!0)}else{const we=await d(fe);if(!we)return;Y(we.metadata.name),O(we.metadata.id),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(fe),N(!0)}x("edit")},Ne=async fe=>{const we=s.some(Ye=>Ye.id===fe)?await p(fe):await d(fe);we&&(Y(we.metadata.name+" (copy)"),O(`${fe}-copy-${Date.now()}`),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(null),N(!1),x("edit"))},Oe=()=>{j(null),Y(""),O(""),z(""),Q("1.0.0"),L("#3b82f6"),W(""),re(50),ee(structuredClone(tb)),$({type:"always"}),ne(""),T(null),H(null),N(!1),x("edit")},lt=async fe=>{await _(fe),C()},ue=P.useCallback(fe=>{T(fe),H(null)},[]),_e=P.useCallback(fe=>{H(fe),T(null)},[]),Te=D!==null?Number(D):-1,Be=Te>=0?Z[Te]??null:null,Ve=P.useCallback(fe=>{ee(ye=>ye.map((we,Ye)=>Ye===Te?fe:we))},[Te]),Ct=K.type==="step_result"?`${K.result}`:f0[K.type]??K.type,se=()=>{const fe=Z.length,ye=WT(Z),we=Ae.find(Ye=>!Ye.subagent);ee([...Z,{id:ye,name:(we==null?void 0:we.name)??"Agent",type:"agent",phase:"build",toolMode:(we==null?void 0:we.id)??"builder",transitions:[]}]),B||W(ye),ue(String(fe))},Le=P.useCallback((fe,ye)=>{fe==="$start"?(W(ye),_e("start")):ee(we=>{const Ye=we.find(Ue=>Ue.id===fe),rt=Ye?Ye.transitions.length:0;return _e(`${fe}:${rt}`),we.map(Ue=>Ue.id===fe?{...Ue,transitions:[...Ue.transitions,{when:{type:"always"},goto:ye}]}:Ue)})},[_e]),$e=P.useCallback((fe,ye)=>{if(fe==="start")W(ye);else{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>Ue.map(Zt=>Zt.id===Ye?{...Zt,transitions:Zt.transitions.map((Mt,$t)=>$t===rt?{...Mt,goto:ye}:Mt)}:Zt))}},[]),at=P.useCallback((fe,ye)=>{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>{const Zt=Ue.find($t=>$t.id===Ye);if(!Zt)return Ue;const Mt=Zt.transitions[rt];return Mt?Ue.map($t=>$t.id===Ye?{...$t,transitions:$t.transitions.filter((Hi,ac)=>ac!==rt)}:$t.id===ye?{...$t,transitions:[...$t.transitions,Mt]}:$t):Ue}),H(null)},[]),qe=P.useCallback(fe=>{if(fe==="start")W("");else{const ye=fe.lastIndexOf(":"),we=fe.slice(0,ye),Ye=parseInt(fe.slice(ye+1));ee(rt=>rt.map(Ue=>Ue.id===we?{...Ue,transitions:Ue.transitions.filter((Zt,Mt)=>Mt!==Ye)}:Ue))}H(null)},[]),Ut=P.useCallback((fe,ye)=>{if(fe==="start")$(ye);else{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>Ue.map(Zt=>Zt.id===Ye?{...Zt,transitions:Zt.transitions.map((Mt,$t)=>$t===rt?{...Mt,when:ye}:Mt)}:Zt))}},[]),Rt=fe=>lf(fe,Ae).name,oi=()=>{if(!I)return null;if(I==="start"){const Mt=Z.find($t=>$t.id===B);return{type:"start",fromLabel:"Start",toLabel:Mt?Rt(Mt):"(none)",condition:K}}const fe=I.lastIndexOf(":"),ye=I.slice(0,fe),we=parseInt(I.slice(fe+1)),Ye=Z.find(Mt=>Mt.id===ye);if(!Ye)return null;const rt=Ye.transitions[we];if(!rt)return null;const Ue=Z.find(Mt=>Mt.id===rt.goto),Zt=rt.goto==="$done"?"Done":Ue?Rt(Ue):rt.goto;return{type:"step",fromLabel:Rt(Ye),toLabel:Zt,condition:rt.when}};if(b==="edit"){const fe=oi();return o.jsxs(ln,{isOpen:e,onClose:We,title:A?V:S?"Edit Workflow":"New Workflow",size:"full",children:[ae&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:ae}),o.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[o.jsxs("div",{className:"min-w-[140px]",children:[o.jsx("label",{className:rn,children:"Name"}),o.jsx("input",{value:V,onChange:ye=>Lt(ye.target.value),placeholder:"Workflow name",className:`${Kn} ${A?"opacity-50":""}`,readOnly:A})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:rn,children:"ID"}),o.jsx("input",{value:q,readOnly:!0,className:`${Kn} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:rn,children:"Description"}),o.jsx("input",{value:U,onChange:ye=>!A&&z(ye.target.value),readOnly:A,placeholder:"What does this workflow do?",className:`${Kn} ${A?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:rn,children:"Max Iter."}),o.jsx("input",{type:"number",value:F,onChange:ye=>!A&&re(Number(ye.target.value)),readOnly:A,className:`${Kn} font-mono ${A?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Color"}),o.jsx("input",{type:"color",value:M,onChange:ye=>!A&&L(ye.target.value),disabled:A,className:`w-8 h-8 rounded border border-border bg-transparent ${A?"opacity-50":"cursor-pointer"}`})]})]}),o.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[o.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!A&&o.jsx("button",{onClick:se,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),o.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[o.jsx(YT,{steps:Z,entryStep:B,selectedNodeId:(Be==null?void 0:Be.id)??null,selectedEdgeKey:I,startConditionLabel:Ct,agentTypes:Ae,isReadOnly:A,onSelectNode:ye=>{if(ye===null){ue(null);return}const we=Z.findIndex(Ye=>Ye.id===ye);ue(we>=0?String(we):null)},onSelectEdge:_e,onRemoveStep:ye=>{var Ye;const we=Z.findIndex(rt=>rt.id===ye);if(ee(rt=>rt.filter(Ue=>Ue.id!==ye)),Te===we&&ue(null),B===ye){const rt=Z.filter(Ue=>Ue.id!==ye);W(((Ye=rt[0])==null?void 0:Ye.id)??"")}},onCreateTransition:Le,onReconnectTo:$e,onReconnectFrom:at,onDeleteTransition:qe}),Z.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[o.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),o.jsx("button",{onClick:se,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),o.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[o.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),o.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:A&&(fe||Be)?o.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):fe?fe.type==="start"?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),B&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"text-text-primary font-medium",children:fe.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Activation Condition"}),o.jsx("select",{value:K.type,onChange:ye=>$(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:Li,children:p0.map(ye=>o.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),K.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Result"}),B&&(()=>{const ye=Z.find(Ue=>Ue.id===B),we=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Ae.find(Ue=>Ue.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,Ye=(we==null?void 0:we.results)&&we.results.length>0,rt=(we==null?void 0:we.results)??[];return Ye?o.jsx("select",{value:K.result??rt[0],onChange:Ue=>$({type:"step_result",result:Ue.target.value}),className:Li,children:rt.map(Ue=>o.jsx("option",{value:Ue,children:Ue},Ue))}):o.jsx("input",{type:"text",value:K.result??"success",onChange:Ue=>$({type:"step_result",result:Ue.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})})()]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):o.jsx(KT,{fromLabel:fe.fromLabel,toLabel:fe.toLabel,condition:fe.condition,fromStep:fe.type==="step"?Z.find(ye=>ye.id===fe.fromLabel):void 0,agentTypes:Ae,onUpdateCondition:ye=>Ut(I,ye),onDelete:()=>qe(I)}):Be?o.jsx(XT,{step:Be,isEntry:Be.id===B,agentTypes:Ae,transitionCount:Be.transitions.length,templateVariables:f,onUpdate:Ve,onRemove:()=>{var ye;if(Be&&(ee(Z.filter((we,Ye)=>Ye!==Te)),ue(null),B===Be.id)){const we=Z.filter((Ye,rt)=>rt!==Te);W(((ye=we[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>W(Be.id)}):o.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",o.jsx("br",{}),"Drag from a port to connect."]})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:We,children:"Close"}),A?o.jsx(st,{variant:"primary",onClick:()=>{Y(V+" (copy)"),O(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(st,{variant:"secondary",onClick:ge,disabled:ve||!V,children:ve?"Saving...":"Save"}),o.jsx(st,{variant:"primary",onClick:je,disabled:ve||!V,children:"Save & Close"})]})]})]})}return o.jsxs(ln,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:Oe,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx("button",{onClick:()=>pe(fe.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Wa,{onClick:()=>Ne(fe.id)})]})]},fe.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Wa,{onClick:()=>Ne(fe.id)}),o.jsx(Mi,{onClick:()=>Fe(fe.id)}),v(fe.id,"delete")?o.jsx(wh,{onConfirm:()=>lt(fe.id),onCancel:()=>{}}):o.jsx(Ch,{onClick:()=>k(fe.id)})]})]},fe.id))})]})]})]})}function ZT(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function QT({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,c]=P.useState(!1),[u,f]=P.useState(null),l=Dt(N=>N.defaults),d=Dt(N=>N.userItems),p=Dt(N=>N.fetchWorkflows),g=[...l,...d],{isOpen:m,search:y,selectedIndex:_,filtered:k,containerRef:C,searchRef:v,handleToggle:b,handleSearchChange:x,handleKeyDown:S}=o0({items:g,isOpen:s,onOpen:()=>c(!0),onClose:()=>c(!1),filterFn:(N,D)=>!D||N.name.toLowerCase().includes(D.toLowerCase())});P.useEffect(()=>{s&&p()},[s,p]);const j=N=>{e(N),c(!1)},A=()=>{c(!1),r()};return o.jsxs("div",{ref:C,className:"relative",children:[o.jsx(l0,{label:"Workflows",isOpen:m,onClick:b}),m&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:S,children:[o.jsx(c0,{value:y,onChange:x,onKeyDown:S,ref:v,placeholder:"Search workflows..."}),o.jsx(u0,{children:k.length===0?o.jsx(d0,{hasItems:g.length>0,message:"No workflows yet"}):k.map((N,D)=>{const T=ZT(N,i),I=N.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${D===_?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>j(N.id),className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:I}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:N.name}),T!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:T?"#22c55e":"#6b7280"},title:T?"Entry condition met":"Entry condition not met"})]}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:H=>{H.stopPropagation(),c(!1),f(N.id)}})]},N.id)})}),o.jsx(h0,{label:"Manage Workflows...",onClick:A})]}),o.jsx(m0,{isOpen:!!u,onClose:()=>f(null),initialEditId:u})]})}function JT(e){return e==="criterion"}function eA(e){var r,i;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(i=e.thinkingContent)!=null&&i.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>JT(s.name))}function tA(e,r=[]){const i=[];let s=null,c=[],u,f=1;const l=new Map,d=new Map,p=[];for(const _ of r)_.type==="message"?l.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&p.push(_);let g=0;const m=()=>{if(c.length>0){const _=p[g];_&&_.type==="criteria-batch"&&_.toolCalls.length===c.length&&_.toolCalls.every((C,v)=>{var b;return C.id===((b=c[v])==null?void 0:b.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},y=()=>{if(!s)return;const _=s,k=d.get(_.subAgentId);k&&k.type==="subagent"&&k.messages.length===_.messages.length&&k.messages.every((v,b)=>v===_.messages[b])?i.push(k):i.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),s=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&u&&_.contextWindowId!==u&&(m(),y(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,eA(_)){y();for(const k of _.toolCalls)c.push(k);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(y(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{y();const k=l.get(_.id);k&&k.type==="message"&&k.message===_?i.push(k):i.push({type:"message",message:_})}}return m(),y(),i}function nA(e){const{year:r,month:i,day:s}=Nb(e);return`${r}/${i}/${s} ${Gl(e)}`}function rA(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const iA=10,sA=150;function aA(e){const r=[];if(e.recentUserPrompts)for(const i of e.recentUserPrompts)r.push({id:i.id,content:i.content,timestamp:i.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function oA(e){return[...e].sort((s,c)=>new Date(c.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,iA).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:nA(s.timestamp),trimmedContent:rA(s.content,sA),sessionId:s.sessionId,sessionName:s.sessionName}))}function lA(e,r,i){const s=[],c=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of c)s.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:i??"",sessionName:"This session"});for(const u of r)i&&u.id===i||s.push(...aA(u));return oA(s)}function cA(e,r=[],i=null){const[s,c]=P.useState(0),[u,f]=P.useState(!1),l=P.useMemo(()=>lA(e,r,i),[e,r,i]),d=P.useCallback(()=>{l.length>0&&(c(l.length-1),f(!0))},[l.length]),p=P.useCallback(()=>{f(!1),c(0)},[]),g=P.useCallback(()=>{c(_=>l.length===0?_:_===0?l.length-1:_-1)},[l.length]),m=P.useCallback(()=>{c(_=>l.length===0?_:_===l.length-1?0:_+1)},[l.length]),y=P.useCallback(()=>{if(l.length===0||!u)return null;const _=l[s];return(_==null?void 0:_.content)??null},[l,s,u]);return{history:l,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:y}}function uA({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=P.useState(""),[u,f]=P.useState([]),[l,d]=P.useState(!1),[p,g]=P.useState(null),[m,y]=P.useState(!1),[_,k]=P.useState(!1),C=P.useRef(null),v=P.useRef(null),b=P.useRef(null),x=Ee(se=>se.currentSession),S=Ee(se=>se.messages),j=Ee(se=>se.streamingMessage),A=Ee(se=>se.sessions),N=Ee(se=>se.error),D=Ee(se=>se.pendingQuestion),T=bb(),I=Ee(se=>se.sendMessage),H=Ee(se=>se.clearError),V=Ee(se=>se.acceptAndBuild),Y=Ee(se=>se.stopGeneration),q=Ee(se=>se.launchRunner),O=Ee(se=>se.cancelQueued),U=OS(),z=Dt(se=>se.defaults),X=Dt(se=>se.userItems),Q=[...z,...X],M=Dt(se=>se.fetchWorkflows);P.useEffect(()=>{M()},[M]);const{history:L,selectedIndex:B,showHistory:W,openHistory:F,closeHistory:re,navigateUp:Z,navigateDown:ee,selectCurrent:K}=cA(S,A,x==null?void 0:x.id),$=P.useMemo(()=>j?S.map(se=>se.id===j.id?j:se):S,[S,j]),ae=P.useRef([]),ne=P.useMemo(()=>{const se=tA($,ae.current);return ae.current=se,se},[$]),ve=P.useMemo(()=>BT(S),[S]),{force_scroll_to_bottom:be,isAutoScrollActive:Ae,setAutoScroll:Me}=i0(C,x),Ie=P.useCallback(()=>{const se=v.current;if(!se)return;se.style.height="auto";const Le=Math.min(200,se.scrollHeight);se.style.height=`${Le}px`},[]);P.useEffect(()=>{if(!(x!=null&&x.id))return;const se=`openfox:draft:${x.id}`,Le=localStorage.getItem(se);Le!==null&&c(Le)},[x==null?void 0:x.id]),P.useEffect(()=>{var se;(se=v.current)==null||se.focus(),Ie()},[x==null?void 0:x.id,Ie]),P.useEffect(()=>{if(!(x!=null&&x.id))return;const se=`openfox:draft:${x.id}`,Le=setTimeout(()=>{s?localStorage.setItem(se,s):localStorage.removeItem(se)},500);return()=>clearTimeout(Le)},[x==null?void 0:x.id,s]),P.useEffect(()=>{Ie()},[s,Ie]),P.useEffect(()=>{const se=Le=>{Le.key==="Escape"&&T&&Y(),Le.key==="ScrollLock"&&Me(!Ae)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[T,Y,Ae]),P.useEffect(()=>{const se=v.current;if(!se)return;const Le=async $e=>{var qe;if(document.activeElement!==se)return;const at=(qe=$e.clipboardData)==null?void 0:qe.items;if(at){for(const Ut of Array.from(at))if(Ut.type.startsWith("image/")){$e.preventDefault();const Rt=Ut.getAsFile();if(!Rt)continue;await Xd(Rt,oi=>f(fe=>[...fe,oi]),g,{filename:"pasted-image"})}}};return se.addEventListener("paste",Le),()=>se.removeEventListener("paste",Le)},[]);const Fe=()=>{c(""),f([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},ke=async se=>{se.preventDefault(),!(!s.trim()&&u.length===0)&&(be(),I(s,u.length>0?u:void 0),Fe())},ge=se=>{if(W)switch(se.key){case"Enter":se.preventDefault();const Le=K();Le&&(c(Le),re());return;case"Escape":se.preventDefault(),re(),T&&Y();return;case"ArrowUp":se.preventDefault(),Z();return;case"ArrowDown":se.preventDefault(),ee();return}if(se.key==="ArrowUp"&&s.trim()===""&&!W){se.preventDefault(),F();return}se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),ke(se))},je=P.useCallback(async se=>{const Le=se.target.files;if(!(!Le||Le.length===0)){g(null);for(const $e of Array.from(Le))await Xd($e,at=>f(qe=>[...qe,at]),g);b.current&&(b.current.value="")}},[]),We=P.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!0)},[]),Lt=P.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!1)},[]),pe=P.useCallback(async se=>{se.preventDefault(),se.stopPropagation(),d(!1),g(null);const Le=se.dataTransfer.files;if(!(!Le||Le.length===0))for(const $e of Array.from(Le))await Xd($e,at=>f(qe=>[...qe,at]),g)},[]),Ne=P.useCallback(se=>{f(Le=>Le.filter($e=>$e.id!==se))},[]),Oe=P.useCallback(()=>{var se;(se=b.current)==null||se.click()},[]),lt=(x==null?void 0:x.mode)==="planner",ue=(x==null?void 0:x.mode)==="builder",_e=((x==null?void 0:x.criteria.length)??0)>0,Te=(x==null?void 0:x.phase)==="done",Be=ne.some(se=>se.type==="message"&&se.message.role==="assistant"),Ve=lt&&_e&&!T&&Be&&!Te,Ct=se=>{const Le=s.trim()?s:void 0,$e=u.length>0?u:void 0;lt?V(se,Le,$e):ue&&q(Le,$e,se),Fe()};return o.jsxs(n2,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:$,children:[D&&o.jsx(yT,{question:D}),o.jsx(s2,{}),o.jsx(_T,{}),o.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:ne.map((se,Le)=>{if(se.type==="context-divider")return o.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),o.jsx("div",{className:"flex-1 border-t border-border"})]},Le);if(se.type==="subagent"){const at=se.messages.some(qe=>qe.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(pT,{messages:se.messages,subAgentType:se.subAgentType,subAgentId:se.subAgentId,isStreaming:at})},Le)}if(se.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(n0,{toolCalls:se.toolCalls,criteria:x==null?void 0:x.criteria})},Le);const $e=se.message;return $e.role==="assistant"?o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(af,{message:$e,showStats:!0})},Le):o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(r0,{message:$e,isLastAssistantMessage:!1,promptContext:$e.role==="user"?ve[$e.id]:void 0})},Le)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[N&&o.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-red-400 text-sm font-medium",children:N.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:N.message})]}),o.jsx(Rs,{onClick:H,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),Ve&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:Q.map(se=>{const Le=se.color??"#3b82f6",$e=parseInt(Le.slice(1,3),16),at=parseInt(Le.slice(3,5),16),qe=parseInt(Le.slice(5,7),16),Ut=`rgba(${$e},${at},${qe},0.12)`,Rt=`rgba(${$e},${at},${qe},0.22)`,oi=`rgba(${$e},${at},${qe},0.25)`;return o.jsxs("button",{onClick:()=>V(se.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:Ut,color:Le,border:`1px solid ${oi}`},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=Rt},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor=Ut},children:["▶ ",se.name]},se.id)})}),T&&o.jsx(ST,{})]})]}),o.jsxs("form",{onSubmit:ke,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>Me(!Ae),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Ae?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:b,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:je,className:"hidden",multiple:!0}),p&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:p}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(se=>o.jsx(wT,{attachment:se,onRemove:Ne},se.id))}),W&&o.jsx(CT,{history:L,selectedIndex:B,onSelect:se=>{c(se),re()},onEscape:re,onNavigate:se=>{se==="up"?Z():ee()}}),U.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:U.map(se=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${se.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[o.jsxs("span",{className:"font-medium",children:[se.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:se.content}),o.jsx(Rs,{onClick:()=>O(se.queueId),size:"sm"})]},se.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${l?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:We,onDragLeave:Lt,onDrop:pe,children:[o.jsx("button",{type:"button",onClick:Oe,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),o.jsx("textarea",{ref:v,value:s,onChange:se=>{c(se.target.value),W&&re()},onKeyDown:ge,placeholder:lt?"What would you like to build?":"Send a message...",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"}}),o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx($T,{onSendCommand:(se,Le,$e,at)=>{var Ut;Le&&(x==null?void 0:x.mode)!==Le&&Ee.getState().switchMode(Le);const qe=$e&&$e.trim()?`${$e.trim()}
|
|
149
|
+
`,children:[o.jsxs("div",{className:"text-xs text-text-muted font-mono",children:[p.formattedTimestamp,p.sessionName&&o.jsxs(o.Fragment,{children:[" | ",o.jsx("span",{className:"text-accent-primary font-medium",children:p.sessionName})]})]}),o.jsx("div",{className:"text-sm text-text-primary mt-1",children:p.trimmedContent})]},p.id))})}const kT={maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576};async function ET(e,r={}){const i={...kT,...r};if(!e.type.startsWith("image/"))throw new Error("File is not an image");if(!["image/png","image/jpeg","image/gif"].includes(e.type))throw new Error(`Unsupported image format: ${e.type}. Only PNG, JPG, and GIF are supported.`);if(e.size<=i.maxSizeBytes){const c=await e.arrayBuffer(),u=RT(c),f=`data:${e.type};base64,${u}`,l=await s0(f);return{dataUrl:f,mimeType:e.type,size:e.size,width:l.width,height:l.height}}return await jT(e,i)}async function jT(e,r){const i=await TT(e),s=await s0(i),{width:c,height:u}=NT(s.width,s.height,r.maxWidth,r.maxHeight),f=AT();f.width=c,f.height=u;const l=f.getContext("2d");if(!l)throw new Error("Failed to get canvas context");l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(s,0,0,c,u);let d=r.quality,p;do{if(p=f.toDataURL(e.type.startsWith("image/gif")?"image/png":e.type,d),Zv(p)<=r.maxSizeBytes||d<=.3)break;d-=.1}while(!0);const g=Zv(p);return{dataUrl:p,mimeType:e.type.startsWith("image/gif")?"image/png":e.type,size:g,width:c,height:u}}function NT(e,r,i,s){const c=e/r;return e>r&&e>i?{width:i,height:Math.round(i/c)}:r>e&&r>s?{width:Math.round(s*c),height:s}:{width:e,height:r}}function TT(e){return new Promise((r,i)=>{const s=LT(),c=new s;c.onload=()=>r(c.result),c.onerror=()=>i(new Error("Failed to read file")),c.readAsDataURL(e)})}function s0(e){return new Promise((r,i)=>{const s=DT(),c=new s;c.onload=()=>r(c),c.onerror=()=>i(new Error("Failed to load image")),c.src=e})}function AT(){var r;const e=of();if(!((r=e.document)!=null&&r.createElement))throw new Error("Image compression requires browser canvas APIs");return e.document.createElement("canvas")}function DT(){const e=of();if(!e.Image)throw new Error("Image compression requires browser image APIs");return e.Image}function LT(){const e=of();if(!e.FileReader)throw new Error("Image compression requires browser file APIs");return e.FileReader}function of(){return globalThis}function RT(e){const r=new Uint8Array(e);let i="";for(let s=0;s<r.byteLength;s++){const c=r[s];c!==void 0&&(i+=String.fromCharCode(c))}return btoa(i)}function Zv(e){const i=e.split(",")[1];return i?Math.round(i.length*3/4):0}function MT(e){return["image/png","image/jpeg","image/gif"].includes(e.type)}function OT(e,r=50*1024*1024){return e.size>r?{valid:!1,error:`Image file is too large (${Qv(e.size)}). Maximum size is ${Qv(r)}.`}:{valid:!0}}function Qv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Xd(e,r,i,s={}){const{maxSizeBytes:c=50*1024*1024,filename:u}=s;if(!MT(e)){i(`Unsupported file type: ${e.type}. Only PNG, JPG, and GIF are supported.`);return}const f=OT(e,c);if(!f.valid){i(f.error??"Image file is too large");return}try{const l=await ET(e,{maxWidth:1920,maxHeight:1920,quality:.85,maxSizeBytes:1048576}),d={id:fb(),filename:u??e.name,mimeType:l.mimeType,size:l.size,data:l.dataUrl};r(d)}catch(l){const d=l instanceof Error?l.message??"Failed to process image":"Failed to process image";i(d)}}function BT(e){const r={};let i=null;for(const s of e){if(s.role==="user"&&!s.isSystemGenerated){i=s.id;continue}s.role==="assistant"&&s.promptContext&&i&&r[i]===void 0&&(r[i]=s.promptContext)}return r}function IT({isOpen:e,onClose:r,providerId:i,model:s}){const[c,u]=P.useState(s.contextWindow),[f,l]=P.useState(!1),d=kt(m=>m.updateModelContext);if(P.useEffect(()=>{u(s.contextWindow)},[s]),!e)return null;const p=async()=>{c<1024||c>1e7||(l(!0),await d(i,s.id,c),l(!1),r())},g=()=>{u(s.contextWindow),r()};return o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-bg-secondary rounded-lg shadow-xl max-w-md w-full mx-4 border border-border",children:[o.jsx("div",{className:"px-6 py-4 border-b border-border",children:o.jsx("h3",{className:"text-lg font-medium text-text-primary",children:"Model Properties"})}),o.jsxs("div",{className:"px-6 py-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Model Name"}),o.jsx("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:s.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Context Window"}),o.jsx("input",{type:"number",min:1024,max:1e7,value:c,onChange:m=>u(parseInt(m.target.value)||0),className:"w-full bg-bg-tertiary border border-border rounded px-3 py-2 text-text-primary focus:outline-none focus:border-accent-primary"}),o.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Range: 1,024 - 10,000,000 tokens"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-text-secondary mb-1",children:"Source"}),o.jsxs("p",{className:"text-text-primary bg-bg-tertiary px-3 py-2 rounded",children:[s.source==="backend"&&"Auto-detected from backend",s.source==="user"&&"Manually set",s.source==="default"&&"Default value"]})]})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-border flex justify-end gap-3",children:[o.jsx("button",{type:"button",onClick:g,disabled:f,className:"px-4 py-2 text-text-secondary hover:text-text-primary transition-colors disabled:opacity-50",children:"Cancel"}),o.jsx("button",{type:"button",onClick:p,disabled:f||c<1024||c>1e7,className:"px-4 py-2 bg-accent-primary text-white rounded hover:opacity-90 transition-opacity disabled:opacity-50 disabled:cursor-not-allowed",children:f?"Saving...":"Save"})]})]})})}function zT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function HT(){var U;const[,e]=ar(),r=Ee(z=>z.currentSession),i=Ee(z=>z.setSessionProvider),[s,c]=P.useState(!1),[u,f]=P.useState([]),[l,d]=P.useState(null),p=P.useRef(null),[g,m]=P.useState(null),y=P.useRef(new Set),_=kt(z=>z.providers),k=kt(z=>z.activeProviderId),C=kt(z=>z.model);kt(z=>z.backend);const v=kt(z=>z.llmStatus),b=kt(z=>z.activating),x=kt(z=>z.activateProvider),S=kt(z=>z.refreshModel),j=kt(z=>z.refreshProviderModels);P.useEffect(()=>{function z(X){p.current&&!p.current.contains(X.target)&&(c(!1),f([]),y.current=new Set)}return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]),P.useEffect(()=>{if(s){const z=_.map(X=>X.id);f(z),z.forEach(X=>{y.current.has(X)||(y.current.add(X),D(X))})}},[s,_]),_.find(z=>z.id===k);const A=v==="disconnected",N=C?((U=C.split("/").pop())==null?void 0:U.replace(/-/g," "))??C:"detecting...",D=async z=>{d(z);try{await j(z)}catch{}finally{d(null)}},T=z=>{u.includes(z.id)?f(u.filter(X=>X!==z.id)):(f([...u,z.id]),D(z.id))},I=async z=>{if(z.id===k){T(z);return}r?(i(z.id,void 0),kt.getState().syncFromSession(z.id,""),c(!1),f([])):await x(z.id)&&(c(!1),f([]))},H=z=>{T(z)},V=async(z,X)=>{z.stopPropagation(),y.current.delete(X),await j(X),await D(X)},Y=(z,X)=>{m({providerId:z,model:X})},q=()=>{m(null)},O=async(z,X)=>{if(console.log("[ProviderSelector.handleModelClick] providerId:",z,"model:",X),r){console.log("[ProviderSelector.handleModelClick] Calling setSessionProvider"),i(z,X),kt.getState().syncFromSession(z,X),f([]),c(!1);return}d("activating");try{(await Ce(`/api/providers/${z}/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:X})})).ok&&(await kt.getState().fetchConfig(),f([]),c(!1))}catch{}finally{d(null)}};return _.length===0?o.jsxs("button",{type:"button",onClick:()=>S(),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:A?"LLM server is offline. Click to retry.":C??"Click to refresh model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"LLM offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("span",{className:"text-text-muted opacity-0 group-hover:opacity-100 transition-opacity",children:"↻"})]}):o.jsxs("div",{className:"relative",ref:p,children:[o.jsxs("button",{type:"button",onClick:()=>c(!s),className:"flex items-center gap-1 px-1.5 py-0.5 rounded hover:bg-bg-tertiary transition-colors group",title:"Click to switch provider or model",children:[A?o.jsx("span",{className:"text-sm text-accent-error animate-pulse",children:"offline"}):o.jsx("span",{className:"text-sm text-accent-primary",children:N}),o.jsx("svg",{className:`w-3 h-3 text-text-muted transition-transform ${s?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[o.jsx("div",{className:"py-1",children:_.map(z=>{var X;return o.jsxs("div",{children:[o.jsxs("div",{className:`px-3 py-2 flex items-center justify-between ${z.id===k?"bg-bg-tertiary":"hover:bg-bg-tertiary"} ${b?"opacity-50 cursor-wait":"cursor-pointer"}`,children:[o.jsxs("div",{onClick:()=>!b&&I(z),className:"flex flex-col min-w-0 flex-1 cursor-pointer",children:[o.jsx("span",{className:`text-sm font-medium truncate ${z.id===k?"text-accent-primary":"text-text-primary"}`,children:z.name}),o.jsx("span",{className:"text-xs text-text-muted truncate",children:z.backend!=="auto"&&vS(z.backend)})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[z.id===k?o.jsx("span",{className:"text-accent-success",title:"Active",children:o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"w-4"}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),V(Q,z.id)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Refresh models",children:o.jsx("svg",{className:`w-4 h-4 ${l===z.id?"animate-spin":""} ${z.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),o.jsx("button",{type:"button",onClick:Q=>{Q.stopPropagation(),H(z)},className:"p-0.5 hover:bg-bg-tertiary rounded transition-colors",title:"Show models",children:o.jsx("svg",{className:`w-4 h-4 transition-transform ${u.includes(z.id)?"rotate-180":""} ${z.id===k?"text-accent-primary":"text-text-muted"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),u.includes(z.id)&&o.jsx("div",{className:"bg-bg-primary border-t border-border",children:l===z.id?o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"Loading models..."}):(X=z.models)!=null&&X.length?z.models.map(Q=>{var M;return o.jsxs("button",{type:"button",onClick:()=>O(z.id,Q.id),disabled:l==="activating",className:`w-full px-4 py-1.5 text-left hover:bg-bg-tertiary transition-colors text-sm flex items-center justify-between group ${l==="activating"?"opacity-50 cursor-wait":""} ${C===Q.id?"text-accent-primary":"text-text-secondary"}`,children:[o.jsx("span",{className:"truncate flex-1",children:((M=Q.id.split("/").pop())==null?void 0:M.replace(/-/g," "))??Q.id}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsx("span",{className:"text-xs text-text-muted",children:zT(Q.contextWindow)}),o.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),Y(z.id,Q)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-bg-tertiary rounded transition-opacity",title:"Edit model context",children:o.jsx("svg",{className:"w-3 h-3 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})})]}),C===Q.id&&o.jsx("span",{className:"text-accent-success flex-shrink-0 ml-1",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},Q.id)}):o.jsx("div",{className:"px-4 py-2 text-xs text-text-muted",children:"No models available"})})]},z.id)})}),o.jsx("div",{className:"border-t border-border px-3 py-2",children:o.jsx("button",{onClick:()=>e("/onboarding"),className:"text-xs text-accent-primary hover:underline",children:"Manage providers"})})]}),g&&o.jsx(IT,{isOpen:!0,onClose:q,providerId:g.providerId,model:g.model})]})}const Dn=Wn((e,r)=>({defaults:[],userItems:[],loading:!1,fetchCommands:async()=>{await _h("/api/commands",e)},fetchCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`);return s.ok?await s.json():null}catch{return null}},fetchDefaultContent:async i=>{try{const s=await Ce(`/api/commands/defaults/${i}`);return s.ok?await s.json():null}catch{return null}},createCommand:async i=>{const s=await si("POST","/api/commands",i);return s.success&&await r().fetchCommands(),s},updateCommand:async(i,s)=>{const c=await si("PUT",`/api/commands/${i}`,s);return c.success&&await r().fetchCommands(),c},deleteCommand:async i=>{try{const s=await Ce(`/api/commands/${i}`,{method:"DELETE"}),c=await s.json();return s.ok?(e(u=>({userItems:u.userItems.filter(f=>f.id!==i)})),{success:!0}):{success:!1,error:c.error??"Failed to delete"}}catch{return{success:!1,error:"Network error"}}},duplicateCommand:async i=>{try{const s=await Ce(`/api/commands/${i}/duplicate`,{method:"POST"}),c=await s.json();return s.ok?(await r().fetchCommands(),{success:!0}):{success:!1,error:c.error??"Failed to duplicate"}}catch{return{success:!1,error:"Network error"}}}}));function PT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}const FT="M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z";function UT({onClick:e}){return o.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:FT})})})}function a0({isOpen:e,onClose:r,initialEditId:i}){const s=Dn(ge=>ge.defaults),c=Dn(ge=>ge.userItems),u=Dn(ge=>ge.loading),f=Dn(ge=>ge.fetchCommands),l=Dn(ge=>ge.fetchCommand),d=Dn(ge=>ge.fetchDefaultContent),p=Dn(ge=>ge.createCommand),g=Dn(ge=>ge.updateCommand),m=Dn(ge=>ge.deleteCommand),[y,_]=P.useState(null),[k,C]=P.useState(null),{view:v,editingId:b,formError:x,saving:S,formData:j,setView:A,setEditingId:N,setFormError:D,setFormData:T,setSaving:I}=Cb(),{requestDelete:H,clearConfirm:V,isConfirming:Y}=Sh(),q=P.useRef(!1),O=Wt(ge=>ge.defaults),U=Wt(ge=>ge.userItems),z=Wt(ge=>ge.fetchAgents),Q=[...O,...U].filter(ge=>!ge.subagent),M=P.useRef(f),L=P.useRef(z),B=P.useRef(l),W=P.useRef(d),F=P.useRef(i),re=P.useRef(A),Z=P.useRef(N),ee=P.useRef(D),K=P.useRef(V);P.useEffect(()=>{M.current=f,L.current=z,B.current=l,W.current=d,F.current=i,re.current=A,Z.current=N,ee.current=D,K.current=V}),P.useEffect(()=>{if(e)if(M.current(),L.current(),q.current||(K.current(),q.current=!0),F.current){const ge=s.some(je=>je.id===F.current);re.current("edit"),Z.current(F.current),ee.current(""),ge?W.current(F.current).then(je=>{je&&T({name:je.metadata.name+" (copy)",id:`${F.current}-copy-${Date.now()}`,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!0})}):B.current(F.current).then(je=>{je&&T({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1})})}else re.current("list"),Z.current(null);else q.current=!1},[e]);const $=async ge=>{_(ge);const je=await d(ge);C((je==null?void 0:je.prompt)??null)},ae=async ge=>{if(s.some(We=>We.id===ge)){const We=await d(ge);We&&(N(null),T({name:`${We.metadata.name} (copy)`,id:`${ge}-copy-${Date.now()}`,prompt:We.prompt,agentMode:We.metadata.agentMode??"",isDefault:!0}),D(""),A("edit"))}else{const We=await l(ge);We&&(N(null),T({name:`${We.metadata.name} (copy)`,id:`${ge}-copy-${Date.now()}`,prompt:We.prompt,agentMode:We.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))}},ne=()=>{T({name:"",id:"",prompt:"",agentMode:"",isDefault:!1}),N(null),A("edit")},ve=async ge=>{const je=await l(ge);je&&(N(ge),T({name:je.metadata.name,id:je.metadata.id,prompt:je.prompt,agentMode:je.metadata.agentMode??"",isDefault:!1}),D(""),A("edit"))},be=async ge=>{await m(ge),V()},Ae=async()=>{const ge=b??j.id;if(!ge||!j.name||!j.prompt){D("Name and message are required.");return}I(!0),D("");const je={metadata:{id:ge,name:j.name,...j.agentMode?{agentMode:j.agentMode}:{}},prompt:j.prompt},We=b?await g(b,je):await p(je);if(I(!1),!We.success){D(We.error??"Failed to save command.");return}i?r():A("list")},Me=()=>{i?r():(A("list"),_(null),C(null))},Ie=ge=>{T(je=>({...je,name:ge})),(!b||j.isDefault)&&T(je=>({...je,id:PT(ge)}))},Fe=()=>{_(null),C(null),A("list")},ke=()=>{y&&(_(null),A("edit"),N(y),d(y).then(ge=>{ge&&T({name:`${ge.metadata.name} (copy)`,id:`${y}-copy-${Date.now()}`,prompt:ge.prompt,agentMode:ge.metadata.agentMode??"",isDefault:!0})}))};if(y){const ge=s.find(je=>je.id===y);return o.jsx(cn,{isOpen:e,onClose:Fe,title:`Default: ${(ge==null?void 0:ge.name)??y}`,size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded bg-bg-tertiary text-text-secondary",children:"Built-in"}),o.jsx("span",{className:"font-mono",children:y})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Name"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm",children:ge==null?void 0:ge.name})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Agent Mode"}),o.jsx("div",{className:"px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm text-text-muted",children:(ge==null?void 0:ge.agentMode)||"None"})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:k??"",readOnly:!0,placeholder:"...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none opacity-60"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Fe,children:"Close"}),o.jsx(st,{variant:"primary",onClick:ke,children:"Duplicate & Customize"})]})]})})}return v==="edit"?o.jsx(cn,{isOpen:e,onClose:Me,title:b?"Edit Command":"New Command",size:"xl",children:o.jsxs("div",{className:"flex flex-col h-full",children:[x&&o.jsx(kh,{message:x}),o.jsxs("div",{className:"space-y-3 mb-3",children:[o.jsx(wb,{name:j.name,id:j.id,nameLabel:"Name",idLabel:"ID",namePlaceholder:"My Command",idPlaceholder:"my-command",readOnlyId:!!b&&!j.isDefault,onNameChange:Ie,onIdChange:ge=>T(je=>({...je,id:ge}))}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-xs text-text-secondary mb-1",children:["Agent Mode ",o.jsx("span",{className:"text-text-muted",children:"(optional)"})]}),o.jsxs("select",{value:j.agentMode,onChange:ge=>T(je=>({...je,agentMode:ge.target.value})),className:"w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",children:[o.jsx("option",{value:"",children:"None (keep current mode)"}),Q.map(ge=>o.jsx("option",{value:ge.id,children:ge.name},ge.id))]})]})]}),o.jsxs("div",{className:"flex-1 min-h-[120px] border-t border-border pt-3 flex flex-col",children:[o.jsx("label",{className:"block text-xs text-text-secondary mb-1",children:"Message"}),o.jsx("textarea",{value:j.prompt,onChange:ge=>T(je=>({...je,prompt:ge.target.value})),placeholder:"The message that will be sent when this command is triggered...",className:"flex-1 w-full px-3 py-2 bg-bg-tertiary border border-border rounded text-sm font-mono resize-none focus:outline-none focus:ring-1 focus:ring-accent-primary"})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border flex-shrink-0",children:[o.jsx(st,{variant:"secondary",onClick:Me,children:"Cancel"}),o.jsx(st,{variant:"primary",onClick:Ae,disabled:S||!j.name||!j.prompt,children:S?"Saving...":"Save"})]})]})}):o.jsxs(cn,{isOpen:e,onClose:r,title:"Commands",size:"lg",children:[o.jsx(yb,{description:"Commands are pre-defined messages you can send with a single click.",onNew:ne}),o.jsxs(Sb,{loading:u,hasItems:s.length>0||c.length>0,loadingLabel:"Loading commands...",emptyLabel:"No commands created yet.",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(ge=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(UT,{onClick:()=>$(ge.id)}),o.jsx(Wa,{onClick:()=>ae(ge.id)})]})]},ge.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(ge=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsx("div",{className:"min-w-0 flex-1 mr-3",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-text-primary text-sm font-medium",children:ge.name})})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Mi,{onClick:()=>ve(ge.id)}),o.jsx(Wa,{onClick:()=>ae(ge.id)}),Y(ge.id,"delete")?o.jsx(wh,{onConfirm:()=>be(ge.id),onCancel:V}):o.jsx(Ch,{onClick:()=>H(ge.id)})]})]},ge.id))})]})]})]})}function o0({items:e,isOpen:r,onOpen:i,onClose:s,filterFn:c}){const[u,f]=P.useState(""),[l,d]=P.useState(0),p=P.useRef(null),g=P.useRef(null);P.useEffect(()=>{r&&(f(""),d(0),requestAnimationFrame(()=>{var v;return(v=g.current)==null?void 0:v.focus()}))},[r]),P.useEffect(()=>{if(!r)return;const v=b=>{p.current&&!p.current.contains(b.target)&&s()};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[r,s]);const m=P.useCallback(()=>{r?s():i()},[r,i,s]),y=P.useCallback(v=>{f(v),d(0)},[]),_=P.useCallback(v=>{const b=e.filter(x=>c(x,u));switch(v.key){case"ArrowDown":v.preventDefault(),d(x=>Math.min(x+1,b.length-1));break;case"ArrowUp":v.preventDefault(),d(x=>Math.max(x-1,0));break;case"Enter":v.preventDefault();break;case"Escape":v.preventDefault(),s();break}},[e,u,c,s]),k=P.useCallback(()=>{d(0)},[]),C=e.filter(v=>c(v,u));return{isOpen:r,search:u,selectedIndex:l,filtered:C,containerRef:p,searchRef:g,handleToggle:m,handleSearchChange:y,handleKeyDown:_,setSelectedIndex:d,resetSelection:k}}function l0({label:e,isOpen:r,onClick:i,className:s=""}){return o.jsxs("button",{type:"button",onClick:i,className:`flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors ${s}`,children:[e,o.jsx("svg",{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]})}function c0({value:e,onChange:r,onKeyDown:i,ref:s,placeholder:c}){return o.jsx("div",{className:"p-2 border-b border-border",children:o.jsx("input",{ref:s,value:e,onChange:u=>r(u.target.value),onKeyDown:i,placeholder:c,className:"w-full px-2 py-1 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary"})})}function u0({children:e,maxHeight:r="max-h-64"}){return o.jsx("div",{className:`overflow-y-auto ${r} p-1`,children:e})}function d0({hasItems:e,message:r}){return o.jsx("div",{className:"px-3 py-2 text-text-muted text-sm",children:e?"No matches":r})}function h0({label:e,onClick:r}){return o.jsx("div",{className:"border-t border-border p-1",children:o.jsx("button",{type:"button",onClick:r,className:"w-full text-left px-3 py-1.5 rounded text-sm text-text-muted hover:text-text-primary hover:bg-bg-tertiary transition-colors",children:e})})}function $T({onSendCommand:e,onOpenManager:r,textareaContent:i,attachments:s}){const[c,u]=P.useState(!1),[f,l]=P.useState(null),d=Dn(D=>D.defaults),p=Dn(D=>D.userItems),g=Dn(D=>D.fetchCommands),m=[...d,...p],{isOpen:y,search:_,selectedIndex:k,filtered:C,containerRef:v,searchRef:b,handleToggle:x,handleSearchChange:S,handleKeyDown:j}=o0({items:m,isOpen:c,onOpen:()=>u(!0),onClose:()=>u(!1),filterFn:(D,T)=>!T||D.name.toLowerCase().includes(T.toLowerCase())});P.useEffect(()=>{c&&g()},[c,g]);const A=async D=>{const T=await Dn.getState().fetchCommand(D);T&&e(T.prompt,T.metadata.agentMode,i,s),u(!1)},N=()=>{u(!1),r()};return o.jsxs("div",{ref:v,className:"relative",children:[o.jsx(l0,{label:"Commands",isOpen:y,onClick:x}),y&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:j,children:[o.jsx(c0,{value:_,onChange:S,onKeyDown:j,ref:b,placeholder:"Search commands..."}),o.jsx(u0,{children:C.length===0?o.jsx(d0,{hasItems:m.length>0,message:"No commands yet"}):C.map((D,T)=>o.jsxs("div",{className:`flex items-center gap-1 px-3 py-2 rounded transition-colors group ${T===k?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsx("button",{type:"button",onClick:()=>A(D.id),className:"flex-1 text-left",children:o.jsx("div",{className:"text-sm text-text-primary font-medium",children:D.name})}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:I=>{I.stopPropagation(),u(!1),l(D.id)}})]},D.id))}),o.jsx(h0,{label:"Manage Commands...",onClick:N})]}),o.jsx(a0,{isOpen:!!f,onClose:()=>l(null),initialEditId:f})]})}function qT(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function WT(e){let r=1;for(;e.some(i=>i.id===`s${r}`);)r++;return`s${r}`}const GT=[{value:"agent",label:"Agent"},{value:"sub_agent",label:"Sub-Agent"},{value:"shell",label:"Shell"}],f0={all_criteria_passed:"All passed",all_criteria_completed_or_passed:"All completed",any_criteria_blocked:"Blocked",has_pending_criteria:"Pending/Failed",step_result:"Result",always:"Always"},p0=[{value:"all_criteria_passed",label:"All criteria passed"},{value:"all_criteria_completed_or_passed",label:"All criteria completed or passed"},{value:"any_criteria_blocked",label:"Any criteria blocked (retry limit)"},{value:"has_pending_criteria",label:"Has pending or failed criteria"},{value:"step_result",label:"Step result is..."},{value:"always",label:"Always (fallback)"}],ji=150,Nr=54,js=80,Tn=30,Ns=70,Jv=100,Ni=50,jl=50,eb=4;function lf(e,r){if(e.type==="agent"){const i=r.find(s=>s.id===e.toolMode);return{name:(i==null?void 0:i.name)??(e.toolMode||"Agent"),color:(i==null?void 0:i.color)||"#3b82f6"}}if(e.type==="sub_agent"){const i=r.find(s=>s.id===e.subAgentType);return{name:(i==null?void 0:i.name)??(e.subAgentType||"Sub-Agent"),color:(i==null?void 0:i.color)||"#a855f7"}}return{name:"Shell",color:"#22c55e"}}function VT(e,r,i,s){const c=jl+Ni+ji+Jv+ji+Ni+jl,u=c/2,f=jl+Ni+ji/2,l=jl+Ni+ji+Jv+ji/2,d=[],p=[],g=new Map,m=e.filter(O=>O.type==="agent"||O.type==="shell"),y=e.filter(O=>O.type==="sub_agent"),_=y.length>0,k=_?f:u,C=m.length>0?l:u,v=Ni+Tn/2;if(d.push({id:"$start",type:"terminal",label:"Start",cx:k,cy:v,w:js,h:Tn}),g.set("$start",{cx:k,cy:v,w:js,h:Tn}),e.length===0){const O=v+Tn/2+Ns*2+Tn/2;return d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:O,w:js,h:Tn}),g.set("$done",{cx:k,cy:O,w:js,h:Tn}),{nodes:d,edges:p,width:c,height:O+Tn/2+Ni,posMap:g}}const b=v+Tn/2+Ns,x=(O,U)=>{O.forEach((z,X)=>{const Q=b+X*(Nr+Ns)+Nr/2,{name:M,color:L}=lf(z,s);d.push({id:z.id,type:"step",label:M,color:L,cx:U,cy:Q,w:ji,h:Nr}),g.set(z.id,{cx:U,cy:Q,w:ji,h:Nr})})};x(m,k),x(y,C);const S=m.length>0?b+(m.length-1)*(Nr+Ns)+Nr/2:v,j=_?b+(y.length-1)*(Nr+Ns)+Nr/2:v,A=Math.max(S,j)+Nr/2+Ns+Tn/2;d.push({id:"$done",type:"terminal",label:"Done",cx:k,cy:A,w:js,h:Tn}),g.set("$done",{cx:k,cy:A,w:js,h:Tn});const N=[];r&&g.has(r)&&N.push({from:"$start",to:r,label:i,edgeKey:"start",direction:"down",backEdgeIndex:0});let D=0;for(const O of e)O.transitions.forEach((U,z)=>{if(!U.goto||!g.has(U.goto))return;const X=g.get(O.id),Q=g.get(U.goto),M=U.when.type==="step_result"?`${U.when.result}`:f0[U.when.type]??U.when.type,L=O.id===U.goto;let B;L?B="back":Q.cy>X.cy+1?B="down":Q.cy<X.cy-1?B="back":B="same",N.push({from:O.id,to:U.goto,label:M,edgeKey:`${O.id}:${z}`,direction:B,backEdgeIndex:B==="back"?D++:0})});const T=new Map,I=new Map,H=new Map,V=new Map;for(const O of N)O.direction==="down"&&(T.set(O.from,(T.get(O.from)??0)+1),I.set(O.to,(I.get(O.to)??0)+1));const Y=new Map,q=new Map;for(const O of N){if(O.direction!=="same")continue;const U=[O.from,O.to].sort().join("|");Y.set(U,(Y.get(U)??0)+1)}for(const O of N){if(O.direction==="back"||O.direction==="same"){let B=0;if(O.direction==="same"){const W=[O.from,O.to].sort().join("|");B=q.get(W)??0,q.set(W,B+1)}p.push({...O,fromPort:0,toPort:0,sameEdgeIndex:B});continue}const U=T.get(O.from)??1,z=I.get(O.to)??1,X=H.get(O.from)??0,Q=V.get(O.to)??0;H.set(O.from,X+1),V.set(O.to,Q+1);const M=U===1?0:-.6+1.2*X/(U-1),L=z===1?0:-.6+1.2*Q/(z-1);p.push({...O,fromPort:M,toPort:L,sameEdgeIndex:0})}return{nodes:d,edges:p,width:c,height:A+Tn/2+Ni,posMap:g}}function YT({steps:e,entryStep:r,selectedNodeId:i,selectedEdgeKey:s,startConditionLabel:c,agentTypes:u,isReadOnly:f,onSelectNode:l,onSelectEdge:d,onRemoveStep:p,onCreateTransition:g,onReconnectTo:m,onReconnectFrom:y,onDeleteTransition:_}){const k=P.useRef(null),C=P.useRef(!1),[v,b]=P.useState(null),[x,S]=P.useState(null),[j,A]=P.useState(null),{nodes:N,edges:D,width:T,height:I,posMap:H}=P.useMemo(()=>VT(e,r,c,u),[e,r,c,u]),V=P.useCallback(Z=>{var ne;const ee=k.current;if(!ee)return{x:0,y:0};const K=ee.createSVGPoint();K.x=Z.clientX,K.y=Z.clientY;const $=(ne=ee.getScreenCTM())==null?void 0:ne.inverse();if(!$)return{x:0,y:0};const ae=K.matrixTransform($);return{x:ae.x,y:ae.y}},[]),Y=P.useCallback(Z=>!Z||!x||Z==="$start"?!1:x.type==="reconnect-from"?Z!=="$done":!0,[x]),q=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"new",fromNodeId:ee,mouseX:K.x,mouseY:K.y})},[V,f]),O=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"reconnect-to",fromNodeId:ee.from,edgeKey:ee.edgeKey,mouseX:K.x,mouseY:K.y})},[V,f]),U=P.useCallback((Z,ee)=>{if(f)return;Z.stopPropagation(),Z.preventDefault();const K=V(Z);S({type:"reconnect-from",fromNodeId:ee.from,fixedTargetId:ee.to,edgeKey:ee.edgeKey,mouseX:K.x,mouseY:K.y})},[V,f]),z=P.useCallback(Z=>{if(!x)return;const ee=V(Z);S(K=>K?{...K,mouseX:ee.x,mouseY:ee.y}:null)},[x,V]),X=P.useCallback(()=>{x&&(C.current=!0,j&&Y(j)&&(x.type==="new"?g(x.fromNodeId,j):x.type==="reconnect-to"?m(x.edgeKey,j):x.type==="reconnect-from"&&y(x.edgeKey,j)),S(null),A(null))},[x,j,Y,g,m,y]),Q=P.useCallback(()=>{if(C.current){C.current=!1;return}l(null),d(null)},[l,d]);P.useEffect(()=>{if(f)return;const Z=ee=>{ee.target instanceof HTMLInputElement||ee.target instanceof HTMLTextAreaElement||ee.target instanceof HTMLSelectElement||(ee.key==="Delete"||ee.key==="Backspace")&&s&&s!=="start"&&(ee.preventDefault(),_(s),d(null))};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[f,s,_,d]);const M=Z=>{const ee=H.get(Z.from),K=H.get(Z.to);if(!ee||!K)return null;let $,ae,ne,ve="middle",be,Ae;if(Z.direction==="down"){const Me=ee.cx+Z.fromPort*(ee.w/2-10),Ie=ee.cy+ee.h/2,Fe=K.cx+Z.toPort*(K.w/2-10),ke=K.cy-K.h/2,ge=ke-Ie,je=Fe-Me;$=`M ${Me} ${Ie} C ${Me} ${Ie+ge*.4}, ${Fe-je*.2} ${ke-ge*.1}, ${Fe} ${ke}`,ae=Me+(Fe-Me)*.5,ne=Ie+ge*.6,be={x:Me,y:Ie},Ae={x:Fe,y:ke}}else if(Z.direction==="back"){const Me=Z.from===Z.to,Ie=ee.cx>=T/2,Fe=Z.backEdgeIndex*16,ke=Ie?T-20-Fe:20+Fe;if(Me){const ge=ee.cx>=T/2,je=30+Z.backEdgeIndex*14,We=ee.cy-ee.h/2,Lt=ge?ee.cx+ee.w/2:ee.cx-ee.w/2,pe=ge?Lt+je:Lt-je,Ne=ee.cx+(ge?ee.w/4:-ee.w/4),Oe=We-20-Z.backEdgeIndex*10;$=`M ${Lt} ${ee.cy} C ${pe} ${ee.cy}, ${pe} ${Oe}, ${Ne} ${We}`,ae=pe+10,ne=Oe+4,ve="middle",be={x:Lt,y:ee.cy},Ae={x:Ne,y:We}}else{const ge=Ie?ee.cx+ee.w/2:ee.cx-ee.w/2,je=K.cx+(Ie?K.w/4:-K.w/4),We=Math.min(ee.cy,K.cy)-K.h/2-18-Z.backEdgeIndex*14;$=`M ${ge} ${ee.cy} L ${ke} ${ee.cy} L ${ke} ${We} L ${je} ${We} L ${je} ${K.cy-K.h/2}`,ae=ke,ne=(ee.cy+We)/2,ve=Ie?"start":"end",be={x:ge,y:ee.cy},Ae={x:je,y:K.cy-K.h/2}}}else{const Me=K.cx>ee.cx,Ie=Z.sameEdgeIndex===0?-12:12,Fe=Me?ee.cx+ee.w/2:ee.cx-ee.w/2,ke=Me?K.cx-K.w/2:K.cx+K.w/2,ge=ee.cy+Ie,je=K.cy+Ie,We=(Fe+ke)/2;$=`M ${Fe} ${ge} C ${We} ${ge}, ${We} ${je}, ${ke} ${je}`,ae=We,ne=(ge+je)/2-6,be={x:Fe,y:ge},Ae={x:ke,y:je}}return{path:$,labelX:ae,labelY:ne,labelAnchor:ve,fromPt:be,toPt:Ae}},L=(Z,ee)=>{const K=M(Z);if(!K)return null;const{path:$,labelX:ae,labelY:ne,labelAnchor:ve}=K,be=s===Z.edgeKey,Ae=Z.label&&!(Z.from==="$start"&&Z.label==="Always");return o.jsxs("g",{children:[o.jsx("path",{d:$,fill:"none",stroke:"transparent",strokeWidth:14,className:"cursor-pointer",onClick:Me=>{Me.stopPropagation(),d(be?null:Z.edgeKey)}}),o.jsx("path",{d:$,fill:"none",stroke:be?"#58a6ff":"#484f58",strokeWidth:be?2.2:1.2,markerEnd:be?"url(#arrow-selected)":"url(#arrow)",pointerEvents:"none"}),Ae&&o.jsx("text",{x:ae+(ve==="start"?5:ve==="end"?-5:0),y:ne+3,textAnchor:ve,className:"text-[8px]",fill:be?"#79c0ff":"#8b949e",style:{paintOrder:"stroke",stroke:"#0d1117",strokeWidth:3,strokeLinejoin:"round"},pointerEvents:"none",children:Z.label})]},ee)},B=()=>{if(!s||x)return null;const Z=D.find(ne=>ne.edgeKey===s);if(!Z)return null;const ee=M(Z);if(!ee)return null;const{fromPt:K,toPt:$}=ee,ae=6;return o.jsxs(o.Fragment,{children:[Z.edgeKey!=="start"&&o.jsx("circle",{cx:K.x,cy:K.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>U(ne,Z)}),o.jsx("circle",{cx:$.x,cy:$.y,r:ae,fill:"#58a6ff",fillOpacity:.25,stroke:"#58a6ff",strokeWidth:2,strokeOpacity:.8,className:"cursor-grab",onMouseDown:ne=>O(ne,Z)})]})},W=()=>{if(!x)return null;let Z,ee,K,$;if(x.type==="reconnect-from"){const ve=H.get(x.fixedTargetId);if(!ve)return null;Z=x.mouseX,ee=x.mouseY,K=ve.cx,$=ve.cy-ve.h/2}else{const ve=H.get(x.fromNodeId);if(!ve)return null;Z=ve.cx,ee=ve.cy+ve.h/2,K=x.mouseX,$=x.mouseY}const ae=$-ee,ne=Math.abs(ae)>10?`M ${Z} ${ee} C ${Z} ${ee+ae*.4}, ${K} ${$-ae*.4}, ${K} ${$}`:`M ${Z} ${ee} L ${K} ${$}`;return o.jsx("path",{d:ne,fill:"none",stroke:"#58a6ff",strokeWidth:2,strokeDasharray:"6 3",strokeOpacity:.7,pointerEvents:"none"})},F=Z=>{const ee=Z.cy+Z.h/2,K=(x==null?void 0:x.fromNodeId)===Z.id;return o.jsx("circle",{cx:Z.cx,cy:ee,r:eb,fill:K?"#58a6ff":"#1c2128",stroke:K?"#58a6ff":"#484f58",strokeWidth:1.5,strokeOpacity:K?1:.5,className:"cursor-crosshair",onMouseDown:$=>q($,Z.id)})},re=Z=>{const ee=Z.cy-Z.h/2,K=x&&j===Z.id&&Y(Z.id);return o.jsx("circle",{cx:Z.cx,cy:ee,r:eb,fill:K?"#3fb950":"#1c2128",stroke:K?"#3fb950":"#484f58",strokeWidth:1.5,strokeOpacity:K?1:.5})};return o.jsxs("svg",{ref:k,viewBox:`0 0 ${T} ${I}`,className:"block w-full",preserveAspectRatio:"xMidYMin meet",onMouseMove:z,onMouseUp:X,onClick:Q,children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"arrow",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#484f58"})}),o.jsx("marker",{id:"arrow-selected",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"7",markerHeight:"5",orient:"auto",children:o.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"#58a6ff"})})]}),D.map((Z,ee)=>L(Z,ee)),N.map(Z=>{const ee=i===Z.id,K=Z.cx-Z.w/2,$=Z.cy-Z.h/2,ae=v===Z.id,ne=x&&j===Z.id&&Y(Z.id);if(Z.type==="terminal"){const be=Z.id==="$start",Ae=be?"#58a6ff":"#3fb950",Me=be,Ie=!be;return o.jsxs("g",{onClick:Fe=>{Fe.stopPropagation(),be&&!f&&d("start")},className:be&&!f?"cursor-pointer":void 0,children:[ne&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),be&&s==="start"&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:Z.h/2+3,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:K,y:$,width:Z.w,height:Z.h,rx:Z.h/2,fill:Ae,fillOpacity:.08,stroke:Ae,strokeOpacity:.4,strokeWidth:1.5}),o.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:Ae,className:"text-[10px] font-medium",pointerEvents:"none",children:Z.label}),Me&&F(Z),Ie&&re(Z)]},Z.id)}const ve=Z.color??"#6b7280";return o.jsxs("g",{onClick:be=>{be.stopPropagation(),f||l(ee?null:Z.id)},onMouseEnter:()=>b(Z.id),onMouseLeave:()=>b(null),className:f?void 0:"cursor-pointer",children:[ne&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#3fb950",strokeOpacity:.6,strokeWidth:2}),ee&&o.jsx("rect",{x:K-3,y:$-3,width:Z.w+6,height:Z.h+6,rx:12,fill:"none",stroke:"#58a6ff",strokeOpacity:.5,strokeWidth:2}),o.jsx("rect",{x:K,y:$,width:Z.w,height:Z.h,rx:10,fill:ve,fillOpacity:.08,stroke:ve,strokeOpacity:.6,strokeWidth:ee?2:1.5}),o.jsx("text",{x:Z.cx,y:Z.cy+4,textAnchor:"middle",fill:"#c9d1d9",className:"text-[11px] font-medium",pointerEvents:"none",children:Z.label}),!f&&F(Z),!f&&re(Z),ae&&!x&&!f&&o.jsxs("g",{onClick:be=>{be.stopPropagation(),p(Z.id)},className:"cursor-pointer",children:[o.jsx("circle",{cx:K+Z.w-2,cy:$+2,r:8,fill:"#0d1117",fillOpacity:.9,stroke:"#f85149",strokeOpacity:.5,strokeWidth:1}),o.jsx("line",{x1:K+Z.w-5,y1:$-1,x2:K+Z.w+1,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"}),o.jsx("line",{x1:K+Z.w+1,y1:$-1,x2:K+Z.w-5,y2:$+5,stroke:"#f85149",strokeWidth:1.5,strokeLinecap:"round"})]})]},Z.id)}),x&&N.map(Z=>Y(Z.id)?o.jsx("rect",{x:Z.cx-Z.w/2-8,y:Z.cy-Z.h/2-8,width:Z.w+16,height:Z.h+16,fill:"transparent",rx:12,onMouseEnter:()=>A(Z.id),onMouseLeave:()=>A(null),onMouseUp:ee=>{ee.stopPropagation(),X()}},`drop-${Z.id}`):null),W(),B()]})}const Kn="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",Li="w-full px-2 py-1.5 bg-bg-tertiary border border-border rounded text-sm focus:outline-none focus:ring-1 focus:ring-accent-primary",rn="block text-[11px] text-text-secondary mb-0.5";function KT({fromLabel:e,toLabel:r,condition:i,fromStep:s,agentTypes:c,onUpdateCondition:u,onDelete:f}){const l=s&&(s.type==="sub_agent"||s.type==="agent")?c.find(p=>p.id===(s.type==="sub_agent"?s.subAgentType:s.toolMode)):void 0,d=(l==null?void 0:l.results)&&l.results.length>0;return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/15 text-blue-300",children:"Transition"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"font-medium text-text-primary",children:e}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"font-medium text-text-primary",children:r})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Condition"}),o.jsx("select",{value:i.type,onChange:p=>{u(p.target.value==="step_result"?{type:"step_result",result:"success"}:{type:p.target.value})},className:Li,children:p0.map(p=>o.jsx("option",{value:p.value,children:p.label},p.value))})]}),i.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Result"}),d?o.jsx("select",{value:i.result??l.results[0],onChange:p=>{u({type:"step_result",result:p.target.value})},className:Li,children:l.results.map(p=>o.jsx("option",{value:p,children:p},p))}):o.jsx("input",{type:"text",value:i.result??"success",onChange:p=>u({type:"step_result",result:p.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Drag handles to reconnect. Press Delete to remove."})]})}function Zd({variables:e,onInsert:r}){return e.length===0?null:o.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:e.map(i=>o.jsx("button",{type:"button",onClick:()=>r(i.name),title:i.description,className:"px-1.5 py-0.5 rounded text-[10px] font-mono bg-bg-primary border border-border text-text-secondary hover:text-accent-primary hover:border-accent-primary/40 transition-colors",children:`{{${i.name}}}`},i.name))})}function XT({step:e,isEntry:r,agentTypes:i,transitionCount:s,templateVariables:c,onUpdate:u,onRemove:f,onSetEntry:l}){const{color:d,name:p}=lf(e,i);return o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:d+"20",color:d},children:p}),r&&o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-accent-primary/15 text-accent-primary",children:"Entry"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[!r&&o.jsx("button",{onClick:l,className:"p-1 rounded text-text-muted hover:text-accent-primary text-xs",children:"Set entry"}),o.jsx("button",{onClick:f,className:"p-1 rounded text-text-muted hover:text-accent-error text-xs",children:"Delete"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Type"}),o.jsx("select",{value:e.type,onChange:g=>{const m=g.target.value,y=m==="sub_agent"?"verification":"build";if(m==="agent"){const _=i.find(k=>!k.subagent);u({...e,type:m,phase:y,toolMode:(_==null?void 0:_.id)??"builder",name:(_==null?void 0:_.name)??"Agent"})}else if(m==="sub_agent"){const _=i.find(k=>k.subagent);u({...e,type:m,phase:y,subAgentType:(_==null?void 0:_.id)??"",name:(_==null?void 0:_.name)??"Sub-Agent"})}else u({...e,type:m,phase:y,name:"Shell"})},className:Li,children:GT.map(g=>o.jsx("option",{value:g.value,children:g.label},g.value))})]}),e.type==="agent"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Agent Type"}),o.jsx("select",{value:e.toolMode??"builder",onChange:g=>{const m=i.find(y=>y.id===g.target.value);u({...e,toolMode:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:i.filter(g=>!g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))})]}),e.type==="sub_agent"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Sub-Agent Type"}),o.jsxs("select",{value:e.subAgentType??"",onChange:g=>{const m=i.find(y=>y.id===g.target.value);u({...e,subAgentType:g.target.value,name:(m==null?void 0:m.name)??g.target.value})},className:Li,children:[o.jsx("option",{value:"",children:"— select —"}),i.filter(g=>g.subagent).map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))]})]}),(e.type==="agent"||e.type==="sub_agent")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Prompt"}),o.jsx("textarea",{value:e.prompt??"",onChange:g=>u({...e,prompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on first entry..."}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,prompt:(e.prompt??"")+`{{${g}}}`})})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Nudge Prompt"}),o.jsx("textarea",{value:e.nudgePrompt??"",onChange:g=>u({...e,nudgePrompt:g.target.value||void 0}),rows:6,className:`${Kn} resize-y text-xs`,placeholder:"Injected on re-entry..."}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,nudgePrompt:(e.nudgePrompt??"")+`{{${g}}}`})})]})]}),e.type==="shell"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Command"}),o.jsx("textarea",{value:e.command??"",onChange:g=>u({...e,command:g.target.value}),rows:3,className:`${Kn} font-mono text-xs resize-y`,placeholder:"cd {{workdir}} && npm run lint"}),o.jsx(Zd,{variables:c,onInsert:g=>u({...e,command:(e.command??"")+`{{${g}}}`})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Timeout (ms)"}),o.jsx("input",{type:"number",value:e.timeout??6e4,onChange:g=>u({...e,timeout:Number(g.target.value)}),className:`${Kn} font-mono text-xs`})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Success Codes"}),o.jsx("input",{value:(e.successExitCodes??[0]).join(", "),onChange:g=>u({...e,successExitCodes:g.target.value.split(",").map(m=>Number(m.trim())).filter(m=>!isNaN(m))}),className:`${Kn} font-mono text-xs`})]})]})]}),o.jsx("div",{className:"pt-1 border-t border-border/50",children:o.jsxs("p",{className:"text-text-muted text-[10px]",children:[s," outgoing transition",s!==1?"s":""," — drag from the bottom port to connect."]})})]})}const tb=[];function m0({isOpen:e,onClose:r,initialEditId:i}){const s=Dt(fe=>fe.defaults),c=Dt(fe=>fe.userItems),u=Dt(fe=>fe.loading),f=Dt(fe=>fe.templateVariables),l=Dt(fe=>fe.fetchWorkflows),d=Dt(fe=>fe.fetchWorkflow),p=Dt(fe=>fe.fetchDefaultContent),g=Dt(fe=>fe.fetchTemplateVariables),m=Dt(fe=>fe.createWorkflow),y=Dt(fe=>fe.updateWorkflow),_=Dt(fe=>fe.deleteWorkflow),{requestDelete:k,clearConfirm:C,isConfirming:v}=Sh(),[b,x]=P.useState("list"),[S,j]=P.useState(null),[A,N]=P.useState(!1),[D,T]=P.useState(null),[I,H]=P.useState(null),[V,Y]=P.useState(""),[q,O]=P.useState(""),[U,z]=P.useState(""),[X,Q]=P.useState("1.0.0"),[M,L]=P.useState("#3b82f6"),[B,W]=P.useState(""),[F,re]=P.useState(50),[Z,ee]=P.useState(tb),[K,$]=P.useState({type:"always"}),[ae,ne]=P.useState(""),[ve,be]=P.useState(!1),[Ae,Me]=P.useState([]),[Ie]=P.useState(null);P.useEffect(()=>{e&&(l(),g(),Ce("/api/agents").then(fe=>fe.json()).then(fe=>Me(fe.agents??[])).catch(()=>{}),T(null),H(null),i?s.some(ye=>ye.id===i)?p(i).then(ye=>{ye&&(Y(ye.metadata.name+" (copy)"),O(`${i}-copy-${Date.now()}`),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),j(null),N(!1),x("edit"))}):d(i).then(ye=>{ye&&(Y(ye.metadata.name),O(ye.metadata.id),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),j(i),N(!1),x("edit"))}):(x("list"),j(null),N(!1)))},[e,l,d,p,g,i]);const Fe=async fe=>{const ye=await d(fe);ye&&(j(fe),Y(ye.metadata.name),O(ye.metadata.id),z(ye.metadata.description),Q(ye.metadata.version),L(ye.metadata.color??"#3b82f6"),W(ye.entryStep),re(ye.settings.maxIterations),ee(ye.steps),$(ye.startCondition??{type:"always"}),ne(""),T(null),H(null),x("edit"))},ke=async()=>{var rt;const fe=S??q;if(!fe||!V)return ne("Name is required."),!1;if(Z.length===0)return ne("Add at least one step."),!1;let ye=B;if(!ye||!Z.some(Ue=>Ue.id===ye)){if(ye=((rt=Z.find(Ue=>Ue.id))==null?void 0:rt.id)??"",!ye)return ne("All steps need an ID."),!1;W(ye)}be(!0),ne("");const we={metadata:{id:fe,name:V,description:U,version:X||"1.0.0",color:M},entryStep:ye,settings:{maxIterations:F},steps:Z,startCondition:K},Ye=S?await y(S,we):await m(we);return be(!1),Ye.success?(S||j(fe),!0):(ne(Ye.error??"Failed to save."),!1)},ge=async()=>{await ke()},je=async()=>{await ke()&&(i?r():x("list"))},We=()=>{i?r():x("list")},Lt=fe=>{Y(fe),S||O(qT(fe))},pe=async fe=>{if(s.some(we=>we.id===fe)){const we=await p(fe);if(!we)return;Y(we.metadata.name),O(we.metadata.id),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(fe),N(!0)}else{const we=await d(fe);if(!we)return;Y(we.metadata.name),O(we.metadata.id),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(fe),N(!0)}x("edit")},Ne=async fe=>{const we=s.some(Ye=>Ye.id===fe)?await p(fe):await d(fe);we&&(Y(we.metadata.name+" (copy)"),O(`${fe}-copy-${Date.now()}`),z(we.metadata.description),Q(we.metadata.version),L(we.metadata.color??"#3b82f6"),W(we.entryStep),re(we.settings.maxIterations),ee(we.steps),$(we.startCondition??{type:"always"}),ne(""),j(null),N(!1),x("edit"))},Oe=()=>{j(null),Y(""),O(""),z(""),Q("1.0.0"),L("#3b82f6"),W(""),re(50),ee(structuredClone(tb)),$({type:"always"}),ne(""),T(null),H(null),N(!1),x("edit")},lt=async fe=>{await _(fe),C()},ue=P.useCallback(fe=>{T(fe),H(null)},[]),_e=P.useCallback(fe=>{H(fe),T(null)},[]),Te=D!==null?Number(D):-1,Be=Te>=0?Z[Te]??null:null,Ve=P.useCallback(fe=>{ee(ye=>ye.map((we,Ye)=>Ye===Te?fe:we))},[Te]),Ct=K.type==="step_result"?`${K.result}`:f0[K.type]??K.type,se=()=>{const fe=Z.length,ye=WT(Z),we=Ae.find(Ye=>!Ye.subagent);ee([...Z,{id:ye,name:(we==null?void 0:we.name)??"Agent",type:"agent",phase:"build",toolMode:(we==null?void 0:we.id)??"builder",transitions:[]}]),B||W(ye),ue(String(fe))},Le=P.useCallback((fe,ye)=>{fe==="$start"?(W(ye),_e("start")):ee(we=>{const Ye=we.find(Ue=>Ue.id===fe),rt=Ye?Ye.transitions.length:0;return _e(`${fe}:${rt}`),we.map(Ue=>Ue.id===fe?{...Ue,transitions:[...Ue.transitions,{when:{type:"always"},goto:ye}]}:Ue)})},[_e]),$e=P.useCallback((fe,ye)=>{if(fe==="start")W(ye);else{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>Ue.map(Zt=>Zt.id===Ye?{...Zt,transitions:Zt.transitions.map((Mt,$t)=>$t===rt?{...Mt,goto:ye}:Mt)}:Zt))}},[]),at=P.useCallback((fe,ye)=>{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>{const Zt=Ue.find($t=>$t.id===Ye);if(!Zt)return Ue;const Mt=Zt.transitions[rt];return Mt?Ue.map($t=>$t.id===Ye?{...$t,transitions:$t.transitions.filter((Hi,ac)=>ac!==rt)}:$t.id===ye?{...$t,transitions:[...$t.transitions,Mt]}:$t):Ue}),H(null)},[]),qe=P.useCallback(fe=>{if(fe==="start")W("");else{const ye=fe.lastIndexOf(":"),we=fe.slice(0,ye),Ye=parseInt(fe.slice(ye+1));ee(rt=>rt.map(Ue=>Ue.id===we?{...Ue,transitions:Ue.transitions.filter((Zt,Mt)=>Mt!==Ye)}:Ue))}H(null)},[]),Ut=P.useCallback((fe,ye)=>{if(fe==="start")$(ye);else{const we=fe.lastIndexOf(":"),Ye=fe.slice(0,we),rt=parseInt(fe.slice(we+1));ee(Ue=>Ue.map(Zt=>Zt.id===Ye?{...Zt,transitions:Zt.transitions.map((Mt,$t)=>$t===rt?{...Mt,when:ye}:Mt)}:Zt))}},[]),Rt=fe=>lf(fe,Ae).name,oi=()=>{if(!I)return null;if(I==="start"){const Mt=Z.find($t=>$t.id===B);return{type:"start",fromLabel:"Start",toLabel:Mt?Rt(Mt):"(none)",condition:K}}const fe=I.lastIndexOf(":"),ye=I.slice(0,fe),we=parseInt(I.slice(fe+1)),Ye=Z.find(Mt=>Mt.id===ye);if(!Ye)return null;const rt=Ye.transitions[we];if(!rt)return null;const Ue=Z.find(Mt=>Mt.id===rt.goto),Zt=rt.goto==="$done"?"Done":Ue?Rt(Ue):rt.goto;return{type:"step",fromLabel:Rt(Ye),toLabel:Zt,condition:rt.when}};if(b==="edit"){const fe=oi();return o.jsxs(cn,{isOpen:e,onClose:We,title:A?V:S?"Edit Workflow":"New Workflow",size:"full",children:[ae&&o.jsx("div",{className:"text-accent-error text-sm px-3 py-2 bg-accent-error/10 rounded mb-3",children:ae}),o.jsxs("div",{className:"flex items-end gap-3 mb-3 pb-3 border-b border-border flex-wrap",children:[o.jsxs("div",{className:"min-w-[140px]",children:[o.jsx("label",{className:rn,children:"Name"}),o.jsx("input",{value:V,onChange:ye=>Lt(ye.target.value),placeholder:"Workflow name",className:`${Kn} ${A?"opacity-50":""}`,readOnly:A})]}),o.jsxs("div",{className:"min-w-[100px]",children:[o.jsx("label",{className:rn,children:"ID"}),o.jsx("input",{value:q,readOnly:!0,className:`${Kn} font-mono opacity-50`})]}),o.jsxs("div",{className:"flex-1 min-w-[140px]",children:[o.jsx("label",{className:rn,children:"Description"}),o.jsx("input",{value:U,onChange:ye=>!A&&z(ye.target.value),readOnly:A,placeholder:"What does this workflow do?",className:`${Kn} ${A?"opacity-50":""}`})]}),o.jsxs("div",{className:"w-20",children:[o.jsx("label",{className:rn,children:"Max Iter."}),o.jsx("input",{type:"number",value:F,onChange:ye=>!A&&re(Number(ye.target.value)),readOnly:A,className:`${Kn} font-mono ${A?"opacity-50":""}`})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Color"}),o.jsx("input",{type:"color",value:M,onChange:ye=>!A&&L(ye.target.value),disabled:A,className:`w-8 h-8 rounded border border-border bg-transparent ${A?"opacity-50":"cursor-pointer"}`})]})]}),o.jsxs("div",{className:"flex gap-3",style:{height:"calc(90vh - 220px)",minHeight:300},children:[o.jsxs("div",{className:"flex-1 min-w-0 bg-bg-primary/50 border border-border rounded-lg flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/50 shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Flow"}),!A&&o.jsx("button",{onClick:se,className:"text-[11px] text-accent-primary hover:text-accent-primary/80",children:"+ Add Step"})]}),o.jsxs("div",{className:"flex-1 min-h-0 p-2 overflow-auto",children:[o.jsx(YT,{steps:Z,entryStep:B,selectedNodeId:(Be==null?void 0:Be.id)??null,selectedEdgeKey:I,startConditionLabel:Ct,agentTypes:Ae,isReadOnly:A,onSelectNode:ye=>{if(ye===null){ue(null);return}const we=Z.findIndex(Ye=>Ye.id===ye);ue(we>=0?String(we):null)},onSelectEdge:_e,onRemoveStep:ye=>{var Ye;const we=Z.findIndex(rt=>rt.id===ye);if(ee(rt=>rt.filter(Ue=>Ue.id!==ye)),Te===we&&ue(null),B===ye){const rt=Z.filter(Ue=>Ue.id!==ye);W(((Ye=rt[0])==null?void 0:Ye.id)??"")}},onCreateTransition:Le,onReconnectTo:$e,onReconnectFrom:at,onDeleteTransition:qe}),Z.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-text-muted",children:[o.jsx("p",{className:"text-xs mb-2",children:"No steps yet"}),o.jsx("button",{onClick:se,className:"px-3 py-1.5 rounded bg-accent-primary/10 text-accent-primary text-xs hover:bg-accent-primary/20",children:"+ Add your first step"})]})]})]}),o.jsxs("div",{className:"w-[300px] shrink-0 border border-border rounded-lg bg-bg-secondary flex flex-col overflow-hidden",children:[o.jsx("div",{className:"px-3 py-1.5 border-b border-border shrink-0",children:o.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wider font-medium",children:"Properties"})}),o.jsx("div",{className:"p-3 overflow-y-auto flex-1 min-h-0",children:A&&(fe||Be)?o.jsx("p",{className:"text-text-muted text-xs text-center py-8",children:'View only — click "Duplicate & Customize" to edit.'}):fe?fe.type==="start"?o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold bg-blue-500/20 text-blue-300",children:"Start"})}),B&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[o.jsx("span",{className:"text-text-primary font-medium",children:"Start"}),o.jsx("svg",{className:"w-3.5 h-3.5 shrink-0 text-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})}),o.jsx("span",{className:"text-text-primary font-medium",children:fe.toLabel})]}),o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Activation Condition"}),o.jsx("select",{value:K.type,onChange:ye=>$(ye.target.value==="step_result"?{type:"step_result",result:"success"}:{type:ye.target.value}),className:Li,children:p0.map(ye=>o.jsx("option",{value:ye.value,children:ye.label},ye.value))})]}),K.type==="step_result"&&o.jsxs("div",{children:[o.jsx("label",{className:rn,children:"Result"}),B&&(()=>{const ye=Z.find(Ue=>Ue.id===B),we=ye&&(ye.type==="sub_agent"||ye.type==="agent")?Ae.find(Ue=>Ue.id===(ye.type==="sub_agent"?ye.subAgentType:ye.toolMode)):void 0,Ye=(we==null?void 0:we.results)&&we.results.length>0,rt=(we==null?void 0:we.results)??[];return Ye?o.jsx("select",{value:K.result??rt[0],onChange:Ue=>$({type:"step_result",result:Ue.target.value}),className:Li,children:rt.map(Ue=>o.jsx("option",{value:Ue,children:Ue},Ue))}):o.jsx("input",{type:"text",value:K.result??"success",onChange:Ue=>$({type:"step_result",result:Ue.target.value}),placeholder:"e.g. success, passed, failed",className:Kn})})()]}),o.jsx("p",{className:"text-text-muted text-[10px]",children:"Workflow only proceeds when this condition is met. Drag the target handle to change entry step."})]}):o.jsx(KT,{fromLabel:fe.fromLabel,toLabel:fe.toLabel,condition:fe.condition,fromStep:fe.type==="step"?Z.find(ye=>ye.id===fe.fromLabel):void 0,agentTypes:Ae,onUpdateCondition:ye=>Ut(I,ye),onDelete:()=>qe(I)}):Be?o.jsx(XT,{step:Be,isEntry:Be.id===B,agentTypes:Ae,transitionCount:Be.transitions.length,templateVariables:f,onUpdate:Ve,onRemove:()=>{var ye;if(Be&&(ee(Z.filter((we,Ye)=>Ye!==Te)),ue(null),B===Be.id)){const we=Z.filter((Ye,rt)=>rt!==Te);W(((ye=we[0])==null?void 0:ye.id)??"")}},onSetEntry:()=>W(Be.id)}):o.jsxs("p",{className:"text-text-muted text-xs text-center py-8",children:["Click a node or edge to edit.",o.jsx("br",{}),"Drag from a port to connect."]})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 pt-3 mt-3 border-t border-border",children:[o.jsx(st,{variant:"secondary",onClick:We,children:"Close"}),A?o.jsx(st,{variant:"primary",onClick:()=>{Y(V+" (copy)"),O(`${S}-copy-${Date.now()}`),j(null),N(!1)},children:"Duplicate & Customize"}):o.jsxs(o.Fragment,{children:[o.jsx(st,{variant:"secondary",onClick:ge,disabled:ve||!V,children:ve?"Saving...":"Save"}),o.jsx(st,{variant:"primary",onClick:je,disabled:ve||!V,children:"Save & Close"})]})]})]})}return o.jsxs(cn,{isOpen:e,onClose:r,title:"Workflows",size:"lg",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:"Workflows define the orchestrator's step sequence when running tasks."}),o.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:o.jsx(st,{variant:"primary",size:"sm",onClick:Oe,children:"+ New"})})]}),u&&s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"Loading workflows..."}):s.length===0&&c.length===0?o.jsx("div",{className:"text-text-muted text-sm",children:"No workflows installed."}):o.jsxs("div",{className:"space-y-4",children:[s.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Built-in"}),o.jsx("div",{className:"space-y-2",children:s.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx("button",{onClick:()=>pe(fe.id),className:"p-1.5 rounded text-text-muted hover:text-text-primary hover:bg-bg-primary transition-colors",title:"View",children:o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),o.jsx(Wa,{onClick:()=>Ne(fe.id)})]})]},fe.id))})]}),c.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-xs font-medium text-text-secondary mb-2 uppercase tracking-wide",children:"Custom"}),o.jsx("div",{className:"space-y-2",children:c.map(fe=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border bg-bg-tertiary",children:[o.jsxs("div",{className:"min-w-0 flex-1 mr-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-text-primary text-sm font-medium",children:fe.name}),o.jsxs("span",{className:"text-text-muted text-xs",children:["v",fe.version]})]}),o.jsx("p",{className:"text-text-secondary text-xs mt-0.5 truncate",children:fe.description})]}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[o.jsx(Wa,{onClick:()=>Ne(fe.id)}),o.jsx(Mi,{onClick:()=>Fe(fe.id)}),v(fe.id,"delete")?o.jsx(wh,{onConfirm:()=>lt(fe.id),onCancel:()=>{}}):o.jsx(Ch,{onClick:()=>k(fe.id)})]})]},fe.id))})]})]})]})}function ZT(e,r){const i=e.startCondition;if(!i||i.type==="always")return!0;switch(i.type){case"has_pending_criteria":return r.some(s=>s.status.type!=="passed");case"all_criteria_passed":return r.length===0||r.every(s=>s.status.type==="passed");case"all_criteria_completed_or_passed":return r.every(s=>s.status.type==="completed"||s.status.type==="passed");case"any_criteria_blocked":return r.some(s=>s.status.type==="failed"&&s.attempts.filter(c=>c.status==="failed").length>=4);case"step_result":return null;default:return null}}function QT({onSelectWorkflow:e,onOpenManager:r,criteria:i}){const[s,c]=P.useState(!1),[u,f]=P.useState(null),l=Dt(N=>N.defaults),d=Dt(N=>N.userItems),p=Dt(N=>N.fetchWorkflows),g=[...l,...d],{isOpen:m,search:y,selectedIndex:_,filtered:k,containerRef:C,searchRef:v,handleToggle:b,handleSearchChange:x,handleKeyDown:S}=o0({items:g,isOpen:s,onOpen:()=>c(!0),onClose:()=>c(!1),filterFn:(N,D)=>!D||N.name.toLowerCase().includes(D.toLowerCase())});P.useEffect(()=>{s&&p()},[s,p]);const j=N=>{e(N),c(!1)},A=()=>{c(!1),r()};return o.jsxs("div",{ref:C,className:"relative",children:[o.jsx(l0,{label:"Workflows",isOpen:m,onClick:b}),m&&o.jsxs("div",{className:"absolute bottom-full right-0 mb-1 w-72 bg-bg-secondary border border-border rounded-lg shadow-xl z-50",onKeyDown:S,children:[o.jsx(c0,{value:y,onChange:x,onKeyDown:S,ref:v,placeholder:"Search workflows..."}),o.jsx(u0,{children:k.length===0?o.jsx(d0,{hasItems:g.length>0,message:"No workflows yet"}):k.map((N,D)=>{const T=ZT(N,i),I=N.color??"#3b82f6";return o.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 rounded transition-colors group ${D===_?"bg-accent-primary/20":"hover:bg-bg-tertiary"}`,children:[o.jsxs("button",{type:"button",onClick:()=>j(N.id),className:"flex-1 text-left flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:I}}),o.jsx("span",{className:"text-sm text-text-primary font-medium flex-1",children:N.name}),T!==null&&o.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{backgroundColor:T?"#22c55e":"#6b7280"},title:T?"Entry condition met":"Entry condition not met"})]}),o.jsx(Mi,{className:"opacity-0 group-hover:opacity-100",onClick:H=>{H.stopPropagation(),c(!1),f(N.id)}})]},N.id)})}),o.jsx(h0,{label:"Manage Workflows...",onClick:A})]}),o.jsx(m0,{isOpen:!!u,onClose:()=>f(null),initialEditId:u})]})}function JT(e){return e==="criterion"}function eA(e){var r,i;return e.role!=="assistant"||e.subAgentId||(r=e.content)!=null&&r.trim()||(i=e.thinkingContent)!=null&&i.trim()||!e.toolCalls||e.toolCalls.length===0?!1:e.toolCalls.every(s=>JT(s.name))}function tA(e,r=[]){const i=[];let s=null,c=[],u,f=1;const l=new Map,d=new Map,p=[];for(const _ of r)_.type==="message"?l.set(_.message.id,_):_.type==="subagent"?d.set(_.subAgentId,_):_.type==="criteria-batch"&&p.push(_);let g=0;const m=()=>{if(c.length>0){const _=p[g];_&&_.type==="criteria-batch"&&_.toolCalls.length===c.length&&_.toolCalls.every((C,v)=>{var b;return C.id===((b=c[v])==null?void 0:b.id)})?i.push(_):i.push({type:"criteria-batch",toolCalls:[...c]}),g++,c=[]}},y=()=>{if(!s)return;const _=s,k=d.get(_.subAgentId);k&&k.type==="subagent"&&k.messages.length===_.messages.length&&k.messages.every((v,b)=>v===_.messages[b])?i.push(k):i.push({type:"subagent",subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:_.messages}),s=null};for(const _ of e)if(_.role!=="tool"){if(_.contextWindowId&&u&&_.contextWindowId!==u&&(m(),y(),f++,i.push({type:"context-divider",windowSequence:f})),u=_.contextWindowId,eA(_)){y();for(const k of _.toolCalls)c.push(k);continue}if(m(),_.subAgentId&&_.subAgentType)s&&s.subAgentId===_.subAgentId?s.messages.push(_):(y(),s={subAgentId:_.subAgentId,subAgentType:_.subAgentType,messages:[_]});else{y();const k=l.get(_.id);k&&k.type==="message"&&k.message===_?i.push(k):i.push({type:"message",message:_})}}return m(),y(),i}function nA(e){const{year:r,month:i,day:s}=Nb(e);return`${r}/${i}/${s} ${Gl(e)}`}function rA(e,r){return e.length<=r?e:e.substring(0,r)+"..."}const iA=10,sA=150;function aA(e){const r=[];if(e.recentUserPrompts)for(const i of e.recentUserPrompts)r.push({id:i.id,content:i.content,timestamp:i.timestamp,sessionId:e.id,sessionName:e.title||e.id});return r}function oA(e){return[...e].sort((s,c)=>new Date(c.timestamp).getTime()-new Date(s.timestamp).getTime()).slice(0,iA).reverse().map(s=>({id:s.id,content:s.content,timestamp:s.timestamp,formattedTimestamp:nA(s.timestamp),trimmedContent:rA(s.content,sA),sessionId:s.sessionId,sessionName:s.sessionName}))}function lA(e,r,i){const s=[],c=e.filter(u=>u.role==="user"&&!u.isSystemGenerated&&u.messageKind!=="auto-prompt");for(const u of c)s.push({id:u.id,content:u.content,timestamp:u.timestamp,sessionId:i??"",sessionName:"This session"});for(const u of r)i&&u.id===i||s.push(...aA(u));return oA(s)}function cA(e,r=[],i=null){const[s,c]=P.useState(0),[u,f]=P.useState(!1),l=P.useMemo(()=>lA(e,r,i),[e,r,i]),d=P.useCallback(()=>{l.length>0&&(c(l.length-1),f(!0))},[l.length]),p=P.useCallback(()=>{f(!1),c(0)},[]),g=P.useCallback(()=>{c(_=>l.length===0?_:_===0?l.length-1:_-1)},[l.length]),m=P.useCallback(()=>{c(_=>l.length===0?_:_===l.length-1?0:_+1)},[l.length]),y=P.useCallback(()=>{if(l.length===0||!u)return null;const _=l[s];return(_==null?void 0:_.content)??null},[l,s,u]);return{history:l,selectedIndex:s,showHistory:u,openHistory:d,closeHistory:p,navigateUp:g,navigateDown:m,selectCurrent:y}}function uA({criteriaSidebarOpen:e,onCriteriaSidebarToggle:r}={}){const i=e??!0,[s,c]=P.useState(""),[u,f]=P.useState([]),[l,d]=P.useState(!1),[p,g]=P.useState(null),[m,y]=P.useState(!1),[_,k]=P.useState(!1),C=P.useRef(null),v=P.useRef(null),b=P.useRef(null),x=Ee(se=>se.currentSession),S=Ee(se=>se.messages),j=Ee(se=>se.streamingMessage),A=Ee(se=>se.sessions),N=Ee(se=>se.error),D=Ee(se=>se.pendingQuestion),T=bb(),I=Ee(se=>se.sendMessage),H=Ee(se=>se.clearError),V=Ee(se=>se.acceptAndBuild),Y=Ee(se=>se.stopGeneration),q=Ee(se=>se.launchRunner),O=Ee(se=>se.cancelQueued),U=OS(),z=Dt(se=>se.defaults),X=Dt(se=>se.userItems),Q=[...z,...X],M=Dt(se=>se.fetchWorkflows);P.useEffect(()=>{M()},[M]);const{history:L,selectedIndex:B,showHistory:W,openHistory:F,closeHistory:re,navigateUp:Z,navigateDown:ee,selectCurrent:K}=cA(S,A,x==null?void 0:x.id),$=P.useMemo(()=>j?S.map(se=>se.id===j.id?j:se):S,[S,j]),ae=P.useRef([]),ne=P.useMemo(()=>{const se=tA($,ae.current);return ae.current=se,se},[$]),ve=P.useMemo(()=>BT(S),[S]),{force_scroll_to_bottom:be,isAutoScrollActive:Ae,setAutoScroll:Me}=i0(C,x),Ie=P.useCallback(()=>{const se=v.current;if(!se)return;se.style.height="auto";const Le=Math.min(200,se.scrollHeight);se.style.height=`${Le}px`},[]);P.useEffect(()=>{if(!(x!=null&&x.id))return;const se=`openfox:draft:${x.id}`,Le=localStorage.getItem(se);Le!==null&&c(Le)},[x==null?void 0:x.id]),P.useEffect(()=>{var se;(se=v.current)==null||se.focus(),Ie()},[x==null?void 0:x.id,Ie]),P.useEffect(()=>{if(!(x!=null&&x.id))return;const se=`openfox:draft:${x.id}`,Le=setTimeout(()=>{s?localStorage.setItem(se,s):localStorage.removeItem(se)},500);return()=>clearTimeout(Le)},[x==null?void 0:x.id,s]),P.useEffect(()=>{Ie()},[s,Ie]),P.useEffect(()=>{const se=Le=>{Le.key==="Escape"&&T&&Y(),Le.key==="ScrollLock"&&Me(!Ae)};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[T,Y,Ae]),P.useEffect(()=>{const se=v.current;if(!se)return;const Le=async $e=>{var qe;if(document.activeElement!==se)return;const at=(qe=$e.clipboardData)==null?void 0:qe.items;if(at){for(const Ut of Array.from(at))if(Ut.type.startsWith("image/")){$e.preventDefault();const Rt=Ut.getAsFile();if(!Rt)continue;await Xd(Rt,oi=>f(fe=>[...fe,oi]),g,{filename:"pasted-image"})}}};return se.addEventListener("paste",Le),()=>se.removeEventListener("paste",Le)},[]);const Fe=()=>{c(""),f([]),x!=null&&x.id&&localStorage.removeItem(`openfox:draft:${x.id}`)},ke=async se=>{se.preventDefault(),!(!s.trim()&&u.length===0)&&(be(),I(s,u.length>0?u:void 0),Fe())},ge=se=>{if(W)switch(se.key){case"Enter":se.preventDefault();const Le=K();Le&&(c(Le),re());return;case"Escape":se.preventDefault(),re(),T&&Y();return;case"ArrowUp":se.preventDefault(),Z();return;case"ArrowDown":se.preventDefault(),ee();return}if(se.key==="ArrowUp"&&s.trim()===""&&!W){se.preventDefault(),F();return}se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),ke(se))},je=P.useCallback(async se=>{const Le=se.target.files;if(!(!Le||Le.length===0)){g(null);for(const $e of Array.from(Le))await Xd($e,at=>f(qe=>[...qe,at]),g);b.current&&(b.current.value="")}},[]),We=P.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!0)},[]),Lt=P.useCallback(se=>{se.preventDefault(),se.stopPropagation(),d(!1)},[]),pe=P.useCallback(async se=>{se.preventDefault(),se.stopPropagation(),d(!1),g(null);const Le=se.dataTransfer.files;if(!(!Le||Le.length===0))for(const $e of Array.from(Le))await Xd($e,at=>f(qe=>[...qe,at]),g)},[]),Ne=P.useCallback(se=>{f(Le=>Le.filter($e=>$e.id!==se))},[]),Oe=P.useCallback(()=>{var se;(se=b.current)==null||se.click()},[]),lt=(x==null?void 0:x.mode)==="planner",ue=(x==null?void 0:x.mode)==="builder",_e=((x==null?void 0:x.criteria.length)??0)>0,Te=(x==null?void 0:x.phase)==="done",Be=ne.some(se=>se.type==="message"&&se.message.role==="assistant"),Ve=lt&&_e&&!T&&Be&&!Te,Ct=se=>{const Le=s.trim()?s:void 0,$e=u.length>0?u:void 0;lt?V(se,Le,$e):ue&&q(Le,$e,se),Fe()};return o.jsxs(n2,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:r,messages:$,children:[D&&o.jsx(yT,{question:D}),o.jsx(s2,{}),o.jsx(_T,{}),o.jsxs("div",{ref:C,"data-testid":"chat-scroll-container",className:"flex-1 min-w-0 overflow-y-auto relative",children:[o.jsx("div",{className:"pt-4",children:ne.map((se,Le)=>{if(se.type==="context-divider")return o.jsxs("div",{className:"flex items-center gap-2 feed-item px-2 md:px-4",children:[o.jsx("div",{className:"flex-1 border-t border-border"}),o.jsx("span",{className:"text-[10px] text-text-muted font-medium px-2",children:"Earlier context summarized"}),o.jsx("div",{className:"flex-1 border-t border-border"})]},Le);if(se.type==="subagent"){const at=se.messages.some(qe=>qe.isStreaming);return o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(pT,{messages:se.messages,subAgentType:se.subAgentType,subAgentId:se.subAgentId,isStreaming:at})},Le)}if(se.type==="criteria-batch")return o.jsx("div",{className:"feed-item px-2 md:px-4",children:o.jsx(n0,{toolCalls:se.toolCalls,criteria:x==null?void 0:x.criteria})},Le);const $e=se.message;return $e.role==="assistant"?o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(af,{message:$e,showStats:!0})},Le):o.jsx("div",{className:"px-2 md:px-4",children:o.jsx(r0,{message:$e,isLastAssistantMessage:!1,promptContext:$e.role==="user"?ve[$e.id]:void 0})},Le)})}),o.jsxs("div",{className:"px-2 md:px-4 pb-4",children:[N&&o.jsx("div",{className:"feed-item bg-red-500/10 border border-red-500/50 rounded p-2",children:o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-red-400 text-sm font-medium",children:N.code}),o.jsx("div",{className:"text-red-300 text-xs mt-0.5",children:N.message})]}),o.jsx(Rs,{onClick:H,className:"text-red-400 hover:text-red-300 p-0.5",size:"sm"})]})}),Ve&&o.jsx("div",{className:"flex justify-center gap-2 feed-item flex-wrap",children:Q.map(se=>{const Le=se.color??"#3b82f6",$e=parseInt(Le.slice(1,3),16),at=parseInt(Le.slice(3,5),16),qe=parseInt(Le.slice(5,7),16),Ut=`rgba(${$e},${at},${qe},0.12)`,Rt=`rgba(${$e},${at},${qe},0.22)`,oi=`rgba(${$e},${at},${qe},0.25)`;return o.jsxs("button",{onClick:()=>V(se.id),className:"px-4 py-1.5 rounded text-sm font-medium transition-colors",style:{backgroundColor:Ut,color:Le,border:`1px solid ${oi}`},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=Rt},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor=Ut},children:["▶ ",se.name]},se.id)})}),T&&o.jsx(ST,{})]})]}),o.jsxs("form",{onSubmit:ke,className:"relative p-2 md:p-4 border-t border-border bg-gradient-to-t from-bg-secondary/50 to-transparent",children:[o.jsxs("button",{type:"button",className:"absolute -top-8 right-2 md:right-4 text-sm text-text-muted hover:text-text-primary z-10 flex items-center gap-1.5",onClick:()=>Me(!Ae),children:[o.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${Ae?"bg-accent-success":"border border-text-muted"}`}),"live"]}),o.jsx("input",{ref:b,type:"file",accept:".png,.jpg,.jpeg,.gif",onChange:je,className:"hidden",multiple:!0}),p&&o.jsx("div",{className:"mb-2 p-2 bg-red-500/10 border border-red-500/50 rounded text-red-300 text-sm",children:p}),u.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:u.map(se=>o.jsx(wT,{attachment:se,onRemove:Ne},se.id))}),W&&o.jsx(CT,{history:L,selectedIndex:B,onSelect:se=>{c(se),re()},onEscape:re,onNavigate:se=>{se==="up"?Z():ee()}}),U.length>0&&o.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:U.map(se=>o.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded text-xs ${se.mode==="asap"?"bg-amber-500/15 text-amber-300 border border-amber-500/30":"bg-blue-500/15 text-blue-300 border border-blue-500/30"}`,children:[o.jsxs("span",{className:"font-medium",children:[se.mode==="asap"?"ASAP":"Queue",":"]}),o.jsx("span",{className:"truncate max-w-[200px]",children:se.content}),o.jsx(Rs,{onClick:()=>O(se.queueId),size:"sm"})]},se.queueId))}),o.jsxs("div",{className:`flex items-end gap-3 p-3 rounded border transition-colors ${l?"border-accent-primary/50 bg-accent-primary/10":"border-border bg-bg-tertiary/50"}`,onDragOver:We,onDragLeave:Lt,onDrop:pe,children:[o.jsx("button",{type:"button",onClick:Oe,className:"p-3 rounded hover:bg-bg-tertiary text-text-muted hover:text-text-primary transition-colors",title:"Attach image file",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),o.jsx("textarea",{ref:v,value:s,onChange:se=>{c(se.target.value),W&&re()},onKeyDown:ge,placeholder:lt?"What would you like to build?":"Send a message...",className:"flex-1 bg-transparent text-sm placeholder:text-text-muted resize-none overflow-y-auto focus:outline-none",style:{minHeight:"24px",maxHeight:"200px"},spellCheck:!1}),o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx($T,{onSendCommand:(se,Le,$e,at)=>{var Ut;Le&&(x==null?void 0:x.mode)!==Le&&Ee.getState().switchMode(Le);const qe=$e&&$e.trim()?`${$e.trim()}
|
|
149
150
|
|
|
150
|
-
${se}`:se;(Ut=C.current)==null||Ut.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(qe,at!=null&&at.length?at:void 0,{messageKind:"command",isSystemGenerated:!0}),Fe()},onOpenManager:()=>y(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(QT,{onSelectWorkflow:Ct,onOpenManager:()=>k(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var se;!s.trim()&&u.length===0||((se=C.current)==null||se.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(s,u),Fe())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"})})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vT,{}),o.jsx(bT,{})]}),o.jsx(HT,{})]})]}),o.jsx(a0,{isOpen:m,onClose:()=>y(!1)}),o.jsx(m0,{isOpen:_,onClose:()=>k(!1)})]})}P.memo(function({item:r}){const[i,s]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:r.description})})]})]})});function nb({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,u]=P.useState(""),f=P.useRef(null);P.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const l=d=>{d.preventDefault(),c.trim()&&i(c)};return o.jsx(ln,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(Vl,{ref:f,type:"password",value:c,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(st,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const dA=[8e3,11434,8080],hA=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function rb(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function g0({size:e="md"}){const r=e==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${r} text-text-muted`,fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function fA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function pA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function mA({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(c,u)=>{const f=u+1,l=f<e,d=f===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":f}),o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${d?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:i[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},u)})})})}function gA({onNext:e}){const[r,i]=P.useState([]),[s,c]=P.useState([]),[u,f]=P.useState(!1),[l,d]=P.useState(""),[p,g]=P.useState(""),[m,y]=P.useState(""),[_,k]=P.useState("auto"),[C,v]=P.useState(!1),[b,x]=P.useState(null),[S,j]=P.useState(null),[A,N]=P.useState(null),[D,T]=P.useState("");P.useEffect(()=>{I()},[]);async function I(){try{const U=await Ce("/api/providers");if(U.ok){const X=(await U.json()).providers.map(Q=>({id:Q.id,name:Q.name,url:Q.url,backend:Q.backend,model:null,apiKey:Q.apiKey}));i(X),c(X)}}catch{}}async function H(U){v(!0),x(null);const z=_!=="auto";try{const Q=await(await Ce("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:U,skipBackendDetection:z})})).json();Q.success?(z||k(Q.backend??"auto"),x({success:!0,model:Q.model??void 0})):x({success:!1,error:Q.error??"Connection failed"})}catch(X){x({success:!1,error:X instanceof Error?X.message:"Connection failed"})}v(!1)}function V(){if(!p)return;const U=l||`Provider ${s.length+1}`,z={id:`temp-${Date.now()}`,name:U,url:p,backend:b!=null&&b.success?_:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0};c([...s,z]),d(""),g(""),y(""),x(null)}function Y(U){j(U),r.some(X=>X.id===U)?Ce(`/api/providers/${U}`,{method:"DELETE"}).then(()=>{c(s.filter(X=>X.id!==U)),i(r.filter(X=>X.id!==U)),j(null)}).catch(()=>{j(null)}):(c(s.filter(X=>X.id!==U)),j(null))}async function q(){for(const z of s)(z.id.startsWith("temp-")||!r.some(X=>X.id===z.id))&&((await Ce("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.name,url:z.url,backend:z.backend,model:z.model,apiKey:z.apiKey})})).ok||console.error("Failed to add provider",z));const U=s.filter(z=>!z.id.startsWith("temp-"));e({providers:U})}const O=s.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(U=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:rb(U.backend)}),A===U.id?o.jsx("input",{type:"text",value:D,onChange:z=>T(z.target.value),onKeyDown:z=>{z.key==="Enter"&&(c(s.map(X=>X.id===U.id?{...X,name:D}:X)),N(null)),z.key==="Escape"&&N(null)},onBlur:()=>{c(s.map(z=>z.id===U.id?{...z,name:D}:z)),N(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(U.id),T(U.name)},title:"Click to edit",children:U.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:U.url}),U.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",U.model]})]}),o.jsx("button",{onClick:()=>Y(U.id),disabled:S===U.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(pA,{})})]},U.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:U=>{U.preventDefault(),p&&V()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:hA.map(U=>o.jsx("button",{type:"button",onClick:()=>{d(U.name),g(U.url),k(U.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===U.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:U.name},U.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:dA.map(U=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${U}`),k("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${U}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",U]},U))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:p,onChange:U=>{g(U.target.value),x(null)},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),H(p))},placeholder:"http://localhost:8000",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:l,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),V())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:U=>y(U.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),b&&o.jsx("div",{className:`p-3 rounded-lg ${b.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:b.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",rb(_),b.model&&` (${b.model})`]}):o.jsx("p",{className:"text-red-500",children:b.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>H(p),disabled:!p||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx(g0,{size:"sm"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!p,className:"flex-1 px-4 py-2 bg-accent-primary text-white rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:b!=null&&b.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[o.jsx(fA,{}),"Add Provider"]}),o.jsx("button",{onClick:q,disabled:!O,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function xA({onNext:e}){const[r,i]=P.useState(""),[s,c]=P.useState(!1);return P.useEffect(()=>{Ce("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(f=>f.json()).then(f=>{f.current&&i(f.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>i(u.target.value),placeholder:"/home/user/projects",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),o.jsx("button",{onClick:()=>c(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(Db,{initialPath:r||void 0,onSelect:u=>{i(u),c(!1)},onClose:()=>c(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function vA({onNext:e}){const[r,i]=P.useState(!1),[s,c]=P.useState("http://localhost:11434"),[u,f]=P.useState("qwen3-vl:2b"),{copied:l,copy:d}=Qy();P.useEffect(()=>{Ce("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),c(g.visionFallback.url),f(g.visionFallback.model))}).catch(()=>{})},[]);function p(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,model:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?o.jsx(Wl,{className:"w-4 h-4 text-accent-primary"}):o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>i(g.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),o.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&o.jsxs("div",{className:"space-y-4 pl-8",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),o.jsx("input",{type:"text",value:s,onChange:g=>c(g.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:u,onChange:g=>f(g.target.value),placeholder:"qwen3-vl:2b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsx("button",{onClick:()=>p(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>p(!1),className:"px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function bA({onComplete:e}){const[r,i]=P.useState(1),[s,c]=P.useState(!1),[u,f]=P.useState({});async function l(m){f(y=>({...y,providers:m.providers})),i(2)}async function d(m){f(y=>({...y,...m})),i(3)}async function p(m){c(!0);try{if(!(await Ce("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(y){console.error("Failed to save onboarding data:",y),c(!1)}}const g=m=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(Rs,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(mA,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(g0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(gA,{onNext:l}),r===2&&o.jsx(xA,{onNext:d}),r===3&&o.jsx(vA,{onNext:p})]})})]})}function cf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function x0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function yA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=bh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ee(m=>m.connectionStatus),u=Ee(m=>m.listSessions),f=Ee(m=>m.clearSession),l=Gt(m=>m.currentProject),d=Gt(m=>m.loadProject),p=cf(),g=c==="connected"||p;return P.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&d(s),u(s),f())},[g,s,l==null?void 0:l.id,d,u,f]),!l||l.id!==s?o.jsx(x0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Ab,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(Sw,{})})]})}function _A({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=bh("/p/:projectId/s/:sessionId"),u=c==null?void 0:c.projectId,f=c==null?void 0:c.sessionId,[,l]=ar(),d=Ee(S=>S.connectionStatus),p=Ee(S=>S.currentSession),g=Ee(S=>S.loadSession),m=Ee(S=>S.listSessions),y=Ee(S=>S.pendingSessionCreate),_=Ee(S=>S.error),k=Ee(S=>S.clearError),C=Gt(S=>S.currentProject),v=Gt(S=>S.loadProject),b=cf(),x=d==="connected"||b;return P.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&v(u)},[x,u,C==null?void 0:C.id,v]),P.useEffect(()=>{x&&f&&(p==null?void 0:p.id)!==f&&!y&&g(f),x&&u&&m(u)},[x,f,p==null?void 0:p.id,g,m,y,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(k(),l(`/p/${u}`))},[_,u,k,l]),!C||C.id!==u?o.jsx(x0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Ab,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(uA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function SA(){const e=kt(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(bA,{onComplete:r})})}function wA(){const{connectionStatus:e}=IS(),r=kt(q=>q.fetchConfig),i=kt(q=>q.refreshProviderModels),s=kt(q=>q.providers),c=kt(q=>q.activeProviderId),[,u]=ar(),f=cf(),[l,d]=P.useState(!1);P.useEffect(()=>{(e==="connected"||f)&&r().then(()=>{d(!0)})},[e,f,r]),P.useEffect(()=>{l&&c&&i(c).then(()=>{r()})},[l,c,i,r]),P.useEffect(()=>{l&&s.length===0&&u("/onboarding")},[l,s.length]);const p=()=>{const q=localStorage.getItem("openfox:leftSidebar");return q!==null?q==="true":!1},g=()=>{const q=localStorage.getItem("openfox:rightSidebar");return q!==null?q==="true":!0},[m,y]=P.useState(p),[_,k]=P.useState(g),[C,v]=P.useState(!1),[b,x]=P.useState(!1),[S,j]=P.useState(!1);P.useEffect(()=>{const q=()=>{j(window.innerWidth<768)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]);const A=S?C:m,N=S?b:_,D=()=>{S?v(!C):y(!m)},T=()=>{S?x(!b):k(!_)};P.useEffect(()=>{S||localStorage.setItem("openfox:leftSidebar",String(m))},[m,S]),P.useEffect(()=>{S||localStorage.setItem("openfox:rightSidebar",String(_))},[_,S]),P.useEffect(()=>{(e==="connected"||f)&&r()},[e,r,f]);const I=Ee(q=>q.showPasswordModal),H=Ee(q=>q.passwordModalRetry),V=Ee(q=>q.submitPassword),Y=Ee(q=>q.cancelPassword);return e!=="connected"&&!I&&!f?o.jsxs(o.Fragment,{children:[o.jsx(nb,{isOpen:!0,isRetry:H,onSubmit:V,onCancel:Y}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(vw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(nb,{isOpen:I,isRetry:H,onSubmit:V,onCancel:Y}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(fw,{}),o.jsx(lw,{onMenuClick:D,onCriteriaToggle:T}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(uS,{children:[o.jsx(Ta,{path:"/onboarding",children:o.jsx(SA,{})}),o.jsx(Ta,{path:"/p/:projectId/s/:sessionId",children:o.jsx(_A,{sidebarOpen:A,onSidebarToggle:D,rightSidebarOpen:N,onRightSidebarToggle:T})}),o.jsx(Ta,{path:"/p/:projectId/new",children:o.jsx(_w,{})}),o.jsx(Ta,{path:"/p/:projectId",children:o.jsx(yA,{sidebarOpen:A,onSidebarToggle:D})}),o.jsx(Ta,{path:"/",children:o.jsx(yw,{})})]})})]})]})}U1.createRoot(document.getElementById("root")).render(o.jsx(dn.StrictMode,{children:o.jsx(wA,{})}));
|
|
151
|
+
${se}`:se;(Ut=C.current)==null||Ut.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(qe,at!=null&&at.length?at:void 0,{messageKind:"command",isSystemGenerated:!0}),Fe()},onOpenManager:()=>y(!0),textareaContent:s,attachments:u.length>0?u:void 0}),o.jsx(QT,{onSelectWorkflow:Ct,onOpenManager:()=>k(!0),criteria:(x==null?void 0:x.criteria)??[]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("button",{type:"button",onClick:()=>{var se;!s.trim()&&u.length===0||((se=C.current)==null||se.scrollTo({top:C.current.scrollHeight,behavior:"smooth"}),I(s,u),Fe())},disabled:!s.trim()&&u.length===0,className:"px-4 py-1.5 rounded bg-accent-primary/20 text-sm text-accent-primary font-medium hover:bg-accent-primary/30 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"Send"})})]})]}),o.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vT,{}),o.jsx(bT,{})]}),o.jsx(HT,{})]})]}),o.jsx(a0,{isOpen:m,onClose:()=>y(!1)}),o.jsx(m0,{isOpen:_,onClose:()=>k(!1)})]})}P.memo(function({item:r}){const[i,s]=P.useState(!1);return r.type==="start"?o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-500/10 border border-amber-500/30 rounded text-amber-300 text-sm",children:[o.jsx("span",{className:"animate-pulse",children:"●"}),o.jsx("span",{children:"Delegating image to fallback vision model..."}),r.filename&&o.jsxs("span",{className:"text-amber-400/70",children:["(",r.filename,")"]})]}):o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 bg-accent-success/10 border border-accent-success/30 rounded",children:[o.jsx("span",{className:"text-accent-success",children:"✓"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-accent-success text-sm",children:"Image description done"}),o.jsx("button",{type:"button",onClick:()=>s(!i),className:"text-xs text-accent-primary hover:text-accent-primary/80 transition-colors",children:i?"Hide":"Show"})]}),i&&r.description&&o.jsx("div",{className:"mt-2 text-xs prose prose-invert prose-sm max-w-none",children:o.jsx(zi,{content:r.description})})]})]})});function nb({isOpen:e,isRetry:r,onSubmit:i,onCancel:s}){const[c,u]=P.useState(""),f=P.useRef(null);P.useEffect(()=>{e&&(u(""),setTimeout(()=>{var d;return(d=f.current)==null?void 0:d.focus()},100))},[e]);const l=d=>{d.preventDefault(),c.trim()&&i(c)};return o.jsx(cn,{isOpen:e,onClose:s,title:r?"Invalid Password":"Password Required",size:"sm",children:o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx("p",{className:"text-text-secondary text-sm",children:r?"The password you entered was incorrect. Please try again.":"This server requires a password to connect."}),o.jsx(Vl,{ref:f,type:"password",value:c,onChange:d=>u(d.target.value),placeholder:"Enter password",autoFocus:!0}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(st,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),o.jsx(st,{type:"submit",disabled:!c.trim(),children:r?"Try Again":"Connect"})]})]})})}const dA=[8e3,11434,8080],hA=[{name:"OpenCode Go",url:"https://opencode.ai/zen/go/v1",backend:"opencode-go"}];function rb(e){switch(e){case"vllm":return"vLLM";case"sglang":return"SGLang";case"ollama":return"Ollama";case"llamacpp":return"llama.cpp";case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"opencode-go":return"OpenCode Go";case"auto":return"Auto";case"unknown":return"Unknown";default:return e}}function g0({size:e="md"}){const r=e==="sm"?"w-4 h-4":"w-6 h-6";return o.jsxs("svg",{className:`animate-spin ${r} text-text-muted`,fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}function fA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}function pA(){return o.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})}function mA({currentStep:e,totalSteps:r,labels:i,onStepClick:s}){return o.jsx("div",{className:"flex justify-center py-6",children:o.jsx("div",{className:"flex items-center",children:Array.from({length:r},(c,u)=>{const f=u+1,l=f<e,d=f===e;return o.jsxs("div",{className:"flex items-center",children:[o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`size-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors shrink-0 ${l?"bg-accent-primary text-white hover:opacity-80":d?"bg-accent-primary text-white":"bg-bg-tertiary text-text-muted"}`,children:l?"✓":f}),o.jsx("button",{onClick:()=>s==null?void 0:s(f),className:`ml-2 mr-4 text-sm whitespace-nowrap hidden sm:block ${d?"text-text-primary font-medium":"text-text-muted hover:text-text-secondary"}`,children:i[u]}),u<r-1&&o.jsx("div",{className:`w-12 sm:w-20 h-0.5 mr-4 ${l?"bg-accent-primary":"bg-border"}`})]},u)})})})}function gA({onNext:e}){const[r,i]=P.useState([]),[s,c]=P.useState([]),[u,f]=P.useState(!1),[l,d]=P.useState(""),[p,g]=P.useState(""),[m,y]=P.useState(""),[_,k]=P.useState("auto"),[C,v]=P.useState(!1),[b,x]=P.useState(null),[S,j]=P.useState(null),[A,N]=P.useState(null),[D,T]=P.useState("");P.useEffect(()=>{I()},[]);async function I(){try{const U=await Ce("/api/providers");if(U.ok){const X=(await U.json()).providers.map(Q=>({id:Q.id,name:Q.name,url:Q.url,backend:Q.backend,model:null,apiKey:Q.apiKey}));i(X),c(X)}}catch{}}async function H(U){v(!0),x(null);const z=_!=="auto";try{const Q=await(await Ce("/api/providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:U,skipBackendDetection:z})})).json();Q.success?(z||k(Q.backend??"auto"),x({success:!0,model:Q.model??void 0})):x({success:!1,error:Q.error??"Connection failed"})}catch(X){x({success:!1,error:X instanceof Error?X.message:"Connection failed"})}v(!1)}function V(){if(!p)return;const U=l||`Provider ${s.length+1}`,z={id:`temp-${Date.now()}`,name:U,url:p,backend:b!=null&&b.success?_:"auto",model:b!=null&&b.success?b.model??null:null,apiKey:m||void 0};c([...s,z]),d(""),g(""),y(""),x(null)}function Y(U){j(U),r.some(X=>X.id===U)?Ce(`/api/providers/${U}`,{method:"DELETE"}).then(()=>{c(s.filter(X=>X.id!==U)),i(r.filter(X=>X.id!==U)),j(null)}).catch(()=>{j(null)}):(c(s.filter(X=>X.id!==U)),j(null))}async function q(){for(const z of s)(z.id.startsWith("temp-")||!r.some(X=>X.id===z.id))&&((await Ce("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.name,url:z.url,backend:z.backend,model:z.model,apiKey:z.apiKey})})).ok||console.error("Failed to add provider",z));const U=s.filter(z=>!z.id.startsWith("temp-"));e({providers:U})}const O=s.length>0;return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"LLM Providers"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Manage your LLM server connections"}),o.jsxs("div",{className:"space-y-4",children:[s.length>0?o.jsx("div",{className:"space-y-2",children:s.map(U=>o.jsxs("div",{className:"flex items-center justify-between bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"px-2 py-0.5 bg-accent-primary/25 text-accent-primary rounded text-xs font-medium",children:rb(U.backend)}),A===U.id?o.jsx("input",{type:"text",value:D,onChange:z=>T(z.target.value),onKeyDown:z=>{z.key==="Enter"&&(c(s.map(X=>X.id===U.id?{...X,name:D}:X)),N(null)),z.key==="Escape"&&N(null)},onBlur:()=>{c(s.map(z=>z.id===U.id?{...z,name:D}:z)),N(null)},className:"px-2 py-0.5 bg-bg-primary border border-accent-primary rounded text-text-primary text-sm focus:outline-none",autoFocus:!0}):o.jsx("span",{className:"text-text-primary font-medium cursor-pointer hover:text-accent-primary",onClick:()=>{N(U.id),T(U.name)},title:"Click to edit",children:U.name})]}),o.jsx("p",{className:"text-text-muted text-sm mt-1",children:U.url}),U.model&&o.jsxs("p",{className:"text-text-secondary text-xs mt-0.5",children:["Model: ",U.model]})]}),o.jsx("button",{onClick:()=>Y(U.id),disabled:S===U.id,className:"p-2 text-text-muted hover:text-red-500 transition-colors disabled:opacity-50",title:"Remove provider",children:o.jsx(pA,{})})]},U.id))}):o.jsx("div",{className:"bg-bg-secondary rounded-lg p-8 text-center border border-border",children:o.jsx("p",{className:"text-text-muted",children:"No providers configured yet"})}),u?o.jsxs("form",{onSubmit:U=>{U.preventDefault(),p&&V()},className:"space-y-4 p-4 bg-bg-tertiary rounded-lg",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Service Presets"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:hA.map(U=>o.jsx("button",{type:"button",onClick:()=>{d(U.name),g(U.url),k(U.backend),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===U.url?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:U.name},U.name))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-2",children:"Local Presets"}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:dA.map(U=>o.jsxs("button",{type:"button",onClick:()=>{d(""),g(`http://localhost:${U}`),k("auto"),x(null)},className:`p-2 rounded border text-center text-sm transition-colors ${p===`http://localhost:${U}`?"border-accent-primary bg-accent-primary/10 text-accent-primary":"border-border hover:border-text-muted text-text-secondary"}`,children:["localhost:",U]},U))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Or enter address manually"}),o.jsx("input",{type:"text",name:"url",value:p,onChange:U=>{g(U.target.value),x(null)},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),H(p))},placeholder:"http://localhost:8000",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Provider name (optional)"}),o.jsx("input",{type:"text",name:"name",value:l,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),V())},placeholder:"My LLM Server",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"API key (optional)"}),o.jsx("input",{type:"password",name:"apiKey",value:m,onChange:U=>y(U.target.value),placeholder:"sk-...",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),b&&o.jsx("div",{className:`p-3 rounded-lg ${b.success?"bg-accent-primary/10":"bg-red-500/10"}`,children:b.success?o.jsxs("p",{className:"text-accent-primary font-medium",children:["✓ Connected to ",rb(_),b.model&&` (${b.model})`]}):o.jsx("p",{className:"text-red-500",children:b.error})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{type:"button",onClick:()=>H(p),disabled:!p||C,className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted disabled:opacity-50",children:C?o.jsx(g0,{size:"sm"}):"Test Connection"}),o.jsx("button",{type:"submit",disabled:!p,className:"flex-1 px-4 py-2 bg-accent-primary text-white rounded-lg hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",children:b!=null&&b.success?"Add Provider ✓":"Add Provider"})]}),o.jsx("button",{type:"button",onClick:()=>{f(!1),d(""),g(""),x(null)},className:"w-full text-center text-text-muted hover:text-text-secondary text-sm",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>f(!0),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-bg-secondary border border-dashed border-border rounded-lg text-text-secondary hover:text-text-primary hover:border-text-muted transition-colors",children:[o.jsx(fA,{}),"Add Provider"]}),o.jsx("button",{onClick:q,disabled:!O,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function xA({onNext:e}){const[r,i]=P.useState(""),[s,c]=P.useState(!1);return P.useEffect(()=>{Ce("/api/config").then(u=>u.json()).then(u=>{u.workdir?i(u.workdir):fetch("/api/directories?path="+encodeURIComponent("/home")).then(f=>f.json()).then(f=>{f.current&&i(f.current)}).catch(()=>{})}).catch(()=>{fetch("/api/directories?path="+encodeURIComponent("/home")).then(u=>u.json()).then(u=>{u.current&&i(u.current)}).catch(()=>{})})},[]),o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Your Projects Folder"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Where should OpenFox create project folders?"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Workspace directory"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",value:r,onChange:u=>i(u.target.value),placeholder:"/home/user/projects",className:"flex-1 px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"}),o.jsx("button",{onClick:()=>c(!0),className:"px-4 py-2 bg-bg-secondary border border-border rounded-lg hover:border-text-muted",children:"Browse"})]})]}),s&&o.jsx(Db,{initialPath:r||void 0,onSelect:u=>{i(u),c(!1)},onClose:()=>c(!1)}),o.jsx("button",{onClick:()=>e({workdir:r}),disabled:!r,className:"w-full mt-6 px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Continue"})]})]})}function vA({onNext:e}){const[r,i]=P.useState(!1),[s,c]=P.useState("http://localhost:11434"),[u,f]=P.useState("qwen3-vl:2b"),{copied:l,copy:d}=Qy();P.useEffect(()=>{Ce("/api/config").then(g=>g.json()).then(g=>{g.visionFallback&&(i(g.visionFallback.enabled),c(g.visionFallback.url),f(g.visionFallback.model))}).catch(()=>{})},[]);function p(g){if(g){e({});return}e({visionFallback:{enabled:r,url:s,model:u,timeout:120}})}return o.jsxs("div",{className:"max-w-xl mx-auto",children:[o.jsx("h2",{className:"text-2xl font-bold text-text-primary mb-2",children:"Vision (Optional)"}),o.jsx("p",{className:"text-text-secondary mb-8",children:"Configure a vision model for non-vision models"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-bg-secondary rounded-lg p-4 border border-border",children:[o.jsx("p",{className:"text-text-secondary text-sm mb-2",children:"To enable vision support, you need an Ollama server with a vision model:"}),o.jsx("a",{href:"https://ollama.com/download",target:"_blank",rel:"noopener noreferrer",className:"text-accent-primary hover:underline text-sm",children:"Download Ollama"}),o.jsxs("div",{className:"mt-3 p-2 bg-bg-primary rounded border border-border flex items-center justify-between gap-2",children:[o.jsx("code",{className:"text-text-secondary text-xs",children:"ollama pull qwen3-vl:2b"}),o.jsx("button",{onClick:()=>d("ollama pull qwen3-vl:2b"),className:"text-text-muted hover:text-text-primary transition-colors",title:"Copy",children:l?o.jsx(Wl,{className:"w-4 h-4 text-accent-primary"}):o.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",strokeWidth:"2"})]})})]})]}),o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:g=>i(g.target.checked),className:"w-5 h-5 rounded border-border bg-bg-secondary text-accent-primary focus:ring-accent-primary"}),o.jsx("span",{className:"text-text-primary",children:"Enable vision fallback for non-vision models"})]}),r&&o.jsxs("div",{className:"space-y-4 pl-8",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision server URL"}),o.jsx("input",{type:"text",value:s,onChange:g=>c(g.target.value),placeholder:"http://localhost:11434",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm text-text-secondary mb-1",children:"Vision model name"}),o.jsx("input",{type:"text",value:u,onChange:g=>f(g.target.value),placeholder:"qwen3-vl:2b",className:"w-full px-4 py-2 bg-bg-secondary border border-border rounded-lg text-text-primary placeholder-text-muted focus:outline-none focus:border-accent-primary"})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsx("button",{onClick:()=>p(!0),className:"text-text-muted hover:text-text-secondary text-sm underline",children:"Skip for now"}),o.jsx("button",{onClick:()=>p(!1),className:"px-6 py-3 bg-accent-primary text-white rounded-lg font-medium hover:bg-accent-primary/90 transition-colors",children:"Finish Setup"})]})]})]})}function bA({onComplete:e}){const[r,i]=P.useState(1),[s,c]=P.useState(!1),[u,f]=P.useState({});async function l(m){f(y=>({...y,providers:m.providers})),i(2)}async function d(m){f(y=>({...y,...m})),i(3)}async function p(m){c(!0);try{if(!(await Ce("/api/init/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workdir:u.workdir,visionFallback:m.visionFallback})})).ok)throw new Error("Failed to save config");e()}catch(y){console.error("Failed to save onboarding data:",y),c(!1)}}const g=m=>{i(m)};return o.jsxs("div",{className:"w-full max-w-xl mx-auto px-6 py-16 relative",children:[o.jsx(Rs,{onClick:e,className:"absolute top-4 right-4 p-2",variant:"modal",size:"xl"}),o.jsx(mA,{currentStep:r,totalSteps:3,labels:["LLM Server","Projects Folder","Vision"],onStepClick:g}),o.jsx("div",{className:"max-w-xl mx-auto",children:s?o.jsxs("div",{className:"text-center",children:[o.jsx(g0,{size:"md"}),o.jsx("p",{className:"mt-4 text-text-secondary",children:"Saving your settings..."})]}):o.jsxs(o.Fragment,{children:[r===1&&o.jsx(gA,{onNext:l}),r===2&&o.jsx(xA,{onNext:d}),r===3&&o.jsx(vA,{onNext:p})]})})]})}function cf(){return typeof window>"u"?!1:localStorage.getItem("openfox_token")!==null}function x0(){return o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Yl,{})})}function yA({sidebarOpen:e,onSidebarToggle:r}){const[,i]=bh("/p/:projectId"),s=i==null?void 0:i.projectId,c=Ee(m=>m.connectionStatus),u=Ee(m=>m.listSessions),f=Ee(m=>m.clearSession),l=Gt(m=>m.currentProject),d=Gt(m=>m.loadProject),p=cf(),g=c==="connected"||p;return P.useEffect(()=>{g&&s&&((l==null?void 0:l.id)!==s&&d(s),u(s),f())},[g,s,l==null?void 0:l.id,d,u,f]),!l||l.id!==s?o.jsx(x0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Ab,{projectId:s,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(Sw,{})})]})}function _A({sidebarOpen:e,onSidebarToggle:r,rightSidebarOpen:i,onRightSidebarToggle:s}){const[,c]=bh("/p/:projectId/s/:sessionId"),u=c==null?void 0:c.projectId,f=c==null?void 0:c.sessionId,[,l]=ar(),d=Ee(S=>S.connectionStatus),p=Ee(S=>S.currentSession),g=Ee(S=>S.loadSession),m=Ee(S=>S.listSessions),y=Ee(S=>S.pendingSessionCreate),_=Ee(S=>S.error),k=Ee(S=>S.clearError),C=Gt(S=>S.currentProject),v=Gt(S=>S.loadProject),b=cf(),x=d==="connected"||b;return P.useEffect(()=>{x&&u&&(C==null?void 0:C.id)!==u&&v(u)},[x,u,C==null?void 0:C.id,v]),P.useEffect(()=>{x&&f&&(p==null?void 0:p.id)!==f&&!y&&g(f),x&&u&&m(u)},[x,f,p==null?void 0:p.id,g,m,y,u]),P.useEffect(()=>{(_==null?void 0:_.code)==="NOT_FOUND"&&u&&(k(),l(`/p/${u}`))},[_,u,k,l]),!C||C.id!==u?o.jsx(x0,{}):o.jsxs(o.Fragment,{children:[o.jsx(Ab,{projectId:u,isOpen:e,onClose:r}),o.jsx("div",{className:"flex-1 min-w-0 bg-bg-primary",children:o.jsx(uA,{criteriaSidebarOpen:i,onCriteriaSidebarToggle:s})})]})}function SA(){const e=kt(i=>i.fetchConfig);function r(){e(),window.history.back()}return o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx(bA,{onComplete:r})})}function wA(){const{connectionStatus:e}=IS(),r=kt(q=>q.fetchConfig),i=kt(q=>q.refreshProviderModels),s=kt(q=>q.providers),c=kt(q=>q.activeProviderId),[,u]=ar(),f=cf(),[l,d]=P.useState(!1);P.useEffect(()=>{(e==="connected"||f)&&r().then(()=>{d(!0)})},[e,f,r]),P.useEffect(()=>{l&&c&&i(c).then(()=>{r()})},[l,c,i,r]),P.useEffect(()=>{l&&s.length===0&&u("/onboarding")},[l,s.length]);const p=()=>{const q=localStorage.getItem("openfox:leftSidebar");return q!==null?q==="true":!1},g=()=>{const q=localStorage.getItem("openfox:rightSidebar");return q!==null?q==="true":!0},[m,y]=P.useState(p),[_,k]=P.useState(g),[C,v]=P.useState(!1),[b,x]=P.useState(!1),[S,j]=P.useState(!1);P.useEffect(()=>{const q=()=>{j(window.innerWidth<768)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]);const A=S?C:m,N=S?b:_,D=()=>{S?v(!C):y(!m)},T=()=>{S?x(!b):k(!_)};P.useEffect(()=>{S||localStorage.setItem("openfox:leftSidebar",String(m))},[m,S]),P.useEffect(()=>{S||localStorage.setItem("openfox:rightSidebar",String(_))},[_,S]),P.useEffect(()=>{(e==="connected"||f)&&r()},[e,r,f]);const I=Ee(q=>q.showPasswordModal),H=Ee(q=>q.passwordModalRetry),V=Ee(q=>q.submitPassword),Y=Ee(q=>q.cancelPassword);return e!=="connected"&&!I&&!f?o.jsxs(o.Fragment,{children:[o.jsx(nb,{isOpen:!0,isRetry:H,onSubmit:V,onCancel:Y}),o.jsx("div",{className:"h-screen flex items-center justify-center",children:o.jsx(vw,{text:"Connecting to server..."})})]}):o.jsxs(o.Fragment,{children:[o.jsx(nb,{isOpen:I,isRetry:H,onSubmit:V,onCancel:Y}),o.jsxs("div",{className:"h-screen flex flex-col",children:[o.jsx(fw,{}),o.jsx(lw,{onMenuClick:D,onCriteriaToggle:T}),o.jsx("div",{className:"flex-1 flex overflow-hidden",children:o.jsxs(uS,{children:[o.jsx(Ta,{path:"/onboarding",children:o.jsx(SA,{})}),o.jsx(Ta,{path:"/p/:projectId/s/:sessionId",children:o.jsx(_A,{sidebarOpen:A,onSidebarToggle:D,rightSidebarOpen:N,onRightSidebarToggle:T})}),o.jsx(Ta,{path:"/p/:projectId/new",children:o.jsx(_w,{})}),o.jsx(Ta,{path:"/p/:projectId",children:o.jsx(yA,{sidebarOpen:A,onSidebarToggle:D})}),o.jsx(Ta,{path:"/",children:o.jsx(yw,{})})]})})]})]})}U1.createRoot(document.getElementById("root")).render(o.jsx(on.StrictMode,{children:o.jsx(wA,{})}));
|