repoburg 1.3.303 → 1.3.305
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/agent-pane/backend/dist/index.js +3936 -717
- package/agent-pane/backend/dist/server.js +4031 -717
- package/agent-pane/backend/scripts/session-host.mjs +860 -0
- package/agent-pane/frontend/dist/assets/{TerminalView-C6AkFuDP.js → TerminalView-CWb7lwEQ.js} +1 -1
- package/agent-pane/frontend/dist/assets/index-B5j2jGP4.css +1 -0
- package/agent-pane/frontend/dist/assets/index-BhyGOapD.js +836 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.d.ts +30 -2
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js +108 -6
- package/backend/dist/src/agent-runtime/agent-runtime-event-emitter.js.map +1 -1
- package/backend/dist/src/agent-runtime/agent-runtime.controller.d.ts +4 -2
- package/backend/dist/src/agent-runtime/agent-runtime.controller.js +49 -9
- package/backend/dist/src/agent-runtime/agent-runtime.controller.js.map +1 -1
- package/backend/dist/src/agent-runtime/agent-runtime.types.d.ts +20 -1
- package/backend/dist/src/interactive-chat/chat.service.js +9 -2
- package/backend/dist/src/interactive-chat/chat.service.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.module.js +2 -0
- package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -1
- package/backend/dist/src/session-inputs/session-inputs.service.d.ts +4 -1
- package/backend/dist/src/session-inputs/session-inputs.service.js +15 -2
- package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -1
- package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
- package/daemon/dist/agentPane.js +6 -2
- package/daemon/dist/agents.js +74 -0
- package/daemon/dist/agents.spec.js +90 -0
- package/daemon/dist/api/agents.js +38 -0
- package/daemon/dist/api/services.js +25 -0
- package/daemon/dist/index.js +7 -3
- package/daemon/dist/serviceManager.js +28 -2
- package/daemon/dist/serviceRoller.js +133 -0
- package/daemon/dist/serviceRoller.spec.js +132 -0
- package/package.json +2 -1
- package/tabtape/extension/dist/build-info.json +3 -3
- package/tabtape/extension/dist/manifest.json +1 -1
- package/tabtape/ui/dist/build-info.json +3 -3
- package/agent-pane/frontend/dist/assets/index-CuJZVIUh.css +0 -1
- package/agent-pane/frontend/dist/assets/index-DoReiVY-.js +0 -834
|
@@ -1,834 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-C6AkFuDP.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var N0=Object.defineProperty;var T0=(t,n,r)=>n in t?N0(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r;var it=(t,n,r)=>T0(t,typeof n!="symbol"?n+"":n,r);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function Hg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Du={exports:{}},hi={},Mu={exports:{}},He={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react.production.min.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Oh;function C0(){if(Oh)return He;Oh=1;var t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=k&&D[k]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,b={};function N(D,P,le){this.props=D,this.context=P,this.refs=b,this.updater=le||S}N.prototype.isReactComponent={},N.prototype.setState=function(D,P){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,P,"setState")},N.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function E(){}E.prototype=N.prototype;function R(D,P,le){this.props=D,this.context=P,this.refs=b,this.updater=le||S}var z=R.prototype=new E;z.constructor=R,C(z,N.prototype),z.isPureReactComponent=!0;var I=Array.isArray,L=Object.prototype.hasOwnProperty,q={current:null},K={key:!0,ref:!0,__self:!0,__source:!0};function $(D,P,le){var W,X={},ae=null,be=null;if(P!=null)for(W in P.ref!==void 0&&(be=P.ref),P.key!==void 0&&(ae=""+P.key),P)L.call(P,W)&&!K.hasOwnProperty(W)&&(X[W]=P[W]);var _e=arguments.length-2;if(_e===1)X.children=le;else if(1<_e){for(var Ae=Array(_e),je=0;je<_e;je++)Ae[je]=arguments[je+2];X.children=Ae}if(D&&D.defaultProps)for(W in _e=D.defaultProps,_e)X[W]===void 0&&(X[W]=_e[W]);return{$$typeof:t,type:D,key:ae,ref:be,props:X,_owner:q.current}}function Z(D,P){return{$$typeof:t,type:D.type,key:P,ref:D.ref,props:D.props,_owner:D._owner}}function he(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function ce(D){var P={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(le){return P[le]})}var ye=/\/+/g;function Se(D,P){return typeof D=="object"&&D!==null&&D.key!=null?ce(""+D.key):P.toString(36)}function Oe(D,P,le,W,X){var ae=typeof D;(ae==="undefined"||ae==="boolean")&&(D=null);var be=!1;if(D===null)be=!0;else switch(ae){case"string":case"number":be=!0;break;case"object":switch(D.$$typeof){case t:case n:be=!0}}if(be)return be=D,X=X(be),D=W===""?"."+Se(be,0):W,I(X)?(le="",D!=null&&(le=D.replace(ye,"$&/")+"/"),Oe(X,P,le,"",function(je){return je})):X!=null&&(he(X)&&(X=Z(X,le+(!X.key||be&&be.key===X.key?"":(""+X.key).replace(ye,"$&/")+"/")+D)),P.push(X)),1;if(be=0,W=W===""?".":W+":",I(D))for(var _e=0;_e<D.length;_e++){ae=D[_e];var Ae=W+Se(ae,_e);be+=Oe(ae,P,le,Ae,X)}else if(Ae=y(D),typeof Ae=="function")for(D=Ae.call(D),_e=0;!(ae=D.next()).done;)ae=ae.value,Ae=W+Se(ae,_e++),be+=Oe(ae,P,le,Ae,X);else if(ae==="object")throw P=String(D),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.");return be}function J(D,P,le){if(D==null)return D;var W=[],X=0;return Oe(D,W,"","",function(ae){return P.call(le,ae,X++)}),W}function re(D){if(D._status===-1){var P=D._result;P=P(),P.then(function(le){(D._status===0||D._status===-1)&&(D._status=1,D._result=le)},function(le){(D._status===0||D._status===-1)&&(D._status=2,D._result=le)}),D._status===-1&&(D._status=0,D._result=P)}if(D._status===1)return D._result.default;throw D._result}var oe={current:null},F={transition:null},Q={ReactCurrentDispatcher:oe,ReactCurrentBatchConfig:F,ReactCurrentOwner:q};function G(){throw Error("act(...) is not supported in production builds of React.")}return He.Children={map:J,forEach:function(D,P,le){J(D,function(){P.apply(this,arguments)},le)},count:function(D){var P=0;return J(D,function(){P++}),P},toArray:function(D){return J(D,function(P){return P})||[]},only:function(D){if(!he(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},He.Component=N,He.Fragment=r,He.Profiler=l,He.PureComponent=R,He.StrictMode=i,He.Suspense=g,He.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,He.act=G,He.cloneElement=function(D,P,le){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var W=C({},D.props),X=D.key,ae=D.ref,be=D._owner;if(P!=null){if(P.ref!==void 0&&(ae=P.ref,be=q.current),P.key!==void 0&&(X=""+P.key),D.type&&D.type.defaultProps)var _e=D.type.defaultProps;for(Ae in P)L.call(P,Ae)&&!K.hasOwnProperty(Ae)&&(W[Ae]=P[Ae]===void 0&&_e!==void 0?_e[Ae]:P[Ae])}var Ae=arguments.length-2;if(Ae===1)W.children=le;else if(1<Ae){_e=Array(Ae);for(var je=0;je<Ae;je++)_e[je]=arguments[je+2];W.children=_e}return{$$typeof:t,type:D.type,key:X,ref:ae,props:W,_owner:be}},He.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:c,_context:D},D.Consumer=D},He.createElement=$,He.createFactory=function(D){var P=$.bind(null,D);return P.type=D,P},He.createRef=function(){return{current:null}},He.forwardRef=function(D){return{$$typeof:p,render:D}},He.isValidElement=he,He.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:re}},He.memo=function(D,P){return{$$typeof:m,type:D,compare:P===void 0?null:P}},He.startTransition=function(D){var P=F.transition;F.transition={};try{D()}finally{F.transition=P}},He.unstable_act=G,He.useCallback=function(D,P){return oe.current.useCallback(D,P)},He.useContext=function(D){return oe.current.useContext(D)},He.useDebugValue=function(){},He.useDeferredValue=function(D){return oe.current.useDeferredValue(D)},He.useEffect=function(D,P){return oe.current.useEffect(D,P)},He.useId=function(){return oe.current.useId()},He.useImperativeHandle=function(D,P,le){return oe.current.useImperativeHandle(D,P,le)},He.useInsertionEffect=function(D,P){return oe.current.useInsertionEffect(D,P)},He.useLayoutEffect=function(D,P){return oe.current.useLayoutEffect(D,P)},He.useMemo=function(D,P){return oe.current.useMemo(D,P)},He.useReducer=function(D,P,le){return oe.current.useReducer(D,P,le)},He.useRef=function(D){return oe.current.useRef(D)},He.useState=function(D){return oe.current.useState(D)},He.useSyncExternalStore=function(D,P,le){return oe.current.useSyncExternalStore(D,P,le)},He.useTransition=function(){return oe.current.useTransition()},He.version="18.3.1",He}var Ph;function Od(){return Ph||(Ph=1,Mu.exports=C0()),Mu.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-jsx-runtime.production.min.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var $h;function E0(){if($h)return hi;$h=1;var t=Od(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(p,g,m){var v,k={},y=null,S=null;m!==void 0&&(y=""+m),g.key!==void 0&&(y=""+g.key),g.ref!==void 0&&(S=g.ref);for(v in g)i.call(g,v)&&!c.hasOwnProperty(v)&&(k[v]=g[v]);if(p&&p.defaultProps)for(v in g=p.defaultProps,g)k[v]===void 0&&(k[v]=g[v]);return{$$typeof:n,type:p,key:y,ref:S,props:k,_owner:l.current}}return hi.Fragment=r,hi.jsx=d,hi.jsxs=d,hi}var zh;function j0(){return zh||(zh=1,Du.exports=E0()),Du.exports}var a=j0(),x=Od();const ct=Hg(x);var Qa={},Lu={exports:{}},An={},Ou={exports:{}},Pu={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.min.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var Fh;function _0(){return Fh||(Fh=1,(function(t){function n(F,Q){var G=F.length;F.push(Q);e:for(;0<G;){var D=G-1>>>1,P=F[D];if(0<l(P,Q))F[D]=Q,F[G]=P,G=D;else break e}}function r(F){return F.length===0?null:F[0]}function i(F){if(F.length===0)return null;var Q=F[0],G=F.pop();if(G!==Q){F[0]=G;e:for(var D=0,P=F.length,le=P>>>1;D<le;){var W=2*(D+1)-1,X=F[W],ae=W+1,be=F[ae];if(0>l(X,G))ae<P&&0>l(be,X)?(F[D]=be,F[ae]=G,D=ae):(F[D]=X,F[W]=G,D=W);else if(ae<P&&0>l(be,G))F[D]=be,F[ae]=G,D=ae;else break e}}return Q}function l(F,Q){var G=F.sortIndex-Q.sortIndex;return G!==0?G:F.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();t.unstable_now=function(){return d.now()-p}}var g=[],m=[],v=1,k=null,y=3,S=!1,C=!1,b=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function z(F){for(var Q=r(m);Q!==null;){if(Q.callback===null)i(m);else if(Q.startTime<=F)i(m),Q.sortIndex=Q.expirationTime,n(g,Q);else break;Q=r(m)}}function I(F){if(b=!1,z(F),!C)if(r(g)!==null)C=!0,re(L);else{var Q=r(m);Q!==null&&oe(I,Q.startTime-F)}}function L(F,Q){C=!1,b&&(b=!1,E($),$=-1),S=!0;var G=y;try{for(z(Q),k=r(g);k!==null&&(!(k.expirationTime>Q)||F&&!ce());){var D=k.callback;if(typeof D=="function"){k.callback=null,y=k.priorityLevel;var P=D(k.expirationTime<=Q);Q=t.unstable_now(),typeof P=="function"?k.callback=P:k===r(g)&&i(g),z(Q)}else i(g);k=r(g)}if(k!==null)var le=!0;else{var W=r(m);W!==null&&oe(I,W.startTime-Q),le=!1}return le}finally{k=null,y=G,S=!1}}var q=!1,K=null,$=-1,Z=5,he=-1;function ce(){return!(t.unstable_now()-he<Z)}function ye(){if(K!==null){var F=t.unstable_now();he=F;var Q=!0;try{Q=K(!0,F)}finally{Q?Se():(q=!1,K=null)}}else q=!1}var Se;if(typeof R=="function")Se=function(){R(ye)};else if(typeof MessageChannel<"u"){var Oe=new MessageChannel,J=Oe.port2;Oe.port1.onmessage=ye,Se=function(){J.postMessage(null)}}else Se=function(){N(ye,0)};function re(F){K=F,q||(q=!0,Se())}function oe(F,Q){$=N(function(){F(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_continueExecution=function(){C||S||(C=!0,re(L))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_getFirstCallbackNode=function(){return r(g)},t.unstable_next=function(F){switch(y){case 1:case 2:case 3:var Q=3;break;default:Q=y}var G=y;y=Q;try{return F()}finally{y=G}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,Q){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var G=y;y=F;try{return Q()}finally{y=G}},t.unstable_scheduleCallback=function(F,Q,G){var D=t.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?D+G:D):G=D,F){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=G+P,F={id:v++,callback:Q,priorityLevel:F,startTime:G,expirationTime:P,sortIndex:-1},G>D?(F.sortIndex=G,n(m,F),r(g)===null&&F===r(m)&&(b?(E($),$=-1):b=!0,oe(I,G-D))):(F.sortIndex=P,n(g,F),C||S||(C=!0,re(L))),F},t.unstable_shouldYield=ce,t.unstable_wrapCallback=function(F){var Q=y;return function(){var G=y;y=Q;try{return F.apply(this,arguments)}finally{y=G}}}})(Pu)),Pu}var Uh;function R0(){return Uh||(Uh=1,Ou.exports=_0()),Ou.exports}/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.min.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var Bh;function A0(){if(Bh)return An;Bh=1;var t=Od(),n=R0();function r(e){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,l={};function c(e,s){d(e,s),d(e+"Capture",s)}function d(e,s){for(l[e]=s,e=0;e<s.length;e++)i.add(s[e])}var p=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=Object.prototype.hasOwnProperty,m=/^[: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]*$/,v={},k={};function y(e){return g.call(k,e)?!0:g.call(v,e)?!1:m.test(e)?k[e]=!0:(v[e]=!0,!1)}function S(e,s,o,u){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function C(e,s,o,u){if(s===null||typeof s>"u"||S(e,s,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function b(e,s,o,u,f,h,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=e,this.type=s,this.sanitizeURL=h,this.removeEmptyString=w}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){N[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var s=e[0];N[s]=new b(s,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){N[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){N[e]=new b(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){N[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){N[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){N[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){N[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){N[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function R(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var s=e.replace(E,R);N[s]=new b(s,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var s=e.replace(E,R);N[s]=new b(s,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var s=e.replace(E,R);N[s]=new b(s,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){N[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),N.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){N[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});function z(e,s,o,u){var f=N.hasOwnProperty(s)?N[s]:null;(f!==null?f.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(C(s,o,f,u)&&(o=null),u||f===null?y(s)&&(o===null?e.removeAttribute(s):e.setAttribute(s,""+o)):f.mustUseProperty?e[f.propertyName]=o===null?f.type===3?!1:"":o:(s=f.attributeName,u=f.attributeNamespace,o===null?e.removeAttribute(s):(f=f.type,o=f===3||f===4&&o===!0?"":""+o,u?e.setAttributeNS(u,s,o):e.setAttribute(s,o))))}var I=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,L=Symbol.for("react.element"),q=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),Z=Symbol.for("react.profiler"),he=Symbol.for("react.provider"),ce=Symbol.for("react.context"),ye=Symbol.for("react.forward_ref"),Se=Symbol.for("react.suspense"),Oe=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),oe=Symbol.for("react.offscreen"),F=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var G=Object.assign,D;function P(e){if(D===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);D=s&&s[1]||""}return`
|
|
35
|
-
`+D+e}var le=!1;function W(e,s){if(!e||le)return"";le=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(V){var u=V}Reflect.construct(e,[],s)}else{try{s.call()}catch(V){u=V}e.call(s.prototype)}else{try{throw Error()}catch(V){u=V}e()}}catch(V){if(V&&u&&typeof V.stack=="string"){for(var f=V.stack.split(`
|
|
36
|
-
`),h=u.stack.split(`
|
|
37
|
-
`),w=f.length-1,j=h.length-1;1<=w&&0<=j&&f[w]!==h[j];)j--;for(;1<=w&&0<=j;w--,j--)if(f[w]!==h[j]){if(w!==1||j!==1)do if(w--,j--,0>j||f[w]!==h[j]){var M=`
|
|
38
|
-
`+f[w].replace(" at new "," at ");return e.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",e.displayName)),M}while(1<=w&&0<=j);break}}}finally{le=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?P(e):""}function X(e){switch(e.tag){case 5:return P(e.type);case 16:return P("Lazy");case 13:return P("Suspense");case 19:return P("SuspenseList");case 0:case 2:case 15:return e=W(e.type,!1),e;case 11:return e=W(e.type.render,!1),e;case 1:return e=W(e.type,!0),e;default:return""}}function ae(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case q:return"Portal";case Z:return"Profiler";case $:return"StrictMode";case Se:return"Suspense";case Oe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ce:return(e.displayName||"Context")+".Consumer";case he:return(e._context.displayName||"Context")+".Provider";case ye:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case J:return s=e.displayName||null,s!==null?s:ae(e.type)||"Memo";case re:s=e._payload,e=e._init;try{return ae(e(s))}catch{}}return null}function be(e){var s=e.type;switch(e.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=s.render,e=e.displayName||e.name||"",s.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(s);case 8:return s===$?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function _e(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ae(e){var s=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function je(e){var s=Ae(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,s),u=""+e[s];if(!e.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,h=o.set;return Object.defineProperty(e,s,{configurable:!0,get:function(){return f.call(this)},set:function(w){u=""+w,h.call(this,w)}}),Object.defineProperty(e,s,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){e._valueTracker=null,delete e[s]}}}}function me(e){e._valueTracker||(e._valueTracker=je(e))}function pe(e){if(!e)return!1;var s=e._valueTracker;if(!s)return!0;var o=s.getValue(),u="";return e&&(u=Ae(e)?e.checked?"true":"false":e.value),e=u,e!==o?(s.setValue(e),!0):!1}function Ve(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ie(e,s){var o=s.checked;return G({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function mt(e,s){var o=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;o=_e(s.value!=null?s.value:o),e._wrapperState={initialChecked:u,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function Ue(e,s){s=s.checked,s!=null&&z(e,"checked",s,!1)}function Vt(e,s){Ue(e,s);var o=_e(s.value),u=s.type;if(o!=null)u==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(u==="submit"||u==="reset"){e.removeAttribute("value");return}s.hasOwnProperty("value")?kt(e,s.type,o):s.hasOwnProperty("defaultValue")&&kt(e,s.type,_e(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(e.defaultChecked=!!s.defaultChecked)}function tn(e,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var u=s.type;if(!(u!=="submit"&&u!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+e._wrapperState.initialValue,o||s===e.value||(e.value=s),e.defaultValue=s}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function kt(e,s,o){(s!=="number"||Ve(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var jt=Array.isArray;function Ft(e,s,o,u){if(e=e.options,s){s={};for(var f=0;f<o.length;f++)s["$"+o[f]]=!0;for(o=0;o<e.length;o++)f=s.hasOwnProperty("$"+e[o].value),e[o].selected!==f&&(e[o].selected=f),f&&u&&(e[o].defaultSelected=!0)}else{for(o=""+_e(o),s=null,f=0;f<e.length;f++){if(e[f].value===o){e[f].selected=!0,u&&(e[f].defaultSelected=!0);return}s!==null||e[f].disabled||(s=e[f])}s!==null&&(s.selected=!0)}}function Ot(e,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return G({},s,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Y(e,s){var o=s.value;if(o==null){if(o=s.children,s=s.defaultValue,o!=null){if(s!=null)throw Error(r(92));if(jt(o)){if(1<o.length)throw Error(r(93));o=o[0]}s=o}s==null&&(s=""),o=s}e._wrapperState={initialValue:_e(o)}}function ge(e,s){var o=_e(s.value),u=_e(s.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),s.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),u!=null&&(e.defaultValue=""+u)}function Be(e){var s=e.textContent;s===e._wrapperState.initialValue&&s!==""&&s!==null&&(e.value=s)}function st(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gt(e,s){return e==null||e==="http://www.w3.org/1999/xhtml"?st(s):e==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var vt,_t=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,u,f){MSApp.execUnsafeLocalFunction(function(){return e(s,o,u,f)})}:e})(function(e,s){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=s;else{for(vt=vt||document.createElement("div"),vt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=vt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;s.firstChild;)e.appendChild(s.firstChild)}});function an(e,s){if(s){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=s;return}}e.textContent=s}var dt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(e){Mn.forEach(function(s){s=s+e.charAt(0).toUpperCase()+e.substring(1),dt[s]=dt[e]})});function Ln(e,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||dt.hasOwnProperty(e)&&dt[e]?(""+s).trim():s+"px"}function hs(e,s){e=e.style;for(var o in s)if(s.hasOwnProperty(o)){var u=o.indexOf("--")===0,f=Ln(o,s[o],u);o==="float"&&(o="cssFloat"),u?e.setProperty(o,f):e[o]=f}}var ms=G({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ns(e,s){if(s){if(ms[e]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function On(e,s){if(e.indexOf("-")===-1)return typeof s.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Kt=null,vn=null,Ze=null;function Rt(e){if(e=Jo(e)){if(typeof Kt!="function")throw Error(r(280));var s=e.stateNode;s&&(s=fa(s),Kt(e.stateNode,e.type,s))}}function ft(e){vn?Ze?Ze.push(e):Ze=[e]:vn=e}function Gt(){if(vn){var e=vn,s=Ze;if(Ze=vn=null,Rt(e),s)for(e=0;e<s.length;e++)Rt(s[e])}}function yt(e,s){return e(s)}function xt(){}var lt=!1;function qt(e,s,o){if(lt)return e(s,o);lt=!0;try{return yt(e,s,o)}finally{lt=!1,(vn!==null||Ze!==null)&&(xt(),Gt())}}function ot(e,s){var o=e.stateNode;if(o===null)return null;var u=fa(o);if(u===null)return null;o=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(e=e.type,u=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!u;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var Pt=!1;if(p)try{var _={};Object.defineProperty(_,"passive",{get:function(){Pt=!0}}),window.addEventListener("test",_,_),window.removeEventListener("test",_,_)}catch{Pt=!1}function fe(e,s,o,u,f,h,w,j,M){var V=Array.prototype.slice.call(arguments,3);try{s.apply(o,V)}catch(ne){this.onError(ne)}}var ie=!1,we=null,Pe=!1,qe=null,$e={onError:function(e){ie=!0,we=e}};function Ut(e,s,o,u,f,h,w,j,M){ie=!1,we=null,fe.apply($e,arguments)}function Pn(e,s,o,u,f,h,w,j,M){if(Ut.apply(this,arguments),ie){if(ie){var V=we;ie=!1,we=null}else throw Error(r(198));Pe||(Pe=!0,qe=V)}}function We(e){var s=e,o=e;if(e.alternate)for(;s.return;)s=s.return;else{e=s;do s=e,(s.flags&4098)!==0&&(o=s.return),e=s.return;while(e)}return s.tag===3?o:null}function yn(e){if(e.tag===13){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function Es(e){if(We(e)!==e)throw Error(r(188))}function Us(e){var s=e.alternate;if(!s){if(s=We(e),s===null)throw Error(r(188));return s!==e?null:e}for(var o=e,u=s;;){var f=o.return;if(f===null)break;var h=f.alternate;if(h===null){if(u=f.return,u!==null){o=u;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===o)return Es(f),e;if(h===u)return Es(f),s;h=h.sibling}throw Error(r(188))}if(o.return!==u.return)o=f,u=h;else{for(var w=!1,j=f.child;j;){if(j===o){w=!0,o=f,u=h;break}if(j===u){w=!0,u=f,o=h;break}j=j.sibling}if(!w){for(j=h.child;j;){if(j===o){w=!0,o=h,u=f;break}if(j===u){w=!0,u=h,o=f;break}j=j.sibling}if(!w)throw Error(r(189))}}if(o.alternate!==u)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?e:s}function $n(e){return e=Us(e),e!==null?gs(e):null}function gs(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var s=gs(e);if(s!==null)return s;e=e.sibling}return null}var Je=n.unstable_scheduleCallback,At=n.unstable_cancelCallback,vs=n.unstable_shouldYield,rc=n.unstable_requestPaint,St=n.unstable_now,ys=n.unstable_getCurrentPriorityLevel,Bs=n.unstable_ImmediatePriority,xs=n.unstable_UserBlockingPriority,Br=n.unstable_NormalPriority,gr=n.unstable_LowPriority,qi=n.unstable_IdlePriority,vr=null,zn=null;function Wr(e){if(zn&&typeof zn.onCommitFiberRoot=="function")try{zn.onCommitFiberRoot(vr,e,void 0,(e.current.flags&128)===128)}catch{}}var xn=Math.clz32?Math.clz32:yr,Hr=Math.log,Ws=Math.LN2;function yr(e){return e>>>=0,e===0?32:31-(Hr(e)/Ws|0)|0}var wn=64,Vr=4194304;function xr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function wr(e,s){var o=e.pendingLanes;if(o===0)return 0;var u=0,f=e.suspendedLanes,h=e.pingedLanes,w=o&268435455;if(w!==0){var j=w&~f;j!==0?u=xr(j):(h&=w,h!==0&&(u=xr(h)))}else w=o&~f,w!==0?u=xr(w):h!==0&&(u=xr(h));if(u===0)return 0;if(s!==0&&s!==u&&(s&f)===0&&(f=u&-u,h=s&-s,f>=h||f===16&&(h&4194240)!==0))return s;if((u&4)!==0&&(u|=o&16),s=e.entangledLanes,s!==0)for(e=e.entanglements,s&=u;0<s;)o=31-xn(s),f=1<<o,u|=e[o],s&=~f;return u}function Xi(e,s){switch(e){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64: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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Yi(e,s){for(var o=e.suspendedLanes,u=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes;0<h;){var w=31-xn(h),j=1<<w,M=f[w];M===-1?((j&o)===0||(j&u)!==0)&&(f[w]=Xi(j,s)):M<=s&&(e.expiredLanes|=j),h&=~j}}function Oo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Po(){var e=wn;return wn<<=1,(wn&4194240)===0&&(wn=64),e}function $o(e){for(var s=[],o=0;31>o;o++)s.push(e);return s}function kr(e,s,o){e.pendingLanes|=s,s!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,s=31-xn(s),e[s]=o}function Qi(e,s){var o=e.pendingLanes&~s;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=s,e.mutableReadLanes&=s,e.entangledLanes&=s,s=e.entanglements;var u=e.eventTimes;for(e=e.expirationTimes;0<o;){var f=31-xn(o),h=1<<f;s[f]=0,u[f]=-1,e[f]=-1,o&=~h}}function Hs(e,s){var o=e.entangledLanes|=s;for(e=e.entanglements;o;){var u=31-xn(o),f=1<<u;f&s|e[u]&s&&(e[u]|=s),o&=~f}}var Xe=0;function ue(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var T,U,ee,Te,Re,Fe=!1,Ye=[],et=null,bt=null,Nt=null,js=new Map,Dt=new Map,Vs=[],Ky="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 submit".split(" ");function xf(e,s){switch(e){case"focusin":case"focusout":et=null;break;case"dragenter":case"dragleave":bt=null;break;case"mouseover":case"mouseout":Nt=null;break;case"pointerover":case"pointerout":js.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dt.delete(s.pointerId)}}function zo(e,s,o,u,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:s,domEventName:o,eventSystemFlags:u,nativeEvent:h,targetContainers:[f]},s!==null&&(s=Jo(s),s!==null&&U(s)),e):(e.eventSystemFlags|=u,s=e.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),e)}function Gy(e,s,o,u,f){switch(s){case"focusin":return et=zo(et,e,s,o,u,f),!0;case"dragenter":return bt=zo(bt,e,s,o,u,f),!0;case"mouseover":return Nt=zo(Nt,e,s,o,u,f),!0;case"pointerover":var h=f.pointerId;return js.set(h,zo(js.get(h)||null,e,s,o,u,f)),!0;case"gotpointercapture":return h=f.pointerId,Dt.set(h,zo(Dt.get(h)||null,e,s,o,u,f)),!0}return!1}function wf(e){var s=Sr(e.target);if(s!==null){var o=We(s);if(o!==null){if(s=o.tag,s===13){if(s=yn(o),s!==null){e.blockedOn=s,Re(e.priority,function(){ee(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Zi(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var o=ic(e.domEventName,e.eventSystemFlags,s[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var u=new o.constructor(o.type,o);gn=u,o.target.dispatchEvent(u),gn=null}else return s=Jo(o),s!==null&&U(s),e.blockedOn=o,!1;s.shift()}return!0}function kf(e,s,o){Zi(e)&&o.delete(s)}function qy(){Fe=!1,et!==null&&Zi(et)&&(et=null),bt!==null&&Zi(bt)&&(bt=null),Nt!==null&&Zi(Nt)&&(Nt=null),js.forEach(kf),Dt.forEach(kf)}function Fo(e,s){e.blockedOn===s&&(e.blockedOn=null,Fe||(Fe=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,qy)))}function Uo(e){function s(f){return Fo(f,e)}if(0<Ye.length){Fo(Ye[0],e);for(var o=1;o<Ye.length;o++){var u=Ye[o];u.blockedOn===e&&(u.blockedOn=null)}}for(et!==null&&Fo(et,e),bt!==null&&Fo(bt,e),Nt!==null&&Fo(Nt,e),js.forEach(s),Dt.forEach(s),o=0;o<Vs.length;o++)u=Vs[o],u.blockedOn===e&&(u.blockedOn=null);for(;0<Vs.length&&(o=Vs[0],o.blockedOn===null);)wf(o),o.blockedOn===null&&Vs.shift()}var Kr=I.ReactCurrentBatchConfig,Ji=!0;function Xy(e,s,o,u){var f=Xe,h=Kr.transition;Kr.transition=null;try{Xe=1,oc(e,s,o,u)}finally{Xe=f,Kr.transition=h}}function Yy(e,s,o,u){var f=Xe,h=Kr.transition;Kr.transition=null;try{Xe=4,oc(e,s,o,u)}finally{Xe=f,Kr.transition=h}}function oc(e,s,o,u){if(Ji){var f=ic(e,s,o,u);if(f===null)bc(e,s,u,ea,o),xf(e,u);else if(Gy(f,e,s,o,u))u.stopPropagation();else if(xf(e,u),s&4&&-1<Ky.indexOf(e)){for(;f!==null;){var h=Jo(f);if(h!==null&&T(h),h=ic(e,s,o,u),h===null&&bc(e,s,u,ea,o),h===f)break;f=h}f!==null&&u.stopPropagation()}else bc(e,s,u,null,o)}}var ea=null;function ic(e,s,o,u){if(ea=null,e=ln(u),e=Sr(e),e!==null)if(s=We(e),s===null)e=null;else if(o=s.tag,o===13){if(e=yn(s),e!==null)return e;e=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null);return ea=e,null}function Sf(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ys()){case Bs:return 1;case xs:return 4;case Br:case gr:return 16;case qi:return 536870912;default:return 16}default:return 16}}var Ks=null,ac=null,ta=null;function bf(){if(ta)return ta;var e,s=ac,o=s.length,u,f="value"in Ks?Ks.value:Ks.textContent,h=f.length;for(e=0;e<o&&s[e]===f[e];e++);var w=o-e;for(u=1;u<=w&&s[o-u]===f[h-u];u++);return ta=f.slice(e,1<u?1-u:void 0)}function na(e){var s=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&s===13&&(e=13)):e=s,e===10&&(e=13),32<=e||e===13?e:0}function sa(){return!0}function Nf(){return!1}function Fn(e){function s(o,u,f,h,w){this._reactName=o,this._targetInst=f,this.type=u,this.nativeEvent=h,this.target=w,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(o=e[j],this[j]=o?o(h):h[j]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?sa:Nf,this.isPropagationStopped=Nf,this}return G(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=sa)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=sa)},persist:function(){},isPersistent:sa}),s}var Gr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lc=Fn(Gr),Bo=G({},Gr,{view:0,detail:0}),Qy=Fn(Bo),cc,uc,Wo,ra=G({},Bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Wo&&(Wo&&e.type==="mousemove"?(cc=e.screenX-Wo.screenX,uc=e.screenY-Wo.screenY):uc=cc=0,Wo=e),cc)},movementY:function(e){return"movementY"in e?e.movementY:uc}}),Tf=Fn(ra),Zy=G({},ra,{dataTransfer:0}),Jy=Fn(Zy),ex=G({},Bo,{relatedTarget:0}),dc=Fn(ex),tx=G({},Gr,{animationName:0,elapsedTime:0,pseudoElement:0}),nx=Fn(tx),sx=G({},Gr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rx=Fn(sx),ox=G({},Gr,{data:0}),Cf=Fn(ox),ix={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ax={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"},lx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cx(e){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(e):(e=lx[e])?!!s[e]:!1}function fc(){return cx}var ux=G({},Bo,{key:function(e){if(e.key){var s=ix[e.key]||e.key;if(s!=="Unidentified")return s}return e.type==="keypress"?(e=na(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ax[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?na(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?na(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),dx=Fn(ux),fx=G({},ra,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ef=Fn(fx),px=G({},Bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),hx=Fn(px),mx=G({},Gr,{propertyName:0,elapsedTime:0,pseudoElement:0}),gx=Fn(mx),vx=G({},ra,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),yx=Fn(vx),xx=[9,13,27,32],pc=p&&"CompositionEvent"in window,Ho=null;p&&"documentMode"in document&&(Ho=document.documentMode);var wx=p&&"TextEvent"in window&&!Ho,jf=p&&(!pc||Ho&&8<Ho&&11>=Ho),_f=" ",Rf=!1;function Af(e,s){switch(e){case"keyup":return xx.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function If(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qr=!1;function kx(e,s){switch(e){case"compositionend":return If(s);case"keypress":return s.which!==32?null:(Rf=!0,_f);case"textInput":return e=s.data,e===_f&&Rf?null:e;default:return null}}function Sx(e,s){if(qr)return e==="compositionend"||!pc&&Af(e,s)?(e=bf(),ta=ac=Ks=null,qr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return jf&&s.locale!=="ko"?null:s.data;default:return null}}var bx={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 Df(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s==="input"?!!bx[e.type]:s==="textarea"}function Mf(e,s,o,u){ft(u),s=ca(s,"onChange"),0<s.length&&(o=new lc("onChange","change",null,o,u),e.push({event:o,listeners:s}))}var Vo=null,Ko=null;function Nx(e){Zf(e,0)}function oa(e){var s=Jr(e);if(pe(s))return e}function Tx(e,s){if(e==="change")return s}var Lf=!1;if(p){var hc;if(p){var mc="oninput"in document;if(!mc){var Of=document.createElement("div");Of.setAttribute("oninput","return;"),mc=typeof Of.oninput=="function"}hc=mc}else hc=!1;Lf=hc&&(!document.documentMode||9<document.documentMode)}function Pf(){Vo&&(Vo.detachEvent("onpropertychange",$f),Ko=Vo=null)}function $f(e){if(e.propertyName==="value"&&oa(Ko)){var s=[];Mf(s,Ko,e,ln(e)),qt(Nx,s)}}function Cx(e,s,o){e==="focusin"?(Pf(),Vo=s,Ko=o,Vo.attachEvent("onpropertychange",$f)):e==="focusout"&&Pf()}function Ex(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oa(Ko)}function jx(e,s){if(e==="click")return oa(s)}function _x(e,s){if(e==="input"||e==="change")return oa(s)}function Rx(e,s){return e===s&&(e!==0||1/e===1/s)||e!==e&&s!==s}var ss=typeof Object.is=="function"?Object.is:Rx;function Go(e,s){if(ss(e,s))return!0;if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;var o=Object.keys(e),u=Object.keys(s);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var f=o[u];if(!g.call(s,f)||!ss(e[f],s[f]))return!1}return!0}function zf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ff(e,s){var o=zf(e);e=0;for(var u;o;){if(o.nodeType===3){if(u=e+o.textContent.length,e<=s&&u>=s)return{node:o,offset:s-e};e=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=zf(o)}}function Uf(e,s){return e&&s?e===s?!0:e&&e.nodeType===3?!1:s&&s.nodeType===3?Uf(e,s.parentNode):"contains"in e?e.contains(s):e.compareDocumentPosition?!!(e.compareDocumentPosition(s)&16):!1:!1}function Bf(){for(var e=window,s=Ve();s instanceof e.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)e=s.contentWindow;else break;s=Ve(e.document)}return s}function gc(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s&&(s==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||s==="textarea"||e.contentEditable==="true")}function Ax(e){var s=Bf(),o=e.focusedElem,u=e.selectionRange;if(s!==o&&o&&o.ownerDocument&&Uf(o.ownerDocument.documentElement,o)){if(u!==null&&gc(o)){if(s=u.start,e=u.end,e===void 0&&(e=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(e,o.value.length);else if(e=(s=o.ownerDocument||document)&&s.defaultView||window,e.getSelection){e=e.getSelection();var f=o.textContent.length,h=Math.min(u.start,f);u=u.end===void 0?h:Math.min(u.end,f),!e.extend&&h>u&&(f=u,u=h,h=f),f=Ff(o,h);var w=Ff(o,u);f&&w&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(f.node,f.offset),e.removeAllRanges(),h>u?(e.addRange(s),e.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),e.addRange(s)))}}for(s=[],e=o;e=e.parentNode;)e.nodeType===1&&s.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<s.length;o++)e=s[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ix=p&&"documentMode"in document&&11>=document.documentMode,Xr=null,vc=null,qo=null,yc=!1;function Wf(e,s,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;yc||Xr==null||Xr!==Ve(u)||(u=Xr,"selectionStart"in u&&gc(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),qo&&Go(qo,u)||(qo=u,u=ca(vc,"onSelect"),0<u.length&&(s=new lc("onSelect","select",null,s,o),e.push({event:s,listeners:u}),s.target=Xr)))}function ia(e,s){var o={};return o[e.toLowerCase()]=s.toLowerCase(),o["Webkit"+e]="webkit"+s,o["Moz"+e]="moz"+s,o}var Yr={animationend:ia("Animation","AnimationEnd"),animationiteration:ia("Animation","AnimationIteration"),animationstart:ia("Animation","AnimationStart"),transitionend:ia("Transition","TransitionEnd")},xc={},Hf={};p&&(Hf=document.createElement("div").style,"AnimationEvent"in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),"TransitionEvent"in window||delete Yr.transitionend.transition);function aa(e){if(xc[e])return xc[e];if(!Yr[e])return e;var s=Yr[e],o;for(o in s)if(s.hasOwnProperty(o)&&o in Hf)return xc[e]=s[o];return e}var Vf=aa("animationend"),Kf=aa("animationiteration"),Gf=aa("animationstart"),qf=aa("transitionend"),Xf=new Map,Yf="abort auxClick 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(" ");function Gs(e,s){Xf.set(e,s),c(s,[e])}for(var wc=0;wc<Yf.length;wc++){var kc=Yf[wc],Dx=kc.toLowerCase(),Mx=kc[0].toUpperCase()+kc.slice(1);Gs(Dx,"on"+Mx)}Gs(Vf,"onAnimationEnd"),Gs(Kf,"onAnimationIteration"),Gs(Gf,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(qf,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xo="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(" "),Lx=new Set("cancel close invalid load scroll toggle".split(" ").concat(Xo));function Qf(e,s,o){var u=e.type||"unknown-event";e.currentTarget=o,Pn(u,s,void 0,e),e.currentTarget=null}function Zf(e,s){s=(s&4)!==0;for(var o=0;o<e.length;o++){var u=e[o],f=u.event;u=u.listeners;e:{var h=void 0;if(s)for(var w=u.length-1;0<=w;w--){var j=u[w],M=j.instance,V=j.currentTarget;if(j=j.listener,M!==h&&f.isPropagationStopped())break e;Qf(f,j,V),h=M}else for(w=0;w<u.length;w++){if(j=u[w],M=j.instance,V=j.currentTarget,j=j.listener,M!==h&&f.isPropagationStopped())break e;Qf(f,j,V),h=M}}}if(Pe)throw e=qe,Pe=!1,qe=null,e}function pt(e,s){var o=s[_c];o===void 0&&(o=s[_c]=new Set);var u=e+"__bubble";o.has(u)||(Jf(s,e,2,!1),o.add(u))}function Sc(e,s,o){var u=0;s&&(u|=4),Jf(o,e,u,s)}var la="_reactListening"+Math.random().toString(36).slice(2);function Yo(e){if(!e[la]){e[la]=!0,i.forEach(function(o){o!=="selectionchange"&&(Lx.has(o)||Sc(o,!1,e),Sc(o,!0,e))});var s=e.nodeType===9?e:e.ownerDocument;s===null||s[la]||(s[la]=!0,Sc("selectionchange",!1,s))}}function Jf(e,s,o,u){switch(Sf(s)){case 1:var f=Xy;break;case 4:f=Yy;break;default:f=oc}o=f.bind(null,s,o,e),f=void 0,!Pt||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),u?f!==void 0?e.addEventListener(s,o,{capture:!0,passive:f}):e.addEventListener(s,o,!0):f!==void 0?e.addEventListener(s,o,{passive:f}):e.addEventListener(s,o,!1)}function bc(e,s,o,u,f){var h=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var j=u.stateNode.containerInfo;if(j===f||j.nodeType===8&&j.parentNode===f)break;if(w===4)for(w=u.return;w!==null;){var M=w.tag;if((M===3||M===4)&&(M=w.stateNode.containerInfo,M===f||M.nodeType===8&&M.parentNode===f))return;w=w.return}for(;j!==null;){if(w=Sr(j),w===null)return;if(M=w.tag,M===5||M===6){u=h=w;continue e}j=j.parentNode}}u=u.return}qt(function(){var V=h,ne=ln(o),se=[];e:{var te=Xf.get(e);if(te!==void 0){var xe=lc,Ne=e;switch(e){case"keypress":if(na(o)===0)break e;case"keydown":case"keyup":xe=dx;break;case"focusin":Ne="focus",xe=dc;break;case"focusout":Ne="blur",xe=dc;break;case"beforeblur":case"afterblur":xe=dc;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xe=Tf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xe=Jy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xe=hx;break;case Vf:case Kf:case Gf:xe=nx;break;case qf:xe=gx;break;case"scroll":xe=Qy;break;case"wheel":xe=yx;break;case"copy":case"cut":case"paste":xe=rx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xe=Ef}var Ce=(s&4)!==0,Mt=!Ce&&e==="scroll",B=Ce?te!==null?te+"Capture":null:te;Ce=[];for(var O=V,H;O!==null;){H=O;var de=H.stateNode;if(H.tag===5&&de!==null&&(H=de,B!==null&&(de=ot(O,B),de!=null&&Ce.push(Qo(O,de,H)))),Mt)break;O=O.return}0<Ce.length&&(te=new xe(te,Ne,null,o,ne),se.push({event:te,listeners:Ce}))}}if((s&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",xe=e==="mouseout"||e==="pointerout",te&&o!==gn&&(Ne=o.relatedTarget||o.fromElement)&&(Sr(Ne)||Ne[_s]))break e;if((xe||te)&&(te=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,xe?(Ne=o.relatedTarget||o.toElement,xe=V,Ne=Ne?Sr(Ne):null,Ne!==null&&(Mt=We(Ne),Ne!==Mt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(xe=null,Ne=V),xe!==Ne)){if(Ce=Tf,de="onMouseLeave",B="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Ef,de="onPointerLeave",B="onPointerEnter",O="pointer"),Mt=xe==null?te:Jr(xe),H=Ne==null?te:Jr(Ne),te=new Ce(de,O+"leave",xe,o,ne),te.target=Mt,te.relatedTarget=H,de=null,Sr(ne)===V&&(Ce=new Ce(B,O+"enter",Ne,o,ne),Ce.target=H,Ce.relatedTarget=Mt,de=Ce),Mt=de,xe&&Ne)t:{for(Ce=xe,B=Ne,O=0,H=Ce;H;H=Qr(H))O++;for(H=0,de=B;de;de=Qr(de))H++;for(;0<O-H;)Ce=Qr(Ce),O--;for(;0<H-O;)B=Qr(B),H--;for(;O--;){if(Ce===B||B!==null&&Ce===B.alternate)break t;Ce=Qr(Ce),B=Qr(B)}Ce=null}else Ce=null;xe!==null&&ep(se,te,xe,Ce,!1),Ne!==null&&Mt!==null&&ep(se,Mt,Ne,Ce,!0)}}e:{if(te=V?Jr(V):window,xe=te.nodeName&&te.nodeName.toLowerCase(),xe==="select"||xe==="input"&&te.type==="file")var Ee=Tx;else if(Df(te))if(Lf)Ee=_x;else{Ee=Ex;var Me=Cx}else(xe=te.nodeName)&&xe.toLowerCase()==="input"&&(te.type==="checkbox"||te.type==="radio")&&(Ee=jx);if(Ee&&(Ee=Ee(e,V))){Mf(se,Ee,o,ne);break e}Me&&Me(e,te,V),e==="focusout"&&(Me=te._wrapperState)&&Me.controlled&&te.type==="number"&&kt(te,"number",te.value)}switch(Me=V?Jr(V):window,e){case"focusin":(Df(Me)||Me.contentEditable==="true")&&(Xr=Me,vc=V,qo=null);break;case"focusout":qo=vc=Xr=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,Wf(se,o,ne);break;case"selectionchange":if(Ix)break;case"keydown":case"keyup":Wf(se,o,ne)}var Le;if(pc)e:{switch(e){case"compositionstart":var ze="onCompositionStart";break e;case"compositionend":ze="onCompositionEnd";break e;case"compositionupdate":ze="onCompositionUpdate";break e}ze=void 0}else qr?Af(e,o)&&(ze="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(ze="onCompositionStart");ze&&(jf&&o.locale!=="ko"&&(qr||ze!=="onCompositionStart"?ze==="onCompositionEnd"&&qr&&(Le=bf()):(Ks=ne,ac="value"in Ks?Ks.value:Ks.textContent,qr=!0)),Me=ca(V,ze),0<Me.length&&(ze=new Cf(ze,e,null,o,ne),se.push({event:ze,listeners:Me}),Le?ze.data=Le:(Le=If(o),Le!==null&&(ze.data=Le)))),(Le=wx?kx(e,o):Sx(e,o))&&(V=ca(V,"onBeforeInput"),0<V.length&&(ne=new Cf("onBeforeInput","beforeinput",null,o,ne),se.push({event:ne,listeners:V}),ne.data=Le))}Zf(se,s)})}function Qo(e,s,o){return{instance:e,listener:s,currentTarget:o}}function ca(e,s){for(var o=s+"Capture",u=[];e!==null;){var f=e,h=f.stateNode;f.tag===5&&h!==null&&(f=h,h=ot(e,o),h!=null&&u.unshift(Qo(e,h,f)),h=ot(e,s),h!=null&&u.push(Qo(e,h,f))),e=e.return}return u}function Qr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ep(e,s,o,u,f){for(var h=s._reactName,w=[];o!==null&&o!==u;){var j=o,M=j.alternate,V=j.stateNode;if(M!==null&&M===u)break;j.tag===5&&V!==null&&(j=V,f?(M=ot(o,h),M!=null&&w.unshift(Qo(o,M,j))):f||(M=ot(o,h),M!=null&&w.push(Qo(o,M,j)))),o=o.return}w.length!==0&&e.push({event:s,listeners:w})}var Ox=/\r\n?/g,Px=/\u0000|\uFFFD/g;function tp(e){return(typeof e=="string"?e:""+e).replace(Ox,`
|
|
39
|
-
`).replace(Px,"")}function ua(e,s,o){if(s=tp(s),tp(e)!==s&&o)throw Error(r(425))}function da(){}var Nc=null,Tc=null;function Cc(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Ec=typeof setTimeout=="function"?setTimeout:void 0,$x=typeof clearTimeout=="function"?clearTimeout:void 0,np=typeof Promise=="function"?Promise:void 0,zx=typeof queueMicrotask=="function"?queueMicrotask:typeof np<"u"?function(e){return np.resolve(null).then(e).catch(Fx)}:Ec;function Fx(e){setTimeout(function(){throw e})}function jc(e,s){var o=s,u=0;do{var f=o.nextSibling;if(e.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"){if(u===0){e.removeChild(f),Uo(s);return}u--}else o!=="$"&&o!=="$?"&&o!=="$!"||u++;o=f}while(o);Uo(s)}function qs(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return e}function sp(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(s===0)return e;s--}else o==="/$"&&s++}e=e.previousSibling}return null}var Zr=Math.random().toString(36).slice(2),ws="__reactFiber$"+Zr,Zo="__reactProps$"+Zr,_s="__reactContainer$"+Zr,_c="__reactEvents$"+Zr,Ux="__reactListeners$"+Zr,Bx="__reactHandles$"+Zr;function Sr(e){var s=e[ws];if(s)return s;for(var o=e.parentNode;o;){if(s=o[_s]||o[ws]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(e=sp(e);e!==null;){if(o=e[ws])return o;e=sp(e)}return s}e=o,o=e.parentNode}return null}function Jo(e){return e=e[ws]||e[_s],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Jr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function fa(e){return e[Zo]||null}var Rc=[],eo=-1;function Xs(e){return{current:e}}function ht(e){0>eo||(e.current=Rc[eo],Rc[eo]=null,eo--)}function ut(e,s){eo++,Rc[eo]=e.current,e.current=s}var Ys={},cn=Xs(Ys),Cn=Xs(!1),br=Ys;function to(e,s){var o=e.type.contextTypes;if(!o)return Ys;var u=e.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in o)f[h]=s[h];return u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=f),f}function En(e){return e=e.childContextTypes,e!=null}function pa(){ht(Cn),ht(cn)}function rp(e,s,o){if(cn.current!==Ys)throw Error(r(168));ut(cn,s),ut(Cn,o)}function op(e,s,o){var u=e.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var f in u)if(!(f in s))throw Error(r(108,be(e)||"Unknown",f));return G({},o,u)}function ha(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ys,br=cn.current,ut(cn,e),ut(Cn,Cn.current),!0}function ip(e,s,o){var u=e.stateNode;if(!u)throw Error(r(169));o?(e=op(e,s,br),u.__reactInternalMemoizedMergedChildContext=e,ht(Cn),ht(cn),ut(cn,e)):ht(Cn),ut(Cn,o)}var Rs=null,ma=!1,Ac=!1;function ap(e){Rs===null?Rs=[e]:Rs.push(e)}function Wx(e){ma=!0,ap(e)}function Qs(){if(!Ac&&Rs!==null){Ac=!0;var e=0,s=Xe;try{var o=Rs;for(Xe=1;e<o.length;e++){var u=o[e];do u=u(!0);while(u!==null)}Rs=null,ma=!1}catch(f){throw Rs!==null&&(Rs=Rs.slice(e+1)),Je(Bs,Qs),f}finally{Xe=s,Ac=!1}}return null}var no=[],so=0,ga=null,va=0,Gn=[],qn=0,Nr=null,As=1,Is="";function Tr(e,s){no[so++]=va,no[so++]=ga,ga=e,va=s}function lp(e,s,o){Gn[qn++]=As,Gn[qn++]=Is,Gn[qn++]=Nr,Nr=e;var u=As;e=Is;var f=32-xn(u)-1;u&=~(1<<f),o+=1;var h=32-xn(s)+f;if(30<h){var w=f-f%5;h=(u&(1<<w)-1).toString(32),u>>=w,f-=w,As=1<<32-xn(s)+f|o<<f|u,Is=h+e}else As=1<<h|o<<f|u,Is=e}function Ic(e){e.return!==null&&(Tr(e,1),lp(e,1,0))}function Dc(e){for(;e===ga;)ga=no[--so],no[so]=null,va=no[--so],no[so]=null;for(;e===Nr;)Nr=Gn[--qn],Gn[qn]=null,Is=Gn[--qn],Gn[qn]=null,As=Gn[--qn],Gn[qn]=null}var Un=null,Bn=null,wt=!1,rs=null;function cp(e,s){var o=Zn(5,null,null,0);o.elementType="DELETED",o.stateNode=s,o.return=e,s=e.deletions,s===null?(e.deletions=[o],e.flags|=16):s.push(o)}function up(e,s){switch(e.tag){case 5:var o=e.type;return s=s.nodeType!==1||o.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(e.stateNode=s,Un=e,Bn=qs(s.firstChild),!0):!1;case 6:return s=e.pendingProps===""||s.nodeType!==3?null:s,s!==null?(e.stateNode=s,Un=e,Bn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=Nr!==null?{id:As,overflow:Is}:null,e.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=Zn(18,null,null,0),o.stateNode=s,o.return=e,e.child=o,Un=e,Bn=null,!0):!1;default:return!1}}function Mc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Lc(e){if(wt){var s=Bn;if(s){var o=s;if(!up(e,s)){if(Mc(e))throw Error(r(418));s=qs(o.nextSibling);var u=Un;s&&up(e,s)?cp(u,o):(e.flags=e.flags&-4097|2,wt=!1,Un=e)}}else{if(Mc(e))throw Error(r(418));e.flags=e.flags&-4097|2,wt=!1,Un=e}}}function dp(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Un=e}function ya(e){if(e!==Un)return!1;if(!wt)return dp(e),wt=!0,!1;var s;if((s=e.tag!==3)&&!(s=e.tag!==5)&&(s=e.type,s=s!=="head"&&s!=="body"&&!Cc(e.type,e.memoizedProps)),s&&(s=Bn)){if(Mc(e))throw fp(),Error(r(418));for(;s;)cp(e,s),s=qs(s.nextSibling)}if(dp(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,s=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(s===0){Bn=qs(e.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}e=e.nextSibling}Bn=null}}else Bn=Un?qs(e.stateNode.nextSibling):null;return!0}function fp(){for(var e=Bn;e;)e=qs(e.nextSibling)}function ro(){Bn=Un=null,wt=!1}function Oc(e){rs===null?rs=[e]:rs.push(e)}var Hx=I.ReactCurrentBatchConfig;function ei(e,s,o){if(e=o.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(r(309));var u=o.stateNode}if(!u)throw Error(r(147,e));var f=u,h=""+e;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===h?s.ref:(s=function(w){var j=f.refs;w===null?delete j[h]:j[h]=w},s._stringRef=h,s)}if(typeof e!="string")throw Error(r(284));if(!o._owner)throw Error(r(290,e))}return e}function xa(e,s){throw e=Object.prototype.toString.call(s),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e))}function pp(e){var s=e._init;return s(e._payload)}function hp(e){function s(B,O){if(e){var H=B.deletions;H===null?(B.deletions=[O],B.flags|=16):H.push(O)}}function o(B,O){if(!e)return null;for(;O!==null;)s(B,O),O=O.sibling;return null}function u(B,O){for(B=new Map;O!==null;)O.key!==null?B.set(O.key,O):B.set(O.index,O),O=O.sibling;return B}function f(B,O){return B=or(B,O),B.index=0,B.sibling=null,B}function h(B,O,H){return B.index=H,e?(H=B.alternate,H!==null?(H=H.index,H<O?(B.flags|=2,O):H):(B.flags|=2,O)):(B.flags|=1048576,O)}function w(B){return e&&B.alternate===null&&(B.flags|=2),B}function j(B,O,H,de){return O===null||O.tag!==6?(O=Eu(H,B.mode,de),O.return=B,O):(O=f(O,H),O.return=B,O)}function M(B,O,H,de){var Ee=H.type;return Ee===K?ne(B,O,H.props.children,de,H.key):O!==null&&(O.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===re&&pp(Ee)===O.type)?(de=f(O,H.props),de.ref=ei(B,O,H),de.return=B,de):(de=Wa(H.type,H.key,H.props,null,B.mode,de),de.ref=ei(B,O,H),de.return=B,de)}function V(B,O,H,de){return O===null||O.tag!==4||O.stateNode.containerInfo!==H.containerInfo||O.stateNode.implementation!==H.implementation?(O=ju(H,B.mode,de),O.return=B,O):(O=f(O,H.children||[]),O.return=B,O)}function ne(B,O,H,de,Ee){return O===null||O.tag!==7?(O=Dr(H,B.mode,de,Ee),O.return=B,O):(O=f(O,H),O.return=B,O)}function se(B,O,H){if(typeof O=="string"&&O!==""||typeof O=="number")return O=Eu(""+O,B.mode,H),O.return=B,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case L:return H=Wa(O.type,O.key,O.props,null,B.mode,H),H.ref=ei(B,null,O),H.return=B,H;case q:return O=ju(O,B.mode,H),O.return=B,O;case re:var de=O._init;return se(B,de(O._payload),H)}if(jt(O)||Q(O))return O=Dr(O,B.mode,H,null),O.return=B,O;xa(B,O)}return null}function te(B,O,H,de){var Ee=O!==null?O.key:null;if(typeof H=="string"&&H!==""||typeof H=="number")return Ee!==null?null:j(B,O,""+H,de);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case L:return H.key===Ee?M(B,O,H,de):null;case q:return H.key===Ee?V(B,O,H,de):null;case re:return Ee=H._init,te(B,O,Ee(H._payload),de)}if(jt(H)||Q(H))return Ee!==null?null:ne(B,O,H,de,null);xa(B,H)}return null}function xe(B,O,H,de,Ee){if(typeof de=="string"&&de!==""||typeof de=="number")return B=B.get(H)||null,j(O,B,""+de,Ee);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case L:return B=B.get(de.key===null?H:de.key)||null,M(O,B,de,Ee);case q:return B=B.get(de.key===null?H:de.key)||null,V(O,B,de,Ee);case re:var Me=de._init;return xe(B,O,H,Me(de._payload),Ee)}if(jt(de)||Q(de))return B=B.get(H)||null,ne(O,B,de,Ee,null);xa(O,de)}return null}function Ne(B,O,H,de){for(var Ee=null,Me=null,Le=O,ze=O=0,Qt=null;Le!==null&&ze<H.length;ze++){Le.index>ze?(Qt=Le,Le=null):Qt=Le.sibling;var tt=te(B,Le,H[ze],de);if(tt===null){Le===null&&(Le=Qt);break}e&&Le&&tt.alternate===null&&s(B,Le),O=h(tt,O,ze),Me===null?Ee=tt:Me.sibling=tt,Me=tt,Le=Qt}if(ze===H.length)return o(B,Le),wt&&Tr(B,ze),Ee;if(Le===null){for(;ze<H.length;ze++)Le=se(B,H[ze],de),Le!==null&&(O=h(Le,O,ze),Me===null?Ee=Le:Me.sibling=Le,Me=Le);return wt&&Tr(B,ze),Ee}for(Le=u(B,Le);ze<H.length;ze++)Qt=xe(Le,B,ze,H[ze],de),Qt!==null&&(e&&Qt.alternate!==null&&Le.delete(Qt.key===null?ze:Qt.key),O=h(Qt,O,ze),Me===null?Ee=Qt:Me.sibling=Qt,Me=Qt);return e&&Le.forEach(function(ir){return s(B,ir)}),wt&&Tr(B,ze),Ee}function Ce(B,O,H,de){var Ee=Q(H);if(typeof Ee!="function")throw Error(r(150));if(H=Ee.call(H),H==null)throw Error(r(151));for(var Me=Ee=null,Le=O,ze=O=0,Qt=null,tt=H.next();Le!==null&&!tt.done;ze++,tt=H.next()){Le.index>ze?(Qt=Le,Le=null):Qt=Le.sibling;var ir=te(B,Le,tt.value,de);if(ir===null){Le===null&&(Le=Qt);break}e&&Le&&ir.alternate===null&&s(B,Le),O=h(ir,O,ze),Me===null?Ee=ir:Me.sibling=ir,Me=ir,Le=Qt}if(tt.done)return o(B,Le),wt&&Tr(B,ze),Ee;if(Le===null){for(;!tt.done;ze++,tt=H.next())tt=se(B,tt.value,de),tt!==null&&(O=h(tt,O,ze),Me===null?Ee=tt:Me.sibling=tt,Me=tt);return wt&&Tr(B,ze),Ee}for(Le=u(B,Le);!tt.done;ze++,tt=H.next())tt=xe(Le,B,ze,tt.value,de),tt!==null&&(e&&tt.alternate!==null&&Le.delete(tt.key===null?ze:tt.key),O=h(tt,O,ze),Me===null?Ee=tt:Me.sibling=tt,Me=tt);return e&&Le.forEach(function(b0){return s(B,b0)}),wt&&Tr(B,ze),Ee}function Mt(B,O,H,de){if(typeof H=="object"&&H!==null&&H.type===K&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case L:e:{for(var Ee=H.key,Me=O;Me!==null;){if(Me.key===Ee){if(Ee=H.type,Ee===K){if(Me.tag===7){o(B,Me.sibling),O=f(Me,H.props.children),O.return=B,B=O;break e}}else if(Me.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===re&&pp(Ee)===Me.type){o(B,Me.sibling),O=f(Me,H.props),O.ref=ei(B,Me,H),O.return=B,B=O;break e}o(B,Me);break}else s(B,Me);Me=Me.sibling}H.type===K?(O=Dr(H.props.children,B.mode,de,H.key),O.return=B,B=O):(de=Wa(H.type,H.key,H.props,null,B.mode,de),de.ref=ei(B,O,H),de.return=B,B=de)}return w(B);case q:e:{for(Me=H.key;O!==null;){if(O.key===Me)if(O.tag===4&&O.stateNode.containerInfo===H.containerInfo&&O.stateNode.implementation===H.implementation){o(B,O.sibling),O=f(O,H.children||[]),O.return=B,B=O;break e}else{o(B,O);break}else s(B,O);O=O.sibling}O=ju(H,B.mode,de),O.return=B,B=O}return w(B);case re:return Me=H._init,Mt(B,O,Me(H._payload),de)}if(jt(H))return Ne(B,O,H,de);if(Q(H))return Ce(B,O,H,de);xa(B,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,O!==null&&O.tag===6?(o(B,O.sibling),O=f(O,H),O.return=B,B=O):(o(B,O),O=Eu(H,B.mode,de),O.return=B,B=O),w(B)):o(B,O)}return Mt}var oo=hp(!0),mp=hp(!1),wa=Xs(null),ka=null,io=null,Pc=null;function $c(){Pc=io=ka=null}function zc(e){var s=wa.current;ht(wa),e._currentValue=s}function Fc(e,s,o){for(;e!==null;){var u=e.alternate;if((e.childLanes&s)!==s?(e.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),e===o)break;e=e.return}}function ao(e,s){ka=e,Pc=io=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&s)!==0&&(jn=!0),e.firstContext=null)}function Xn(e){var s=e._currentValue;if(Pc!==e)if(e={context:e,memoizedValue:s,next:null},io===null){if(ka===null)throw Error(r(308));io=e,ka.dependencies={lanes:0,firstContext:e}}else io=io.next=e;return s}var Cr=null;function Uc(e){Cr===null?Cr=[e]:Cr.push(e)}function gp(e,s,o,u){var f=s.interleaved;return f===null?(o.next=o,Uc(s)):(o.next=f.next,f.next=o),s.interleaved=o,Ds(e,u)}function Ds(e,s){e.lanes|=s;var o=e.alternate;for(o!==null&&(o.lanes|=s),o=e,e=e.return;e!==null;)e.childLanes|=s,o=e.alternate,o!==null&&(o.childLanes|=s),o=e,e=e.return;return o.tag===3?o.stateNode:null}var Zs=!1;function Bc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vp(e,s){e=e.updateQueue,s.updateQueue===e&&(s.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ms(e,s){return{eventTime:e,lane:s,tag:0,payload:null,callback:null,next:null}}function Js(e,s,o){var u=e.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var f=u.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),u.pending=s,Ds(e,o)}return f=u.interleaved,f===null?(s.next=s,Uc(u)):(s.next=f.next,f.next=s),u.interleaved=s,Ds(e,o)}function Sa(e,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var u=s.lanes;u&=e.pendingLanes,o|=u,s.lanes=o,Hs(e,o)}}function yp(e,s){var o=e.updateQueue,u=e.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,h=null;if(o=o.firstBaseUpdate,o!==null){do{var w={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};h===null?f=h=w:h=h.next=w,o=o.next}while(o!==null);h===null?f=h=s:h=h.next=s}else f=h=s;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:u.shared,effects:u.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=s:e.next=s,o.lastBaseUpdate=s}function ba(e,s,o,u){var f=e.updateQueue;Zs=!1;var h=f.firstBaseUpdate,w=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var M=j,V=M.next;M.next=null,w===null?h=V:w.next=V,w=M;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,j=ne.lastBaseUpdate,j!==w&&(j===null?ne.firstBaseUpdate=V:j.next=V,ne.lastBaseUpdate=M))}if(h!==null){var se=f.baseState;w=0,ne=V=M=null,j=h;do{var te=j.lane,xe=j.eventTime;if((u&te)===te){ne!==null&&(ne=ne.next={eventTime:xe,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var Ne=e,Ce=j;switch(te=s,xe=o,Ce.tag){case 1:if(Ne=Ce.payload,typeof Ne=="function"){se=Ne.call(xe,se,te);break e}se=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ce.payload,te=typeof Ne=="function"?Ne.call(xe,se,te):Ne,te==null)break e;se=G({},se,te);break e;case 2:Zs=!0}}j.callback!==null&&j.lane!==0&&(e.flags|=64,te=f.effects,te===null?f.effects=[j]:te.push(j))}else xe={eventTime:xe,lane:te,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ne===null?(V=ne=xe,M=se):ne=ne.next=xe,w|=te;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;te=j,j=te.next,te.next=null,f.lastBaseUpdate=te,f.shared.pending=null}}while(!0);if(ne===null&&(M=se),f.baseState=M,f.firstBaseUpdate=V,f.lastBaseUpdate=ne,s=f.shared.interleaved,s!==null){f=s;do w|=f.lane,f=f.next;while(f!==s)}else h===null&&(f.shared.lanes=0);_r|=w,e.lanes=w,e.memoizedState=se}}function xp(e,s,o){if(e=s.effects,s.effects=null,e!==null)for(s=0;s<e.length;s++){var u=e[s],f=u.callback;if(f!==null){if(u.callback=null,u=o,typeof f!="function")throw Error(r(191,f));f.call(u)}}}var ti={},ks=Xs(ti),ni=Xs(ti),si=Xs(ti);function Er(e){if(e===ti)throw Error(r(174));return e}function Wc(e,s){switch(ut(si,s),ut(ni,e),ut(ks,ti),e=s.nodeType,e){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:gt(null,"");break;default:e=e===8?s.parentNode:s,s=e.namespaceURI||null,e=e.tagName,s=gt(s,e)}ht(ks),ut(ks,s)}function lo(){ht(ks),ht(ni),ht(si)}function wp(e){Er(si.current);var s=Er(ks.current),o=gt(s,e.type);s!==o&&(ut(ni,e),ut(ks,o))}function Hc(e){ni.current===e&&(ht(ks),ht(ni))}var Tt=Xs(0);function Na(e){for(var s=e;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Vc=[];function Kc(){for(var e=0;e<Vc.length;e++)Vc[e]._workInProgressVersionPrimary=null;Vc.length=0}var Ta=I.ReactCurrentDispatcher,Gc=I.ReactCurrentBatchConfig,jr=0,Ct=null,Bt=null,Xt=null,Ca=!1,ri=!1,oi=0,Vx=0;function un(){throw Error(r(321))}function qc(e,s){if(s===null)return!1;for(var o=0;o<s.length&&o<e.length;o++)if(!ss(e[o],s[o]))return!1;return!0}function Xc(e,s,o,u,f,h){if(jr=h,Ct=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ta.current=e===null||e.memoizedState===null?Xx:Yx,e=o(u,f),ri){h=0;do{if(ri=!1,oi=0,25<=h)throw Error(r(301));h+=1,Xt=Bt=null,s.updateQueue=null,Ta.current=Qx,e=o(u,f)}while(ri)}if(Ta.current=_a,s=Bt!==null&&Bt.next!==null,jr=0,Xt=Bt=Ct=null,Ca=!1,s)throw Error(r(300));return e}function Yc(){var e=oi!==0;return oi=0,e}function Ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Ct.memoizedState=Xt=e:Xt=Xt.next=e,Xt}function Yn(){if(Bt===null){var e=Ct.alternate;e=e!==null?e.memoizedState:null}else e=Bt.next;var s=Xt===null?Ct.memoizedState:Xt.next;if(s!==null)Xt=s,Bt=e;else{if(e===null)throw Error(r(310));Bt=e,e={memoizedState:Bt.memoizedState,baseState:Bt.baseState,baseQueue:Bt.baseQueue,queue:Bt.queue,next:null},Xt===null?Ct.memoizedState=Xt=e:Xt=Xt.next=e}return Xt}function ii(e,s){return typeof s=="function"?s(e):s}function Qc(e){var s=Yn(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=e;var u=Bt,f=u.baseQueue,h=o.pending;if(h!==null){if(f!==null){var w=f.next;f.next=h.next,h.next=w}u.baseQueue=f=h,o.pending=null}if(f!==null){h=f.next,u=u.baseState;var j=w=null,M=null,V=h;do{var ne=V.lane;if((jr&ne)===ne)M!==null&&(M=M.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),u=V.hasEagerState?V.eagerState:e(u,V.action);else{var se={lane:ne,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};M===null?(j=M=se,w=u):M=M.next=se,Ct.lanes|=ne,_r|=ne}V=V.next}while(V!==null&&V!==h);M===null?w=u:M.next=j,ss(u,s.memoizedState)||(jn=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=M,o.lastRenderedState=u}if(e=o.interleaved,e!==null){f=e;do h=f.lane,Ct.lanes|=h,_r|=h,f=f.next;while(f!==e)}else f===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function Zc(e){var s=Yn(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=e;var u=o.dispatch,f=o.pending,h=s.memoizedState;if(f!==null){o.pending=null;var w=f=f.next;do h=e(h,w.action),w=w.next;while(w!==f);ss(h,s.memoizedState)||(jn=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),o.lastRenderedState=h}return[h,u]}function kp(){}function Sp(e,s){var o=Ct,u=Yn(),f=s(),h=!ss(u.memoizedState,f);if(h&&(u.memoizedState=f,jn=!0),u=u.queue,Jc(Tp.bind(null,o,u,e),[e]),u.getSnapshot!==s||h||Xt!==null&&Xt.memoizedState.tag&1){if(o.flags|=2048,ai(9,Np.bind(null,o,u,f,s),void 0,null),Yt===null)throw Error(r(349));(jr&30)!==0||bp(o,s,f)}return f}function bp(e,s,o){e.flags|=16384,e={getSnapshot:s,value:o},s=Ct.updateQueue,s===null?(s={lastEffect:null,stores:null},Ct.updateQueue=s,s.stores=[e]):(o=s.stores,o===null?s.stores=[e]:o.push(e))}function Np(e,s,o,u){s.value=o,s.getSnapshot=u,Cp(s)&&Ep(e)}function Tp(e,s,o){return o(function(){Cp(s)&&Ep(e)})}function Cp(e){var s=e.getSnapshot;e=e.value;try{var o=s();return!ss(e,o)}catch{return!0}}function Ep(e){var s=Ds(e,1);s!==null&&ls(s,e,1,-1)}function jp(e){var s=Ss();return typeof e=="function"&&(e=e()),s.memoizedState=s.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ii,lastRenderedState:e},s.queue=e,e=e.dispatch=qx.bind(null,Ct,e),[s.memoizedState,e]}function ai(e,s,o,u){return e={tag:e,create:s,destroy:o,deps:u,next:null},s=Ct.updateQueue,s===null?(s={lastEffect:null,stores:null},Ct.updateQueue=s,s.lastEffect=e.next=e):(o=s.lastEffect,o===null?s.lastEffect=e.next=e:(u=o.next,o.next=e,e.next=u,s.lastEffect=e)),e}function _p(){return Yn().memoizedState}function Ea(e,s,o,u){var f=Ss();Ct.flags|=e,f.memoizedState=ai(1|s,o,void 0,u===void 0?null:u)}function ja(e,s,o,u){var f=Yn();u=u===void 0?null:u;var h=void 0;if(Bt!==null){var w=Bt.memoizedState;if(h=w.destroy,u!==null&&qc(u,w.deps)){f.memoizedState=ai(s,o,h,u);return}}Ct.flags|=e,f.memoizedState=ai(1|s,o,h,u)}function Rp(e,s){return Ea(8390656,8,e,s)}function Jc(e,s){return ja(2048,8,e,s)}function Ap(e,s){return ja(4,2,e,s)}function Ip(e,s){return ja(4,4,e,s)}function Dp(e,s){if(typeof s=="function")return e=e(),s(e),function(){s(null)};if(s!=null)return e=e(),s.current=e,function(){s.current=null}}function Mp(e,s,o){return o=o!=null?o.concat([e]):null,ja(4,4,Dp.bind(null,s,e),o)}function eu(){}function Lp(e,s){var o=Yn();s=s===void 0?null:s;var u=o.memoizedState;return u!==null&&s!==null&&qc(s,u[1])?u[0]:(o.memoizedState=[e,s],e)}function Op(e,s){var o=Yn();s=s===void 0?null:s;var u=o.memoizedState;return u!==null&&s!==null&&qc(s,u[1])?u[0]:(e=e(),o.memoizedState=[e,s],e)}function Pp(e,s,o){return(jr&21)===0?(e.baseState&&(e.baseState=!1,jn=!0),e.memoizedState=o):(ss(o,s)||(o=Po(),Ct.lanes|=o,_r|=o,e.baseState=!0),s)}function Kx(e,s){var o=Xe;Xe=o!==0&&4>o?o:4,e(!0);var u=Gc.transition;Gc.transition={};try{e(!1),s()}finally{Xe=o,Gc.transition=u}}function $p(){return Yn().memoizedState}function Gx(e,s,o){var u=sr(e);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},zp(e))Fp(s,o);else if(o=gp(e,s,o,u),o!==null){var f=Sn();ls(o,e,u,f),Up(o,s,u)}}function qx(e,s,o){var u=sr(e),f={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(zp(e))Fp(s,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var w=s.lastRenderedState,j=h(w,o);if(f.hasEagerState=!0,f.eagerState=j,ss(j,w)){var M=s.interleaved;M===null?(f.next=f,Uc(s)):(f.next=M.next,M.next=f),s.interleaved=f;return}}catch{}finally{}o=gp(e,s,f,u),o!==null&&(f=Sn(),ls(o,e,u,f),Up(o,s,u))}}function zp(e){var s=e.alternate;return e===Ct||s!==null&&s===Ct}function Fp(e,s){ri=Ca=!0;var o=e.pending;o===null?s.next=s:(s.next=o.next,o.next=s),e.pending=s}function Up(e,s,o){if((o&4194240)!==0){var u=s.lanes;u&=e.pendingLanes,o|=u,s.lanes=o,Hs(e,o)}}var _a={readContext:Xn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},Xx={readContext:Xn,useCallback:function(e,s){return Ss().memoizedState=[e,s===void 0?null:s],e},useContext:Xn,useEffect:Rp,useImperativeHandle:function(e,s,o){return o=o!=null?o.concat([e]):null,Ea(4194308,4,Dp.bind(null,s,e),o)},useLayoutEffect:function(e,s){return Ea(4194308,4,e,s)},useInsertionEffect:function(e,s){return Ea(4,2,e,s)},useMemo:function(e,s){var o=Ss();return s=s===void 0?null:s,e=e(),o.memoizedState=[e,s],e},useReducer:function(e,s,o){var u=Ss();return s=o!==void 0?o(s):s,u.memoizedState=u.baseState=s,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},u.queue=e,e=e.dispatch=Gx.bind(null,Ct,e),[u.memoizedState,e]},useRef:function(e){var s=Ss();return e={current:e},s.memoizedState=e},useState:jp,useDebugValue:eu,useDeferredValue:function(e){return Ss().memoizedState=e},useTransition:function(){var e=jp(!1),s=e[0];return e=Kx.bind(null,e[1]),Ss().memoizedState=e,[s,e]},useMutableSource:function(){},useSyncExternalStore:function(e,s,o){var u=Ct,f=Ss();if(wt){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),Yt===null)throw Error(r(349));(jr&30)!==0||bp(u,s,o)}f.memoizedState=o;var h={value:o,getSnapshot:s};return f.queue=h,Rp(Tp.bind(null,u,h,e),[e]),u.flags|=2048,ai(9,Np.bind(null,u,h,o,s),void 0,null),o},useId:function(){var e=Ss(),s=Yt.identifierPrefix;if(wt){var o=Is,u=As;o=(u&~(1<<32-xn(u)-1)).toString(32)+o,s=":"+s+"R"+o,o=oi++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=Vx++,s=":"+s+"r"+o.toString(32)+":";return e.memoizedState=s},unstable_isNewReconciler:!1},Yx={readContext:Xn,useCallback:Lp,useContext:Xn,useEffect:Jc,useImperativeHandle:Mp,useInsertionEffect:Ap,useLayoutEffect:Ip,useMemo:Op,useReducer:Qc,useRef:_p,useState:function(){return Qc(ii)},useDebugValue:eu,useDeferredValue:function(e){var s=Yn();return Pp(s,Bt.memoizedState,e)},useTransition:function(){var e=Qc(ii)[0],s=Yn().memoizedState;return[e,s]},useMutableSource:kp,useSyncExternalStore:Sp,useId:$p,unstable_isNewReconciler:!1},Qx={readContext:Xn,useCallback:Lp,useContext:Xn,useEffect:Jc,useImperativeHandle:Mp,useInsertionEffect:Ap,useLayoutEffect:Ip,useMemo:Op,useReducer:Zc,useRef:_p,useState:function(){return Zc(ii)},useDebugValue:eu,useDeferredValue:function(e){var s=Yn();return Bt===null?s.memoizedState=e:Pp(s,Bt.memoizedState,e)},useTransition:function(){var e=Zc(ii)[0],s=Yn().memoizedState;return[e,s]},useMutableSource:kp,useSyncExternalStore:Sp,useId:$p,unstable_isNewReconciler:!1};function os(e,s){if(e&&e.defaultProps){s=G({},s),e=e.defaultProps;for(var o in e)s[o]===void 0&&(s[o]=e[o]);return s}return s}function tu(e,s,o,u){s=e.memoizedState,o=o(u,s),o=o==null?s:G({},s,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var Ra={isMounted:function(e){return(e=e._reactInternals)?We(e)===e:!1},enqueueSetState:function(e,s,o){e=e._reactInternals;var u=Sn(),f=sr(e),h=Ms(u,f);h.payload=s,o!=null&&(h.callback=o),s=Js(e,h,f),s!==null&&(ls(s,e,f,u),Sa(s,e,f))},enqueueReplaceState:function(e,s,o){e=e._reactInternals;var u=Sn(),f=sr(e),h=Ms(u,f);h.tag=1,h.payload=s,o!=null&&(h.callback=o),s=Js(e,h,f),s!==null&&(ls(s,e,f,u),Sa(s,e,f))},enqueueForceUpdate:function(e,s){e=e._reactInternals;var o=Sn(),u=sr(e),f=Ms(o,u);f.tag=2,s!=null&&(f.callback=s),s=Js(e,f,u),s!==null&&(ls(s,e,u,o),Sa(s,e,u))}};function Bp(e,s,o,u,f,h,w){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(u,h,w):s.prototype&&s.prototype.isPureReactComponent?!Go(o,u)||!Go(f,h):!0}function Wp(e,s,o){var u=!1,f=Ys,h=s.contextType;return typeof h=="object"&&h!==null?h=Xn(h):(f=En(s)?br:cn.current,u=s.contextTypes,h=(u=u!=null)?to(e,f):Ys),s=new s(o,h),e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ra,e.stateNode=s,s._reactInternals=e,u&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=f,e.__reactInternalMemoizedMaskedChildContext=h),s}function Hp(e,s,o,u){e=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,u),s.state!==e&&Ra.enqueueReplaceState(s,s.state,null)}function nu(e,s,o,u){var f=e.stateNode;f.props=o,f.state=e.memoizedState,f.refs={},Bc(e);var h=s.contextType;typeof h=="object"&&h!==null?f.context=Xn(h):(h=En(s)?br:cn.current,f.context=to(e,h)),f.state=e.memoizedState,h=s.getDerivedStateFromProps,typeof h=="function"&&(tu(e,s,h,o),f.state=e.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(s=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),s!==f.state&&Ra.enqueueReplaceState(f,f.state,null),ba(e,o,f,u),f.state=e.memoizedState),typeof f.componentDidMount=="function"&&(e.flags|=4194308)}function co(e,s){try{var o="",u=s;do o+=X(u),u=u.return;while(u);var f=o}catch(h){f=`
|
|
40
|
-
Error generating stack: `+h.message+`
|
|
41
|
-
`+h.stack}return{value:e,source:s,stack:f,digest:null}}function su(e,s,o){return{value:e,source:null,stack:o??null,digest:s??null}}function ru(e,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var Zx=typeof WeakMap=="function"?WeakMap:Map;function Vp(e,s,o){o=Ms(-1,o),o.tag=3,o.payload={element:null};var u=s.value;return o.callback=function(){Pa||(Pa=!0,xu=u),ru(e,s)},o}function Kp(e,s,o){o=Ms(-1,o),o.tag=3;var u=e.type.getDerivedStateFromError;if(typeof u=="function"){var f=s.value;o.payload=function(){return u(f)},o.callback=function(){ru(e,s)}}var h=e.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(o.callback=function(){ru(e,s),typeof u!="function"&&(tr===null?tr=new Set([this]):tr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),o}function Gp(e,s,o){var u=e.pingCache;if(u===null){u=e.pingCache=new Zx;var f=new Set;u.set(s,f)}else f=u.get(s),f===void 0&&(f=new Set,u.set(s,f));f.has(o)||(f.add(o),e=f0.bind(null,e,s,o),s.then(e,e))}function qp(e){do{var s;if((s=e.tag===13)&&(s=e.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return e;e=e.return}while(e!==null);return null}function Xp(e,s,o,u,f){return(e.mode&1)===0?(e===s?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(s=Ms(-1,1),s.tag=2,Js(o,s,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=f,e)}var Jx=I.ReactCurrentOwner,jn=!1;function kn(e,s,o,u){s.child=e===null?mp(s,null,o,u):oo(s,e.child,o,u)}function Yp(e,s,o,u,f){o=o.render;var h=s.ref;return ao(s,f),u=Xc(e,s,o,u,h,f),o=Yc(),e!==null&&!jn?(s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~f,Ls(e,s,f)):(wt&&o&&Ic(s),s.flags|=1,kn(e,s,u,f),s.child)}function Qp(e,s,o,u,f){if(e===null){var h=o.type;return typeof h=="function"&&!Cu(h)&&h.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=h,Zp(e,s,h,u,f)):(e=Wa(o.type,null,u,s,s.mode,f),e.ref=s.ref,e.return=s,s.child=e)}if(h=e.child,(e.lanes&f)===0){var w=h.memoizedProps;if(o=o.compare,o=o!==null?o:Go,o(w,u)&&e.ref===s.ref)return Ls(e,s,f)}return s.flags|=1,e=or(h,u),e.ref=s.ref,e.return=s,s.child=e}function Zp(e,s,o,u,f){if(e!==null){var h=e.memoizedProps;if(Go(h,u)&&e.ref===s.ref)if(jn=!1,s.pendingProps=u=h,(e.lanes&f)!==0)(e.flags&131072)!==0&&(jn=!0);else return s.lanes=e.lanes,Ls(e,s,f)}return ou(e,s,o,u,f)}function Jp(e,s,o){var u=s.pendingProps,f=u.children,h=e!==null?e.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},ut(fo,Wn),Wn|=o;else{if((o&1073741824)===0)return e=h!==null?h.baseLanes|o:o,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:e,cachePool:null,transitions:null},s.updateQueue=null,ut(fo,Wn),Wn|=e,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=h!==null?h.baseLanes:o,ut(fo,Wn),Wn|=u}else h!==null?(u=h.baseLanes|o,s.memoizedState=null):u=o,ut(fo,Wn),Wn|=u;return kn(e,s,f,o),s.child}function eh(e,s){var o=s.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function ou(e,s,o,u,f){var h=En(o)?br:cn.current;return h=to(s,h),ao(s,f),o=Xc(e,s,o,u,h,f),u=Yc(),e!==null&&!jn?(s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~f,Ls(e,s,f)):(wt&&u&&Ic(s),s.flags|=1,kn(e,s,o,f),s.child)}function th(e,s,o,u,f){if(En(o)){var h=!0;ha(s)}else h=!1;if(ao(s,f),s.stateNode===null)Ia(e,s),Wp(s,o,u),nu(s,o,u,f),u=!0;else if(e===null){var w=s.stateNode,j=s.memoizedProps;w.props=j;var M=w.context,V=o.contextType;typeof V=="object"&&V!==null?V=Xn(V):(V=En(o)?br:cn.current,V=to(s,V));var ne=o.getDerivedStateFromProps,se=typeof ne=="function"||typeof w.getSnapshotBeforeUpdate=="function";se||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(j!==u||M!==V)&&Hp(s,w,u,V),Zs=!1;var te=s.memoizedState;w.state=te,ba(s,u,w,f),M=s.memoizedState,j!==u||te!==M||Cn.current||Zs?(typeof ne=="function"&&(tu(s,o,ne,u),M=s.memoizedState),(j=Zs||Bp(s,o,j,u,te,M,V))?(se||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(s.flags|=4194308)):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=M),w.props=u,w.state=M,w.context=V,u=j):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,vp(e,s),j=s.memoizedProps,V=s.type===s.elementType?j:os(s.type,j),w.props=V,se=s.pendingProps,te=w.context,M=o.contextType,typeof M=="object"&&M!==null?M=Xn(M):(M=En(o)?br:cn.current,M=to(s,M));var xe=o.getDerivedStateFromProps;(ne=typeof xe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(j!==se||te!==M)&&Hp(s,w,u,M),Zs=!1,te=s.memoizedState,w.state=te,ba(s,u,w,f);var Ne=s.memoizedState;j!==se||te!==Ne||Cn.current||Zs?(typeof xe=="function"&&(tu(s,o,xe,u),Ne=s.memoizedState),(V=Zs||Bp(s,o,V,u,te,Ne,M)||!1)?(ne||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,Ne,M),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,Ne,M)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=Ne),w.props=u,w.state=Ne,w.context=M,u=V):(typeof w.componentDidUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&te===e.memoizedState||(s.flags|=1024),u=!1)}return iu(e,s,o,u,h,f)}function iu(e,s,o,u,f,h){eh(e,s);var w=(s.flags&128)!==0;if(!u&&!w)return f&&ip(s,o,!1),Ls(e,s,h);u=s.stateNode,Jx.current=s;var j=w&&typeof o.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,e!==null&&w?(s.child=oo(s,e.child,null,h),s.child=oo(s,null,j,h)):kn(e,s,j,h),s.memoizedState=u.state,f&&ip(s,o,!0),s.child}function nh(e){var s=e.stateNode;s.pendingContext?rp(e,s.pendingContext,s.pendingContext!==s.context):s.context&&rp(e,s.context,!1),Wc(e,s.containerInfo)}function sh(e,s,o,u,f){return ro(),Oc(f),s.flags|=256,kn(e,s,o,u),s.child}var au={dehydrated:null,treeContext:null,retryLane:0};function lu(e){return{baseLanes:e,cachePool:null,transitions:null}}function rh(e,s,o){var u=s.pendingProps,f=Tt.current,h=!1,w=(s.flags&128)!==0,j;if((j=w)||(j=e!==null&&e.memoizedState===null?!1:(f&2)!==0),j?(h=!0,s.flags&=-129):(e===null||e.memoizedState!==null)&&(f|=1),ut(Tt,f&1),e===null)return Lc(s),e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((s.mode&1)===0?s.lanes=1:e.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,e=u.fallback,h?(u=s.mode,h=s.child,w={mode:"hidden",children:w},(u&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=w):h=Ha(w,u,0,null),e=Dr(e,u,o,null),h.return=s,e.return=s,h.sibling=e,s.child=h,s.child.memoizedState=lu(o),s.memoizedState=au,e):cu(s,w));if(f=e.memoizedState,f!==null&&(j=f.dehydrated,j!==null))return e0(e,s,w,u,j,f,o);if(h){h=u.fallback,w=s.mode,f=e.child,j=f.sibling;var M={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==f?(u=s.child,u.childLanes=0,u.pendingProps=M,s.deletions=null):(u=or(f,M),u.subtreeFlags=f.subtreeFlags&14680064),j!==null?h=or(j,h):(h=Dr(h,w,o,null),h.flags|=2),h.return=s,u.return=s,u.sibling=h,s.child=u,u=h,h=s.child,w=e.child.memoizedState,w=w===null?lu(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},h.memoizedState=w,h.childLanes=e.childLanes&~o,s.memoizedState=au,u}return h=e.child,e=h.sibling,u=or(h,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=o),u.return=s,u.sibling=null,e!==null&&(o=s.deletions,o===null?(s.deletions=[e],s.flags|=16):o.push(e)),s.child=u,s.memoizedState=null,u}function cu(e,s){return s=Ha({mode:"visible",children:s},e.mode,0,null),s.return=e,e.child=s}function Aa(e,s,o,u){return u!==null&&Oc(u),oo(s,e.child,null,o),e=cu(s,s.pendingProps.children),e.flags|=2,s.memoizedState=null,e}function e0(e,s,o,u,f,h,w){if(o)return s.flags&256?(s.flags&=-257,u=su(Error(r(422))),Aa(e,s,w,u)):s.memoizedState!==null?(s.child=e.child,s.flags|=128,null):(h=u.fallback,f=s.mode,u=Ha({mode:"visible",children:u.children},f,0,null),h=Dr(h,f,w,null),h.flags|=2,u.return=s,h.return=s,u.sibling=h,s.child=u,(s.mode&1)!==0&&oo(s,e.child,null,w),s.child.memoizedState=lu(w),s.memoizedState=au,h);if((s.mode&1)===0)return Aa(e,s,w,null);if(f.data==="$!"){if(u=f.nextSibling&&f.nextSibling.dataset,u)var j=u.dgst;return u=j,h=Error(r(419)),u=su(h,u,void 0),Aa(e,s,w,u)}if(j=(w&e.childLanes)!==0,jn||j){if(u=Yt,u!==null){switch(w&-w){case 4:f=2;break;case 16:f=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(u.suspendedLanes|w))!==0?0:f,f!==0&&f!==h.retryLane&&(h.retryLane=f,Ds(e,f),ls(u,e,f,-1))}return Tu(),u=su(Error(r(421))),Aa(e,s,w,u)}return f.data==="$?"?(s.flags|=128,s.child=e.child,s=p0.bind(null,e),f._reactRetry=s,null):(e=h.treeContext,Bn=qs(f.nextSibling),Un=s,wt=!0,rs=null,e!==null&&(Gn[qn++]=As,Gn[qn++]=Is,Gn[qn++]=Nr,As=e.id,Is=e.overflow,Nr=s),s=cu(s,u.children),s.flags|=4096,s)}function oh(e,s,o){e.lanes|=s;var u=e.alternate;u!==null&&(u.lanes|=s),Fc(e.return,s,o)}function uu(e,s,o,u,f){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:f}:(h.isBackwards=s,h.rendering=null,h.renderingStartTime=0,h.last=u,h.tail=o,h.tailMode=f)}function ih(e,s,o){var u=s.pendingProps,f=u.revealOrder,h=u.tail;if(kn(e,s,u.children,o),u=Tt.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=s.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&oh(e,o,s);else if(e.tag===19)oh(e,o,s);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break e;for(;e.sibling===null;){if(e.return===null||e.return===s)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}u&=1}if(ut(Tt,u),(s.mode&1)===0)s.memoizedState=null;else switch(f){case"forwards":for(o=s.child,f=null;o!==null;)e=o.alternate,e!==null&&Na(e)===null&&(f=o),o=o.sibling;o=f,o===null?(f=s.child,s.child=null):(f=o.sibling,o.sibling=null),uu(s,!1,f,o,h);break;case"backwards":for(o=null,f=s.child,s.child=null;f!==null;){if(e=f.alternate,e!==null&&Na(e)===null){s.child=f;break}e=f.sibling,f.sibling=o,o=f,f=e}uu(s,!0,o,null,h);break;case"together":uu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Ia(e,s){(s.mode&1)===0&&e!==null&&(e.alternate=null,s.alternate=null,s.flags|=2)}function Ls(e,s,o){if(e!==null&&(s.dependencies=e.dependencies),_r|=s.lanes,(o&s.childLanes)===0)return null;if(e!==null&&s.child!==e.child)throw Error(r(153));if(s.child!==null){for(e=s.child,o=or(e,e.pendingProps),s.child=o,o.return=s;e.sibling!==null;)e=e.sibling,o=o.sibling=or(e,e.pendingProps),o.return=s;o.sibling=null}return s.child}function t0(e,s,o){switch(s.tag){case 3:nh(s),ro();break;case 5:wp(s);break;case 1:En(s.type)&&ha(s);break;case 4:Wc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,f=s.memoizedProps.value;ut(wa,u._currentValue),u._currentValue=f;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(ut(Tt,Tt.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?rh(e,s,o):(ut(Tt,Tt.current&1),e=Ls(e,s,o),e!==null?e.sibling:null);ut(Tt,Tt.current&1);break;case 19:if(u=(o&s.childLanes)!==0,(e.flags&128)!==0){if(u)return ih(e,s,o);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ut(Tt,Tt.current),u)break;return null;case 22:case 23:return s.lanes=0,Jp(e,s,o)}return Ls(e,s,o)}var ah,du,lh,ch;ah=function(e,s){for(var o=s.child;o!==null;){if(o.tag===5||o.tag===6)e.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},du=function(){},lh=function(e,s,o,u){var f=e.memoizedProps;if(f!==u){e=s.stateNode,Er(ks.current);var h=null;switch(o){case"input":f=Ie(e,f),u=Ie(e,u),h=[];break;case"select":f=G({},f,{value:void 0}),u=G({},u,{value:void 0}),h=[];break;case"textarea":f=Ot(e,f),u=Ot(e,u),h=[];break;default:typeof f.onClick!="function"&&typeof u.onClick=="function"&&(e.onclick=da)}ns(o,u);var w;o=null;for(V in f)if(!u.hasOwnProperty(V)&&f.hasOwnProperty(V)&&f[V]!=null)if(V==="style"){var j=f[V];for(w in j)j.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?h||(h=[]):(h=h||[]).push(V,null));for(V in u){var M=u[V];if(j=f!=null?f[V]:void 0,u.hasOwnProperty(V)&&M!==j&&(M!=null||j!=null))if(V==="style")if(j){for(w in j)!j.hasOwnProperty(w)||M&&M.hasOwnProperty(w)||(o||(o={}),o[w]="");for(w in M)M.hasOwnProperty(w)&&j[w]!==M[w]&&(o||(o={}),o[w]=M[w])}else o||(h||(h=[]),h.push(V,o)),o=M;else V==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,j=j?j.__html:void 0,M!=null&&j!==M&&(h=h||[]).push(V,M)):V==="children"?typeof M!="string"&&typeof M!="number"||(h=h||[]).push(V,""+M):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(M!=null&&V==="onScroll"&&pt("scroll",e),h||j===M||(h=[])):(h=h||[]).push(V,M))}o&&(h=h||[]).push("style",o);var V=h;(s.updateQueue=V)&&(s.flags|=4)}},ch=function(e,s,o,u){o!==u&&(s.flags|=4)};function li(e,s){if(!wt)switch(e.tailMode){case"hidden":s=e.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?s||e.tail===null?e.tail=null:e.tail.sibling=null:u.sibling=null}}function dn(e){var s=e.alternate!==null&&e.alternate.child===e.child,o=0,u=0;if(s)for(var f=e.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags&14680064,u|=f.flags&14680064,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=u,e.childLanes=o,s}function n0(e,s,o){var u=s.pendingProps;switch(Dc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(s),null;case 1:return En(s.type)&&pa(),dn(s),null;case 3:return u=s.stateNode,lo(),ht(Cn),ht(cn),Kc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(e===null||e.child===null)&&(ya(s)?s.flags|=4:e===null||e.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,rs!==null&&(Su(rs),rs=null))),du(e,s),dn(s),null;case 5:Hc(s);var f=Er(si.current);if(o=s.type,e!==null&&s.stateNode!=null)lh(e,s,o,u,f),e.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return dn(s),null}if(e=Er(ks.current),ya(s)){u=s.stateNode,o=s.type;var h=s.memoizedProps;switch(u[ws]=s,u[Zo]=h,e=(s.mode&1)!==0,o){case"dialog":pt("cancel",u),pt("close",u);break;case"iframe":case"object":case"embed":pt("load",u);break;case"video":case"audio":for(f=0;f<Xo.length;f++)pt(Xo[f],u);break;case"source":pt("error",u);break;case"img":case"image":case"link":pt("error",u),pt("load",u);break;case"details":pt("toggle",u);break;case"input":mt(u,h),pt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!h.multiple},pt("invalid",u);break;case"textarea":Y(u,h),pt("invalid",u)}ns(o,h),f=null;for(var w in h)if(h.hasOwnProperty(w)){var j=h[w];w==="children"?typeof j=="string"?u.textContent!==j&&(h.suppressHydrationWarning!==!0&&ua(u.textContent,j,e),f=["children",j]):typeof j=="number"&&u.textContent!==""+j&&(h.suppressHydrationWarning!==!0&&ua(u.textContent,j,e),f=["children",""+j]):l.hasOwnProperty(w)&&j!=null&&w==="onScroll"&&pt("scroll",u)}switch(o){case"input":me(u),tn(u,h,!0);break;case"textarea":me(u),Be(u);break;case"select":case"option":break;default:typeof h.onClick=="function"&&(u.onclick=da)}u=f,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=f.nodeType===9?f:f.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=st(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=w.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof u.is=="string"?e=w.createElement(o,{is:u.is}):(e=w.createElement(o),o==="select"&&(w=e,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):e=w.createElementNS(e,o),e[ws]=s,e[Zo]=u,ah(e,s,!1,!1),s.stateNode=e;e:{switch(w=On(o,u),o){case"dialog":pt("cancel",e),pt("close",e),f=u;break;case"iframe":case"object":case"embed":pt("load",e),f=u;break;case"video":case"audio":for(f=0;f<Xo.length;f++)pt(Xo[f],e);f=u;break;case"source":pt("error",e),f=u;break;case"img":case"image":case"link":pt("error",e),pt("load",e),f=u;break;case"details":pt("toggle",e),f=u;break;case"input":mt(e,u),f=Ie(e,u),pt("invalid",e);break;case"option":f=u;break;case"select":e._wrapperState={wasMultiple:!!u.multiple},f=G({},u,{value:void 0}),pt("invalid",e);break;case"textarea":Y(e,u),f=Ot(e,u),pt("invalid",e);break;default:f=u}ns(o,f),j=f;for(h in j)if(j.hasOwnProperty(h)){var M=j[h];h==="style"?hs(e,M):h==="dangerouslySetInnerHTML"?(M=M?M.__html:void 0,M!=null&&_t(e,M)):h==="children"?typeof M=="string"?(o!=="textarea"||M!=="")&&an(e,M):typeof M=="number"&&an(e,""+M):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(l.hasOwnProperty(h)?M!=null&&h==="onScroll"&&pt("scroll",e):M!=null&&z(e,h,M,w))}switch(o){case"input":me(e),tn(e,u,!1);break;case"textarea":me(e),Be(e);break;case"option":u.value!=null&&e.setAttribute("value",""+_e(u.value));break;case"select":e.multiple=!!u.multiple,h=u.value,h!=null?Ft(e,!!u.multiple,h,!1):u.defaultValue!=null&&Ft(e,!!u.multiple,u.defaultValue,!0);break;default:typeof f.onClick=="function"&&(e.onclick=da)}switch(o){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}}u&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return dn(s),null;case 6:if(e&&s.stateNode!=null)ch(e,s,e.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(o=Er(si.current),Er(ks.current),ya(s)){if(u=s.stateNode,o=s.memoizedProps,u[ws]=s,(h=u.nodeValue!==o)&&(e=Un,e!==null))switch(e.tag){case 3:ua(u.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ua(u.nodeValue,o,(e.mode&1)!==0)}h&&(s.flags|=4)}else u=(o.nodeType===9?o:o.ownerDocument).createTextNode(u),u[ws]=s,s.stateNode=u}return dn(s),null;case 13:if(ht(Tt),u=s.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wt&&Bn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)fp(),ro(),s.flags|=98560,h=!1;else if(h=ya(s),u!==null&&u.dehydrated!==null){if(e===null){if(!h)throw Error(r(318));if(h=s.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[ws]=s}else ro(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;dn(s),h=!1}else rs!==null&&(Su(rs),rs=null),h=!0;if(!h)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=o,s):(u=u!==null,u!==(e!==null&&e.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(e===null||(Tt.current&1)!==0?Wt===0&&(Wt=3):Tu())),s.updateQueue!==null&&(s.flags|=4),dn(s),null);case 4:return lo(),du(e,s),e===null&&Yo(s.stateNode.containerInfo),dn(s),null;case 10:return zc(s.type._context),dn(s),null;case 17:return En(s.type)&&pa(),dn(s),null;case 19:if(ht(Tt),h=s.memoizedState,h===null)return dn(s),null;if(u=(s.flags&128)!==0,w=h.rendering,w===null)if(u)li(h,!1);else{if(Wt!==0||e!==null&&(e.flags&128)!==0)for(e=s.child;e!==null;){if(w=Na(e),w!==null){for(s.flags|=128,li(h,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=o,o=s.child;o!==null;)h=o,e=u,h.flags&=14680066,w=h.alternate,w===null?(h.childLanes=0,h.lanes=e,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=w.childLanes,h.lanes=w.lanes,h.child=w.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=w.memoizedProps,h.memoizedState=w.memoizedState,h.updateQueue=w.updateQueue,h.type=w.type,e=w.dependencies,h.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return ut(Tt,Tt.current&1|2),s.child}e=e.sibling}h.tail!==null&&St()>po&&(s.flags|=128,u=!0,li(h,!1),s.lanes=4194304)}else{if(!u)if(e=Na(w),e!==null){if(s.flags|=128,u=!0,o=e.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),li(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!wt)return dn(s),null}else 2*St()-h.renderingStartTime>po&&o!==1073741824&&(s.flags|=128,u=!0,li(h,!1),s.lanes=4194304);h.isBackwards?(w.sibling=s.child,s.child=w):(o=h.last,o!==null?o.sibling=w:s.child=w,h.last=w)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=St(),s.sibling=null,o=Tt.current,ut(Tt,u?o&1|2:o&1),s):(dn(s),null);case 22:case 23:return Nu(),u=s.memoizedState!==null,e!==null&&e.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Wn&1073741824)!==0&&(dn(s),s.subtreeFlags&6&&(s.flags|=8192)):dn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function s0(e,s){switch(Dc(s),s.tag){case 1:return En(s.type)&&pa(),e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 3:return lo(),ht(Cn),ht(cn),Kc(),e=s.flags,(e&65536)!==0&&(e&128)===0?(s.flags=e&-65537|128,s):null;case 5:return Hc(s),null;case 13:if(ht(Tt),e=s.memoizedState,e!==null&&e.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ro()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 19:return ht(Tt),null;case 4:return lo(),null;case 10:return zc(s.type._context),null;case 22:case 23:return Nu(),null;case 24:return null;default:return null}}var Da=!1,fn=!1,r0=typeof WeakSet=="function"?WeakSet:Set,ke=null;function uo(e,s){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){It(e,s,u)}else o.current=null}function fu(e,s,o){try{o()}catch(u){It(e,s,u)}}var uh=!1;function o0(e,s){if(Nc=Ji,e=Bf(),gc(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,h=u.focusNode;u=u.focusOffset;try{o.nodeType,h.nodeType}catch{o=null;break e}var w=0,j=-1,M=-1,V=0,ne=0,se=e,te=null;t:for(;;){for(var xe;se!==o||f!==0&&se.nodeType!==3||(j=w+f),se!==h||u!==0&&se.nodeType!==3||(M=w+u),se.nodeType===3&&(w+=se.nodeValue.length),(xe=se.firstChild)!==null;)te=se,se=xe;for(;;){if(se===e)break t;if(te===o&&++V===f&&(j=w),te===h&&++ne===u&&(M=w),(xe=se.nextSibling)!==null)break;se=te,te=se.parentNode}se=xe}o=j===-1||M===-1?null:{start:j,end:M}}else o=null}o=o||{start:0,end:0}}else o=null;for(Tc={focusedElem:e,selectionRange:o},Ji=!1,ke=s;ke!==null;)if(s=ke,e=s.child,(s.subtreeFlags&1028)!==0&&e!==null)e.return=s,ke=e;else for(;ke!==null;){s=ke;try{var Ne=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Ce=Ne.memoizedProps,Mt=Ne.memoizedState,B=s.stateNode,O=B.getSnapshotBeforeUpdate(s.elementType===s.type?Ce:os(s.type,Ce),Mt);B.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var H=s.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(de){It(s,s.return,de)}if(e=s.sibling,e!==null){e.return=s.return,ke=e;break}ke=s.return}return Ne=uh,uh=!1,Ne}function ci(e,s,o){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&fu(s,o,h)}f=f.next}while(f!==u)}}function Ma(e,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&e)===e){var u=o.create;o.destroy=u()}o=o.next}while(o!==s)}}function pu(e){var s=e.ref;if(s!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof s=="function"?s(e):s.current=e}}function dh(e){var s=e.alternate;s!==null&&(e.alternate=null,dh(s)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(s=e.stateNode,s!==null&&(delete s[ws],delete s[Zo],delete s[_c],delete s[Ux],delete s[Bx])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function fh(e){return e.tag===5||e.tag===3||e.tag===4}function ph(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||fh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function hu(e,s,o){var u=e.tag;if(u===5||u===6)e=e.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(e,s):o.insertBefore(e,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(e,o)):(s=o,s.appendChild(e)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=da));else if(u!==4&&(e=e.child,e!==null))for(hu(e,s,o),e=e.sibling;e!==null;)hu(e,s,o),e=e.sibling}function mu(e,s,o){var u=e.tag;if(u===5||u===6)e=e.stateNode,s?o.insertBefore(e,s):o.appendChild(e);else if(u!==4&&(e=e.child,e!==null))for(mu(e,s,o),e=e.sibling;e!==null;)mu(e,s,o),e=e.sibling}var nn=null,is=!1;function er(e,s,o){for(o=o.child;o!==null;)hh(e,s,o),o=o.sibling}function hh(e,s,o){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(vr,o)}catch{}switch(o.tag){case 5:fn||uo(o,s);case 6:var u=nn,f=is;nn=null,er(e,s,o),nn=u,is=f,nn!==null&&(is?(e=nn,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):nn.removeChild(o.stateNode));break;case 18:nn!==null&&(is?(e=nn,o=o.stateNode,e.nodeType===8?jc(e.parentNode,o):e.nodeType===1&&jc(e,o),Uo(e)):jc(nn,o.stateNode));break;case 4:u=nn,f=is,nn=o.stateNode.containerInfo,is=!0,er(e,s,o),nn=u,is=f;break;case 0:case 11:case 14:case 15:if(!fn&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var h=f,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&fu(o,s,w),f=f.next}while(f!==u)}er(e,s,o);break;case 1:if(!fn&&(uo(o,s),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(j){It(o,s,j)}er(e,s,o);break;case 21:er(e,s,o);break;case 22:o.mode&1?(fn=(u=fn)||o.memoizedState!==null,er(e,s,o),fn=u):er(e,s,o);break;default:er(e,s,o)}}function mh(e){var s=e.updateQueue;if(s!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new r0),s.forEach(function(u){var f=h0.bind(null,e,u);o.has(u)||(o.add(u),u.then(f,f))})}}function as(e,s){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u];try{var h=e,w=s,j=w;e:for(;j!==null;){switch(j.tag){case 5:nn=j.stateNode,is=!1;break e;case 3:nn=j.stateNode.containerInfo,is=!0;break e;case 4:nn=j.stateNode.containerInfo,is=!0;break e}j=j.return}if(nn===null)throw Error(r(160));hh(h,w,f),nn=null,is=!1;var M=f.alternate;M!==null&&(M.return=null),f.return=null}catch(V){It(f,s,V)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)gh(s,e),s=s.sibling}function gh(e,s){var o=e.alternate,u=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(as(s,e),bs(e),u&4){try{ci(3,e,e.return),Ma(3,e)}catch(Ce){It(e,e.return,Ce)}try{ci(5,e,e.return)}catch(Ce){It(e,e.return,Ce)}}break;case 1:as(s,e),bs(e),u&512&&o!==null&&uo(o,o.return);break;case 5:if(as(s,e),bs(e),u&512&&o!==null&&uo(o,o.return),e.flags&32){var f=e.stateNode;try{an(f,"")}catch(Ce){It(e,e.return,Ce)}}if(u&4&&(f=e.stateNode,f!=null)){var h=e.memoizedProps,w=o!==null?o.memoizedProps:h,j=e.type,M=e.updateQueue;if(e.updateQueue=null,M!==null)try{j==="input"&&h.type==="radio"&&h.name!=null&&Ue(f,h),On(j,w);var V=On(j,h);for(w=0;w<M.length;w+=2){var ne=M[w],se=M[w+1];ne==="style"?hs(f,se):ne==="dangerouslySetInnerHTML"?_t(f,se):ne==="children"?an(f,se):z(f,ne,se,V)}switch(j){case"input":Vt(f,h);break;case"textarea":ge(f,h);break;case"select":var te=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!h.multiple;var xe=h.value;xe!=null?Ft(f,!!h.multiple,xe,!1):te!==!!h.multiple&&(h.defaultValue!=null?Ft(f,!!h.multiple,h.defaultValue,!0):Ft(f,!!h.multiple,h.multiple?[]:"",!1))}f[Zo]=h}catch(Ce){It(e,e.return,Ce)}}break;case 6:if(as(s,e),bs(e),u&4){if(e.stateNode===null)throw Error(r(162));f=e.stateNode,h=e.memoizedProps;try{f.nodeValue=h}catch(Ce){It(e,e.return,Ce)}}break;case 3:if(as(s,e),bs(e),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Uo(s.containerInfo)}catch(Ce){It(e,e.return,Ce)}break;case 4:as(s,e),bs(e);break;case 13:as(s,e),bs(e),f=e.child,f.flags&8192&&(h=f.memoizedState!==null,f.stateNode.isHidden=h,!h||f.alternate!==null&&f.alternate.memoizedState!==null||(yu=St())),u&4&&mh(e);break;case 22:if(ne=o!==null&&o.memoizedState!==null,e.mode&1?(fn=(V=fn)||ne,as(s,e),fn=V):as(s,e),bs(e),u&8192){if(V=e.memoizedState!==null,(e.stateNode.isHidden=V)&&!ne&&(e.mode&1)!==0)for(ke=e,ne=e.child;ne!==null;){for(se=ke=ne;ke!==null;){switch(te=ke,xe=te.child,te.tag){case 0:case 11:case 14:case 15:ci(4,te,te.return);break;case 1:uo(te,te.return);var Ne=te.stateNode;if(typeof Ne.componentWillUnmount=="function"){u=te,o=te.return;try{s=u,Ne.props=s.memoizedProps,Ne.state=s.memoizedState,Ne.componentWillUnmount()}catch(Ce){It(u,o,Ce)}}break;case 5:uo(te,te.return);break;case 22:if(te.memoizedState!==null){xh(se);continue}}xe!==null?(xe.return=te,ke=xe):xh(se)}ne=ne.sibling}e:for(ne=null,se=e;;){if(se.tag===5){if(ne===null){ne=se;try{f=se.stateNode,V?(h=f.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none"):(j=se.stateNode,M=se.memoizedProps.style,w=M!=null&&M.hasOwnProperty("display")?M.display:null,j.style.display=Ln("display",w))}catch(Ce){It(e,e.return,Ce)}}}else if(se.tag===6){if(ne===null)try{se.stateNode.nodeValue=V?"":se.memoizedProps}catch(Ce){It(e,e.return,Ce)}}else if((se.tag!==22&&se.tag!==23||se.memoizedState===null||se===e)&&se.child!==null){se.child.return=se,se=se.child;continue}if(se===e)break e;for(;se.sibling===null;){if(se.return===null||se.return===e)break e;ne===se&&(ne=null),se=se.return}ne===se&&(ne=null),se.sibling.return=se.return,se=se.sibling}}break;case 19:as(s,e),bs(e),u&4&&mh(e);break;case 21:break;default:as(s,e),bs(e)}}function bs(e){var s=e.flags;if(s&2){try{e:{for(var o=e.return;o!==null;){if(fh(o)){var u=o;break e}o=o.return}throw Error(r(160))}switch(u.tag){case 5:var f=u.stateNode;u.flags&32&&(an(f,""),u.flags&=-33);var h=ph(e);mu(e,h,f);break;case 3:case 4:var w=u.stateNode.containerInfo,j=ph(e);hu(e,j,w);break;default:throw Error(r(161))}}catch(M){It(e,e.return,M)}e.flags&=-3}s&4096&&(e.flags&=-4097)}function i0(e,s,o){ke=e,vh(e)}function vh(e,s,o){for(var u=(e.mode&1)!==0;ke!==null;){var f=ke,h=f.child;if(f.tag===22&&u){var w=f.memoizedState!==null||Da;if(!w){var j=f.alternate,M=j!==null&&j.memoizedState!==null||fn;j=Da;var V=fn;if(Da=w,(fn=M)&&!V)for(ke=f;ke!==null;)w=ke,M=w.child,w.tag===22&&w.memoizedState!==null?wh(f):M!==null?(M.return=w,ke=M):wh(f);for(;h!==null;)ke=h,vh(h),h=h.sibling;ke=f,Da=j,fn=V}yh(e)}else(f.subtreeFlags&8772)!==0&&h!==null?(h.return=f,ke=h):yh(e)}}function yh(e){for(;ke!==null;){var s=ke;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:fn||Ma(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!fn)if(o===null)u.componentDidMount();else{var f=s.elementType===s.type?o.memoizedProps:os(s.type,o.memoizedProps);u.componentDidUpdate(f,o.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var h=s.updateQueue;h!==null&&xp(s,h,u);break;case 3:var w=s.updateQueue;if(w!==null){if(o=null,s.child!==null)switch(s.child.tag){case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}xp(s,w,o)}break;case 5:var j=s.stateNode;if(o===null&&s.flags&4){o=j;var M=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":M.autoFocus&&o.focus();break;case"img":M.src&&(o.src=M.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var V=s.alternate;if(V!==null){var ne=V.memoizedState;if(ne!==null){var se=ne.dehydrated;se!==null&&Uo(se)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||s.flags&512&&pu(s)}catch(te){It(s,s.return,te)}}if(s===e){ke=null;break}if(o=s.sibling,o!==null){o.return=s.return,ke=o;break}ke=s.return}}function xh(e){for(;ke!==null;){var s=ke;if(s===e){ke=null;break}var o=s.sibling;if(o!==null){o.return=s.return,ke=o;break}ke=s.return}}function wh(e){for(;ke!==null;){var s=ke;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{Ma(4,s)}catch(M){It(s,o,M)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var f=s.return;try{u.componentDidMount()}catch(M){It(s,f,M)}}var h=s.return;try{pu(s)}catch(M){It(s,h,M)}break;case 5:var w=s.return;try{pu(s)}catch(M){It(s,w,M)}}}catch(M){It(s,s.return,M)}if(s===e){ke=null;break}var j=s.sibling;if(j!==null){j.return=s.return,ke=j;break}ke=s.return}}var a0=Math.ceil,La=I.ReactCurrentDispatcher,gu=I.ReactCurrentOwner,Qn=I.ReactCurrentBatchConfig,Qe=0,Yt=null,$t=null,sn=0,Wn=0,fo=Xs(0),Wt=0,ui=null,_r=0,Oa=0,vu=0,di=null,_n=null,yu=0,po=1/0,Os=null,Pa=!1,xu=null,tr=null,$a=!1,nr=null,za=0,fi=0,wu=null,Fa=-1,Ua=0;function Sn(){return(Qe&6)!==0?St():Fa!==-1?Fa:Fa=St()}function sr(e){return(e.mode&1)===0?1:(Qe&2)!==0&&sn!==0?sn&-sn:Hx.transition!==null?(Ua===0&&(Ua=Po()),Ua):(e=Xe,e!==0||(e=window.event,e=e===void 0?16:Sf(e.type)),e)}function ls(e,s,o,u){if(50<fi)throw fi=0,wu=null,Error(r(185));kr(e,o,u),((Qe&2)===0||e!==Yt)&&(e===Yt&&((Qe&2)===0&&(Oa|=o),Wt===4&&rr(e,sn)),Rn(e,u),o===1&&Qe===0&&(s.mode&1)===0&&(po=St()+500,ma&&Qs()))}function Rn(e,s){var o=e.callbackNode;Yi(e,s);var u=wr(e,e===Yt?sn:0);if(u===0)o!==null&&At(o),e.callbackNode=null,e.callbackPriority=0;else if(s=u&-u,e.callbackPriority!==s){if(o!=null&&At(o),s===1)e.tag===0?Wx(Sh.bind(null,e)):ap(Sh.bind(null,e)),zx(function(){(Qe&6)===0&&Qs()}),o=null;else{switch(ue(u)){case 1:o=Bs;break;case 4:o=xs;break;case 16:o=Br;break;case 536870912:o=qi;break;default:o=Br}o=Rh(o,kh.bind(null,e))}e.callbackPriority=s,e.callbackNode=o}}function kh(e,s){if(Fa=-1,Ua=0,(Qe&6)!==0)throw Error(r(327));var o=e.callbackNode;if(ho()&&e.callbackNode!==o)return null;var u=wr(e,e===Yt?sn:0);if(u===0)return null;if((u&30)!==0||(u&e.expiredLanes)!==0||s)s=Ba(e,u);else{s=u;var f=Qe;Qe|=2;var h=Nh();(Yt!==e||sn!==s)&&(Os=null,po=St()+500,Ar(e,s));do try{u0();break}catch(j){bh(e,j)}while(!0);$c(),La.current=h,Qe=f,$t!==null?s=0:(Yt=null,sn=0,s=Wt)}if(s!==0){if(s===2&&(f=Oo(e),f!==0&&(u=f,s=ku(e,f))),s===1)throw o=ui,Ar(e,0),rr(e,u),Rn(e,St()),o;if(s===6)rr(e,u);else{if(f=e.current.alternate,(u&30)===0&&!l0(f)&&(s=Ba(e,u),s===2&&(h=Oo(e),h!==0&&(u=h,s=ku(e,h))),s===1))throw o=ui,Ar(e,0),rr(e,u),Rn(e,St()),o;switch(e.finishedWork=f,e.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Ir(e,_n,Os);break;case 3:if(rr(e,u),(u&130023424)===u&&(s=yu+500-St(),10<s)){if(wr(e,0)!==0)break;if(f=e.suspendedLanes,(f&u)!==u){Sn(),e.pingedLanes|=e.suspendedLanes&f;break}e.timeoutHandle=Ec(Ir.bind(null,e,_n,Os),s);break}Ir(e,_n,Os);break;case 4:if(rr(e,u),(u&4194240)===u)break;for(s=e.eventTimes,f=-1;0<u;){var w=31-xn(u);h=1<<w,w=s[w],w>f&&(f=w),u&=~h}if(u=f,u=St()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*a0(u/1960))-u,10<u){e.timeoutHandle=Ec(Ir.bind(null,e,_n,Os),u);break}Ir(e,_n,Os);break;case 5:Ir(e,_n,Os);break;default:throw Error(r(329))}}}return Rn(e,St()),e.callbackNode===o?kh.bind(null,e):null}function ku(e,s){var o=di;return e.current.memoizedState.isDehydrated&&(Ar(e,s).flags|=256),e=Ba(e,s),e!==2&&(s=_n,_n=o,s!==null&&Su(s)),e}function Su(e){_n===null?_n=e:_n.push.apply(_n,e)}function l0(e){for(var s=e;;){if(s.flags&16384){var o=s.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var u=0;u<o.length;u++){var f=o[u],h=f.getSnapshot;f=f.value;try{if(!ss(h(),f))return!1}catch{return!1}}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function rr(e,s){for(s&=~vu,s&=~Oa,e.suspendedLanes|=s,e.pingedLanes&=~s,e=e.expirationTimes;0<s;){var o=31-xn(s),u=1<<o;e[o]=-1,s&=~u}}function Sh(e){if((Qe&6)!==0)throw Error(r(327));ho();var s=wr(e,0);if((s&1)===0)return Rn(e,St()),null;var o=Ba(e,s);if(e.tag!==0&&o===2){var u=Oo(e);u!==0&&(s=u,o=ku(e,u))}if(o===1)throw o=ui,Ar(e,0),rr(e,s),Rn(e,St()),o;if(o===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=s,Ir(e,_n,Os),Rn(e,St()),null}function bu(e,s){var o=Qe;Qe|=1;try{return e(s)}finally{Qe=o,Qe===0&&(po=St()+500,ma&&Qs())}}function Rr(e){nr!==null&&nr.tag===0&&(Qe&6)===0&&ho();var s=Qe;Qe|=1;var o=Qn.transition,u=Xe;try{if(Qn.transition=null,Xe=1,e)return e()}finally{Xe=u,Qn.transition=o,Qe=s,(Qe&6)===0&&Qs()}}function Nu(){Wn=fo.current,ht(fo)}function Ar(e,s){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,$x(o)),$t!==null)for(o=$t.return;o!==null;){var u=o;switch(Dc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&pa();break;case 3:lo(),ht(Cn),ht(cn),Kc();break;case 5:Hc(u);break;case 4:lo();break;case 13:ht(Tt);break;case 19:ht(Tt);break;case 10:zc(u.type._context);break;case 22:case 23:Nu()}o=o.return}if(Yt=e,$t=e=or(e.current,null),sn=Wn=s,Wt=0,ui=null,vu=Oa=_r=0,_n=di=null,Cr!==null){for(s=0;s<Cr.length;s++)if(o=Cr[s],u=o.interleaved,u!==null){o.interleaved=null;var f=u.next,h=o.pending;if(h!==null){var w=h.next;h.next=f,u.next=w}o.pending=u}Cr=null}return e}function bh(e,s){do{var o=$t;try{if($c(),Ta.current=_a,Ca){for(var u=Ct.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}Ca=!1}if(jr=0,Xt=Bt=Ct=null,ri=!1,oi=0,gu.current=null,o===null||o.return===null){Wt=1,ui=s,$t=null;break}e:{var h=e,w=o.return,j=o,M=s;if(s=sn,j.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){var V=M,ne=j,se=ne.tag;if((ne.mode&1)===0&&(se===0||se===11||se===15)){var te=ne.alternate;te?(ne.updateQueue=te.updateQueue,ne.memoizedState=te.memoizedState,ne.lanes=te.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var xe=qp(w);if(xe!==null){xe.flags&=-257,Xp(xe,w,j,h,s),xe.mode&1&&Gp(h,V,s),s=xe,M=V;var Ne=s.updateQueue;if(Ne===null){var Ce=new Set;Ce.add(M),s.updateQueue=Ce}else Ne.add(M);break e}else{if((s&1)===0){Gp(h,V,s),Tu();break e}M=Error(r(426))}}else if(wt&&j.mode&1){var Mt=qp(w);if(Mt!==null){(Mt.flags&65536)===0&&(Mt.flags|=256),Xp(Mt,w,j,h,s),Oc(co(M,j));break e}}h=M=co(M,j),Wt!==4&&(Wt=2),di===null?di=[h]:di.push(h),h=w;do{switch(h.tag){case 3:h.flags|=65536,s&=-s,h.lanes|=s;var B=Vp(h,M,s);yp(h,B);break e;case 1:j=M;var O=h.type,H=h.stateNode;if((h.flags&128)===0&&(typeof O.getDerivedStateFromError=="function"||H!==null&&typeof H.componentDidCatch=="function"&&(tr===null||!tr.has(H)))){h.flags|=65536,s&=-s,h.lanes|=s;var de=Kp(h,j,s);yp(h,de);break e}}h=h.return}while(h!==null)}Ch(o)}catch(Ee){s=Ee,$t===o&&o!==null&&($t=o=o.return);continue}break}while(!0)}function Nh(){var e=La.current;return La.current=_a,e===null?_a:e}function Tu(){(Wt===0||Wt===3||Wt===2)&&(Wt=4),Yt===null||(_r&268435455)===0&&(Oa&268435455)===0||rr(Yt,sn)}function Ba(e,s){var o=Qe;Qe|=2;var u=Nh();(Yt!==e||sn!==s)&&(Os=null,Ar(e,s));do try{c0();break}catch(f){bh(e,f)}while(!0);if($c(),Qe=o,La.current=u,$t!==null)throw Error(r(261));return Yt=null,sn=0,Wt}function c0(){for(;$t!==null;)Th($t)}function u0(){for(;$t!==null&&!vs();)Th($t)}function Th(e){var s=_h(e.alternate,e,Wn);e.memoizedProps=e.pendingProps,s===null?Ch(e):$t=s,gu.current=null}function Ch(e){var s=e;do{var o=s.alternate;if(e=s.return,(s.flags&32768)===0){if(o=n0(o,s,Wn),o!==null){$t=o;return}}else{if(o=s0(o,s),o!==null){o.flags&=32767,$t=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Wt=6,$t=null;return}}if(s=s.sibling,s!==null){$t=s;return}$t=s=e}while(s!==null);Wt===0&&(Wt=5)}function Ir(e,s,o){var u=Xe,f=Qn.transition;try{Qn.transition=null,Xe=1,d0(e,s,o,u)}finally{Qn.transition=f,Xe=u}return null}function d0(e,s,o,u){do ho();while(nr!==null);if((Qe&6)!==0)throw Error(r(327));o=e.finishedWork;var f=e.finishedLanes;if(o===null)return null;if(e.finishedWork=null,e.finishedLanes=0,o===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var h=o.lanes|o.childLanes;if(Qi(e,h),e===Yt&&($t=Yt=null,sn=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||$a||($a=!0,Rh(Br,function(){return ho(),null})),h=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||h){h=Qn.transition,Qn.transition=null;var w=Xe;Xe=1;var j=Qe;Qe|=4,gu.current=null,o0(e,o),gh(o,e),Ax(Tc),Ji=!!Nc,Tc=Nc=null,e.current=o,i0(o),rc(),Qe=j,Xe=w,Qn.transition=h}else e.current=o;if($a&&($a=!1,nr=e,za=f),h=e.pendingLanes,h===0&&(tr=null),Wr(o.stateNode),Rn(e,St()),s!==null)for(u=e.onRecoverableError,o=0;o<s.length;o++)f=s[o],u(f.value,{componentStack:f.stack,digest:f.digest});if(Pa)throw Pa=!1,e=xu,xu=null,e;return(za&1)!==0&&e.tag!==0&&ho(),h=e.pendingLanes,(h&1)!==0?e===wu?fi++:(fi=0,wu=e):fi=0,Qs(),null}function ho(){if(nr!==null){var e=ue(za),s=Qn.transition,o=Xe;try{if(Qn.transition=null,Xe=16>e?16:e,nr===null)var u=!1;else{if(e=nr,nr=null,za=0,(Qe&6)!==0)throw Error(r(331));var f=Qe;for(Qe|=4,ke=e.current;ke!==null;){var h=ke,w=h.child;if((ke.flags&16)!==0){var j=h.deletions;if(j!==null){for(var M=0;M<j.length;M++){var V=j[M];for(ke=V;ke!==null;){var ne=ke;switch(ne.tag){case 0:case 11:case 15:ci(8,ne,h)}var se=ne.child;if(se!==null)se.return=ne,ke=se;else for(;ke!==null;){ne=ke;var te=ne.sibling,xe=ne.return;if(dh(ne),ne===V){ke=null;break}if(te!==null){te.return=xe,ke=te;break}ke=xe}}}var Ne=h.alternate;if(Ne!==null){var Ce=Ne.child;if(Ce!==null){Ne.child=null;do{var Mt=Ce.sibling;Ce.sibling=null,Ce=Mt}while(Ce!==null)}}ke=h}}if((h.subtreeFlags&2064)!==0&&w!==null)w.return=h,ke=w;else e:for(;ke!==null;){if(h=ke,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:ci(9,h,h.return)}var B=h.sibling;if(B!==null){B.return=h.return,ke=B;break e}ke=h.return}}var O=e.current;for(ke=O;ke!==null;){w=ke;var H=w.child;if((w.subtreeFlags&2064)!==0&&H!==null)H.return=w,ke=H;else e:for(w=O;ke!==null;){if(j=ke,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:Ma(9,j)}}catch(Ee){It(j,j.return,Ee)}if(j===w){ke=null;break e}var de=j.sibling;if(de!==null){de.return=j.return,ke=de;break e}ke=j.return}}if(Qe=f,Qs(),zn&&typeof zn.onPostCommitFiberRoot=="function")try{zn.onPostCommitFiberRoot(vr,e)}catch{}u=!0}return u}finally{Xe=o,Qn.transition=s}}return!1}function Eh(e,s,o){s=co(o,s),s=Vp(e,s,1),e=Js(e,s,1),s=Sn(),e!==null&&(kr(e,1,s),Rn(e,s))}function It(e,s,o){if(e.tag===3)Eh(e,e,o);else for(;s!==null;){if(s.tag===3){Eh(s,e,o);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(tr===null||!tr.has(u))){e=co(o,e),e=Kp(s,e,1),s=Js(s,e,1),e=Sn(),s!==null&&(kr(s,1,e),Rn(s,e));break}}s=s.return}}function f0(e,s,o){var u=e.pingCache;u!==null&&u.delete(s),s=Sn(),e.pingedLanes|=e.suspendedLanes&o,Yt===e&&(sn&o)===o&&(Wt===4||Wt===3&&(sn&130023424)===sn&&500>St()-yu?Ar(e,0):vu|=o),Rn(e,s)}function jh(e,s){s===0&&((e.mode&1)===0?s=1:(s=Vr,Vr<<=1,(Vr&130023424)===0&&(Vr=4194304)));var o=Sn();e=Ds(e,s),e!==null&&(kr(e,s,o),Rn(e,o))}function p0(e){var s=e.memoizedState,o=0;s!==null&&(o=s.retryLane),jh(e,o)}function h0(e,s){var o=0;switch(e.tag){case 13:var u=e.stateNode,f=e.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=e.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),jh(e,o)}var _h;_h=function(e,s,o){if(e!==null)if(e.memoizedProps!==s.pendingProps||Cn.current)jn=!0;else{if((e.lanes&o)===0&&(s.flags&128)===0)return jn=!1,t0(e,s,o);jn=(e.flags&131072)!==0}else jn=!1,wt&&(s.flags&1048576)!==0&&lp(s,va,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Ia(e,s),e=s.pendingProps;var f=to(s,cn.current);ao(s,o),f=Xc(null,s,u,e,f,o);var h=Yc();return s.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,En(u)?(h=!0,ha(s)):h=!1,s.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Bc(s),f.updater=Ra,s.stateNode=f,f._reactInternals=s,nu(s,u,e,o),s=iu(null,s,u,!0,h,o)):(s.tag=0,wt&&h&&Ic(s),kn(null,s,f,o),s=s.child),s;case 16:u=s.elementType;e:{switch(Ia(e,s),e=s.pendingProps,f=u._init,u=f(u._payload),s.type=u,f=s.tag=g0(u),e=os(u,e),f){case 0:s=ou(null,s,u,e,o);break e;case 1:s=th(null,s,u,e,o);break e;case 11:s=Yp(null,s,u,e,o);break e;case 14:s=Qp(null,s,u,os(u.type,e),o);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:os(u,f),ou(e,s,u,f,o);case 1:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:os(u,f),th(e,s,u,f,o);case 3:e:{if(nh(s),e===null)throw Error(r(387));u=s.pendingProps,h=s.memoizedState,f=h.element,vp(e,s),ba(s,u,null,o);var w=s.memoizedState;if(u=w.element,h.isDehydrated)if(h={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){f=co(Error(r(423)),s),s=sh(e,s,u,o,f);break e}else if(u!==f){f=co(Error(r(424)),s),s=sh(e,s,u,o,f);break e}else for(Bn=qs(s.stateNode.containerInfo.firstChild),Un=s,wt=!0,rs=null,o=mp(s,null,u,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ro(),u===f){s=Ls(e,s,o);break e}kn(e,s,u,o)}s=s.child}return s;case 5:return wp(s),e===null&&Lc(s),u=s.type,f=s.pendingProps,h=e!==null?e.memoizedProps:null,w=f.children,Cc(u,f)?w=null:h!==null&&Cc(u,h)&&(s.flags|=32),eh(e,s),kn(e,s,w,o),s.child;case 6:return e===null&&Lc(s),null;case 13:return rh(e,s,o);case 4:return Wc(s,s.stateNode.containerInfo),u=s.pendingProps,e===null?s.child=oo(s,null,u,o):kn(e,s,u,o),s.child;case 11:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:os(u,f),Yp(e,s,u,f,o);case 7:return kn(e,s,s.pendingProps,o),s.child;case 8:return kn(e,s,s.pendingProps.children,o),s.child;case 12:return kn(e,s,s.pendingProps.children,o),s.child;case 10:e:{if(u=s.type._context,f=s.pendingProps,h=s.memoizedProps,w=f.value,ut(wa,u._currentValue),u._currentValue=w,h!==null)if(ss(h.value,w)){if(h.children===f.children&&!Cn.current){s=Ls(e,s,o);break e}}else for(h=s.child,h!==null&&(h.return=s);h!==null;){var j=h.dependencies;if(j!==null){w=h.child;for(var M=j.firstContext;M!==null;){if(M.context===u){if(h.tag===1){M=Ms(-1,o&-o),M.tag=2;var V=h.updateQueue;if(V!==null){V=V.shared;var ne=V.pending;ne===null?M.next=M:(M.next=ne.next,ne.next=M),V.pending=M}}h.lanes|=o,M=h.alternate,M!==null&&(M.lanes|=o),Fc(h.return,o,s),j.lanes|=o;break}M=M.next}}else if(h.tag===10)w=h.type===s.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(r(341));w.lanes|=o,j=w.alternate,j!==null&&(j.lanes|=o),Fc(w,o,s),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===s){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}kn(e,s,f.children,o),s=s.child}return s;case 9:return f=s.type,u=s.pendingProps.children,ao(s,o),f=Xn(f),u=u(f),s.flags|=1,kn(e,s,u,o),s.child;case 14:return u=s.type,f=os(u,s.pendingProps),f=os(u.type,f),Qp(e,s,u,f,o);case 15:return Zp(e,s,s.type,s.pendingProps,o);case 17:return u=s.type,f=s.pendingProps,f=s.elementType===u?f:os(u,f),Ia(e,s),s.tag=1,En(u)?(e=!0,ha(s)):e=!1,ao(s,o),Wp(s,u,f),nu(s,u,f,o),iu(null,s,u,!0,e,o);case 19:return ih(e,s,o);case 22:return Jp(e,s,o)}throw Error(r(156,s.tag))};function Rh(e,s){return Je(e,s)}function m0(e,s,o,u){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Zn(e,s,o,u){return new m0(e,s,o,u)}function Cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function g0(e){if(typeof e=="function")return Cu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ye)return 11;if(e===J)return 14}return 2}function or(e,s){var o=e.alternate;return o===null?(o=Zn(e.tag,s,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=s,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,s=e.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function Wa(e,s,o,u,f,h){var w=2;if(u=e,typeof e=="function")Cu(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case K:return Dr(o.children,f,h,s);case $:w=8,f|=8;break;case Z:return e=Zn(12,o,s,f|2),e.elementType=Z,e.lanes=h,e;case Se:return e=Zn(13,o,s,f),e.elementType=Se,e.lanes=h,e;case Oe:return e=Zn(19,o,s,f),e.elementType=Oe,e.lanes=h,e;case oe:return Ha(o,f,h,s);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:w=10;break e;case ce:w=9;break e;case ye:w=11;break e;case J:w=14;break e;case re:w=16,u=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return s=Zn(w,o,s,f),s.elementType=e,s.type=u,s.lanes=h,s}function Dr(e,s,o,u){return e=Zn(7,e,u,s),e.lanes=o,e}function Ha(e,s,o,u){return e=Zn(22,e,u,s),e.elementType=oe,e.lanes=o,e.stateNode={isHidden:!1},e}function Eu(e,s,o){return e=Zn(6,e,null,s),e.lanes=o,e}function ju(e,s,o){return s=Zn(4,e.children!==null?e.children:[],e.key,s),s.lanes=o,s.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},s}function v0(e,s,o,u,f){this.tag=s,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$o(0),this.expirationTimes=$o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$o(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function _u(e,s,o,u,f,h,w,j,M){return e=new v0(e,s,o,j,M),s===1?(s=1,h===!0&&(s|=8)):s=0,h=Zn(3,null,null,s),e.current=h,h.stateNode=e,h.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bc(h),e}function y0(e,s,o){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:q,key:u==null?null:""+u,children:e,containerInfo:s,implementation:o}}function Ah(e){if(!e)return Ys;e=e._reactInternals;e:{if(We(e)!==e||e.tag!==1)throw Error(r(170));var s=e;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(En(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(e.tag===1){var o=e.type;if(En(o))return op(e,o,s)}return s}function Ih(e,s,o,u,f,h,w,j,M){return e=_u(o,u,!0,e,f,h,w,j,M),e.context=Ah(null),o=e.current,u=Sn(),f=sr(o),h=Ms(u,f),h.callback=s??null,Js(o,h,f),e.current.lanes=f,kr(e,f,u),Rn(e,u),e}function Va(e,s,o,u){var f=s.current,h=Sn(),w=sr(f);return o=Ah(o),s.context===null?s.context=o:s.pendingContext=o,s=Ms(h,w),s.payload={element:e},u=u===void 0?null:u,u!==null&&(s.callback=u),e=Js(f,s,w),e!==null&&(ls(e,f,w,h),Sa(e,f,w)),w}function Ka(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Dh(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<s?o:s}}function Ru(e,s){Dh(e,s),(e=e.alternate)&&Dh(e,s)}function x0(){return null}var Mh=typeof reportError=="function"?reportError:function(e){console.error(e)};function Au(e){this._internalRoot=e}Ga.prototype.render=Au.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(r(409));Va(e,s,null,null)},Ga.prototype.unmount=Au.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;Rr(function(){Va(null,e,null,null)}),s[_s]=null}};function Ga(e){this._internalRoot=e}Ga.prototype.unstable_scheduleHydration=function(e){if(e){var s=Te();e={blockedOn:null,target:e,priority:s};for(var o=0;o<Vs.length&&s!==0&&s<Vs[o].priority;o++);Vs.splice(o,0,e),o===0&&wf(e)}};function Iu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function qa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Lh(){}function w0(e,s,o,u,f){if(f){if(typeof u=="function"){var h=u;u=function(){var V=Ka(w);h.call(V)}}var w=Ih(s,u,e,0,null,!1,!1,"",Lh);return e._reactRootContainer=w,e[_s]=w.current,Yo(e.nodeType===8?e.parentNode:e),Rr(),w}for(;f=e.lastChild;)e.removeChild(f);if(typeof u=="function"){var j=u;u=function(){var V=Ka(M);j.call(V)}}var M=_u(e,0,!1,null,null,!1,!1,"",Lh);return e._reactRootContainer=M,e[_s]=M.current,Yo(e.nodeType===8?e.parentNode:e),Rr(function(){Va(s,M,o,u)}),M}function Xa(e,s,o,u,f){var h=o._reactRootContainer;if(h){var w=h;if(typeof f=="function"){var j=f;f=function(){var M=Ka(w);j.call(M)}}Va(s,w,e,f)}else w=w0(o,s,e,f,u);return Ka(w)}T=function(e){switch(e.tag){case 3:var s=e.stateNode;if(s.current.memoizedState.isDehydrated){var o=xr(s.pendingLanes);o!==0&&(Hs(s,o|1),Rn(s,St()),(Qe&6)===0&&(po=St()+500,Qs()))}break;case 13:Rr(function(){var u=Ds(e,1);if(u!==null){var f=Sn();ls(u,e,1,f)}}),Ru(e,1)}},U=function(e){if(e.tag===13){var s=Ds(e,134217728);if(s!==null){var o=Sn();ls(s,e,134217728,o)}Ru(e,134217728)}},ee=function(e){if(e.tag===13){var s=sr(e),o=Ds(e,s);if(o!==null){var u=Sn();ls(o,e,s,u)}Ru(e,s)}},Te=function(){return Xe},Re=function(e,s){var o=Xe;try{return Xe=e,s()}finally{Xe=o}},Kt=function(e,s,o){switch(s){case"input":if(Vt(e,o),s=o.name,o.type==="radio"&&s!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<o.length;s++){var u=o[s];if(u!==e&&u.form===e.form){var f=fa(u);if(!f)throw Error(r(90));pe(u),Vt(u,f)}}}break;case"textarea":ge(e,o);break;case"select":s=o.value,s!=null&&Ft(e,!!o.multiple,s,!1)}},yt=bu,xt=Rr;var k0={usingClientEntryPoint:!1,Events:[Jo,Jr,fa,ft,Gt,bu]},pi={findFiberByHostInstance:Sr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},S0={bundleType:pi.bundleType,version:pi.version,rendererPackageName:pi.rendererPackageName,rendererConfig:pi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:I.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=$n(e),e===null?null:e.stateNode},findFiberByHostInstance:pi.findFiberByHostInstance||x0,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ya=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ya.isDisabled&&Ya.supportsFiber)try{vr=Ya.inject(S0),zn=Ya}catch{}}return An.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=k0,An.createPortal=function(e,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Iu(s))throw Error(r(200));return y0(e,s,null,o)},An.createRoot=function(e,s){if(!Iu(e))throw Error(r(299));var o=!1,u="",f=Mh;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(f=s.onRecoverableError)),s=_u(e,1,!1,null,null,o,!1,u,f),e[_s]=s.current,Yo(e.nodeType===8?e.parentNode:e),new Au(s)},An.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=$n(s),e=e===null?null:e.stateNode,e},An.flushSync=function(e){return Rr(e)},An.hydrate=function(e,s,o){if(!qa(s))throw Error(r(200));return Xa(null,e,s,!0,o)},An.hydrateRoot=function(e,s,o){if(!Iu(e))throw Error(r(405));var u=o!=null&&o.hydratedSources||null,f=!1,h="",w=Mh;if(o!=null&&(o.unstable_strictMode===!0&&(f=!0),o.identifierPrefix!==void 0&&(h=o.identifierPrefix),o.onRecoverableError!==void 0&&(w=o.onRecoverableError)),s=Ih(s,null,e,1,o??null,f,!1,h,w),e[_s]=s.current,Yo(e),u)for(e=0;e<u.length;e++)o=u[e],f=o._getVersion,f=f(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,f]:s.mutableSourceEagerHydrationData.push(o,f);return new Ga(s)},An.render=function(e,s,o){if(!qa(s))throw Error(r(200));return Xa(null,e,s,!1,o)},An.unmountComponentAtNode=function(e){if(!qa(e))throw Error(r(40));return e._reactRootContainer?(Rr(function(){Xa(null,null,e,!1,function(){e._reactRootContainer=null,e[_s]=null})}),!0):!1},An.unstable_batchedUpdates=bu,An.unstable_renderSubtreeIntoContainer=function(e,s,o,u){if(!qa(o))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Xa(e,s,o,!1,u)},An.version="18.3.1-next-f1338f8080-20240426",An}var Wh;function Vg(){if(Wh)return Lu.exports;Wh=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),Lu.exports=A0(),Lu.exports}var Hh;function I0(){if(Hh)return Qa;Hh=1;var t=Vg();return Qa.createRoot=t.createRoot,Qa.hydrateRoot=t.hydrateRoot,Qa}var D0=I0();const M0=Hg(D0),Vh=t=>{let n;const r=new Set,i=(m,v)=>{const k=typeof m=="function"?m(n):m;if(!Object.is(k,n)){const y=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,y))}},l=()=>n,p={setState:i,getState:l,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=n=t(i,l,p);return p},L0=(t=>t?Vh(t):Vh),O0=t=>t;function P0(t,n=O0){const r=ct.useSyncExternalStore(t.subscribe,ct.useCallback(()=>n(t.getState()),[t,n]),ct.useCallback(()=>n(t.getInitialState()),[t,n]));return ct.useDebugValue(r),r}const $0=t=>{const n=L0(t),r=i=>P0(n,i);return Object.assign(r,n),r},z0=(t=>$0),Kg="agentpane:machines",Gg="agentpane:active-machine";function F0(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function qg(t){return`${t}.repoburg.com`}function Xg(t){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return n?n[1]:null}function Yg(t,n){try{const r=localStorage.getItem(t);return r==null?n:JSON.parse(r)}catch{return n}}function Qg(t,n){try{localStorage.setItem(t,JSON.stringify(n))}catch{}}function U0(t){const{mahlas:n,hostname:r}=t??{};return typeof n=="string"&&F0(n)&&r===qg(n)}function Zg(){const t=Yg(Kg,[]);return Array.isArray(t)?t.filter(U0):[]}function B0(t){const n={mahlas:t,hostname:qg(t),lastConnectedAt:new Date().toISOString()},r=Zg(),i=[n,...r.filter(l=>l.mahlas!==t)];return Qg(Kg,i),n}function W0(){const t=Yg(Gg,null);return t?Zg().find(n=>n.mahlas===t)??null:null}function H0(t){Qg(Gg,t)}function V0(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const n=Xg(t);n&&(B0(n),H0(n))}const Kh="http://localhost:9998",K0=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),n=t.get("bport");if(n)return`http://localhost:${n}`;const r=t.get("host");if(r)return`https://${r}`;const i=window.location.hostname;if(K0.includes(i))return Kh;if(Xg(i))return"";const l=W0();return l?`https://${l.hostname}`:i==="localhost"||i==="127.0.0.1"||i==="0.0.0.0"?"":Kh}function G0(t){const n=mn();return n?`${n.replace(/^http/,"ws")}${t}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${t}`}const q0="/api";class zi extends Error{constructor(r,i,l){super(r);it(this,"status");it(this,"body");this.name="ApiError",this.status=i,this.body=l}}function Pr(t){var n;if(t instanceof zi){const r=(n=t.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return t instanceof Error?t.message:String(t)}async function Fi(t,n,r){const i=await fetch(`${mn()}${q0}${n}`,{method:t,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!i.ok){let l=`${i.status} ${i.statusText}`,c=null;try{c=await i.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new zi(`${t} ${n} failed: ${l}`,i.status,c)}return i.json()}function Et(t){return Fi("GET",t)}function at(t,n){return Fi("POST",t,n)}function Bl(t){return Fi("DELETE",t)}function ds(t,n){return Fi("PATCH",t,n)}function X0(t,n){return Fi("PUT",t,n)}function Y0(){return Et("/sessions")}function mi(t){return Et(`/sessions/${t}?items=summary`)}function Q0(t,n){return Et(`/sessions/${t}/turns/${n}`)}function Pd(t){return at("/sessions",t)}function Gh(t){return Bl(`/sessions/${t}`)}function Jg(t,n,r,i){return at(`/sessions/${t}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...i!=null&&i.originAppId?{origin_app_id:i.originAppId}:{}})}function Z0(t){return at(`/sessions/${t}/cancel`)}function J0(t,n){return at(`/sessions/${t}/turns/${n}/resume`)}function ew(){return at("/turns/resume-signed-out")}function tw(t,n){return ds(`/sessions/${t}`,{title:n})}function qh(t){return ds(`/sessions/${t}`,{lifecycle:"finished"})}function Xh(t){return ds(`/sessions/${t}`,{lifecycle:"working"})}function nw(t,n){return ds(`/sessions/${t}`,{starred:n})}function Yh(t){return ds(`/sessions/${t}`,{has_unreviewed:0})}function sw(t,n,r,i){const l={model:n,model_reasoning_effort:r};return i!==void 0&&(l.runtime_type=i),ds(`/sessions/${t}`,l)}function rw(t,n){return ds(`/sessions/${t}`,{runtime_config:n})}function ow(t,n){return at(`/sessions/${t}/rewind`,{turn_id:n})}function iw(t){return at(`/sessions/${t}/restore`,{})}function aw(t,n,r){return at(`/sessions/${t}/branch`,{turn_id:n,title:r})}function ev(){return Et("/workspaces")}function lw(t,n){return at("/workspaces",{path:t,label:n})}function cw(t){return at("/workspaces/hide",{path:t})}function uw(){return Et("/workspaces/picker")}function Qh(t){return Et(t?`/workspaces/browse?path=${encodeURIComponent(t)}`:"/workspaces/browse")}async function tv(){const t=await fetch(`${mn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function nv(){return Et("/folders")}function dw(t,n){return at("/folders",{workspace_path:t,name:n})}function Zh(t,n){return ds(`/folders/${t}`,n)}function fw(t){return Bl(`/folders/${t}`)}function pw(t){return at("/sessions/reorder",{moves:t})}function zs(t){return t.status==="pending"||t.status==="running"}function sv(t){return!!(t!=null&&t.turns.some(zs))}function Wl(t){return t?t.turns.some(zs)||(t.threads??[]).some(n=>(n.turns??[]).some(zs)):!1}const hw="s:",cd="a:",$r=t=>`${hw}${t}`,Ri=t=>`${cd}${t}`;function pr(t){return{kind:t.startsWith(cd)?"app":"session",id:t.slice(cd.length)}}function $d(t){return t.activeAppTabId!==null?Ri(t.activeAppTabId):t.activeSessionId===null?null:$r(t.activeSessionId)}function rv(t,n,r){const i=[...n.map($r),...r.map(Ri)],l=new Set(i),c=t.filter(g=>l.has(g)),d=new Set(c),p=i.filter(g=>!d.has(g));return p.length===0&&c.length===t.length?t:[...c,...p]}function mw(t){return t.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const i=rv(n.tabOrder,n.openTabs,n.openAppTabs);i!==n.tabOrder&&t.setState({tabOrder:i})})}function Jh(t,n,r){const i=t.indexOf(n);return t.slice(i+1).find(r)??t.slice(0,Math.max(i,0)).reverse().find(r)??null}function zd(t,n){const r=d=>!n.has(d),i=$d(t);let{activeSessionId:l,activeAppTabId:c}=t;if(i!==null&&n.has(i)){const d=Jh(t.tabOrder,i,r),p=d===null?null:pr(d);c=(p==null?void 0:p.kind)==="app"?p.id:null,(p==null?void 0:p.kind)==="session"&&(l=p.id)}if(l!==null&&n.has($r(l))){const d=g=>r(g)&&pr(g).kind==="session",p=Jh(t.tabOrder,$r(l),d);l=p===null?null:pr(p).id}return{activeSessionId:l,activeAppTabId:c}}function ov(t,n){if(t.tabOrder.includes(n))return!1;const{kind:r,id:i}=pr(n);return(r==="app"?t.apps:t.sessions).some(c=>c.id===i)}const iv=1;function av(){let t="";try{t=mn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function $u(t){return Array.isArray(t)&&t.every(n=>typeof n=="string")}function em(t){return t===null||typeof t=="string"}function gw(t){if(t==null)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==iv||!$u(r.openTabs)||!em(r.activeSessionId)||!$u(r.openAppTabs)||!em(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:$u(r.tabOrder)?r.tabOrder:[]}}const lv=[()=>window.sessionStorage,()=>window.localStorage];function vw(){const t=av();for(const n of lv)try{const r=gw(n().getItem(t));if(r)return r}catch{}return null}function yw(t){const n=av(),r=JSON.stringify({v:iv,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId,tabOrder:t.tabOrder});for(const i of lv)try{i().setItem(n,r)}catch{}}function xw(t){return t.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&yw(n)})}function Ni(t){return[...new Set(t)]}function ww(t,n,r,i){const l=v=>r===null||r.has(v),c=Ni(((t==null?void 0:t.openTabs)??[]).filter(v=>n.has(v))),d=Ni(((t==null?void 0:t.openAppTabs)??[]).filter(l));let p=(t==null?void 0:t.activeSessionId)??null;p!==null&&!n.has(p)&&(p=null),p!==null&&!c.includes(p)&&c.push(p),p??(p=c.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;g!==null&&!l(g)&&(g=null),g!==null&&!d.includes(g)&&d.push(g),i!==null&&n.has(i)&&(c.includes(i)||c.push(i),p=i,g=null);const m=rv(Ni((t==null?void 0:t.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:p,openAppTabs:d,activeAppTabId:g,tabOrder:m}}const Fs=new Map,Fd=new Map,Hl=new Map,xl=new Set,Ud=new Map,Vl=new Map;function kw(t,n,r=""){Fs.set(t,n),Fd.set(t,r)}function Sw(t){Fs.delete(t),Fd.delete(t)}function cl(t,n){Hl.set(t,n)}function bw(t,n){n?xl.add(t):xl.delete(t)}function tm(t,n,r){const i=Hl.get(t);if(!i||xl.has(i))return;const l=Fs.get(i);l&&l({source:"agentpane-host",event:n,payload:r})}function nm(t,n){const r=Hl.get(t);if(!r||xl.has(r))return;const i=Fs.get(r);i&&i({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:n}})}function Nw(t,n,r,i,l,c=null){if(typeof l=="string"&&l!==Fd.get(t))return;const d=Fs.get(t);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:i,caller:c}})}function Tw(t,n,r,i){const l=Hl.get(t);if(!l)return;const c=Fs.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:n,itemId:r,delta:i}})}function Cw(t,n){Ud.set(t,n)}function Ew(t){Ud.delete(t)}function jw(t,n){Vl.set(t,n)}function _w(t){Vl.delete(t)}function cv(t,n={}){const r=Vl.get(t);if(r){r(n);return}const i=Fs.get(t);i&&i({source:"agentpane-host",event:"state_changed",payload:{}})}function Rw(){for(const t of new Set([...Fs.keys(),...Vl.keys()]))cv(t)}function Aw(t){var r;const n=Fs.get(t);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Ud.get(t))==null||r()}const Iw=(t,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>t({wsConnected:r}),onTurnCreated:(r,i)=>{t(l=>{const c=l.sessionDetails[r];return!c||i.thread_id?{}:c.turns.some(d=>d.id===i.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...c,turns:[...c.turns,{...i,items:[]}]}}}})},onTurnStarted:(r,i)=>{n().addLogEntry("DEBUG",`turn:started — ${i.slice(0,8)}`),t(l=>{const c=lr(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const p=d.turns.findIndex(g=>g.id===i);return{sessionDetails:{...l.sessionDetails,[r]:{...In(d,i,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&p>=0?p:l.activeTurnIndex}})},onItemStarted:(r,i,l)=>{n().addLogEntry("DEBUG",`item:started — ${l.type}`),t(c=>{const d=sm(l)?ar(c.retryStates,i):c.retryStates,p=c.sessionDetails[r];return p?{sessionDetails:{...c.sessionDetails,[r]:In(p,i,g=>Fu(g,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,i,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:In(d,i,p=>Fu(p,l))}}:{}})},onItemCompleted:(r,i,l)=>{if(n().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const c=l.data||{},d=c.task_type||"unknown",p=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?n().addToast("success",`${m} completed: ${p}`):c.status!=="stopped"&&n().addToast("error",`${m} failed: ${p}`)}t(c=>{const d=sm(l)?ar(c.retryStates,i):c.retryStates,p=c.sessionDetails[r];return p?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:In(p,i,g=>{var v,k;let m=Fu(g,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const y=m.thoughts?m.thoughts+`
|
|
42
|
-
`+l.data.text:l.data.text;m={...m,thoughts:y}}return m})}}:{retryStates:d}})},onItemDelta:(r,i,l,c)=>{Tw(r,i,l,c),t(d=>{const p=ar(d.retryStates,i),g=d.sessionDetails[r];return g?{sessionDetails:{...d.sessionDetails,[r]:In(g,i,m=>Ow(m,l,c))},retryStates:p}:{retryStates:p}})},onWidgetDelta:(r,i,l,c,d)=>{t(p=>{const g=ar(p.retryStates,i),m=p.sessionDetails[r];return m?{sessionDetails:{...p.sessionDetails,[r]:In(m,i,v=>Lw(v,l,c,d))},retryStates:g}:{retryStates:g}})},onTurnCompleted:(r,i,l,c,d)=>{n().dropSignedOutTurn(i);const p=(l==null?void 0:l.input_tokens)??0,g=(l==null?void 0:l.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${p} in / ${g} out`),tm(r,"turn:completed",{sessionId:r,turnId:i,response:d??null}),n().refreshApps(),t(m=>{const v=m.sessionDetails[r],k=v?In(v,i,N=>({...N,status:"completed",token_usage:l??N.token_usage??null,...d&&!N.agent_response?{agent_response:d}:{}})):null,y=zu(k),S=y&&k?Za(k):"active",C=lr(m.sessions,r,N=>({is_running:y,status:S,has_unreviewed:c?1:N.has_unreviewed})),b=ar(m.retryStates,i);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:y,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:C,retryStates:b}:{sessions:C,retryStates:b}})},onTokenUsageUpdated:(r,i,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:In(d,i,p=>({...p,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,i)=>{t(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:i}}}:{}})},onTurnFailed:(r,i,l,c)=>{n().dropSignedOutTurn(i),n().addLogEntry("ERROR",`turn:failed — ${l}`),n().addToast("error",`Turn failed — ${l}`),tm(r,"turn:failed",{sessionId:r,turnId:i,error:l}),t(d=>{const p=d.sessionDetails[r],g=l.includes("cancelled")||l.includes("aborted"),m=g?"aborted":"failed",v=p?In(p,i,b=>({...b,status:m,error:l,...c?{resume_state:c}:{},items:b.items.map(N=>N.status==="in_progress"?{...N,status:"failed"}:N)})):null,k=zu(v),y=k&&v?Za(v):g?"active":"failed",S=lr(d.sessions,r,()=>({is_running:k,status:y})),C=ar(d.retryStates,i);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:y}},sessions:S,retryStates:C}:{sessions:S,retryStates:C}})},onTurnCancelled:(r,i)=>{n().dropSignedOutTurn(i),t(l=>{const c=l.sessionDetails[r],d=c?In(c,i,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(y=>y.status==="in_progress"?{...y,status:"completed"}:y)})):null,p=zu(d),g=p&&d?Za(d):"active",m=lr(l.sessions,r,()=>({is_running:p,status:g})),v=ar(l.retryStates,i);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:p,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,i,l)=>{n().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),n().addToast("warn",Dw(l.reason)),l.reason==="auth"?t(c=>({signedOutTurns:{...c.signedOutTurns,[i]:r}})):n().dropSignedOutTurn(i),t(c=>{const d=c.sessionDetails[r],p=d?In(d,i,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts,resume_at:l.resumeAt??null})):null,g=p?Za(p):"interrupted",m=lr(c.sessions,r,()=>({is_running:1,status:g})),v=ar(c.retryStates,i);return p?{sessionDetails:{...c.sessionDetails,[r]:{...p,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,i,l)=>{n().dropSignedOutTurn(i),n().addLogEntry("INFO",`turn:resuming — ${i.slice(0,8)} (attempt ${l})`),t(c=>{const d=lr(c.sessions,r,()=>({is_running:1,status:"running"})),p=c.sessionDetails[r];return p?{sessionDetails:{...c.sessionDetails,[r]:{...In(p,i,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,i)=>{n().addLogEntry("INFO",`turn:resumed — ${i.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),t(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:In(c,i,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,i,l)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${i.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),t(c=>({retryStates:{...c.retryStates,[i]:l}}))},onSessionTitle:(r,i)=>{t(l=>({sessions:l.sessions.map(c=>c.id===r?{...c,title:i}:c),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:i}}:l.sessionDetails}))},onSessionTouched:r=>{t(i=>{const l=i.sessionDetails[r];return{sessions:lr(i.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...i.sessionDetails,[r]:{...l,user_touched:1}}:i.sessionDetails}})},onSessionUpdated:r=>{const i={...r};delete i.is_running,delete i.status,t(l=>{const c=l.sessionDetails[r.id];return{sessions:lr(l.sessions,r.id,()=>i),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...i}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,i)=>{nm(r,i),t(l=>{if(i.length===0&&!l.backgroundTasks[r])return{};const c={...l.backgroundTasks};return i.length>0?c[r]=i:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>t({signedOutTurns:Object.fromEntries(r.map(i=>[i.turnId,i.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const i={...n().signedOutTurns};delete i[r],t({signedOutTurns:i})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))nm(l,c);const i={};for(const[l,c]of Object.entries(r))c.length>0&&(i[l]=c);t({backgroundTasks:i})}});function Dw(t){switch(t){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";case"auth":return"Claude is signed out — the turn waits until you sign in again";case"usage_limit":return"Usage limit reached — the turn waits until it is over";default:return"The agent host restarted — resuming the turn"}}function Za(t){const n=[...t.turns,...(t.threads??[]).flatMap(r=>r.turns??[])].filter(zs);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function sm(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function ar(t,n){if(!(n in t))return t;const r={...t};return delete r[n],r}function zu(t){return t&&(t.turns.some(zs)||(t.threads??[]).some(r=>(r.turns??[]).some(zs)))?1:0}function lr(t,n,r){return t.some(i=>i.id===n)?t.map(i=>i.id===n?{...i,...r(i)}:i):t}function In(t,n,r){const i=(t.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===n)?{...l,turns:(l.turns??[]).map(c=>c.id===n?r(c):c)}:l);return{...t,turns:t.turns.map(l=>l.id===n?r(l):l),threads:i}}function Bd(t,n){for(let r=t.length-1;r>=0;r--)if(t[r].external_item_id===n)return r;return-1}function Fu(t,n){const r=Bd(t.items,n.external_item_id);if(r>=0){const c=[...t.items];return c[r]=n,{...t,items:c}}if(n.type==="agent_message"){const c=t.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...t,items:[...c,n]}}const i=t.items;let l=i.length;if(t.deferred_item_count)for(;l>0&&i[l-1].created_at>n.created_at;)l--;return{...t,items:[...i.slice(0,l),n,...i.slice(l)]}}function Mw(t,n){const r=c=>c.external_item_id??c.id,i=new Map(t.items.map(c=>[r(c),c])),l=n.map(c=>{var p;const d=i.get(r(c));return i.delete(r(c)),d&&((p=d.data)==null?void 0:p.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...t,items:[...l,...i.values()],deferred_item_count:0,deferred_tool_calls:0}}function Lw(t,n,r,i){var p;const l=new Date().toISOString(),c=Bd(t.items,n);if(c>=0){const g=t.items[c];if(((p=g.data)==null?void 0:p.partial)!==!0||g.data.title===r&&g.data.html===i)return t;const m=[...t.items];return m[c]={...g,data:{...g.data,title:r,html:i},updated_at:l},{...t,items:m}}const d={id:`delta-${n}`,turn_id:t.id,external_item_id:n,type:"widget",data:{title:r,html:i,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...t,items:[...t.items,d]}}function Ow(t,n,r){var c;const i=Bd(t.items,n);if(i>=0){const d=t.items[i],g=(((c=d.data)==null?void 0:c.text)??"")+r,m=[...t.items];return m[i]={...d,data:{...d.data,text:g}},{...t,items:m,agent_response:g}}const l={id:`delta-${n}`,turn_id:t.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,l],agent_response:r}}function Pw(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function $w(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let Uu=0;function rm(t){return t==="sidecar"?"sidecar":"turns"}async function zw(t,n){const r=await Promise.allSettled(t.map(c=>n(c))),i=new Map;let l=null;return r.forEach((c,d)=>{var p;c.status==="fulfilled"?i.set(t[d],c.value):l===null&&(l=((p=c.reason)==null?void 0:p.message)??"Request failed")}),{updated:i,firstError:l}}function Fw(t,n){const r={...t.sessionDetails};n.forEach(g=>delete r[g]);const i={...t.backgroundTasks};n.forEach(g=>delete i[g]);const l=Object.fromEntries(Object.entries(t.signedOutTurns).filter(([,g])=>!n.has(g))),c=t.openTabs.filter(g=>!n.has(g)),d=zd(t,new Set([...n].map($r)));let p=t.activeTurnIndex;if(d.activeSessionId!==t.activeSessionId){const g=d.activeSessionId?r[d.activeSessionId]:null;p=g&&g.turns.length>0?g.turns.length-1:0}return{sessions:t.sessions.filter(g=>!n.has(g.id)),sessionDetails:r,backgroundTasks:i,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:p}}function Uw(t){const n={...t};return delete n.turns,delete n.threads,delete n.contextUsage,n}function om(t,n,r){const i=n().activeSessionId;t(c=>Fw(c,r));const l=n().activeSessionId;l&&l!==i&&n().selectSession(l,{keepAppView:!0})}async function im(t,n,r,i,l){if(r.length===0)return;t({error:null});const{updated:c,firstError:d}=await zw(r,i);c.size>0&&t(g=>({sessions:g.sessions.map(m=>c.get(m.id)??m)}));const p=r.length-c.size;if(p===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{t({error:d});const g=l[0].toUpperCase()+l.slice(1);n().addToast(p===r.length?"error":"warn",`${g} ${c.size} of ${r.length} — ${p} failed`)}}const Bu=new Map,Bw=(t,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=Pw(),i=vw();try{const l=localStorage.getItem("agentpane:last-model-config");l&&t({lastModelConfig:JSON.parse(l)})}catch{}t({loading:!0,error:null});try{const l=n().loadApps(),[c,d,p]=await Promise.all([Y0(),ev(),nv()]);t({sessions:c,workspaces:d,folders:p,loading:!1}),$w();const g=await l,m=ww(i,new Set(c.map(v=>v.id)),g?new Set(n().apps.map(v=>v.id)):null,r.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:Ni([...m.openTabs,...v.openTabs]),openAppTabs:Ni([...m.openAppTabs,...v.openAppTabs]),tabOrder:m.tabOrder,activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!n().activeSessionId&&await n().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(t({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(l){t({loading:!1,error:l.message})}},selectSession:async(r,i)=>{const l=++Uu,c=i!=null&&i.keepAppView?{}:{activeAppTabId:null},d=p=>p.includes(r)?p:[...p,r];if(n().sessionDetails[r]){const p=n().sessionDetails[r];t({activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:rm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),p.has_unreviewed===1&&(Yh(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const p=await mi(r);if(l!==Uu){t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},openTabs:d(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:rm(g.activeRightTab),...c,openTabs:d(g.openTabs),loading:!1})),p.has_unreviewed===1&&(Yh(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})))}catch(p){t(l===Uu?{loading:!1,error:p.message}:{loading:!1})}},closeTab:r=>n().closeTabs([$r(r)]),updateModelConfig:async(r,i,l)=>{const c=n().activeSessionId;if(c){t({error:null});try{const d=await sw(c,r,i,l),p={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};t({lastModelConfig:p}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(p)),t(g=>({sessions:g.sessions.map(m=>m.id===c?d:m),sessionDetails:g.sessionDetails[c]?{...g.sessionDetails,[c]:{...g.sessionDetails[c],model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id}}:g.sessionDetails})),await n().refreshActiveSession()}catch(d){t({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{t({error:null});try{const i=await Pd(r);t(c=>({sessions:[i,...c.sessions],showNewSessionDialog:!1}));const l={provider:i.runtime_type,model:i.model??"",reasoning:i.model_reasoning_effort??""};t({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await n().selectSession(i.id),n().addLogEntry("INFO",`Session created — ${i.id.slice(0,8)}`),n().addToast("success",`Session created — ${i.title||i.id.slice(0,8)}`)}catch(i){t({error:i.message}),n().addToast("error",`Failed to create session — ${i.message}`)}},addSession:r=>{t(i=>({sessions:i.sessions.some(l=>l.id===r.id)?i.sessions:[r,...i.sessions]}))},revealSession:async r=>{let i=n().sessionDetails[r];if(!i){const l=await mi(r);t(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),i=l}n().sessions.some(l=>l.id===r)||n().addSession(Uw(i)),await n().selectSession(r)},deleteSession:async r=>{var l;t({error:null});const i=(l=n().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await Gh(r),om(t,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${i||r.slice(0,8)}" deleted`)}catch(c){t({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,i)=>{t({error:null});try{const l=await tw(r,i.trim());t(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],title:l.title}}:c.sessionDetails}))}catch(l){t({error:l.message}),n().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{t({error:null});try{const i=await qh(r);t(l=>({sessions:l.sessions.map(c=>c.id===r?i:c)})),n().addToast("info","Session marked as finished")}catch(i){t({error:i.message}),n().addToast("error",`Failed to mark as finished — ${i.message}`)}},markFinishedMany:async r=>{await im(t,n,r,qh,"marked as finished")},toggleStar:async r=>{const i=n().sessions.find(l=>l.id===r);if(i){t({error:null});try{const l=await nw(r,i.starred?0:1);t(c=>({sessions:c.sessions.map(d=>d.id===r?l:d),sessionDetails:c.sessionDetails[r]?{...c.sessionDetails,[r]:{...c.sessionDetails[r],starred:l.starred}}:c.sessionDetails}))}catch(l){t({error:l.message}),n().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{t({error:null});try{const i=await Xh(r);t(l=>({sessions:l.sessions.map(c=>c.id===r?i:c)})),n().addToast("info","Session reopened")}catch(i){t({error:i.message}),n().addToast("error",`Failed to reopen session — ${i.message}`)}},reopenSessionMany:async r=>{await im(t,n,r,Xh,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;t({error:null});const i=await Promise.allSettled(r.map(d=>Gh(d))),l=new Set;if(i.forEach((d,p)=>{d.status==="fulfilled"&&l.add(r[p])}),l.size===0){t({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}om(t,n,l),n().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const c=r.length-l.size;c===0?n().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,i)=>{const l=n().activeSessionId;if(l){t({error:null,submittingPrompt:r}),t(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(p=>p.id===l?{...p,is_running:1,status:"running"}:p)}:{}});try{const c=await Jg(l,r,i);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),t(d=>{const p=d.sessionDetails[l];if(!p)return{submittingPrompt:null};const g=p.turns.findIndex(v=>v.id===c.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...p,turns:[...p.turns,m]}},activeTurnIndex:p.turns.length}})}catch(c){t({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),t(d=>{const p=d.sessionDetails[l];if(!p)return{};const g=Wl(p)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...p,is_running:g,status:g?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await Z0(r)}catch(i){t({error:i.message})}},rewindToTurn:async(r,i)=>{t({error:null});try{const l=await ow(r,i),c=await mi(r);t(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(p=>p.id===r?{...p,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:p),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(l){t({error:l.message}),n().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{t({error:null});try{const i=await iw(r),l=await mi(r);t(c=>({sessionDetails:{...c.sessionDetails,[r]:l},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:i.external_thread_id,is_running:0,status:"active"}:d),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),n().addToast("info","Restored rewound session")}catch(i){t({error:i.message}),n().addToast("error",`Failed to restore — ${i.message}`)}},branchFromTurn:async(r,i,l)=>{t({error:null});try{const c=await aw(r,i,l);t(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){t({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const i=n().activeSessionId;if(i){t({error:null});try{const l=await rw(i,JSON.stringify(r));t(c=>({sessions:c.sessions.map(d=>d.id===i?l:d),sessionDetails:c.sessionDetails[i]?{...c.sessionDetails,[i]:{...c.sessionDetails[i],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){t({error:l.message}),n().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const i=await mi(r);t(l=>({sessionDetails:{...l.sessionDetails,[r]:i},activeTurnIndex:i.turns.length>0?Math.min(l.activeTurnIndex,i.turns.length-1):0,sessions:l.sessions.map(c=>c.id===r?{...c,is_running:i.is_running,status:i.status}:c)}))}catch(i){t({error:i.message})}},loadDeferredItems:(r,i)=>{const l=Bu.get(i);if(l)return l;const c=Q0(r,i).then(({items:d})=>(t(p=>{const g=p.sessionDetails[r];return g?{sessionDetails:{...p.sessionDetails,[r]:In(g,i,m=>Mw(m,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Bu.delete(i));return Bu.set(i,c),c}});async function uv(t){const{sessions:n}=await Et(`/claude-sessions?workspace=${encodeURIComponent(t)}`);return n}function Ww(t,n){return at(`/claude-sessions/${encodeURIComponent(t)}/import`,{workspace:n})}const am={available:!0,reason:null};let Wu=null;const Hw=(t,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Wu??(Wu=uw().then(i=>typeof(i==null?void 0:i.available)!="boolean"?am:(t({pickerSupport:i}),i)).catch(()=>am).finally(()=>{Wu=null})),Wu)},createWorkspaceAt:async r=>{const i=await lw(r.trim());return t(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==i.id),i]})),i},addWorkspace:async r=>{t({error:null});try{const i=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${i.path}`),i}catch(i){return n().addToast("error",`Failed to add workspace — ${Pr(i)}`),null}},removeWorkspace:async r=>{t({error:null});try{await cw(r);const i=await ev();t({workspaces:i}),n().addToast("info","Workspace hidden")}catch(i){n().addToast("error",`Failed to hide workspace — ${i.message}`)}},createSessionInWorkspace:async r=>{t({error:null});try{const i=n().lastModelConfig,l=await Pd({cwd:r,runtime_type:(i==null?void 0:i.provider)??"codex",model:i==null?void 0:i.model,model_reasoning_effort:i==null?void 0:i.reasoning});t(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),n().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(i){t({error:i.message}),n().addToast("error",`Failed to create session — ${i.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const i=await tv();if(i.cancelled||!i.path)return;await n().addWorkspace(i.path)}catch(i){n().addToast("error",`Failed to pick directory — ${i.message}`)}},importClaudeSessions:async(r,i)=>{const l=[],c=[];for(const d of[...i].reverse())try{l.unshift(await Ww(d,r))}catch(p){c.unshift({id:d,error:Pr(p)})}return l.length>0&&(t(d=>({sessions:[...l,...d.sessions]})),await n().selectSession(l[0].id),n().addLogEntry("INFO",`Imported ${l.length} Claude Code session(s) into ${r}`),n().addToast("success",l.length===1?`Imported — ${l[0].title||"Claude Code session"}`:`Imported ${l.length} Claude Code sessions`)),{imported:l,failed:c}}});function dv(t,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return Et(`/providers/${encodeURIComponent(t)}/models${r}`)}const lm="curl -fsSL https://repoburg.com/install.sh | bash",Vw=2e3,fv="agentpane:daemon-seen";function Kw(t=mn()){if(!t)return!1;try{const n=new URL(t);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function Gw(t=mn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function qw(){try{return localStorage.getItem(fv)==="true"}catch{return!1}}function Xw(){try{localStorage.setItem(fv,"true")}catch{}}function Yw(t){let n=!1,r=!1,i=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(n||r)return;c(),r=!0;const m=await Gw();if(r=!1,!n){if(m){Xw(),g(),t.onReady();return}i||(i=!0,t.onMissing()),l=setTimeout(()=>void d(),Vw)}}function p(){document.visibilityState==="visible"&&d()}function g(){n=!0,c(),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}return window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),d(),g}const ud=160,dd=480,Qw=240,wl=220,Zw=300,Jw=600,ek=36;function kl(){return typeof window>"u"?Jw:Math.max(wl,Math.round(window.innerWidth*.7))}const cm="agentpane:sidebar-width",um="agentpane:right-panel-width",Hu="agentpane:right-panel-collapsed";function dm(t,n,r,i){try{const l=localStorage.getItem(t);if(l==null)return i;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):i}catch{return i}}function tk(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function fm(t,n){try{localStorage.setItem(t,String(n))}catch{}}const pm=200,nk=(t,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:dm(cm,ud,dd,Qw),rightPanelWidth:dm(um,wl,kl(),Zw),rightPanelCollapsed:tk(Hu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:Kw()?"checking":"ready",setActiveTurnIndex:r=>t({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&fm(Hu,!1),t({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>t({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>t({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>t({importSessionsWorkspace:r}),setShowRemoteModal:r=>t({showRemoteModal:r}),setShowCommandPalette:r=>t({showCommandPalette:r}),setShowModelSelector:r=>t({showModelSelector:r}),setDeepLinkThreadId:r=>t({deepLinkThreadId:r}),setSidebarWidth:r=>{const i=Math.min(dd,Math.max(ud,Math.round(r)));t({sidebarWidth:i});try{localStorage.setItem(cm,String(i))}catch{}},setRightPanelWidth:r=>{const i=Math.min(kl(),Math.max(wl,Math.round(r)));t({rightPanelWidth:i});try{localStorage.setItem(um,String(i))}catch{}},setRightPanelCollapsed:r=>{t({rightPanelCollapsed:r}),fm(Hu,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,i,l)=>t({vscodeState:r,vscodeId:i,vscodeToken:l}),toggleUsageView:()=>t({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>t(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>t({daemonStatus:r}),addToast:(r,i,l,c)=>{const d=Math.random().toString(36).slice(2,9);t(p=>({toasts:[...p.toasts,{id:d,type:r,message:i,undoAction:l,undoLabel:c}]}))},removeToast:r=>{t(i=>({toasts:i.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,i)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(c=>{const d=[...c.eventLog,{time:l,level:r,message:i}];return d.length>pm&&d.splice(0,d.length-pm),{eventLog:d}})},loadModels:async(r,i)=>{if(!n().modelsLoading){t({modelsLoading:!0,models:[]});try{const l=await dv(r,i);t({models:l,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),sk=(t,n)=>({createThread:async(r,i)=>{try{await at(`/sessions/${r}/threads`,i),n().addLogEntry("INFO",`Thread created — "${i.message.slice(0,40)}"`)}catch(l){n().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,i,l)=>{try{await at(`/sessions/${r}/threads/${i}/followup`,{message:l}),n().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(c){n().addToast("error",`Failed to send follow-up — ${c.message}`)}},cancelThreadTurn:async(r,i)=>{try{await at(`/sessions/${r}/cancel?threadId=${encodeURIComponent(i)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(l){n().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,i)=>{try{await ds(`/sessions/${r}/threads/${i}`,{status:"resolved"})}catch(l){n().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,i)=>{try{await ds(`/sessions/${r}/threads/${i}`,{status:"open"})}catch(l){n().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,i,l)=>{try{const c=await at(`/sessions/${r}/threads/${i}/summarize`,{directives:l}),d=`
|
|
43
|
-
[Shared from a resolved discussion thread — summary of its findings]
|
|
44
|
-
|
|
45
|
-
\`\`\`QUOTE
|
|
46
|
-
${c.summary}
|
|
47
|
-
\`\`\`
|
|
48
|
-
|
|
49
|
-
`;return t({quotedText:d}),n().addLogEntry("INFO",`Thread shared to main session — "${c.summary.slice(0,40)}"`),n().addToast("success","Thread summary added to your input"),!0}catch(c){return n().addToast("error",`Failed to share thread — ${c.message}`),!1}},deleteThread:async(r,i)=>{try{await Bl(`/sessions/${r}/threads/${i}`)}catch(l){n().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,i)=>{try{return await at(`/sessions/${r}/sidecar`,{message:i}),n().addLogEntry("INFO",`Sidecar asked — "${i.slice(0,40)}"`),!0}catch(l){return n().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,i,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...i,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,i,l)=>{t(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(p=>p.id===i?{...p,turns:[...p.turns??[],{...l,items:[]}]}:p)}}}:{}})},onThreadResolved:(r,i,l)=>{t(c=>{const d=c.sessionDetails[r];if(!d)return{};const p=(d.threads??[]).map(g=>g.id===i?{...g,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:p}}}})},onThreadDeleted:(r,i)=>{t(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==i)}}}:{}})}}),rk=(t,n)=>({folders:[],loadFolders:async()=>{const r=await nv();t({folders:r})},createSidebarFolder:async(r,i)=>{try{const l=await dw(r,i);return t(c=>({folders:[...c.folders,l]})),l}catch(l){return n().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,i)=>{try{const l=await Zh(r,{name:i});t(c=>({folders:c.folders.map(d=>d.id===r?l:d)}))}catch(l){n().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const i=n().folders,l=n().sessions;t(c=>({folders:c.folders.filter(d=>d.id!==r),sessions:c.sessions.map(d=>d.folder_id===r?{...d,folder_id:null}:d)}));try{await fw(r)}catch(c){t({folders:i,sessions:l}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const i=n().sessions,l=new Map(r.map(c=>[c.id,c]));t(c=>({sessions:c.sessions.map(d=>{const p=l.get(d.id);return p?{...d,folder_id:p.folder_id,sort_order:p.sort_order}:d})}));try{await pw(r)}catch(c){t({sessions:i}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const i=n().folders,l=new Map(r.map((c,d)=>[c,d]));t(c=>({folders:c.folders.map(d=>l.has(d.id)?{...d,sort_order:l.get(d.id)}:d)}));try{await Promise.all(r.map((c,d)=>Zh(c,{sort_order:d})))}catch(c){t({folders:i}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function hm(){return Et("/apps")}function ok(){return Et("/apps/root")}function mm(t){return Et(`/apps/${t}/source`)}function gm(t,n=""){return Et(`/apps/${t}/state?workspace=${encodeURIComponent(n)}`)}function pv(t,n,r=""){return X0(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`,n)}function ik(t){return Bl(`/apps/${t}`)}function ak(t){return Et(`/apps/${t}/sessions`)}async function vm(t,n){try{return await Et(`/apps/${t}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof zi&&r.status===404)return null;throw r}}function lk(t,n,r={}){const i=new URLSearchParams({workspace:n});return r.lifecycle&&i.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&i.set("running",String(r.running)),Et(`/apps/${t}/workspace-sessions?${i}`)}async function ck(t,n,r){try{return await Et(`/apps/${t}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(i){if(i instanceof zi&&i.status===404)return null;throw i}}function uk(t,n){return at(`/apps/${t}/sessions/${encodeURIComponent(n)}/cancel`)}function dk(t,n,r){return ds(`/apps/${t}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function fk(t,n,r,i){const l=await at("/apps/mcp/call",{tool:`${t}__${r}`,args:i,workspace:n});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function pk(){return Et("/apps/examples")}function hk(t){return at(`/apps/examples/${t}/install`,{})}function mk(t){return at("/apps",t)}function gk(t,n){return at("/apps/import",{id:t,files:n})}function vk(t,n,r){return at(`/apps/mcp/calls/${t}/result`,{result:n,error:null})}function yk(t,n){return at(`/apps/${t}/edit-session`,n)}function xk(t,n){return at(`/apps/${t}/files`,n)}async function wk(t,n){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${t}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function kk(t,n){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${t}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const ul=new Set;async function Vu(t,n){ul.add(n),await t().loadApps();const r=t().apps.find(i=>i.id===n);t().openAppTab(n),t().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const fd="agentpane:app-workspaces";function Sk(){try{const t=JSON.parse(localStorage.getItem(fd)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const bk=(t,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:Sk(),loadApps:async()=>{try{const[r,i]=await Promise.all([hm(),ok().catch(()=>null)]);return r.forEach(l=>ul.add(l.id)),t(i?{apps:r,appsRootPath:i.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await hm();for(const i of r)ul.has(i.id)||(ul.add(i.id),n().addToast("success",`New mini app discovered: ${i.title}`));t({apps:r})}catch{}},openAppTab:r=>{t(i=>({activeAppTabId:r,openAppTabs:i.openAppTabs.includes(r)?i.openAppTabs:[...i.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Ri(r)]),setActiveAppTab:r=>t({activeAppTabId:r}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(r,i)=>{t(l=>{const c={...l.appWorkspaces,[r]:i};try{localStorage.setItem(fd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await hk(r),await Vu(n,r),!0}catch(i){return n().addToast("error",`Failed to install app — ${i.message}`),!1}},createSkeletonApp:async r=>{try{return await mk(r),await Vu(n,r.id),!0}catch(i){return n().addToast("error",`Failed to create app — ${i.message}`),!1}},importAppFolder:async(r,i)=>{try{return await gk(r,i),await Vu(n,r),!0}catch(l){return n().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async r=>{try{const i=n().lastModelConfig,l=await yk(r,{runtime_type:i==null?void 0:i.provider,model:(i==null?void 0:i.model)??null,model_reasoning_effort:(i==null?void 0:i.reasoning)??null});n().sessions.some(c=>c.id===l.id)||t(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(i){n().addToast("error",`Failed to open app edit session — ${i.message}`)}},toggleAppPin:async r=>{const i=n().apps.find(l=>l.id===r);if(i)try{await pv(r,{pinned:!i.pinned}),await n().loadApps()}catch(l){n().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await ik(r);const i=n().activeSessionId;t(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(fd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(p=>p.id!==r),openAppTabs:c.openAppTabs.filter(p=>p!==r),...zd(c,new Set([Ri(r)])),appWorkspaces:d}});const l=n().activeSessionId;l&&l!==i&&n().selectSession(l,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(i){n().addToast("error",`Failed to delete app — ${i.message}`)}}}),Nk=(t,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,i)=>{const l=[...n().tabOrder],c=l.indexOf(r),d=l.indexOf(i);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),t({tabOrder:l}))},closeTabs:r=>{const i=n(),l=new Set(r.filter(g=>i.tabOrder.includes(g)));if(l.size===0)return;const c=zd(i,l),d=i.tabOrder.map((g,m)=>({key:g,index:m})).filter(g=>l.has(g.key)).reverse();t({...c,openTabs:i.openTabs.filter(g=>!l.has($r(g))),openAppTabs:i.openAppTabs.filter(g=>!l.has(Ri(g))),tabOrder:i.tabOrder.filter(g=>!l.has(g)),closedTabs:[...i.closedTabs,...d].slice(-20)});const p=c.activeSessionId;p!==null&&p!==i.activeSessionId&&n().selectSession(p,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),i=[...r.closedTabs];let l=i.pop();for(;l&&!ov(r,l.key);)l=i.pop();if(!l){t({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:p}=pr(l.key);d==="app"?(t({closedTabs:i,tabOrder:c,openAppTabs:[...r.openAppTabs,p]}),n().openAppTab(p)):(t({closedTabs:i,tabOrder:c,openTabs:[...r.openTabs,p]}),n().selectSession(p))}}),ym=3e3,Vn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Kn=[];let Sl=0,Wd=0,bl=0,Hd=0,Nl=0,Vd=0,Kd=0;const Ai=new Map,Ii=new Map;let Co=new Map,No=0,Eo=new Map,Ku=!1;function Tl(t,n,r){if(Kn.push({t:Date.now(),cat:t,msg:n,ms:r}),Kn.length>ym){const i=Kn.length-ym;Kn.splice(0,i),Dn=Math.max(0,Dn-i)}}function To(t,n,r){Tl(t,n,r),console.log(`[perf:${t}] ${n}`)}function hv(t){To("note",t)}function mv(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function Tk(t,n){let r=Co.get(t);r||Co.set(t,r={n:0,bytes:0}),r.n++,r.bytes+=n;let i=Ai.get(t);i||Ai.set(t,i={n:0,bytes:0}),i.n++,i.bytes+=n}function Ck(){No++,Kd++}function Ek(t){Eo.set(t,(Eo.get(t)??0)+1),Ii.set(t,(Ii.get(t)??0)+1)}let dl=0;function jk(){dl=performance.now()}function _k(){const t=performance.now(),n=dl?t-dl:null;dl=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-t+n;r>Vn.keypressMs&&To("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const Rk=5e3,gv=500,xm=2e3;let Dn=0,Gu=!1;function Ak(t){return at("/perf-log",{entries:t}).then(()=>{Dn+=t.length})}function Ik(){if(Gu||Dn>=Kn.length)return;const t=Kn.slice(Dn,Dn+gv);t.length!==0&&(Gu=!0,Ak(t).catch(()=>{Kn.length-Dn>xm&&(Dn=Math.max(Dn,Kn.length-xm))}).finally(()=>{Gu=!1}))}function wm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||Dn>=Kn.length)return;const t=Kn.slice(Dn,Dn+gv);if(t.length!==0)try{const n=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,n),Dn+=t.length}catch{}}function Dk(){let t=0;for(const i of Co.values())t+=i.n;const n=[];if(t>0){const i=[...Co.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${mv(c.bytes)})`).join(", ");n.push(`ws ${t}/s [${i}]`)}No>0&&n.push(`store ${No}/s`);const r=[...Eo.entries()].sort((i,l)=>l[1]-i[1]).map(([i,l])=>`${i}×${l}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const i=n.join(" · ");Tl("stat",i);const l=[...Eo.values()].some(c=>c>Vn.renderPerSecLog);(t>Vn.wsPerSecLog||No>Vn.storePerSecLog||l)&&console.log(`[perf:stat] ${i}`)}Co=new Map,No=0,Eo=new Map}function Mk(t){if(t instanceof Element){const n=t.id?`#${t.id}`:"",r=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${n}${r}`}return t?"window":"unknown"}function Lk(){if(Ku||typeof window>"u")return()=>{};Ku=!0,Sl=Date.now();const t=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Vn.lagMs&&(Wd++,bl=Math.max(bl,d),To("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(t.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const p=g=>{const m=g-c;c=g,m>Vn.frameGapMs&&To("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(p)};d=window.requestAnimationFrame(p),t.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var p;for(const g of d.getEntries()){const m=g.duration;if(m<Vn.longtaskBufferMs)continue;Hd++,Nl=Math.max(Nl,m);const v=(p=g.attribution)==null?void 0:p[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",y=`long task ${Math.round(m)}ms (${k})`;m>=Vn.longtaskLogMs?To("longtask",y,m):Tl("longtask",y,m)}});c.observe({type:"longtask",buffered:!1}),t.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const p of d.getEntries()){const g=p.duration,m=p.processingStart-p.startTime;Vd++;const v=`${p.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${Mk(p.target)}`;g>=Vn.eventLogMs?To("input",v,g):Tl("input",v,g)}});c.observe({type:"event",durationThreshold:Vn.eventBufferMs}),t.push(()=>c.disconnect())}catch{}}const i=window.setInterval(Dk,1e3);t.push(()=>window.clearInterval(i)),hv("perf logger session started");const l=window.setInterval(Ik,Rk);return t.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",wm),t.push(()=>window.removeEventListener("beforeunload",wm)),window.__agentPanePerf={dump:vv,reset:yv},()=>{t.forEach(c=>c()),Ku=!1}}function vv(){const t=[],n=Sl?Math.round((Date.now()-Sl)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${n}s · ${Kn.length} buffered entries`),t.push(`event-loop lag: ${Wd} blocks >${Vn.lagMs}ms (max ${Math.round(bl)}ms)`),t.push(`long tasks: ${Hd} ≥${Vn.longtaskBufferMs}ms (max ${Math.round(Nl)}ms)`),t.push(`slow input events (≥${Vn.eventBufferMs}ms): ${Vd}`),t.push(`store updates: ${Kd} total`),Ai.size>0){t.push("ws messages by type (top 15):");for(const[r,i]of[...Ai.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))t.push(` ${r}: ${i.n} msgs, ${mv(i.bytes)}`)}if(Ii.size>0){t.push("render counts by component:");for(const[r,i]of[...Ii.entries()].sort((l,c)=>c[1]-l[1]))t.push(` ${r}: ${i}`)}t.push("--- last 200 entries ---");for(const r of Kn.slice(-200))t.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return t.join(`
|
|
50
|
-
`)}function yv(){Kn.length=0,Dn=0,Sl=Date.now(),Wd=0,bl=0,Hd=0,Nl=0,Vd=0,Kd=0,Ai.clear(),Ii.clear(),Co=new Map,No=0,Eo=new Map}const Lt={start:Lk,note:hv,trackWsEvent:Tk,trackStoreUpdate:Ck,trackRender:Ek,markKeystroke:jk,markInputChange:_k,dump:vv,reset:yv},A=z0()((...t)=>({...Bw(...t),...Hw(...t),...Iw(...t),...nk(...t),...sk(...t),...rk(...t),...bk(...t),...Nk(...t)}));typeof window<"u"&&(A.subscribe(()=>Lt.trackStoreUpdate()),mw(A),xw(A));const Ok="modulepreload",Pk=function(t){return"/"+t},km={},$k=function(n,r,i){let l=Promise.resolve();if(r&&r.length>0){let d=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),g=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));l=d(r.map(m=>{if(m=Pk(m),m in km)return;km[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const y=document.createElement("link");if(y.rel=v?"stylesheet":Ok,v||(y.as="script"),y.crossOrigin="",y.href=m,g&&y.setAttribute("nonce",g),document.head.appendChild(y),v)return new Promise((S,C)=>{y.addEventListener("load",S),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return l.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return n().catch(c)})};function pd(t){switch(t){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function zk(t,n,r=!1,i="working",l=0){if(i==="finished")return"";if(t==="interrupted")return"interrupted";if(n)return"running";if(l>0)return"background";if(r&&t!=="failed")return"queued";switch(t){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function Fk(t,n,r=!1,i="working",l=0){if(i==="finished")return"Finished";if(t==="interrupted")return"Interrupted";if(n)return"Running";if(l>0)return"Background";if(r&&t!=="failed")return"Review Pending";switch(t){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return t}}function Kl(t,n=0){const r=t.is_running===1,i=t.lifecycle==="finished",l=pd(t.runtime_type),c=zk(t.status,r,t.has_unreviewed===1,t.lifecycle,n),d=Fk(t.status,r,t.has_unreviewed===1,t.lifecycle,n);return{dot:c,label:d,dotTitle:c==="background"?`${n} background task${n===1?"":"s"} running`:d,iconClass:l.iconClass,iconText:l.iconText,isRunning:r,isFinished:i,backgroundTaskCount:n}}function Ui(t,n,r=!0){x.useEffect(()=>{if(!r)return;function i(l){t.current&&!t.current.contains(l.target)&&n()}return document.addEventListener("mousedown",i),document.addEventListener("touchstart",i),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("touchstart",i)}},[t,n,r])}function Ao(t,n=!0){x.useEffect(()=>{if(!n)return;function r(i){i.key==="Escape"&&t()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n])}function Gd({status:t,size:n=6,title:r}){return a.jsx("span",{className:`status-dot ${t}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function qd({iconClass:t,iconText:n,size:r=20}){return a.jsx("span",{className:`runtime-icon ${t}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
|
|
51
|
-
* @license lucide-react v0.469.0 - ISC
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the ISC license.
|
|
54
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const Uk=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),xv=(...t)=>t.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();/**
|
|
56
|
-
* @license lucide-react v0.469.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/var Bk={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
61
|
-
* @license lucide-react v0.469.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const wv=x.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:l="",children:c,iconNode:d,...p},g)=>x.createElement("svg",{ref:g,...Bk,width:n,height:n,stroke:t,strokeWidth:i?Number(r)*24/Number(n):r,className:xv("lucide",l),...p},[...d.map(([m,v])=>x.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
|
|
66
|
-
* @license lucide-react v0.469.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const ve=(t,n)=>{const r=x.forwardRef(({className:i,...l},c)=>x.createElement(wv,{ref:c,iconNode:n,className:xv(`lucide-${Uk(t)}`,i),...l}));return r.displayName=`${t}`,r};/**
|
|
71
|
-
* @license lucide-react v0.469.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const Wk=ve("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
76
|
-
* @license lucide-react v0.469.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const Hk=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
81
|
-
* @license lucide-react v0.469.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const kv=ve("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
86
|
-
* @license lucide-react v0.469.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const Vk=ve("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/**
|
|
91
|
-
* @license lucide-react v0.469.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const mr=ve("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
|
96
|
-
* @license lucide-react v0.469.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const Kk=ve("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
101
|
-
* @license lucide-react v0.469.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const Ts=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
106
|
-
* @license lucide-react v0.469.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const jo=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
111
|
-
* @license lucide-react v0.469.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const Di=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
116
|
-
* @license lucide-react v0.469.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const Gl=ve("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
121
|
-
* @license lucide-react v0.469.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const Gk=ve("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
126
|
-
* @license lucide-react v0.469.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const Cl=ve("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
131
|
-
* @license lucide-react v0.469.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const qk=ve("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
136
|
-
* @license lucide-react v0.469.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const Xk=ve("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
141
|
-
* @license lucide-react v0.469.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const Yk=ve("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
146
|
-
* @license lucide-react v0.469.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const Sv=ve("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/**
|
|
151
|
-
* @license lucide-react v0.469.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const Sm=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
|
|
156
|
-
* @license lucide-react v0.469.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const Mi=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
161
|
-
* @license lucide-react v0.469.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const Qk=ve("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
166
|
-
* @license lucide-react v0.469.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const bv=ve("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
171
|
-
* @license lucide-react v0.469.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const Zk=ve("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
|
|
176
|
-
* @license lucide-react v0.469.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const Nv=ve("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
181
|
-
* @license lucide-react v0.469.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const Jk=ve("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
|
|
186
|
-
* @license lucide-react v0.469.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const e1=ve("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
191
|
-
* @license lucide-react v0.469.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const qu=ve("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
196
|
-
* @license lucide-react v0.469.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const El=ve("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
201
|
-
* @license lucide-react v0.469.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const Tv=ve("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
|
206
|
-
* @license lucide-react v0.469.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const Cv=ve("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
211
|
-
* @license lucide-react v0.469.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const Ev=ve("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
|
|
216
|
-
* @license lucide-react v0.469.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const t1=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
221
|
-
* @license lucide-react v0.469.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const n1=ve("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
|
|
226
|
-
* @license lucide-react v0.469.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const s1=ve("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
231
|
-
* @license lucide-react v0.469.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const jv=ve("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
236
|
-
* @license lucide-react v0.469.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const r1=ve("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
241
|
-
* @license lucide-react v0.469.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const o1=ve("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
|
|
246
|
-
* @license lucide-react v0.469.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const i1=ve("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
251
|
-
* @license lucide-react v0.469.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const a1=ve("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
256
|
-
* @license lucide-react v0.469.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const hn=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
261
|
-
* @license lucide-react v0.469.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const l1=ve("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
266
|
-
* @license lucide-react v0.469.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const c1=ve("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
|
|
271
|
-
* @license lucide-react v0.469.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const _v=ve("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
276
|
-
* @license lucide-react v0.469.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const u1=ve("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
281
|
-
* @license lucide-react v0.469.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const bm=ve("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
|
|
286
|
-
* @license lucide-react v0.469.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const d1=ve("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
|
|
291
|
-
* @license lucide-react v0.469.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const f1=ve("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
|
|
296
|
-
* @license lucide-react v0.469.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const p1=ve("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
|
|
301
|
-
* @license lucide-react v0.469.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const h1=ve("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
306
|
-
* @license lucide-react v0.469.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const m1=ve("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
311
|
-
* @license lucide-react v0.469.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const fl=ve("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
|
|
316
|
-
* @license lucide-react v0.469.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const g1=ve("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
321
|
-
* @license lucide-react v0.469.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const v1=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
|
326
|
-
* @license lucide-react v0.469.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const fr=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
331
|
-
* @license lucide-react v0.469.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const Rv=ve("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
336
|
-
* @license lucide-react v0.469.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const Nm=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
341
|
-
* @license lucide-react v0.469.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const y1=ve("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
|
|
346
|
-
* @license lucide-react v0.469.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const Li=ve("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
351
|
-
* @license lucide-react v0.469.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const Av=ve("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
356
|
-
* @license lucide-react v0.469.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const Iv=ve("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/**
|
|
361
|
-
* @license lucide-react v0.469.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const x1=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
366
|
-
* @license lucide-react v0.469.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const Bi=ve("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
371
|
-
* @license lucide-react v0.469.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const w1=ve("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/**
|
|
376
|
-
* @license lucide-react v0.469.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const k1=ve("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
|
381
|
-
* @license lucide-react v0.469.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const Dv=ve("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
386
|
-
* @license lucide-react v0.469.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const Fr=ve("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
391
|
-
* @license lucide-react v0.469.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const jl=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
396
|
-
* @license lucide-react v0.469.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const Mv=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
401
|
-
* @license lucide-react v0.469.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const us=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
406
|
-
* @license lucide-react v0.469.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const ql=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
411
|
-
* @license lucide-react v0.469.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const S1=ve("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
416
|
-
* @license lucide-react v0.469.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const b1=ve("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
421
|
-
* @license lucide-react v0.469.0 - ISC
|
|
422
|
-
*
|
|
423
|
-
* This source code is licensed under the ISC license.
|
|
424
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
-
*/const N1=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
426
|
-
* @license lucide-react v0.469.0 - ISC
|
|
427
|
-
*
|
|
428
|
-
* This source code is licensed under the ISC license.
|
|
429
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
430
|
-
*/const Lv=ve("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
431
|
-
* @license lucide-react v0.469.0 - ISC
|
|
432
|
-
*
|
|
433
|
-
* This source code is licensed under the ISC license.
|
|
434
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/const T1=ve("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
436
|
-
* @license lucide-react v0.469.0 - ISC
|
|
437
|
-
*
|
|
438
|
-
* This source code is licensed under the ISC license.
|
|
439
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/const Nn=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
441
|
-
* @license lucide-react v0.469.0 - ISC
|
|
442
|
-
*
|
|
443
|
-
* This source code is licensed under the ISC license.
|
|
444
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
445
|
-
*/const C1=ve("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),E1=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),j1=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function _1(t){return t.filter(([n])=>E1.has(n)).map(([n,r],i)=>[n,{...Object.fromEntries(Object.entries(r).filter(([l])=>j1.has(l))),key:String(i)}])}function Io({iconNode:t,size:n=14,className:r}){const i=x.useMemo(()=>t?_1(t):[],[t]);return i.length===0?a.jsx(jv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(wv,{iconNode:i,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Si=Vg();function R1(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return x.useMemo(()=>i=>{n.forEach(l=>l(i))},n)}const Xl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Do(t){const n=Object.prototype.toString.call(t);return n==="[object Window]"||n==="[object global]"}function Xd(t){return"nodeType"in t}function Tn(t){var n,r;return t?Do(t)?t:Xd(t)&&(n=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function Yd(t){const{Document:n}=Tn(t);return t instanceof n}function Wi(t){return Do(t)?!1:t instanceof Tn(t).HTMLElement}function Ov(t){return t instanceof Tn(t).SVGElement}function Mo(t){return t?Do(t)?t.document:Xd(t)?Yd(t)?t:Wi(t)||Ov(t)?t.ownerDocument:document:document:document}const fs=Xl?x.useLayoutEffect:x.useEffect;function Yl(t){const n=x.useRef(t);return fs(()=>{n.current=t}),x.useCallback(function(){for(var r=arguments.length,i=new Array(r),l=0;l<r;l++)i[l]=arguments[l];return n.current==null?void 0:n.current(...i)},[])}function A1(){const t=x.useRef(null),n=x.useCallback((i,l)=>{t.current=setInterval(i,l)},[]),r=x.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[n,r]}function Oi(t,n){n===void 0&&(n=[t]);const r=x.useRef(t);return fs(()=>{r.current!==t&&(r.current=t)},n),r}function Hi(t,n){const r=x.useRef();return x.useMemo(()=>{const i=t(r.current);return r.current=i,i},[...n])}function _l(t){const n=Yl(t),r=x.useRef(null),i=x.useCallback(l=>{l!==r.current&&(n==null||n(l,r.current)),r.current=l},[]);return[r,i]}function Rl(t){const n=x.useRef();return x.useEffect(()=>{n.current=t},[t]),n.current}let Xu={};function Vi(t,n){return x.useMemo(()=>{if(n)return n;const r=Xu[t]==null?0:Xu[t]+1;return Xu[t]=r,t+"-"+r},[t,n])}function Pv(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),l=1;l<r;l++)i[l-1]=arguments[l];return i.reduce((c,d)=>{const p=Object.entries(d);for(const[g,m]of p){const v=c[g];v!=null&&(c[g]=v+t*m)}return c},{...n})}}const _o=Pv(1),Al=Pv(-1);function I1(t){return"clientX"in t&&"clientY"in t}function Ql(t){if(!t)return!1;const{KeyboardEvent:n}=Tn(t.target);return n&&t instanceof n}function D1(t){if(!t)return!1;const{TouchEvent:n}=Tn(t.target);return n&&t instanceof n}function Il(t){if(D1(t)){if(t.touches&&t.touches.length){const{clientX:n,clientY:r}=t.touches[0];return{x:n,y:r}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:n,clientY:r}=t.changedTouches[0];return{x:n,y:r}}}return I1(t)?{x:t.clientX,y:t.clientY}:null}const Cs=Object.freeze({Translate:{toString(t){if(!t)return;const{x:n,y:r}=t;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:n,scaleY:r}=t;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[Cs.Translate.toString(t),Cs.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:n,duration:r,easing:i}=t;return n+" "+r+"ms "+i}}}),Tm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function M1(t){return t.matches(Tm)?t:t.querySelector(Tm)}const L1={display:"none"};function O1(t){let{id:n,value:r}=t;return ct.createElement("div",{id:n,style:L1},r)}function P1(t){let{id:n,announcement:r,ariaLiveType:i="assertive"}=t;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ct.createElement("div",{id:n,style:l,role:"status","aria-live":i,"aria-atomic":!0},r)}function $1(){const[t,n]=x.useState("");return{announce:x.useCallback(i=>{i!=null&&n(i)},[]),announcement:t}}const $v=x.createContext(null);function z1(t){const n=x.useContext($v);x.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(t)},[t,n])}function F1(){const[t]=x.useState(()=>new Set),n=x.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[x.useCallback(i=>{let{type:l,event:c}=i;t.forEach(d=>{var p;return(p=d[l])==null?void 0:p.call(d,c)})},[t]),n]}const U1={draggable:`
|
|
446
|
-
To pick up a draggable item, press the space bar.
|
|
447
|
-
While dragging, use the arrow keys to move the item.
|
|
448
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
449
|
-
`},B1={onDragStart(t){let{active:n}=t;return"Picked up draggable item "+n.id+"."},onDragOver(t){let{active:n,over:r}=t;return r?"Draggable item "+n.id+" was moved over droppable area "+r.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(t){let{active:n,over:r}=t;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(t){let{active:n}=t;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function W1(t){let{announcements:n=B1,container:r,hiddenTextDescribedById:i,screenReaderInstructions:l=U1}=t;const{announce:c,announcement:d}=$1(),p=Vi("DndLiveRegion"),[g,m]=x.useState(!1);if(x.useEffect(()=>{m(!0)},[]),z1(x.useMemo(()=>({onDragStart(k){let{active:y}=k;c(n.onDragStart({active:y}))},onDragMove(k){let{active:y,over:S}=k;n.onDragMove&&c(n.onDragMove({active:y,over:S}))},onDragOver(k){let{active:y,over:S}=k;c(n.onDragOver({active:y,over:S}))},onDragEnd(k){let{active:y,over:S}=k;c(n.onDragEnd({active:y,over:S}))},onDragCancel(k){let{active:y,over:S}=k;c(n.onDragCancel({active:y,over:S}))}}),[c,n])),!g)return null;const v=ct.createElement(ct.Fragment,null,ct.createElement(O1,{id:i,value:l.draggable}),ct.createElement(P1,{id:p,announcement:d}));return r?Si.createPortal(v,r):v}var Ht;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ht||(Ht={}));function Dl(){}function zv(t,n){return x.useMemo(()=>({sensor:t,options:n??{}}),[t,n])}function Fv(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return x.useMemo(()=>[...n].filter(i=>i!=null),[...n])}const ps=Object.freeze({x:0,y:0});function H1(t,n){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function V1(t,n){const r=Il(t);if(!r)return"0 0";const i={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return i.x+"% "+i.y+"%"}function K1(t,n){let{data:{value:r}}=t,{data:{value:i}}=n;return r-i}function G1(t,n){let{data:{value:r}}=t,{data:{value:i}}=n;return i-r}function q1(t,n){if(!t||t.length===0)return null;const[r]=t;return r[n]}function Cm(t,n,r){return n===void 0&&(n=t.left),r===void 0&&(r=t.top),{x:n+t.width*.5,y:r+t.height*.5}}const Uv=t=>{let{collisionRect:n,droppableRects:r,droppableContainers:i}=t;const l=Cm(n,n.left,n.top),c=[];for(const d of i){const{id:p}=d,g=r.get(p);if(g){const m=H1(Cm(g),l);c.push({id:p,data:{droppableContainer:d,value:m}})}}return c.sort(K1)};function X1(t,n){const r=Math.max(n.top,t.top),i=Math.max(n.left,t.left),l=Math.min(n.left+n.width,t.left+t.width),c=Math.min(n.top+n.height,t.top+t.height),d=l-i,p=c-r;if(i<l&&r<c){const g=n.width*n.height,m=t.width*t.height,v=d*p,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const Y1=t=>{let{collisionRect:n,droppableRects:r,droppableContainers:i}=t;const l=[];for(const c of i){const{id:d}=c,p=r.get(d);if(p){const g=X1(p,n);g>0&&l.push({id:d,data:{droppableContainer:c,value:g}})}}return l.sort(G1)};function Q1(t,n,r){return{...t,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function Bv(t,n){return t&&n?{x:t.left-n.left,y:t.top-n.top}:ps}function Z1(t){return function(r){for(var i=arguments.length,l=new Array(i>1?i-1:0),c=1;c<i;c++)l[c-1]=arguments[c];return l.reduce((d,p)=>({...d,top:d.top+t*p.y,bottom:d.bottom+t*p.y,left:d.left+t*p.x,right:d.right+t*p.x}),{...r})}}const J1=Z1(1);function Wv(t){if(t.startsWith("matrix3d(")){const n=t.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(t.startsWith("matrix(")){const n=t.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function eS(t,n,r){const i=Wv(n);if(!i)return t;const{scaleX:l,scaleY:c,x:d,y:p}=i,g=t.left-d-(1-l)*parseFloat(r),m=t.top-p-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?t.width/l:t.width,k=c?t.height/c:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const tS={ignoreTransform:!1};function Lo(t,n){n===void 0&&(n=tS);let r=t.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:v}=Tn(t).getComputedStyle(t);m&&(r=eS(r,m,v))}const{top:i,left:l,width:c,height:d,bottom:p,right:g}=r;return{top:i,left:l,width:c,height:d,bottom:p,right:g}}function Em(t){return Lo(t,{ignoreTransform:!0})}function nS(t){const n=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function sS(t,n){return n===void 0&&(n=Tn(t).getComputedStyle(t)),n.position==="fixed"}function rS(t,n){n===void 0&&(n=Tn(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=n[l];return typeof c=="string"?r.test(c):!1})}function Qd(t,n){const r=[];function i(l){if(n!=null&&r.length>=n||!l)return r;if(Yd(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Wi(l)||Ov(l)||r.includes(l))return r;const c=Tn(t).getComputedStyle(l);return l!==t&&rS(l,c)&&r.push(l),sS(l,c)?r:i(l.parentNode)}return t?i(t):r}function Hv(t){const[n]=Qd(t,1);return n??null}function Yu(t){return!Xl||!t?null:Do(t)?t:Xd(t)?Yd(t)||t===Mo(t).scrollingElement?window:Wi(t)?t:null:null}function Vv(t){return Do(t)?t.scrollX:t.scrollLeft}function Kv(t){return Do(t)?t.scrollY:t.scrollTop}function hd(t){return{x:Vv(t),y:Kv(t)}}var en;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(en||(en={}));function Gv(t){return!Xl||!t?!1:t===document.scrollingElement}function qv(t){const n={x:0,y:0},r=Gv(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},i={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},l=t.scrollTop<=n.y,c=t.scrollLeft<=n.x,d=t.scrollTop>=i.y,p=t.scrollLeft>=i.x;return{isTop:l,isLeft:c,isBottom:d,isRight:p,maxScroll:i,minScroll:n}}const oS={x:.2,y:.2};function iS(t,n,r,i,l){let{top:c,left:d,right:p,bottom:g}=r;i===void 0&&(i=10),l===void 0&&(l=oS);const{isTop:m,isBottom:v,isLeft:k,isRight:y}=qv(t),S={x:0,y:0},C={x:0,y:0},b={height:n.height*l.y,width:n.width*l.x};return!m&&c<=n.top+b.height?(S.y=en.Backward,C.y=i*Math.abs((n.top+b.height-c)/b.height)):!v&&g>=n.bottom-b.height&&(S.y=en.Forward,C.y=i*Math.abs((n.bottom-b.height-g)/b.height)),!y&&p>=n.right-b.width?(S.x=en.Forward,C.x=i*Math.abs((n.right-b.width-p)/b.width)):!k&&d<=n.left+b.width&&(S.x=en.Backward,C.x=i*Math.abs((n.left+b.width-d)/b.width)),{direction:S,speed:C}}function aS(t){if(t===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:n,left:r,right:i,bottom:l}=t.getBoundingClientRect();return{top:n,left:r,right:i,bottom:l,width:t.clientWidth,height:t.clientHeight}}function Xv(t){return t.reduce((n,r)=>_o(n,hd(r)),ps)}function lS(t){return t.reduce((n,r)=>n+Vv(r),0)}function cS(t){return t.reduce((n,r)=>n+Kv(r),0)}function Yv(t,n){if(n===void 0&&(n=Lo),!t)return;const{top:r,left:i,bottom:l,right:c}=n(t);Hv(t)&&(l<=0||c<=0||r>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const uS=[["x",["left","right"],lS],["y",["top","bottom"],cS]];class Zd{constructor(n,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Qd(r),l=Xv(i);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,p]of uS)for(const g of d)Object.defineProperty(this,g,{get:()=>{const m=p(i),v=l[c]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ti{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=n}add(n,r,i){var l;(l=this.target)==null||l.addEventListener(n,r,i),this.listeners.push([n,r,i])}}function dS(t){const{EventTarget:n}=Tn(t);return t instanceof n?t:Mo(t)}function Qu(t,n){const r=Math.abs(t.x),i=Math.abs(t.y);return typeof n=="number"?Math.sqrt(r**2+i**2)>n:"x"in n&&"y"in n?r>n.x&&i>n.y:"x"in n?r>n.x:"y"in n?i>n.y:!1}var es;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(es||(es={}));function jm(t){t.preventDefault()}function fS(t){t.stopPropagation()}var nt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(nt||(nt={}));const Qv={start:[nt.Space,nt.Enter],cancel:[nt.Esc],end:[nt.Space,nt.Enter,nt.Tab]},pS=(t,n)=>{let{currentCoordinates:r}=n;switch(t.code){case nt.Right:return{...r,x:r.x+25};case nt.Left:return{...r,x:r.x-25};case nt.Down:return{...r,y:r.y+25};case nt.Up:return{...r,y:r.y-25}}};class Zv{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:r}}=n;this.props=n,this.listeners=new Ti(Mo(r)),this.windowListeners=new Ti(Tn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:r}=this.props,i=n.node.current;i&&Yv(i),r(ps)}handleKeyDown(n){if(Ql(n)){const{active:r,context:i,options:l}=this.props,{keyboardCodes:c=Qv,coordinateGetter:d=pS,scrollBehavior:p="smooth"}=l,{code:g}=n;if(c.end.includes(g)){this.handleEnd(n);return}if(c.cancel.includes(g)){this.handleCancel(n);return}const{collisionRect:m}=i.current,v=m?{x:m.left,y:m.top}:ps;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:i.current,currentCoordinates:v});if(k){const y=Al(k,v),S={x:0,y:0},{scrollableAncestors:C}=i.current;for(const b of C){const N=n.code,{isTop:E,isRight:R,isLeft:z,isBottom:I,maxScroll:L,minScroll:q}=qv(b),K=aS(b),$={x:Math.min(N===nt.Right?K.right-K.width/2:K.right,Math.max(N===nt.Right?K.left:K.left+K.width/2,k.x)),y:Math.min(N===nt.Down?K.bottom-K.height/2:K.bottom,Math.max(N===nt.Down?K.top:K.top+K.height/2,k.y))},Z=N===nt.Right&&!R||N===nt.Left&&!z,he=N===nt.Down&&!I||N===nt.Up&&!E;if(Z&&$.x!==k.x){const ce=b.scrollLeft+y.x,ye=N===nt.Right&&ce<=L.x||N===nt.Left&&ce>=q.x;if(ye&&!y.y){b.scrollTo({left:ce,behavior:p});return}ye?S.x=b.scrollLeft-ce:S.x=N===nt.Right?b.scrollLeft-L.x:b.scrollLeft-q.x,S.x&&b.scrollBy({left:-S.x,behavior:p});break}else if(he&&$.y!==k.y){const ce=b.scrollTop+y.y,ye=N===nt.Down&&ce<=L.y||N===nt.Up&&ce>=q.y;if(ye&&!y.x){b.scrollTo({top:ce,behavior:p});return}ye?S.y=b.scrollTop-ce:S.y=N===nt.Down?b.scrollTop-L.y:b.scrollTop-q.y,S.y&&b.scrollBy({top:-S.y,behavior:p});break}}this.handleMove(n,_o(Al(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:i}=this.props;n.preventDefault(),i(r)}handleEnd(n){const{onEnd:r}=this.props;n.preventDefault(),this.detach(),r()}handleCancel(n){const{onCancel:r}=this.props;n.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Zv.activators=[{eventName:"onKeyDown",handler:(t,n,r)=>{let{keyboardCodes:i=Qv,onActivation:l}=n,{active:c}=r;const{code:d}=t.nativeEvent;if(i.start.includes(d)){const p=c.activatorNode.current;return p&&t.target!==p?!1:(t.preventDefault(),l==null||l({event:t.nativeEvent}),!0)}return!1}}];function _m(t){return!!(t&&"distance"in t)}function Rm(t){return!!(t&&"delay"in t)}class Jd{constructor(n,r,i){var l;i===void 0&&(i=dS(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=r;const{event:c}=n,{target:d}=c;this.props=n,this.events=r,this.document=Mo(d),this.documentListeners=new Ti(this.document),this.listeners=new Ti(i),this.windowListeners=new Ti(Tn(d)),this.initialCoordinates=(l=Il(c))!=null?l:ps,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,jm),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,jm),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Rm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(_m(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,r){const{active:i,onPending:l}=this.props;l(i,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(es.Click,fS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:i,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!l)return;const g=(r=Il(n))!=null?r:ps,m=Al(l,g);if(!i&&p){if(_m(p)){if(p.tolerance!=null&&Qu(m,p.tolerance))return this.handleCancel();if(Qu(m,p.distance))return this.handleStart()}if(Rm(p)&&Qu(m,p.tolerance))return this.handleCancel();this.handlePending(p,m);return}n.cancelable&&n.preventDefault(),d(g)}handleEnd(){const{onAbort:n,onEnd:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleCancel(){const{onAbort:n,onCancel:r}=this.props;this.detach(),this.activated||n(this.props.active),r()}handleKeydown(n){n.code===nt.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const hS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Zl extends Jd{constructor(n){const{event:r}=n,i=Mo(r.target);super(n,hS,i)}}Zl.activators=[{eventName:"onPointerDown",handler:(t,n)=>{let{nativeEvent:r}=t,{onActivation:i}=n;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const mS={move:{name:"mousemove"},end:{name:"mouseup"}};var md;(function(t){t[t.RightClick=2]="RightClick"})(md||(md={}));class gS extends Jd{constructor(n){super(n,mS,Mo(n.event.target))}}gS.activators=[{eventName:"onMouseDown",handler:(t,n)=>{let{nativeEvent:r}=t,{onActivation:i}=n;return r.button===md.RightClick?!1:(i==null||i({event:r}),!0)}}];const Zu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class vS extends Jd{constructor(n){super(n,Zu)}static setup(){return window.addEventListener(Zu.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(Zu.move.name,n)};function n(){}}}vS.activators=[{eventName:"onTouchStart",handler:(t,n)=>{let{nativeEvent:r}=t,{onActivation:i}=n;const{touches:l}=r;return l.length>1?!1:(i==null||i({event:r}),!0)}}];var Ci;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Ci||(Ci={}));var Ml;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ml||(Ml={}));function yS(t){let{acceleration:n,activator:r=Ci.Pointer,canScroll:i,draggingRect:l,enabled:c,interval:d=5,order:p=Ml.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:y}=t;const S=wS({delta:k,disabled:!c}),[C,b]=A1(),N=x.useRef({x:0,y:0}),E=x.useRef({x:0,y:0}),R=x.useMemo(()=>{switch(r){case Ci.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case Ci.DraggableRect:return l}},[r,l,g]),z=x.useRef(null),I=x.useCallback(()=>{const q=z.current;if(!q)return;const K=N.current.x*E.current.x,$=N.current.y*E.current.y;q.scrollBy(K,$)},[]),L=x.useMemo(()=>p===Ml.TreeOrder?[...m].reverse():m,[p,m]);x.useEffect(()=>{if(!c||!m.length||!R){b();return}for(const q of L){if((i==null?void 0:i(q))===!1)continue;const K=m.indexOf(q),$=v[K];if(!$)continue;const{direction:Z,speed:he}=iS(q,$,R,n,y);for(const ce of["x","y"])S[ce][Z[ce]]||(he[ce]=0,Z[ce]=0);if(he.x>0||he.y>0){b(),z.current=q,C(I,d),N.current=he,E.current=Z;return}}N.current={x:0,y:0},E.current={x:0,y:0},b()},[n,I,i,b,c,d,JSON.stringify(R),JSON.stringify(S),C,m,L,v,JSON.stringify(y)])}const xS={x:{[en.Backward]:!1,[en.Forward]:!1},y:{[en.Backward]:!1,[en.Forward]:!1}};function wS(t){let{delta:n,disabled:r}=t;const i=Rl(n);return Hi(l=>{if(r||!i||!l)return xS;const c={x:Math.sign(n.x-i.x),y:Math.sign(n.y-i.y)};return{x:{[en.Backward]:l.x[en.Backward]||c.x===-1,[en.Forward]:l.x[en.Forward]||c.x===1},y:{[en.Backward]:l.y[en.Backward]||c.y===-1,[en.Forward]:l.y[en.Forward]||c.y===1}}},[r,n,i])}function kS(t,n){const r=n!=null?t.get(n):void 0,i=r?r.node.current:null;return Hi(l=>{var c;return n==null?null:(c=i??l)!=null?c:null},[i,n])}function SS(t,n){return x.useMemo(()=>t.reduce((r,i)=>{const{sensor:l}=i,c=l.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,i)}));return[...r,...c]},[]),[t,n])}var Pi;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Pi||(Pi={}));var gd;(function(t){t.Optimized="optimized"})(gd||(gd={}));const Am=new Map;function bS(t,n){let{dragging:r,dependencies:i,config:l}=n;const[c,d]=x.useState(null),{frequency:p,measure:g,strategy:m}=l,v=x.useRef(t),k=N(),y=Oi(k),S=x.useCallback(function(E){E===void 0&&(E=[]),!y.current&&d(R=>R===null?E:R.concat(E.filter(z=>!R.includes(z))))},[y]),C=x.useRef(null),b=Hi(E=>{if(k&&!r)return Am;if(!E||E===Am||v.current!==t||c!=null){const R=new Map;for(let z of t){if(!z)continue;if(c&&c.length>0&&!c.includes(z.id)&&z.rect.current){R.set(z.id,z.rect.current);continue}const I=z.node.current,L=I?new Zd(g(I),I):null;z.rect.current=L,L&&R.set(z.id,L)}return R}return E},[t,c,r,k,g]);return x.useEffect(()=>{v.current=t},[t]),x.useEffect(()=>{k||S()},[r,k]),x.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),x.useEffect(()=>{k||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{S(),C.current=null},p))},[p,k,S,...i]),{droppableRects:b,measureDroppableContainers:S,measuringScheduled:c!=null};function N(){switch(m){case Pi.Always:return!1;case Pi.BeforeDragging:return r;default:return!r}}}function ef(t,n){return Hi(r=>t?r||(typeof n=="function"?n(t):t):null,[n,t])}function NS(t,n){return ef(t,n)}function TS(t){let{callback:n,disabled:r}=t;const i=Yl(n),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(i)},[i,r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Jl(t){let{callback:n,disabled:r}=t;const i=Yl(n),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(i)},[r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function CS(t){return new Zd(Lo(t),t)}function Im(t,n,r){n===void 0&&(n=CS);const[i,l]=x.useState(null);function c(){l(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??r)!=null?m:null}const v=n(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const d=TS({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){c();break}}}}),p=Jl({callback:c});return fs(()=>{c(),t?(p==null||p.observe(t),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(p==null||p.disconnect(),d==null||d.disconnect())},[t]),i}function ES(t){const n=ef(t);return Bv(t,n)}const Dm=[];function jS(t){const n=x.useRef(t),r=Hi(i=>t?i&&i!==Dm&&t&&n.current&&t.parentNode===n.current.parentNode?i:Qd(t):Dm,[t]);return x.useEffect(()=>{n.current=t},[t]),r}function _S(t){const[n,r]=x.useState(null),i=x.useRef(t),l=x.useCallback(c=>{const d=Yu(c.target);d&&r(p=>p?(p.set(d,hd(d)),new Map(p)):null)},[]);return x.useEffect(()=>{const c=i.current;if(t!==c){d(c);const p=t.map(g=>{const m=Yu(g);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,hd(m)]):null}).filter(g=>g!=null);r(p.length?new Map(p):null),i.current=t}return()=>{d(t),d(c)};function d(p){p.forEach(g=>{const m=Yu(g);m==null||m.removeEventListener("scroll",l)})}},[l,t]),x.useMemo(()=>t.length?n?Array.from(n.values()).reduce((c,d)=>_o(c,d),ps):Xv(t):ps,[t,n])}function Mm(t,n){n===void 0&&(n=[]);const r=x.useRef(null);return x.useEffect(()=>{r.current=null},n),x.useEffect(()=>{const i=t!==ps;i&&!r.current&&(r.current=t),!i&&r.current&&(r.current=null)},[t]),r.current?Al(t,r.current):ps}function RS(t){x.useEffect(()=>{if(!Xl)return;const n=t.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of n)r==null||r()}},t.map(n=>{let{sensor:r}=n;return r}))}function AS(t,n){return x.useMemo(()=>t.reduce((r,i)=>{let{eventName:l,handler:c}=i;return r[l]=d=>{c(d,n)},r},{}),[t,n])}function Jv(t){return x.useMemo(()=>t?nS(t):null,[t])}const Lm=[];function IS(t,n){n===void 0&&(n=Lo);const[r]=t,i=Jv(r?Tn(r):null),[l,c]=x.useState(Lm);function d(){c(()=>t.length?t.map(g=>Gv(g)?i:new Zd(n(g),g)):Lm)}const p=Jl({callback:d});return fs(()=>{p==null||p.disconnect(),d(),t.forEach(g=>p==null?void 0:p.observe(g))},[t]),l}function ey(t){if(!t)return null;if(t.children.length>1)return t;const n=t.children[0];return Wi(n)?n:t}function DS(t){let{measure:n}=t;const[r,i]=x.useState(null),l=x.useCallback(m=>{for(const{target:v}of m)if(Wi(v)){i(k=>{const y=n(v);return k?{...k,width:y.width,height:y.height}:y});break}},[n]),c=Jl({callback:l}),d=x.useCallback(m=>{const v=ey(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),i(v?n(v):null)},[n,c]),[p,g]=_l(d);return x.useMemo(()=>({nodeRef:p,rect:r,setRef:g}),[r,p,g])}const MS=[{sensor:Zl,options:{}},{sensor:Zv,options:{}}],LS={current:{}},pl={draggable:{measure:Em},droppable:{measure:Em,strategy:Pi.WhileDragging,frequency:gd.Optimized},dragOverlay:{measure:Lo}};class Ei extends Map{get(n){var r;return n!=null&&(r=super.get(n))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:r}=n;return!r})}getNodeFor(n){var r,i;return(r=(i=this.get(n))==null?void 0:i.node.current)!=null?r:void 0}}const OS={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ei,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Dl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pl,measureDroppableContainers:Dl,windowRect:null,measuringScheduled:!1},ty={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Dl,draggableNodes:new Map,over:null,measureDroppableContainers:Dl},Ki=x.createContext(ty),ny=x.createContext(OS);function PS(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ei}}}function $S(t,n){switch(n.type){case Ht.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Ht.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:n.coordinates.x-t.draggable.initialCoordinates.x,y:n.coordinates.y-t.draggable.initialCoordinates.y}}};case Ht.DragEnd:case Ht.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ht.RegisterDroppable:{const{element:r}=n,{id:i}=r,l=new Ei(t.droppable.containers);return l.set(i,r),{...t,droppable:{...t.droppable,containers:l}}}case Ht.SetDroppableDisabled:{const{id:r,key:i,disabled:l}=n,c=t.droppable.containers.get(r);if(!c||i!==c.key)return t;const d=new Ei(t.droppable.containers);return d.set(r,{...c,disabled:l}),{...t,droppable:{...t.droppable,containers:d}}}case Ht.UnregisterDroppable:{const{id:r,key:i}=n,l=t.droppable.containers.get(r);if(!l||i!==l.key)return t;const c=new Ei(t.droppable.containers);return c.delete(r),{...t,droppable:{...t.droppable,containers:c}}}default:return t}}function zS(t){let{disabled:n}=t;const{active:r,activatorEvent:i,draggableNodes:l}=x.useContext(Ki),c=Rl(i),d=Rl(r==null?void 0:r.id);return x.useEffect(()=>{if(!n&&!i&&c&&d!=null){if(!Ql(c)||document.activeElement===c.target)return;const p=l.get(d);if(!p)return;const{activatorNode:g,node:m}=p;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=M1(v);if(k){k.focus();break}}})}},[i,n,l,d,c]),null}function sy(t,n){let{transform:r,...i}=n;return t!=null&&t.length?t.reduce((l,c)=>c({transform:l,...i}),r):r}function FS(t){return x.useMemo(()=>({draggable:{...pl.draggable,...t==null?void 0:t.draggable},droppable:{...pl.droppable,...t==null?void 0:t.droppable},dragOverlay:{...pl.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function US(t){let{activeNode:n,measure:r,initialRect:i,config:l=!0}=t;const c=x.useRef(!1),{x:d,y:p}=typeof l=="boolean"?{x:l,y:l}:l;fs(()=>{if(!d&&!p||!n){c.current=!1;return}if(c.current||!i)return;const m=n==null?void 0:n.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=Bv(v,i);if(d||(k.x=0),p||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const y=Hv(m);y&&y.scrollBy({top:k.y,left:k.x})}},[n,d,p,i,r])}const ec=x.createContext({...ps,scaleX:1,scaleY:1});var ur;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(ur||(ur={}));const ry=x.memo(function(n){var r,i,l,c;let{id:d,accessibility:p,autoScroll:g=!0,children:m,sensors:v=MS,collisionDetection:k=Y1,measuring:y,modifiers:S,...C}=n;const b=x.useReducer($S,void 0,PS),[N,E]=b,[R,z]=F1(),[I,L]=x.useState(ur.Uninitialized),q=I===ur.Initialized,{draggable:{active:K,nodes:$,translate:Z},droppable:{containers:he}}=N,ce=K!=null?$.get(K):null,ye=x.useRef({initial:null,translated:null}),Se=x.useMemo(()=>{var Ze;return K!=null?{id:K,data:(Ze=ce==null?void 0:ce.data)!=null?Ze:LS,rect:ye}:null},[K,ce]),Oe=x.useRef(null),[J,re]=x.useState(null),[oe,F]=x.useState(null),Q=Oi(C,Object.values(C)),G=Vi("DndDescribedBy",d),D=x.useMemo(()=>he.getEnabled(),[he]),P=FS(y),{droppableRects:le,measureDroppableContainers:W,measuringScheduled:X}=bS(D,{dragging:q,dependencies:[Z.x,Z.y],config:P.droppable}),ae=kS($,K),be=x.useMemo(()=>oe?Il(oe):null,[oe]),_e=vn(),Ae=NS(ae,P.draggable.measure);US({activeNode:K!=null?$.get(K):null,config:_e.layoutShiftCompensation,initialRect:Ae,measure:P.draggable.measure});const je=Im(ae,P.draggable.measure,Ae),me=Im(ae?ae.parentElement:null),pe=x.useRef({activatorEvent:null,active:null,activeNode:ae,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:he,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ve=he.getNodeFor((r=pe.current.over)==null?void 0:r.id),Ie=DS({measure:P.dragOverlay.measure}),mt=(i=Ie.nodeRef.current)!=null?i:ae,Ue=q?(l=Ie.rect)!=null?l:je:null,Vt=!!(Ie.nodeRef.current&&Ie.rect),tn=ES(Vt?null:je),kt=Jv(mt?Tn(mt):null),jt=jS(q?Ve??ae:null),Ft=IS(jt),Ot=sy(S,{transform:{x:Z.x-tn.x,y:Z.y-tn.y,scaleX:1,scaleY:1},activatorEvent:oe,active:Se,activeNodeRect:je,containerNodeRect:me,draggingNodeRect:Ue,over:pe.current.over,overlayNodeRect:Ie.rect,scrollableAncestors:jt,scrollableAncestorRects:Ft,windowRect:kt}),Y=be?_o(be,Z):null,ge=_S(jt),Be=Mm(ge),st=Mm(ge,[je]),gt=_o(Ot,Be),vt=Ue?J1(Ue,Ot):null,_t=Se&&vt?k({active:Se,collisionRect:vt,droppableRects:le,droppableContainers:D,pointerCoordinates:Y}):null,an=q1(_t,"id"),[dt,Mn]=x.useState(null),Ln=Vt?Ot:_o(Ot,st),hs=Q1(Ln,(c=dt==null?void 0:dt.rect)!=null?c:null,je),ms=x.useRef(null),ns=x.useCallback((Ze,Rt)=>{let{sensor:ft,options:Gt}=Rt;if(Oe.current==null)return;const yt=$.get(Oe.current);if(!yt)return;const xt=Ze.nativeEvent,lt=new ft({active:Oe.current,activeNode:yt,event:xt,options:Gt,context:pe,onAbort(ot){if(!$.get(ot))return;const{onDragAbort:_}=Q.current,fe={id:ot};_==null||_(fe),R({type:"onDragAbort",event:fe})},onPending(ot,Pt,_,fe){if(!$.get(ot))return;const{onDragPending:we}=Q.current,Pe={id:ot,constraint:Pt,initialCoordinates:_,offset:fe};we==null||we(Pe),R({type:"onDragPending",event:Pe})},onStart(ot){const Pt=Oe.current;if(Pt==null)return;const _=$.get(Pt);if(!_)return;const{onDragStart:fe}=Q.current,ie={activatorEvent:xt,active:{id:Pt,data:_.data,rect:ye}};Si.unstable_batchedUpdates(()=>{fe==null||fe(ie),L(ur.Initializing),E({type:Ht.DragStart,initialCoordinates:ot,active:Pt}),R({type:"onDragStart",event:ie}),re(ms.current),F(xt)})},onMove(ot){E({type:Ht.DragMove,coordinates:ot})},onEnd:qt(Ht.DragEnd),onCancel:qt(Ht.DragCancel)});ms.current=lt;function qt(ot){return async function(){const{active:_,collisions:fe,over:ie,scrollAdjustedTranslate:we}=pe.current;let Pe=null;if(_&&we){const{cancelDrop:qe}=Q.current;Pe={activatorEvent:xt,active:_,collisions:fe,delta:we,over:ie},ot===Ht.DragEnd&&typeof qe=="function"&&await Promise.resolve(qe(Pe))&&(ot=Ht.DragCancel)}Oe.current=null,Si.unstable_batchedUpdates(()=>{E({type:ot}),L(ur.Uninitialized),Mn(null),re(null),F(null),ms.current=null;const qe=ot===Ht.DragEnd?"onDragEnd":"onDragCancel";if(Pe){const $e=Q.current[qe];$e==null||$e(Pe),R({type:qe,event:Pe})}})}}},[$]),On=x.useCallback((Ze,Rt)=>(ft,Gt)=>{const yt=ft.nativeEvent,xt=$.get(Gt);if(Oe.current!==null||!xt||yt.dndKit||yt.defaultPrevented)return;const lt={active:xt};Ze(ft,Rt.options,lt)===!0&&(yt.dndKit={capturedBy:Rt.sensor},Oe.current=Gt,ns(ft,Rt))},[$,ns]),gn=SS(v,On);RS(v),fs(()=>{je&&I===ur.Initializing&&L(ur.Initialized)},[je,I]),x.useEffect(()=>{const{onDragMove:Ze}=Q.current,{active:Rt,activatorEvent:ft,collisions:Gt,over:yt}=pe.current;if(!Rt||!ft)return;const xt={active:Rt,activatorEvent:ft,collisions:Gt,delta:{x:gt.x,y:gt.y},over:yt};Si.unstable_batchedUpdates(()=>{Ze==null||Ze(xt),R({type:"onDragMove",event:xt})})},[gt.x,gt.y]),x.useEffect(()=>{const{active:Ze,activatorEvent:Rt,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:yt}=pe.current;if(!Ze||Oe.current==null||!Rt||!yt)return;const{onDragOver:xt}=Q.current,lt=Gt.get(an),qt=lt&<.rect.current?{id:lt.id,rect:lt.rect.current,data:lt.data,disabled:lt.disabled}:null,ot={active:Ze,activatorEvent:Rt,collisions:ft,delta:{x:yt.x,y:yt.y},over:qt};Si.unstable_batchedUpdates(()=>{Mn(qt),xt==null||xt(ot),R({type:"onDragOver",event:ot})})},[an]),fs(()=>{pe.current={activatorEvent:oe,active:Se,activeNode:ae,collisionRect:vt,collisions:_t,droppableRects:le,draggableNodes:$,draggingNode:mt,draggingNodeRect:Ue,droppableContainers:he,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:gt},ye.current={initial:Ue,translated:vt}},[Se,ae,_t,vt,$,mt,Ue,le,he,dt,jt,gt]),yS({..._e,delta:Z,draggingRect:vt,pointerCoordinates:Y,scrollableAncestors:jt,scrollableAncestorRects:Ft});const ln=x.useMemo(()=>({active:Se,activeNode:ae,activeNodeRect:je,activatorEvent:oe,collisions:_t,containerNodeRect:me,dragOverlay:Ie,draggableNodes:$,droppableContainers:he,droppableRects:le,over:dt,measureDroppableContainers:W,scrollableAncestors:jt,scrollableAncestorRects:Ft,measuringConfiguration:P,measuringScheduled:X,windowRect:kt}),[Se,ae,je,oe,_t,me,Ie,$,he,le,dt,W,jt,Ft,P,X,kt]),Kt=x.useMemo(()=>({activatorEvent:oe,activators:gn,active:Se,activeNodeRect:je,ariaDescribedById:{draggable:G},dispatch:E,draggableNodes:$,over:dt,measureDroppableContainers:W}),[oe,gn,Se,je,E,G,$,dt,W]);return ct.createElement($v.Provider,{value:z},ct.createElement(Ki.Provider,{value:Kt},ct.createElement(ny.Provider,{value:ln},ct.createElement(ec.Provider,{value:hs},m)),ct.createElement(zS,{disabled:(p==null?void 0:p.restoreFocus)===!1})),ct.createElement(W1,{...p,hiddenTextDescribedById:G}));function vn(){const Ze=(J==null?void 0:J.autoScrollEnabled)===!1,Rt=typeof g=="object"?g.enabled===!1:g===!1,ft=q&&!Ze&&!Rt;return typeof g=="object"?{...g,enabled:ft}:{enabled:ft}}}),BS=x.createContext(null),Om="button",WS="Draggable";function HS(t){let{id:n,data:r,disabled:i=!1,attributes:l}=t;const c=Vi(WS),{activators:d,activatorEvent:p,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:y}=x.useContext(Ki),{role:S=Om,roleDescription:C="draggable",tabIndex:b=0}=l??{},N=(g==null?void 0:g.id)===n,E=x.useContext(N?ec:BS),[R,z]=_l(),[I,L]=_l(),q=AS(d,n),K=Oi(r);fs(()=>(k.set(n,{id:n,key:c,node:R,activatorNode:I,data:K}),()=>{const Z=k.get(n);Z&&Z.key===c&&k.delete(n)}),[k,n]);const $=x.useMemo(()=>({role:S,tabIndex:b,"aria-disabled":i,"aria-pressed":N&&S===Om?!0:void 0,"aria-roledescription":C,"aria-describedby":v.draggable}),[i,S,b,N,C,v.draggable]);return{active:g,activatorEvent:p,activeNodeRect:m,attributes:$,isDragging:N,listeners:i?void 0:q,node:R,over:y,setNodeRef:z,setActivatorNodeRef:L,transform:E}}function oy(){return x.useContext(ny)}const VS="Droppable",KS={timeout:25};function iy(t){let{data:n,disabled:r=!1,id:i,resizeObserverConfig:l}=t;const c=Vi(VS),{active:d,dispatch:p,over:g,measureDroppableContainers:m}=x.useContext(Ki),v=x.useRef({disabled:r}),k=x.useRef(!1),y=x.useRef(null),S=x.useRef(null),{disabled:C,updateMeasurementsFor:b,timeout:N}={...KS,...l},E=Oi(b??i),R=x.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(E.current)?E.current:[E.current]),S.current=null},N)},[N]),z=Jl({callback:R,disabled:C||!d}),I=x.useCallback(($,Z)=>{z&&(Z&&(z.unobserve(Z),k.current=!1),$&&z.observe($))},[z]),[L,q]=_l(I),K=Oi(n);return x.useEffect(()=>{!z||!L.current||(z.disconnect(),k.current=!1,z.observe(L.current))},[L,z]),x.useEffect(()=>(p({type:Ht.RegisterDroppable,element:{id:i,key:c,disabled:r,node:L,rect:y,data:K}}),()=>p({type:Ht.UnregisterDroppable,key:c,id:i})),[i]),x.useEffect(()=>{r!==v.current.disabled&&(p({type:Ht.SetDroppableDisabled,id:i,key:c,disabled:r}),v.current.disabled=r)},[i,c,r,p]),{active:d,rect:y,isOver:(g==null?void 0:g.id)===i,node:L,over:g,setNodeRef:q}}function GS(t){let{animation:n,children:r}=t;const[i,l]=x.useState(null),[c,d]=x.useState(null),p=Rl(r);return!r&&!i&&p&&l(p),fs(()=>{if(!c)return;const g=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(g==null||m==null){l(null);return}Promise.resolve(n(m,c)).then(()=>{l(null)})},[n,i,c]),ct.createElement(ct.Fragment,null,r,i?x.cloneElement(i,{ref:d}):null)}const qS={x:0,y:0,scaleX:1,scaleY:1};function XS(t){let{children:n}=t;return ct.createElement(Ki.Provider,{value:ty},ct.createElement(ec.Provider,{value:qS},n))}const YS={position:"fixed",touchAction:"none"},QS=t=>Ql(t)?"transform 250ms ease":void 0,ZS=x.forwardRef((t,n)=>{let{as:r,activatorEvent:i,adjustScale:l,children:c,className:d,rect:p,style:g,transform:m,transition:v=QS}=t;if(!p)return null;const k=l?m:{...m,scaleX:1,scaleY:1},y={...YS,width:p.width,height:p.height,top:p.top,left:p.left,transform:Cs.Transform.toString(k),transformOrigin:l&&i?V1(i,p):void 0,transition:typeof v=="function"?v(i):v,...g};return ct.createElement(r,{className:d,style:y,ref:n},c)}),JS=t=>n=>{let{active:r,dragOverlay:i}=n;const l={},{styles:c,className:d}=t;if(c!=null&&c.active)for(const[p,g]of Object.entries(c.active))g!==void 0&&(l[p]=r.node.style.getPropertyValue(p),r.node.style.setProperty(p,g));if(c!=null&&c.dragOverlay)for(const[p,g]of Object.entries(c.dragOverlay))g!==void 0&&i.node.style.setProperty(p,g);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&i.node.classList.add(d.dragOverlay),function(){for(const[g,m]of Object.entries(l))r.node.style.setProperty(g,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},eb=t=>{let{transform:{initial:n,final:r}}=t;return[{transform:Cs.Transform.toString(n)},{transform:Cs.Transform.toString(r)}]},tb={duration:250,easing:"ease",keyframes:eb,sideEffects:JS({styles:{active:{opacity:"0"}}})};function nb(t){let{config:n,draggableNodes:r,droppableContainers:i,measuringConfiguration:l}=t;return Yl((c,d)=>{if(n===null)return;const p=r.get(c);if(!p)return;const g=p.node.current;if(!g)return;const m=ey(d);if(!m)return;const{transform:v}=Tn(d).getComputedStyle(d),k=Wv(v);if(!k)return;const y=typeof n=="function"?n:sb(n);return Yv(g,l.draggable.measure),y({active:{id:c,data:p.data,node:g,rect:l.draggable.measure(g)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:l,transform:k})})}function sb(t){const{duration:n,easing:r,sideEffects:i,keyframes:l}={...tb,...t};return c=>{let{active:d,dragOverlay:p,transform:g,...m}=c;if(!n)return;const v={x:p.rect.left-d.rect.left,y:p.rect.top-d.rect.top},k={scaleX:g.scaleX!==1?d.rect.width*g.scaleX/p.rect.width:1,scaleY:g.scaleY!==1?d.rect.height*g.scaleY/p.rect.height:1},y={x:g.x-v.x,y:g.y-v.y,...k},S=l({...m,active:d,dragOverlay:p,transform:{initial:g,final:y}}),[C]=S,b=S[S.length-1];if(JSON.stringify(C)===JSON.stringify(b))return;const N=i==null?void 0:i({active:d,dragOverlay:p,...m}),E=p.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(R=>{E.onfinish=()=>{N==null||N(),R()}})}}let Pm=0;function rb(t){return x.useMemo(()=>{if(t!=null)return Pm++,Pm},[t])}const ob=ct.memo(t=>{let{adjustScale:n=!1,children:r,dropAnimation:i,style:l,transition:c,modifiers:d,wrapperElement:p="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:y,containerNodeRect:S,draggableNodes:C,droppableContainers:b,dragOverlay:N,over:E,measuringConfiguration:R,scrollableAncestors:z,scrollableAncestorRects:I,windowRect:L}=oy(),q=x.useContext(ec),K=rb(k==null?void 0:k.id),$=sy(d,{activatorEvent:v,active:k,activeNodeRect:y,containerNodeRect:S,draggingNodeRect:N.rect,over:E,overlayNodeRect:N.rect,scrollableAncestors:z,scrollableAncestorRects:I,transform:q,windowRect:L}),Z=ef(y),he=nb({config:i,draggableNodes:C,droppableContainers:b,measuringConfiguration:R}),ce=Z?N.setRef:void 0;return ct.createElement(XS,null,ct.createElement(GS,{animation:he},k&&K?ct.createElement(ZS,{key:K,id:k.id,ref:ce,as:p,activatorEvent:v,adjustScale:n,className:g,transition:c,rect:Z,style:{zIndex:m,...l},transform:$},r):null))});function ay(t,n,r){const i=t.slice();return i.splice(r<0?i.length+r:r,0,i.splice(n,1)[0]),i}function ib(t,n){return t.reduce((r,i,l)=>{const c=n.get(i);return c&&(r[l]=c),r},Array(t.length))}function Ja(t){return t!==null&&t>=0}function ab(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r])return!1;return!0}function lb(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const el={scaleX:1,scaleY:1},cb=t=>{var n;let{rects:r,activeNodeRect:i,activeIndex:l,overIndex:c,index:d}=t;const p=(n=r[l])!=null?n:i;if(!p)return null;const g=ub(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(p.left+p.width):m.left-p.left,y:0,...el}:null}return d>l&&d<=c?{x:-p.width-g,y:0,...el}:d<l&&d>=c?{x:p.width+g,y:0,...el}:{x:0,y:0,...el}};function ub(t,n,r){const i=t[n],l=t[n-1],c=t[n+1];return!i||!l&&!c?0:r<n?l?i.left-(l.left+l.width):c.left-(i.left+i.width):c?c.left-(i.left+i.width):i.left-(l.left+l.width)}const ly=t=>{let{rects:n,activeIndex:r,overIndex:i,index:l}=t;const c=ay(n,i,r),d=n[l],p=c[l];return!p||!d?null:{x:p.left-d.left,y:p.top-d.top,scaleX:p.width/d.width,scaleY:p.height/d.height}},tl={scaleX:1,scaleY:1},$m=t=>{var n;let{activeIndex:r,activeNodeRect:i,index:l,rects:c,overIndex:d}=t;const p=(n=c[r])!=null?n:i;if(!p)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(p.top+p.height):m.top-p.top,...tl}:null}const g=db(c,l,r);return l>r&&l<=d?{x:0,y:-p.height-g,...tl}:l<r&&l>=d?{x:0,y:p.height+g,...tl}:{x:0,y:0,...tl}};function db(t,n,r){const i=t[n],l=t[n-1],c=t[n+1];return i?r<n?l?i.top-(l.top+l.height):c?c.top-(i.top+i.height):0:c?c.top-(i.top+i.height):l?i.top-(l.top+l.height):0:0}const cy="Sortable",uy=ct.createContext({activeIndex:-1,containerId:cy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ly,disabled:{draggable:!1,droppable:!1}});function vd(t){let{children:n,id:r,items:i,strategy:l=ly,disabled:c=!1}=t;const{active:d,dragOverlay:p,droppableRects:g,over:m,measureDroppableContainers:v}=oy(),k=Vi(cy,r),y=p.rect!==null,S=x.useMemo(()=>i.map(q=>typeof q=="object"&&"id"in q?q.id:q),[i]),C=d!=null,b=d?S.indexOf(d.id):-1,N=m?S.indexOf(m.id):-1,E=x.useRef(S),R=!ab(S,E.current),z=N!==-1&&b===-1||R,I=lb(c);fs(()=>{R&&C&&v(S)},[R,S,C,v]),x.useEffect(()=>{E.current=S},[S]);const L=x.useMemo(()=>({activeIndex:b,containerId:k,disabled:I,disableTransforms:z,items:S,overIndex:N,useDragOverlay:y,sortedRects:ib(S,g),strategy:l}),[b,k,I.draggable,I.droppable,z,S,N,g,y,l]);return ct.createElement(uy.Provider,{value:L},n)}const fb=t=>{let{id:n,items:r,activeIndex:i,overIndex:l}=t;return ay(r,i,l).indexOf(n)},pb=t=>{let{containerId:n,isSorting:r,wasDragging:i,index:l,items:c,newIndex:d,previousItems:p,previousContainerId:g,transition:m}=t;return!m||!i||p!==c&&l===d?!1:r?!0:d!==l&&n===g},hb={duration:200,easing:"ease"},dy="transform",mb=Cs.Transition.toString({property:dy,duration:0,easing:"linear"}),gb={roleDescription:"sortable"};function vb(t){let{disabled:n,index:r,node:i,rect:l}=t;const[c,d]=x.useState(null),p=x.useRef(r);return fs(()=>{if(!n&&r!==p.current&&i.current){const g=l.current;if(g){const m=Lo(i.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&d(v)}}r!==p.current&&(p.current=r)},[n,r,i,l]),x.useEffect(()=>{c&&d(null)},[c]),c}function tf(t){let{animateLayoutChanges:n=pb,attributes:r,disabled:i,data:l,getNewIndex:c=fb,id:d,strategy:p,resizeObserverConfig:g,transition:m=hb}=t;const{items:v,containerId:k,activeIndex:y,disabled:S,disableTransforms:C,sortedRects:b,overIndex:N,useDragOverlay:E,strategy:R}=x.useContext(uy),z=yb(i,S),I=v.indexOf(d),L=x.useMemo(()=>({sortable:{containerId:k,index:I,items:v},...l}),[k,l,I,v]),q=x.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:K,node:$,isOver:Z,setNodeRef:he}=iy({id:d,data:L,disabled:z.droppable,resizeObserverConfig:{updateMeasurementsFor:q,...g}}),{active:ce,activatorEvent:ye,activeNodeRect:Se,attributes:Oe,setNodeRef:J,listeners:re,isDragging:oe,over:F,setActivatorNodeRef:Q,transform:G}=HS({id:d,data:L,attributes:{...gb,...r},disabled:z.draggable}),D=R1(he,J),P=!!ce,le=P&&!C&&Ja(y)&&Ja(N),W=!E&&oe,X=W&&le?G:null,be=le?X??(p??R)({rects:b,activeNodeRect:Se,activeIndex:y,overIndex:N,index:I}):null,_e=Ja(y)&&Ja(N)?c({id:d,items:v,activeIndex:y,overIndex:N}):I,Ae=ce==null?void 0:ce.id,je=x.useRef({activeId:Ae,items:v,newIndex:_e,containerId:k}),me=v!==je.current.items,pe=n({active:ce,containerId:k,isDragging:oe,isSorting:P,id:d,index:I,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:m,wasDragging:je.current.activeId!=null}),Ve=vb({disabled:!pe,index:I,node:$,rect:K});return x.useEffect(()=>{P&&je.current.newIndex!==_e&&(je.current.newIndex=_e),k!==je.current.containerId&&(je.current.containerId=k),v!==je.current.items&&(je.current.items=v)},[P,_e,k,v]),x.useEffect(()=>{if(Ae===je.current.activeId)return;if(Ae!=null&&je.current.activeId==null){je.current.activeId=Ae;return}const mt=setTimeout(()=>{je.current.activeId=Ae},50);return()=>clearTimeout(mt)},[Ae]),{active:ce,activeIndex:y,attributes:Oe,data:L,rect:K,index:I,newIndex:_e,items:v,isOver:Z,isSorting:P,isDragging:oe,listeners:re,node:$,overIndex:N,over:F,setNodeRef:D,setActivatorNodeRef:Q,setDroppableNodeRef:he,setDraggableNodeRef:J,transform:Ve??be,transition:Ie()};function Ie(){if(Ve||me&&je.current.newIndex===I)return mb;if(!(W&&!Ql(ye)||!m)&&(P||pe))return Cs.Transition.toString({...m,property:dy})}}function yb(t,n){var r,i;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:n.draggable,droppable:(i=t==null?void 0:t.droppable)!=null?i:n.droppable}}nt.Down,nt.Right,nt.Up,nt.Left;function nl(t){const[n,r]=x.useState(()=>{try{const l=localStorage.getItem(t);if(l==null)return new Set;const c=JSON.parse(l);return Array.isArray(c)?new Set(c.filter(d=>typeof d=="string")):new Set}catch{return new Set}}),i=x.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(t,JSON.stringify([...d]))}catch{}return d})},[t]);return[n,i]}function xb(t,n=!1){const[r,i]=x.useState(()=>{try{const c=localStorage.getItem(t);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),l=x.useCallback(c=>{i(c);try{localStorage.setItem(t,c?"1":"0")}catch{}},[t]);return[r,l]}async function $i(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const n=document.createElement("textarea");n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}}}function wb(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}const yd="(no directory)";function hr(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function xd(t,n){if(!n||!t.cwd)return!1;const r=hr(t.cwd),i=hr(n);return r.startsWith(`${i}/`)}function kb(t,n){const r=new Map;for(const d of n){const p=d.cwd||yd,g=r.get(p)??[];g.push(d),r.set(p,g)}const i=new Set,l=new Set(t.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of t){if(d.deleted===1){i.add(d.path);continue}i.add(d.path),c.push({path:d.path,label:d.label||d.path.split("/").pop()||d.path,sessions:r.get(d.path)??[],workspace:d})}for(const[d,p]of r)i.has(d)||l.has(d)||c.push({path:d,label:d===yd?"Other":d.split("/").pop()||d,sessions:p,workspace:null});return c}function Sb(t,n,r){if(n.length===0)return!1;const i=new Set(t.filter(l=>l.deleted===1).map(l=>l.path));return n.some(l=>!xd(l,r)&&!i.has(l.cwd||yd))}function Ll(t){return[...t].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function zm(t,n,r,i){const l=n.map(c=>({folder:c,sessions:t.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:i.has(c.id)}));return l.push({folder:null,sessions:t.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),l}function Fm(t,n){return{working:Ll(t.sessions.filter(r=>r.lifecycle!=="finished")),finished:Ll(t.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(t.finishedKey)}}function sl(t,n){return t.folder_id&&n.has(t.folder_id)?t.folder_id:null}function bb(t){const n=new Set(t.map(i=>i.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Um({id:t,children:n,className:r}){const{setNodeRef:i,isOver:l}=iy({id:t});return a.jsx("div",{ref:i,className:`${r??""}${l?" drop-over":""}`,children:n})}function nf({inputRef:t,value:n,onChange:r,onConfirm:i,onCancel:l}){return a.jsx("input",{ref:t,className:"tree-rename-input",value:n,onChange:c=>r(c.target.value),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),onKeyDown:c=>{c.key==="Enter"&&i(),c.key==="Escape"&&l()},onBlur:i})}function Nb({s:t,backgroundTaskCount:n,isActive:r,isSelected:i,originApp:l,renaming:c,renameValue:d,renameRef:p,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:y,onToggleStar:S}){const{attributes:C,listeners:b,setNodeRef:N,transform:E,transition:R,isDragging:z}=tf({id:`s:${t.id}`}),I=Kl(t,n);return a.jsxs("div",{ref:N,style:{transform:Cs.Transform.toString(E),transition:R},className:`tree-item ${r?"active":""}${i?" selected":""} ${I.isFinished?"tree-item-finished":""}${z?" dragging":""}${t.starred?" tree-item-starred":""}`,...C,...b,onClick:k,onContextMenu:y,children:[a.jsx(qd,{iconClass:I.iconClass,iconText:I.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(Io,{iconNode:l.iconNode,size:10})}),c?a.jsx(nf,{inputRef:p,value:d,onChange:g,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:L=>{L.stopPropagation(),S()},onPointerDown:L=>L.stopPropagation(),children:a.jsx(jl,{size:10,fill:t.starred?"currentColor":"none"})}),I.dot&&a.jsx(Gd,{status:I.dot,title:I.dotTitle})]})}function Tb({folder:t,count:n,collapsed:r,renaming:i,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:p,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:y,listeners:S,setNodeRef:C,transform:b,transition:N,isDragging:E,over:R}=tf({id:`f:${t.id}`}),z=R!=null&&String(R.id).startsWith("s:");return a.jsxs("div",{ref:C,style:{transform:Cs.Transform.toString(b),transition:N},className:`tree-folder ${r?"collapsed":""}${E?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${z?" drop-over":""}`,...y,...S,onClick:()=>{i||m()},onContextMenu:v,children:i?a.jsx(nf,{inputRef:c,value:l,onChange:d,onConfirm:p,onCancel:g}):a.jsxs(a.Fragment,{children:[a.jsx(jo,{size:8,className:"tree-chevron"}),a.jsx(El,{size:12}),a.jsx("span",{className:"tree-folder-label",children:t.name}),a.jsx("span",{className:"tree-count",children:n})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function Cb(){const t=A(_=>_.sessions),n=A(_=>_.backgroundTasks),r=A(_=>_.workspaces),i=A(_=>_.folders),l=A(_=>_.activeSessionId),c=A(_=>_.selectSession),d=A(_=>_.deleteSession),p=A(_=>_.removeWorkspace),g=A(_=>_.createSessionInWorkspace),m=A(_=>_.pickAndAddWorkspace),v=A(_=>_.setImportSessionsWorkspace),k=A(_=>_.renameSession),y=A(_=>_.markFinished),S=A(_=>_.markFinishedMany),C=A(_=>_.toggleStar),b=A(_=>_.reopenSession),N=A(_=>_.reopenSessionMany),E=A(_=>_.deleteSessionMany),R=A(_=>_.createSidebarFolder),z=A(_=>_.renameFolder),I=A(_=>_.deleteFolder),L=A(_=>_.applyMoves),q=A(_=>_.reorderFolders),K=A(_=>_.apps),$=A(_=>_.appsRootPath),Z=A(_=>_.activeAppTabId),he=A(_=>_.openAppTab),ce=A(_=>_.startAppEdit),ye=A(_=>_.toggleAppPin),Se=A(_=>_.deleteApp),Oe=A(_=>_.openAppCatalog),[J,re]=nl("agentpane:sidebar-ws-collapsed"),[oe,F]=nl("agentpane:sidebar-sub-collapsed"),[Q,G]=nl("agentpane:sidebar-folders-collapsed"),[D,P]=nl("agentpane:sidebar-app-edits-collapsed"),[le,W]=xb("agentpane:sidebar-hide-auto-sessions"),[X,ae]=x.useState(null),[be,_e]=x.useState(null),[Ae,je]=x.useState(""),[me,pe]=x.useState(null),[Ve,Ie]=x.useState(new Set),[mt,Ue]=x.useState(null),Vt=x.useRef(null),tn=x.useRef(null),kt=x.useRef(null),jt=x.useRef(!1),Ft=Fv(zv(Zl,{activationConstraint:{distance:5}}));function Ot(){Ie(new Set),Ue(null)}Ui(Vt,()=>ae(null),!!X),Ao(()=>{ae(null),Ot()},!!X||Ve.size>0),x.useLayoutEffect(()=>{const _=Vt.current;if(!X||!_)return;const fe=8,{offsetWidth:ie,offsetHeight:we}=_,Pe=X.x+ie>window.innerWidth-fe?Math.max(fe,X.x-ie):X.x,qe=X.y+we>window.innerHeight-fe?Math.max(fe,X.y-we):X.y;_.style.left=`${Pe}px`,_.style.top=`${qe}px`},[X]);const Y=x.useMemo(()=>new Map(t.map(_=>[_.id,_])),[t]),ge=x.useMemo(()=>new Map(i.map(_=>[_.id,_])),[i]),Be=x.useMemo(()=>{const _=new Map;for(const fe of[...i].sort((ie,we)=>ie.sort_order-we.sort_order)){const ie=_.get(fe.workspace_path)??[];ie.push(fe),_.set(fe.workspace_path,ie)}return _},[i]);function st(_){re(fe=>{const ie=new Set(fe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}function gt(_){F(fe=>{const ie=new Set(fe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}function vt(_){G(fe=>{const ie=new Set(fe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}function _t(){W(!le),Ot()}function an(_){P(fe=>{const ie=new Set(fe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}x.useEffect(()=>{be&&tn.current&&(tn.current.focus(),tn.current.select())},[be]),x.useEffect(()=>{var _,fe,ie;jt.current||!l||(jt.current=!0,(ie=(fe=(_=kt.current)==null?void 0:_.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:fe.scrollIntoView)==null||ie.call(fe,{block:"nearest"}))},[l]);function dt(_,fe,ie,we=""){_e({kind:_,id:fe}),je(ie||we)}function Mn(){if(be){const _=Ae.trim();_&&(be.kind==="session"?k(be.id,_):z(be.id,_))}_e(null)}function Ln(){_e(null),je("")}async function hs(_){const fe=bb(Be.get(_)??[]),ie=await R(_,fe);ie&&dt("folder",ie.id,ie.name)}function ms(_){const fe=String(_.active.id);if(fe.startsWith("s:")){const ie=Y.get(fe.slice(2));ie&&pe({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(fe.startsWith("f:")){const ie=ge.get(fe.slice(2));ie&&pe({kind:"folder",label:ie.name})}}function ns(_){pe(null);const{active:fe,over:ie}=_;if(!ie)return;const we=String(fe.id),Pe=String(ie.id);if(we.startsWith("s:")){const qe=Y.get(we.slice(2));if(!qe)return;const $e=qe.cwd||"(no directory)",Ut=sl(qe,ge);let Pn,We;if(Pe.startsWith("f:")){const Je=ge.get(Pe.slice(2));if(!Je)return;Pn=Je.workspace_path,We=Je.id}else if(Pe.startsWith("s:")){const Je=Y.get(Pe.slice(2));if(!Je)return;Pn=Je.cwd||"(no directory)",We=sl(Je,ge)}else if(Pe.startsWith("c:")){const Je=Pe.slice(2),At=Je.lastIndexOf("|");Pn=Je.slice(0,At);const vs=Je.slice(At+1);We=vs==="root"?null:vs}else return;if(Pn!==$e)return;const yn=Ll(t.filter(Je=>(Je.cwd||"(no directory)")===Pn&&sl(Je,ge)===We)),Es=yn.filter(Je=>Je.id!==qe.id);let Us=Es.length;if(Pe.startsWith("s:")){const Je=Es.findIndex(At=>At.id===Pe.slice(2));Je>=0&&(Us=Je)}const $n=[...Es.slice(0,Us),qe,...Es.slice(Us)],gs=[];if(We===Ut){if($n.length===yn.length&&$n.every((Je,At)=>Je.id===yn[At].id))return;$n.forEach((Je,At)=>gs.push({id:Je.id,folder_id:We,sort_order:$n.length-1-At}))}else{const Je=Ll(t.filter(At=>(At.cwd||"(no directory)")===$e&&sl(At,ge)===Ut)).filter(At=>At.id!==qe.id);Je.forEach((At,vs)=>gs.push({id:At.id,folder_id:Ut,sort_order:Je.length-1-vs})),$n.forEach((At,vs)=>gs.push({id:At.id,folder_id:We,sort_order:$n.length-1-vs}))}L(gs);return}if(we.startsWith("f:")){if(!Pe.startsWith("f:"))return;const qe=ge.get(we.slice(2)),$e=ge.get(Pe.slice(2));if(!qe||!$e||qe.id===$e.id||qe.workspace_path!==$e.workspace_path)return;const Ut=(Be.get(qe.workspace_path)??[]).map(yn=>yn.id),Pn=Ut.indexOf(qe.id),We=Ut.indexOf($e.id);Ut.splice(We,0,...Ut.splice(Pn,1)),q(Ut)}}const On=$?t.filter(_=>!xd(_,$)):t,gn=new Set(le?On.filter(_=>wb(_)&&_.id!==l).map(_=>_.id):[]),ln=kb(r,gn.size>0?On.filter(_=>!gn.has(_.id)):On),Kt=x.useMemo(()=>{const _=new Map;if(!$)return _;const fe=hr($);for(const ie of t){if(!xd(ie,$))continue;const we=hr(ie.cwd).slice(fe.length+1).split("/")[0],Pe=_.get(we)??[];Pe.push(ie),_.set(we,Pe)}return _},[t,$]);function vn(_){return{folder:null,sessions:Kt.get(_)??[],finishedKey:`app:${_}:finished`,hidden:D.has(_)}}const Ze=[],Rt=_=>{if(_.hidden)return;const{working:fe,finished:ie,finishedCollapsed:we}=Fm(_,oe);Ze.push(...fe.map(Pe=>Pe.id)),we||Ze.push(...ie.map(Pe=>Pe.id))};for(const _ of ln){if(J.has(_.path))continue;const fe=Be.get(_.path)??[],ie=new Set(fe.map(we=>we.id));zm(_,fe,ie,Q).forEach(Rt)}K.forEach(_=>Rt(vn(_.id)));const ft=t.filter(_=>Ve.has(_.id)),Gt=ft.filter(_=>_.lifecycle!=="finished").map(_=>_.id),yt=ft.filter(_=>_.lifecycle==="finished").map(_=>_.id);function xt(_,fe){if(fe.metaKey||fe.ctrlKey){fe.preventDefault(),Ue(_.id),Ie(ie=>{const we=new Set(ie);return we.has(_.id)?we.delete(_.id):we.add(_.id),we});return}if(fe.shiftKey){fe.preventDefault();const ie=mt??_.id;Ue(ie);const we=Ze.indexOf(ie),Pe=Ze.indexOf(_.id);if(we>=0&&Pe>=0){const[qe,$e]=we<Pe?[we,Pe]:[Pe,we];Ie(new Set(Ze.slice(qe,$e+1)))}return}Ot(),Ue(_.id),c(_.id)}function lt(_,fe){fe.preventDefault();const ie=Ve.has(_.id)&&Ve.size>1;Ve.has(_.id)||(Ie(new Set),Ue(_.id)),ae({x:fe.clientX,y:fe.clientY,type:"session",sessionId:_.id,sessionTitle:_.title,sessionLifecycle:_.lifecycle,sessionExternalId:_.external_thread_id,multi:ie})}function qt(_){var ie;const fe=_.origin_app_id?K.find(we=>we.id===_.origin_app_id):null;return a.jsx(Nb,{s:_,backgroundTaskCount:((ie=n[_.id])==null?void 0:ie.length)??0,isActive:l===_.id,isSelected:Ve.has(_.id),originApp:fe??null,renaming:(be==null?void 0:be.kind)==="session"&&be.id===_.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onSelect:we=>xt(_,we),onToggleStar:()=>C(_.id),onCtxMenu:we=>lt(_,we)},_.id)}function ot(_){var ie;const fe=Kl(_,((ie=n[_.id])==null?void 0:ie.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===_.id?" active":""}${Ve.has(_.id)?" selected":""}${fe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:we=>xt(_,we),onContextMenu:we=>lt(_,we),children:[a.jsx(qd,{iconClass:fe.iconClass,iconText:fe.iconText,size:14}),(be==null?void 0:be.kind)==="session"&&be.id===_.id?a.jsx(nf,{inputRef:tn,value:Ae,onChange:je,onConfirm:Mn,onCancel:Ln}):a.jsx("span",{className:"tree-label",children:_.title||_.id.slice(0,8)}),fe.dot&&a.jsx(Gd,{status:fe.dot,title:fe.dotTitle})]},_.id)}function Pt(_,fe="workspace"){const{working:ie,finished:we,finishedCollapsed:Pe}=Fm(_,oe),qe=fe==="workspace"?qt:ot,$e=a.jsxs(a.Fragment,{children:[ie.length===0&&we.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(qe),we.length>0&&a.jsxs("div",{className:`tree-subgroup ${Pe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>gt(_.finishedKey),children:[a.jsx(jo,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:we.length})]}),!Pe&&a.jsx("div",{className:"tree-subgroup-items",children:we.map(qe)})]})]});if(fe==="app")return $e;const Ut=[...ie,...we].map(Pn=>`s:${Pn.id}`);return a.jsx(vd,{items:Ut,strategy:$m,children:$e})}return a.jsxs("div",{className:"ide-sidebar",ref:kt,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),a.jsxs("div",{className:"sidebar-header-actions",children:[a.jsx("button",{className:`sidebar-add sidebar-filter${le?" active":""}`,title:le?`Show automatic sessions (${gn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":le?"Show automatic sessions":"Hide automatic sessions","aria-pressed":le,onClick:_t,children:le?a.jsx(Vk,{size:14}):a.jsx(mr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(fr,{size:14})})]})]}),a.jsxs(ry,{sensors:Ft,collisionDetection:Uv,onDragStart:ms,onDragEnd:ns,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(_=>{const fe=J.has(_.path),ie=Be.get(_.path)??[],we=new Set(ie.map($e=>$e.id)),Pe=zm(_,ie,we,Q),qe=Pe[Pe.length-1];return a.jsxs("div",{className:`tree-section ${fe?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>st(_.path),onContextMenu:$e=>{$e.preventDefault(),ae({x:$e.clientX,y:$e.clientY,type:"workspace",path:_.path})},children:[a.jsx(jo,{size:9,className:"tree-chevron"}),a.jsx(El,{size:14}),a.jsx("span",{className:"tree-section-label",children:_.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:$e=>{$e.stopPropagation(),g(_.path)},children:a.jsx(fr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:$e=>{$e.stopPropagation(),hs(_.path)},children:a.jsx(qu,{size:11})}),a.jsx("span",{className:"tree-count",children:_.sessions.length})]}),!fe&&a.jsxs("div",{className:"tree-children",children:[a.jsx(vd,{items:ie.map($e=>`f:${$e.id}`),strategy:$m,children:Pe.filter($e=>$e.folder).map($e=>a.jsx(Tb,{folder:$e.folder,count:$e.sessions.length,collapsed:$e.hidden,renaming:(be==null?void 0:be.kind)==="folder"&&be.id===$e.folder.id,renameValue:Ae,renameRef:tn,onRenameValue:je,onRenameConfirm:Mn,onRenameCancel:Ln,onToggle:()=>vt($e.folder.id),onCtxMenu:Ut=>{Ut.preventDefault(),ae({x:Ut.clientX,y:Ut.clientY,type:"folder",folderId:$e.folder.id,folderName:$e.folder.name})},children:a.jsx(Um,{id:`c:${_.path}|${$e.folder.id}`,children:Pt($e)})},$e.folder.id))}),a.jsx(Um,{id:`c:${_.path}|root`,children:Pt(qe)})]})]},_.path)}),a.jsx(ob,{children:me&&a.jsxs("div",{className:"drag-overlay",children:[me.kind==="folder"&&a.jsx(El,{size:12}),a.jsx("span",{children:me.label})]})})]}),a.jsxs("div",{className:"sidebar-apps",children:[a.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Apps"}),a.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Oe(),children:a.jsx(fr,{size:14})})]}),K.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),K.map(_=>{const fe=vn(_.id),ie=fe.sessions.length>0&&!fe.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${Z===_.id?" active":""}`,title:_.description??void 0,onClick:()=>he(_.id),onContextMenu:we=>{we.preventDefault(),ae({x:we.clientX,y:we.clientY,type:"app",appId:_.id,appPinned:_.pinned})},children:[fe.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:we=>{we.stopPropagation(),an(_.id)},children:a.jsx(jo,{size:10,className:"tree-chevron"})}),a.jsx(Io,{iconNode:_.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:_.title}),fe.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:fe.sessions.length}),_.pinned&&a.jsx(jl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&a.jsx("div",{className:"sidebar-app-edits",children:Pt(fe,"app")})]},_.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(qu,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Vt,className:"ctx-menu",style:{position:"fixed",left:X.x,top:X.y,zIndex:500},children:[X.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(X.path),ae(null)},children:[a.jsx(fr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{hs(X.path),ae(null)},children:[a.jsx(qu,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),ae(null)},children:[a.jsx(Ev,{size:12})," Import Claude Code Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{p(X.path),ae(null)},children:[a.jsx(us,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",X.folderId,X.folderName??""),ae(null)},children:[a.jsx(fl,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{I(X.folderId),ae(null)},children:[a.jsx(us,{size:12})," Delete Folder"]})]}),X.type==="session"&&!X.multi&&a.jsx(a.Fragment,{children:X.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",X.sessionId,X.sessionTitle??""),ae(null)},children:[a.jsx(fl,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{y(X.sessionId),ae(null)},children:[a.jsx(Cl,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&($i(X.sessionExternalId),ae(null))},children:[a.jsx(Mi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ae(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{b(X.sessionId),ae(null)},children:[a.jsx(Li,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&($i(X.sessionExternalId),ae(null))},children:[a.jsx(Mi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ae(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Gt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Gt),ae(null),Ot()},children:[a.jsx(Cl,{size:12})," Mark ",Gt.length," as Finished"]}),yt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{N(yt),ae(null),Ot()},children:[a.jsx(Li,{size:12})," Reopen ",yt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{E([...Ve]),ae(null),Ot()},children:[a.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ce(X.appId),ae(null)},children:[a.jsx(fl,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ye(X.appId),ae(null)},children:[a.jsx(jl,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Se(X.appId),ae(null)},children:[a.jsx(us,{size:12})," Delete App"]})]})]})]})}const rl=4,Eb=({transform:t})=>({...t,y:0});function Bm({tabKey:t,title:n,active:r,icon:i,badge:l,onSelect:c,onClose:d,onMenu:p}){const{attributes:g,listeners:m,setNodeRef:v,transform:k,transition:y,isDragging:S}=tf({id:t});return a.jsxs("div",{ref:v,style:{transform:Cs.Translate.toString(k),transition:y},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...g,...m,onClick:c,onMouseDown:C=>{C.button===1&&C.preventDefault()},onAuxClick:C=>{C.button===1&&d()},onContextMenu:C=>{C.preventDefault(),C.stopPropagation(),p(C.clientX,C.clientY)},children:[i,n,l,a.jsx("span",{className:"ide-tab-close",onClick:C=>{C.stopPropagation(),d()},children:a.jsx(Nn,{size:12})})]})}function jb({menu:t,tabs:n,onDone:r}){const i=A(k=>k.closeTabs),l=A(k=>k.reopenClosedTab),c=A(k=>k.closedTabs.some(y=>ov(k,y.key))),d=x.useRef(null),[p,g]=x.useState({left:t.x,top:t.y});Ui(d,r,!0),Ao(r,!0),x.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:y}=d.current.getBoundingClientRect();g({left:Math.max(rl,Math.min(t.x,window.innerWidth-k-rl)),top:Math.max(rl,Math.min(t.y,window.innerHeight-y-rl))})},[t.x,t.y]);const m=t.key!==null&&n.includes(t.key)?t.key:null,v=(k,y,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(y(),r())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...p,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>i([m])),v("Close Others",()=>i(n.filter(k=>k!==m)),n.length<2),v("Close to the Right",()=>i(n.slice(n.indexOf(m)+1)),n.at(-1)===m),v("Close All",()=>i(n))]}),v("Reopen Closed Tab",l,!c)]})}function _b(){const t=A(L=>L.tabOrder),n=A(L=>L.activeSessionId),r=A(L=>L.sessions),i=A(L=>L.backgroundTasks),l=A(L=>L.selectSession),c=A(L=>L.closeTab),d=A(L=>L.setShowNewSessionDialog),p=A(L=>L.apps),g=A(L=>L.activeAppTabId),m=A(L=>L.openAppTab),v=A(L=>L.closeAppTab),k=A(L=>L.moveTab),[y,S]=x.useState(null),C=x.useRef(null),b=Fv(zv(Zl,{activationConstraint:{distance:5}})),N=$d({activeSessionId:n,activeAppTabId:g});x.useEffect(()=>{var L,q,K;(K=(q=(L=C.current)==null?void 0:L.querySelector(".ide-tab.active"))==null?void 0:q.scrollIntoView)==null||K.call(q,{block:"nearest",inline:"nearest"})},[N]);const E=t.filter(L=>{const{kind:q,id:K}=pr(L);return q==="app"||r.some($=>$.id===K)}),R=({active:L,over:q})=>{q&&k(String(L.id),String(q.id))},z=L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,key:null})},I=L=>{var ce;const{kind:q,id:K}=pr(L),$=(ye,Se)=>S({x:ye,y:Se,key:L});if(q==="app"){const ye=p.find(Se=>Se.id===K);return a.jsx(Bm,{tabKey:L,title:(ye==null?void 0:ye.title)??K,active:g===K,icon:a.jsx(Io,{iconNode:ye==null?void 0:ye.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(K),onClose:()=>v(K),onMenu:$},L)}const Z=r.find(ye=>ye.id===K);if(!Z)return null;const he=Kl(Z,((ce=i[K])==null?void 0:ce.length)??0);return a.jsx(Bm,{tabKey:L,title:Z.title||K.slice(0,8),active:n===K&&g==null,icon:a.jsx(qd,{iconClass:he.iconClass,iconText:he.iconText,size:14}),badge:he.dot&&a.jsx(Gd,{status:he.dot,title:he.dotTitle}),onSelect:()=>void l(K),onClose:()=>c(K),onMenu:$},L)};return a.jsxs(ry,{sensors:b,collisionDetection:Uv,modifiers:[Eb],onDragEnd:R,children:[a.jsx(vd,{items:E,strategy:cb,children:a.jsxs("div",{ref:C,className:"ide-tabs",onContextMenu:z,onWheel:L=>{L.deltaX===0&&(L.currentTarget.scrollLeft+=L.deltaY)},children:[E.map(I),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(fr,{size:14})})]})}),y&&a.jsx(jb,{menu:y,tabs:E,onDone:()=>S(null)})]})}function sf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ur=sf();function fy(t){Ur=t}var ji={exec:()=>null};function rt(t,n=""){let r=typeof t=="string"?t:t.source;const i={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(bn.caret,"$1"),r=r.replace(l,d),i},getRegex:()=>new RegExp(r,n)};return i}var bn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Rb=/^(?:[ \t]*(?:\n|$))+/,Ab=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ib=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Gi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Db=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,rf=/(?:[*+-]|\d{1,9}[.)])/,py=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hy=rt(py).replace(/bull/g,rf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Mb=rt(py).replace(/bull/g,rf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),of=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Lb=/^[^\n]+/,af=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ob=rt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",af).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pb=rt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,rf).getRegex(),tc="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",lf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$b=rt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",lf).replace("tag",tc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),my=rt(of).replace("hr",Gi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",tc).getRegex(),zb=rt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",my).getRegex(),cf={blockquote:zb,code:Ab,def:Ob,fences:Ib,heading:Db,hr:Gi,html:$b,lheading:hy,list:Pb,newline:Rb,paragraph:my,table:ji,text:Lb},Wm=rt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Gi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",tc).getRegex(),Fb={...cf,lheading:Mb,table:Wm,paragraph:rt(of).replace("hr",Gi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Wm).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",tc).getRegex()},Ub={...cf,html:rt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",lf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ji,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:rt(of).replace("hr",Gi).replace("heading",` *#{1,6} *[^
|
|
450
|
-
]`).replace("lheading",hy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Bb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Wb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,gy=/^( {2,}|\\)\n(?!\s*$)/,Hb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,nc=/[\p{P}\p{S}]/u,uf=/[\s\p{P}\p{S}]/u,vy=/[^\s\p{P}\p{S}]/u,Vb=rt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,uf).getRegex(),yy=/(?!~)[\p{P}\p{S}]/u,Kb=/(?!~)[\s\p{P}\p{S}]/u,Gb=/(?:[^\s\p{P}\p{S}]|~)/u,qb=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,xy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Xb=rt(xy,"u").replace(/punct/g,nc).getRegex(),Yb=rt(xy,"u").replace(/punct/g,yy).getRegex(),wy="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qb=rt(wy,"gu").replace(/notPunctSpace/g,vy).replace(/punctSpace/g,uf).replace(/punct/g,nc).getRegex(),Zb=rt(wy,"gu").replace(/notPunctSpace/g,Gb).replace(/punctSpace/g,Kb).replace(/punct/g,yy).getRegex(),Jb=rt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vy).replace(/punctSpace/g,uf).replace(/punct/g,nc).getRegex(),eN=rt(/\\(punct)/,"gu").replace(/punct/g,nc).getRegex(),tN=rt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nN=rt(lf).replace("(?:-->|$)","-->").getRegex(),sN=rt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",nN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ol=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,rN=rt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ol).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ky=rt(/^!?\[(label)\]\[(ref)\]/).replace("label",Ol).replace("ref",af).getRegex(),Sy=rt(/^!?\[(ref)\](?:\[\])?/).replace("ref",af).getRegex(),oN=rt("reflink|nolink(?!\\()","g").replace("reflink",ky).replace("nolink",Sy).getRegex(),df={_backpedal:ji,anyPunctuation:eN,autolink:tN,blockSkip:qb,br:gy,code:Wb,del:ji,emStrongLDelim:Xb,emStrongRDelimAst:Qb,emStrongRDelimUnd:Jb,escape:Bb,link:rN,nolink:Sy,punctuation:Vb,reflink:ky,reflinkSearch:oN,tag:sN,text:Hb,url:ji},iN={...df,link:rt(/^!?\[(label)\]\((.*?)\)/).replace("label",Ol).getRegex(),reflink:rt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ol).getRegex()},wd={...df,emStrongRDelimAst:Zb,emStrongLDelim:Yb,url:rt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},aN={...wd,br:rt(gy).replace("{2,}","*").getRegex(),text:rt(wd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ol={normal:cf,gfm:Fb,pedantic:Ub},gi={normal:df,gfm:wd,breaks:aN,pedantic:iN},lN={"&":"&","<":"<",">":">",'"':""","'":"'"},Hm=t=>lN[t];function Ns(t,n){if(n){if(bn.escapeTest.test(t))return t.replace(bn.escapeReplace,Hm)}else if(bn.escapeTestNoEncode.test(t))return t.replace(bn.escapeReplaceNoEncode,Hm);return t}function Vm(t){try{t=encodeURI(t).replace(bn.percentDecode,"%")}catch{return null}return t}function Km(t,n){var c;const r=t.replace(bn.findPipe,(d,p,g)=>{let m=!1,v=p;for(;--v>=0&&g[v]==="\\";)m=!m;return m?"|":" |"}),i=r.split(bn.splitPipe);let l=0;if(i[0].trim()||i.shift(),i.length>0&&!((c=i.at(-1))!=null&&c.trim())&&i.pop(),n)if(i.length>n)i.splice(n);else for(;i.length<n;)i.push("");for(;l<i.length;l++)i[l]=i[l].trim().replace(bn.slashPipe,"|");return i}function vi(t,n,r){const i=t.length;if(i===0)return"";let l=0;for(;l<i&&t.charAt(i-l-1)===n;)l++;return t.slice(0,i-l)}function cN(t,n){if(t.indexOf(n[1])===-1)return-1;let r=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===n[0])r++;else if(t[i]===n[1]&&(r--,r<0))return i;return r>0?-2:-1}function Gm(t,n,r,i,l){const c=n.href,d=n.title||null,p=t[1].replace(l.other.outputLinkReplace,"$1");i.state.inLink=!0;const g={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:p,tokens:i.inlineTokens(p)};return i.state.inLink=!1,g}function uN(t,n,r){const i=t.match(r.other.indentCodeCompensation);if(i===null)return n;const l=i[1];return n.split(`
|
|
451
|
-
`).map(c=>{const d=c.match(r.other.beginningSpace);if(d===null)return c;const[p]=d;return p.length>=l.length?c.slice(l.length):c}).join(`
|
|
452
|
-
`)}var Pl=class{constructor(t){it(this,"options");it(this,"rules");it(this,"lexer");this.options=t||Ur}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:vi(r,`
|
|
453
|
-
`)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const r=n[0],i=uN(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:i}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const i=vi(r,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(r=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:vi(n[0],`
|
|
454
|
-
`)}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){let r=vi(n[0],`
|
|
455
|
-
`).split(`
|
|
456
|
-
`),i="",l="";const c=[];for(;r.length>0;){let d=!1;const p=[];let g;for(g=0;g<r.length;g++)if(this.rules.other.blockquoteStart.test(r[g]))p.push(r[g]),d=!0;else if(!d)p.push(r[g]);else break;r=r.slice(g);const m=p.join(`
|
|
457
|
-
`),v=m.replace(this.rules.other.blockquoteSetextReplace,`
|
|
458
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
459
|
-
${m}`:m,l=l?`${l}
|
|
460
|
-
${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,c,!0),this.lexer.state.top=k,r.length===0)break;const y=c.at(-1);if((y==null?void 0:y.type)==="code")break;if((y==null?void 0:y.type)==="blockquote"){const S=y,C=S.raw+`
|
|
461
|
-
`+r.join(`
|
|
462
|
-
`),b=this.blockquote(C);c[c.length-1]=b,i=i.substring(0,i.length-S.raw.length)+b.raw,l=l.substring(0,l.length-S.text.length)+b.text;break}else if((y==null?void 0:y.type)==="list"){const S=y,C=S.raw+`
|
|
463
|
-
`+r.join(`
|
|
464
|
-
`),b=this.list(C);c[c.length-1]=b,i=i.substring(0,i.length-y.raw.length)+b.raw,l=l.substring(0,l.length-S.raw.length)+b.raw,r=C.substring(c.at(-1).raw.length).split(`
|
|
465
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:c,text:l}}}list(t){let n=this.rules.block.list.exec(t);if(n){let r=n[1].trim();const i=r.length>1,l={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");const c=this.rules.other.listItemRegex(r);let d=!1;for(;t;){let g=!1,m="",v="";if(!(n=c.exec(t))||this.rules.block.hr.test(t))break;m=n[0],t=t.substring(m.length);let k=n[2].split(`
|
|
466
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,E=>" ".repeat(3*E.length)),y=t.split(`
|
|
467
|
-
`,1)[0],S=!k.trim(),C=0;if(this.options.pedantic?(C=2,v=k.trimStart()):S?C=n[1].length+1:(C=n[2].search(this.rules.other.nonSpaceChar),C=C>4?1:C,v=k.slice(C),C+=n[1].length),S&&this.rules.other.blankLine.test(y)&&(m+=y+`
|
|
468
|
-
`,t=t.substring(y.length+1),g=!0),!g){const E=this.rules.other.nextBulletRegex(C),R=this.rules.other.hrRegex(C),z=this.rules.other.fencesBeginRegex(C),I=this.rules.other.headingBeginRegex(C),L=this.rules.other.htmlBeginRegex(C);for(;t;){const q=t.split(`
|
|
469
|
-
`,1)[0];let K;if(y=q,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),K=y):K=y.replace(this.rules.other.tabCharGlobal," "),z.test(y)||I.test(y)||L.test(y)||E.test(y)||R.test(y))break;if(K.search(this.rules.other.nonSpaceChar)>=C||!y.trim())v+=`
|
|
470
|
-
`+K.slice(C);else{if(S||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||z.test(k)||I.test(k)||R.test(k))break;v+=`
|
|
471
|
-
`+y}!S&&!y.trim()&&(S=!0),m+=q+`
|
|
472
|
-
`,t=t.substring(q.length+1),k=K.slice(C)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(d=!0));let b=null,N;this.options.gfm&&(b=this.rules.other.listIsTask.exec(v),b&&(N=b[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!b,checked:N,loose:!1,text:v,tokens:[]}),l.raw+=m}const p=l.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let g=0;g<l.items.length;g++)if(this.lexer.state.top=!1,l.items[g].tokens=this.lexer.blockTokens(l.items[g].text,[]),!l.loose){const m=l.items[g].tokens.filter(k=>k.type==="space"),v=m.length>0&&m.some(k=>this.rules.other.anyLine.test(k.raw));l.loose=v}if(l.loose)for(let g=0;g<l.items.length;g++)l.items[g].loose=!0;return l}}html(t){const n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){const n=this.rules.block.def.exec(t);if(n){const r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:i,title:l}}}table(t){var d;const n=this.rules.block.table.exec(t);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const r=Km(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=n[3])!=null&&d.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
473
|
-
`):[],c={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(const p of i)this.rules.other.tableAlignRight.test(p)?c.align.push("right"):this.rules.other.tableAlignCenter.test(p)?c.align.push("center"):this.rules.other.tableAlignLeft.test(p)?c.align.push("left"):c.align.push(null);for(let p=0;p<r.length;p++)c.header.push({text:r[p],tokens:this.lexer.inline(r[p]),header:!0,align:c.align[p]});for(const p of l)c.rows.push(Km(p,c.header.length).map((g,m)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:c.align[m]})));return c}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const r=n[1].charAt(n[1].length-1)===`
|
|
474
|
-
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const c=vi(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=cN(n[2],"()");if(c===-2)return;if(c>-1){const p=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,p).trim(),n[3]=""}}let i=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(i);c&&(i=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),Gm(n,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(t,n){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const i=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[i.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return Gm(r,l,r[0],this.lexer,this.rules)}}emStrong(t,n,r=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...i[0]].length-1;let d,p,g=c,m=0;const v=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*t.length+c);(i=v.exec(n))!=null;){if(d=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!d)continue;if(p=[...d].length,i[3]||i[4]){g+=p;continue}else if((i[5]||i[6])&&c%3&&!((c+p)%3)){m+=p;continue}if(g-=p,g>0)continue;p=Math.min(p,p+g+m);const k=[...i[0]][0].length,y=t.slice(0,c+i.index+k+p);if(Math.min(c,p)%2){const C=y.slice(1,-1);return{type:"em",raw:y,text:C,tokens:this.lexer.inlineTokens(C)}}const S=y.slice(2,-2);return{type:"strong",raw:y,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return i&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let r,i;return n[2]==="@"?(r=n[1],i="mailto:"+r):(r=n[1],i=r),{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let n;if(n=this.rules.inline.url.exec(t)){let i,l;if(n[2]==="@")i=n[0],l="mailto:"+i;else{let c;do c=n[0],n[0]=((r=this.rules.inline._backpedal.exec(n[0]))==null?void 0:r[0])??"";while(c!==n[0]);i=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Ps=class kd{constructor(n){it(this,"tokens");it(this,"options");it(this,"state");it(this,"tokenizer");it(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Ur,this.options.tokenizer=this.options.tokenizer||new Pl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:bn,block:ol.normal,inline:gi.normal};this.options.pedantic?(r.block=ol.pedantic,r.inline=gi.pedantic):this.options.gfm&&(r.block=ol.gfm,this.options.breaks?r.inline=gi.breaks:r.inline=gi.gfm),this.tokenizer.rules=r}static get rules(){return{block:ol,inline:gi}}static lex(n,r){return new kd(r).lex(n)}static lexInline(n,r){return new kd(r).inlineTokens(n)}lex(n){n=n.replace(bn.carriageReturn,`
|
|
475
|
-
`),this.blockTokens(n,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const i=this.inlineQueue[r];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,r=[],i=!1){var l,c,d;for(this.options.pedantic&&(n=n.replace(bn.tabCharGlobal," ").replace(bn.spaceLine,""));n;){let p;if((c=(l=this.options.extensions)==null?void 0:l.block)!=null&&c.some(m=>(p=m.call({lexer:this},n,r))?(n=n.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.space(n)){n=n.substring(p.raw.length);const m=r.at(-1);p.raw.length===1&&m!==void 0?m.raw+=`
|
|
476
|
-
`:r.push(p);continue}if(p=this.tokenizer.code(n)){n=n.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
477
|
-
`+p.raw,m.text+=`
|
|
478
|
-
`+p.text,this.inlineQueue.at(-1).src=m.text):r.push(p);continue}if(p=this.tokenizer.fences(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.heading(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.hr(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.blockquote(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.list(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.html(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.def(n)){n=n.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
479
|
-
`+p.raw,m.text+=`
|
|
480
|
-
`+p.raw,this.inlineQueue.at(-1).src=m.text):this.tokens.links[p.tag]||(this.tokens.links[p.tag]={href:p.href,title:p.title});continue}if(p=this.tokenizer.table(n)){n=n.substring(p.raw.length),r.push(p);continue}if(p=this.tokenizer.lheading(n)){n=n.substring(p.raw.length),r.push(p);continue}let g=n;if((d=this.options.extensions)!=null&&d.startBlock){let m=1/0;const v=n.slice(1);let k;this.options.extensions.startBlock.forEach(y=>{k=y.call({lexer:this},v),typeof k=="number"&&k>=0&&(m=Math.min(m,k))}),m<1/0&&m>=0&&(g=n.substring(0,m+1))}if(this.state.top&&(p=this.tokenizer.paragraph(g))){const m=r.at(-1);i&&(m==null?void 0:m.type)==="paragraph"?(m.raw+=`
|
|
481
|
-
`+p.raw,m.text+=`
|
|
482
|
-
`+p.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(p),i=g.length!==n.length,n=n.substring(p.raw.length);continue}if(p=this.tokenizer.text(n)){n=n.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
483
|
-
`+p.raw,m.text+=`
|
|
484
|
-
`+p.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(p);continue}if(n){const m="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(n,r=[]){return this.inlineQueue.push({src:n,tokens:r}),r}inlineTokens(n,r=[]){var p,g,m;let i=n,l=null;if(this.tokens.links){const v=Object.keys(this.tokens.links);if(v.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,l.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let c=!1,d="";for(;n;){c||(d=""),c=!1;let v;if((g=(p=this.options.extensions)==null?void 0:p.inline)!=null&&g.some(y=>(v=y.call({lexer:this},n,r))?(n=n.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(v.raw.length);const y=r.at(-1);v.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):r.push(v);continue}if(v=this.tokenizer.emStrong(n,i,d)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(n)){n=n.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(n)){n=n.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(n))){n=n.substring(v.raw.length),r.push(v);continue}let k=n;if((m=this.options.extensions)!=null&&m.startInline){let y=1/0;const S=n.slice(1);let C;this.options.extensions.startInline.forEach(b=>{C=b.call({lexer:this},S),typeof C=="number"&&C>=0&&(y=Math.min(y,C))}),y<1/0&&y>=0&&(k=n.substring(0,y+1))}if(v=this.tokenizer.inlineText(k)){n=n.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(d=v.raw.slice(-1)),c=!0;const y=r.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):r.push(v);continue}if(n){const y="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return r}},$l=class{constructor(t){it(this,"options");it(this,"parser");this.options=t||Ur}space(t){return""}code({text:t,lang:n,escaped:r}){var c;const i=(c=(n||"").match(bn.notSpaceStart))==null?void 0:c[0],l=t.replace(bn.endingNewline,"")+`
|
|
485
|
-
`;return i?'<pre><code class="language-'+Ns(i)+'">'+(r?l:Ns(l,!0))+`</code></pre>
|
|
486
|
-
`:"<pre><code>"+(r?l:Ns(l,!0))+`</code></pre>
|
|
487
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
488
|
-
${this.parser.parse(t)}</blockquote>
|
|
489
|
-
`}html({text:t}){return t}heading({tokens:t,depth:n}){return`<h${n}>${this.parser.parseInline(t)}</h${n}>
|
|
490
|
-
`}hr(t){return`<hr>
|
|
491
|
-
`}list(t){const n=t.ordered,r=t.start;let i="";for(let d=0;d<t.items.length;d++){const p=t.items[d];i+=this.listitem(p)}const l=n?"ol":"ul",c=n&&r!==1?' start="'+r+'"':"";return"<"+l+c+`>
|
|
492
|
-
`+i+"</"+l+`>
|
|
493
|
-
`}listitem(t){var r;let n="";if(t.task){const i=this.checkbox({checked:!!t.checked});t.loose?((r=t.tokens[0])==null?void 0:r.type)==="paragraph"?(t.tokens[0].text=i+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=i+" "+Ns(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):n+=i+" "}return n+=this.parser.parse(t.tokens,!!t.loose),`<li>${n}</li>
|
|
494
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
495
|
-
`}table(t){let n="",r="";for(let l=0;l<t.header.length;l++)r+=this.tablecell(t.header[l]);n+=this.tablerow({text:r});let i="";for(let l=0;l<t.rows.length;l++){const c=t.rows[l];r="";for(let d=0;d<c.length;d++)r+=this.tablecell(c[d]);i+=this.tablerow({text:r})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
496
|
-
<thead>
|
|
497
|
-
`+n+`</thead>
|
|
498
|
-
`+i+`</table>
|
|
499
|
-
`}tablerow({text:t}){return`<tr>
|
|
500
|
-
${t}</tr>
|
|
501
|
-
`}tablecell(t){const n=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+n+`</${r}>
|
|
502
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ns(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:r}){const i=this.parser.parseInline(r),l=Vm(t);if(l===null)return i;t=l;let c='<a href="'+t+'"';return n&&(c+=' title="'+Ns(n)+'"'),c+=">"+i+"</a>",c}image({href:t,title:n,text:r,tokens:i}){i&&(r=this.parser.parseInline(i,this.parser.textRenderer));const l=Vm(t);if(l===null)return Ns(r);t=l;let c=`<img src="${t}" alt="${r}"`;return n&&(c+=` title="${Ns(n)}"`),c+=">",c}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ns(t.text)}},ff=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},$s=class Sd{constructor(n){it(this,"options");it(this,"renderer");it(this,"textRenderer");this.options=n||Ur,this.options.renderer=this.options.renderer||new $l,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ff}static parse(n,r){return new Sd(r).parse(n)}static parseInline(n,r){return new Sd(r).parseInline(n)}parse(n,r=!0){var l,c;let i="";for(let d=0;d<n.length;d++){const p=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[p.type]){const m=p,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){i+=v||"";continue}}const g=p;switch(g.type){case"space":{i+=this.renderer.space(g);continue}case"hr":{i+=this.renderer.hr(g);continue}case"heading":{i+=this.renderer.heading(g);continue}case"code":{i+=this.renderer.code(g);continue}case"table":{i+=this.renderer.table(g);continue}case"blockquote":{i+=this.renderer.blockquote(g);continue}case"list":{i+=this.renderer.list(g);continue}case"html":{i+=this.renderer.html(g);continue}case"paragraph":{i+=this.renderer.paragraph(g);continue}case"text":{let m=g,v=this.renderer.text(m);for(;d+1<n.length&&n[d+1].type==="text";)m=n[++d],v+=`
|
|
503
|
-
`+this.renderer.text(m);r?i+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):i+=v;continue}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return i}parseInline(n,r=this.renderer){var l,c;let i="";for(let d=0;d<n.length;d++){const p=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[p.type]){const m=this.options.extensions.renderers[p.type].call({parser:this},p);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){i+=m||"";continue}}const g=p;switch(g.type){case"escape":{i+=r.text(g);break}case"html":{i+=r.html(g);break}case"link":{i+=r.link(g);break}case"image":{i+=r.image(g);break}case"strong":{i+=r.strong(g);break}case"em":{i+=r.em(g);break}case"codespan":{i+=r.codespan(g);break}case"br":{i+=r.br(g);break}case"del":{i+=r.del(g);break}case"text":{i+=r.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return i}},ld,hl=(ld=class{constructor(t){it(this,"options");it(this,"block");this.options=t||Ur}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ps.lex:Ps.lexInline}provideParser(){return this.block?$s.parse:$s.parseInline}},it(ld,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ld),dN=class{constructor(...t){it(this,"defaults",sf());it(this,"options",this.setOptions);it(this,"parse",this.parseMarkdown(!0));it(this,"parseInline",this.parseMarkdown(!1));it(this,"Parser",$s);it(this,"Renderer",$l);it(this,"TextRenderer",ff);it(this,"Lexer",Ps);it(this,"Tokenizer",Pl);it(this,"Hooks",hl);this.use(...t)}walkTokens(t,n){var i,l;let r=[];for(const c of t)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const p of d.header)r=r.concat(this.walkTokens(p.tokens,n));for(const p of d.rows)for(const g of p)r=r.concat(this.walkTokens(g.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(p=>{const g=d[p].flat(1/0);r=r.concat(this.walkTokens(g,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const c=n.renderers[l.name];c?n.renderers[l.name]=function(...d){let p=l.renderer.apply(this,d);return p===!1&&(p=c.apply(this,d)),p}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const c=n[l.level];c?c.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),i.extensions=n),r.renderer){const l=this.defaults.renderer||new $l(this.defaults);for(const c in r.renderer){if(!(c in l))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const d=c,p=r.renderer[d],g=l[d];l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v||""}}i.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new Pl(this.defaults);for(const c in r.tokenizer){if(!(c in l))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const d=c,p=r.tokenizer[d],g=l[d];l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}i.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new hl;for(const c in r.hooks){if(!(c in l))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const d=c,p=r.hooks[d],g=l[d];hl.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(p.call(l,m)).then(k=>g.call(l,k));const v=p.call(l,m);return g.call(l,v)}:l[d]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}i.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;i.walkTokens=function(d){let p=[];return p.push(c.call(this,d)),l&&(p=p.concat(l.call(this,d))),p}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return Ps.lex(t,n??this.defaults)}parser(t,n){return $s.parse(t,n??this.defaults)}parseMarkdown(t){return(r,i)=>{const l={...i},c={...this.defaults,...l},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&l.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=t);const p=c.hooks?c.hooks.provideLexer():t?Ps.lex:Ps.lexInline,g=c.hooks?c.hooks.provideParser():t?$s.parse:$s.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>p(m,c)).then(m=>c.hooks?c.hooks.processAllTokens(m):m).then(m=>c.walkTokens?Promise.all(this.walkTokens(m,c.walkTokens)).then(()=>m):m).then(m=>g(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=p(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=g(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(t,n){return r=>{if(r.message+=`
|
|
504
|
-
Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+Ns(r.message+"",!0)+"</pre>";return n?Promise.resolve(i):i}if(n)return Promise.reject(r);throw r}}},zr=new dN;function Ge(t,n){return zr.parse(t,n)}Ge.options=Ge.setOptions=function(t){return zr.setOptions(t),Ge.defaults=zr.defaults,fy(Ge.defaults),Ge};Ge.getDefaults=sf;Ge.defaults=Ur;Ge.use=function(...t){return zr.use(...t),Ge.defaults=zr.defaults,fy(Ge.defaults),Ge};Ge.walkTokens=function(t,n){return zr.walkTokens(t,n)};Ge.parseInline=zr.parseInline;Ge.Parser=$s;Ge.parser=$s.parse;Ge.Renderer=$l;Ge.TextRenderer=ff;Ge.Lexer=Ps;Ge.lexer=Ps.lex;Ge.Tokenizer=Pl;Ge.Hooks=hl;Ge.parse=Ge;Ge.options;Ge.setOptions;Ge.use;Ge.walkTokens;Ge.parseInline;$s.parse;Ps.lex;/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function qm(t,n){(n==null||n>t.length)&&(n=t.length);for(var r=0,i=Array(n);r<n;r++)i[r]=t[r];return i}function fN(t){if(Array.isArray(t))return t}function pN(t,n){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var i,l,c,d,p=[],g=!0,m=!1;try{if(c=(r=r.call(t)).next,n!==0)for(;!(g=(i=c.call(r)).done)&&(p.push(i.value),p.length!==n);g=!0);}catch(v){m=!0,l=v}finally{try{if(!g&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return p}}function hN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
505
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mN(t,n){return fN(t)||pN(t,n)||gN(t,n)||hN()}function gN(t,n){if(t){if(typeof t=="string")return qm(t,n);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qm(t,n):void 0}}const by=Object.entries,Xm=Object.setPrototypeOf,vN=Object.isFrozen,yN=Object.getPrototypeOf,xN=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,wo=Object.create,Ny=typeof Reflect<"u"&&Reflect,bd=Ny.apply,Nd=Ny.construct;rn||(rn=function(n){return n});on||(on=function(n){return n});bd||(bd=function(n,r){for(var i=arguments.length,l=new Array(i>2?i-2:0),c=2;c<i;c++)l[c-2]=arguments[c];return n.apply(r,l)});Nd||(Nd=function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),l=1;l<r;l++)i[l-1]=arguments[l];return new n(...i)});const mo=zt(Array.prototype.forEach),wN=zt(Array.prototype.lastIndexOf),Ym=zt(Array.prototype.pop),go=zt(Array.prototype.push),kN=zt(Array.prototype.splice),dr=Array.isArray,bi=zt(String.prototype.toLowerCase),Ju=zt(String.prototype.toString),Qm=zt(String.prototype.match),yi=zt(String.prototype.replace),Zm=zt(String.prototype.indexOf),SN=zt(String.prototype.trim),bN=zt(Number.prototype.toString),NN=zt(Boolean.prototype.toString),Jm=typeof BigInt>"u"?null:zt(BigInt.prototype.toString),eg=typeof Symbol>"u"?null:zt(Symbol.prototype.toString),Jt=zt(Object.prototype.hasOwnProperty),xi=zt(Object.prototype.toString),Zt=zt(RegExp.prototype.test),Mr=TN(TypeError);function zt(t){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),l=1;l<r;l++)i[l-1]=arguments[l];return bd(t,n,i)}}function TN(t){return function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Nd(t,r)}}function Ke(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bi;if(Xm&&Xm(t,null),!dr(n))return t;let i=n.length;for(;i--;){let l=n[i];if(typeof l=="string"){const c=r(l);c!==l&&(vN(n)||(n[i]=c),l=c)}t[l]=!0}return t}function CN(t){for(let n=0;n<t.length;n++)Jt(t,n)||(t[n]=null);return t}function pn(t){const n=wo(null);for(const i of by(t)){var r=mN(i,2);const l=r[0],c=r[1];Jt(t,l)&&(dr(c)?n[l]=CN(c):c&&typeof c=="object"&&c.constructor===Object?n[l]=pn(c):n[l]=c)}return n}function EN(t){switch(typeof t){case"string":return t;case"number":return bN(t);case"boolean":return NN(t);case"bigint":return Jm?Jm(t):"0";case"symbol":return eg?eg(t):"Symbol()";case"undefined":return xi(t);case"function":case"object":{if(t===null)return xi(t);const n=t,r=cs(n,"toString");if(typeof r=="function"){const i=r(n);return typeof i=="string"?i:xi(i)}return xi(t)}default:return xi(t)}}function cs(t,n){for(;t!==null;){const i=xN(t,n);if(i){if(i.get)return zt(i.get);if(typeof i.value=="function")return zt(i.value)}t=yN(t)}function r(){return null}return r}function jN(t){try{return Zt(t,""),!0}catch{return!1}}const tg=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ed=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),td=rn(["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"]),_N=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nd=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),RN=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ng=rn(["#text"]),sg=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sd=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),rg=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),il=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),AN=on(/{{[\w\W]*|^[\w\W]*}}/g),IN=on(/<%[\w\W]*|^[\w\W]*%>/g),DN=on(/\${[\w\W]*/g),MN=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),LN=on(/^aria-[\-\w]+$/),og=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ON=on(/^(?:\w+script|data):/i),PN=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$N=on(/^html$/i),zN=on(/^[a-z][.\w]*(-[.\w]+)+$/i),ig=on(/<[/\w!]/g),ag=on(/<[/\w]/g),FN=on(/<\/no(script|embed|frames)/i),UN=on(/\/>/i),Hn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},BN=function(){return typeof window>"u"?null:window},WN=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let i=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(i=r.getAttribute(l));const c="dompurify"+(i?"#"+i:"");try{return n.createPolicy(c,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},lg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},cr=function(n,r,i,l){return Jt(n,r)&&dr(n[r])?Ke(l.base?pn(l.base):{},n[r],l.transform):i};function Ty(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:BN();const n=ue=>Ty(ue);if(n.version="3.4.13",n.removed=[],!t||!t.document||t.document.nodeType!==Hn.document||!t.Element)return n.isSupported=!1,n;let r=t.document;const i=r,l=i.currentScript;t.DocumentFragment;const c=t.HTMLTemplateElement,d=t.Node,p=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,y=p.prototype,S=cs(y,"cloneNode"),C=cs(y,"remove"),b=cs(y,"nextSibling"),N=cs(y,"childNodes"),E=cs(y,"parentNode"),R=cs(y,"shadowRoot"),z=cs(y,"attributes"),I=d&&d.prototype?cs(d.prototype,"nodeType"):null,L=d&&d.prototype?cs(d.prototype,"nodeName"):null,q=d&&d.prototype?cs(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const ue=r.createElement("template");ue.content&&ue.content.ownerDocument&&(r=ue.content.ownerDocument)}let K,$="",Z,he=!1,ce=0;const ye=function(){if(ce>0)throw Mr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Se=function(T){ye(),ce++;try{return K.createHTML(T)}finally{ce--}},Oe=function(T){ye(),ce++;try{return K.createScriptURL(T)}finally{ce--}},J=function(){return he||(Z=WN(k,l),he=!0),Z},re=r,oe=re.implementation,F=re.createNodeIterator,Q=re.createDocumentFragment,G=re.getElementsByTagName,D=i.importNode;let P=lg();n.isSupported=typeof by=="function"&&typeof E=="function"&&oe&&oe.createHTMLDocument!==void 0;const le=AN,W=IN,X=DN,ae=MN,be=LN,_e=ON,Ae=PN,je=zN;let me=og,pe=null;const Ve=Ke({},[...tg,...ed,...td,...nd,...ng]);let Ie=null;const mt=Ke({},[...sg,...sd,...rg,...il]);let Ue=Object.seal(wo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Vt=null,tn=null;const kt=Object.seal(wo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,Ft=!0,Ot=!1,Y=!0,ge=!1,Be=!0,st=!1,gt=!1,vt=null,_t=null,an=!1,dt=!1,Mn=!1,Ln=!1,hs=!0,ms=!1;const ns="user-content-";let On=!0,gn=!1,ln={},Kt=null;const vn=Ke({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ze=null;const Rt=Ke({},["audio","video","img","source","image","track"]);let ft=null;const Gt=Ke({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",lt="http://www.w3.org/1999/xhtml";let qt=lt,ot=!1,Pt=null;const _=Ke({},[yt,xt,lt],Ju),fe=rn(["mi","mo","mn","ms","mtext"]);let ie=Ke({},fe);const we=rn(["annotation-xml"]);let Pe=Ke({},we);const qe=Ke({},["title","style","font","a","script"]);let $e=null;const Ut=["application/xhtml+xml","text/html"],Pn="text/html";let We=null,yn=null;const Es=r.createElement("form"),Us=function(T){return T instanceof RegExp||T instanceof Function},$n=function(){let T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(yn&&yn===T)return;(!T||typeof T!="object")&&(T={}),T=pn(T),$e=Ut.indexOf(T.PARSER_MEDIA_TYPE)===-1?Pn:T.PARSER_MEDIA_TYPE,We=$e==="application/xhtml+xml"?Ju:bi,pe=cr(T,"ALLOWED_TAGS",Ve,{transform:We}),Ie=cr(T,"ALLOWED_ATTR",mt,{transform:We}),Pt=cr(T,"ALLOWED_NAMESPACES",_,{transform:Ju}),ft=cr(T,"ADD_URI_SAFE_ATTR",Gt,{transform:We,base:Gt}),Ze=cr(T,"ADD_DATA_URI_TAGS",Rt,{transform:We,base:Rt}),Kt=cr(T,"FORBID_CONTENTS",vn,{transform:We}),Vt=cr(T,"FORBID_TAGS",pn({}),{transform:We}),tn=cr(T,"FORBID_ATTR",pn({}),{transform:We}),ln=Jt(T,"USE_PROFILES")?T.USE_PROFILES&&typeof T.USE_PROFILES=="object"?pn(T.USE_PROFILES):T.USE_PROFILES:!1,jt=T.ALLOW_ARIA_ATTR!==!1,Ft=T.ALLOW_DATA_ATTR!==!1,Ot=T.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=T.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=T.SAFE_FOR_TEMPLATES||!1,Be=T.SAFE_FOR_XML!==!1,st=T.WHOLE_DOCUMENT||!1,dt=T.RETURN_DOM||!1,Mn=T.RETURN_DOM_FRAGMENT||!1,Ln=T.RETURN_TRUSTED_TYPE||!1,an=T.FORCE_BODY||!1,hs=T.SANITIZE_DOM!==!1,ms=T.SANITIZE_NAMED_PROPS||!1,On=T.KEEP_CONTENT!==!1,gn=T.IN_PLACE||!1,me=jN(T.ALLOWED_URI_REGEXP)?T.ALLOWED_URI_REGEXP:og,qt=typeof T.NAMESPACE=="string"?T.NAMESPACE:lt,ie=Jt(T,"MATHML_TEXT_INTEGRATION_POINTS")&&T.MATHML_TEXT_INTEGRATION_POINTS&&typeof T.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(T.MATHML_TEXT_INTEGRATION_POINTS):Ke({},fe),Pe=Jt(T,"HTML_INTEGRATION_POINTS")&&T.HTML_INTEGRATION_POINTS&&typeof T.HTML_INTEGRATION_POINTS=="object"?pn(T.HTML_INTEGRATION_POINTS):Ke({},we);const U=Jt(T,"CUSTOM_ELEMENT_HANDLING")&&T.CUSTOM_ELEMENT_HANDLING&&typeof T.CUSTOM_ELEMENT_HANDLING=="object"?pn(T.CUSTOM_ELEMENT_HANDLING):wo(null);if(Ue=wo(null),Jt(U,"tagNameCheck")&&Us(U.tagNameCheck)&&(Ue.tagNameCheck=U.tagNameCheck),Jt(U,"attributeNameCheck")&&Us(U.attributeNameCheck)&&(Ue.attributeNameCheck=U.attributeNameCheck),Jt(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(Ue.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),on(Ue),ge&&(Ft=!1),Mn&&(dt=!0),ln&&(pe=Ke({},ng),Ie=wo(null),ln.html===!0&&(Ke(pe,tg),Ke(Ie,sg)),ln.svg===!0&&(Ke(pe,ed),Ke(Ie,sd),Ke(Ie,il)),ln.svgFilters===!0&&(Ke(pe,td),Ke(Ie,sd),Ke(Ie,il)),ln.mathMl===!0&&(Ke(pe,nd),Ke(Ie,rg),Ke(Ie,il))),kt.tagCheck=null,kt.attributeCheck=null,Jt(T,"ADD_TAGS")&&(typeof T.ADD_TAGS=="function"?kt.tagCheck=T.ADD_TAGS:dr(T.ADD_TAGS)&&(pe===Ve&&(pe=pn(pe)),Ke(pe,T.ADD_TAGS,We))),Jt(T,"ADD_ATTR")&&(typeof T.ADD_ATTR=="function"?kt.attributeCheck=T.ADD_ATTR:dr(T.ADD_ATTR)&&(Ie===mt&&(Ie=pn(Ie)),Ke(Ie,T.ADD_ATTR,We))),Jt(T,"ADD_URI_SAFE_ATTR")&&dr(T.ADD_URI_SAFE_ATTR)&&Ke(ft,T.ADD_URI_SAFE_ATTR,We),Jt(T,"FORBID_CONTENTS")&&dr(T.FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,T.FORBID_CONTENTS,We)),Jt(T,"ADD_FORBID_CONTENTS")&&dr(T.ADD_FORBID_CONTENTS)&&(Kt===vn&&(Kt=pn(Kt)),Ke(Kt,T.ADD_FORBID_CONTENTS,We)),On&&(pe["#text"]=!0),st&&Ke(pe,["html","head","body"]),pe.table&&(Ke(pe,["tbody"]),delete Vt.tbody),T.TRUSTED_TYPES_POLICY){if(typeof T.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof T.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ee=K;K=T.TRUSTED_TYPES_POLICY;try{$=Se("")}catch(Te){throw K=ee,Te}}else T.TRUSTED_TYPES_POLICY===null?(K=void 0,$=""):(K===void 0&&(K=J()),K&&typeof $=="string"&&($=Se("")));rn&&rn(T),yn=T},gs=Ke({},[...ed,...td,..._N]),Je=Ke({},[...nd,...RN]),At=function(T,U,ee){return U.namespaceURI===lt?T==="svg":U.namespaceURI===yt?T==="svg"&&(ee==="annotation-xml"||ie[ee]):!!gs[T]},vs=function(T,U,ee){return U.namespaceURI===lt?T==="math":U.namespaceURI===xt?T==="math"&&Pe[ee]:!!Je[T]},rc=function(T,U,ee){return U.namespaceURI===xt&&!Pe[ee]||U.namespaceURI===yt&&!ie[ee]?!1:!Je[T]&&(qe[T]||!gs[T])},St=function(T){let U=E(T);(!U||!U.tagName)&&(U={namespaceURI:qt,tagName:"template"});const ee=bi(T.tagName),Te=bi(U.tagName);return Pt[T.namespaceURI]?T.namespaceURI===xt?At(ee,U,Te):T.namespaceURI===yt?vs(ee,U,Te):T.namespaceURI===lt?rc(ee,U,Te):!!($e==="application/xhtml+xml"&&Pt[T.namespaceURI]):!1},ys=function(T){go(n.removed,{element:T});try{E(T).removeChild(T)}catch{if(C(T),!E(T))throw Mr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Bs=function(T){gr(T);const U=N(T);if(U){const Te=[];mo(U,Re=>{go(Te,Re)}),mo(Te,Re=>{try{C(Re)}catch{}})}const ee=z(T);if(ee)for(let Te=ee.length-1;Te>=0;--Te){const Re=ee[Te],Fe=Re&&Re.name;if(typeof Fe=="string")try{T.removeAttribute(Fe)}catch{}}},xs=function(T,U){try{go(n.removed,{attribute:U.getAttributeNode(T),from:U})}catch{go(n.removed,{attribute:null,from:U})}if(U.removeAttribute(T),T==="is")if(dt||Mn)try{ys(U)}catch{}else try{U.setAttribute(T,"")}catch{}},Br=function(T){const U=z(T);if(U)for(let ee=U.length-1;ee>=0;--ee){const Te=U[ee],Re=Te&&Te.name;if(!(typeof Re!="string"||Ie[We(Re)]))try{T.removeAttribute(Re)}catch{}}},gr=function(T){const U=[T];for(;U.length>0;){const ee=U.pop();(I?I(ee):ee.nodeType)===Hn.element&&Br(ee);const Re=N(ee);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)U.push(Re[Fe])}},qi=function(T){if(!Be)return;const U=[T];for(;U.length>0;){const ee=U.pop(),Te=I?I(ee):ee.nodeType;if(Te===Hn.processingInstruction||Te===Hn.comment&&Zt(ag,ee.data)){try{C(ee)}catch{}continue}if(Te===Hn.element){const Fe=ee,Ye=We(L?L(ee):ee.nodeName);try{Fe.hasAttribute&&Fe.hasAttribute("patchsrc")&&Fe.removeAttribute("patchsrc"),Fe.hasAttribute&&Fe.hasAttribute("for")&&Ye!=="label"&&Ye!=="output"&&Fe.removeAttribute("for")}catch{}}const Re=N(ee);if(Re)for(let Fe=Re.length-1;Fe>=0;--Fe)U.push(Re[Fe])}},vr=function(T){let U=null,ee=null;if(an)T="<remove></remove>"+T;else{const Fe=Qm(T,/^[\r\n\t ]+/);ee=Fe&&Fe[0]}$e==="application/xhtml+xml"&&qt===lt&&(T='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+T+"</body></html>");const Te=K?Se(T):T;if(qt===lt)try{U=new v().parseFromString(Te,$e)}catch{}if(!U||!U.documentElement){U=oe.createDocument(qt,"template",null);try{U.documentElement.innerHTML=ot?$:Te}catch{}}const Re=U.body||U.documentElement;return T&&ee&&Re.insertBefore(r.createTextNode(ee),Re.childNodes[0]||null),qt===lt?G.call(U,st?"html":"body")[0]:st?U.documentElement:Re},zn=function(T){const U=q?q(T):T.ownerDocument;return F.call(U||T,T,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Wr=function(T){return T=yi(T,le," "),T=yi(T,W," "),T=yi(T,X," "),T},xn=function(T){var U;T.normalize();const ee=q?q(T):T.ownerDocument,Te=F.call(ee||T,T,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let Re=Te.nextNode();for(;Re;)Re.data=Wr(Re.data),Re=Te.nextNode();const Fe=(U=T.querySelectorAll)===null||U===void 0?void 0:U.call(T,"template");Fe&&mo(Fe,Ye=>{Ws(Ye.content)&&xn(Ye.content)})},Hr=function(T){const U=L?L(T):null;return typeof U!="string"||We(U)!=="form"?!1:typeof T.nodeName!="string"||typeof T.textContent!="string"||typeof T.removeChild!="function"||T.attributes!==z(T)||typeof T.removeAttribute!="function"||typeof T.setAttribute!="function"||typeof T.namespaceURI!="string"||typeof T.insertBefore!="function"||typeof T.hasChildNodes!="function"||T.nodeType!==I(T)||T.childNodes!==N(T)},Ws=function(T){if(!I||typeof T!="object"||T===null)return!1;try{return I(T)===Hn.documentFragment}catch{return!1}},yr=function(T){if(!I||typeof T!="object"||T===null)return!1;try{return typeof I(T)=="number"}catch{return!1}};function wn(ue,T,U){ue.length!==0&&mo(ue,ee=>{ee.call(n,T,U,yn)})}const Vr=function(T,U){return!!(Be&&T.hasChildNodes()&&!yr(T.firstElementChild)&&Zt(ig,T.textContent)&&Zt(ig,T.innerHTML)||Be&&T.namespaceURI===lt&&U==="style"&&yr(T.firstElementChild)||T.nodeType===Hn.processingInstruction||Be&&T.nodeType===Hn.comment&&Zt(ag,T.data))},xr=function(T,U,ee){if(!Vt[U]&&Po(U)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,U)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(U)))return!1;if(On&&!Kt[U]){const Te=E(T),Re=N(T);if(Re&&Te){const Fe=Re.length;for(let Ye=Fe-1;Ye>=0;--Ye){const et=T===ee?S(Re[Ye],!0):Re[Ye];Te.insertBefore(et,b(T))}}}return ys(T),!0},wr=function(T,U,ee,Te){return T.length===0?U:U===ee||U===Te?pn(U):U},Xi=function(T,U){if(wn(P.beforeSanitizeElements,T,null),T!==U&&E(T)===null)return gn&&gr(T),!0;if(Hr(T))return ys(T),!0;const ee=We(L?L(T):T.nodeName);if(pe=wr(P.uponSanitizeElement,pe,Ve,vt),wn(P.uponSanitizeElement,T,{tagName:ee,allowedTags:pe}),T!==U&&E(T)===null)return gn&&gr(T),!0;if(Vr(T,ee))return ys(T),!0;if(Vt[ee]||!(kt.tagCheck instanceof Function&&kt.tagCheck(ee))&&!pe[ee]){const Re=xr(T,ee,U);return Re===!1&&wn(P.afterSanitizeElements,T,null),Re}if((I?I(T):T.nodeType)===Hn.element&&!St(T)||(ee==="noscript"||ee==="noembed"||ee==="noframes")&&Zt(FN,T.innerHTML))return ys(T),!0;if(ge&&T.nodeType===Hn.text){const Re=Wr(T.textContent);T.textContent!==Re&&(go(n.removed,{element:T.cloneNode()}),T.textContent=Re)}return wn(P.afterSanitizeElements,T,null),!1},Yi=function(T,U,ee){if(tn[U]||Be&&U==="patchsrc"||Be&&U==="for"&&T!=="label"&&T!=="output"||hs&&(U==="id"||U==="name")&&(ee in r||ee in Es))return!1;const Te=Ie[U]||kt.attributeCheck instanceof Function&&kt.attributeCheck(U,T);if(!(Ft&&Zt(ae,U))){if(!(jt&&Zt(be,U))){if(Te){if(!ft[U]){if(!Zt(me,yi(ee,Ae,""))){if(!((U==="src"||U==="xlink:href"||U==="href")&&T!=="script"&&Zm(ee,"data:")===0&&Ze[T])){if(!(Ot&&!Zt(_e,yi(ee,Ae,"")))){if(ee)return!1}}}}}else if(!(Po(T)&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,T)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(T))&&(Ue.attributeNameCheck instanceof RegExp&&Zt(Ue.attributeNameCheck,U)||Ue.attributeNameCheck instanceof Function&&Ue.attributeNameCheck(U,T))||U==="is"&&Ue.allowCustomizedBuiltInElements&&(Ue.tagNameCheck instanceof RegExp&&Zt(Ue.tagNameCheck,ee)||Ue.tagNameCheck instanceof Function&&Ue.tagNameCheck(ee))))return!1}}return!0},Oo=Ke({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Po=function(T){return!Oo[bi(T)]&&Zt(je,T)},$o=function(T,U,ee,Te){if(K&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ee)switch(k.getAttributeType(T,U)){case"TrustedHTML":return Se(Te);case"TrustedScriptURL":return Oe(Te)}return Te},kr=function(T,U,ee,Te){try{ee?T.setAttributeNS(ee,U,Te):T.setAttribute(U,Te),Hr(T)?ys(T):Ym(n.removed)}catch{xs(U,T)}},Qi=function(T){wn(P.beforeSanitizeAttributes,T,null);const U=T.attributes;if(!U||Hr(T))return;Ie=wr(P.uponSanitizeAttribute,Ie,mt,_t);const ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ie,forceKeepAttr:void 0};let Te=U.length;const Re=We(T.nodeName);for(;Te--;){const Fe=U[Te],Ye=Fe.name,et=Fe.namespaceURI,bt=Fe.value,Nt=We(Ye),js=bt;let Dt=Ye==="value"?js:SN(js);if(ee.attrName=Nt,ee.attrValue=Dt,ee.keepAttr=!0,ee.forceKeepAttr=void 0,wn(P.uponSanitizeAttribute,T,ee),Dt=ee.attrValue,ms&&(Nt==="id"||Nt==="name")&&Zm(Dt,ns)!==0&&(xs(Ye,T),Dt=ns+Dt),Be&&Zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Dt)){xs(Ye,T);continue}if(Nt==="attributename"&&Qm(Dt,"href")){xs(Ye,T);continue}if(!ee.forceKeepAttr){if(!ee.keepAttr){xs(Ye,T);continue}if(!Y&&Zt(UN,Dt)){xs(Ye,T);continue}if(ge&&(Dt=Wr(Dt)),!Yi(Re,Nt,Dt)){xs(Ye,T);continue}Dt=$o(Re,Nt,et,Dt),Dt!==js&&kr(T,Ye,et,Dt)}}wn(P.afterSanitizeAttributes,T,null)},Hs=function(T){let U=null;const ee=zn(T);for(wn(P.beforeSanitizeShadowDOM,T,null);U=ee.nextNode();)if(wn(P.uponSanitizeShadowNode,U,null),Xi(U,T),Qi(U),Ws(U.content)&&Hs(U.content),(I?I(U):U.nodeType)===Hn.element){const Re=R(U);Ws(Re)&&(Xe(Re),Hs(Re))}wn(P.afterSanitizeShadowDOM,T,null)},Xe=function(T){const U=[{node:T,shadow:null}];for(;U.length>0;){const ee=U.pop();if(ee.shadow){Hs(ee.shadow);continue}const Te=ee.node,Fe=(I?I(Te):Te.nodeType)===Hn.element,Ye=N(Te);if(Ye)for(let et=Ye.length-1;et>=0;--et)U.push({node:Ye[et],shadow:null});if(Fe){const et=L?L(Te):null;if(typeof et=="string"&&We(et)==="template"){const bt=Te.content;Ws(bt)&&U.push({node:bt,shadow:null})}}if(Fe){const et=R(Te);Ws(et)&&U.push({node:null,shadow:et},{node:et,shadow:null})}}};return n.sanitize=function(ue){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,ee=null,Te=null,Re=null;if(ot=!ue,ot&&(ue="<!-->"),typeof ue!="string"&&!yr(ue)&&(ue=EN(ue),typeof ue!="string"))throw Mr("dirty is not a string, aborting");if(!n.isSupported)return ue;gt?(pe=vt,Ie=_t):$n(T),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(pe=pn(pe)),P.uponSanitizeAttribute.length>0&&(Ie=pn(Ie)),n.removed=[];const Fe=gn&&typeof ue!="string"&&yr(ue);if(Fe){qi(ue);const bt=L?L(ue):ue.nodeName;if(typeof bt=="string"){const Nt=We(bt);if(!pe[Nt]||Vt[Nt])throw Bs(ue),Mr("root node is forbidden and cannot be sanitized in-place")}if(Hr(ue))throw Bs(ue),Mr("root node is clobbered and cannot be sanitized in-place");try{Xe(ue)}catch(Nt){throw Bs(ue),Nt}}else if(yr(ue))U=vr("<!---->"),ee=U.ownerDocument.importNode(ue,!0),ee.nodeType===Hn.element&&ee.nodeName==="BODY"||ee.nodeName==="HTML"?U=ee:U.appendChild(ee),Xe(ee);else{if(!dt&&!ge&&!st&&ue.indexOf("<")===-1)return K&&Ln?Se(ue):ue;if(U=vr(ue),!U)return dt?null:Ln?$:""}U&&an&&ys(U.firstChild);const Ye=Fe?ue:U;try{const bt=zn(Ye);for(;Te=bt.nextNode();)Xi(Te,Ye),Qi(Te),Ws(Te.content)&&Hs(Te.content)}catch(bt){throw Fe&&(Bs(ue),mo(n.removed,Nt=>{Nt.element&&gr(Nt.element)})),bt}if(Fe)return mo(n.removed,bt=>{bt.element&&gr(bt.element)}),ge&&xn(ue),ue;if(dt){if(ge&&xn(U),Mn)for(Re=Q.call(U.ownerDocument);U.firstChild;)Re.appendChild(U.firstChild);else Re=U;return(Ie.shadowroot||Ie.shadowrootmode)&&(Re=D.call(i,Re,!0)),Re}let et=st?U.outerHTML:U.innerHTML;return st&&pe["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&Zt($N,U.ownerDocument.doctype.name)&&(et="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
|
|
506
|
-
`+et),ge&&(et=Wr(et)),K&&Ln?Se(et):et},n.setConfig=function(){let ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$n(ue),gt=!0,vt=pe,_t=Ie},n.clearConfig=function(){yn=null,gt=!1,vt=null,_t=null,K=Z,$=""},n.isValidAttribute=function(ue,T,U){yn||$n({});const ee=We(ue),Te=We(T);return Yi(ee,Te,U)},n.addHook=function(ue,T){typeof T=="function"&&Jt(P,ue)&&go(P[ue],T)},n.removeHook=function(ue,T){if(Jt(P,ue)){if(T!==void 0){const U=wN(P[ue],T);return U===-1?void 0:kN(P[ue],U,1)[0]}return Ym(P[ue])}},n.removeHooks=function(ue){Jt(P,ue)&&(P[ue]=[])},n.removeAllHooks=function(){P=lg()},n}var pf=Ty();const HN=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),VN=100;function cg(t){return HN.has(t.type)}function KN({items:t,runtimeType:n,turn:r,threads:i=[]}){const[l,c]=x.useState(!1),[d,p]=x.useState(!1);if(t.length===0)return null;const g=t.length,m=d?0:Math.max(0,g-VN),v=m>0?t.slice(m):t;return a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>c(k=>!k),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(T1,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[g," tool call",g>1?"s":""]}),a.jsx(Di,{size:14,className:"tool-calls-chevron",style:{transform:l?"rotate(90deg)":"none"}})]}),l&&a.jsxs("div",{className:"tool-calls-body",children:[m>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>p(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Lr,{item:k,runtimeType:n,turn:r,threads:i},k.id))]})]})}Ge.setOptions({breaks:!0,gfm:!0});function GN(t){const n=Ge.parse(t);return pf.sanitize(n)}function ug(t,n){var l;const r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let i=0;for(;r.nextNode();){const c=r.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(i+d>n)return{node:c,offset:n-i};i+=d}return null}function qN(t,n,r){const i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),l=[];for(;i.nextNode();){const c=i.currentNode;if(!c.textContent||c.textContent.trim()==="")continue;const d=document.createRange();d.selectNodeContents(c),!(d.compareBoundaryPoints(Range.START_TO_END,n)<=0)&&(d.compareBoundaryPoints(Range.END_TO_START,n)>=0||l.push(c))}for(const c of l){const d=c.length;let p=0,g=d;if(c===n.startContainer&&(p=Math.min(n.startOffset,d)),c===n.endContainer&&(g=Math.min(n.endOffset,d)),p>=g)continue;g<d&&c.splitText(g);const m=p>0?c.splitText(p):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function XN(t,n){t.querySelectorAll("mark[data-thread-id]").forEach(r=>{const i=r.parentNode;if(!i)return;const l=document.createTextNode(r.textContent||"");i.replaceChild(l,r),i.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const i=ug(t,r.start_offset),l=ug(t,r.end_offset);if(!i||!l)continue;const c=document.createRange();c.setStart(i.node,i.offset),c.setEnd(l.node,l.offset),qN(t,c,()=>{const d=document.createElement("mark");return d.setAttribute("data-thread-id",r.id),r.status==="resolved"&&d.classList.add("thread-mark-resolved"),d})}}function YN(t){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!t.contains(r.commonAncestorContainer))return null;const i=document.createRange();i.setStart(t,0),i.setEnd(r.startContainer,r.startOffset);const l=i.toString().length,c=r.toString();return{start:l,end:l+c.length,text:c}}function QN({itemId:t,turnId:n,sessionId:r,content:i,threads:l}){const c=x.useRef(null),d=x.useRef(null),p=x.useRef(null),g=x.useRef(""),m=x.useRef(0),[v,k]=x.useState(!1),[y,S]=x.useState({x:0,y:0}),[C,b]=x.useState(!1),[N,E]=x.useState({x:0,y:0}),[R,z]=x.useState(""),[I,L]=x.useState(null),[q,K]=x.useState(!1),$=A(G=>G.createThread),Z=A(G=>G.switchRightTab),he=A(G=>Wl(G.sessionDetails[r])),ce=x.useCallback(async()=>{await $i(i||""),K(!0),setTimeout(()=>K(!1),1500)},[i]),ye=x.useCallback(()=>{var D;if(!I)return;const G=`
|
|
507
|
-
\`\`\`QUOTE
|
|
508
|
-
${I.text}
|
|
509
|
-
\`\`\`
|
|
510
|
-
|
|
511
|
-
`;A.setState({quotedText:G}),k(!1),L(null),(D=window.getSelection())==null||D.removeAllRanges()},[I]),Se=x.useMemo(()=>GN(i||"…"),[i]),Oe=x.useMemo(()=>l.filter(G=>G.item_id===t),[l,t]);x.useEffect(()=>{c.current&&XN(c.current,Oe)},[Se,Oe]),x.useEffect(()=>{g.current=R},[R]),x.useEffect(()=>{function G(D){d.current&&!d.current.contains(D.target)&&(k(!1),g.current.trim()||b(!1))}return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[]);const J=x.useCallback(()=>{k(!1),g.current.trim()||b(!1)},[]),re=x.useCallback(()=>{const G=c.current;if(!G)return;const D=YN(G);if(D&&D.text.trim().length>0){const P=window.getSelection();if(P&&P.rangeCount>0&&P.anchorNode&&P.focusNode){const W=P.getRangeAt(0).getBoundingClientRect(),X=28,ae=6,be=170;let _e=!1;try{const me=document.createRange();me.setStart(P.focusNode,P.focusOffset),me.setEnd(P.focusNode,P.focusOffset);const pe=document.createRange();pe.setStart(P.anchorNode,P.anchorOffset),pe.setEnd(P.anchorNode,P.anchorOffset),_e=pe.compareBoundaryPoints(Range.START_TO_START,me)>0}catch{_e=!1}let Ae=W.top-X-ae;Ae<8&&(Ae=W.bottom+ae);let je=_e?W.left-be:W.right;je=Math.max(8,Math.min(je,window.innerWidth-be-8)),S({x:je,y:Ae}),k(!0),L(D)}}else k(!1)},[]);x.useEffect(()=>{function G(D){const P=D.target;P&&(P.closest(".selection-actions")||P.closest(".thread-create-popover"))||re()}return document.addEventListener("mouseup",G),()=>document.removeEventListener("mouseup",G)},[re]);const oe=x.useCallback(()=>{k(!1),b(!0),E({x:y.x,y:y.y})},[y]);x.useLayoutEffect(()=>{if(!C)return;const G=p.current;if(!G)return;const D=G.offsetWidth,P=G.offsetHeight,le=8;let W=y.x,X=y.y;W-D<le&&(W=D+le),W>window.innerWidth-le&&(W=window.innerWidth-le),X<le&&(X=le),X+P>window.innerHeight-le&&(X=window.innerHeight-P-le),E({x:W,y:X})},[C,y]);const F=x.useCallback(async()=>{var G;he||!I||!R.trim()||(await $(r,{itemId:t,turnId:n,startOffset:I.start,endOffset:I.end,selectedText:I.text,message:R.trim()}),z(""),b(!1),L(null),(G=window.getSelection())==null||G.removeAllRanges(),Z("threads"))},[I,R,$,r,t,n,Z,he]),Q=x.useCallback(G=>{const D=G.target;if(D.tagName==="MARK"&&D.hasAttribute("data-thread-id")){G.preventDefault(),Z("threads");const P=D.getAttribute("data-thread-id");setTimeout(()=>{const le=document.getElementById(`thread-${P}`);le&&(le.scrollIntoView({behavior:"smooth",block:"center"}),le.classList.add("thread-card-highlighted"),setTimeout(()=>le.classList.remove("thread-card-highlighted"),1500))},100)}},[Z]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:Se},onMouseDown:J,onClick:Q}),a.jsx("button",{className:`copy-text-btn${q?" copied":""}`,onClick:ce,title:q?"Copied":"Copy message","aria-label":"Copy message text",children:q?a.jsx(Ts,{size:14}):a.jsx(Mi,{size:14})}),v&&!C&&a.jsxs("div",{className:"selection-actions",style:{left:y.x,top:y.y},children:[!he&&a.jsxs("button",{className:"discuss-button",onClick:oe,title:"Start a discussion about this text",children:[a.jsx(c1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:ye,title:"Quote this text in your message",children:[a.jsx(Rv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),C&&a.jsxs("div",{ref:p,className:"thread-create-popover",style:{left:N.x,top:N.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',I==null?void 0:I.text.slice(0,80),I&&I.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{b(!1),L(null)},children:a.jsx(Nn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:R,onChange:G=>z(G.target.value),autoFocus:!0,rows:2,onKeyDown:G=>{if(G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&(G.preventDefault(),F()),G.key==="Escape")if(g.current.trim()){const D=Date.now();m.current&&D-m.current<400?(m.current=0,b(!1),L(null)):m.current=D}else b(!1),L(null)}}),a.jsxs("div",{className:"thread-create-footer",children:[a.jsx("span",{className:"thread-create-hint",children:"⌘↵ to send · Esc to cancel"}),a.jsxs("button",{className:"thread-create-send",onClick:F,disabled:!R.trim()||he,title:he?"Wait for the running turn to finish first":void 0,children:[a.jsx(Bi,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const dg=x.memo(QN),zl=new Map,Cy=new Set,Td=new Set,fg=new Map;function Ey(){Td.forEach(t=>t())}function jy(t,n){return`${t}:${n}`}function ZN(t,n,r,i,l){var g;const c=jy(n,r),d=zl.get(t)??new Map,p=new Map(d);((g=p.get(c))==null?void 0:g.answer)===l?p.delete(c):p.set(c,{itemIndex:n,groupIndex:r,question:i,answer:l}),zl.set(t,p),Ey()}function JN(t){zl.delete(t),Ey()}function eT(t){Cy.add(t),JN(t)}function tT(t){const n=x.useCallback(r=>(Td.add(r),()=>{Td.delete(r)}),[]);return x.useSyncExternalStore(n,()=>zl.get(t)??fg,()=>fg)}function nT(t){return[...t].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
|
|
512
|
-
${n.answer}`).join(`
|
|
513
|
-
|
|
514
|
-
`)}function pg({item:t,turn:n}){var S;const r=t.data??{},i=x.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(C=>!!C&&Array.isArray(C.selections)&&C.selections.length>0):[],[r.groups]),l=tT(n.id),c=A(C=>n.session_id?C.sessionDetails[n.session_id]:null),d=A(C=>C.activeSessionId),p=n.items.filter(C=>C.type==="ask_user"||C.type==="final_result").findIndex(C=>C.id===t.id),g=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,m=Cy.has(n.id),v=m||sv(c)||!g||n.session_id!==d,k=(C,b,N)=>{v||ZN(n.id,p,C,b,N)},y=()=>{const C=[...l.values()];if(C.length===0)return;const b=nT(C);eT(n.id),A.getState().submitPrompt(b)};return a.jsxs("div",{className:"render-content ask-user-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(qk,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),i.length>0?a.jsxs("div",{className:"ask-user-groups",children:[i.map((C,b)=>a.jsxs("div",{className:"ask-user-group",children:[C.question&&a.jsx("div",{className:"ask-user-question",children:C.question}),a.jsx("div",{className:"ask-user-options",children:C.selections.map(N=>{var R;const E=((R=l.get(jy(p,b)))==null?void 0:R.answer)===N;return a.jsx("button",{type:"button",className:`ask-user-option ${E?"selected":""}`,disabled:v,onClick:()=>k(b,C.question,N),children:N},N)})})]},b)),v?m&&a.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):a.jsxs("button",{type:"button",className:"ask-user-send",disabled:l.size===0,onClick:y,children:[a.jsx(Bi,{size:12}),"Send"]})]}):r.question?a.jsx("p",{className:"user-message",children:r.question}):a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Waiting for user response"})]})}const sT={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function ml(t){return t&&sT[t]||"interrupted"}function Fl(t){if(!t)return"";const n=new Date(t);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function rT(t){switch(t.interrupt_reason){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"auth":return"Interrupted — Claude is signed out. Sign in again from a terminal, then resume.";case"usage_limit":{const n=Fl(t.resume_at);return n?`Usage limit reached — resumes at ${n}.`:"Usage limit reached — resume once it is over."}case"process_exit":return"Interrupted — the agent process stopped. Resuming automatically…";case"host_shutdown":return"Interrupted — the agent host shut down. Resuming automatically…";default:return"Interrupted — the agent host restarted. Resuming automatically…"}}function oT(t){return t.items.filter(n=>n.type==="interruption").map(n=>n.data)}function iT({item:t}){const n=t.data,r=Fl(n.interrupted_at);let i="";switch(n.outcome){case"waiting":i="waiting to resume";break;case"resuming":i="resuming…";break;case"resumed":i=n.resumed_at?`resumed ${Fl(n.resumed_at)}`:"resumed";break;case"cancelled":i="stopped";break;case"unsupported":i="cannot be resumed";break;default:i="not resumed"}return a.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",ml(n.reason),") · ",i]})})}function aT({turn:t,label:n}){const[r,i]=x.useState(!1),l=A(d=>d.addToast),c=()=>{i(!0),J0(t.session_id,t.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>i(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[a.jsx(Av,{size:12}),n]})}function lT({turn:t}){const n=t.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=t.interrupt_reason,i=oT(t),l=i[i.length-1],c=Fl(t.interrupted_at??(l==null?void 0:l.interrupted_at));let d,p=null,g=null;switch(n){case"waiting":{const m=r==="usage_limit"&&!t.resume_at;d=rT(t),p=m?(l==null?void 0:l.detail)??null:null,g=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${ml(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(i.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,p=t.error&&!t.error.startsWith("Automatic resume stopped")?t.error:null,g="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${ml(r)}) — too long ago to resume automatically.`,g="Resume";break;default:d=`Interrupted (${ml(r)}) — this turn cannot be resumed.`,p=t.error}return a.jsxs("div",{className:"interruption-banner","data-state":n,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(Lv,{size:12}):a.jsx(Gl,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,p&&a.jsx("span",{className:"banner-detail",children:p})]}),g&&a.jsx(aT,{turn:t,label:g})]})}function cT({turnId:t}){const n=A(i=>i.retryStates[t]);if(!n)return null;const r=n.errorStatus?`API error ${n.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Lv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const uT='(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.morphdom=factory())})(this,function(){"use strict";var DOCUMENT_FRAGMENT_NODE=11;function morphAttrs(fromNode,toNode){var toNodeAttrs=toNode.attributes;var attr;var attrName;var attrNamespaceURI;var attrValue;var fromValue;if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE||fromNode.nodeType===DOCUMENT_FRAGMENT_NODE){return}for(var i=toNodeAttrs.length-1;i>=0;i--){attr=toNodeAttrs[i];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;attrValue=attr.value;if(attrNamespaceURI){attrName=attr.localName||attrName;fromValue=fromNode.getAttributeNS(attrNamespaceURI,attrName);if(fromValue!==attrValue){if(attr.prefix==="xmlns"){attrName=attr.name}fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue)}}else{fromValue=fromNode.getAttribute(attrName);if(fromValue!==attrValue){fromNode.setAttribute(attrName,attrValue)}}}var fromNodeAttrs=fromNode.attributes;for(var d=fromNodeAttrs.length-1;d>=0;d--){attr=fromNodeAttrs[d];attrName=attr.name;attrNamespaceURI=attr.namespaceURI;if(attrNamespaceURI){attrName=attr.localName||attrName;if(!toNode.hasAttributeNS(attrNamespaceURI,attrName)){fromNode.removeAttributeNS(attrNamespaceURI,attrName)}}else{if(!toNode.hasAttribute(attrName)){fromNode.removeAttribute(attrName)}}}}var range;var NS_XHTML="http://www.w3.org/1999/xhtml";var doc=typeof document==="undefined"?undefined:document;var HAS_TEMPLATE_SUPPORT=!!doc&&"content"in doc.createElement("template");var HAS_RANGE_SUPPORT=!!doc&&doc.createRange&&"createContextualFragment"in doc.createRange();function createFragmentFromTemplate(str){var template=doc.createElement("template");template.innerHTML=str;return template.content.childNodes[0]}function createFragmentFromRange(str){if(!range){range=doc.createRange();range.selectNode(doc.body)}var fragment=range.createContextualFragment(str);return fragment.childNodes[0]}function createFragmentFromWrap(str){var fragment=doc.createElement("body");fragment.innerHTML=str;return fragment.childNodes[0]}function toElement(str){str=str.trim();if(HAS_TEMPLATE_SUPPORT){return createFragmentFromTemplate(str)}else if(HAS_RANGE_SUPPORT){return createFragmentFromRange(str)}return createFragmentFromWrap(str)}function compareNodeNames(fromEl,toEl){var fromNodeName=fromEl.nodeName;var toNodeName=toEl.nodeName;var fromCodeStart,toCodeStart;if(fromNodeName===toNodeName){return true}fromCodeStart=fromNodeName.charCodeAt(0);toCodeStart=toNodeName.charCodeAt(0);if(fromCodeStart<=90&&toCodeStart>=97){return fromNodeName===toNodeName.toUpperCase()}else if(toCodeStart<=90&&fromCodeStart>=97){return toNodeName===fromNodeName.toUpperCase()}else{return false}}function createElementNS(name,namespaceURI){return!namespaceURI||namespaceURI===NS_XHTML?doc.createElement(name):doc.createElementNS(namespaceURI,name)}function moveChildren(fromEl,toEl){var curChild=fromEl.firstChild;while(curChild){var nextChild=curChild.nextSibling;toEl.appendChild(curChild);curChild=nextChild}return toEl}function syncBooleanAttrProp(fromEl,toEl,name){if(fromEl[name]!==toEl[name]){fromEl[name]=toEl[name];if(fromEl[name]){fromEl.setAttribute(name,"")}else{fromEl.removeAttribute(name)}}}var specialElHandlers={OPTION:function(fromEl,toEl){var parentNode=fromEl.parentNode;if(parentNode){var parentName=parentNode.nodeName.toUpperCase();if(parentName==="OPTGROUP"){parentNode=parentNode.parentNode;parentName=parentNode&&parentNode.nodeName.toUpperCase()}if(parentName==="SELECT"&&!parentNode.hasAttribute("multiple")){if(fromEl.hasAttribute("selected")&&!toEl.selected){fromEl.setAttribute("selected","selected");fromEl.removeAttribute("selected")}parentNode.selectedIndex=-1}}syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked");syncBooleanAttrProp(fromEl,toEl,"disabled");if(fromEl.value!==toEl.value){fromEl.value=toEl.value}if(!toEl.hasAttribute("value")){fromEl.removeAttribute("value")}},TEXTAREA:function(fromEl,toEl){var newValue=toEl.value;if(fromEl.value!==newValue){fromEl.value=newValue}var firstChild=fromEl.firstChild;if(firstChild){var oldValue=firstChild.nodeValue;if(oldValue==newValue||!newValue&&oldValue==fromEl.placeholder){return}firstChild.nodeValue=newValue}},SELECT:function(fromEl,toEl){if(!toEl.hasAttribute("multiple")){var selectedIndex=-1;var i=0;var curChild=fromEl.firstChild;var optgroup;var nodeName;while(curChild){nodeName=curChild.nodeName&&curChild.nodeName.toUpperCase();if(nodeName==="OPTGROUP"){optgroup=curChild;curChild=optgroup.firstChild;if(!curChild){curChild=optgroup.nextSibling;optgroup=null}}else{if(nodeName==="OPTION"){if(curChild.hasAttribute("selected")){selectedIndex=i;break}i++}curChild=curChild.nextSibling;if(!curChild&&optgroup){curChild=optgroup.nextSibling;optgroup=null}}}fromEl.selectedIndex=selectedIndex}}};var ELEMENT_NODE=1;var DOCUMENT_FRAGMENT_NODE$1=11;var TEXT_NODE=3;var COMMENT_NODE=8;function noop(){}function defaultGetNodeKey(node){if(node){return node.getAttribute&&node.getAttribute("id")||node.id}}function morphdomFactory(morphAttrs){return function morphdom(fromNode,toNode,options){if(!options){options={}}if(typeof toNode==="string"){if(fromNode.nodeName==="#document"||fromNode.nodeName==="HTML"){var toNodeHtml=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeHtml}else if(fromNode.nodeName==="BODY"){var toNodeBody=toNode;toNode=doc.createElement("html");toNode.innerHTML=toNodeBody;var bodyElement=toNode.querySelector("body");if(bodyElement){toNode=bodyElement}}else{toNode=toElement(toNode)}}else if(toNode.nodeType===DOCUMENT_FRAGMENT_NODE$1){toNode=toNode.firstElementChild}var getNodeKey=options.getNodeKey||defaultGetNodeKey;var onBeforeNodeAdded=options.onBeforeNodeAdded||noop;var onNodeAdded=options.onNodeAdded||noop;var onBeforeElUpdated=options.onBeforeElUpdated||noop;var onElUpdated=options.onElUpdated||noop;var onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop;var onNodeDiscarded=options.onNodeDiscarded||noop;var onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop;var skipFromChildren=options.skipFromChildren||noop;var addChild=options.addChild||function(parent,child){return parent.appendChild(child)};var childrenOnly=options.childrenOnly===true;var fromNodesLookup=Object.create(null);var keyedRemovalList=[];function addKeyedRemoval(key){keyedRemovalList.push(key)}function walkDiscardedChildNodes(node,skipKeyedNodes){if(node.nodeType===ELEMENT_NODE){var curChild=node.firstChild;while(curChild){var key=undefined;if(skipKeyedNodes&&(key=getNodeKey(curChild))){addKeyedRemoval(key)}else{onNodeDiscarded(curChild);if(curChild.firstChild){walkDiscardedChildNodes(curChild,skipKeyedNodes)}}curChild=curChild.nextSibling}}}function removeNode(node,parentNode,skipKeyedNodes){if(onBeforeNodeDiscarded(node)===false){return}if(parentNode){parentNode.removeChild(node)}onNodeDiscarded(node);walkDiscardedChildNodes(node,skipKeyedNodes)}function indexTree(node){if(node.nodeType===ELEMENT_NODE||node.nodeType===DOCUMENT_FRAGMENT_NODE$1){var curChild=node.firstChild;while(curChild){var key=getNodeKey(curChild);if(key){fromNodesLookup[key]=curChild}indexTree(curChild);curChild=curChild.nextSibling}}}indexTree(fromNode);function handleNodeAdded(el){onNodeAdded(el);var curChild=el.firstChild;while(curChild){var nextSibling=curChild.nextSibling;var key=getNodeKey(curChild);if(key){var unmatchedFromEl=fromNodesLookup[key];if(unmatchedFromEl&&compareNodeNames(curChild,unmatchedFromEl)){curChild.parentNode.replaceChild(unmatchedFromEl,curChild);morphEl(unmatchedFromEl,curChild)}else{handleNodeAdded(curChild)}}else{handleNodeAdded(curChild)}curChild=nextSibling}}function cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey){while(curFromNodeChild){var fromNextSibling=curFromNodeChild.nextSibling;if(curFromNodeKey=getNodeKey(curFromNodeChild)){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);if(toElKey){delete fromNodesLookup[toElKey]}if(!childrenOnly){var beforeUpdateResult=onBeforeElUpdated(fromEl,toEl);if(beforeUpdateResult===false){return}else if(beforeUpdateResult instanceof HTMLElement){fromEl=beforeUpdateResult;indexTree(fromEl)}morphAttrs(fromEl,toEl);onElUpdated(fromEl);if(onBeforeElChildrenUpdated(fromEl,toEl)===false){return}}if(fromEl.nodeName!=="TEXTAREA"){morphChildren(fromEl,toEl)}else{specialElHandlers.TEXTAREA(fromEl,toEl)}}function morphChildren(fromEl,toEl){var skipFrom=skipFromChildren(fromEl,toEl);var curToNodeChild=toEl.firstChild;var curFromNodeChild=fromEl.firstChild;var curToNodeKey;var curFromNodeKey;var fromNextSibling;var toNextSibling;var matchingFromEl;outer:while(curToNodeChild){toNextSibling=curToNodeChild.nextSibling;curToNodeKey=getNodeKey(curToNodeChild);while(!skipFrom&&curFromNodeChild){fromNextSibling=curFromNodeChild.nextSibling;if(curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType;var isCompatible=undefined;if(curFromNodeType===curToNodeChild.nodeType){if(curFromNodeType===ELEMENT_NODE){if(curToNodeKey){if(curToNodeKey!==curFromNodeKey){if(matchingFromEl=fromNodesLookup[curToNodeKey]){if(fromNextSibling===matchingFromEl){isCompatible=false}else{fromEl.insertBefore(matchingFromEl,curFromNodeChild);if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=matchingFromEl;curFromNodeKey=getNodeKey(curFromNodeChild)}}else{isCompatible=false}}}else if(curFromNodeKey){isCompatible=false}isCompatible=isCompatible!==false&&compareNodeNames(curFromNodeChild,curToNodeChild);if(isCompatible){morphEl(curFromNodeChild,curToNodeChild)}}else if(curFromNodeType===TEXT_NODE||curFromNodeType==COMMENT_NODE){isCompatible=true;if(curFromNodeChild.nodeValue!==curToNodeChild.nodeValue){curFromNodeChild.nodeValue=curToNodeChild.nodeValue}}}if(isCompatible){curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling;continue outer}if(curFromNodeKey){addKeyedRemoval(curFromNodeKey)}else{removeNode(curFromNodeChild,fromEl,true)}curFromNodeChild=fromNextSibling}if(curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)){if(!skipFrom){addChild(fromEl,matchingFromEl)}morphEl(matchingFromEl,curToNodeChild)}else{var onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild);if(onBeforeNodeAddedResult!==false){if(onBeforeNodeAddedResult){curToNodeChild=onBeforeNodeAddedResult}if(curToNodeChild.actualize){curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)}addChild(fromEl,curToNodeChild);handleNodeAdded(curToNodeChild)}}curToNodeChild=toNextSibling;curFromNodeChild=fromNextSibling}cleanupFromEl(fromEl,curFromNodeChild,curFromNodeKey);var specialElHandler=specialElHandlers[fromEl.nodeName];if(specialElHandler){specialElHandler(fromEl,toEl)}}var morphedNode=fromNode;var morphedNodeType=morphedNode.nodeType;var toNodeType=toNode.nodeType;if(!childrenOnly){if(morphedNodeType===ELEMENT_NODE){if(toNodeType===ELEMENT_NODE){if(!compareNodeNames(fromNode,toNode)){onNodeDiscarded(fromNode);morphedNode=moveChildren(fromNode,createElementNS(toNode.nodeName,toNode.namespaceURI))}}else{morphedNode=toNode}}else if(morphedNodeType===TEXT_NODE||morphedNodeType===COMMENT_NODE){if(toNodeType===morphedNodeType){if(morphedNode.nodeValue!==toNode.nodeValue){morphedNode.nodeValue=toNode.nodeValue}return morphedNode}else{morphedNode=toNode}}}if(morphedNode===toNode){onNodeDiscarded(fromNode)}else{if(toNode.isSameNode&&toNode.isSameNode(morphedNode)){return}morphEl(morphedNode,toNode,childrenOnly);if(keyedRemovalList){for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];if(elToRemove){removeNode(elToRemove,elToRemove.parentNode,false)}}}}if(!childrenOnly&&morphedNode!==fromNode&&fromNode.parentNode){if(morphedNode.actualize){morphedNode=morphedNode.actualize(fromNode.ownerDocument||doc)}fromNode.parentNode.replaceChild(morphedNode,fromNode)}return morphedNode}}var morphdom=morphdomFactory(morphAttrs);return morphdom});',dT=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],_y="agentpane-widget",Ry="agentpane-pane",Ay="allow-scripts allow-popups allow-popups-to-escape-sandbox",wi=dT.join(" "),Iy=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${wi}`,`style-src 'unsafe-inline' ${wi}`,`img-src data: blob: ${wi}`,`font-src data: ${wi}`,`connect-src ${wi}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Dy(){const t=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,i)=>(t==null?void 0:t.getPropertyValue(r).trim())||i;return{"--color-text-primary":n("--text","#1c1b18"),"--color-text-secondary":n("--text-2","#54504a"),"--color-text-muted":n("--text-3","#78736c"),"--color-background-primary":n("--canvas","#fdfdfc"),"--color-background-secondary":n("--surface-0","#f8f7f5"),"--color-border":n("--border","#e2e0db"),"--color-accent":n("--accent","#d97706"),"--font-sans":n("--font-sans","'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"),"--font-mono":n("--font-mono","'JetBrains Mono', 'SF Mono', 'Fira Code', monospace"),"--radius":n("--r-lg","8px"),"--color-series-1":"#2a78d6","--color-series-2":"#eb6834","--color-series-3":"#1baf7a","--color-series-4":"#eda100","--color-series-5":"#e87ba4","--color-series-6":"#008300","--color-series-7":"#6250d6","--color-series-8":"#e34948","--color-good":"#0ca30c","--color-warning":"#fab219","--color-serious":"#ec835a","--color-critical":"#d03b3b"}}const My=`window.addEventListener('click', function (e) {
|
|
515
|
-
if (e.defaultPrevented || e.button !== 0) return;
|
|
516
|
-
var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
|
|
517
|
-
if (!a) return;
|
|
518
|
-
var href = (a.getAttribute('href') || '').trim();
|
|
519
|
-
if (href.charAt(0) === '#' || /^javascript:/i.test(href)) return;
|
|
520
|
-
e.preventDefault();
|
|
521
|
-
if (!/^https?:\\/\\//i.test(href)) return;
|
|
522
|
-
try {
|
|
523
|
-
window.open(new URL(href).href, '_blank', 'noopener,noreferrer');
|
|
524
|
-
} catch (err) {}
|
|
525
|
-
});`,fT=`(function () {
|
|
526
|
-
var SELF = '${_y}';
|
|
527
|
-
var PANE = '${Ry}';
|
|
528
|
-
var SCRIPT_TIMEOUT_MS = 15000;
|
|
529
|
-
var root = document.getElementById('root');
|
|
530
|
-
var finished = false;
|
|
531
|
-
var lastHtml = null;
|
|
532
|
-
|
|
533
|
-
function post(msg) {
|
|
534
|
-
msg.source = SELF;
|
|
535
|
-
parent.postMessage(msg, '*');
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function parse(html, keepScripts) {
|
|
539
|
-
var tmp = document.createElement('div');
|
|
540
|
-
tmp.innerHTML = html;
|
|
541
|
-
if (!keepScripts) {
|
|
542
|
-
var scripts = tmp.querySelectorAll('script');
|
|
543
|
-
for (var i = 0; i < scripts.length; i++) scripts[i].remove();
|
|
544
|
-
}
|
|
545
|
-
return tmp;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
function morph(html, isFinal) {
|
|
549
|
-
var added = new Set();
|
|
550
|
-
morphdom(root, parse(html, isFinal), {
|
|
551
|
-
childrenOnly: true,
|
|
552
|
-
onBeforeElUpdated: function (from, to) { return !from.isEqualNode(to); },
|
|
553
|
-
onNodeAdded: function (node) {
|
|
554
|
-
added.add(node);
|
|
555
|
-
if (!isFinal && node.nodeType === 1 && node.animate && !added.has(node.parentNode)) {
|
|
556
|
-
node.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: 'ease-out' });
|
|
557
|
-
}
|
|
558
|
-
return node;
|
|
559
|
-
},
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// Scripts parsed by innerHTML never run; replace each with a fresh copy.
|
|
564
|
-
function runScripts(done) {
|
|
565
|
-
var scripts = Array.prototype.slice.call(root.querySelectorAll('script'));
|
|
566
|
-
var i = 0;
|
|
567
|
-
function next() {
|
|
568
|
-
if (i >= scripts.length) return done();
|
|
569
|
-
var old = scripts[i++];
|
|
570
|
-
var s = document.createElement('script');
|
|
571
|
-
for (var a = 0; a < old.attributes.length; a++) s.setAttribute(old.attributes[a].name, old.attributes[a].value);
|
|
572
|
-
s.text = old.textContent || '';
|
|
573
|
-
if (!old.src) {
|
|
574
|
-
old.replaceWith(s);
|
|
575
|
-
return next();
|
|
576
|
-
}
|
|
577
|
-
s.async = false;
|
|
578
|
-
var settled = false;
|
|
579
|
-
var timer = setTimeout(go, SCRIPT_TIMEOUT_MS);
|
|
580
|
-
function go() {
|
|
581
|
-
if (settled) return;
|
|
582
|
-
settled = true;
|
|
583
|
-
clearTimeout(timer);
|
|
584
|
-
next();
|
|
585
|
-
}
|
|
586
|
-
s.onload = go;
|
|
587
|
-
s.onerror = function () {
|
|
588
|
-
post({ type: 'error', message: 'Could not load ' + old.src });
|
|
589
|
-
go();
|
|
590
|
-
};
|
|
591
|
-
old.replaceWith(s);
|
|
592
|
-
}
|
|
593
|
-
next();
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
function finish() {
|
|
597
|
-
document.dispatchEvent(new Event('DOMContentLoaded', { bubbles: true }));
|
|
598
|
-
window.dispatchEvent(new Event('load'));
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
window.addEventListener('message', function (e) {
|
|
602
|
-
if (e.source !== parent) return;
|
|
603
|
-
var msg = e.data;
|
|
604
|
-
if (!msg || msg.source !== PANE || msg.type !== 'content' || finished) return;
|
|
605
|
-
var html = typeof msg.html === 'string' ? msg.html : '';
|
|
606
|
-
var isFinal = msg.final === true;
|
|
607
|
-
if (!isFinal && html === lastHtml) return;
|
|
608
|
-
lastHtml = html;
|
|
609
|
-
morph(html, isFinal);
|
|
610
|
-
if (isFinal) {
|
|
611
|
-
finished = true;
|
|
612
|
-
runScripts(finish);
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
window.addEventListener('error', function (e) {
|
|
617
|
-
var message = String(e.message || 'Script error');
|
|
618
|
-
// Benign: a layout change inside a ResizeObserver callback.
|
|
619
|
-
if (/ResizeObserver loop/.test(message)) return;
|
|
620
|
-
post({ type: 'error', message: message });
|
|
621
|
-
});
|
|
622
|
-
|
|
623
|
-
${My}
|
|
624
|
-
|
|
625
|
-
// The frame is as tall as the document's content: the bottom of the
|
|
626
|
-
// lowest in-flow child of <body> (#root, or what a script appended), plus
|
|
627
|
-
// the body's own padding, border and margin below it. Not the viewport or
|
|
628
|
-
// a box styled height: 100% — those follow the frame itself.
|
|
629
|
-
function px(style, prop) {
|
|
630
|
-
return parseFloat(style.getPropertyValue(prop)) || 0;
|
|
631
|
-
}
|
|
632
|
-
function contentHeight() {
|
|
633
|
-
var bottom = 0;
|
|
634
|
-
var children = document.body.children;
|
|
635
|
-
for (var i = 0; i < children.length; i++) {
|
|
636
|
-
var child = children[i];
|
|
637
|
-
if (child.tagName === 'SCRIPT') continue;
|
|
638
|
-
var style = getComputedStyle(child);
|
|
639
|
-
if (style.position === 'absolute' || style.position === 'fixed' || style.display === 'none') continue;
|
|
640
|
-
bottom = Math.max(bottom, child.getBoundingClientRect().bottom + px(style, 'margin-bottom'));
|
|
641
|
-
}
|
|
642
|
-
var body = getComputedStyle(document.body);
|
|
643
|
-
return bottom + window.scrollY + px(body, 'padding-bottom') + px(body, 'border-bottom-width') + px(body, 'margin-bottom');
|
|
644
|
-
}
|
|
645
|
-
var lastHeight = -1;
|
|
646
|
-
function reportHeight() {
|
|
647
|
-
var h = Math.ceil(contentHeight());
|
|
648
|
-
if (h === lastHeight) return;
|
|
649
|
-
lastHeight = h;
|
|
650
|
-
post({ type: 'height', height: h });
|
|
651
|
-
}
|
|
652
|
-
var sizes = new ResizeObserver(reportHeight);
|
|
653
|
-
sizes.observe(root);
|
|
654
|
-
sizes.observe(document.body);
|
|
655
|
-
// Elements a script adds next to #root count too.
|
|
656
|
-
new MutationObserver(function (records) {
|
|
657
|
-
for (var r = 0; r < records.length; r++) {
|
|
658
|
-
for (var n = 0; n < records[r].addedNodes.length; n++) {
|
|
659
|
-
if (records[r].addedNodes[n].nodeType === 1) sizes.observe(records[r].addedNodes[n]);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
reportHeight();
|
|
663
|
-
}).observe(document.body, { childList: true });
|
|
664
|
-
reportHeight();
|
|
665
|
-
post({ type: 'ready' });
|
|
666
|
-
})();`;function Cd(t){return`<script>${t.replace(/<\/script/gi,"<\\/script")}<\/script>`}function pT(){const t=Object.entries(Dy()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Iy}">`,"<style>",`:root { ${t} color-scheme: light; }`,"html, body { margin: 0; padding: 0; background: transparent; overflow: hidden; }","body { font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }","#root { position: relative; display: flow-root; }","*, *::before, *::after { box-sizing: border-box; }","</style>",Cd(uT),'</head><body><div id="root"></div>',Cd(fT),"</body></html>"].join(`
|
|
667
|
-
`)}let hg=null;function hT(){return hg??(hg=pT()),hg}const mT=4e3,gT=3,ko=new Map,vT=500;function yT(t,n){if(ko.delete(t),ko.set(t,n),ko.size>vT){const r=ko.keys().next().value;r!==void 0&&ko.delete(r)}}function xT({widgetId:t,title:n,html:r,final:i,onError:l}){const c=x.useRef(null),[d,p]=x.useState(()=>ko.get(t)??0),g=x.useRef({html:r,final:i});g.current={html:r,final:i};const m=x.useRef(l);m.current=l;const v=x.useRef(0),k=x.useRef(null),y=x.useCallback(()=>{var N;const S=(N=c.current)==null?void 0:N.contentWindow;if(!S||v.current===0||v.current>gT)return;const C=g.current,b=k.current;b&&(b.final||b.html===C.html&&b.final===C.final)||(k.current=C,S.postMessage({source:Ry,type:"content",html:C.html,final:C.final},"*"))},[]);return x.useEffect(()=>{function S(C){var E;const b=c.current;if(!b||C.source!==b.contentWindow)return;const N=C.data;if(!(!N||typeof N!="object"||N.source!==_y))if(N.type==="ready")v.current+=1,k.current=null,y();else if(N.type==="height"&&typeof N.height=="number"&&Number.isFinite(N.height)){const R=Math.min(mT,Math.max(0,Math.ceil(N.height)));p(R),yT(t,R)}else N.type==="error"&&typeof N.message=="string"&&((E=m.current)==null||E.call(m,N.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[t,y]),x.useEffect(()=>{y()},[r,i,y]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:Ay,srcDoc:hT(),title:n||"Widget",style:{height:`${d}px`}})}const wT=720,kT=20;function Ed(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ST(t,n){const r=Object.entries(Dy()).map(([i,l])=>`${i}: ${l};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Iy}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Ed(t||"Widget")}</title>`,"<style>",`:root { ${r} color-scheme: light; }`,"html { background: var(--color-background-primary); }","body { margin: 0; padding: 32px 24px; font: 14px/1.5 var(--font-sans); color: var(--color-text-primary); -webkit-font-smoothing: antialiased; }",`#root { position: relative; display: flow-root; max-width: ${wT}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",Cd(My),'</head><body><div id="root">',n,"</div></body></html>"].join(`
|
|
668
|
-
`)}function bT(t,n){const r=Ed(t||"Widget");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">','<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${r}</title>`,"<style>html, body { margin: 0; height: 100%; } iframe { display: block; width: 100%; height: 100%; border: 0; }</style>","</head><body>",`<iframe sandbox="${Ay}" title="${r}" srcdoc="${Ed(ST(t,n))}"></iframe>`,"</body></html>"].join(`
|
|
669
|
-
`)}const vo=new Map;function NT(t,n,r){const i=bT(n,r);let l=vo.get(t);l&&l.doc!==i&&(URL.revokeObjectURL(l.url),l=void 0),l??(l={doc:i,url:URL.createObjectURL(new Blob([i],{type:"text/html;charset=utf-8"}))}),vo.delete(t),vo.set(t,l);for(const[d,p]of vo){if(vo.size<=kT)break;URL.revokeObjectURL(p.url),vo.delete(d)}const c=window.open(l.url,"_blank");c&&(c.opener=null)}function TT({item:t}){const[n,r]=x.useState(null),i=t.data??{},l=typeof i.title=="string"?i.title.trim():"",c=typeof i.html=="string"?i.html:"",d=i.partial===!0,p=typeof i.error=="string"&&i.error?i.error:null,g=t.external_item_id??t.id;return a.jsxs("div",{className:"render-content widget-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(w1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),p&&a.jsx("span",{className:"turn-header-meta",style:{color:"var(--red)"},children:"failed"}),!d&&c.trim()!==""&&a.jsx("button",{type:"button",className:"widget-open-btn",title:"Open in a new tab","aria-label":"Open in a new tab",onClick:()=>NT(g,l,c),children:a.jsx(bv,{size:14})})]}),c.trim()?a.jsx(xT,{widgetId:g,title:l,html:c,final:!d,onError:r}):!p&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),p&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:p})}),n&&!p&&a.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}Ge.setOptions({breaks:!0,gfm:!0});const CT=10,ET=100;function jT({attachments:t}){const[n,r]=x.useState(null);return x.useEffect(()=>{if(!n)return;function i(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[n]),!Array.isArray(t)||t.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:t.map((i,l)=>{const c=i.media_type.startsWith("image/"),d=`data:${i.media_type};base64,${i.data}`;return a.jsxs("span",{className:"attachment-pill",title:i.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:i.name,className:"attachment-pill-thumb"}):a.jsx(Nv,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:i.name})]},l)})}),n&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:i=>i.stopPropagation(),children:[a.jsx("img",{src:n,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(Nn,{size:20})})]})})]})}function _T(t){const n=Ge.parse(t);return pf.sanitize(n)}function mg(t){var n;return(n=t.data)!=null&&n.text?t.data.text:""}function RT(t){const n=t.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:t}const gg='<script>(function(){function report(){var h=Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0);if(h>0)parent.postMessage(Math.ceil(h),"*");}window.addEventListener("load",report);new ResizeObserver(report).observe(document.documentElement);report();})();<\/script>';function AT(t){return/<\/body>/i.test(t)?t.replace(/<\/body>/i,`${gg}</body>`):t+gg}function IT({html:t}){const[n,r]=x.useState(480),i=x.useRef(null);return x.useEffect(()=>{function l(c){var d;c.source===((d=i.current)==null?void 0:d.contentWindow)&&typeof c.data=="number"&&c.data>0&&r(c.data)}return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),a.jsx("iframe",{ref:i,sandbox:"allow-scripts",srcDoc:AT(t),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const vg=1e4;function DT({item:t,runtimeType:n,turn:r,threads:i}){var p,g,m,v,k,y,S,C;const l=t.status==="in_progress",[c,d]=x.useState(!1);switch(t.type){case"agent_message":{const{iconClass:b,iconText:N}=pd(n??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${b}`,children:N}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(dg,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:mg(t)||"…",threads:i,runtimeType:n})]})}case"reasoning":return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Kk,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:_T(mg(t))}})]});case"command_execution":{const b=t.data||{},N=RT(b.command||""),E=b.aggregated_output||"",R=b.exit_code,z=l?"running…":R!==null?`exit ${R}`:"",I=E.length>vg,L=I&&!c?E.slice(0,vg)+`
|
|
670
|
-
… (truncated, click to expand)`:E;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Mv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),z&&a.jsx("span",{className:"turn-header-meta",children:z})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:N})}),E&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:L})}),I&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(q=>!q),children:c?"Show less":`Show full output (${(E.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(p=t.data)==null?void 0:p.changes,N=Array.isArray(b)?b:[],E=`${N.length} file${N.length!==1?"s":""}`;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Zk,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:E})]}),a.jsx("div",{className:"file-change-list",children:N.map((R,z)=>{const I=R.kind==="add"?"A":R.kind==="delete"?"D":"M",L=R.kind==="add"?"fc-add":R.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${L}`,children:I}),a.jsx("span",{className:"fc-name",children:R.path})]},z)})})]})}case"mcp_tool_call":{const b=t.data||{},N=b.tool||"mcp";if(N==="Agent"){const $=b.arguments,Z=($==null?void 0:$.description)||($==null?void 0:$.prompt)||"Subagent",he=t.status==="failed",ce=l?"running…":he?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(mr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:Z}),a.jsx("span",{className:`agent-call-status ${l?"running":he?"failed":"done"}`,children:ce})]})}const E=b.server||"",R=b.arguments,z=b.result,I=b.error,L=t.status==="failed"||!!I,q=l?"running…":L?"failed":"done",K=((g=z==null?void 0:z.content)==null?void 0:g.filter($=>$.type==="text").map($=>$.text))??[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(v1,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",N]}),E&&a.jsx("span",{className:"turn-header-meta",children:E}),a.jsx("span",{className:"turn-header-meta",style:L?{color:"var(--red)"}:void 0,children:q})]}),R&&Object.keys(R).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(R).map(([$,Z])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:$}),$==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(Z)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof Z=="string"?Z:JSON.stringify(Z,null,2)})]},$))}),K.length>0&&K.map(($,Z)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:$})},Z)),I&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:I})})]})}case"web_search":{const b=((m=t.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(x1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:b})]})}case"todo_list":{const b=((v=t.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(i1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:b.map((N,E)=>a.jsxs("li",{className:N.completed?"todo-done":"todo-pending",children:[N.completed?a.jsx(Ts,{size:14}):a.jsx(Fr,{size:14})," ",N.text]},E))})]})}case"ask_user":return a.jsx(pg,{item:t,turn:r});case"final_result":{const b=t.data??{},N=b.text||"",E=b.html||null,R=Array.isArray(b.groups)?b.groups.filter(L=>!!L&&Array.isArray(L.selections)&&L.selections.length>0):[],{iconClass:z,iconText:I}=pd(n??"codex");return a.jsxs(a.Fragment,{children:[(N||E)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${z}`,children:I}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),N&&a.jsx(dg,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:N,threads:i,runtimeType:n}),E&&a.jsx(IT,{html:E})]}),R.length>0&&a.jsx(pg,{item:t,turn:r})]})}case"background_task":{const b=t.data||{},N=b.task_type||"unknown",E=b.subagent_type||null,R=b.description||"",z=b.status||"running",I=b.last_tool_name||null,L=b.token_count||null,q=N==="local_agent",K=N==="local_bash",$=q?mr:K?Iv:Sv,Z=q?`Subagent${E?`: ${E}`:""}`:K?"Monitor":"Background Task",he=z==="running"?"running…":z==="completed"?"done":z==="failed"?"failed":z==="stopped"?"stopped":z,ce=t.status==="failed"||z==="failed";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx($,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Z}),a.jsx("span",{className:"turn-header-meta",style:ce?{color:"var(--red)"}:void 0,children:he})]}),R&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:R}),I&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",I,L!=null&&` · ${L.toLocaleString()} tokens`]}),a.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const b=((k=t.data)==null?void 0:k.trigger)??"auto",N=((y=t.data)==null?void 0:y.pre_tokens)??0,E=((S=t.data)==null?void 0:S.post_tokens)??0,R=N>0?Math.round((1-E/N)*100):0,z=b==="manual"?"Context compacted (/compact)":"Context auto-compacted";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(u1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:z})]}),a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[N.toLocaleString()," → ",E.toLocaleString()," tokens (",R,"% reduction)"]})]})}case"interruption":return a.jsx(iT,{item:t});case"widget":return a.jsx(TT,{item:t});case"error":{const b=((C=t.data)==null?void 0:C.message)||"Unknown error";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--red)",color:"#fff"},children:a.jsx(Gl,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Error"})]}),a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:b})})]})}default:return null}}const Lr=x.memo(DT,(t,n)=>t.item===n.item&&t.runtimeType===n.runtimeType&&t.threads===n.threads&&t.turn.id===n.turn.id);function MT(t){return t.type==="widget"?`widget-${t.external_item_id??t.id}`:t.id}function LT({turn:t,runtimeType:n,threads:r=[]}){Lt.trackRender("TurnContent");const[i,l]=x.useState(!1),[c,d]=x.useState(!1),[p,g]=x.useState(!1),[m,v]=x.useState(!1),k=A(W=>W.loadDeferredItems),y=t.items.some(W=>W.type==="background_task"&&W.status==="in_progress");x.useEffect(()=>{t.status==="running"||t.status==="pending"?l(!0):t.status==="completed"&&!y&&l(!1)},[t.status,y]);const S=t.deferred_item_count??0,C=zs(t),b=x.useRef(C);x.useEffect(()=>{const W=b.current&&!C&&t.status==="completed"&&!y;if(b.current=C,W||!i||S===0||m||C&&!c)return;let X=!1;return k(t.session_id,t.id).then(ae=>{!ae&&!X&&v(!0)}),()=>{X=!0}},[i,S,m,C,c,t.status,y,k,t.session_id,t.id]);let N=-1;for(let W=t.items.length-1;W>=0;W--)if(t.items[W].type==="agent_message"){N=W;break}const E=N>=0,R=E?t.items.slice(0,N):t.items,z=t.items.some(W=>W.type==="final_result"||W.type==="ask_user"),I=!E&&t.status==="completed"&&t.agent_response&&!z?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,L=R.filter(W=>{var X;return!(W.type==="reasoning"&&(!((X=W.data)!=null&&X.text)||W.data.text===""))}),q=t.items.some(W=>{var X;return W.type==="interruption"&&((X=W.data)==null?void 0:X.reason)==="auth"}),K=t.items.some(W=>{var X;return W.type==="interruption"&&((X=W.data)==null?void 0:X.reason)==="usage_limit"}),$=L.filter(W=>{var X,ae;return!(W.type==="background_task"||W.type==="ask_user"||W.type==="final_result"||W.type==="widget"||q&&W.type==="error"&&((X=W.data)==null?void 0:X.error)==="authentication_failed"||K&&W.type==="error"&&((ae=W.data)==null?void 0:ae.error)==="rate_limit")}),Z=c?0:Math.max(0,$.length-ET),he=Z>0?$.slice(Z):$,ce=[];let ye=null;for(const W of he)W.type==="agent_message"?(ye&&ce.push(ye),ye={agentMessage:W,toolItems:[],otherItems:[]}):W.type==="interruption"||W.type==="error"?(ye&&ce.push(ye),ce.push({agentMessage:null,toolItems:[],otherItems:[W]}),ye=null):(ye||(ye={agentMessage:null,toolItems:[],otherItems:[]}),cg(W)?ye.toolItems.push(W):ye.otherItems.push(W));ye&&ce.push(ye);const Se=t.status==="running"||t.status==="pending",Oe=W=>{var X;return W.type==="widget"&&(Se||((X=W.data)==null?void 0:X.partial)!==!0)},J=E?t.items[N]:I,re=[...R.filter(Oe),...J?[J]:[],...E?t.items.slice(N+1).filter(W=>W.type!=="ask_user"&&W.type!=="background_task"&&W.type!=="final_result"&&(W.type!=="widget"||Oe(W))):[]],oe=t.items.filter(W=>W.type==="background_task"),F=p?0:Math.max(0,oe.length-CT),Q=F>0?oe.slice(F):oe,G=$.filter(W=>cg(W)).length+(t.deferred_tool_calls??0),D=G>0||C&&($.length>0||S>0),P=t.status==="pending"&&t.resume_state==="waiting",le=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&a.jsx(jT,{attachments:t.attachments})]}),D&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(W=>!W),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(s1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:G>0?`${G} tool call${G>1?"s":""}`:P?"interrupted":"thinking…"}),a.jsx(Di,{size:14,className:"tool-calls-chevron",style:{transform:i?"rotate(90deg)":"none"}})]}),i&&a.jsxs("div",{className:"tool-calls-body",children:[S>0&&a.jsx("div",{className:"render-load-earlier",children:m?a.jsx("button",{className:"render-load-earlier-btn",onClick:()=>v(!1),children:"Couldn't load these steps. Try again"}):C&&!c?a.jsx("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:"Show earlier steps"}):a.jsx("span",{className:"tool-calls-loading",children:"Loading steps…"})}),(S===0||C)&&a.jsxs(a.Fragment,{children:[S===0&&Z>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Z," earlier step",Z>1?"s":""]})}),ce.map((W,X)=>a.jsxs("div",{className:"intermediate-segment",children:[W.agentMessage&&a.jsx(Lr,{item:W.agentMessage,runtimeType:n,turn:t,threads:r}),W.otherItems.map(ae=>a.jsx(Lr,{item:ae,runtimeType:n,turn:t,threads:r},ae.id)),W.toolItems.length>0&&a.jsx(KN,{items:W.toolItems,runtimeType:n,turn:t,threads:r})]},X))]})]})]}),F>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",F," earlier background task",F>1?"s":""]})}),Q.map(W=>a.jsx(Lr,{item:W,runtimeType:n,turn:t,threads:r},`task-${W.id}`)),re.map(W=>a.jsx(Lr,{item:W,runtimeType:n,turn:t,threads:r},MT(W))),t.items.filter(W=>W.type==="final_result").map(W=>a.jsx(Lr,{item:W,runtimeType:n,turn:t,threads:r},`final-${W.id}`)),t.items.filter(W=>W.type==="ask_user").map(W=>a.jsx(Lr,{item:W,runtimeType:n,turn:t,threads:r},`ask-${W.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!le&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:t.error})})}),t.status==="running"&&a.jsx(cT,{turnId:t.id}),a.jsx(lT,{turn:t}),t.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Fr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const OT=x.memo(LT),PT=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function $T(){const t=A(N=>N.workspaces),n=A(N=>N.loadPickerSupport),r=A(N=>N.pickAndAddWorkspace),i=A(N=>N.createSessionInWorkspace),l=A(N=>N.setImportSessionsWorkspace);x.useEffect(()=>{n()},[n]);const c=t.filter(N=>N.deleted===0),[d,p]=x.useState(null),g=c.find(N=>N.path===d)??c[c.length-1]??null,m=(g==null?void 0:g.path)??null,[v,k]=x.useState(null);x.useEffect(()=>{if(!m)return;let N=!1;return uv(m).then(E=>{N||k({path:m,count:E.length})}).catch(()=>{}),()=>{N=!0}},[m]);const y=v&&v.path===m?v.count:0,[S,C]=x.useState(!1);async function b(N){C(!0);try{await i(N)}finally{C(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${g?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:g?a.jsx(Ts,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),g?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:g.path,children:g.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(e1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${g?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),g&&m?a.jsxs(a.Fragment,{children:[c.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:N=>p(N.target.value),children:c.map(N=>a.jsx("option",{value:N.path,children:N.label||N.path},N.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:S,onClick:()=>void b(m),children:[a.jsx(fr,{size:14})," New session"]}),y>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Ev,{size:14})," Import ",y," Claude Code"," ",y===1?"session":"sessions"]})]}),y>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code sessions, and press ",a.jsx("kbd",{children:PT})," for the command palette."]})]})})}const zT=[],al=50;function FT(){Lt.trackRender("RenderArea");const t=A(S=>S.activeSessionId),n=A(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=A(S=>S.submittingPrompt),i=A(S=>S.loading),l=A(S=>!S.activeSessionId&&!Sb(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??zT,p=x.useRef(null),[g,m]=x.useState(al);x.useEffect(()=>{m(al)},[t]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-g),y=v.slice(k);return x.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[t,c.length]),i&&!n?a.jsx("div",{className:"render-scroll",children:a.jsxs("div",{className:"skeleton-bars",children:[a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"})]})}):n?a.jsxs("div",{className:"render-scroll",ref:p,children:[r&&a.jsx("div",{className:"turn-block",children:a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:r})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),c.length===0&&!r&&a.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>m(S=>S+al),children:["Show ",Math.min(al,k)," earlier turns (",k," hidden)"]})}),y.map((S,C)=>a.jsx("div",{id:`turn-${k+C}`,className:"turn-block",children:a.jsx(OT,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):l?a.jsx($T,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const UT=x.memo(FT),BT=[{id:"model",label:"/model",hint:"Change model",capability:"dynamicModels"},{id:"sandbox",label:"/sandbox",hint:"Sandbox mode",capability:"sandbox",subPopup:"sandbox"},{id:"websearch",label:"/websearch",hint:"Web search mode",capability:"webSearch",subPopup:"websearch"},{id:"network",label:"/network",hint:"Network access",capability:"networkAccess",subPopup:"network"},{id:"skills",label:"/skills",hint:"Browse skills",capability:"skills"},{id:"plugins",label:"/plugins",hint:"Browse plugins",capability:"plugins"},{id:"mcp",label:"/mcp",hint:"Browse MCP servers",capability:"mcpServers"}];function WT(t){return t.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function HT(t,n,r=[]){const i=[...BT,...WT(r)],l=new Set;return i.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!n[c.capability])||t&&!c.label.toLowerCase().includes(t.toLowerCase())))}function VT({commands:t,selectedIndex:n,onSelect:r,onHover:i}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>i(c),onClick:()=>r(l),children:[a.jsx("span",{className:"slash-popup-label",children:l.label}),a.jsx("span",{className:"slash-popup-hint",children:l.hint})]},l.id))]})}function rd({title:t,options:n,currentValue:r,onSelect:i,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:t})]}),n.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>i(c.value),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:c.label}),c.description&&a.jsx("span",{className:"slash-popup-hint",children:c.description})]}),c.value===r&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},c.value))]})}function KT(t){return Et("/skills")}function GT({filter:t,onSelect:n,onClose:r}){const[i,l]=x.useState([]),[c,d]=x.useState(!0),[p,g]=x.useState(0),m=x.useRef(null);x.useEffect(()=>{KT().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=i.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return x.useEffect(()=>{g(0)},[t]),x.useEffect(()=>{function k(y){y.key==="ArrowDown"?(y.preventDefault(),g(S=>Math.min(S+1,v.length-1))):y.key==="ArrowUp"?(y.preventDefault(),g(S=>Math.max(S-1,0))):y.key==="Enter"?(y.preventDefault(),v[p]&&n(v[p])):y.key==="Escape"&&(y.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,p,n,r]),a.jsxs("div",{className:"slash-popup",ref:m,children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),c&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!c&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,y)=>a.jsxs("div",{className:`slash-popup-item ${y===p?"selected":""}`,onMouseEnter:()=>g(y),onClick:()=>n(k),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&a.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&a.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function Ly(){return Et("/providers")}function qT(t,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return Et(`/providers/${t}/commands${r}`)}const XT={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function YT(t){const[n,r]=x.useState([]),[i,l]=x.useState(!0);x.useEffect(()=>{Ly().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=n.find(d=>d.id===t)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??XT,loading:i}}const yo=32,od=200;function yg(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function xg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let wg=0;function QT(){return wg+=1,`att-${Date.now()}-${wg}`}function ZT(){Lt.trackRender("CommandInputBar");const[t,n]=x.useState(""),r=x.useRef(null),i=x.useRef(yo),l=x.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:p,setShowModelSelector:g}=A(),m=A(Y=>Y.activeSessionId),v=A(Y=>Y.activeSessionId?Y.sessionDetails[Y.activeSessionId]:null),k=A(Y=>Y.quotedText),y=sv(v),S=!!(v!=null&&v.turns.some(Y=>Y.status==="pending"&&Y.resume_state==="waiting")),C=!m,{capabilities:b}=YT(v==null?void 0:v.runtime_type),N=(v==null?void 0:v.runtime_type)??null,E=b.imageAttachments,[R,z]=x.useState([]),[I,L]=x.useState(!1),[q,K]=x.useState(null),[$,Z]=x.useState([]);x.useEffect(()=>{if(!N){Z([]);return}let Y=!1;return qT(N,(v==null?void 0:v.cwd)??void 0).then(ge=>{Y||Z(ge)}).catch(()=>{Y||Z([])}),()=>{Y=!0}},[N,v==null?void 0:v.cwd]);const[he,ce]=x.useState(!1),[ye,Se]=x.useState(""),[Oe,J]=x.useState(0),[re,oe]=x.useState(void 0),[F,Q]=x.useState(!1),[G,D]=x.useState(""),[P,le]=x.useState([]),W=he?HT(ye,b,$):[];x.useEffect(()=>{k!==null&&(n(Y=>Y+k),setTimeout(()=>{if(r.current){pe(),r.current.focus();const Y=r.current.value.length;r.current.setSelectionRange(Y,Y)}},0),A.setState({quotedText:null}))},[k]),x.useEffect(()=>{if(!y)return;function Y(ge){ge.key==="Escape"&&(ge.preventDefault(),d())}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[y,d]),x.useEffect(()=>{ce(!1),oe(void 0),Q(!1),le([]),z(Y=>{for(const ge of Y)ge.previewUrl&&URL.revokeObjectURL(ge.previewUrl);return[]})},[m]),x.useEffect(()=>{if(!q)return;function Y(ge){ge.key==="Escape"&&(ge.preventDefault(),K(null))}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[q]);const X=x.useCallback(Y=>{if(!Y)return;const ge=Array.from(Y);for(const Be of ge){const st=new FileReader;st.onload=()=>{const vt=st.result.split(",")[1]??"",_t=Be.type.startsWith("image/")?URL.createObjectURL(Be):void 0;z(an=>[...an,{id:QT(),name:Be.name,media_type:Be.type||"application/octet-stream",data:vt,previewUrl:_t,size:Be.size}])},st.readAsDataURL(Be)}},[]),ae=x.useCallback(Y=>{z(ge=>{const Be=ge.find(st=>st.id===Y);return Be!=null&&Be.previewUrl&&URL.revokeObjectURL(Be.previewUrl),ge.filter(st=>st.id!==Y)})},[]),be=x.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),!(!E||y)&&L(!0)},[E,y]),_e=x.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1)},[]),Ae=x.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation(),L(!1),!(!E||y)&&X(Y.dataTransfer.files)},[E,y,X]),je=x.useCallback(Y=>{var st;if(!E)return;const ge=(st=Y.clipboardData)==null?void 0:st.items;if(!ge)return;const Be=[];for(let gt=0;gt<ge.length;gt++){const vt=ge[gt];if(vt.type.startsWith("image/")){const _t=vt.getAsFile();_t&&Be.push(_t)}}Be.length>0&&(Y.preventDefault(),X(Be))},[E,X]);function me(Y){const ge=r.current;ge&&(ge.style.height=`${Y}px`,i.current=Y)}function pe(){const Y=r.current;if(Y){if(Y.scrollHeight>Y.clientHeight){const ge=Math.min(Y.scrollHeight,od);ge!==i.current&&me(ge);return}i.current>yo&&(Y.style.height="auto",me(Math.min(Y.scrollHeight,od)))}}function Ve(){const Y=t.trim();if(!Y||y)return;let ge=Y;P.length>0&&(ge=`${P.map(gt=>`$${gt.name}`).join(" ")}
|
|
671
|
-
|
|
672
|
-
${Y}`);const Be=R.map(({id:st,previewUrl:gt,size:vt,..._t})=>_t);n(""),le([]),me(yo),ce(!1),oe(void 0),Q(!1);for(const st of R)st.previewUrl&&URL.revokeObjectURL(st.previewUrl);z([]),c(ge,Be.length>0?Be:void 0)}function Ie(Y){if(Y.insertAsText){const ge=`/${Y.id} `;n(ge),ce(!1),oe(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Be=ge.length;r.current.setSelectionRange(Be,Be),pe()}});return}Y.subPopup?oe(Y.subPopup):Y.id==="skills"?(Q(!0),D(""),ce(!1),n("")):Y.id==="model"?(g(!0),ce(!1),n("")):(ce(!1),n(""))}function mt(Y){le(ge=>[...ge,Y]),Q(!1),n(""),me(yo)}function Ue(Y){const ge=yg(v==null?void 0:v.runtime_config);re==="sandbox"?ge.sandboxMode=Y:re==="websearch"?ge.webSearchMode=Y:re==="network"&&(ge.networkAccessEnabled=Y==="true"),p(ge),oe(void 0),ce(!1),n(""),me(yo)}function Vt(Y){if(Lt.markKeystroke(),he&&!re){if(Y.key==="ArrowDown"){Y.preventDefault(),J(ge=>Math.min(ge+1,W.length-1));return}if(Y.key==="ArrowUp"){Y.preventDefault(),J(ge=>Math.max(ge-1,0));return}if(Y.key==="Enter"){Y.preventDefault(),W[Oe]&&Ie(W[Oe]);return}if(Y.key==="Escape"){Y.preventDefault(),ce(!1),n("");return}}if(re&&Y.key==="Escape"){Y.preventDefault(),oe(void 0);return}if(Y.key==="Enter"&&(Y.metaKey||Y.ctrlKey)&&!y){Y.preventDefault(),Ve();return}Y.key==="Escape"&&y&&(Y.preventDefault(),d())}function tn(Y){Lt.markInputChange();const ge=Y.target.value;n(ge),pe(),ge.startsWith("/")&&!ge.includes(" ")&&!y?(ce(!0),Se(ge.slice(1)),J(0)):(ce(!1),oe(void 0)),ge.startsWith("$")&&!y?(Q(!0),D(ge.slice(1))):ge.startsWith("$")||Q(!1)}const kt=yg(v==null?void 0:v.runtime_config),jt=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],Ft=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Ot=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return a.jsxs("div",{className:`cmd-bar${I?" drag-over":""}`,onDragOver:be,onDragLeave:_e,onDrop:Ae,children:[he&&!re&&a.jsx(VT,{commands:W,selectedIndex:Oe,onSelect:Ie,onHover:J}),he&&re==="sandbox"&&a.jsx(rd,{title:"Sandbox Mode",options:jt,currentValue:kt.sandboxMode,onSelect:Ue,onClose:()=>oe(void 0)}),he&&re==="websearch"&&a.jsx(rd,{title:"Web Search",options:Ft,currentValue:kt.webSearchMode,onSelect:Ue,onClose:()=>oe(void 0)}),he&&re==="network"&&a.jsx(rd,{title:"Network Access",options:Ot,currentValue:kt.networkAccessEnabled===!0?"true":"false",onSelect:Ue,onClose:()=>oe(void 0)}),F&&a.jsx(GT,{filter:G,onSelect:mt,onClose:()=>{Q(!1),n("")}}),P.length>0&&a.jsx("div",{className:"skill-badges",children:P.map(Y=>a.jsxs("span",{className:"skill-badge",children:["$",Y.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>le(ge=>ge.filter(Be=>Be.id!==Y.id)),children:"×"})]},Y.id))}),R.length>0&&a.jsx("div",{className:"attachment-preview-area",children:R.map(Y=>a.jsxs("div",{className:"attachment-chip",title:Y.name,children:[Y.previewUrl?a.jsx("img",{src:Y.previewUrl,alt:Y.name,className:"attachment-thumb",onClick:()=>K(Y),style:{cursor:"pointer"}}):a.jsx(Nv,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:Y.name}),a.jsx("span",{className:"attachment-size",children:xg(Y.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>ae(Y.id),title:"Remove attachment",children:a.jsx(Nn,{size:14})})]},Y.id))}),E&&!y&&!C&&a.jsx("input",{ref:l,type:"file",multiple:!0,accept:"image/*,application/pdf,text/*,.ts,.js,.tsx,.jsx,.py,.go,.rs,.java,.c,.cpp,.h,.css,.html,.xml,.yml,.yaml,.toml,.ini,.sh,.sql",style:{display:"none"},onChange:Y=>{X(Y.target.files),Y.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[E&&!y&&!C&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var Y;return(Y=l.current)==null?void 0:Y.click()},title:"Attach files",disabled:y,children:a.jsx(m1,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:C?"Select or create a session…":S?"Interrupted — waiting to resume…":y?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:t,disabled:y||C,rows:1,style:{minHeight:yo,maxHeight:od},onChange:tn,onKeyDown:Vt,onPaste:je}),y?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(Fr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:Ve,disabled:!t.trim()||C,title:"Send (⌘↵)",children:a.jsx(kv,{size:16})})]}),q&&a.jsx("div",{className:"image-preview-modal",onClick:()=>K(null),children:a.jsxs("div",{className:"image-preview-content",onClick:Y=>Y.stopPropagation(),children:[a.jsx("img",{src:q.previewUrl,alt:q.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:q.name}),a.jsx("span",{children:xg(q.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>K(null),children:a.jsx(Nn,{size:20})})]})})]})}function JT(){const t=A(N=>N.activeSessionId),n=A(N=>N.activeSessionId?N.sessionDetails[N.activeSessionId]:null),r=A(N=>N.activeTurnIndex),i=A(N=>N.setActiveTurnIndex),l=A(N=>N.rewindToTurn),c=A(N=>N.restoreSession),d=A(N=>N.branchFromTurn),p=(n==null?void 0:n.turns)??[],g=Wl(n),m=!!(n!=null&&n.rewound_at_turn_id),v=(n==null?void 0:n.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[y,S]=x.useState(null),C=x.useRef(null);if(Ui(C,()=>S(null),!!y),Ao(()=>S(null),!!y),p.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function b(N){i(N),requestAnimationFrame(()=>{var E;(E=document.getElementById(`turn-${N}`))==null||E.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),p.map((N,E)=>{const R=E===r,z=N.user_prompt.length>50?N.user_prompt.slice(0,50)+"…":N.user_prompt,I=N.status==="running"||N.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${R?"active":""}`,onClick:()=>b(E),onContextMenu:L=>{L.preventDefault(),S({x:L.clientX,y:L.clientY,turnId:N.id,turnIndex:E,isLast:E===p.length-1,isSlashCommand:N.user_prompt.trimStart().startsWith("/")})},children:[a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(N1,{size:12})}),a.jsx("span",{className:"turn-item-label",children:z}),I&&a.jsx("span",{className:"turn-item-status",children:N.status==="pending"&&N.resume_state==="waiting"?"interrupted":"running…"})]})},N.id)}),y&&a.jsxs("div",{ref:C,className:"ctx-menu",style:{position:"fixed",left:y.x,top:y.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${y.isLast||g||y.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{y.isLast||g||y.isSlashCommand||(window.confirm(k)&&l(t,y.turnId),S(null))},children:[a.jsx(y1,{size:12})," Rewind to Here",y.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(t),S(null)},children:[a.jsx(Li,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(t,y.turnId),S(null)},children:[a.jsx(Cv,{size:12})," Branch from Here"]})]})]})}function hf(t){return(t??[]).filter(n=>n.task_type!=="local_agent").length}const kg=2e4;function eC(t){const n=[];return t.forEach((r,i)=>{var l;for(const c of r.items)if(c.type==="background_task"){if((((l=c.data)==null?void 0:l.task_type)||"unknown")==="local_agent")continue;n.push({item:c,turnIndex:i,turnPrompt:r.user_prompt})}}),n}function tC({entry:t}){const{item:n,turnIndex:r,turnPrompt:i}=t,l=n.data||{},c=l.task_type||"unknown",d=l.subagent_type||null,p=l.description||"",g=l.summary||null,m=l.last_tool_name||null,v=l.token_count||null,k=l.output||"",y=n.status==="in_progress",S=l.status||"running",C=!y&&S==="running"?"stopped":S,b=c==="local_agent",N=c==="local_bash",E=b?mr:N?Iv:Sv,R=b?`Subagent${d?`: ${d}`:""}`:N?"Monitor":"Background Task",z=C==="running"?"running…":C==="completed"?"done":C==="failed"?"failed":C==="stopped"?"stopped":C,I=C==="failed"||n.status==="failed"&&C!=="stopped",[L,q]=x.useState(y),[K,$]=x.useState(!1),Z=x.useRef(null);x.useEffect(()=>{y&&q(!0)},[y]),x.useEffect(()=>{L&&y&&Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},[L,y,k]);const he=k.length>kg,ce=he&&!K?k.slice(0,kg)+`
|
|
673
|
-
… (truncated, click to expand)`:k,ye=y?null:C==="completed"?a.jsx(Ts,{size:12}):I?a.jsx(Gl,{size:12}):a.jsx(Fr,{size:12});return a.jsxs("div",{className:`task-card ${y?"task-running":""} ${I?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>q(Se=>!Se),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(E,{size:14})}),a.jsx("span",{className:"task-card-type",children:R}),a.jsxs("span",{className:`task-card-status ${I?"task-status-failed":y?"task-status-running":"task-status-done"}`,children:[ye," ",z]}),a.jsx(Di,{size:14,className:"task-card-chevron",style:{transform:L?"rotate(90deg)":"none",marginLeft:"auto"}})]}),p&&a.jsx("div",{className:"task-card-desc",children:p}),y&&m&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",m,v!=null&&` · ${v.toLocaleString()} tokens`]}),L&&a.jsxs("div",{className:"task-card-body",children:[k?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:Z,children:a.jsx("code",{children:ce})}),he&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>$(Se=>!Se),children:K?"Show less":`Show full output (${(k.length/1024).toFixed(0)}KB)`})]}):g?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:g})}):y?a.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):a.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),a.jsxs("div",{className:"task-card-context",title:i,children:["from turn ",r+1,": ",i.length>60?i.slice(0,60)+"…":i]})]})]})}const nC=x.memo(tC);function sC(){const t=A(d=>d.activeSessionId?d.sessionDetails[d.activeSessionId]:null),n=A(d=>d.activeSessionId?d.backgroundTasks[d.activeSessionId]:void 0),r=(t==null?void 0:t.turns)??[],i=eC(r),l=[...i].sort((d,p)=>{const g=d.item.status==="in_progress",m=p.item.status==="in_progress";return g&&!m?-1:!g&&m?1:p.turnIndex-d.turnIndex}),c=hf(n);return i.length===0?a.jsx("div",{className:"empty-state",children:"No background tasks yet"}):a.jsxs("div",{className:"right-section",children:[a.jsxs("div",{className:"right-section-title",children:["Background Tasks (",i.length,")",c>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",c," running"]})]}),l.map(d=>a.jsx(nC,{entry:d},d.item.id))]})}const rC=x.memo(sC),oC="Your job is to answer questions about this session:",Sg="Understand the user's question below, read the session file given above, and answer.",iC=new Set(["claude"]);function aC(t){return iC.has(t)}function mf(t){return t.kind==="sidecar"}function lC(t){const n=(t??[]).filter(mf);return n.length?n[n.length-1]:null}function cC(t){if(!t.startsWith(oC))return t;const n=t.indexOf(Sg);return n<0?t:t.slice(n+Sg.length).replace(/^\n+/,"")}function uC({thread:t,onClose:n}){const{activeSessionId:r,resolveThread:i,shareThread:l}=A(),[c,d]=x.useState(""),[p,g]=x.useState(!1),[m,v]=x.useState(!1);async function k(){if(!r||p)return;g(!0),await l(r,t.id,c)?n():g(!1)}async function y(){!r||m||(v(!0),await i(r,t.id),n())}const S=p||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:a.jsxs("div",{className:"dialog",onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Resolve thread"}),a.jsx("button",{className:"dialog-close",onClick:n,disabled:S,children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsx("div",{className:"dialog-hint",children:"Share this thread's findings with the main session? The discussion will be summarized and the summary is added to your input as a quote."}),a.jsxs("label",{className:"dialog-label",children:["Summarization directives (optional)",a.jsx("textarea",{className:"dialog-input share-directives-input",placeholder:"e.g. focus on the performance findings, keep file paths",value:c,onChange:C=>d(C.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:n,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:y,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(hn,{size:13,className:"spin"}):a.jsx(Cl,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[p?a.jsx(hn,{size:13,className:"spin"}):a.jsx(k1,{size:13}),p?"Summarizing…":"Share & Resolve"]})]})]})})}const bg=[];Ge.setOptions({breaks:!0,gfm:!0});function dC(t){const n=Ge.parse(t);return pf.sanitize(n)}function fC(t){var n,r,i;if(t.type==="agent_message"||t.type==="final_result"){const l=(n=t.data)==null?void 0:n.text;return typeof l=="string"&&l?l:null}if(t.type==="ask_user"){const l=Array.isArray((r=t.data)==null?void 0:r.groups)?t.data.groups:[],c=[(i=t.data)==null?void 0:i.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
|
|
674
|
-
|
|
675
|
-
`):null}return null}function pC(t){const n=t.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:t}function Oy({turn:t,formatPrompt:n=pC}){const r=n(t.user_prompt),i=t.items.map(fC).filter(l=>l!==null);return i.length===0&&t.status==="completed"&&t.agent_response&&i.push(t.agent_response),a.jsxs("div",{className:"thread-card-turn",children:[a.jsx("div",{className:"thread-card-user-message",children:r}),i.map((l,c)=>a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:dC(l)}},c)),i.length===0&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:t.status==="running"?"AI is responding…":"Waiting…"}),t.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:t.error||"Turn failed"})]})}function hC({thread:t,threadTurns:n,onStop:r,onResolve:i,onReopen:l,onDelete:c,onFollowup:d,onLocate:p}){var Se,Oe,J;const[g,m]=x.useState(""),[v,k]=x.useState(!0),y=x.useRef(null),S=x.useRef(null),[C,b]=x.useState(!1),[N,E]=x.useState({x:0,y:0}),[R,z]=x.useState(""),I=n.some(zs),L=28,q=120,K=x.useRef(L);x.useEffect(()=>{const re=S.current;re&&(re.scrollTop=re.scrollHeight)},[n.length,v]);function $(re){const oe=y.current;oe&&(oe.style.height=`${re}px`,K.current=re)}function Z(){const re=y.current;if(re){if(re.scrollHeight>re.clientHeight){const oe=Math.min(re.scrollHeight,q);oe!==K.current&&$(oe);return}K.current>L&&(re.style.height="auto",$(Math.min(re.scrollHeight,q)))}}const he=x.useCallback(()=>{b(!1)},[]),ce=x.useCallback(()=>{const re=S.current;if(!re)return;const oe=window.getSelection();if(!oe||oe.rangeCount===0||oe.isCollapsed){b(!1);return}const F=oe.getRangeAt(0);if(!re.contains(F.commonAncestorContainer)){b(!1);return}const Q=F.commonAncestorContainer.nodeType===Node.TEXT_NODE?F.commonAncestorContainer.parentElement:F.commonAncestorContainer;if(!(Q!=null&&Q.closest(".thread-card-ai-response"))){b(!1);return}const G=oe.toString();if(!G.trim()){b(!1);return}const D=F.getBoundingClientRect(),P=28,le=6,W=170;let X=!1;if(oe.anchorNode&&oe.focusNode)try{const _e=document.createRange();_e.setStart(oe.focusNode,oe.focusOffset),_e.setEnd(oe.focusNode,oe.focusOffset);const Ae=document.createRange();Ae.setStart(oe.anchorNode,oe.anchorOffset),Ae.setEnd(oe.anchorNode,oe.anchorOffset),X=Ae.compareBoundaryPoints(Range.START_TO_START,_e)>0}catch{X=!1}let ae=D.top-P-le;ae<8&&(ae=D.bottom+le);let be=X?D.left-W:D.right;be=Math.max(8,Math.min(be,window.innerWidth-W-8)),E({x:be,y:ae}),z(G),b(!0)},[]);x.useEffect(()=>{function re(oe){const F=oe.target;F&&F.closest(".selection-actions")||ce()}return document.addEventListener("mouseup",re),()=>document.removeEventListener("mouseup",re)},[ce]);const ye=x.useCallback(()=>{var oe;const re=`
|
|
676
|
-
\`\`\`QUOTE
|
|
677
|
-
${R}
|
|
678
|
-
\`\`\`
|
|
679
|
-
|
|
680
|
-
`;m(F=>F+re),b(!1),z(""),(oe=window.getSelection())==null||oe.removeAllRanges(),setTimeout(()=>{if(y.current){Z(),y.current.focus();const F=y.current.value.length;y.current.setSelectionRange(F,F)}},0)},[R]);return a.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(re=>!re),children:[a.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((J=(Oe=(Se=t.turns)==null?void 0:Se[0])==null?void 0:Oe.user_prompt)==null?void 0:J.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:re=>{re.stopPropagation(),p()},title:"Scroll to text",children:a.jsx(d1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:he,children:[n.map(re=>a.jsx(Oy,{turn:re},re.id)),n.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),C&&a.jsx("div",{className:"selection-actions",style:{left:N.x,top:N.y},children:a.jsxs("button",{className:"discuss-button",onClick:ye,title:"Quote this text in your follow-up",children:[a.jsx(Rv,{size:14}),a.jsx("span",{children:"Quote"})]})}),t.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:y,className:"thread-card-followup-input",placeholder:I?"Agent is running…":"Type a follow-up…",value:g,onChange:re=>{Lt.markInputChange(),m(re.target.value),Z()},disabled:I,rows:1,style:{minHeight:L,maxHeight:q},onKeyDown:re=>{Lt.markKeystroke(),re.key==="Enter"&&(re.metaKey||re.ctrlKey)&&!I&&g.trim()&&(re.preventDefault(),d(g.trim()),m(""),$(L))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:I||!g.trim(),onClick:()=>{d(g.trim()),m("")},children:a.jsx(Bi,{size:13})}),I&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(Fr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:i,title:"Resolve thread",children:[a.jsx(Cl,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(Li,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(us,{size:13})," Delete"]})]})]})]})}function mC(){Lt.trackRender("ThreadsPanel");const t=A(E=>E.activeSessionId),n=A(E=>{var R;return E.activeSessionId?((R=E.sessionDetails[E.activeSessionId])==null?void 0:R.threads)??bg:bg}),r=x.useMemo(()=>n.filter(E=>!mf(E)),[n]),i=A(E=>E.followupThread),l=A(E=>E.cancelThreadTurn),c=A(E=>E.reopenThread),d=A(E=>E.deleteThread),p=A(E=>E.deepLinkThreadId),g=A(E=>E.setDeepLinkThreadId),[m,v]=x.useState("open"),[k,y]=x.useState(null);x.useEffect(()=>{if(!p)return;const E=p;g(null),v(z=>r.some(I=>I.id===E&&I.status==="open")?z:"all");const R=setTimeout(()=>{const z=document.getElementById(`thread-${E}`);z&&(z.scrollIntoView({behavior:"smooth",block:"center"}),z.classList.add("thread-card-highlighted"),setTimeout(()=>z.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(R)},[p,g,r]);const S=r.filter(E=>m==="open"?E.status==="open":m==="resolved"?E.status==="resolved":!0),C=r.filter(E=>E.status==="open").length,b=r.filter(E=>E.status==="resolved").length;function N(E){setTimeout(()=>{const R=document.querySelector(`mark[data-thread-id="${E}"]`);R&&(R.scrollIntoView({behavior:"smooth",block:"center"}),R.classList.add("thread-mark-flash"),setTimeout(()=>R.classList.remove("thread-mark-flash"),1500))},50)}return t?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(_v,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"No threads yet."}),a.jsx("div",{style:{fontSize:"11px",marginTop:"4px"},children:"Select text in an agent response to start a discussion."})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"thread-filter-tabs",children:[a.jsxs("button",{className:`thread-filter-tab ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",C,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",b,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(E=>a.jsx(hC,{thread:E,threadTurns:E.turns??[],onStop:()=>l(t,E.id),onResolve:()=>y(E),onReopen:()=>c(t,E.id),onDelete:()=>d(t,E.id),onFollowup:R=>i(t,E.id,R),onLocate:()=>N(E.id)},E.id)),k&&a.jsx(uC,{thread:k,onClose:()=>y(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function gC(){const t=A(d=>d.apps),n=A(d=>d.activeAppTabId),r=A(d=>d.openAppTab),i=A(d=>d.startAppEdit),l=A(d=>d.toggleAppPin),c=A(d=>d.deleteApp);return t.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:t.map(d=>a.jsxs("div",{className:`apps-panel-row${n===d.id?" active":""}`,onClick:()=>r(d.id),title:d.description??void 0,children:[a.jsx(Io,{iconNode:d.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:d.title}),d.description&&a.jsx("span",{className:"apps-panel-desc",children:d.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:p=>{p.stopPropagation(),i(d.id)},children:a.jsx(fl,{size:12})}),a.jsx("button",{className:`apps-panel-action${d.pinned?" pinned":""}`,title:d.pinned?"Unpin app":"Pin app (sorts first)",onClick:p=>{p.stopPropagation(),l(d.id)},children:a.jsx(jl,{size:12,fill:d.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:p=>{p.stopPropagation(),c(d.id)},children:a.jsx(us,{size:12})})]},d.id))})}const vC=24;function yC(){Lt.trackRender("SidecarPanel");const t=A(E=>E.activeSessionId),n=A(E=>{var R;return E.activeSessionId?(R=E.sessionDetails[E.activeSessionId])==null?void 0:R.runtime_type:void 0}),r=A(E=>{var R;return E.activeSessionId?lC((R=E.sessionDetails[E.activeSessionId])==null?void 0:R.threads):null}),i=A(E=>E.askSidecar),l=A(E=>E.cancelThreadTurn),c=A(E=>E.deleteThread),[d,p]=x.useState(""),[g,m]=x.useState(!1),v=x.useRef(null),k=x.useRef(!0),y=(r==null?void 0:r.turns)??[],S=y[y.length-1],C=y.some(zs);if(x.useEffect(()=>{k.current=!0},[t,y.length]),x.useEffect(()=>{const E=v.current;E&&k.current&&(E.scrollTop=E.scrollHeight)},[t,y.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!t||!n)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!aC(n))return a.jsxs("div",{className:"empty-state",children:[a.jsx(mr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const b=!C&&!g&&d.trim().length>0;async function N(){if(!t||!b)return;m(!0);const E=await i(t,d.trim());m(!1),E&&p("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:E=>{const R=E.currentTarget;k.current=R.scrollHeight-R.scrollTop-R.clientHeight<=vC},children:y.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(mr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"Ask about this session."}),a.jsx("div",{className:"sidecar-hint",children:"Where does it stand? Is it stuck? When will it finish? What is done and what is left?"})]}):y.map(E=>a.jsx(Oy,{turn:E,formatPrompt:cC},E.id))}),a.jsxs("div",{className:"sidecar-footer",children:[a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:C?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:C,onChange:E=>{Lt.markInputChange(),p(E.target.value)},onKeyDown:E=>{Lt.markKeystroke(),E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),N())}}),C&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(t,r.id),children:a.jsx(Fr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!b,onClick:()=>void N(),children:a.jsx(Bi,{size:13})})]}),r&&a.jsx("div",{className:"thread-card-actions",children:a.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:C,onClick:()=>c(t,r.id),children:[a.jsx(us,{size:13})," Clear"]})})]})]})}function xC(){var g;Lt.trackRender("RightPanel");const t=A(m=>m.activeRightTab),n=A(m=>m.switchRightTab),r=A(m=>m.rightPanelCollapsed),i=A(m=>m.toggleRightPanel),l=A(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=A(m=>m.activeSessionId?hf(m.backgroundTasks[m.activeSessionId]):0),d=((g=l==null?void 0:l.threads)==null?void 0:g.filter(m=>m.status==="open"&&!mf(m)).length)??0,p=[{id:"turns",label:"Turns",icon:o1},{id:"sidecar",label:"Sidecar",icon:mr},{id:"tasks",label:"Tasks",icon:r1,badge:c||void 0},{id:"threads",label:"Threads",icon:_v,badge:d||void 0},{id:"apps",label:"Apps",icon:jv}];return r?a.jsxs("div",{className:"ide-right collapsed",children:[a.jsx("button",{type:"button",className:"right-icon-btn",title:"Expand panel","aria-label":"Expand panel","aria-expanded":!1,onClick:i,children:a.jsx(p1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),p.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>n(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:p.map(m=>a.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>n(m.id),children:[m.label,m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id))}),a.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:i,children:a.jsx(f1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[t==="turns"&&a.jsx(JT,{}),t==="sidecar"&&a.jsx(yC,{}),t==="tasks"&&a.jsx(rC,{}),t==="threads"&&a.jsx(mC,{}),t==="apps"&&a.jsx(gC,{})]})]})}const De={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},jd=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max,De.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high,De.xhigh,De.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[De.low,De.medium,De.high]}]}];function wC(t){return jd.find(n=>n.id===t)}function gf(t){const n=wC(t);return(n==null?void 0:n.models)??[]}function Py(t,n){return gf(t).find(r=>r.slug===n)}function _d(t,n){var r;return((r=Py(t,n))==null?void 0:r.reasoningLevels)??[]}function Rd(t,n){var r;return(r=Py(t,n))==null?void 0:r.defaultReasoning}function kC(){const{activeSessionId:t,sessions:n,updateModelConfig:r}=A(),i=A(J=>J.showModelSelector),l=A(J=>J.setShowModelSelector),c=n.find(J=>J.id===t),d=A(J=>J.models),p=A(J=>J.modelsLoading),g=A(J=>J.loadModels),[m,v]=x.useState(!1),k=x.useRef(null);if(Ui(k,()=>v(!1),m),Ao(()=>v(!1),m),x.useEffect(()=>{i&&(v(!0),l(!1))},[i,l]),x.useEffect(()=>{c!=null&&c.runtime_type&&g(c.runtime_type,c.cwd??void 0)},[c==null?void 0:c.runtime_type,c==null?void 0:c.cwd,g]),!c)return null;const y=c.runtime_type,S=c.model??"",C=c.model_reasoning_effort??"",b=d.length>0?d:[],N=gf(y),R=[...b.length>0?b:N];if(S&&!R.some(J=>J.slug===S)){const J=N[0];R.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(J==null?void 0:J.defaultReasoning)??"medium",reasoningLevels:(J==null?void 0:J.reasoningLevels)??[]})}function z(J){return R.find(re=>re.slug===J)}function I(J){var re;return b.length>0?((re=z(J))==null?void 0:re.reasoningLevels)??[]:_d(y,J)}function L(J){var re;return b.length>0?(re=z(J))==null?void 0:re.defaultReasoning:Rd(y,J)}const q=jd.find(J=>J.id===y),K=z(S),$=S?I(S):[],Z=(q==null?void 0:q.label)??y,he=(K==null?void 0:K.displayName)??(S||"Default"),ce=$.find(J=>J.effort===C),ye=(ce==null?void 0:ce.label)??(C||"Default");function Se(J){var Q;const re=I(J),F=re.some(G=>G.effort===C)?C:L(J)??((Q=re[0])==null?void 0:Q.effort)??"";r(J,F),v(!1)}function Oe(J){r(S,J),v(!1)}return a.jsxs("div",{className:"model-selector",ref:k,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:Z}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:he}),ye!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:ye})]}),a.jsx(jo,{size:12,className:"model-selector-chevron"})]}),m&&a.jsxs("div",{className:"model-selector-popover",children:[a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Provider"}),jd.map(J=>a.jsxs("div",{className:`model-selector-item ${J.id===y?"selected":""} ${J.available?"":"disabled"}`,onClick:()=>{if(J.available){if(J.id===y){v(!1);return}r("","",J.id)}},children:[a.jsx("span",{children:J.label}),!J.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(l1,{size:10})," Soon"]}),J.id===y&&a.jsx(Ts,{size:12})]},J.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),p&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!p&&R.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),R.map(J=>a.jsxs("div",{className:`model-selector-item ${J.slug===S?"selected":""}`,onClick:()=>Se(J.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:J.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:J.description})]}),J.slug===S&&a.jsx(Ts,{size:12})]},J.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),$.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),$.map(J=>a.jsxs("div",{className:`model-selector-item ${J.effort===C?"selected":""}`,onClick:()=>Oe(J.effort),children:[a.jsx("span",{children:J.label}),J.effort===C&&a.jsx(Ts,{size:12})]},J.effort))]})]})]})}function ki(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Ng(){const t=A(r=>r.canGoBack),n=A(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!t,onClick:()=>window.history.back(),children:a.jsx(Wk,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:a.jsx(Hk,{size:14})})]})}function Tg(){const t=A(n=>n.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[a.jsx(C1,{size:14})," Repoburg"]})}function Cg(){const t=A(r=>r.usageViewOpen),n=A(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:n,children:[a.jsx(Tv,{size:14})," Usage"]})}function Eg(){const t=A(r=>r.vscodeViewOpen),n=A(r=>r.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:n,children:[a.jsx(Yk,{size:14})," Code"]})}function jg(){const t=A(r=>r.terminalViewOpen),n=A(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open a terminal",onClick:n,children:[a.jsx(Dv,{size:14})," Terminal"]})}function SC(){Lt.trackRender("StatusBar");const t=A(v=>v.activeSessionId),n=A(v=>t?v.sessions.find(k=>k.id===t)??null:null),r=A(v=>t?v.sessionDetails[t]??null:null),i=A(v=>t?v.backgroundTasks[t]:void 0),l=A(v=>v.wsConnected),c=A(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Ng,{}),a.jsx(Tg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Eg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(jg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Cg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Sm,{size:14})," K"]})]});const p=i??[],g=Kl(n,p.length),m=hf(p);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Ng,{}),a.jsx(Tg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Eg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(jg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Cg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(kC,{}),m>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",style:{color:"var(--amber)",cursor:"pointer"},title:`${m} Monitor task${m>1?"s":""} running — click to view`,onClick:()=>c("tasks"),children:[a.jsx(Mv,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:g.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),d&&a.jsx(bC,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Sm,{size:14})," K"]})]})}function bC({usage:t}){const n=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",r=`${ki(t.totalTokens)} / ${ki(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${ki(t.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:r,children:a.jsxs("span",{className:"sb-context-text",style:{color:n},children:[Math.round(t.percentage),"% / ",ki(t.totalTokens)," / ",ki(t.contextWindow)]})})]})}function _g(t){return Et(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function NC(t){return at("/vscode-web/start",{folder:t})}function TC(t){return at("/vscode-web/heartbeat",{id:t})}const CC=1e3,EC=5*6e4;function Rg({children:t}){const n=A(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:n,children:a.jsx(Nn,{size:16})})]})}function jC(){const t=A(C=>C.vscodeState),n=A(C=>C.vscodeId),r=A(C=>C.vscodeToken),i=A(C=>C.setVscodeView),l=A(C=>{var N;const b=C.activeSessionId?C.sessions.find(E=>E.id===C.activeSessionId):null;return b!=null&&b.cwd?b.cwd:((N=C.workspaces.find(E=>E.deleted===0))==null?void 0:N.path)??null}),[c,d]=x.useState(!1),[p,g]=x.useState(0),m=x.useRef(null),v=mn(),k=v===""||v===window.location.origin,y=`${v}/vscode/${n??""}/?tkn=${r??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;x.useEffect(()=>{let C=!1;function b(){m.current&&(clearInterval(m.current),m.current=null)}async function N(){try{let R=await _g(l);if((R.state==="stopped"||R.state==="error")&&(R=await NC(l)),C||(i(R.state,R.id,R.token),R.state==="running"||R.state==="error"))return;m.current=setInterval(async()=>{const z=await _g(l);C||(i(z.state,z.id,z.token),(z.state==="running"||z.state==="error"||z.state==="stopped")&&b())},CC)}catch{C||i("error",null,null)}}N();const E=setInterval(()=>{const R=A.getState().vscodeId;R&&TC(R).catch(()=>{})},EC);return()=>{C=!0,b(),clearInterval(E)}},[p,l,i]);function S(){d(!1),i("starting",null,null),g(C=>C+1)}return t!=="running"||!r||!n?a.jsx(Rg,{children:t==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[a.jsx(Li,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:y,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]}):a.jsxs(Rg,{children:[a.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(y,"_blank","noopener"),children:[a.jsx(bv,{size:14})," Open VS Code in a new tab"]})]})}function _C(t){const n=new URLSearchParams;return t.since&&n.set("since",t.since),t.until&&n.set("until",t.until),n.set("tz",t.timezone),t.fresh&&n.set("fresh","1"),Et(`/usage/report?${n.toString()}`)}const RC=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function So(t){return Math.round(t).toLocaleString("en-US")}function ts(t){return`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function bo(t){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(t)}function vf(t){const n=t.startsWith("anthropic/claude-")?t.slice(17):t.startsWith("claude-")?t.slice(7):t,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const AC={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function gl(t){return AC[t]??t.charAt(0).toUpperCase()+t.slice(1)}const Ul=t=>String(t).padStart(2,"0");function sc(t){return`${t.getFullYear()}-${Ul(t.getMonth()+1)}-${Ul(t.getDate())}`}function IC(t){const n=new Date(t);return Number.isNaN(n.getTime())?t:`${sc(n)} ${Ul(n.getHours())}:${Ul(n.getMinutes())}`}function Ag(t,n=new Date){if(t==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return t==="7d"?r.setDate(r.getDate()-6):t==="30d"?r.setDate(r.getDate()-29):t==="month"&&r.setDate(1),{since:sc(r),until:null}}function Ig(t){const n=new Date(`${t}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function yf(t,n){const r=[],i=new Date(`${t}T00:00:00Z`),l=new Date(`${n}T00:00:00Z`);for(;i<=l&&r.length<3700;)r.push(i.toISOString().slice(0,10)),i.setUTCDate(i.getUTCDate()+1);return r}const DC=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ad(t){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(t);if(!n)return t;const r=DC[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function MC(t,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(t))/1e3));if(r<45)return"just now";const i=Math.round(r/60);if(i<60)return`${i} min ago`;const l=Math.round(i/60);return l<24?`${l} h ago`:sc(new Date(t))}const Or=7,LC=92;function $y(t,n){const r=n.indexOf(t);return r>=0&&r<Or?r:Or}function vl(t){return t<Or?`var(--usage-series-${t+1})`:"var(--usage-series-other)"}function OC(t,n){return yf(Ig(t),Ig(n)).filter((r,i)=>i%7===0)}function PC(t,n){const{daily:r}=t;if(r.length===0)return null;const i=t.window.since??r[0].period,l=r[r.length-1].period,c=t.window.until??(n>l?n:l),d=yf(i,c);if(d.length<2)return null;const p=d.length>LC,g=new Map((p?t.weekly:r).map(y=>[y.period,y])),m=new Map,v=(p?OC(i,c):d).map(y=>{const S=g.get(y),C=new Map;let b=0;for(const R of(S==null?void 0:S.breakdown)??[]){if(R.cost_usd<=0)continue;const z=$y(R.model,t.model_order),I=C.get(z)??{slot:z,label:z<Or?vf(R.model):"Other",cost:0};I.cost+=R.cost_usd,b+=R.cost_usd,C.set(z,I)}const N=((S==null?void 0:S.cost_usd)??0)-b;if(N>.005){const R=C.get(Or)??{slot:Or,label:"Other",cost:0};R.cost+=N,C.set(Or,R)}const E=[...C.values()].sort((R,z)=>R.slot-z.slot);for(const R of E)m.set(R.slot,R.label);return{period:y,label:p?`Week of ${Ad(y)}`:Ad(y),total:E.reduce((R,z)=>R+z.cost,0),segments:E}});if(!v.some(y=>y.total>0))return null;const k=[...m.entries()].sort((y,S)=>y[0]-S[0]).map(([y,S])=>({slot:y,label:S}));return{unit:p?"week":"day",columns:v,series:k}}function $C(t){if(!(t>0))return[0,1];if(t<.01)return[0,.01];const n=t/4,r=10**Math.floor(Math.log10(n)),i=n/r,l=(i<=1?1:i<=2?2:i<=2.5?2.5:i<=5?5:10)*r,c=[];for(let d=0;d*l<t+l*1e-9||c.length<2;d++)c.push(d*l);return c[c.length-1]<t&&c.push(c.length*l),c}function zC(t,n){if(t>=1e4)return`$${bo(t)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${t.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const xo=t=>`${t}%`;function FC({data:t}){const{columns:n,series:r,unit:i}=t,[l,c]=x.useState(null),d=x.useMemo(()=>$C(Math.max(...n.map(b=>b.total))),[n]),p=d[d.length-1],g=d[1]-d[0],m=n.reduce((b,N,E)=>N.total>n[b].total?E:b,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,y=b=>{const N={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};b.key in N&&(b.preventDefault(),c(E=>Math.min(k-1,Math.max(0,(E??k-1)+N[b.key]))))},S=l===null?null:n[l],C=l===null?0:(l+.5)/k*100;return a.jsxs("div",{className:"usage-chart",children:[a.jsxs("div",{className:"usage-chart-head",children:[a.jsx("div",{className:"usage-section-title",children:i==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&a.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(b=>a.jsxs("li",{className:"usage-legend-item",children:[a.jsx("span",{className:"usage-swatch",style:{background:vl(b.slot)}}),b.label]},b.slot))})]}),a.jsxs("div",{className:"usage-plot-wrap",children:[a.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(b=>a.jsx("span",{className:"usage-ytick",style:{bottom:xo(b/p*100)},children:zC(b,g)},b))}),a.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${i==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${i}s.`,onKeyDown:y,onFocus:()=>c(b=>b??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(b=>a.jsx("div",{className:`usage-gridline${b===0?" usage-gridline-base":""}`,style:{bottom:xo(b/p*100)}},b)),a.jsx("div",{className:"usage-cols",children:n.map((b,N)=>a.jsxs("div",{className:`usage-col${l===N?" usage-col-active":""}`,"data-period":b.period,onMouseEnter:()=>c(N),children:[N===m&&b.total>0&&l!==N&&a.jsx("span",{className:"usage-peak",style:{bottom:`calc(${xo(b.total/p*100)} + 3px)`},children:ts(b.total)}),b.total>0&&a.jsx("div",{className:"usage-bar",style:{height:xo(b.total/p*100)},children:b.segments.map(E=>a.jsx("div",{className:"usage-seg",style:{flexGrow:E.cost,background:vl(E.slot)}},E.slot))})]},b.period))}),S&&a.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:xo(C),transform:C<20?"translateX(-12px)":C>80?"translateX(calc(-100% + 12px))":"translateX(-50%)"},children:[a.jsxs("div",{className:"usage-tooltip-head",children:[a.jsx("span",{children:S.label}),a.jsx("strong",{children:ts(S.total)})]}),S.segments.length===0&&a.jsx("div",{className:"usage-tooltip-empty",children:"No usage"}),[...S.segments].sort((b,N)=>N.cost-b.cost).map(b=>a.jsxs("div",{className:"usage-tooltip-line",children:[a.jsx("span",{className:"usage-swatch",style:{background:vl(b.slot)}}),a.jsx("span",{className:"usage-tooltip-model",children:b.label}),a.jsx("span",{children:ts(b.cost)})]},b.slot))]})]}),a.jsx("div",{}),a.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((b,N)=>(k-1-N)%v===0?a.jsx("span",{className:"usage-xtick",style:{left:xo((N+.5)/k*100),transform:N===0&&k>1?"translateX(-30%)":N===k-1?"translateX(-70%)":"translateX(-50%)"},children:Ad(b.period)},b.period):null)})]})]})}const Dg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],UC={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},id=50,BC={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function WC(t){return t.reduce((n,r)=>({input_tokens:n.input_tokens+r.input_tokens,output_tokens:n.output_tokens+r.output_tokens,cache_creation_tokens:n.cache_creation_tokens+r.cache_creation_tokens,cache_read_tokens:n.cache_read_tokens+r.cache_read_tokens,total_tokens:n.total_tokens+r.total_tokens,cost_usd:n.cost_usd+r.cost_usd}),BC)}function ad({t}){return a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"usage-num",children:So(t.input_tokens)}),a.jsx("td",{className:"usage-num",children:So(t.output_tokens)}),a.jsx("td",{className:"usage-num",children:So(t.cache_creation_tokens)}),a.jsx("td",{className:"usage-num",children:So(t.cache_read_tokens)}),a.jsx("td",{className:"usage-num",children:So(t.total_tokens)}),a.jsx("td",{className:"usage-num usage-cost",children:ts(t.cost_usd)})]})}function HC({models:t,order:n}){return a.jsx("span",{className:"usage-models",children:t.map(r=>a.jsxs("span",{className:"usage-model",title:r,children:[a.jsx("span",{className:"usage-swatch",style:{background:vl($y(r,n))}}),vf(r)]},r))})}function VC({row:t,onOpen:n}){const r=t.pane_session;if(!r)return a.jsx("span",{className:"usage-session-id usage-session-id-main",title:t.period,children:t.period});const i=r.title||"Untitled session";return a.jsxs("span",{className:"usage-session",children:[a.jsxs("span",{className:"usage-session-title",children:[a.jsx("button",{className:"usage-session-link",title:`Open "${i}"`,onClick:()=>n(r.id),children:i}),r.kind==="discussion"&&a.jsx("span",{className:"usage-tag",children:"discussion"})]}),a.jsx("span",{className:"usage-session-id",title:t.period,children:t.period})]})}function KC({report:t,onOpenSession:n}){var C;const[r,i]=x.useState("daily"),[l,c]=x.useState(!1),[d,p]=x.useState(!1),g=r==="session",m=g?t.sessions:t[r],v=g&&!d?m.slice(0,id):m,k=g?WC(t.sessions):t.totals,y=g?10:9,S=UC[r];return a.jsxs("div",{className:"usage-table-wrap",children:[a.jsxs("div",{className:"usage-table-head",children:[a.jsx("div",{className:"usage-tabs",role:"tablist","aria-label":"Report",children:Dg.map(b=>a.jsx("button",{role:"tab","aria-selected":r===b.id,className:`usage-tab${r===b.id?" usage-tab-active":""}`,onClick:()=>i(b.id),children:b.label},b.id))}),S&&a.jsx("span",{className:"usage-table-note",children:S}),a.jsxs("label",{className:"usage-check",title:"One line per agent and model, like ccusage --breakdown",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:b=>c(b.target.checked)}),"Breakdown"]})]}),a.jsx("div",{className:"usage-table-scroll",role:"tabpanel",children:a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:(C=Dg.find(b=>b.id===r))==null?void 0:C.column}),a.jsx("th",{children:"Agent"}),a.jsx("th",{children:"Models"}),a.jsx("th",{className:"usage-num",children:"Input"}),a.jsx("th",{className:"usage-num",children:"Output"}),a.jsx("th",{className:"usage-num",children:"Cache Create"}),a.jsx("th",{className:"usage-num",children:"Cache Read"}),a.jsx("th",{className:"usage-num",children:"Total Tokens"}),a.jsx("th",{className:"usage-num",children:"Cost (USD)"}),g&&a.jsx("th",{children:"Last Activity"})]})}),a.jsxs("tbody",{children:[m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:y,className:"usage-empty",children:"No usage in this range."})}),v.map(b=>{const N=g?b:null;return a.jsxs(x.Fragment,{children:[a.jsxs("tr",{className:"usage-row",children:[a.jsx("td",{className:"usage-period",children:N?a.jsx(VC,{row:N,onOpen:n}):b.period}),a.jsx("td",{children:N?gl(N.agent):b.agents.map(gl).join(", ")}),a.jsx("td",{children:a.jsx(HC,{models:b.models,order:t.model_order})}),a.jsx(ad,{t:b}),N&&a.jsx("td",{className:"usage-when",children:N.last_activity?IC(N.last_activity):"—"})]}),l&&b.breakdown.map(E=>a.jsxs("tr",{className:"usage-sub",children:[a.jsx("td",{}),a.jsx("td",{children:gl(E.agent)}),a.jsxs("td",{title:E.model,children:[a.jsx("span",{className:"usage-branch",children:"└─"})," ",vf(E.model)]}),a.jsx(ad,{t:E}),N&&a.jsx("td",{})]},`${E.agent}\0${E.model}`))]},b.period)})]}),m.length>0&&a.jsx("tfoot",{children:a.jsxs("tr",{className:"usage-total",children:[a.jsx("td",{children:"Total"}),a.jsx("td",{}),a.jsx("td",{}),a.jsx(ad,{t:k}),g&&a.jsx("td",{})]})})]})}),g&&m.length>id&&a.jsx("button",{className:"usage-more",onClick:()=>p(b=>!b),children:d?`Show the top ${id}`:`Show all ${m.length} sessions`})]})}const zy="agentpane:usage-budget",GC=6e4;function qC(){try{const t=Number(localStorage.getItem(zy));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function XC(t){try{localStorage.setItem(zy,String(t))}catch{}}function YC(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function yl({label:t,value:n,title:r,children:i}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:t}),a.jsx("div",{className:"usage-kpi-value",title:r,children:n}),i]})}function QC({spent:t}){const[n,r]=x.useState(qC),i=n>0?t/n:0,l=i>=1?"over":i>=.8?"near":"ok",c=d=>{const p=Number(d.replace(",",".")),g=Number.isFinite(p)&&p>0?p:0;r(g),XC(g)};return a.jsxs(yl,{label:"This month",value:ts(t),children:[n>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`usage-meter usage-meter-${l}`,role:"meter","aria-label":"Monthly budget used","aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":Math.min(t,n),children:a.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,i*100)}%`}})}),a.jsx("div",{className:`usage-kpi-sub${l==="over"?" usage-over":""}`,children:l==="over"?a.jsxs(a.Fragment,{children:[a.jsx(ql,{size:11})," ",ts(t-n)," over the ",ts(n)," budget"]}):`${ts(n-t)} left of ${ts(n)}`})]}):a.jsx("div",{className:"usage-kpi-sub",children:"No monthly budget set"}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:n>0?n:"",placeholder:"none",onBlur:d=>c(d.target.value),onKeyDown:d=>{d.key==="Enter"&&c(d.currentTarget.value)}})]})]})}const ZC=(t,n)=>t.since===n.since&&t.until===n.until;function JC(){const t=A(z=>z.toggleUsageView),n=A(z=>z.selectSession),[r,i]=x.useState("30d"),[l,c]=x.useState(null),[d,p]=x.useState(null),[g,m]=x.useState(!1),v=x.useMemo(YC,[]),k=x.useRef(0),y=x.useCallback(z=>{const I=++k.current,{since:L,until:q}=Ag(r),K=async $=>{const Z=await _C({since:L,until:q,timezone:v,fresh:$});I===k.current&&(c(Z),p(null),!$&&Z.generated_at&&Date.now()-Date.parse(Z.generated_at)>GC&&await K(!0))};m(!0),K(z).catch($=>{I===k.current&&p($.message)}).finally(()=>{I===k.current&&m(!1)})},[r,v]);x.useEffect(()=>{y(!1)},[y]),x.useEffect(()=>()=>{k.current++},[]);const S=z=>{t(),n(z)},C=sc(new Date),b=x.useMemo(()=>l?PC(l,C):null,[l,C]),N=g&&l!==null&&!ZC(l.window,Ag(r)),E=l==null?void 0:l.totals,R=l&&l.daily.length>0?yf(l.window.since??l.daily[0].period,l.window.until??C).length:0;return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(Tv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[RC.map(z=>a.jsx("button",{className:`usage-range-btn${r===z.id?" usage-range-btn-active":""}`,"aria-pressed":r===z.id,onClick:()=>i(z.id),children:z.label},z.id)),a.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>y(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:a.jsx(Nm,{size:13,className:g?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:a.jsx(Nn,{size:16})})]})]}),d&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",d]}),!l&&!d&&a.jsxs("div",{className:"usage-loading",children:[a.jsx(Nm,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),l&&E&&a.jsxs("div",{className:`usage-body${N?" usage-body-stale":""}`,"aria-busy":g,children:[l.source.ccusage_error&&a.jsxs("div",{className:"usage-warning",role:"alert",children:[a.jsx(ql,{size:13}),a.jsxs("span",{children:["ccusage could not read the Claude Code and Codex logs, so only Repoburg calls are counted:"," ",l.source.ccusage_error]})]}),a.jsxs("div",{className:"usage-kpis",children:[a.jsx(yl,{label:"Cost (USD)",value:ts(E.cost_usd),children:a.jsx("div",{className:"usage-kpi-sub",children:l.by_agent.length===0?"No usage in this range":l.by_agent.map(z=>`${gl(z.agent)} ${ts(z.cost_usd)}`).join(" · ")})}),a.jsx(QC,{spent:l.month_to_date_cost_usd}),a.jsxs(yl,{label:"Total tokens",value:bo(E.total_tokens),title:`${So(E.total_tokens)} tokens`,children:[a.jsxs("div",{className:"usage-kpi-sub",children:["Input ",bo(E.input_tokens)," · Output ",bo(E.output_tokens)]}),a.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",bo(E.cache_creation_tokens)," · Cache Read"," ",bo(E.cache_read_tokens)]})]}),a.jsx(yl,{label:"Daily average",value:R>0?ts(E.cost_usd/R):"—",children:a.jsx("div",{className:"usage-kpi-sub",children:R>0?`over ${R} ${R===1?"day":"days"} · ${l.daily.length} with usage`:"No usage in this range"})})]}),b&&a.jsx(FC,{data:b}),a.jsx(KC,{report:l,onOpenSession:S}),l.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["No price for these Repoburg models, counted as $0: ",l.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-source",children:["Claude Code and Codex costs by"," ",a.jsx("a",{href:"https://github.com/ryoppippi/ccusage",target:"_blank",rel:"noreferrer",children:"ccusage"}),l.source.ccusage_version?` ${l.source.ccusage_version}`:""," with LiteLLM prices · Repoburg calls priced by AgentPane · days in ",l.timezone,l.generated_at&&` · logs read ${MC(l.generated_at)}`]})]})]})}const Mg="claude auth login";function eE(){const t=A(p=>Object.keys(p.signedOutTurns).length),n=A(p=>p.terminalViewOpen),r=A(p=>p.toggleTerminalView),i=A(p=>p.addToast),[l,c]=x.useState(!1);if(t===0)return null;const d=()=>{c(!0),ew().catch(p=>i("error",`Could not resume the turns — ${Pr(p)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(n1,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",t===1?"1 turn is":`${t} turns are`," waiting. Run"," ",a.jsx("code",{children:Mg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void $i(Mg),children:[a.jsx(Mi,{size:12}),"Copy"]}),!n&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(Dv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(Av,{size:12}),t===1?"Resume turn":"Resume turns"]})]})}const Lg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,tE=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,nE={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function Fy(){return mn()||window.location.origin}function Uy(t,n){let r=n;if(r&&typeof r=="object"){const d=r;r=typeof d.id=="string"?d.id:d.url}if(typeof r!="string")return null;const i=r.trim();if(Lg.test(i))return i;const l=tE.exec(i);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===t&&Lg.test(l[2])?l[2]:null}function Og(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${Fy()}${t.url}`}}function sE(t){return nE[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function By(t){return new Promise((n,r)=>{const i=new FileReader;i.onload=()=>{const l=String(i.result??"");n(l.slice(l.indexOf(",")+1))},i.onerror=()=>r(i.error??new Error("Could not read the file")),i.readAsDataURL(t)})}function rE(t,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return r?{type:n||r[1]||void 0,data:t.slice(r[0].length)}:{type:n,data:t}}async function Wy(t){if(t instanceof Blob){const n=t.name;return{name:typeof n=="string"&&n?n:void 0,type:t.type||void 0,data:await By(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const n=t;return{name:typeof n.name=="string"&&n.name?n.name:void 0,type:typeof n.type=="string"&&n.type?n.type:void 0,data:n.data}}return null}async function oE(t){const n=await Wy(t);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function iE(t,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const i=[];for(let l=0;l<n.length;l++){const c=n[l],d=await Wy(c);if(d){const{type:m,data:v}=rE(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);i.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const p=Uy(t,c);if(!p)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const g=await r(p);i.push({name:p,media_type:sE(p),data:await By(g)})}return i}const aE=`function (config) {
|
|
681
|
-
var nextId = 1;
|
|
682
|
-
var pending = new Map();
|
|
683
|
-
var listeners = [];
|
|
684
|
-
// Absolute http(s) URL, or null. Relative and #fragment hrefs are not
|
|
685
|
-
// external and keep their in-frame behavior.
|
|
686
|
-
function externalUrl(raw) {
|
|
687
|
-
if (typeof raw !== 'string' || !/^\\s*https?:\\/\\//i.test(raw)) return null;
|
|
688
|
-
try { return new URL(raw.trim()).href; } catch (err) { return null; }
|
|
689
|
-
}
|
|
690
|
-
// New browser tab. The sandbox lets popups escape it, so the page loads
|
|
691
|
-
// like any other tab; noopener leaves it no handle back to this frame.
|
|
692
|
-
function openTab(url) {
|
|
693
|
-
window.open(url, '_blank', 'noopener,noreferrer');
|
|
694
|
-
}
|
|
695
|
-
// A plain external link would navigate THIS frame: the app disappears and
|
|
696
|
-
// most sites refuse to be framed anyway. Open it in a new tab instead.
|
|
697
|
-
// Bubble phase on window, so the app's own handlers run first and can
|
|
698
|
-
// still claim the click with preventDefault(). Modifier clicks and
|
|
699
|
-
// target="_blank" links already open a tab natively.
|
|
700
|
-
window.addEventListener('click', function (e) {
|
|
701
|
-
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
702
|
-
var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
|
|
703
|
-
if (!a) return;
|
|
704
|
-
var target = (a.getAttribute('target') || '').toLowerCase();
|
|
705
|
-
if (target && target !== '_self' && target !== '_parent' && target !== '_top') return;
|
|
706
|
-
var url = externalUrl(a.getAttribute('href'));
|
|
707
|
-
if (!url) return;
|
|
708
|
-
e.preventDefault();
|
|
709
|
-
openTab(url);
|
|
710
|
-
});
|
|
711
|
-
// Stored files: <apiOrigin>/api/apps/<app-id>/files/<id>. Same reference
|
|
712
|
-
// rules as the pane (utils/appFiles.ts): an id, a file URL of this app on
|
|
713
|
-
// any origin, or an object carrying id/url.
|
|
714
|
-
var FILE_ID_RE = /^[a-f0-9]{64}\\.(?:png|jpg|gif|webp)$/;
|
|
715
|
-
var FILE_URL_RE = /^(?:https?:\\/\\/[^\\/?#]+)?\\/api\\/apps\\/([^\\/?#]+)\\/files\\/([^\\/?#]+)$/i;
|
|
716
|
-
function fileRefId(ref) {
|
|
717
|
-
if (ref && typeof ref === 'object') ref = typeof ref.id === 'string' ? ref.id : ref.url;
|
|
718
|
-
if (typeof ref !== 'string') return null;
|
|
719
|
-
var s = ref.trim();
|
|
720
|
-
if (FILE_ID_RE.test(s)) return s;
|
|
721
|
-
var m = FILE_URL_RE.exec(s);
|
|
722
|
-
if (!m) return null;
|
|
723
|
-
var owner;
|
|
724
|
-
try { owner = decodeURIComponent(m[1]); } catch (err) { return null; }
|
|
725
|
-
return owner === config.appId && FILE_ID_RE.test(m[2]) ? m[2] : null;
|
|
726
|
-
}
|
|
727
|
-
function fileUrl(ref) {
|
|
728
|
-
var id = fileRefId(ref);
|
|
729
|
-
if (!id) return typeof ref === 'string' ? ref : '';
|
|
730
|
-
return config.apiOrigin + '/api/apps/' + encodeURIComponent(config.appId) + '/files/' + id;
|
|
731
|
-
}
|
|
732
|
-
window.addEventListener('message', function (e) {
|
|
733
|
-
var msg = e.data;
|
|
734
|
-
if (!msg || msg.source !== 'agentpane-host') return;
|
|
735
|
-
if (msg.id != null && pending.has(msg.id)) {
|
|
736
|
-
var p = pending.get(msg.id);
|
|
737
|
-
pending.delete(msg.id);
|
|
738
|
-
if (msg.ok) {
|
|
739
|
-
p.resolve(msg.result);
|
|
740
|
-
} else {
|
|
741
|
-
var err = new Error(msg.error || 'bridge error');
|
|
742
|
-
// code 'conflict': setState's ifVersion is stale; state = the stored copy.
|
|
743
|
-
if (msg.code) err.code = msg.code;
|
|
744
|
-
if (msg.state) err.state = msg.state;
|
|
745
|
-
p.reject(err);
|
|
746
|
-
}
|
|
747
|
-
} else if (msg.event) {
|
|
748
|
-
for (var i = 0; i < listeners.length; i++) {
|
|
749
|
-
try { listeners[i](msg.event, msg.payload); } catch (err) { /* app error */ }
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
function call(method, params) {
|
|
754
|
-
return new Promise(function (resolve, reject) {
|
|
755
|
-
var id = nextId++;
|
|
756
|
-
pending.set(id, { resolve: resolve, reject: reject });
|
|
757
|
-
try {
|
|
758
|
-
parent.postMessage({ source: 'agentpane-app', id: id, method: method, params: params || null }, '*');
|
|
759
|
-
} catch (err) {
|
|
760
|
-
// Params that cannot be cloned (functions, DOM nodes, ...).
|
|
761
|
-
pending.delete(id);
|
|
762
|
-
reject(err);
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
window.AgentPane = {
|
|
767
|
-
getApp: function () { return call('getApp'); },
|
|
768
|
-
getState: function () { return call('getState'); },
|
|
769
|
-
setState: function (data, opts) {
|
|
770
|
-
var params = { data: data };
|
|
771
|
-
if (opts && typeof opts.ifVersion === 'number') params.ifVersion = opts.ifVersion;
|
|
772
|
-
return call('setState', params);
|
|
773
|
-
},
|
|
774
|
-
createSession: function (opts) { return call('createSession', opts); },
|
|
775
|
-
submitTurn: function (sessionId, prompt, opts) {
|
|
776
|
-
var params = { sessionId: sessionId, prompt: prompt };
|
|
777
|
-
if (opts && opts.attachments != null) params.attachments = opts.attachments;
|
|
778
|
-
return call('submitTurn', params);
|
|
779
|
-
},
|
|
780
|
-
getSession: function (sessionId) { return call('getSession', { sessionId: sessionId }); },
|
|
781
|
-
listSessions: function (opts) {
|
|
782
|
-
var params = {};
|
|
783
|
-
if (opts && (opts.lifecycle === 'working' || opts.lifecycle === 'finished')) params.lifecycle = opts.lifecycle;
|
|
784
|
-
if (opts && typeof opts.running === 'boolean') params.running = opts.running;
|
|
785
|
-
return call('listSessions', params);
|
|
786
|
-
},
|
|
787
|
-
getSessionInfo: function (sessionId) { return call('getSessionInfo', { sessionId: sessionId }); },
|
|
788
|
-
cancelTurn: function (sessionId) { return call('cancelTurn', { sessionId: sessionId }); },
|
|
789
|
-
setSessionLifecycle: function (sessionId, lifecycle) { return call('setSessionLifecycle', { sessionId: sessionId, lifecycle: lifecycle }); },
|
|
790
|
-
callTool: function (tool, args) { return call('callTool', { tool: tool, args: args }); },
|
|
791
|
-
listProviders: function () { return call('listProviders'); },
|
|
792
|
-
listModels: function (runtime, cwd) { return call('listModels', { runtime: runtime, cwd: cwd }); },
|
|
793
|
-
pickDirectory: function () { return call('pickDirectory'); },
|
|
794
|
-
onTurnCompleted: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:completed' || event === 'turn:failed') cb(event, payload); }); },
|
|
795
|
-
onTurnDelta: function (cb) { listeners.push(function (event, payload) { if (event === 'turn:delta' && payload) cb(payload); }); },
|
|
796
|
-
onToolCall: function (cb) { listeners.push(function (event, payload) { if (event === 'tool_call' && payload) cb(payload); }); },
|
|
797
|
-
onStateChanged: function (cb) { listeners.push(function (event, payload) { if (event === 'state_changed') cb(payload || {}); }); },
|
|
798
|
-
onBackgroundTasks: function (cb) { listeners.push(function (event, payload) { if (event === 'background_tasks' && payload) cb(payload); }); },
|
|
799
|
-
resolveToolCall: function (callId, result) { return call('resolveToolCall', { callId: callId, result: result }); },
|
|
800
|
-
openSession: function (sessionId) { return call('openSession', { sessionId: sessionId }); },
|
|
801
|
-
openUrl: function (url) {
|
|
802
|
-
var href = externalUrl(url);
|
|
803
|
-
if (!href) return Promise.reject(new Error('openUrl: expected an absolute http(s) URL, got ' + JSON.stringify(url)));
|
|
804
|
-
try { openTab(href); } catch (err) { return Promise.reject(err); }
|
|
805
|
-
return Promise.resolve({ ok: true });
|
|
806
|
-
},
|
|
807
|
-
uploadFile: function (file) { return call('uploadFile', { file: file }); },
|
|
808
|
-
getFile: function (ref) { return call('getFile', { ref: ref }); },
|
|
809
|
-
fileUrl: fileUrl
|
|
810
|
-
};
|
|
811
|
-
// Runtime error reporting — surface compile checks' blind side to the pane.
|
|
812
|
-
window.addEventListener('error', function (e) {
|
|
813
|
-
parent.postMessage({
|
|
814
|
-
source: 'agentpane-app', report: 'error',
|
|
815
|
-
message: e.message || 'Unknown error',
|
|
816
|
-
stack: (e.error && e.error.stack) || '',
|
|
817
|
-
line: e.lineno || 0, col: e.colno || 0
|
|
818
|
-
}, '*');
|
|
819
|
-
});
|
|
820
|
-
window.addEventListener('unhandledrejection', function (e) {
|
|
821
|
-
var r = e.reason;
|
|
822
|
-
var msg = r && (r.message || String(r)) || 'unknown';
|
|
823
|
-
parent.postMessage({
|
|
824
|
-
source: 'agentpane-app', report: 'error',
|
|
825
|
-
message: 'Unhandled promise rejection: ' + msg,
|
|
826
|
-
stack: (r && r.stack) || '', line: 0, col: 0
|
|
827
|
-
}, '*');
|
|
828
|
-
});
|
|
829
|
-
}`;function lE(t){return`(${aE})(${JSON.stringify(t)});`}function Pg(t){return t.replace(/<\/script/gi,"<\\/script")}function cE(t,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(r,"gi");let l=-1,c;for(;(c=i.exec(t))!==null;)l=c.index;return l}function $g(t,n,r){const i=cE(t,n);return i===-1?t+r:t.slice(0,i)+r+t.slice(i)}function uE(t,n,r){let i=t;const l=`<script>${Pg(n)}<\/script>`;if(/<\/head>/i.test(i)?i=$g(i,"</head>",l):/<html[^>]*>/i.test(i)?i=i.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):i=`${l}${i}`,r){const c=`<script>${Pg(r)}<\/script>`;i=$g(i,"</body>",c)}return i}function dE(){const t=globalThis.crypto;return t&&typeof t.randomUUID=="function"?`tab-${t.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function fE(t){var r;if(!(t instanceof zi)||t.status!==409)return null;const n=(r=t.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function pE({appId:t,workspace:n=""}){const r=x.useRef(null),i=x.useRef({pinned:!1,data:null}),[l,c]=x.useState(null),[d,p]=x.useState(null),[g,m]=x.useState([]);x.useEffect(()=>{let S=!0;const C=dE(),b=E=>{const R=i.current.version;typeof E.version=="number"&&typeof R=="number"&&E.version<R||(i.current=E)};kw(t,E=>{var R,z;return(z=(R=r.current)==null?void 0:R.contentWindow)==null?void 0:z.postMessage(E,"*")},n);const N=async E=>{var K,$,Z,he,ce,ye,Se,Oe,J,re,oe,F,Q,G,D,P,le,W,X,ae,be,_e,Ae,je;if(E.source!==((K=r.current)==null?void 0:K.contentWindow))return;const R=E.data;if(!R||R.source!=="agentpane-app")return;if(R.report==="error"){const me={message:String(R.message??"Unknown error"),stack:String(R.stack??"")};m(pe=>{const Ve=pe[pe.length-1];return Ve&&Ve.message===me.message?pe:[...pe,me].slice(-20)});return}if(typeof R.method!="string")return;let z=!0,I,L,q=null;try{switch(R.method){case"getApp":I={id:t,workspace:n};break;case"getState":try{const me=await gm(t,n);b(me),I=me}catch{I=i.current}break;case"setState":{const me=(($=R.params)==null?void 0:$.data)??null,pe=(Z=R.params)==null?void 0:Z.ifVersion,Ve={data:me,writer:C};typeof pe=="number"&&(Ve.ifVersion=pe);try{const Ie=await pv(t,Ve,n);b(Ie),I=Ie}catch(Ie){if(q=fE(Ie),!q)throw Ie;b(q);const mt=Ie.body;throw new Error(typeof(mt==null?void 0:mt.error)=="string"?mt.error:"App state changed since that version")}break}case"createSession":{const me=R.params??{},pe=await Pd({title:typeof me.title=="string"?me.title:void 0,runtime_type:typeof me.runtime_type=="string"?me.runtime_type:void 0,model:typeof me.model=="string"?me.model:void 0,model_reasoning_effort:typeof me.model_reasoning_effort=="string"?me.model_reasoning_effort:void 0,cwd:typeof me.cwd=="string"?me.cwd:void 0,origin_app_id:t,origin_app_workspace:n});cl(pe.id,t),A.getState().addSession(pe),I=pe;break}case"submitTurn":{const me=String(((he=R.params)==null?void 0:he.sessionId)??"");if(!await vm(t,me))throw new Error(`submitTurn: ${me} is not a session of this app`);const pe=String(((ce=R.params)==null?void 0:ce.prompt)??""),Ve=await iE(t,(ye=R.params)==null?void 0:ye.attachments,mt=>kk(t,mt)),Ie=await Jg(me,pe,Ve.length?Ve:void 0,{originAppId:t});cl(me,t),I=Ie;break}case"getSession":{I=await vm(t,String(((Se=R.params)==null?void 0:Se.sessionId)??""));break}case"listSessions":{const me=(Oe=R.params)==null?void 0:Oe.lifecycle,pe=(J=R.params)==null?void 0:J.running;I=await lk(t,n,{lifecycle:me==="working"||me==="finished"?me:void 0,running:typeof pe=="boolean"?pe:void 0});break}case"getSessionInfo":{I=await ck(t,n,String(((re=R.params)==null?void 0:re.sessionId)??""));break}case"cancelTurn":{I=await uk(t,String(((oe=R.params)==null?void 0:oe.sessionId)??""));break}case"setSessionLifecycle":{I=await dk(t,String(((F=R.params)==null?void 0:F.sessionId)??""),String(((Q=R.params)==null?void 0:Q.lifecycle)??""));break}case"callTool":{const me=(G=R.params)==null?void 0:G.args;I=await fk(t,n,String(((D=R.params)==null?void 0:D.tool)??""),me&&typeof me=="object"?me:{});break}case"listProviders":{I=await Ly();break}case"listModels":{const me=typeof((P=R.params)==null?void 0:P.runtime)=="string"?R.params.runtime.trim():"";if(!me)throw new Error("listModels: runtime is required");const pe=(le=R.params)==null?void 0:le.cwd;I=await dv(me,typeof pe=="string"&&pe?pe:void 0);break}case"pickDirectory":{if(A.getState().activeAppTabId!==t)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");I=await tv();break}case"resolveToolCall":{const me=String(((W=R.params)==null?void 0:W.callId)??""),pe=(X=R.params)==null?void 0:X.result;await vk(me,pe),I={ok:!0};break}case"openSession":{if(A.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const me=typeof((ae=R.params)==null?void 0:ae.sessionId)=="string"?R.params.sessionId.trim():"";if(!me)throw new Error("openSession: sessionId is required");try{await A.getState().revealSession(me)}catch(pe){throw new Error(`openSession: ${pe instanceof Error?pe.message:String(pe)}`)}I={ok:!0};break}case"uploadFile":{const me=await oE((be=R.params)==null?void 0:be.file);try{I=Og(await xk(t,me))}catch(pe){throw new Error(`uploadFile: ${pe instanceof Error?pe.message:String(pe)}`)}break}case"getFile":{const me=Uy(t,(_e=R.params)==null?void 0:_e.ref),pe=me?await wk(t,me):null;I=pe?Og(pe):null;break}default:throw new Error(`Unknown bridge method: ${R.method}`)}}catch(me){z=!1,L=me instanceof Error?me.message:String(me)}(je=(Ae=r.current)==null?void 0:Ae.contentWindow)==null||je.postMessage(q?{source:"agentpane-host",id:R.id,ok:z,error:L,code:"conflict",state:q}:{source:"agentpane-host",id:R.id,ok:z,result:I,error:L},"*")};return window.addEventListener("message",N),jw(t,E=>{var R,z;typeof E.workspace=="string"&&E.workspace!==n||E.writer!==C&&((z=(R=r.current)==null?void 0:R.contentWindow)==null||z.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof E.version=="number"?{version:E.version}:{}},"*"))}),Cw(t,()=>{mm(t).then(E=>{S&&(c(E),m([]))}).catch(()=>{})}),(async()=>{try{const[E,R,z]=await Promise.all([mm(t),gm(t,n),ak(t).catch(()=>[])]);if(!S)return;i.current=R,z.forEach(I=>cl(I.id,t)),c(E)}catch(E){S&&p(E instanceof Error?E.message:String(E))}})(),()=>{S=!1,Sw(t),Ew(t),_w(t),window.removeEventListener("message",N)}},[t,n]),x.useEffect(()=>{l&&bw(t,l.manifest.headlessSessions===!0)},[t,l]);const v=x.useMemo(()=>l?uE(l.html,lE({appId:t,apiOrigin:Fy()}),l.js):"",[l,t]);if(d)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",d]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],y=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${y?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:y?`Compile errors in ${(l==null?void 0:l.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,C)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},C))]}),a.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${t}`,srcDoc:v}),g.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((S,C)=>a.jsxs("div",{className:"miniapp-rt-error",children:[a.jsx("div",{className:"miniapp-rt-error-message",children:S.message}),S.stack&&a.jsx("pre",{className:"miniapp-rt-error-stack",children:S.stack})]},C))})]})}function hE({appId:t,active:n}){const r=A(y=>y.apps),i=A(y=>y.workspaces),l=A(y=>y.appWorkspaces),c=A(y=>y.setAppWorkspace),d=A(y=>y.setActiveAppTab),p=A(y=>y.startAppEdit),g=r.find(y=>y.id===t),m=l[t]??"",v=i.filter(y=>y.deleted!==1),k=m!==""&&!v.some(y=>y.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${n?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(Io,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:y=>c(t,y.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(y=>a.jsx("option",{value:y.path,children:y.label||y.path.split("/").pop()||y.path},y.path)),k&&a.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),a.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void p(t),children:[a.jsx(g1,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:a.jsx(Nn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(pE,{appId:t,workspace:m},`${t}:${m}`)})]})}function mE({side:t,minWidth:n,maxWidth:r,getWidth:i,setWidth:l}){const[c,d]=x.useState(!1),p=x.useRef(0),g=x.useRef(0),m=x.useCallback(y=>{const S=y.clientX-p.current,C=t==="left"?g.current+S:g.current-S,b=Math.min(r,Math.max(n,C));l(b)},[t,n,r,l]),v=x.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:x.useCallback(y=>{var S,C;y.preventDefault(),y.stopPropagation();try{(C=(S=y.currentTarget)==null?void 0:S.setPointerCapture)==null||C.call(S,y.pointerId)}catch{}p.current=y.clientX,g.current=i(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[i,m,v]),dragging:c}}function zg({side:t,minWidth:n,maxWidth:r,getWidth:i,setWidth:l}){const{onPointerDown:c,dragging:d}=mE({side:t,minWidth:n,maxWidth:r,getWidth:i,setWidth:l});return a.jsx("div",{className:`resize-handle ${t}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":d?"":void 0})}const gE=x.lazy(()=>$k(()=>import("./TerminalView-C6AkFuDP.js"),__vite__mapDeps([0,1])));function vE(){Lt.trackRender("IdeWorkspace");const t=A(S=>S.sidebarWidth),n=A(S=>S.rightPanelWidth),r=A(S=>S.setSidebarWidth),i=A(S=>S.setRightPanelWidth),l=A(S=>S.rightPanelCollapsed),c=A(S=>S.vscodeViewOpen),d=A(S=>S.usageViewOpen),p=A(S=>S.terminalViewOpen),[g,m]=x.useState(!1);p&&!g&&m(!0);const v=A(S=>S.activeAppTabId),k=A(S=>S.openAppTabs);x.useEffect(()=>{const S=()=>{const C=kl(),{rightPanelWidth:b,setRightPanelWidth:N}=A.getState();b>C&&N(C)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const y=l?`${t}px 6px 1fr ${ek}px`:`${t}px 6px 1fr 6px ${n}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(eE,{}),a.jsxs("div",{className:`ide-layout ${c||d||p?"ide-hidden":""}`,style:{gridTemplateColumns:y},children:[a.jsx(Cb,{}),a.jsx(zg,{side:"left",minWidth:ud,maxWidth:dd,getWidth:()=>A.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(_b,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(hE,{appId:S,active:v===S},S)),v==null&&a.jsx(UT,{})]}),a.jsx(ZT,{})]}),!l&&a.jsx(zg,{side:"right",minWidth:wl,maxWidth:kl(),getWidth:()=>A.getState().rightPanelWidth,setWidth:i}),a.jsx(xC,{})]}),c&&a.jsx(jC,{}),d&&a.jsx(JC,{}),g&&a.jsx(x.Suspense,{fallback:null,children:a.jsx(gE,{visible:p})}),a.jsx(SC,{})]})}function yE(){const{showNewSessionDialog:t,setShowNewSessionDialog:n,createSession:r,lastModelConfig:i}=A(),l=(i==null?void 0:i.provider)??"codex",c=(i==null?void 0:i.model)??"",d=(i==null?void 0:i.reasoning)??"",[p,g]=x.useState(""),[m,v]=x.useState(c),[k,y]=x.useState(d),[S,C]=x.useState("");if(!t)return null;const b=gf(l),N=m?_d(l,m):[];function E(){r({title:p.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),g(""),C("")}function R(I){I.key==="Escape"&&n(!1)}function z(I){var K;v(I);const L=_d(l,I);L.some($=>$.effort===k)||y(Rd(l,I)??((K=L[0])==null?void 0:K.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:I=>I.stopPropagation(),onKeyDown:R,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("label",{className:"dialog-label",children:["Title (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:p,onChange:I=>g(I.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Model",a.jsxs("select",{className:"dialog-input dialog-select",value:m,onChange:I=>z(I.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),b.map(I=>a.jsxs("option",{value:I.slug,children:[I.displayName," — ",I.description]},I.slug))]})]}),N.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:I=>y(I.target.value),children:[a.jsxs("option",{value:"",children:["Default (",Rd(l,m),")"]}),N.map(I=>a.jsx("option",{value:I.effort,children:I.label},I.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:I=>C(I.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>n(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:E,children:"Create"})]})]})})}function xE(t,n){const r=n!==""&&(t===n||t.startsWith(`${n}/`)),i=[r?{label:"~",path:n}:{label:"/",path:"/"}],l=t.slice(r?n.length:0);let c=i[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,i.push({label:d,path:c});return i}function wE(t){const n=t.filter(l=>l.deleted===0).at(-1);if(!n)return;const r=hr(n.path),i=r.lastIndexOf("/");return i>0?r.slice(0,i):void 0}function kE(){return A(n=>n.showAddWorkspaceDialog)?a.jsx(SE,{}):null}function SE(){var K;const t=A($=>$.setShowAddWorkspaceDialog),n=A($=>$.workspaces),r=A($=>$.createWorkspaceAt),i=A($=>$.addToast),[l,c]=x.useState(null),[d,p]=x.useState(!0),[g,m]=x.useState(null),[v,k]=x.useState(!1),y=x.useRef(0),[S]=x.useState(()=>wE(A.getState().workspaces)),C=x.useRef(null),b=x.useCallback(()=>{v||t(!1)},[v,t]);Ao(b);const N=x.useCallback(async($,Z=!1)=>{const he=++y.current;p(!0);let ce=null,ye=null;try{ce=await Qh($)}catch(Se){if(ye=Pr(Se),Z&&$)try{ce=await Qh(),ye=null}catch(Oe){ye=Pr(Oe)}}he===y.current&&(ce&&c(ce),m(ye),p(!1))},[]);x.useEffect(()=>{N(S,!0)},[N,S]);const E=l==null?void 0:l.path;x.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[E]);const R=new Set(n.filter($=>$.deleted===0).map($=>hr($.path)));async function z($){if(!v){k(!0),m(null);try{const Z=await r($);t(!1),i("success",`Workspace added — ${Z.path}`)}catch(Z){m(Pr(Z)),k(!1)}}}const I=l?xE(l.path,l.home):[],L=((K=I.at(-1))==null?void 0:K.label)??"",q=l!==null&&R.has(hr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:b,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:$=>$.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),a.jsx("button",{className:"dialog-close",onClick:b,"aria-label":"Close",disabled:v,children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Choose a project folder",l&&a.jsxs(a.Fragment,{children:[" ","on ",a.jsx("strong",{children:l.hostname})]}),"."]}),a.jsxs("div",{className:"folder-nav",children:[a.jsx("button",{className:"folder-up",onClick:()=>(l==null?void 0:l.parent)&&void N(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(kv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:I.map(($,Z)=>a.jsxs(x.Fragment,{children:[Z>0&&a.jsx(Di,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Z===I.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:$.path,children:$.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void N($.path),title:$.path,children:$.label})]},$.path))}),d&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:C,className:`folder-list${d&&l?" loading":""}`,"aria-label":"Folders",children:l?l.folders.length===0?a.jsx("li",{className:"folder-empty",children:"No folders here."}):l.folders.map($=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void N($.path),title:$.path,"aria-label":$.git?`${$.name} (git repository)`:$.name,children:[$.git?a.jsx(Jk,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(El,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:$.name}),a.jsx(Di,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),R.has(hr($.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void z($.path),disabled:v,"aria-label":`Add ${$.name}`,children:"Add"})]},$.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),g&&a.jsx("p",{className:"folder-error",role:"alert",children:g})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:b,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void z(l.path),disabled:!l||d||v||q,children:v?"Adding…":q?"Already added":`Add “${L}”`})]})]})})}const Id=6e4,Dd=60*Id,ll=24*Dd;function bE(t,n=Date.now()){const r=Date.parse(t);if(Number.isNaN(r))return"";const i=Math.max(0,n-r);return i<Id?"just now":i<Dd?`${Math.floor(i/Id)} min ago`:i<ll?`${Math.floor(i/Dd)} h ago`:i<2*ll?"yesterday":i<7*ll?`${Math.floor(i/ll)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function NE(){const t=A(n=>n.importSessionsWorkspace);return t?a.jsx(TE,{workspace:t},t):null}function TE({workspace:t}){const n=A(I=>I.setImportSessionsWorkspace),r=A(I=>I.importClaudeSessions),[i,l]=x.useState(null),[c,d]=x.useState(null),[p,g]=x.useState(new Set),[m,v]=x.useState(!1),[k,y]=x.useState(new Map),S=x.useCallback(()=>{m||n(null)},[m,n]);Ao(S),x.useEffect(()=>{let I=!1;return uv(t).then(L=>{I||l(L)}).catch(L=>{I||d(Pr(L))}),()=>{I=!0}},[t]);function C(I){g(L=>{const q=new Set(L);return q.has(I)?q.delete(I):q.add(I),q})}const b=i??[],N=b.length>0&&b.every(I=>p.has(I.session_id));async function E(){const I=b.filter($=>p.has($.session_id)).map($=>$.session_id);if(I.length===0)return;v(!0);const{imported:L,failed:q}=await r(t,I);if(v(!1),q.length===0){n(null);return}const K=new Set(L.map($=>$.import_source_id));l($=>($??[]).filter(Z=>!K.has(Z.session_id))),g(new Set(q.map($=>$.id))),y(new Map(q.map($=>[$.id,$.error])))}const R=t.split("/").pop()||t,z=p.size;return a.jsx("div",{className:"dialog-overlay",onClick:S,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import Claude Code sessions"}),a.jsx("button",{className:"dialog-close",onClick:S,"aria-label":"Close",disabled:m,children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in ",a.jsx("strong",{title:t,children:R}),", in a terminal or an IDE. An imported session keeps its history and continues the same Claude conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):i===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):i.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," in this folder will show up here."]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:N,disabled:m,onChange:()=>g(N?new Set:new Set(b.map(I=>I.session_id)))}),"Select all (",i.length,")"]}),a.jsx("ul",{className:"import-list",children:i.map(I=>{const L=k.get(I.session_id);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${p.has(I.session_id)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:p.has(I.session_id),disabled:m,onChange:()=>C(I.session_id)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:I.title,children:I.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{title:new Date(I.last_modified).toLocaleString(),children:bE(I.last_modified)}),I.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(Cv,{size:10})," ",I.git_branch]})]}),I.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(ql,{size:11})," Active in the last few minutes. If it is still open in a terminal, close it there first: both would write to the same session."]}),L&&a.jsx("span",{className:"import-row-error",role:"alert",children:L})]})]})},I.session_id)})})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:S,disabled:m,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void E(),disabled:z===0||m,children:m?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):z>1?`Import ${z} sessions`:"Import"})]})]})})}const CE=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,EE=512*1024;function jE(t){const n=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function _E(){const{appCatalogOpen:t,closeAppCatalog:n,apps:r,installExampleApp:i,createSkeletonApp:l,importAppFolder:c}=A(),[d,p]=x.useState("examples"),[g,m]=x.useState(null),[v,k]=x.useState(null),[y,S]=x.useState(!1),[C,b]=x.useState(""),[N,E]=x.useState(""),[R,z]=x.useState(""),[I,L]=x.useState(""),[q,K]=x.useState(null),[$,Z]=x.useState(""),he=x.useRef(null);if(x.useEffect(()=>{t&&(m(null),pk().then(m).catch(()=>m([])))},[t]),x.useEffect(()=>{he.current&&(he.current.webkitdirectory=!0)},[d]),!t)return null;const ce=new Set(r.map(F=>F.id));async function ye(F){k(F);try{await i(F)&&n()}finally{k(null)}}async function Se(){if(y)return;const F=C.trim(),Q=N.trim();if(!(!F||!Q)){S(!0);try{await l({id:F,title:Q,description:R.trim()||void 0,icon:I.trim()||void 0})&&(b(""),E(""),z(""),L(""),n())}finally{S(!1)}}}async function Oe(F){const Q=Array.from(F.target.files??[]),G={};let D="";for(const P of Q){const W=(P.webkitRelativePath??"").split("/");!D&&W.length>1&&(D=W[0]);const X=W[W.length-1];if(!(!X||!CE.test(X))&&!(P.size>EE))try{G[X]=await P.text()}catch{}}K(Object.keys(G).length>0?G:null),Z(jE(D))}async function J(){if(!(y||!q||!$.trim())){S(!0);try{await c($.trim(),q)&&(K(null),Z(""),n())}finally{S(!1)}}}function re(F){F.key==="Escape"&&n()}const oe=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:n,children:a.jsxs("div",{className:"dialog app-catalog",onClick:F=>F.stopPropagation(),onKeyDown:re,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Add Mini App"}),a.jsx("button",{className:"dialog-close",onClick:n,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:oe.map(F=>a.jsx("button",{className:`catalog-tab${d===F.key?" active":""}`,onClick:()=>p(F.key),children:F.label},F.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:g===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(F=>{const Q=ce.has(F.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(Io,{iconNode:F.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:F.title}),F.description&&a.jsx("span",{className:"example-desc",children:F.description})]}),a.jsx("button",{className:"example-install",disabled:Q||v===F.id,onClick:()=>ye(F.id),title:Q?"Already installed":"Install this example",children:Q?"Installed":v===F.id?"Installing…":"Install"})]},F.id)})}),d==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id (folder name)",a.jsx("input",{className:"dialog-input",type:"text",value:C,onChange:F=>b(F.target.value),placeholder:"e.g. todo-list",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Title",a.jsx("input",{className:"dialog-input",type:"text",value:N,onChange:F=>E(F.target.value),placeholder:"e.g. Todo List"})]}),a.jsxs("label",{className:"dialog-label",children:["Description (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:R,onChange:F=>z(F.target.value),placeholder:"What does this app do?"})]}),a.jsxs("label",{className:"dialog-label",children:[a.jsxs("span",{children:["Icon (optional, a"," ",a.jsx("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noreferrer",children:"Lucide icon"})," ","name)"]}),a.jsx("input",{className:"dialog-input",type:"text",value:I,onChange:F=>L(F.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:y||!C.trim()||!N.trim(),onClick:Se,children:[a.jsx(fr,{size:13})," Create App"]})]}),d==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Select an app folder from disk. Text files only (manifest.json, index.html, app.ts (or legacy app.js), …). A missing manifest.json is generated from the folder name."}),a.jsx("input",{ref:he,type:"file",multiple:!0,onChange:Oe}),q&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:$,onChange:F=>Z(F.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(q).length," file(s):"," ",Object.keys(q).slice(0,6).join(", "),Object.keys(q).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:y||!q||!$.trim(),onClick:J,children:[a.jsx(b1,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function RE(){const t=A(k=>k.showCommandPalette),n=A(k=>k.setShowCommandPalette),r=A(),[i,l]=x.useState(""),[c,d]=x.useState(0),p=x.useRef(null),g=x.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,y=Wl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:fr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:us,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Bi,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!y},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Fr,action:()=>r.cancelTurn(),available:y},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:a1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:mr,action:()=>r.switchRightTab("sidecar"),available:!!r.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:r.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:h1,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:Nn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=x.useMemo(()=>{const k=i.toLowerCase().trim(),y=g.filter(S=>S.available);return k?y.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):y},[g,i]);x.useEffect(()=>{t&&(l(""),d(0),setTimeout(()=>{var k;return(k=p.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(y=>Math.min(y+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(y=>Math.max(y-1,0));else if(k.key==="Enter"){k.preventDefault();const y=m[c];y&&(y.action(),n(!1))}else k.key==="Escape"&&n(!1)}return t?a.jsx("div",{className:"palette-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:p,type:"text",placeholder:"Type a command…",value:i,onChange:k=>{l(k.target.value),d(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,y)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${y===c?"selected":""}`,onClick:()=>{k.action(),n(!1)},onMouseEnter:()=>d(y),children:[a.jsx("span",{className:"palette-item-icon",children:a.jsx(S,{size:16})}),a.jsx("span",{className:"palette-item-label",children:k.label}),a.jsx("span",{className:"palette-item-hint",children:k.hint}),y===c&&a.jsx(Qk,{size:12,className:"palette-item-enter"})]},k.id)})}),a.jsxs("div",{className:"palette-footer",children:[a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↑"}),a.jsx("span",{className:"kbd",children:"↓"})," Navigate"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↵"})," Select"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"Esc"})," Close"]})]})]})}):null}const Fg=/^[a-z][a-z0-9-]{1,30}$/,AE=2e3;function IE(){const{showRemoteModal:t,setShowRemoteModal:n,selectSession:r}=A(),[i,l]=x.useState(null),[c,d]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(!1),[k,y]=x.useState(!1),[S,C]=x.useState(!1),[b,N]=x.useState("main"),[E,R]=x.useState(""),[z,I]=x.useState(!1),[L,q]=x.useState(null),K=x.useRef(null);Ui(K,()=>C(!1),S);const $=m||k,Z=x.useCallback(async()=>{g(!0),d(null);try{const F=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!F.ok)throw new Error(`status ${F.status}`);l(await F.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{g(!1)}},[]);x.useEffect(()=>{t&&(N("main"),q(null),Z())},[t,Z]);const he=L!==null&&L.state==="running";if(x.useEffect(()=>{if(!he)return;const F=setInterval(async()=>{try{const Q=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Q.ok&&q(await Q.json())}catch{}},AE);return()=>clearInterval(F)},[he]),!t)return null;const ce=!!(i!=null&&i.tunnel.provisioned)&&!!(i!=null&&i.service.running)&&!!(i!=null&&i.connection.ok);function ye(F){F.key==="Escape"&&n(!1)}async function Se(F){if(Fg.test(F)){I(!0);try{const Q=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:F})});if(!Q.ok)throw new Error(`enable ${Q.status}`);q(await Q.json()),N("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{I(!1)}}}function Oe(){L!=null&&L.troubleshootingSessionId&&(r(L.troubleshootingSessionId),n(!1))}async function J(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await Z()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function re(){if(C(!1),!!window.confirm(`Remove the tunnel completely?
|
|
830
|
-
|
|
831
|
-
This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
|
|
832
|
-
|
|
833
|
-
This cannot be undone.`)){y(!0);try{const Q=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Q.ok)throw new Error(`uninstall ${Q.status}`);await Z()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{y(!1)}}}function oe(){if(!L)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:E,onChange:D=>R(D.target.value.toLowerCase()),placeholder:"my-macbook",autoFocus:!0})]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The machine will be reachable at https://<name>.repoburg.com"}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>N("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Fg.test(E)||z,onClick:()=>void Se(E),children:[z?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const F=["detect","provision","install","verify","ready"],Q=F.indexOf(L.step),G=L.state==="ready";return a.jsxs(a.Fragment,{children:[L.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),L.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Ts,{size:14})," Setup complete — you can close this window."]}),L.state==="ready"&&L.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${L.hostname}`,target:"_blank",rel:"noreferrer",children:L.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:F.map((D,P)=>{const le=G||Q>-1&&P<Q,W=!G&&P===Q&&L.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:le||W?1:.4,color:le?"var(--green)":void 0},children:[le?a.jsx(Ts,{size:13}):W?a.jsx(hn,{size:13,className:"spin"}):a.jsx(Xk,{size:9,style:{marginLeft:2,marginRight:2}}),D]},D)})}),L.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:L.logs.slice(-3).map(D=>D.message).join(`
|
|
834
|
-
`)}),L.state==="troubleshooting"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:"Setup failed — a troubleshooting session is open and the agent is working on the fix in the background."}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-create",onClick:Oe,children:"Open troubleshooting session"})})]}),L.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",L.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void Z(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:F=>F.stopPropagation(),onKeyDown:ye,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>n(!1),children:a.jsx(Nn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[p&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),b==="setup"?oe():a.jsxs(a.Fragment,{children:[ce&&(i==null?void 0:i.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${i.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:i.tunnel.hostname})]}),a.jsxs("div",{style:{position:"relative",display:"flex",marginTop:8},children:[a.jsxs("button",{className:"dialog-btn-cancel",style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0},onClick:()=>void J(),disabled:$,children:[m?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),a.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(F=>!F),disabled:$,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(jo,{size:14})}),S&&a.jsx("div",{ref:K,className:"ctx-menu",role:"menu",style:{position:"absolute",right:0,top:"calc(100% + 4px)",zIndex:10},children:a.jsxs("div",{className:"ctx-menu-item ctx-danger",role:"menuitem",onClick:()=>void re(),children:[a.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!ce&&a.jsx(a.Fragment,{children:i!=null&&i.tunnel.provisioned&&i.tunnel.mahlas&&i.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${i.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:i.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Se(i.tunnel.mahlas),disabled:z,children:[z?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(bm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>N("setup"),children:[a.jsx(bm,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const DE={success:Gk,error:Gl,info:t1,warn:ql},ME=4e3;function LE({toast:t}){const n=A(d=>d.removeToast),r=DE[t.type],i=x.useRef(null);x.useEffect(()=>{function d(){i.current=setTimeout(()=>n(t.id),ME)}return d(),()=>{i.current&&clearTimeout(i.current)}},[t.id,n]);function l(){i.current&&(clearTimeout(i.current),i.current=null)}function c(){i.current=setTimeout(()=>n(t.id),2e3)}return a.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=t.undoAction)==null||d.call(t),n(t.id)},children:[a.jsx(S1,{size:12})," ",t.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>n(t.id),children:a.jsx(Nn,{size:14})})]})}function OE(){const t=A(n=>n.toasts);return t.length===0?null:a.jsx("div",{className:"toast-container",children:t.map(n=>a.jsx(LE,{toast:n},n.id))})}function PE(){const[t]=x.useState(qw),[n,r]=x.useState(!1),[i,l]=x.useState(!1),c=x.useRef(void 0);x.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await $i(lm)&&(r(!0),l(!0),clearTimeout(c.current),c.current=setTimeout(()=>r(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),t&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[t&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:lm}),a.jsx("button",{type:"button",className:`daemon-download-copy${n?" copied":""}`,onClick:()=>void d(),"aria-label":"Copy the install command",title:n?"Copied":"Copy",children:n?a.jsx(Ts,{size:15}):a.jsx(Mi,{size:15})})]}),!t&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),i&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(t||i)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Ro=null,_i=1e3;const $E=1e4;function Md(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(G0("/ws")),Jn.onopen=()=>{const t=_i>1e3;if(_i=1e3,A.getState().setWsConnected(!0),A.getState().addLogEntry("INFO","WebSocket connected"),t){Rw();const n=A.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{A.getState().setWsConnected(!1),A.getState().addLogEntry("WARN","WebSocket disconnected"),A.getState().addToast("warn","WebSocket disconnected — reconnecting…"),FE()},Jn.onerror=()=>{},Jn.onmessage=t=>{try{const n=JSON.parse(t.data);Lt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof t.data=="string"?t.data.length:0);const r=UE[n.event];r&&r(n.data)}catch{}})}function zE(){Ro&&(clearTimeout(Ro),Ro=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),A.getState().setWsConnected(!1)}function FE(){Ro||(Ro=window.setTimeout(()=>{Ro=null,Md()},_i),_i=Math.min(_i*2,$E))}const UE={"turn:created":t=>{const n=t;A.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":t=>{const n=t;Lt.note(`turn:started — ${n.turnId.slice(0,8)}`),A.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":t=>{const n=t;A.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":t=>{const n=t;A.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":t=>{const n=t;A.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":t=>{const n=t;A.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta)},"widget:delta":t=>{const n=t;typeof n.itemId!="string"||typeof n.html!="string"||A.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":t=>{const n=t;Lt.note(`turn:completed — ${n.turnId.slice(0,8)}`),A.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":t=>{const n=t;A.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":t=>{const n=t,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};A.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":t=>{const n=t;A.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":t=>{const n=t;Lt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),A.getState().onTurnInterrupted(n.sessionId,n.turnId,{reason:n.reason,interruptedAt:n.interruptedAt,attempts:n.attempts,detail:n.detail??null,resumeAt:n.resumeAt??null})},"turn:resuming":t=>{const n=t;A.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":t=>{const n=t;A.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":t=>{const n=t;A.getState().onTurnRetrying(n.sessionId,n.turnId,{attempt:n.attempt,maxRetries:n.maxRetries,retryDelayMs:n.retryDelayMs,errorStatus:n.errorStatus??null,error:n.error??null})},"turn:cancelled":t=>{const n=t;A.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":t=>{const n=t;A.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":t=>{const n=t;A.getState().onSessionTouched(n.sessionId)},"session:created":t=>{const{session:n}=t;n.origin_app_id&&cl(n.id,n.origin_app_id),A.getState().addSession(n)},"session:updated":t=>{const n=t;A.getState().onSessionUpdated(n.session)},background_tasks:t=>{const n=t;Lt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),A.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":t=>{const n=t;A.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":t=>{const n=t;A.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":t=>{const n=t;A.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":t=>{const n=t;A.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":t=>{const n=t;A.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":t=>{const n=t;A.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":t=>{const n=t;Nw(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":t=>{Aw(t.appId),A.getState().refreshApps()},"app:state_changed":t=>{const{appId:n,...r}=t;cv(n,r)}};function BE(){const t=A(n=>n.init);return x.useEffect(()=>{V0();function n(){t(),Md()}const{daemonStatus:r,setDaemonStatus:i}=A.getState();let l=null;r==="ready"?n():l=Yw({onMissing:()=>i("missing"),onReady:()=>{i("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=A.getState(),p=d.activeSessionId;if(!p)return;const g=d.sessionDetails[p];d.wsConnected||Md(),g&&g.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),zE(),document.removeEventListener("visibilitychange",c)}},[t]),null}const Hy="agentpaneView";function Ld(t){return{tab:$d(t),vscode:t.vscodeViewOpen,usage:t.usageViewOpen,terminal:t.terminalViewOpen}}function Vy(t,n){return t.tab===n.tab&&t.vscode===n.vscode&&t.usage===n.usage&&t.terminal===n.terminal}function Ug(t){return t.tab===null&&!t.vscode&&!t.usage&&!t.terminal}function Bg(t,n){return n.tab!==null&&!t.tabOrder.includes(n.tab)?!1:!Vy(n,Ld(t))}function Wg(t){const n=t==null?void 0:t[Hy];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function WE(t,n){t.getState().vscodeViewOpen!==n.vscode&&t.getState().toggleVscodeView(),t.getState().usageViewOpen!==n.usage&&t.getState().toggleUsageView(),t.getState().terminalViewOpen!==n.terminal&&t.getState().toggleTerminalView();const r=t.getState();if(n.tab===null)return;const{kind:i,id:l}=pr(n.tab);i==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function HE(t){let n=Wg(window.history.state)??{index:0,newest:0,view:Ld(t.getState())},r=n.newest,i=!1;const l=new Map([[n.index,n.view]]),c=y=>{const S=t.getState();for(let C=n.index+y;C>=0&&C<=r;C+=y){const b=l.get(C);if(!b||Bg(S,b))return!0}return!1},d=()=>{const y=c(-1),S=c(1),C=t.getState();(C.canGoBack!==y||C.canGoForward!==S)&&t.setState({canGoBack:y,canGoForward:S})},p=()=>({[Hy]:{...n,newest:r}}),g=()=>{window.history.replaceState({...window.history.state,...p()},"")},m=y=>{if(l.set(n.index,n.view),Ug(n.view))n={...n,view:y},g();else{n={index:n.index+1,newest:n.index+1,view:y},r=n.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(p(),"")}l.set(n.index,y)},v=y=>{const S=Wg(y.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const C=t.getState(),b=Math.sign(S.index-n.index);if(b!==0&&!Bg(C,S.view)){const N=S.index+b;window.history.go(N<0||N>r?n.index-S.index:b);return}n=S,g(),i=!0;try{WE(t,S.view)}finally{i=!1}d()};g(),d(),window.addEventListener("popstate",v);const k=t.subscribe((y,S)=>{const C=y.activeSessionId!==S.activeSessionId||y.activeAppTabId!==S.activeAppTabId||y.vscodeViewOpen!==S.vscodeViewOpen||y.usageViewOpen!==S.usageViewOpen||y.terminalViewOpen!==S.terminalViewOpen;if(!(!C&&y.tabOrder===S.tabOrder)){if(C&&!i){const b=Ld(y);!Ug(b)&&!Vy(b,n.view)&&m(b)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function VE(){const t=A(c=>c.loading),n=A(c=>c.error),r=A(c=>c.sessions),i=A(c=>c.daemonStatus),l=A(c=>c.setShowCommandPalette);return x.useEffect(()=>Lt.start(),[]),x.useEffect(()=>HE(A),[]),x.useEffect(()=>{function c(d){(d.metaKey||d.ctrlKey)&&d.key==="k"&&(d.preventDefault(),l(!0))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l]),a.jsxs(a.Fragment,{children:[a.jsx(BE,{}),i==="missing"?a.jsx(PE,{}):i==="checking"||t&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):n&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",n]}):a.jsxs(a.Fragment,{children:[a.jsx(vE,{}),a.jsx(yE,{}),a.jsx(kE,{}),a.jsx(NE,{}),a.jsx(_E,{}),a.jsx(IE,{}),a.jsx(RE,{}),a.jsx(OE,{})]})]})}M0.createRoot(document.getElementById("root")).render(a.jsx(ct.StrictMode,{children:a.jsx(VE,{})}));export{Li as R,Nn as X,G0 as b,ve as c,a as j,x as r,A as u};
|