repoburg 1.3.324 → 1.3.326

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-DQaRNqT-.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
- var Kw=Object.defineProperty;var Gw=(e,n,r)=>n in e?Kw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ht=(e,n,r)=>Gw(e,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"]'))o(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"&&o(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 o(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function sv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fu={exports:{}},gi={},Uu={exports:{}},Ge={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-DhSqcUfd.js","assets/TerminalView-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
+ var Xw=Object.defineProperty;var Yw=(e,n,r)=>n in e?Xw(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ht=(e,n,r)=>Yw(e,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"]'))o(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"&&o(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 o(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function iv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fu={exports:{}},gi={},Uu={exports:{}},Ge={};/**
3
3
  * @license React
4
4
  * react.production.min.js
5
5
  *
@@ -7,7 +7,7 @@ var Kw=Object.defineProperty;var Gw=(e,n,r)=>n in e?Kw(e,n,{enumerable:!0,config
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var qh;function qw(){if(qh)return Ge;qh=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=k&&E[k]||E["@@iterator"],typeof E=="function"?E:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function T(E,M,de){this.props=E,this.context=M,this.refs=N,this.updater=de||S}T.prototype.isReactComponent={},T.prototype.setState=function(E,M){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,M,"setState")},T.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function b(){}b.prototype=T.prototype;function A(E,M,de){this.props=E,this.context=M,this.refs=N,this.updater=de||S}var P=A.prototype=new b;P.constructor=A,j(P,T.prototype),P.isPureReactComponent=!0;var L=Array.isArray,z=Object.prototype.hasOwnProperty,q={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function O(E,M,de){var U,ue={},X=null,ve=null;if(M!=null)for(U in M.ref!==void 0&&(ve=M.ref),M.key!==void 0&&(X=""+M.key),M)z.call(M,U)&&!F.hasOwnProperty(U)&&(ue[U]=M[U]);var xe=arguments.length-2;if(xe===1)ue.children=de;else if(1<xe){for(var Ae=Array(xe),Ce=0;Ce<xe;Ce++)Ae[Ce]=arguments[Ce+2];ue.children=Ae}if(E&&E.defaultProps)for(U in xe=E.defaultProps,xe)ue[U]===void 0&&(ue[U]=xe[U]);return{$$typeof:e,type:E,key:X,ref:ve,props:ue,_owner:q.current}}function Q(E,M){return{$$typeof:e,type:E.type,key:M,ref:E.ref,props:E.props,_owner:E._owner}}function J(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function te(E){var M={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(de){return M[de]})}var me=/\/+/g;function ke(E,M){return typeof E=="object"&&E!==null&&E.key!=null?te(""+E.key):M.toString(36)}function Le(E,M,de,U,ue){var X=typeof E;(X==="undefined"||X==="boolean")&&(E=null);var ve=!1;if(E===null)ve=!0;else switch(X){case"string":case"number":ve=!0;break;case"object":switch(E.$$typeof){case e:case n:ve=!0}}if(ve)return ve=E,ue=ue(ve),E=U===""?"."+ke(ve,0):U,L(ue)?(de="",E!=null&&(de=E.replace(me,"$&/")+"/"),Le(ue,M,de,"",function(Ce){return Ce})):ue!=null&&(J(ue)&&(ue=Q(ue,de+(!ue.key||ve&&ve.key===ue.key?"":(""+ue.key).replace(me,"$&/")+"/")+E)),M.push(ue)),1;if(ve=0,U=U===""?".":U+":",L(E))for(var xe=0;xe<E.length;xe++){X=E[xe];var Ae=U+ke(X,xe);ve+=Le(X,M,de,Ae,ue)}else if(Ae=x(E),typeof Ae=="function")for(E=Ae.call(E),xe=0;!(X=E.next()).done;)X=X.value,Ae=U+ke(X,xe++),ve+=Le(X,M,de,Ae,ue);else if(X==="object")throw M=String(E),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.");return ve}function Te(E,M,de){if(E==null)return E;var U=[],ue=0;return Le(E,U,"","",function(X){return M.call(de,X,ue++)}),U}function oe(E){if(E._status===-1){var M=E._result;M=M(),M.then(function(de){(E._status===0||E._status===-1)&&(E._status=1,E._result=de)},function(de){(E._status===0||E._status===-1)&&(E._status=2,E._result=de)}),E._status===-1&&(E._status=0,E._result=M)}if(E._status===1)return E._result.default;throw E._result}var ee={current:null},Y={transition:null},ae={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:Y,ReactCurrentOwner:q};function K(){throw Error("act(...) is not supported in production builds of React.")}return Ge.Children={map:Te,forEach:function(E,M,de){Te(E,function(){M.apply(this,arguments)},de)},count:function(E){var M=0;return Te(E,function(){M++}),M},toArray:function(E){return Te(E,function(M){return M})||[]},only:function(E){if(!J(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},Ge.Component=T,Ge.Fragment=r,Ge.Profiler=l,Ge.PureComponent=A,Ge.StrictMode=o,Ge.Suspense=h,Ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ae,Ge.act=K,Ge.cloneElement=function(E,M,de){if(E==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+E+".");var U=j({},E.props),ue=E.key,X=E.ref,ve=E._owner;if(M!=null){if(M.ref!==void 0&&(X=M.ref,ve=q.current),M.key!==void 0&&(ue=""+M.key),E.type&&E.type.defaultProps)var xe=E.type.defaultProps;for(Ae in M)z.call(M,Ae)&&!F.hasOwnProperty(Ae)&&(U[Ae]=M[Ae]===void 0&&xe!==void 0?xe[Ae]:M[Ae])}var Ae=arguments.length-2;if(Ae===1)U.children=de;else if(1<Ae){xe=Array(Ae);for(var Ce=0;Ce<Ae;Ce++)xe[Ce]=arguments[Ce+2];U.children=xe}return{$$typeof:e,type:E.type,key:ue,ref:X,props:U,_owner:ve}},Ge.createContext=function(E){return E={$$typeof:d,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},E.Provider={$$typeof:c,_context:E},E.Consumer=E},Ge.createElement=O,Ge.createFactory=function(E){var M=O.bind(null,E);return M.type=E,M},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(E){return{$$typeof:f,render:E}},Ge.isValidElement=J,Ge.lazy=function(E){return{$$typeof:v,_payload:{_status:-1,_result:E},_init:oe}},Ge.memo=function(E,M){return{$$typeof:m,type:E,compare:M===void 0?null:M}},Ge.startTransition=function(E){var M=Y.transition;Y.transition={};try{E()}finally{Y.transition=M}},Ge.unstable_act=K,Ge.useCallback=function(E,M){return ee.current.useCallback(E,M)},Ge.useContext=function(E){return ee.current.useContext(E)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(E){return ee.current.useDeferredValue(E)},Ge.useEffect=function(E,M){return ee.current.useEffect(E,M)},Ge.useId=function(){return ee.current.useId()},Ge.useImperativeHandle=function(E,M,de){return ee.current.useImperativeHandle(E,M,de)},Ge.useInsertionEffect=function(E,M){return ee.current.useInsertionEffect(E,M)},Ge.useLayoutEffect=function(E,M){return ee.current.useLayoutEffect(E,M)},Ge.useMemo=function(E,M){return ee.current.useMemo(E,M)},Ge.useReducer=function(E,M,de){return ee.current.useReducer(E,M,de)},Ge.useRef=function(E){return ee.current.useRef(E)},Ge.useState=function(E){return ee.current.useState(E)},Ge.useSyncExternalStore=function(E,M,de){return ee.current.useSyncExternalStore(E,M,de)},Ge.useTransition=function(){return ee.current.useTransition()},Ge.version="18.3.1",Ge}var Xh;function Vd(){return Xh||(Xh=1,Uu.exports=qw()),Uu.exports}/**
10
+ */var qh;function Qw(){if(qh)return Ge;qh=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=k&&E[k]||E["@@iterator"],typeof E=="function"?E:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function T(E,M,de){this.props=E,this.context=M,this.refs=N,this.updater=de||S}T.prototype.isReactComponent={},T.prototype.setState=function(E,M){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,M,"setState")},T.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function b(){}b.prototype=T.prototype;function A(E,M,de){this.props=E,this.context=M,this.refs=N,this.updater=de||S}var P=A.prototype=new b;P.constructor=A,j(P,T.prototype),P.isPureReactComponent=!0;var L=Array.isArray,z=Object.prototype.hasOwnProperty,q={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function O(E,M,de){var U,ue={},X=null,ve=null;if(M!=null)for(U in M.ref!==void 0&&(ve=M.ref),M.key!==void 0&&(X=""+M.key),M)z.call(M,U)&&!F.hasOwnProperty(U)&&(ue[U]=M[U]);var xe=arguments.length-2;if(xe===1)ue.children=de;else if(1<xe){for(var Ae=Array(xe),Ce=0;Ce<xe;Ce++)Ae[Ce]=arguments[Ce+2];ue.children=Ae}if(E&&E.defaultProps)for(U in xe=E.defaultProps,xe)ue[U]===void 0&&(ue[U]=xe[U]);return{$$typeof:e,type:E,key:X,ref:ve,props:ue,_owner:q.current}}function Q(E,M){return{$$typeof:e,type:E.type,key:M,ref:E.ref,props:E.props,_owner:E._owner}}function J(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function te(E){var M={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(de){return M[de]})}var me=/\/+/g;function ke(E,M){return typeof E=="object"&&E!==null&&E.key!=null?te(""+E.key):M.toString(36)}function Le(E,M,de,U,ue){var X=typeof E;(X==="undefined"||X==="boolean")&&(E=null);var ve=!1;if(E===null)ve=!0;else switch(X){case"string":case"number":ve=!0;break;case"object":switch(E.$$typeof){case e:case n:ve=!0}}if(ve)return ve=E,ue=ue(ve),E=U===""?"."+ke(ve,0):U,L(ue)?(de="",E!=null&&(de=E.replace(me,"$&/")+"/"),Le(ue,M,de,"",function(Ce){return Ce})):ue!=null&&(J(ue)&&(ue=Q(ue,de+(!ue.key||ve&&ve.key===ue.key?"":(""+ue.key).replace(me,"$&/")+"/")+E)),M.push(ue)),1;if(ve=0,U=U===""?".":U+":",L(E))for(var xe=0;xe<E.length;xe++){X=E[xe];var Ae=U+ke(X,xe);ve+=Le(X,M,de,Ae,ue)}else if(Ae=x(E),typeof Ae=="function")for(E=Ae.call(E),xe=0;!(X=E.next()).done;)X=X.value,Ae=U+ke(X,xe++),ve+=Le(X,M,de,Ae,ue);else if(X==="object")throw M=String(E),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.");return ve}function Te(E,M,de){if(E==null)return E;var U=[],ue=0;return Le(E,U,"","",function(X){return M.call(de,X,ue++)}),U}function oe(E){if(E._status===-1){var M=E._result;M=M(),M.then(function(de){(E._status===0||E._status===-1)&&(E._status=1,E._result=de)},function(de){(E._status===0||E._status===-1)&&(E._status=2,E._result=de)}),E._status===-1&&(E._status=0,E._result=M)}if(E._status===1)return E._result.default;throw E._result}var ee={current:null},Y={transition:null},ae={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:Y,ReactCurrentOwner:q};function K(){throw Error("act(...) is not supported in production builds of React.")}return Ge.Children={map:Te,forEach:function(E,M,de){Te(E,function(){M.apply(this,arguments)},de)},count:function(E){var M=0;return Te(E,function(){M++}),M},toArray:function(E){return Te(E,function(M){return M})||[]},only:function(E){if(!J(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},Ge.Component=T,Ge.Fragment=r,Ge.Profiler=l,Ge.PureComponent=A,Ge.StrictMode=o,Ge.Suspense=h,Ge.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ae,Ge.act=K,Ge.cloneElement=function(E,M,de){if(E==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+E+".");var U=j({},E.props),ue=E.key,X=E.ref,ve=E._owner;if(M!=null){if(M.ref!==void 0&&(X=M.ref,ve=q.current),M.key!==void 0&&(ue=""+M.key),E.type&&E.type.defaultProps)var xe=E.type.defaultProps;for(Ae in M)z.call(M,Ae)&&!F.hasOwnProperty(Ae)&&(U[Ae]=M[Ae]===void 0&&xe!==void 0?xe[Ae]:M[Ae])}var Ae=arguments.length-2;if(Ae===1)U.children=de;else if(1<Ae){xe=Array(Ae);for(var Ce=0;Ce<Ae;Ce++)xe[Ce]=arguments[Ce+2];U.children=xe}return{$$typeof:e,type:E.type,key:ue,ref:X,props:U,_owner:ve}},Ge.createContext=function(E){return E={$$typeof:d,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},E.Provider={$$typeof:c,_context:E},E.Consumer=E},Ge.createElement=O,Ge.createFactory=function(E){var M=O.bind(null,E);return M.type=E,M},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(E){return{$$typeof:f,render:E}},Ge.isValidElement=J,Ge.lazy=function(E){return{$$typeof:v,_payload:{_status:-1,_result:E},_init:oe}},Ge.memo=function(E,M){return{$$typeof:m,type:E,compare:M===void 0?null:M}},Ge.startTransition=function(E){var M=Y.transition;Y.transition={};try{E()}finally{Y.transition=M}},Ge.unstable_act=K,Ge.useCallback=function(E,M){return ee.current.useCallback(E,M)},Ge.useContext=function(E){return ee.current.useContext(E)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(E){return ee.current.useDeferredValue(E)},Ge.useEffect=function(E,M){return ee.current.useEffect(E,M)},Ge.useId=function(){return ee.current.useId()},Ge.useImperativeHandle=function(E,M,de){return ee.current.useImperativeHandle(E,M,de)},Ge.useInsertionEffect=function(E,M){return ee.current.useInsertionEffect(E,M)},Ge.useLayoutEffect=function(E,M){return ee.current.useLayoutEffect(E,M)},Ge.useMemo=function(E,M){return ee.current.useMemo(E,M)},Ge.useReducer=function(E,M,de){return ee.current.useReducer(E,M,de)},Ge.useRef=function(E){return ee.current.useRef(E)},Ge.useState=function(E){return ee.current.useState(E)},Ge.useSyncExternalStore=function(E,M,de){return ee.current.useSyncExternalStore(E,M,de)},Ge.useTransition=function(){return ee.current.useTransition()},Ge.version="18.3.1",Ge}var Xh;function Vd(){return Xh||(Xh=1,Uu.exports=Qw()),Uu.exports}/**
11
11
  * @license React
12
12
  * react-jsx-runtime.production.min.js
13
13
  *
@@ -15,7 +15,7 @@ var Kw=Object.defineProperty;var Gw=(e,n,r)=>n in e?Kw(e,n,{enumerable:!0,config
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var Yh;function Xw(){if(Yh)return gi;Yh=1;var e=Vd(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(f,h,m){var v,k={},x=null,S=null;m!==void 0&&(x=""+m),h.key!==void 0&&(x=""+h.key),h.ref!==void 0&&(S=h.ref);for(v in h)o.call(h,v)&&!c.hasOwnProperty(v)&&(k[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)k[v]===void 0&&(k[v]=h[v]);return{$$typeof:n,type:f,key:x,ref:S,props:k,_owner:l.current}}return gi.Fragment=r,gi.jsx=d,gi.jsxs=d,gi}var Qh;function Yw(){return Qh||(Qh=1,Fu.exports=Xw()),Fu.exports}var a=Yw(),y=Vd();const gt=sv(y);var tl={},Bu={exports:{}},Ln={},Wu={exports:{}},Hu={};/**
18
+ */var Yh;function Zw(){if(Yh)return gi;Yh=1;var e=Vd(),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function d(f,h,m){var v,k={},x=null,S=null;m!==void 0&&(x=""+m),h.key!==void 0&&(x=""+h.key),h.ref!==void 0&&(S=h.ref);for(v in h)o.call(h,v)&&!c.hasOwnProperty(v)&&(k[v]=h[v]);if(f&&f.defaultProps)for(v in h=f.defaultProps,h)k[v]===void 0&&(k[v]=h[v]);return{$$typeof:n,type:f,key:x,ref:S,props:k,_owner:l.current}}return gi.Fragment=r,gi.jsx=d,gi.jsxs=d,gi}var Qh;function Jw(){return Qh||(Qh=1,Fu.exports=Zw()),Fu.exports}var a=Jw(),y=Vd();const vt=iv(y);var tl={},Bu={exports:{}},Ln={},Wu={exports:{}},Hu={};/**
19
19
  * @license React
20
20
  * scheduler.production.min.js
21
21
  *
@@ -23,7 +23,7 @@ var Kw=Object.defineProperty;var Gw=(e,n,r)=>n in e?Kw(e,n,{enumerable:!0,config
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
26
- */var Zh;function Qw(){return Zh||(Zh=1,(function(e){function n(Y,ae){var K=Y.length;Y.push(ae);e:for(;0<K;){var E=K-1>>>1,M=Y[E];if(0<l(M,ae))Y[E]=ae,Y[K]=M,K=E;else break e}}function r(Y){return Y.length===0?null:Y[0]}function o(Y){if(Y.length===0)return null;var ae=Y[0],K=Y.pop();if(K!==ae){Y[0]=K;e:for(var E=0,M=Y.length,de=M>>>1;E<de;){var U=2*(E+1)-1,ue=Y[U],X=U+1,ve=Y[X];if(0>l(ue,K))X<M&&0>l(ve,ue)?(Y[E]=ve,Y[X]=K,E=X):(Y[E]=ue,Y[U]=K,E=U);else if(X<M&&0>l(ve,K))Y[E]=ve,Y[X]=K,E=X;else break e}}return ae}function l(Y,ae){var K=Y.sortIndex-ae.sortIndex;return K!==0?K:Y.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],m=[],v=1,k=null,x=3,S=!1,j=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(Y){for(var ae=r(m);ae!==null;){if(ae.callback===null)o(m);else if(ae.startTime<=Y)o(m),ae.sortIndex=ae.expirationTime,n(h,ae);else break;ae=r(m)}}function L(Y){if(N=!1,P(Y),!j)if(r(h)!==null)j=!0,oe(z);else{var ae=r(m);ae!==null&&ee(L,ae.startTime-Y)}}function z(Y,ae){j=!1,N&&(N=!1,b(O),O=-1),S=!0;var K=x;try{for(P(ae),k=r(h);k!==null&&(!(k.expirationTime>ae)||Y&&!te());){var E=k.callback;if(typeof E=="function"){k.callback=null,x=k.priorityLevel;var M=E(k.expirationTime<=ae);ae=e.unstable_now(),typeof M=="function"?k.callback=M:k===r(h)&&o(h),P(ae)}else o(h);k=r(h)}if(k!==null)var de=!0;else{var U=r(m);U!==null&&ee(L,U.startTime-ae),de=!1}return de}finally{k=null,x=K,S=!1}}var q=!1,F=null,O=-1,Q=5,J=-1;function te(){return!(e.unstable_now()-J<Q)}function me(){if(F!==null){var Y=e.unstable_now();J=Y;var ae=!0;try{ae=F(!0,Y)}finally{ae?ke():(q=!1,F=null)}}else q=!1}var ke;if(typeof A=="function")ke=function(){A(me)};else if(typeof MessageChannel<"u"){var Le=new MessageChannel,Te=Le.port2;Le.port1.onmessage=me,ke=function(){Te.postMessage(null)}}else ke=function(){T(me,0)};function oe(Y){F=Y,q||(q=!0,ke())}function ee(Y,ae){O=T(function(){Y(e.unstable_now())},ae)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){j||S||(j=!0,oe(z))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(Y){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var K=x;x=ae;try{return Y()}finally{x=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var K=x;x=Y;try{return ae()}finally{x=K}},e.unstable_scheduleCallback=function(Y,ae,K){var E=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?E+K:E):K=E,Y){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=K+M,Y={id:v++,callback:ae,priorityLevel:Y,startTime:K,expirationTime:M,sortIndex:-1},K>E?(Y.sortIndex=K,n(m,Y),r(h)===null&&Y===r(m)&&(N?(b(O),O=-1):N=!0,ee(L,K-E))):(Y.sortIndex=M,n(h,Y),j||S||(j=!0,oe(z))),Y},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(Y){var ae=x;return function(){var K=x;x=ae;try{return Y.apply(this,arguments)}finally{x=K}}}})(Hu)),Hu}var Jh;function Zw(){return Jh||(Jh=1,Wu.exports=Qw()),Wu.exports}/**
26
+ */var Zh;function e0(){return Zh||(Zh=1,(function(e){function n(Y,ae){var K=Y.length;Y.push(ae);e:for(;0<K;){var E=K-1>>>1,M=Y[E];if(0<l(M,ae))Y[E]=ae,Y[K]=M,K=E;else break e}}function r(Y){return Y.length===0?null:Y[0]}function o(Y){if(Y.length===0)return null;var ae=Y[0],K=Y.pop();if(K!==ae){Y[0]=K;e:for(var E=0,M=Y.length,de=M>>>1;E<de;){var U=2*(E+1)-1,ue=Y[U],X=U+1,ve=Y[X];if(0>l(ue,K))X<M&&0>l(ve,ue)?(Y[E]=ve,Y[X]=K,E=X):(Y[E]=ue,Y[U]=K,E=U);else if(X<M&&0>l(ve,K))Y[E]=ve,Y[X]=K,E=X;else break e}}return ae}function l(Y,ae){var K=Y.sortIndex-ae.sortIndex;return K!==0?K:Y.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var h=[],m=[],v=1,k=null,x=3,S=!1,j=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(Y){for(var ae=r(m);ae!==null;){if(ae.callback===null)o(m);else if(ae.startTime<=Y)o(m),ae.sortIndex=ae.expirationTime,n(h,ae);else break;ae=r(m)}}function L(Y){if(N=!1,P(Y),!j)if(r(h)!==null)j=!0,oe(z);else{var ae=r(m);ae!==null&&ee(L,ae.startTime-Y)}}function z(Y,ae){j=!1,N&&(N=!1,b(O),O=-1),S=!0;var K=x;try{for(P(ae),k=r(h);k!==null&&(!(k.expirationTime>ae)||Y&&!te());){var E=k.callback;if(typeof E=="function"){k.callback=null,x=k.priorityLevel;var M=E(k.expirationTime<=ae);ae=e.unstable_now(),typeof M=="function"?k.callback=M:k===r(h)&&o(h),P(ae)}else o(h);k=r(h)}if(k!==null)var de=!0;else{var U=r(m);U!==null&&ee(L,U.startTime-ae),de=!1}return de}finally{k=null,x=K,S=!1}}var q=!1,F=null,O=-1,Q=5,J=-1;function te(){return!(e.unstable_now()-J<Q)}function me(){if(F!==null){var Y=e.unstable_now();J=Y;var ae=!0;try{ae=F(!0,Y)}finally{ae?ke():(q=!1,F=null)}}else q=!1}var ke;if(typeof A=="function")ke=function(){A(me)};else if(typeof MessageChannel<"u"){var Le=new MessageChannel,Te=Le.port2;Le.port1.onmessage=me,ke=function(){Te.postMessage(null)}}else ke=function(){T(me,0)};function oe(Y){F=Y,q||(q=!0,ke())}function ee(Y,ae){O=T(function(){Y(e.unstable_now())},ae)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){j||S||(j=!0,oe(z))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return r(h)},e.unstable_next=function(Y){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var K=x;x=ae;try{return Y()}finally{x=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,ae){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var K=x;x=Y;try{return ae()}finally{x=K}},e.unstable_scheduleCallback=function(Y,ae,K){var E=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?E+K:E):K=E,Y){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=K+M,Y={id:v++,callback:ae,priorityLevel:Y,startTime:K,expirationTime:M,sortIndex:-1},K>E?(Y.sortIndex=K,n(m,Y),r(h)===null&&Y===r(m)&&(N?(b(O),O=-1):N=!0,ee(L,K-E))):(Y.sortIndex=M,n(h,Y),j||S||(j=!0,oe(z))),Y},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(Y){var ae=x;return function(){var K=x;x=ae;try{return Y.apply(this,arguments)}finally{x=K}}}})(Hu)),Hu}var Jh;function t0(){return Jh||(Jh=1,Wu.exports=e0()),Wu.exports}/**
27
27
  * @license React
28
28
  * react-dom.production.min.js
29
29
  *
@@ -31,66 +31,66 @@ var Kw=Object.defineProperty;var Gw=(e,n,r)=>n in e?Kw(e,n,{enumerable:!0,config
31
31
  *
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
- */var em;function Jw(){if(em)return Ln;em=1;var e=Vd(),n=Zw();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,l={};function c(t,s){d(t,s),d(t+"Capture",s)}function d(t,s){for(l[t]=s,t=0;t<s.length;t++)o.add(s[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=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 x(t){return h.call(k,t)?!0:h.call(v,t)?!1:m.test(t)?k[t]=!0:(v[t]=!0,!1)}function S(t,s,i,u){if(i!==null&&i.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function j(t,s,i,u){if(s===null||typeof s>"u"||S(t,s,i,u))return!0;if(u)return!1;if(i!==null)switch(i.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 N(t,s,i,u,p,g,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=s,this.sanitizeURL=g,this.removeEmptyString=w}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){T[t]=new N(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];T[s]=new N(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){T[t]=new N(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){T[t]=new N(t,2,!1,t,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(t){T[t]=new N(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){T[t]=new N(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){T[t]=new N(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){T[t]=new N(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){T[t]=new N(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function A(t){return t[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(t){var s=t.replace(b,A);T[s]=new N(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,A);T[s]=new N(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,A);T[s]=new N(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){T[t]=new N(t,1,!1,t.toLowerCase(),null,!1,!1)}),T.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){T[t]=new N(t,1,!1,t.toLowerCase(),null,!0,!0)});function P(t,s,i,u){var p=T.hasOwnProperty(s)?T[s]:null;(p!==null?p.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(j(s,i,p,u)&&(i=null),u||p===null?x(s)&&(i===null?t.removeAttribute(s):t.setAttribute(s,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(s=p.attributeName,u=p.attributeNamespace,i===null?t.removeAttribute(s):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,u?t.setAttributeNS(u,s,i):t.setAttribute(s,i))))}var L=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,z=Symbol.for("react.element"),q=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),J=Symbol.for("react.provider"),te=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),ke=Symbol.for("react.suspense"),Le=Symbol.for("react.suspense_list"),Te=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),ee=Symbol.for("react.offscreen"),Y=Symbol.iterator;function ae(t){return t===null||typeof t!="object"?null:(t=Y&&t[Y]||t["@@iterator"],typeof t=="function"?t:null)}var K=Object.assign,E;function M(t){if(E===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);E=s&&s[1]||""}return`
34
+ */var em;function n0(){if(em)return Ln;em=1;var e=Vd(),n=t0();function r(t){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,l={};function c(t,s){d(t,s),d(t+"Capture",s)}function d(t,s){for(l[t]=s,t=0;t<s.length;t++)o.add(s[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=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 x(t){return h.call(k,t)?!0:h.call(v,t)?!1:m.test(t)?k[t]=!0:(v[t]=!0,!1)}function S(t,s,i,u){if(i!==null&&i.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return u?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function j(t,s,i,u){if(s===null||typeof s>"u"||S(t,s,i,u))return!0;if(u)return!1;if(i!==null)switch(i.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 N(t,s,i,u,p,g,w){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=u,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=s,this.sanitizeURL=g,this.removeEmptyString=w}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){T[t]=new N(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var s=t[0];T[s]=new N(s,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){T[t]=new N(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){T[t]=new N(t,2,!1,t,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(t){T[t]=new N(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){T[t]=new N(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){T[t]=new N(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){T[t]=new N(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){T[t]=new N(t,5,!1,t.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function A(t){return t[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(t){var s=t.replace(b,A);T[s]=new N(s,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var s=t.replace(b,A);T[s]=new N(s,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var s=t.replace(b,A);T[s]=new N(s,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){T[t]=new N(t,1,!1,t.toLowerCase(),null,!1,!1)}),T.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){T[t]=new N(t,1,!1,t.toLowerCase(),null,!0,!0)});function P(t,s,i,u){var p=T.hasOwnProperty(s)?T[s]:null;(p!==null?p.type!==0:u||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(j(s,i,p,u)&&(i=null),u||p===null?x(s)&&(i===null?t.removeAttribute(s):t.setAttribute(s,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(s=p.attributeName,u=p.attributeNamespace,i===null?t.removeAttribute(s):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,u?t.setAttributeNS(u,s,i):t.setAttribute(s,i))))}var L=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,z=Symbol.for("react.element"),q=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),J=Symbol.for("react.provider"),te=Symbol.for("react.context"),me=Symbol.for("react.forward_ref"),ke=Symbol.for("react.suspense"),Le=Symbol.for("react.suspense_list"),Te=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),ee=Symbol.for("react.offscreen"),Y=Symbol.iterator;function ae(t){return t===null||typeof t!="object"?null:(t=Y&&t[Y]||t["@@iterator"],typeof t=="function"?t:null)}var K=Object.assign,E;function M(t){if(E===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);E=s&&s[1]||""}return`
35
35
  `+E+t}var de=!1;function U(t,s){if(!t||de)return"";de=!0;var i=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(t,[],s)}else{try{s.call()}catch(V){u=V}t.call(s.prototype)}else{try{throw Error()}catch(V){u=V}t()}}catch(V){if(V&&u&&typeof V.stack=="string"){for(var p=V.stack.split(`
36
36
  `),g=u.stack.split(`
37
37
  `),w=p.length-1,_=g.length-1;1<=w&&0<=_&&p[w]!==g[_];)_--;for(;1<=w&&0<=_;w--,_--)if(p[w]!==g[_]){if(w!==1||_!==1)do if(w--,_--,0>_||p[w]!==g[_]){var D=`
38
- `+p[w].replace(" at new "," at ");return t.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",t.displayName)),D}while(1<=w&&0<=_);break}}}finally{de=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?M(t):""}function ue(t){switch(t.tag){case 5:return M(t.type);case 16:return M("Lazy");case 13:return M("Suspense");case 19:return M("SuspenseList");case 0:case 2:case 15:return t=U(t.type,!1),t;case 11:return t=U(t.type.render,!1),t;case 1:return t=U(t.type,!0),t;default:return""}}function X(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case F:return"Fragment";case q:return"Portal";case Q:return"Profiler";case O:return"StrictMode";case ke:return"Suspense";case Le:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case te:return(t.displayName||"Context")+".Consumer";case J:return(t._context.displayName||"Context")+".Provider";case me:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Te:return s=t.displayName||null,s!==null?s:X(t.type)||"Memo";case oe:s=t._payload,t=t._init;try{return X(t(s))}catch{}}return null}function ve(t){var s=t.type;switch(t.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 t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(s);case 8:return s===O?"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 xe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ae(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Ce(t){var s=Ae(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,g=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(w){u=""+w,g.call(this,w)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ge(t){t._valueTracker||(t._valueTracker=Ce(t))}function le(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=Ae(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function Qe(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ee(t,s){var i=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function et(t,s){var i=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;i=xe(s.value!=null?s.value:i),t._wrapperState={initialChecked:u,initialValue:i,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function He(t,s){s=s.checked,s!=null&&P(t,"checked",s,!1)}function Se(t,s){He(t,s);var i=xe(s.value),u=s.type;if(i!=null)u==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?Xe(t,s.type,i):s.hasOwnProperty("defaultValue")&&Xe(t,s.type,xe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function Be(t,s,i){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=""+t._wrapperState.initialValue,i||s===t.value||(t.value=s),t.defaultValue=s}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Xe(t,s,i){(s!=="number"||Qe(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var at=Array.isArray;function kt(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+xe(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Ot(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function G(t,s){var i=s.value;if(i==null){if(i=s.children,s=s.defaultValue,i!=null){if(s!=null)throw Error(r(92));if(at(i)){if(1<i.length)throw Error(r(93));i=i[0]}s=i}s==null&&(s=""),i=s}t._wrapperState={initialValue:xe(i)}}function we(t,s){var i=xe(s.value),u=xe(s.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),s.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),u!=null&&(t.defaultValue=""+u)}function ze(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function Ye(t){switch(t){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 vt(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?Ye(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var yt,Z=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,i,u,p){MSApp.execUnsafeLocalFunction(function(){return t(s,i,u,p)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(yt=yt||document.createElement("div"),yt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=yt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Pe(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var qe={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},St=["Webkit","ms","Moz","O"];Object.keys(qe).forEach(function(t){St.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),qe[s]=qe[t]})});function yn(t,s,i){return s==null||typeof s=="boolean"||s===""?"":i||typeof s!="number"||s===0||qe.hasOwnProperty(t)&&qe[t]?(""+s).trim():s+"px"}function xn(t,s){t=t.style;for(var i in s)if(s.hasOwnProperty(i)){var u=i.indexOf("--")===0,p=yn(i,s[i],u);i==="float"&&(i="cssFloat"),u?t.setProperty(i,p):t[i]=p}}var ns=K({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 ss(t,s){if(s){if(ns[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));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 rs(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wn=null;function fn(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Wt=null,_n=null,ft=null;function bt(t){if(t=ti(t)){if(typeof Wt!="function")throw Error(r(280));var s=t.stateNode;s&&(s=ga(s),Wt(t.stateNode,t.type,s))}}function Rt(t){_n?ft?ft.push(t):ft=[t]:_n=t}function Kt(){if(_n){var t=_n,s=ft;if(ft=_n=null,bt(t),s)for(t=0;t<s.length;t++)bt(s[t])}}function Et(t,s){return t(s)}function Nt(){}var mt=!1;function Gt(t,s,i){if(mt)return t(s,i);mt=!0;try{return Et(t,s,i)}finally{mt=!1,(_n!==null||ft!==null)&&(Nt(),Kt())}}function pt(t,s){var i=t.stateNode;if(i===null)return null;var u=ga(i);if(u===null)return null;i=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)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var Jt=!1;if(f)try{var $t={};Object.defineProperty($t,"passive",{get:function(){Jt=!0}}),window.addEventListener("test",$t,$t),window.removeEventListener("test",$t,$t)}catch{Jt=!1}function I(t,s,i,u,p,g,w,_,D){var V=Array.prototype.slice.call(arguments,3);try{s.apply(i,V)}catch(re){this.onError(re)}}var he=!1,ce=null,be=!1,We=null,tt={onError:function(t){he=!0,ce=t}};function Ve(t,s,i,u,p,g,w,_,D){he=!1,ce=null,I.apply(tt,arguments)}function qt(t,s,i,u,p,g,w,_,D){if(Ve.apply(this,arguments),he){if(he){var V=ce;he=!1,ce=null}else throw Error(r(198));be||(be=!0,We=V)}}function Ke(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function Xt(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function ys(t){if(Ke(t)!==t)throw Error(r(188))}function Rs(t){var s=t.alternate;if(!s){if(s=Ke(t),s===null)throw Error(r(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return ys(p),t;if(g===u)return ys(p),s;g=g.sibling}throw Error(r(188))}if(i.return!==u.return)i=p,u=g;else{for(var w=!1,_=p.child;_;){if(_===i){w=!0,i=p,u=g;break}if(_===u){w=!0,u=p,i=g;break}_=_.sibling}if(!w){for(_=g.child;_;){if(_===i){w=!0,i=g,u=p;break}if(_===u){w=!0,u=g,i=p;break}_=_.sibling}if(!w)throw Error(r(189))}}if(i.alternate!==u)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:s}function xs(t){return t=Rs(t),t!==null?Kn(t):null}function Kn(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=Kn(t);if(s!==null)return s;t=t.sibling}return null}var ws=n.unstable_scheduleCallback,lt=n.unstable_cancelCallback,zt=n.unstable_shouldYield,ks=n.unstable_requestPaint,At=n.unstable_now,Ss=n.unstable_getCurrentPriorityLevel,Hs=n.unstable_ImmediatePriority,bs=n.unstable_UserBlockingPriority,Hr=n.unstable_NormalPriority,xr=n.unstable_LowPriority,Zi=n.unstable_IdlePriority,wr=null,$n=null;function Vr(t){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(wr,t,void 0,(t.current.flags&128)===128)}catch{}}var kn=Math.clz32?Math.clz32:kr,Kr=Math.log,Vs=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(Kr(t)/Vs|0)|0}var Sn=64,Gr=4194304;function Sr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function br(t,s){var i=t.pendingLanes;if(i===0)return 0;var u=0,p=t.suspendedLanes,g=t.pingedLanes,w=i&268435455;if(w!==0){var _=w&~p;_!==0?u=Sr(_):(g&=w,g!==0&&(u=Sr(g)))}else w=i&~p,w!==0?u=Sr(w):g!==0&&(u=Sr(g));if(u===0)return 0;if(s!==0&&s!==u&&(s&p)===0&&(p=u&-u,g=s&-s,p>=g||p===16&&(g&4194240)!==0))return s;if((u&4)!==0&&(u|=i&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=u;0<s;)i=31-kn(s),p=1<<i,u|=t[i],s&=~p;return u}function Ji(t,s){switch(t){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 ea(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,g=t.pendingLanes;0<g;){var w=31-kn(g),_=1<<w,D=p[w];D===-1?((_&i)===0||(_&u)!==0)&&(p[w]=Ji(_,s)):D<=s&&(t.expiredLanes|=_),g&=~_}}function Po(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function zo(){var t=Sn;return Sn<<=1,(Sn&4194240)===0&&(Sn=64),t}function Fo(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function Nr(t,s,i){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-kn(s),t[s]=i}function ta(t,s){var i=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-kn(i),g=1<<p;s[p]=0,u[p]=-1,t[p]=-1,i&=~g}}function Ks(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-kn(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}var nt=0;function fe(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var C,B,ne,Re,Me,Ue=!1,st=[],ot=null,It=null,Dt=null,As=new Map,Ft=new Map,Gs=[],hx="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 Af(t,s){switch(t){case"focusin":case"focusout":ot=null;break;case"dragenter":case"dragleave":It=null;break;case"mouseover":case"mouseout":Dt=null;break;case"pointerover":case"pointerout":As.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ft.delete(s.pointerId)}}function Uo(t,s,i,u,p,g){return t===null||t.nativeEvent!==g?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:g,targetContainers:[p]},s!==null&&(s=ti(s),s!==null&&B(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function mx(t,s,i,u,p){switch(s){case"focusin":return ot=Uo(ot,t,s,i,u,p),!0;case"dragenter":return It=Uo(It,t,s,i,u,p),!0;case"mouseover":return Dt=Uo(Dt,t,s,i,u,p),!0;case"pointerover":var g=p.pointerId;return As.set(g,Uo(As.get(g)||null,t,s,i,u,p)),!0;case"gotpointercapture":return g=p.pointerId,Ft.set(g,Uo(Ft.get(g)||null,t,s,i,u,p)),!0}return!1}function If(t){var s=Tr(t.target);if(s!==null){var i=Ke(s);if(i!==null){if(s=i.tag,s===13){if(s=Xt(i),s!==null){t.blockedOn=s,Me(t.priority,function(){ne(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function na(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=pc(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);wn=u,i.target.dispatchEvent(u),wn=null}else return s=ti(i),s!==null&&B(s),t.blockedOn=i,!1;s.shift()}return!0}function Df(t,s,i){na(t)&&i.delete(s)}function gx(){Ue=!1,ot!==null&&na(ot)&&(ot=null),It!==null&&na(It)&&(It=null),Dt!==null&&na(Dt)&&(Dt=null),As.forEach(Df),Ft.forEach(Df)}function Bo(t,s){t.blockedOn===s&&(t.blockedOn=null,Ue||(Ue=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,gx)))}function Wo(t){function s(p){return Bo(p,t)}if(0<st.length){Bo(st[0],t);for(var i=1;i<st.length;i++){var u=st[i];u.blockedOn===t&&(u.blockedOn=null)}}for(ot!==null&&Bo(ot,t),It!==null&&Bo(It,t),Dt!==null&&Bo(Dt,t),As.forEach(s),Ft.forEach(s),i=0;i<Gs.length;i++)u=Gs[i],u.blockedOn===t&&(u.blockedOn=null);for(;0<Gs.length&&(i=Gs[0],i.blockedOn===null);)If(i),i.blockedOn===null&&Gs.shift()}var qr=L.ReactCurrentBatchConfig,sa=!0;function vx(t,s,i,u){var p=nt,g=qr.transition;qr.transition=null;try{nt=1,fc(t,s,i,u)}finally{nt=p,qr.transition=g}}function yx(t,s,i,u){var p=nt,g=qr.transition;qr.transition=null;try{nt=4,fc(t,s,i,u)}finally{nt=p,qr.transition=g}}function fc(t,s,i,u){if(sa){var p=pc(t,s,i,u);if(p===null)Rc(t,s,u,ra,i),Af(t,u);else if(mx(p,t,s,i,u))u.stopPropagation();else if(Af(t,u),s&4&&-1<hx.indexOf(t)){for(;p!==null;){var g=ti(p);if(g!==null&&C(g),g=pc(t,s,i,u),g===null&&Rc(t,s,u,ra,i),g===p)break;p=g}p!==null&&u.stopPropagation()}else Rc(t,s,u,null,i)}}var ra=null;function pc(t,s,i,u){if(ra=null,t=fn(u),t=Tr(t),t!==null)if(s=Ke(t),s===null)t=null;else if(i=s.tag,i===13){if(t=Xt(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return ra=t,null}function Mf(t){switch(t){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(Ss()){case Hs:return 1;case bs:return 4;case Hr:case xr:return 16;case Zi:return 536870912;default:return 16}default:return 16}}var qs=null,hc=null,oa=null;function Lf(){if(oa)return oa;var t,s=hc,i=s.length,u,p="value"in qs?qs.value:qs.textContent,g=p.length;for(t=0;t<i&&s[t]===p[t];t++);var w=i-t;for(u=1;u<=w&&s[i-u]===p[g-u];u++);return oa=p.slice(t,1<u?1-u:void 0)}function ia(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function aa(){return!0}function Of(){return!1}function Pn(t){function s(i,u,p,g,w){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?aa:Of,this.isPropagationStopped=Of,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=aa)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=aa)},persist:function(){},isPersistent:aa}),s}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mc=Pn(Xr),Ho=K({},Xr,{view:0,detail:0}),xx=Pn(Ho),gc,vc,Vo,la=K({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Vo&&(Vo&&t.type==="mousemove"?(gc=t.screenX-Vo.screenX,vc=t.screenY-Vo.screenY):vc=gc=0,Vo=t),gc)},movementY:function(t){return"movementY"in t?t.movementY:vc}}),$f=Pn(la),wx=K({},la,{dataTransfer:0}),kx=Pn(wx),Sx=K({},Ho,{relatedTarget:0}),yc=Pn(Sx),bx=K({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),Nx=Pn(bx),Tx=K({},Xr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Cx=Pn(Tx),jx=K({},Xr,{data:0}),Pf=Pn(jx),Ex={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_x={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"},Rx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ax(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=Rx[t])?!!s[t]:!1}function xc(){return Ax}var Ix=K({},Ho,{key:function(t){if(t.key){var s=Ex[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=ia(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?_x[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xc,charCode:function(t){return t.type==="keypress"?ia(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ia(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Dx=Pn(Ix),Mx=K({},la,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zf=Pn(Mx),Lx=K({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xc}),Ox=Pn(Lx),$x=K({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Px=Pn($x),zx=K({},la,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Fx=Pn(zx),Ux=[9,13,27,32],wc=f&&"CompositionEvent"in window,Ko=null;f&&"documentMode"in document&&(Ko=document.documentMode);var Bx=f&&"TextEvent"in window&&!Ko,Ff=f&&(!wc||Ko&&8<Ko&&11>=Ko),Uf=" ",Bf=!1;function Wf(t,s){switch(t){case"keyup":return Ux.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Yr=!1;function Wx(t,s){switch(t){case"compositionend":return Hf(s);case"keypress":return s.which!==32?null:(Bf=!0,Uf);case"textInput":return t=s.data,t===Uf&&Bf?null:t;default:return null}}function Hx(t,s){if(Yr)return t==="compositionend"||!wc&&Wf(t,s)?(t=Lf(),oa=hc=qs=null,Yr=!1,t):null;switch(t){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 Ff&&s.locale!=="ko"?null:s.data;default:return null}}var Vx={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 Vf(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!Vx[t.type]:s==="textarea"}function Kf(t,s,i,u){Rt(u),s=pa(s,"onChange"),0<s.length&&(i=new mc("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var Go=null,qo=null;function Kx(t){up(t,0)}function ca(t){var s=to(t);if(le(s))return t}function Gx(t,s){if(t==="change")return s}var Gf=!1;if(f){var kc;if(f){var Sc="oninput"in document;if(!Sc){var qf=document.createElement("div");qf.setAttribute("oninput","return;"),Sc=typeof qf.oninput=="function"}kc=Sc}else kc=!1;Gf=kc&&(!document.documentMode||9<document.documentMode)}function Xf(){Go&&(Go.detachEvent("onpropertychange",Yf),qo=Go=null)}function Yf(t){if(t.propertyName==="value"&&ca(qo)){var s=[];Kf(s,qo,t,fn(t)),Gt(Kx,s)}}function qx(t,s,i){t==="focusin"?(Xf(),Go=s,qo=i,Go.attachEvent("onpropertychange",Yf)):t==="focusout"&&Xf()}function Xx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ca(qo)}function Yx(t,s){if(t==="click")return ca(s)}function Qx(t,s){if(t==="input"||t==="change")return ca(s)}function Zx(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var os=typeof Object.is=="function"?Object.is:Zx;function Xo(t,s){if(os(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!h.call(s,p)||!os(t[p],s[p]))return!1}return!0}function Qf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Zf(t,s){var i=Qf(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Qf(i)}}function Jf(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Jf(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function ep(){for(var t=window,s=Qe();s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=Qe(t.document)}return s}function bc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function Jx(t){var s=ep(),i=t.focusedElem,u=t.selectionRange;if(s!==i&&i&&i.ownerDocument&&Jf(i.ownerDocument.documentElement,i)){if(u!==null&&bc(i)){if(s=u.start,t=u.end,t===void 0&&(t=s),"selectionStart"in i)i.selectionStart=s,i.selectionEnd=Math.min(t,i.value.length);else if(t=(s=i.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,g=Math.min(u.start,p);u=u.end===void 0?g:Math.min(u.end,p),!t.extend&&g>u&&(p=u,u=g,g=p),p=Zf(i,g);var w=Zf(i,u);p&&w&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),t.removeAllRanges(),g>u?(t.addRange(s),t.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),t.addRange(s)))}}for(s=[],t=i;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<s.length;i++)t=s[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var ew=f&&"documentMode"in document&&11>=document.documentMode,Qr=null,Nc=null,Yo=null,Tc=!1;function tp(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Tc||Qr==null||Qr!==Qe(u)||(u=Qr,"selectionStart"in u&&bc(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}),Yo&&Xo(Yo,u)||(Yo=u,u=pa(Nc,"onSelect"),0<u.length&&(s=new mc("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Qr)))}function ua(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var Zr={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},Cc={},np={};f&&(np=document.createElement("div").style,"AnimationEvent"in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),"TransitionEvent"in window||delete Zr.transitionend.transition);function da(t){if(Cc[t])return Cc[t];if(!Zr[t])return t;var s=Zr[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in np)return Cc[t]=s[i];return t}var sp=da("animationend"),rp=da("animationiteration"),op=da("animationstart"),ip=da("transitionend"),ap=new Map,lp="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 Xs(t,s){ap.set(t,s),c(s,[t])}for(var jc=0;jc<lp.length;jc++){var Ec=lp[jc],tw=Ec.toLowerCase(),nw=Ec[0].toUpperCase()+Ec.slice(1);Xs(tw,"on"+nw)}Xs(sp,"onAnimationEnd"),Xs(rp,"onAnimationIteration"),Xs(op,"onAnimationStart"),Xs("dblclick","onDoubleClick"),Xs("focusin","onFocus"),Xs("focusout","onBlur"),Xs(ip,"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 Qo="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(" "),sw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qo));function cp(t,s,i){var u=t.type||"unknown-event";t.currentTarget=i,qt(u,s,void 0,t),t.currentTarget=null}function up(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var g=void 0;if(s)for(var w=u.length-1;0<=w;w--){var _=u[w],D=_.instance,V=_.currentTarget;if(_=_.listener,D!==g&&p.isPropagationStopped())break e;cp(p,_,V),g=D}else for(w=0;w<u.length;w++){if(_=u[w],D=_.instance,V=_.currentTarget,_=_.listener,D!==g&&p.isPropagationStopped())break e;cp(p,_,V),g=D}}}if(be)throw t=We,be=!1,We=null,t}function Tt(t,s){var i=s[Oc];i===void 0&&(i=s[Oc]=new Set);var u=t+"__bubble";i.has(u)||(dp(s,t,2,!1),i.add(u))}function _c(t,s,i){var u=0;s&&(u|=4),dp(i,t,u,s)}var fa="_reactListening"+Math.random().toString(36).slice(2);function Zo(t){if(!t[fa]){t[fa]=!0,o.forEach(function(i){i!=="selectionchange"&&(sw.has(i)||_c(i,!1,t),_c(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[fa]||(s[fa]=!0,_c("selectionchange",!1,s))}}function dp(t,s,i,u){switch(Mf(s)){case 1:var p=vx;break;case 4:p=yx;break;default:p=fc}i=p.bind(null,s,i,t),p=void 0,!Jt||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function Rc(t,s,i,u,p){var g=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 _=u.stateNode.containerInfo;if(_===p||_.nodeType===8&&_.parentNode===p)break;if(w===4)for(w=u.return;w!==null;){var D=w.tag;if((D===3||D===4)&&(D=w.stateNode.containerInfo,D===p||D.nodeType===8&&D.parentNode===p))return;w=w.return}for(;_!==null;){if(w=Tr(_),w===null)return;if(D=w.tag,D===5||D===6){u=g=w;continue e}_=_.parentNode}}u=u.return}Gt(function(){var V=g,re=fn(i),ie=[];e:{var se=ap.get(t);if(se!==void 0){var Ne=mc,_e=t;switch(t){case"keypress":if(ia(i)===0)break e;case"keydown":case"keyup":Ne=Dx;break;case"focusin":_e="focus",Ne=yc;break;case"focusout":_e="blur",Ne=yc;break;case"beforeblur":case"afterblur":Ne=yc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=$f;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=kx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=Ox;break;case sp:case rp:case op:Ne=Nx;break;case ip:Ne=Px;break;case"scroll":Ne=xx;break;case"wheel":Ne=Fx;break;case"copy":case"cut":case"paste":Ne=Cx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=zf}var Ie=(s&4)!==0,Ut=!Ie&&t==="scroll",W=Ie?se!==null?se+"Capture":null:se;Ie=[];for(var $=V,H;$!==null;){H=$;var pe=H.stateNode;if(H.tag===5&&pe!==null&&(H=pe,W!==null&&(pe=pt($,W),pe!=null&&Ie.push(Jo($,pe,H)))),Ut)break;$=$.return}0<Ie.length&&(se=new Ne(se,_e,null,i,re),ie.push({event:se,listeners:Ie}))}}if((s&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",Ne=t==="mouseout"||t==="pointerout",se&&i!==wn&&(_e=i.relatedTarget||i.fromElement)&&(Tr(_e)||_e[Is]))break e;if((Ne||se)&&(se=re.window===re?re:(se=re.ownerDocument)?se.defaultView||se.parentWindow:window,Ne?(_e=i.relatedTarget||i.toElement,Ne=V,_e=_e?Tr(_e):null,_e!==null&&(Ut=Ke(_e),_e!==Ut||_e.tag!==5&&_e.tag!==6)&&(_e=null)):(Ne=null,_e=V),Ne!==_e)){if(Ie=$f,pe="onMouseLeave",W="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=zf,pe="onPointerLeave",W="onPointerEnter",$="pointer"),Ut=Ne==null?se:to(Ne),H=_e==null?se:to(_e),se=new Ie(pe,$+"leave",Ne,i,re),se.target=Ut,se.relatedTarget=H,pe=null,Tr(re)===V&&(Ie=new Ie(W,$+"enter",_e,i,re),Ie.target=H,Ie.relatedTarget=Ut,pe=Ie),Ut=pe,Ne&&_e)t:{for(Ie=Ne,W=_e,$=0,H=Ie;H;H=Jr(H))$++;for(H=0,pe=W;pe;pe=Jr(pe))H++;for(;0<$-H;)Ie=Jr(Ie),$--;for(;0<H-$;)W=Jr(W),H--;for(;$--;){if(Ie===W||W!==null&&Ie===W.alternate)break t;Ie=Jr(Ie),W=Jr(W)}Ie=null}else Ie=null;Ne!==null&&fp(ie,se,Ne,Ie,!1),_e!==null&&Ut!==null&&fp(ie,Ut,_e,Ie,!0)}}e:{if(se=V?to(V):window,Ne=se.nodeName&&se.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&se.type==="file")var De=Gx;else if(Vf(se))if(Gf)De=Qx;else{De=Xx;var Oe=qx}else(Ne=se.nodeName)&&Ne.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(De=Yx);if(De&&(De=De(t,V))){Kf(ie,De,i,re);break e}Oe&&Oe(t,se,V),t==="focusout"&&(Oe=se._wrapperState)&&Oe.controlled&&se.type==="number"&&Xe(se,"number",se.value)}switch(Oe=V?to(V):window,t){case"focusin":(Vf(Oe)||Oe.contentEditable==="true")&&(Qr=Oe,Nc=V,Yo=null);break;case"focusout":Yo=Nc=Qr=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,tp(ie,i,re);break;case"selectionchange":if(ew)break;case"keydown":case"keyup":tp(ie,i,re)}var $e;if(wc)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Yr?Wf(t,i)&&(Fe="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(Fe="onCompositionStart");Fe&&(Ff&&i.locale!=="ko"&&(Yr||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Yr&&($e=Lf()):(qs=re,hc="value"in qs?qs.value:qs.textContent,Yr=!0)),Oe=pa(V,Fe),0<Oe.length&&(Fe=new Pf(Fe,t,null,i,re),ie.push({event:Fe,listeners:Oe}),$e?Fe.data=$e:($e=Hf(i),$e!==null&&(Fe.data=$e)))),($e=Bx?Wx(t,i):Hx(t,i))&&(V=pa(V,"onBeforeInput"),0<V.length&&(re=new Pf("onBeforeInput","beforeinput",null,i,re),ie.push({event:re,listeners:V}),re.data=$e))}up(ie,s)})}function Jo(t,s,i){return{instance:t,listener:s,currentTarget:i}}function pa(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,g=p.stateNode;p.tag===5&&g!==null&&(p=g,g=pt(t,i),g!=null&&u.unshift(Jo(t,g,p)),g=pt(t,s),g!=null&&u.push(Jo(t,g,p))),t=t.return}return u}function Jr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function fp(t,s,i,u,p){for(var g=s._reactName,w=[];i!==null&&i!==u;){var _=i,D=_.alternate,V=_.stateNode;if(D!==null&&D===u)break;_.tag===5&&V!==null&&(_=V,p?(D=pt(i,g),D!=null&&w.unshift(Jo(i,D,_))):p||(D=pt(i,g),D!=null&&w.push(Jo(i,D,_)))),i=i.return}w.length!==0&&t.push({event:s,listeners:w})}var rw=/\r\n?/g,ow=/\u0000|\uFFFD/g;function pp(t){return(typeof t=="string"?t:""+t).replace(rw,`
39
- `).replace(ow,"")}function ha(t,s,i){if(s=pp(s),pp(t)!==s&&i)throw Error(r(425))}function ma(){}var Ac=null,Ic=null;function Dc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Mc=typeof setTimeout=="function"?setTimeout:void 0,iw=typeof clearTimeout=="function"?clearTimeout:void 0,hp=typeof Promise=="function"?Promise:void 0,aw=typeof queueMicrotask=="function"?queueMicrotask:typeof hp<"u"?function(t){return hp.resolve(null).then(t).catch(lw)}:Mc;function lw(t){setTimeout(function(){throw t})}function Lc(t,s){var i=s,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(u===0){t.removeChild(p),Wo(s);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=p}while(i);Wo(s)}function Ys(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function mp(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}var eo=Math.random().toString(36).slice(2),Ns="__reactFiber$"+eo,ei="__reactProps$"+eo,Is="__reactContainer$"+eo,Oc="__reactEvents$"+eo,cw="__reactListeners$"+eo,uw="__reactHandles$"+eo;function Tr(t){var s=t[Ns];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Is]||i[Ns]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=mp(t);t!==null;){if(i=t[Ns])return i;t=mp(t)}return s}t=i,i=t.parentNode}return null}function ti(t){return t=t[Ns]||t[Is],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function to(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ga(t){return t[ei]||null}var $c=[],no=-1;function Qs(t){return{current:t}}function Ct(t){0>no||(t.current=$c[no],$c[no]=null,no--)}function wt(t,s){no++,$c[no]=t.current,t.current=s}var Zs={},pn=Qs(Zs),Rn=Qs(!1),Cr=Zs;function so(t,s){var i=t.type.contextTypes;if(!i)return Zs;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var p={},g;for(g in i)p[g]=s[g];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=p),p}function An(t){return t=t.childContextTypes,t!=null}function va(){Ct(Rn),Ct(pn)}function gp(t,s,i){if(pn.current!==Zs)throw Error(r(168));wt(pn,s),wt(Rn,i)}function vp(t,s,i){var u=t.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var p in u)if(!(p in s))throw Error(r(108,ve(t)||"Unknown",p));return K({},i,u)}function ya(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Zs,Cr=pn.current,wt(pn,t),wt(Rn,Rn.current),!0}function yp(t,s,i){var u=t.stateNode;if(!u)throw Error(r(169));i?(t=vp(t,s,Cr),u.__reactInternalMemoizedMergedChildContext=t,Ct(Rn),Ct(pn),wt(pn,t)):Ct(Rn),wt(Rn,i)}var Ds=null,xa=!1,Pc=!1;function xp(t){Ds===null?Ds=[t]:Ds.push(t)}function dw(t){xa=!0,xp(t)}function Js(){if(!Pc&&Ds!==null){Pc=!0;var t=0,s=nt;try{var i=Ds;for(nt=1;t<i.length;t++){var u=i[t];do u=u(!0);while(u!==null)}Ds=null,xa=!1}catch(p){throw Ds!==null&&(Ds=Ds.slice(t+1)),ws(Hs,Js),p}finally{nt=s,Pc=!1}}return null}var ro=[],oo=0,wa=null,ka=0,Gn=[],qn=0,jr=null,Ms=1,Ls="";function Er(t,s){ro[oo++]=ka,ro[oo++]=wa,wa=t,ka=s}function wp(t,s,i){Gn[qn++]=Ms,Gn[qn++]=Ls,Gn[qn++]=jr,jr=t;var u=Ms;t=Ls;var p=32-kn(u)-1;u&=~(1<<p),i+=1;var g=32-kn(s)+p;if(30<g){var w=p-p%5;g=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Ms=1<<32-kn(s)+p|i<<p|u,Ls=g+t}else Ms=1<<g|i<<p|u,Ls=t}function zc(t){t.return!==null&&(Er(t,1),wp(t,1,0))}function Fc(t){for(;t===wa;)wa=ro[--oo],ro[oo]=null,ka=ro[--oo],ro[oo]=null;for(;t===jr;)jr=Gn[--qn],Gn[qn]=null,Ls=Gn[--qn],Gn[qn]=null,Ms=Gn[--qn],Gn[qn]=null}var zn=null,Fn=null,_t=!1,is=null;function kp(t,s){var i=Zn(5,null,null,0);i.elementType="DELETED",i.stateNode=s,i.return=t,s=t.deletions,s===null?(t.deletions=[i],t.flags|=16):s.push(i)}function Sp(t,s){switch(t.tag){case 5:var i=t.type;return s=s.nodeType!==1||i.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,zn=t,Fn=Ys(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,zn=t,Fn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(i=jr!==null?{id:Ms,overflow:Ls}:null,t.memoizedState={dehydrated:s,treeContext:i,retryLane:1073741824},i=Zn(18,null,null,0),i.stateNode=s,i.return=t,t.child=i,zn=t,Fn=null,!0):!1;default:return!1}}function Uc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Bc(t){if(_t){var s=Fn;if(s){var i=s;if(!Sp(t,s)){if(Uc(t))throw Error(r(418));s=Ys(i.nextSibling);var u=zn;s&&Sp(t,s)?kp(u,i):(t.flags=t.flags&-4097|2,_t=!1,zn=t)}}else{if(Uc(t))throw Error(r(418));t.flags=t.flags&-4097|2,_t=!1,zn=t}}}function bp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;zn=t}function Sa(t){if(t!==zn)return!1;if(!_t)return bp(t),_t=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!Dc(t.type,t.memoizedProps)),s&&(s=Fn)){if(Uc(t))throw Np(),Error(r(418));for(;s;)kp(t,s),s=Ys(s.nextSibling)}if(bp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(s===0){Fn=Ys(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++}t=t.nextSibling}Fn=null}}else Fn=zn?Ys(t.stateNode.nextSibling):null;return!0}function Np(){for(var t=Fn;t;)t=Ys(t.nextSibling)}function io(){Fn=zn=null,_t=!1}function Wc(t){is===null?is=[t]:is.push(t)}var fw=L.ReactCurrentBatchConfig;function ni(t,s,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var u=i.stateNode}if(!u)throw Error(r(147,t));var p=u,g=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(w){var _=p.refs;w===null?delete _[g]:_[g]=w},s._stringRef=g,s)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function ba(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function Tp(t){var s=t._init;return s(t._payload)}function Cp(t){function s(W,$){if(t){var H=W.deletions;H===null?(W.deletions=[$],W.flags|=16):H.push($)}}function i(W,$){if(!t)return null;for(;$!==null;)s(W,$),$=$.sibling;return null}function u(W,$){for(W=new Map;$!==null;)$.key!==null?W.set($.key,$):W.set($.index,$),$=$.sibling;return W}function p(W,$){return W=ar(W,$),W.index=0,W.sibling=null,W}function g(W,$,H){return W.index=H,t?(H=W.alternate,H!==null?(H=H.index,H<$?(W.flags|=2,$):H):(W.flags|=2,$)):(W.flags|=1048576,$)}function w(W){return t&&W.alternate===null&&(W.flags|=2),W}function _(W,$,H,pe){return $===null||$.tag!==6?($=Mu(H,W.mode,pe),$.return=W,$):($=p($,H),$.return=W,$)}function D(W,$,H,pe){var De=H.type;return De===F?re(W,$,H.props.children,pe,H.key):$!==null&&($.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===oe&&Tp(De)===$.type)?(pe=p($,H.props),pe.ref=ni(W,$,H),pe.return=W,pe):(pe=Ga(H.type,H.key,H.props,null,W.mode,pe),pe.ref=ni(W,$,H),pe.return=W,pe)}function V(W,$,H,pe){return $===null||$.tag!==4||$.stateNode.containerInfo!==H.containerInfo||$.stateNode.implementation!==H.implementation?($=Lu(H,W.mode,pe),$.return=W,$):($=p($,H.children||[]),$.return=W,$)}function re(W,$,H,pe,De){return $===null||$.tag!==7?($=Or(H,W.mode,pe,De),$.return=W,$):($=p($,H),$.return=W,$)}function ie(W,$,H){if(typeof $=="string"&&$!==""||typeof $=="number")return $=Mu(""+$,W.mode,H),$.return=W,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case z:return H=Ga($.type,$.key,$.props,null,W.mode,H),H.ref=ni(W,null,$),H.return=W,H;case q:return $=Lu($,W.mode,H),$.return=W,$;case oe:var pe=$._init;return ie(W,pe($._payload),H)}if(at($)||ae($))return $=Or($,W.mode,H,null),$.return=W,$;ba(W,$)}return null}function se(W,$,H,pe){var De=$!==null?$.key:null;if(typeof H=="string"&&H!==""||typeof H=="number")return De!==null?null:_(W,$,""+H,pe);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case z:return H.key===De?D(W,$,H,pe):null;case q:return H.key===De?V(W,$,H,pe):null;case oe:return De=H._init,se(W,$,De(H._payload),pe)}if(at(H)||ae(H))return De!==null?null:re(W,$,H,pe,null);ba(W,H)}return null}function Ne(W,$,H,pe,De){if(typeof pe=="string"&&pe!==""||typeof pe=="number")return W=W.get(H)||null,_($,W,""+pe,De);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case z:return W=W.get(pe.key===null?H:pe.key)||null,D($,W,pe,De);case q:return W=W.get(pe.key===null?H:pe.key)||null,V($,W,pe,De);case oe:var Oe=pe._init;return Ne(W,$,H,Oe(pe._payload),De)}if(at(pe)||ae(pe))return W=W.get(H)||null,re($,W,pe,De,null);ba($,pe)}return null}function _e(W,$,H,pe){for(var De=null,Oe=null,$e=$,Fe=$=0,nn=null;$e!==null&&Fe<H.length;Fe++){$e.index>Fe?(nn=$e,$e=null):nn=$e.sibling;var it=se(W,$e,H[Fe],pe);if(it===null){$e===null&&($e=nn);break}t&&$e&&it.alternate===null&&s(W,$e),$=g(it,$,Fe),Oe===null?De=it:Oe.sibling=it,Oe=it,$e=nn}if(Fe===H.length)return i(W,$e),_t&&Er(W,Fe),De;if($e===null){for(;Fe<H.length;Fe++)$e=ie(W,H[Fe],pe),$e!==null&&($=g($e,$,Fe),Oe===null?De=$e:Oe.sibling=$e,Oe=$e);return _t&&Er(W,Fe),De}for($e=u(W,$e);Fe<H.length;Fe++)nn=Ne($e,W,Fe,H[Fe],pe),nn!==null&&(t&&nn.alternate!==null&&$e.delete(nn.key===null?Fe:nn.key),$=g(nn,$,Fe),Oe===null?De=nn:Oe.sibling=nn,Oe=nn);return t&&$e.forEach(function(lr){return s(W,lr)}),_t&&Er(W,Fe),De}function Ie(W,$,H,pe){var De=ae(H);if(typeof De!="function")throw Error(r(150));if(H=De.call(H),H==null)throw Error(r(151));for(var Oe=De=null,$e=$,Fe=$=0,nn=null,it=H.next();$e!==null&&!it.done;Fe++,it=H.next()){$e.index>Fe?(nn=$e,$e=null):nn=$e.sibling;var lr=se(W,$e,it.value,pe);if(lr===null){$e===null&&($e=nn);break}t&&$e&&lr.alternate===null&&s(W,$e),$=g(lr,$,Fe),Oe===null?De=lr:Oe.sibling=lr,Oe=lr,$e=nn}if(it.done)return i(W,$e),_t&&Er(W,Fe),De;if($e===null){for(;!it.done;Fe++,it=H.next())it=ie(W,it.value,pe),it!==null&&($=g(it,$,Fe),Oe===null?De=it:Oe.sibling=it,Oe=it);return _t&&Er(W,Fe),De}for($e=u(W,$e);!it.done;Fe++,it=H.next())it=Ne($e,W,Fe,it.value,pe),it!==null&&(t&&it.alternate!==null&&$e.delete(it.key===null?Fe:it.key),$=g(it,$,Fe),Oe===null?De=it:Oe.sibling=it,Oe=it);return t&&$e.forEach(function(Vw){return s(W,Vw)}),_t&&Er(W,Fe),De}function Ut(W,$,H,pe){if(typeof H=="object"&&H!==null&&H.type===F&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case z:e:{for(var De=H.key,Oe=$;Oe!==null;){if(Oe.key===De){if(De=H.type,De===F){if(Oe.tag===7){i(W,Oe.sibling),$=p(Oe,H.props.children),$.return=W,W=$;break e}}else if(Oe.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===oe&&Tp(De)===Oe.type){i(W,Oe.sibling),$=p(Oe,H.props),$.ref=ni(W,Oe,H),$.return=W,W=$;break e}i(W,Oe);break}else s(W,Oe);Oe=Oe.sibling}H.type===F?($=Or(H.props.children,W.mode,pe,H.key),$.return=W,W=$):(pe=Ga(H.type,H.key,H.props,null,W.mode,pe),pe.ref=ni(W,$,H),pe.return=W,W=pe)}return w(W);case q:e:{for(Oe=H.key;$!==null;){if($.key===Oe)if($.tag===4&&$.stateNode.containerInfo===H.containerInfo&&$.stateNode.implementation===H.implementation){i(W,$.sibling),$=p($,H.children||[]),$.return=W,W=$;break e}else{i(W,$);break}else s(W,$);$=$.sibling}$=Lu(H,W.mode,pe),$.return=W,W=$}return w(W);case oe:return Oe=H._init,Ut(W,$,Oe(H._payload),pe)}if(at(H))return _e(W,$,H,pe);if(ae(H))return Ie(W,$,H,pe);ba(W,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,$!==null&&$.tag===6?(i(W,$.sibling),$=p($,H),$.return=W,W=$):(i(W,$),$=Mu(H,W.mode,pe),$.return=W,W=$),w(W)):i(W,$)}return Ut}var ao=Cp(!0),jp=Cp(!1),Na=Qs(null),Ta=null,lo=null,Hc=null;function Vc(){Hc=lo=Ta=null}function Kc(t){var s=Na.current;Ct(Na),t._currentValue=s}function Gc(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function co(t,s){Ta=t,Hc=lo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(In=!0),t.firstContext=null)}function Xn(t){var s=t._currentValue;if(Hc!==t)if(t={context:t,memoizedValue:s,next:null},lo===null){if(Ta===null)throw Error(r(308));lo=t,Ta.dependencies={lanes:0,firstContext:t}}else lo=lo.next=t;return s}var _r=null;function qc(t){_r===null?_r=[t]:_r.push(t)}function Ep(t,s,i,u){var p=s.interleaved;return p===null?(i.next=i,qc(s)):(i.next=p.next,p.next=i),s.interleaved=i,Os(t,u)}function Os(t,s){t.lanes|=s;var i=t.alternate;for(i!==null&&(i.lanes|=s),i=t,t=t.return;t!==null;)t.childLanes|=s,i=t.alternate,i!==null&&(i.childLanes|=s),i=t,t=t.return;return i.tag===3?i.stateNode:null}var er=!1;function Xc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _p(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function $s(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function tr(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(rt&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,Os(t,i)}return p=u.interleaved,p===null?(s.next=s,qc(u)):(s.next=p.next,p.next=s),u.interleaved=s,Os(t,i)}function Ca(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194240)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Ks(t,i)}}function Rp(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?p=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?p=g=s:g=g.next=s}else p=g=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:u.shared,effects:u.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}function ja(t,s,i,u){var p=t.updateQueue;er=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var D=_,V=D.next;D.next=null,w===null?g=V:w.next=V,w=D;var re=t.alternate;re!==null&&(re=re.updateQueue,_=re.lastBaseUpdate,_!==w&&(_===null?re.firstBaseUpdate=V:_.next=V,re.lastBaseUpdate=D))}if(g!==null){var ie=p.baseState;w=0,re=V=D=null,_=g;do{var se=_.lane,Ne=_.eventTime;if((u&se)===se){re!==null&&(re=re.next={eventTime:Ne,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var _e=t,Ie=_;switch(se=s,Ne=i,Ie.tag){case 1:if(_e=Ie.payload,typeof _e=="function"){ie=_e.call(Ne,ie,se);break e}ie=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ie.payload,se=typeof _e=="function"?_e.call(Ne,ie,se):_e,se==null)break e;ie=K({},ie,se);break e;case 2:er=!0}}_.callback!==null&&_.lane!==0&&(t.flags|=64,se=p.effects,se===null?p.effects=[_]:se.push(_))}else Ne={eventTime:Ne,lane:se,tag:_.tag,payload:_.payload,callback:_.callback,next:null},re===null?(V=re=Ne,D=ie):re=re.next=Ne,w|=se;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;se=_,_=se.next,se.next=null,p.lastBaseUpdate=se,p.shared.pending=null}}while(!0);if(re===null&&(D=ie),p.baseState=D,p.firstBaseUpdate=V,p.lastBaseUpdate=re,s=p.shared.interleaved,s!==null){p=s;do w|=p.lane,p=p.next;while(p!==s)}else g===null&&(p.shared.lanes=0);Ir|=w,t.lanes=w,t.memoizedState=ie}}function Ap(t,s,i){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var u=t[s],p=u.callback;if(p!==null){if(u.callback=null,u=i,typeof p!="function")throw Error(r(191,p));p.call(u)}}}var si={},Ts=Qs(si),ri=Qs(si),oi=Qs(si);function Rr(t){if(t===si)throw Error(r(174));return t}function Yc(t,s){switch(wt(oi,s),wt(ri,t),wt(Ts,si),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:vt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=vt(s,t)}Ct(Ts),wt(Ts,s)}function uo(){Ct(Ts),Ct(ri),Ct(oi)}function Ip(t){Rr(oi.current);var s=Rr(Ts.current),i=vt(s,t.type);s!==i&&(wt(ri,t),wt(Ts,i))}function Qc(t){ri.current===t&&(Ct(Ts),Ct(ri))}var Mt=Qs(0);function Ea(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.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===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Zc=[];function Jc(){for(var t=0;t<Zc.length;t++)Zc[t]._workInProgressVersionPrimary=null;Zc.length=0}var _a=L.ReactCurrentDispatcher,eu=L.ReactCurrentBatchConfig,Ar=0,Lt=null,Yt=null,en=null,Ra=!1,ii=!1,ai=0,pw=0;function hn(){throw Error(r(321))}function tu(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!os(t[i],s[i]))return!1;return!0}function nu(t,s,i,u,p,g){if(Ar=g,Lt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,_a.current=t===null||t.memoizedState===null?vw:yw,t=i(u,p),ii){g=0;do{if(ii=!1,ai=0,25<=g)throw Error(r(301));g+=1,en=Yt=null,s.updateQueue=null,_a.current=xw,t=i(u,p)}while(ii)}if(_a.current=Da,s=Yt!==null&&Yt.next!==null,Ar=0,en=Yt=Lt=null,Ra=!1,s)throw Error(r(300));return t}function su(){var t=ai!==0;return ai=0,t}function Cs(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Lt.memoizedState=en=t:en=en.next=t,en}function Yn(){if(Yt===null){var t=Lt.alternate;t=t!==null?t.memoizedState:null}else t=Yt.next;var s=en===null?Lt.memoizedState:en.next;if(s!==null)en=s,Yt=t;else{if(t===null)throw Error(r(310));Yt=t,t={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},en===null?Lt.memoizedState=en=t:en=en.next=t}return en}function li(t,s){return typeof s=="function"?s(t):s}function ru(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=Yt,p=u.baseQueue,g=i.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}u.baseQueue=p=g,i.pending=null}if(p!==null){g=p.next,u=u.baseState;var _=w=null,D=null,V=g;do{var re=V.lane;if((Ar&re)===re)D!==null&&(D=D.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),u=V.hasEagerState?V.eagerState:t(u,V.action);else{var ie={lane:re,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};D===null?(_=D=ie,w=u):D=D.next=ie,Lt.lanes|=re,Ir|=re}V=V.next}while(V!==null&&V!==g);D===null?w=u:D.next=_,os(u,s.memoizedState)||(In=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=D,i.lastRenderedState=u}if(t=i.interleaved,t!==null){p=t;do g=p.lane,Lt.lanes|=g,Ir|=g,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[s.memoizedState,i.dispatch]}function ou(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,g=s.memoizedState;if(p!==null){i.pending=null;var w=p=p.next;do g=t(g,w.action),w=w.next;while(w!==p);os(g,s.memoizedState)||(In=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),i.lastRenderedState=g}return[g,u]}function Dp(){}function Mp(t,s){var i=Lt,u=Yn(),p=s(),g=!os(u.memoizedState,p);if(g&&(u.memoizedState=p,In=!0),u=u.queue,iu($p.bind(null,i,u,t),[t]),u.getSnapshot!==s||g||en!==null&&en.memoizedState.tag&1){if(i.flags|=2048,ci(9,Op.bind(null,i,u,p,s),void 0,null),tn===null)throw Error(r(349));(Ar&30)!==0||Lp(i,s,p)}return p}function Lp(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=Lt.updateQueue,s===null?(s={lastEffect:null,stores:null},Lt.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Op(t,s,i,u){s.value=i,s.getSnapshot=u,Pp(s)&&zp(t)}function $p(t,s,i){return i(function(){Pp(s)&&zp(t)})}function Pp(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!os(t,i)}catch{return!0}}function zp(t){var s=Os(t,1);s!==null&&us(s,t,1,-1)}function Fp(t){var s=Cs();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:t},s.queue=t,t=t.dispatch=gw.bind(null,Lt,t),[s.memoizedState,t]}function ci(t,s,i,u){return t={tag:t,create:s,destroy:i,deps:u,next:null},s=Lt.updateQueue,s===null?(s={lastEffect:null,stores:null},Lt.updateQueue=s,s.lastEffect=t.next=t):(i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t)),t}function Up(){return Yn().memoizedState}function Aa(t,s,i,u){var p=Cs();Lt.flags|=t,p.memoizedState=ci(1|s,i,void 0,u===void 0?null:u)}function Ia(t,s,i,u){var p=Yn();u=u===void 0?null:u;var g=void 0;if(Yt!==null){var w=Yt.memoizedState;if(g=w.destroy,u!==null&&tu(u,w.deps)){p.memoizedState=ci(s,i,g,u);return}}Lt.flags|=t,p.memoizedState=ci(1|s,i,g,u)}function Bp(t,s){return Aa(8390656,8,t,s)}function iu(t,s){return Ia(2048,8,t,s)}function Wp(t,s){return Ia(4,2,t,s)}function Hp(t,s){return Ia(4,4,t,s)}function Vp(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Kp(t,s,i){return i=i!=null?i.concat([t]):null,Ia(4,4,Vp.bind(null,s,t),i)}function au(){}function Gp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&tu(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function qp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&tu(s,u[1])?u[0]:(t=t(),i.memoizedState=[t,s],t)}function Xp(t,s,i){return(Ar&21)===0?(t.baseState&&(t.baseState=!1,In=!0),t.memoizedState=i):(os(i,s)||(i=zo(),Lt.lanes|=i,Ir|=i,t.baseState=!0),s)}function hw(t,s){var i=nt;nt=i!==0&&4>i?i:4,t(!0);var u=eu.transition;eu.transition={};try{t(!1),s()}finally{nt=i,eu.transition=u}}function Yp(){return Yn().memoizedState}function mw(t,s,i){var u=or(t);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},Qp(t))Zp(s,i);else if(i=Ep(t,s,i,u),i!==null){var p=Nn();us(i,t,u,p),Jp(i,s,u)}}function gw(t,s,i){var u=or(t),p={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(Qp(t))Zp(s,p);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var w=s.lastRenderedState,_=g(w,i);if(p.hasEagerState=!0,p.eagerState=_,os(_,w)){var D=s.interleaved;D===null?(p.next=p,qc(s)):(p.next=D.next,D.next=p),s.interleaved=p;return}}catch{}finally{}i=Ep(t,s,p,u),i!==null&&(p=Nn(),us(i,t,u,p),Jp(i,s,u))}}function Qp(t){var s=t.alternate;return t===Lt||s!==null&&s===Lt}function Zp(t,s){ii=Ra=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function Jp(t,s,i){if((i&4194240)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Ks(t,i)}}var Da={readContext:Xn,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},vw={readContext:Xn,useCallback:function(t,s){return Cs().memoizedState=[t,s===void 0?null:s],t},useContext:Xn,useEffect:Bp,useImperativeHandle:function(t,s,i){return i=i!=null?i.concat([t]):null,Aa(4194308,4,Vp.bind(null,s,t),i)},useLayoutEffect:function(t,s){return Aa(4194308,4,t,s)},useInsertionEffect:function(t,s){return Aa(4,2,t,s)},useMemo:function(t,s){var i=Cs();return s=s===void 0?null:s,t=t(),i.memoizedState=[t,s],t},useReducer:function(t,s,i){var u=Cs();return s=i!==void 0?i(s):s,u.memoizedState=u.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},u.queue=t,t=t.dispatch=mw.bind(null,Lt,t),[u.memoizedState,t]},useRef:function(t){var s=Cs();return t={current:t},s.memoizedState=t},useState:Fp,useDebugValue:au,useDeferredValue:function(t){return Cs().memoizedState=t},useTransition:function(){var t=Fp(!1),s=t[0];return t=hw.bind(null,t[1]),Cs().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,i){var u=Lt,p=Cs();if(_t){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),tn===null)throw Error(r(349));(Ar&30)!==0||Lp(u,s,i)}p.memoizedState=i;var g={value:i,getSnapshot:s};return p.queue=g,Bp($p.bind(null,u,g,t),[t]),u.flags|=2048,ci(9,Op.bind(null,u,g,i,s),void 0,null),i},useId:function(){var t=Cs(),s=tn.identifierPrefix;if(_t){var i=Ls,u=Ms;i=(u&~(1<<32-kn(u)-1)).toString(32)+i,s=":"+s+"R"+i,i=ai++,0<i&&(s+="H"+i.toString(32)),s+=":"}else i=pw++,s=":"+s+"r"+i.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},yw={readContext:Xn,useCallback:Gp,useContext:Xn,useEffect:iu,useImperativeHandle:Kp,useInsertionEffect:Wp,useLayoutEffect:Hp,useMemo:qp,useReducer:ru,useRef:Up,useState:function(){return ru(li)},useDebugValue:au,useDeferredValue:function(t){var s=Yn();return Xp(s,Yt.memoizedState,t)},useTransition:function(){var t=ru(li)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Dp,useSyncExternalStore:Mp,useId:Yp,unstable_isNewReconciler:!1},xw={readContext:Xn,useCallback:Gp,useContext:Xn,useEffect:iu,useImperativeHandle:Kp,useInsertionEffect:Wp,useLayoutEffect:Hp,useMemo:qp,useReducer:ou,useRef:Up,useState:function(){return ou(li)},useDebugValue:au,useDeferredValue:function(t){var s=Yn();return Yt===null?s.memoizedState=t:Xp(s,Yt.memoizedState,t)},useTransition:function(){var t=ou(li)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Dp,useSyncExternalStore:Mp,useId:Yp,unstable_isNewReconciler:!1};function as(t,s){if(t&&t.defaultProps){s=K({},s),t=t.defaultProps;for(var i in t)s[i]===void 0&&(s[i]=t[i]);return s}return s}function lu(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:K({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Ma={isMounted:function(t){return(t=t._reactInternals)?Ke(t)===t:!1},enqueueSetState:function(t,s,i){t=t._reactInternals;var u=Nn(),p=or(t),g=$s(u,p);g.payload=s,i!=null&&(g.callback=i),s=tr(t,g,p),s!==null&&(us(s,t,p,u),Ca(s,t,p))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=Nn(),p=or(t),g=$s(u,p);g.tag=1,g.payload=s,i!=null&&(g.callback=i),s=tr(t,g,p),s!==null&&(us(s,t,p,u),Ca(s,t,p))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=Nn(),u=or(t),p=$s(i,u);p.tag=2,s!=null&&(p.callback=s),s=tr(t,p,u),s!==null&&(us(s,t,u,i),Ca(s,t,u))}};function eh(t,s,i,u,p,g,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,g,w):s.prototype&&s.prototype.isPureReactComponent?!Xo(i,u)||!Xo(p,g):!0}function th(t,s,i){var u=!1,p=Zs,g=s.contextType;return typeof g=="object"&&g!==null?g=Xn(g):(p=An(s)?Cr:pn.current,u=s.contextTypes,g=(u=u!=null)?so(t,p):Zs),s=new s(i,g),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ma,t.stateNode=s,s._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=g),s}function nh(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&Ma.enqueueReplaceState(s,s.state,null)}function cu(t,s,i,u){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},Xc(t);var g=s.contextType;typeof g=="object"&&g!==null?p.context=Xn(g):(g=An(s)?Cr:pn.current,p.context=so(t,g)),p.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(lu(t,s,g,i),p.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(s=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),s!==p.state&&Ma.enqueueReplaceState(p,p.state,null),ja(t,i,p,u),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function fo(t,s){try{var i="",u=s;do i+=ue(u),u=u.return;while(u);var p=i}catch(g){p=`
38
+ `+p[w].replace(" at new "," at ");return t.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",t.displayName)),D}while(1<=w&&0<=_);break}}}finally{de=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?M(t):""}function ue(t){switch(t.tag){case 5:return M(t.type);case 16:return M("Lazy");case 13:return M("Suspense");case 19:return M("SuspenseList");case 0:case 2:case 15:return t=U(t.type,!1),t;case 11:return t=U(t.type.render,!1),t;case 1:return t=U(t.type,!0),t;default:return""}}function X(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case F:return"Fragment";case q:return"Portal";case Q:return"Profiler";case O:return"StrictMode";case ke:return"Suspense";case Le:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case te:return(t.displayName||"Context")+".Consumer";case J:return(t._context.displayName||"Context")+".Provider";case me:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Te:return s=t.displayName||null,s!==null?s:X(t.type)||"Memo";case oe:s=t._payload,t=t._init;try{return X(t(s))}catch{}}return null}function ve(t){var s=t.type;switch(t.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 t=s.render,t=t.displayName||t.name||"",s.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return X(s);case 8:return s===O?"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 xe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ae(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Ce(t){var s=Ae(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,s),u=""+t[s];if(!t.hasOwnProperty(s)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,g=i.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return p.call(this)},set:function(w){u=""+w,g.call(this,w)}}),Object.defineProperty(t,s,{enumerable:i.enumerable}),{getValue:function(){return u},setValue:function(w){u=""+w},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function ge(t){t._valueTracker||(t._valueTracker=Ce(t))}function le(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var i=s.getValue(),u="";return t&&(u=Ae(t)?t.checked?"true":"false":t.value),t=u,t!==i?(s.setValue(t),!0):!1}function Qe(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ee(t,s){var i=s.checked;return K({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function et(t,s){var i=s.defaultValue==null?"":s.defaultValue,u=s.checked!=null?s.checked:s.defaultChecked;i=xe(s.value!=null?s.value:i),t._wrapperState={initialChecked:u,initialValue:i,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function He(t,s){s=s.checked,s!=null&&P(t,"checked",s,!1)}function Se(t,s){He(t,s);var i=xe(s.value),u=s.type;if(i!=null)u==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}s.hasOwnProperty("value")?Xe(t,s.type,i):s.hasOwnProperty("defaultValue")&&Xe(t,s.type,xe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(t.defaultChecked=!!s.defaultChecked)}function Be(t,s,i){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=""+t._wrapperState.initialValue,i||s===t.value||(t.value=s),t.defaultValue=s}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Xe(t,s,i){(s!=="number"||Qe(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var at=Array.isArray;function kt(t,s,i,u){if(t=t.options,s){s={};for(var p=0;p<i.length;p++)s["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=s.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&u&&(t[i].defaultSelected=!0)}else{for(i=""+xe(i),s=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}s!==null||t[p].disabled||(s=t[p])}s!==null&&(s.selected=!0)}}function Ot(t,s){if(s.dangerouslySetInnerHTML!=null)throw Error(r(91));return K({},s,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function G(t,s){var i=s.value;if(i==null){if(i=s.children,s=s.defaultValue,i!=null){if(s!=null)throw Error(r(92));if(at(i)){if(1<i.length)throw Error(r(93));i=i[0]}s=i}s==null&&(s=""),i=s}t._wrapperState={initialValue:xe(i)}}function we(t,s){var i=xe(s.value),u=xe(s.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),s.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),u!=null&&(t.defaultValue=""+u)}function ze(t){var s=t.textContent;s===t._wrapperState.initialValue&&s!==""&&s!==null&&(t.value=s)}function Ye(t){switch(t){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 yt(t,s){return t==null||t==="http://www.w3.org/1999/xhtml"?Ye(s):t==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var xt,Z=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,i,u,p){MSApp.execUnsafeLocalFunction(function(){return t(s,i,u,p)})}:t})(function(t,s){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=s;else{for(xt=xt||document.createElement("div"),xt.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=xt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;s.firstChild;)t.appendChild(s.firstChild)}});function Pe(t,s){if(s){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=s;return}}t.textContent=s}var qe={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},St=["Webkit","ms","Moz","O"];Object.keys(qe).forEach(function(t){St.forEach(function(s){s=s+t.charAt(0).toUpperCase()+t.substring(1),qe[s]=qe[t]})});function yn(t,s,i){return s==null||typeof s=="boolean"||s===""?"":i||typeof s!="number"||s===0||qe.hasOwnProperty(t)&&qe[t]?(""+s).trim():s+"px"}function xn(t,s){t=t.style;for(var i in s)if(s.hasOwnProperty(i)){var u=i.indexOf("--")===0,p=yn(i,s[i],u);i==="float"&&(i="cssFloat"),u?t.setProperty(i,p):t[i]=p}}var ns=K({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 ss(t,s){if(s){if(ns[t]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,t));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 rs(t,s){if(t.indexOf("-")===-1)return typeof s.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wn=null;function fn(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Wt=null,_n=null,ft=null;function bt(t){if(t=ti(t)){if(typeof Wt!="function")throw Error(r(280));var s=t.stateNode;s&&(s=ga(s),Wt(t.stateNode,t.type,s))}}function Rt(t){_n?ft?ft.push(t):ft=[t]:_n=t}function Kt(){if(_n){var t=_n,s=ft;if(ft=_n=null,bt(t),s)for(t=0;t<s.length;t++)bt(s[t])}}function Et(t,s){return t(s)}function Nt(){}var mt=!1;function Gt(t,s,i){if(mt)return t(s,i);mt=!0;try{return Et(t,s,i)}finally{mt=!1,(_n!==null||ft!==null)&&(Nt(),Kt())}}function pt(t,s){var i=t.stateNode;if(i===null)return null;var u=ga(i);if(u===null)return null;i=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)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,s,typeof i));return i}var Jt=!1;if(f)try{var $t={};Object.defineProperty($t,"passive",{get:function(){Jt=!0}}),window.addEventListener("test",$t,$t),window.removeEventListener("test",$t,$t)}catch{Jt=!1}function I(t,s,i,u,p,g,w,_,D){var V=Array.prototype.slice.call(arguments,3);try{s.apply(i,V)}catch(re){this.onError(re)}}var he=!1,ce=null,be=!1,We=null,tt={onError:function(t){he=!0,ce=t}};function Ve(t,s,i,u,p,g,w,_,D){he=!1,ce=null,I.apply(tt,arguments)}function qt(t,s,i,u,p,g,w,_,D){if(Ve.apply(this,arguments),he){if(he){var V=ce;he=!1,ce=null}else throw Error(r(198));be||(be=!0,We=V)}}function Ke(t){var s=t,i=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(i=s.return),t=s.return;while(t)}return s.tag===3?i:null}function Xt(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function ys(t){if(Ke(t)!==t)throw Error(r(188))}function Rs(t){var s=t.alternate;if(!s){if(s=Ke(t),s===null)throw Error(r(188));return s!==t?null:t}for(var i=t,u=s;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(u=p.return,u!==null){i=u;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return ys(p),t;if(g===u)return ys(p),s;g=g.sibling}throw Error(r(188))}if(i.return!==u.return)i=p,u=g;else{for(var w=!1,_=p.child;_;){if(_===i){w=!0,i=p,u=g;break}if(_===u){w=!0,u=p,i=g;break}_=_.sibling}if(!w){for(_=g.child;_;){if(_===i){w=!0,i=g,u=p;break}if(_===u){w=!0,u=g,i=p;break}_=_.sibling}if(!w)throw Error(r(189))}}if(i.alternate!==u)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:s}function xs(t){return t=Rs(t),t!==null?Kn(t):null}function Kn(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var s=Kn(t);if(s!==null)return s;t=t.sibling}return null}var ws=n.unstable_scheduleCallback,lt=n.unstable_cancelCallback,zt=n.unstable_shouldYield,ks=n.unstable_requestPaint,At=n.unstable_now,Ss=n.unstable_getCurrentPriorityLevel,Hs=n.unstable_ImmediatePriority,bs=n.unstable_UserBlockingPriority,Hr=n.unstable_NormalPriority,xr=n.unstable_LowPriority,Zi=n.unstable_IdlePriority,wr=null,$n=null;function Vr(t){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(wr,t,void 0,(t.current.flags&128)===128)}catch{}}var kn=Math.clz32?Math.clz32:kr,Kr=Math.log,Vs=Math.LN2;function kr(t){return t>>>=0,t===0?32:31-(Kr(t)/Vs|0)|0}var Sn=64,Gr=4194304;function Sr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function br(t,s){var i=t.pendingLanes;if(i===0)return 0;var u=0,p=t.suspendedLanes,g=t.pingedLanes,w=i&268435455;if(w!==0){var _=w&~p;_!==0?u=Sr(_):(g&=w,g!==0&&(u=Sr(g)))}else w=i&~p,w!==0?u=Sr(w):g!==0&&(u=Sr(g));if(u===0)return 0;if(s!==0&&s!==u&&(s&p)===0&&(p=u&-u,g=s&-s,p>=g||p===16&&(g&4194240)!==0))return s;if((u&4)!==0&&(u|=i&16),s=t.entangledLanes,s!==0)for(t=t.entanglements,s&=u;0<s;)i=31-kn(s),p=1<<i,u|=t[i],s&=~p;return u}function Ji(t,s){switch(t){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 ea(t,s){for(var i=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,g=t.pendingLanes;0<g;){var w=31-kn(g),_=1<<w,D=p[w];D===-1?((_&i)===0||(_&u)!==0)&&(p[w]=Ji(_,s)):D<=s&&(t.expiredLanes|=_),g&=~_}}function Po(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function zo(){var t=Sn;return Sn<<=1,(Sn&4194240)===0&&(Sn=64),t}function Fo(t){for(var s=[],i=0;31>i;i++)s.push(t);return s}function Nr(t,s,i){t.pendingLanes|=s,s!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,s=31-kn(s),t[s]=i}function ta(t,s){var i=t.pendingLanes&~s;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=s,t.mutableReadLanes&=s,t.entangledLanes&=s,s=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-kn(i),g=1<<p;s[p]=0,u[p]=-1,t[p]=-1,i&=~g}}function Ks(t,s){var i=t.entangledLanes|=s;for(t=t.entanglements;i;){var u=31-kn(i),p=1<<u;p&s|t[u]&s&&(t[u]|=s),i&=~p}}var nt=0;function fe(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var C,B,ne,Re,Me,Ue=!1,st=[],ot=null,It=null,Dt=null,As=new Map,Ft=new Map,Gs=[],vx="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 Af(t,s){switch(t){case"focusin":case"focusout":ot=null;break;case"dragenter":case"dragleave":It=null;break;case"mouseover":case"mouseout":Dt=null;break;case"pointerover":case"pointerout":As.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ft.delete(s.pointerId)}}function Uo(t,s,i,u,p,g){return t===null||t.nativeEvent!==g?(t={blockedOn:s,domEventName:i,eventSystemFlags:u,nativeEvent:g,targetContainers:[p]},s!==null&&(s=ti(s),s!==null&&B(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),t)}function yx(t,s,i,u,p){switch(s){case"focusin":return ot=Uo(ot,t,s,i,u,p),!0;case"dragenter":return It=Uo(It,t,s,i,u,p),!0;case"mouseover":return Dt=Uo(Dt,t,s,i,u,p),!0;case"pointerover":var g=p.pointerId;return As.set(g,Uo(As.get(g)||null,t,s,i,u,p)),!0;case"gotpointercapture":return g=p.pointerId,Ft.set(g,Uo(Ft.get(g)||null,t,s,i,u,p)),!0}return!1}function If(t){var s=Tr(t.target);if(s!==null){var i=Ke(s);if(i!==null){if(s=i.tag,s===13){if(s=Xt(i),s!==null){t.blockedOn=s,Me(t.priority,function(){ne(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function na(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var i=pc(t.domEventName,t.eventSystemFlags,s[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);wn=u,i.target.dispatchEvent(u),wn=null}else return s=ti(i),s!==null&&B(s),t.blockedOn=i,!1;s.shift()}return!0}function Df(t,s,i){na(t)&&i.delete(s)}function xx(){Ue=!1,ot!==null&&na(ot)&&(ot=null),It!==null&&na(It)&&(It=null),Dt!==null&&na(Dt)&&(Dt=null),As.forEach(Df),Ft.forEach(Df)}function Bo(t,s){t.blockedOn===s&&(t.blockedOn=null,Ue||(Ue=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,xx)))}function Wo(t){function s(p){return Bo(p,t)}if(0<st.length){Bo(st[0],t);for(var i=1;i<st.length;i++){var u=st[i];u.blockedOn===t&&(u.blockedOn=null)}}for(ot!==null&&Bo(ot,t),It!==null&&Bo(It,t),Dt!==null&&Bo(Dt,t),As.forEach(s),Ft.forEach(s),i=0;i<Gs.length;i++)u=Gs[i],u.blockedOn===t&&(u.blockedOn=null);for(;0<Gs.length&&(i=Gs[0],i.blockedOn===null);)If(i),i.blockedOn===null&&Gs.shift()}var qr=L.ReactCurrentBatchConfig,sa=!0;function wx(t,s,i,u){var p=nt,g=qr.transition;qr.transition=null;try{nt=1,fc(t,s,i,u)}finally{nt=p,qr.transition=g}}function kx(t,s,i,u){var p=nt,g=qr.transition;qr.transition=null;try{nt=4,fc(t,s,i,u)}finally{nt=p,qr.transition=g}}function fc(t,s,i,u){if(sa){var p=pc(t,s,i,u);if(p===null)Rc(t,s,u,ra,i),Af(t,u);else if(yx(p,t,s,i,u))u.stopPropagation();else if(Af(t,u),s&4&&-1<vx.indexOf(t)){for(;p!==null;){var g=ti(p);if(g!==null&&C(g),g=pc(t,s,i,u),g===null&&Rc(t,s,u,ra,i),g===p)break;p=g}p!==null&&u.stopPropagation()}else Rc(t,s,u,null,i)}}var ra=null;function pc(t,s,i,u){if(ra=null,t=fn(u),t=Tr(t),t!==null)if(s=Ke(t),s===null)t=null;else if(i=s.tag,i===13){if(t=Xt(s),t!==null)return t;t=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null);return ra=t,null}function Mf(t){switch(t){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(Ss()){case Hs:return 1;case bs:return 4;case Hr:case xr:return 16;case Zi:return 536870912;default:return 16}default:return 16}}var qs=null,hc=null,oa=null;function Lf(){if(oa)return oa;var t,s=hc,i=s.length,u,p="value"in qs?qs.value:qs.textContent,g=p.length;for(t=0;t<i&&s[t]===p[t];t++);var w=i-t;for(u=1;u<=w&&s[i-u]===p[g-u];u++);return oa=p.slice(t,1<u?1-u:void 0)}function ia(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function aa(){return!0}function Of(){return!1}function Pn(t){function s(i,u,p,g,w){this._reactName=i,this._targetInst=p,this.type=u,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?aa:Of,this.isPropagationStopped=Of,this}return K(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=aa)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=aa)},persist:function(){},isPersistent:aa}),s}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mc=Pn(Xr),Ho=K({},Xr,{view:0,detail:0}),Sx=Pn(Ho),gc,vc,Vo,la=K({},Ho,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Vo&&(Vo&&t.type==="mousemove"?(gc=t.screenX-Vo.screenX,vc=t.screenY-Vo.screenY):vc=gc=0,Vo=t),gc)},movementY:function(t){return"movementY"in t?t.movementY:vc}}),$f=Pn(la),bx=K({},la,{dataTransfer:0}),Nx=Pn(bx),Tx=K({},Ho,{relatedTarget:0}),yc=Pn(Tx),Cx=K({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),jx=Pn(Cx),Ex=K({},Xr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),_x=Pn(Ex),Rx=K({},Xr,{data:0}),Pf=Pn(Rx),Ax={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ix={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"},Dx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mx(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=Dx[t])?!!s[t]:!1}function xc(){return Mx}var Lx=K({},Ho,{key:function(t){if(t.key){var s=Ax[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=ia(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ix[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xc,charCode:function(t){return t.type==="keypress"?ia(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ia(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Ox=Pn(Lx),$x=K({},la,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zf=Pn($x),Px=K({},Ho,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xc}),zx=Pn(Px),Fx=K({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ux=Pn(Fx),Bx=K({},la,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Wx=Pn(Bx),Hx=[9,13,27,32],wc=f&&"CompositionEvent"in window,Ko=null;f&&"documentMode"in document&&(Ko=document.documentMode);var Vx=f&&"TextEvent"in window&&!Ko,Ff=f&&(!wc||Ko&&8<Ko&&11>=Ko),Uf=" ",Bf=!1;function Wf(t,s){switch(t){case"keyup":return Hx.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Yr=!1;function Kx(t,s){switch(t){case"compositionend":return Hf(s);case"keypress":return s.which!==32?null:(Bf=!0,Uf);case"textInput":return t=s.data,t===Uf&&Bf?null:t;default:return null}}function Gx(t,s){if(Yr)return t==="compositionend"||!wc&&Wf(t,s)?(t=Lf(),oa=hc=qs=null,Yr=!1,t):null;switch(t){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 Ff&&s.locale!=="ko"?null:s.data;default:return null}}var qx={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 Vf(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!qx[t.type]:s==="textarea"}function Kf(t,s,i,u){Rt(u),s=pa(s,"onChange"),0<s.length&&(i=new mc("onChange","change",null,i,u),t.push({event:i,listeners:s}))}var Go=null,qo=null;function Xx(t){up(t,0)}function ca(t){var s=to(t);if(le(s))return t}function Yx(t,s){if(t==="change")return s}var Gf=!1;if(f){var kc;if(f){var Sc="oninput"in document;if(!Sc){var qf=document.createElement("div");qf.setAttribute("oninput","return;"),Sc=typeof qf.oninput=="function"}kc=Sc}else kc=!1;Gf=kc&&(!document.documentMode||9<document.documentMode)}function Xf(){Go&&(Go.detachEvent("onpropertychange",Yf),qo=Go=null)}function Yf(t){if(t.propertyName==="value"&&ca(qo)){var s=[];Kf(s,qo,t,fn(t)),Gt(Xx,s)}}function Qx(t,s,i){t==="focusin"?(Xf(),Go=s,qo=i,Go.attachEvent("onpropertychange",Yf)):t==="focusout"&&Xf()}function Zx(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ca(qo)}function Jx(t,s){if(t==="click")return ca(s)}function ew(t,s){if(t==="input"||t==="change")return ca(s)}function tw(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var os=typeof Object.is=="function"?Object.is:tw;function Xo(t,s){if(os(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var i=Object.keys(t),u=Object.keys(s);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var p=i[u];if(!h.call(s,p)||!os(t[p],s[p]))return!1}return!0}function Qf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Zf(t,s){var i=Qf(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=s&&u>=s)return{node:i,offset:s-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Qf(i)}}function Jf(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Jf(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function ep(){for(var t=window,s=Qe();s instanceof t.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)t=s.contentWindow;else break;s=Qe(t.document)}return s}function bc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}function nw(t){var s=ep(),i=t.focusedElem,u=t.selectionRange;if(s!==i&&i&&i.ownerDocument&&Jf(i.ownerDocument.documentElement,i)){if(u!==null&&bc(i)){if(s=u.start,t=u.end,t===void 0&&(t=s),"selectionStart"in i)i.selectionStart=s,i.selectionEnd=Math.min(t,i.value.length);else if(t=(s=i.ownerDocument||document)&&s.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,g=Math.min(u.start,p);u=u.end===void 0?g:Math.min(u.end,p),!t.extend&&g>u&&(p=u,u=g,g=p),p=Zf(i,g);var w=Zf(i,u);p&&w&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==w.node||t.focusOffset!==w.offset)&&(s=s.createRange(),s.setStart(p.node,p.offset),t.removeAllRanges(),g>u?(t.addRange(s),t.extend(w.node,w.offset)):(s.setEnd(w.node,w.offset),t.addRange(s)))}}for(s=[],t=i;t=t.parentNode;)t.nodeType===1&&s.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<s.length;i++)t=s[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var sw=f&&"documentMode"in document&&11>=document.documentMode,Qr=null,Nc=null,Yo=null,Tc=!1;function tp(t,s,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Tc||Qr==null||Qr!==Qe(u)||(u=Qr,"selectionStart"in u&&bc(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}),Yo&&Xo(Yo,u)||(Yo=u,u=pa(Nc,"onSelect"),0<u.length&&(s=new mc("onSelect","select",null,s,i),t.push({event:s,listeners:u}),s.target=Qr)))}function ua(t,s){var i={};return i[t.toLowerCase()]=s.toLowerCase(),i["Webkit"+t]="webkit"+s,i["Moz"+t]="moz"+s,i}var Zr={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},Cc={},np={};f&&(np=document.createElement("div").style,"AnimationEvent"in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),"TransitionEvent"in window||delete Zr.transitionend.transition);function da(t){if(Cc[t])return Cc[t];if(!Zr[t])return t;var s=Zr[t],i;for(i in s)if(s.hasOwnProperty(i)&&i in np)return Cc[t]=s[i];return t}var sp=da("animationend"),rp=da("animationiteration"),op=da("animationstart"),ip=da("transitionend"),ap=new Map,lp="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 Xs(t,s){ap.set(t,s),c(s,[t])}for(var jc=0;jc<lp.length;jc++){var Ec=lp[jc],rw=Ec.toLowerCase(),ow=Ec[0].toUpperCase()+Ec.slice(1);Xs(rw,"on"+ow)}Xs(sp,"onAnimationEnd"),Xs(rp,"onAnimationIteration"),Xs(op,"onAnimationStart"),Xs("dblclick","onDoubleClick"),Xs("focusin","onFocus"),Xs("focusout","onBlur"),Xs(ip,"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 Qo="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(" "),iw=new Set("cancel close invalid load scroll toggle".split(" ").concat(Qo));function cp(t,s,i){var u=t.type||"unknown-event";t.currentTarget=i,qt(u,s,void 0,t),t.currentTarget=null}function up(t,s){s=(s&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],p=u.event;u=u.listeners;e:{var g=void 0;if(s)for(var w=u.length-1;0<=w;w--){var _=u[w],D=_.instance,V=_.currentTarget;if(_=_.listener,D!==g&&p.isPropagationStopped())break e;cp(p,_,V),g=D}else for(w=0;w<u.length;w++){if(_=u[w],D=_.instance,V=_.currentTarget,_=_.listener,D!==g&&p.isPropagationStopped())break e;cp(p,_,V),g=D}}}if(be)throw t=We,be=!1,We=null,t}function Tt(t,s){var i=s[Oc];i===void 0&&(i=s[Oc]=new Set);var u=t+"__bubble";i.has(u)||(dp(s,t,2,!1),i.add(u))}function _c(t,s,i){var u=0;s&&(u|=4),dp(i,t,u,s)}var fa="_reactListening"+Math.random().toString(36).slice(2);function Zo(t){if(!t[fa]){t[fa]=!0,o.forEach(function(i){i!=="selectionchange"&&(iw.has(i)||_c(i,!1,t),_c(i,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[fa]||(s[fa]=!0,_c("selectionchange",!1,s))}}function dp(t,s,i,u){switch(Mf(s)){case 1:var p=wx;break;case 4:p=kx;break;default:p=fc}i=p.bind(null,s,i,t),p=void 0,!Jt||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(s,i,{capture:!0,passive:p}):t.addEventListener(s,i,!0):p!==void 0?t.addEventListener(s,i,{passive:p}):t.addEventListener(s,i,!1)}function Rc(t,s,i,u,p){var g=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 _=u.stateNode.containerInfo;if(_===p||_.nodeType===8&&_.parentNode===p)break;if(w===4)for(w=u.return;w!==null;){var D=w.tag;if((D===3||D===4)&&(D=w.stateNode.containerInfo,D===p||D.nodeType===8&&D.parentNode===p))return;w=w.return}for(;_!==null;){if(w=Tr(_),w===null)return;if(D=w.tag,D===5||D===6){u=g=w;continue e}_=_.parentNode}}u=u.return}Gt(function(){var V=g,re=fn(i),ie=[];e:{var se=ap.get(t);if(se!==void 0){var Ne=mc,_e=t;switch(t){case"keypress":if(ia(i)===0)break e;case"keydown":case"keyup":Ne=Ox;break;case"focusin":_e="focus",Ne=yc;break;case"focusout":_e="blur",Ne=yc;break;case"beforeblur":case"afterblur":Ne=yc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=$f;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=Nx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=zx;break;case sp:case rp:case op:Ne=jx;break;case ip:Ne=Ux;break;case"scroll":Ne=Sx;break;case"wheel":Ne=Wx;break;case"copy":case"cut":case"paste":Ne=_x;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=zf}var Ie=(s&4)!==0,Ut=!Ie&&t==="scroll",W=Ie?se!==null?se+"Capture":null:se;Ie=[];for(var $=V,H;$!==null;){H=$;var pe=H.stateNode;if(H.tag===5&&pe!==null&&(H=pe,W!==null&&(pe=pt($,W),pe!=null&&Ie.push(Jo($,pe,H)))),Ut)break;$=$.return}0<Ie.length&&(se=new Ne(se,_e,null,i,re),ie.push({event:se,listeners:Ie}))}}if((s&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",Ne=t==="mouseout"||t==="pointerout",se&&i!==wn&&(_e=i.relatedTarget||i.fromElement)&&(Tr(_e)||_e[Is]))break e;if((Ne||se)&&(se=re.window===re?re:(se=re.ownerDocument)?se.defaultView||se.parentWindow:window,Ne?(_e=i.relatedTarget||i.toElement,Ne=V,_e=_e?Tr(_e):null,_e!==null&&(Ut=Ke(_e),_e!==Ut||_e.tag!==5&&_e.tag!==6)&&(_e=null)):(Ne=null,_e=V),Ne!==_e)){if(Ie=$f,pe="onMouseLeave",W="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=zf,pe="onPointerLeave",W="onPointerEnter",$="pointer"),Ut=Ne==null?se:to(Ne),H=_e==null?se:to(_e),se=new Ie(pe,$+"leave",Ne,i,re),se.target=Ut,se.relatedTarget=H,pe=null,Tr(re)===V&&(Ie=new Ie(W,$+"enter",_e,i,re),Ie.target=H,Ie.relatedTarget=Ut,pe=Ie),Ut=pe,Ne&&_e)t:{for(Ie=Ne,W=_e,$=0,H=Ie;H;H=Jr(H))$++;for(H=0,pe=W;pe;pe=Jr(pe))H++;for(;0<$-H;)Ie=Jr(Ie),$--;for(;0<H-$;)W=Jr(W),H--;for(;$--;){if(Ie===W||W!==null&&Ie===W.alternate)break t;Ie=Jr(Ie),W=Jr(W)}Ie=null}else Ie=null;Ne!==null&&fp(ie,se,Ne,Ie,!1),_e!==null&&Ut!==null&&fp(ie,Ut,_e,Ie,!0)}}e:{if(se=V?to(V):window,Ne=se.nodeName&&se.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&se.type==="file")var De=Yx;else if(Vf(se))if(Gf)De=ew;else{De=Zx;var Oe=Qx}else(Ne=se.nodeName)&&Ne.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(De=Jx);if(De&&(De=De(t,V))){Kf(ie,De,i,re);break e}Oe&&Oe(t,se,V),t==="focusout"&&(Oe=se._wrapperState)&&Oe.controlled&&se.type==="number"&&Xe(se,"number",se.value)}switch(Oe=V?to(V):window,t){case"focusin":(Vf(Oe)||Oe.contentEditable==="true")&&(Qr=Oe,Nc=V,Yo=null);break;case"focusout":Yo=Nc=Qr=null;break;case"mousedown":Tc=!0;break;case"contextmenu":case"mouseup":case"dragend":Tc=!1,tp(ie,i,re);break;case"selectionchange":if(sw)break;case"keydown":case"keyup":tp(ie,i,re)}var $e;if(wc)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Yr?Wf(t,i)&&(Fe="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(Fe="onCompositionStart");Fe&&(Ff&&i.locale!=="ko"&&(Yr||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Yr&&($e=Lf()):(qs=re,hc="value"in qs?qs.value:qs.textContent,Yr=!0)),Oe=pa(V,Fe),0<Oe.length&&(Fe=new Pf(Fe,t,null,i,re),ie.push({event:Fe,listeners:Oe}),$e?Fe.data=$e:($e=Hf(i),$e!==null&&(Fe.data=$e)))),($e=Vx?Kx(t,i):Gx(t,i))&&(V=pa(V,"onBeforeInput"),0<V.length&&(re=new Pf("onBeforeInput","beforeinput",null,i,re),ie.push({event:re,listeners:V}),re.data=$e))}up(ie,s)})}function Jo(t,s,i){return{instance:t,listener:s,currentTarget:i}}function pa(t,s){for(var i=s+"Capture",u=[];t!==null;){var p=t,g=p.stateNode;p.tag===5&&g!==null&&(p=g,g=pt(t,i),g!=null&&u.unshift(Jo(t,g,p)),g=pt(t,s),g!=null&&u.push(Jo(t,g,p))),t=t.return}return u}function Jr(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function fp(t,s,i,u,p){for(var g=s._reactName,w=[];i!==null&&i!==u;){var _=i,D=_.alternate,V=_.stateNode;if(D!==null&&D===u)break;_.tag===5&&V!==null&&(_=V,p?(D=pt(i,g),D!=null&&w.unshift(Jo(i,D,_))):p||(D=pt(i,g),D!=null&&w.push(Jo(i,D,_)))),i=i.return}w.length!==0&&t.push({event:s,listeners:w})}var aw=/\r\n?/g,lw=/\u0000|\uFFFD/g;function pp(t){return(typeof t=="string"?t:""+t).replace(aw,`
39
+ `).replace(lw,"")}function ha(t,s,i){if(s=pp(s),pp(t)!==s&&i)throw Error(r(425))}function ma(){}var Ac=null,Ic=null;function Dc(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Mc=typeof setTimeout=="function"?setTimeout:void 0,cw=typeof clearTimeout=="function"?clearTimeout:void 0,hp=typeof Promise=="function"?Promise:void 0,uw=typeof queueMicrotask=="function"?queueMicrotask:typeof hp<"u"?function(t){return hp.resolve(null).then(t).catch(dw)}:Mc;function dw(t){setTimeout(function(){throw t})}function Lc(t,s){var i=s,u=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(u===0){t.removeChild(p),Wo(s);return}u--}else i!=="$"&&i!=="$?"&&i!=="$!"||u++;i=p}while(i);Wo(s)}function Ys(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return t}function mp(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(s===0)return t;s--}else i==="/$"&&s++}t=t.previousSibling}return null}var eo=Math.random().toString(36).slice(2),Ns="__reactFiber$"+eo,ei="__reactProps$"+eo,Is="__reactContainer$"+eo,Oc="__reactEvents$"+eo,fw="__reactListeners$"+eo,pw="__reactHandles$"+eo;function Tr(t){var s=t[Ns];if(s)return s;for(var i=t.parentNode;i;){if(s=i[Is]||i[Ns]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(t=mp(t);t!==null;){if(i=t[Ns])return i;t=mp(t)}return s}t=i,i=t.parentNode}return null}function ti(t){return t=t[Ns]||t[Is],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function to(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ga(t){return t[ei]||null}var $c=[],no=-1;function Qs(t){return{current:t}}function Ct(t){0>no||(t.current=$c[no],$c[no]=null,no--)}function wt(t,s){no++,$c[no]=t.current,t.current=s}var Zs={},pn=Qs(Zs),Rn=Qs(!1),Cr=Zs;function so(t,s){var i=t.type.contextTypes;if(!i)return Zs;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===s)return u.__reactInternalMemoizedMaskedChildContext;var p={},g;for(g in i)p[g]=s[g];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=p),p}function An(t){return t=t.childContextTypes,t!=null}function va(){Ct(Rn),Ct(pn)}function gp(t,s,i){if(pn.current!==Zs)throw Error(r(168));wt(pn,s),wt(Rn,i)}function vp(t,s,i){var u=t.stateNode;if(s=s.childContextTypes,typeof u.getChildContext!="function")return i;u=u.getChildContext();for(var p in u)if(!(p in s))throw Error(r(108,ve(t)||"Unknown",p));return K({},i,u)}function ya(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Zs,Cr=pn.current,wt(pn,t),wt(Rn,Rn.current),!0}function yp(t,s,i){var u=t.stateNode;if(!u)throw Error(r(169));i?(t=vp(t,s,Cr),u.__reactInternalMemoizedMergedChildContext=t,Ct(Rn),Ct(pn),wt(pn,t)):Ct(Rn),wt(Rn,i)}var Ds=null,xa=!1,Pc=!1;function xp(t){Ds===null?Ds=[t]:Ds.push(t)}function hw(t){xa=!0,xp(t)}function Js(){if(!Pc&&Ds!==null){Pc=!0;var t=0,s=nt;try{var i=Ds;for(nt=1;t<i.length;t++){var u=i[t];do u=u(!0);while(u!==null)}Ds=null,xa=!1}catch(p){throw Ds!==null&&(Ds=Ds.slice(t+1)),ws(Hs,Js),p}finally{nt=s,Pc=!1}}return null}var ro=[],oo=0,wa=null,ka=0,Gn=[],qn=0,jr=null,Ms=1,Ls="";function Er(t,s){ro[oo++]=ka,ro[oo++]=wa,wa=t,ka=s}function wp(t,s,i){Gn[qn++]=Ms,Gn[qn++]=Ls,Gn[qn++]=jr,jr=t;var u=Ms;t=Ls;var p=32-kn(u)-1;u&=~(1<<p),i+=1;var g=32-kn(s)+p;if(30<g){var w=p-p%5;g=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Ms=1<<32-kn(s)+p|i<<p|u,Ls=g+t}else Ms=1<<g|i<<p|u,Ls=t}function zc(t){t.return!==null&&(Er(t,1),wp(t,1,0))}function Fc(t){for(;t===wa;)wa=ro[--oo],ro[oo]=null,ka=ro[--oo],ro[oo]=null;for(;t===jr;)jr=Gn[--qn],Gn[qn]=null,Ls=Gn[--qn],Gn[qn]=null,Ms=Gn[--qn],Gn[qn]=null}var zn=null,Fn=null,_t=!1,is=null;function kp(t,s){var i=Zn(5,null,null,0);i.elementType="DELETED",i.stateNode=s,i.return=t,s=t.deletions,s===null?(t.deletions=[i],t.flags|=16):s.push(i)}function Sp(t,s){switch(t.tag){case 5:var i=t.type;return s=s.nodeType!==1||i.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(t.stateNode=s,zn=t,Fn=Ys(s.firstChild),!0):!1;case 6:return s=t.pendingProps===""||s.nodeType!==3?null:s,s!==null?(t.stateNode=s,zn=t,Fn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(i=jr!==null?{id:Ms,overflow:Ls}:null,t.memoizedState={dehydrated:s,treeContext:i,retryLane:1073741824},i=Zn(18,null,null,0),i.stateNode=s,i.return=t,t.child=i,zn=t,Fn=null,!0):!1;default:return!1}}function Uc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Bc(t){if(_t){var s=Fn;if(s){var i=s;if(!Sp(t,s)){if(Uc(t))throw Error(r(418));s=Ys(i.nextSibling);var u=zn;s&&Sp(t,s)?kp(u,i):(t.flags=t.flags&-4097|2,_t=!1,zn=t)}}else{if(Uc(t))throw Error(r(418));t.flags=t.flags&-4097|2,_t=!1,zn=t}}}function bp(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;zn=t}function Sa(t){if(t!==zn)return!1;if(!_t)return bp(t),_t=!0,!1;var s;if((s=t.tag!==3)&&!(s=t.tag!==5)&&(s=t.type,s=s!=="head"&&s!=="body"&&!Dc(t.type,t.memoizedProps)),s&&(s=Fn)){if(Uc(t))throw Np(),Error(r(418));for(;s;)kp(t,s),s=Ys(s.nextSibling)}if(bp(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,s=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(s===0){Fn=Ys(t.nextSibling);break e}s--}else i!=="$"&&i!=="$!"&&i!=="$?"||s++}t=t.nextSibling}Fn=null}}else Fn=zn?Ys(t.stateNode.nextSibling):null;return!0}function Np(){for(var t=Fn;t;)t=Ys(t.nextSibling)}function io(){Fn=zn=null,_t=!1}function Wc(t){is===null?is=[t]:is.push(t)}var mw=L.ReactCurrentBatchConfig;function ni(t,s,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var u=i.stateNode}if(!u)throw Error(r(147,t));var p=u,g=""+t;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===g?s.ref:(s=function(w){var _=p.refs;w===null?delete _[g]:_[g]=w},s._stringRef=g,s)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function ba(t,s){throw t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t))}function Tp(t){var s=t._init;return s(t._payload)}function Cp(t){function s(W,$){if(t){var H=W.deletions;H===null?(W.deletions=[$],W.flags|=16):H.push($)}}function i(W,$){if(!t)return null;for(;$!==null;)s(W,$),$=$.sibling;return null}function u(W,$){for(W=new Map;$!==null;)$.key!==null?W.set($.key,$):W.set($.index,$),$=$.sibling;return W}function p(W,$){return W=ar(W,$),W.index=0,W.sibling=null,W}function g(W,$,H){return W.index=H,t?(H=W.alternate,H!==null?(H=H.index,H<$?(W.flags|=2,$):H):(W.flags|=2,$)):(W.flags|=1048576,$)}function w(W){return t&&W.alternate===null&&(W.flags|=2),W}function _(W,$,H,pe){return $===null||$.tag!==6?($=Mu(H,W.mode,pe),$.return=W,$):($=p($,H),$.return=W,$)}function D(W,$,H,pe){var De=H.type;return De===F?re(W,$,H.props.children,pe,H.key):$!==null&&($.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===oe&&Tp(De)===$.type)?(pe=p($,H.props),pe.ref=ni(W,$,H),pe.return=W,pe):(pe=Ga(H.type,H.key,H.props,null,W.mode,pe),pe.ref=ni(W,$,H),pe.return=W,pe)}function V(W,$,H,pe){return $===null||$.tag!==4||$.stateNode.containerInfo!==H.containerInfo||$.stateNode.implementation!==H.implementation?($=Lu(H,W.mode,pe),$.return=W,$):($=p($,H.children||[]),$.return=W,$)}function re(W,$,H,pe,De){return $===null||$.tag!==7?($=Or(H,W.mode,pe,De),$.return=W,$):($=p($,H),$.return=W,$)}function ie(W,$,H){if(typeof $=="string"&&$!==""||typeof $=="number")return $=Mu(""+$,W.mode,H),$.return=W,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case z:return H=Ga($.type,$.key,$.props,null,W.mode,H),H.ref=ni(W,null,$),H.return=W,H;case q:return $=Lu($,W.mode,H),$.return=W,$;case oe:var pe=$._init;return ie(W,pe($._payload),H)}if(at($)||ae($))return $=Or($,W.mode,H,null),$.return=W,$;ba(W,$)}return null}function se(W,$,H,pe){var De=$!==null?$.key:null;if(typeof H=="string"&&H!==""||typeof H=="number")return De!==null?null:_(W,$,""+H,pe);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case z:return H.key===De?D(W,$,H,pe):null;case q:return H.key===De?V(W,$,H,pe):null;case oe:return De=H._init,se(W,$,De(H._payload),pe)}if(at(H)||ae(H))return De!==null?null:re(W,$,H,pe,null);ba(W,H)}return null}function Ne(W,$,H,pe,De){if(typeof pe=="string"&&pe!==""||typeof pe=="number")return W=W.get(H)||null,_($,W,""+pe,De);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case z:return W=W.get(pe.key===null?H:pe.key)||null,D($,W,pe,De);case q:return W=W.get(pe.key===null?H:pe.key)||null,V($,W,pe,De);case oe:var Oe=pe._init;return Ne(W,$,H,Oe(pe._payload),De)}if(at(pe)||ae(pe))return W=W.get(H)||null,re($,W,pe,De,null);ba($,pe)}return null}function _e(W,$,H,pe){for(var De=null,Oe=null,$e=$,Fe=$=0,nn=null;$e!==null&&Fe<H.length;Fe++){$e.index>Fe?(nn=$e,$e=null):nn=$e.sibling;var it=se(W,$e,H[Fe],pe);if(it===null){$e===null&&($e=nn);break}t&&$e&&it.alternate===null&&s(W,$e),$=g(it,$,Fe),Oe===null?De=it:Oe.sibling=it,Oe=it,$e=nn}if(Fe===H.length)return i(W,$e),_t&&Er(W,Fe),De;if($e===null){for(;Fe<H.length;Fe++)$e=ie(W,H[Fe],pe),$e!==null&&($=g($e,$,Fe),Oe===null?De=$e:Oe.sibling=$e,Oe=$e);return _t&&Er(W,Fe),De}for($e=u(W,$e);Fe<H.length;Fe++)nn=Ne($e,W,Fe,H[Fe],pe),nn!==null&&(t&&nn.alternate!==null&&$e.delete(nn.key===null?Fe:nn.key),$=g(nn,$,Fe),Oe===null?De=nn:Oe.sibling=nn,Oe=nn);return t&&$e.forEach(function(lr){return s(W,lr)}),_t&&Er(W,Fe),De}function Ie(W,$,H,pe){var De=ae(H);if(typeof De!="function")throw Error(r(150));if(H=De.call(H),H==null)throw Error(r(151));for(var Oe=De=null,$e=$,Fe=$=0,nn=null,it=H.next();$e!==null&&!it.done;Fe++,it=H.next()){$e.index>Fe?(nn=$e,$e=null):nn=$e.sibling;var lr=se(W,$e,it.value,pe);if(lr===null){$e===null&&($e=nn);break}t&&$e&&lr.alternate===null&&s(W,$e),$=g(lr,$,Fe),Oe===null?De=lr:Oe.sibling=lr,Oe=lr,$e=nn}if(it.done)return i(W,$e),_t&&Er(W,Fe),De;if($e===null){for(;!it.done;Fe++,it=H.next())it=ie(W,it.value,pe),it!==null&&($=g(it,$,Fe),Oe===null?De=it:Oe.sibling=it,Oe=it);return _t&&Er(W,Fe),De}for($e=u(W,$e);!it.done;Fe++,it=H.next())it=Ne($e,W,Fe,it.value,pe),it!==null&&(t&&it.alternate!==null&&$e.delete(it.key===null?Fe:it.key),$=g(it,$,Fe),Oe===null?De=it:Oe.sibling=it,Oe=it);return t&&$e.forEach(function(qw){return s(W,qw)}),_t&&Er(W,Fe),De}function Ut(W,$,H,pe){if(typeof H=="object"&&H!==null&&H.type===F&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case z:e:{for(var De=H.key,Oe=$;Oe!==null;){if(Oe.key===De){if(De=H.type,De===F){if(Oe.tag===7){i(W,Oe.sibling),$=p(Oe,H.props.children),$.return=W,W=$;break e}}else if(Oe.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===oe&&Tp(De)===Oe.type){i(W,Oe.sibling),$=p(Oe,H.props),$.ref=ni(W,Oe,H),$.return=W,W=$;break e}i(W,Oe);break}else s(W,Oe);Oe=Oe.sibling}H.type===F?($=Or(H.props.children,W.mode,pe,H.key),$.return=W,W=$):(pe=Ga(H.type,H.key,H.props,null,W.mode,pe),pe.ref=ni(W,$,H),pe.return=W,W=pe)}return w(W);case q:e:{for(Oe=H.key;$!==null;){if($.key===Oe)if($.tag===4&&$.stateNode.containerInfo===H.containerInfo&&$.stateNode.implementation===H.implementation){i(W,$.sibling),$=p($,H.children||[]),$.return=W,W=$;break e}else{i(W,$);break}else s(W,$);$=$.sibling}$=Lu(H,W.mode,pe),$.return=W,W=$}return w(W);case oe:return Oe=H._init,Ut(W,$,Oe(H._payload),pe)}if(at(H))return _e(W,$,H,pe);if(ae(H))return Ie(W,$,H,pe);ba(W,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,$!==null&&$.tag===6?(i(W,$.sibling),$=p($,H),$.return=W,W=$):(i(W,$),$=Mu(H,W.mode,pe),$.return=W,W=$),w(W)):i(W,$)}return Ut}var ao=Cp(!0),jp=Cp(!1),Na=Qs(null),Ta=null,lo=null,Hc=null;function Vc(){Hc=lo=Ta=null}function Kc(t){var s=Na.current;Ct(Na),t._currentValue=s}function Gc(t,s,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===i)break;t=t.return}}function co(t,s){Ta=t,Hc=lo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&s)!==0&&(In=!0),t.firstContext=null)}function Xn(t){var s=t._currentValue;if(Hc!==t)if(t={context:t,memoizedValue:s,next:null},lo===null){if(Ta===null)throw Error(r(308));lo=t,Ta.dependencies={lanes:0,firstContext:t}}else lo=lo.next=t;return s}var _r=null;function qc(t){_r===null?_r=[t]:_r.push(t)}function Ep(t,s,i,u){var p=s.interleaved;return p===null?(i.next=i,qc(s)):(i.next=p.next,p.next=i),s.interleaved=i,Os(t,u)}function Os(t,s){t.lanes|=s;var i=t.alternate;for(i!==null&&(i.lanes|=s),i=t,t=t.return;t!==null;)t.childLanes|=s,i=t.alternate,i!==null&&(i.childLanes|=s),i=t,t=t.return;return i.tag===3?i.stateNode:null}var er=!1;function Xc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _p(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function $s(t,s){return{eventTime:t,lane:s,tag:0,payload:null,callback:null,next:null}}function tr(t,s,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(rt&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,Os(t,i)}return p=u.interleaved,p===null?(s.next=s,qc(u)):(s.next=p.next,p.next=s),u.interleaved=s,Os(t,i)}function Ca(t,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194240)!==0)){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Ks(t,i)}}function Rp(t,s){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?p=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?p=g=s:g=g.next=s}else p=g=s;i={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:u.shared,effects:u.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=s:t.next=s,i.lastBaseUpdate=s}function ja(t,s,i,u){var p=t.updateQueue;er=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var D=_,V=D.next;D.next=null,w===null?g=V:w.next=V,w=D;var re=t.alternate;re!==null&&(re=re.updateQueue,_=re.lastBaseUpdate,_!==w&&(_===null?re.firstBaseUpdate=V:_.next=V,re.lastBaseUpdate=D))}if(g!==null){var ie=p.baseState;w=0,re=V=D=null,_=g;do{var se=_.lane,Ne=_.eventTime;if((u&se)===se){re!==null&&(re=re.next={eventTime:Ne,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var _e=t,Ie=_;switch(se=s,Ne=i,Ie.tag){case 1:if(_e=Ie.payload,typeof _e=="function"){ie=_e.call(Ne,ie,se);break e}ie=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ie.payload,se=typeof _e=="function"?_e.call(Ne,ie,se):_e,se==null)break e;ie=K({},ie,se);break e;case 2:er=!0}}_.callback!==null&&_.lane!==0&&(t.flags|=64,se=p.effects,se===null?p.effects=[_]:se.push(_))}else Ne={eventTime:Ne,lane:se,tag:_.tag,payload:_.payload,callback:_.callback,next:null},re===null?(V=re=Ne,D=ie):re=re.next=Ne,w|=se;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;se=_,_=se.next,se.next=null,p.lastBaseUpdate=se,p.shared.pending=null}}while(!0);if(re===null&&(D=ie),p.baseState=D,p.firstBaseUpdate=V,p.lastBaseUpdate=re,s=p.shared.interleaved,s!==null){p=s;do w|=p.lane,p=p.next;while(p!==s)}else g===null&&(p.shared.lanes=0);Ir|=w,t.lanes=w,t.memoizedState=ie}}function Ap(t,s,i){if(t=s.effects,s.effects=null,t!==null)for(s=0;s<t.length;s++){var u=t[s],p=u.callback;if(p!==null){if(u.callback=null,u=i,typeof p!="function")throw Error(r(191,p));p.call(u)}}}var si={},Ts=Qs(si),ri=Qs(si),oi=Qs(si);function Rr(t){if(t===si)throw Error(r(174));return t}function Yc(t,s){switch(wt(oi,s),wt(ri,t),wt(Ts,si),t=s.nodeType,t){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:yt(null,"");break;default:t=t===8?s.parentNode:s,s=t.namespaceURI||null,t=t.tagName,s=yt(s,t)}Ct(Ts),wt(Ts,s)}function uo(){Ct(Ts),Ct(ri),Ct(oi)}function Ip(t){Rr(oi.current);var s=Rr(Ts.current),i=yt(s,t.type);s!==i&&(wt(ri,t),wt(Ts,i))}function Qc(t){ri.current===t&&(Ct(Ts),Ct(ri))}var Mt=Qs(0);function Ea(t){for(var s=t;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.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===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Zc=[];function Jc(){for(var t=0;t<Zc.length;t++)Zc[t]._workInProgressVersionPrimary=null;Zc.length=0}var _a=L.ReactCurrentDispatcher,eu=L.ReactCurrentBatchConfig,Ar=0,Lt=null,Yt=null,en=null,Ra=!1,ii=!1,ai=0,gw=0;function hn(){throw Error(r(321))}function tu(t,s){if(s===null)return!1;for(var i=0;i<s.length&&i<t.length;i++)if(!os(t[i],s[i]))return!1;return!0}function nu(t,s,i,u,p,g){if(Ar=g,Lt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,_a.current=t===null||t.memoizedState===null?ww:kw,t=i(u,p),ii){g=0;do{if(ii=!1,ai=0,25<=g)throw Error(r(301));g+=1,en=Yt=null,s.updateQueue=null,_a.current=Sw,t=i(u,p)}while(ii)}if(_a.current=Da,s=Yt!==null&&Yt.next!==null,Ar=0,en=Yt=Lt=null,Ra=!1,s)throw Error(r(300));return t}function su(){var t=ai!==0;return ai=0,t}function Cs(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?Lt.memoizedState=en=t:en=en.next=t,en}function Yn(){if(Yt===null){var t=Lt.alternate;t=t!==null?t.memoizedState:null}else t=Yt.next;var s=en===null?Lt.memoizedState:en.next;if(s!==null)en=s,Yt=t;else{if(t===null)throw Error(r(310));Yt=t,t={memoizedState:Yt.memoizedState,baseState:Yt.baseState,baseQueue:Yt.baseQueue,queue:Yt.queue,next:null},en===null?Lt.memoizedState=en=t:en=en.next=t}return en}function li(t,s){return typeof s=="function"?s(t):s}function ru(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=Yt,p=u.baseQueue,g=i.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}u.baseQueue=p=g,i.pending=null}if(p!==null){g=p.next,u=u.baseState;var _=w=null,D=null,V=g;do{var re=V.lane;if((Ar&re)===re)D!==null&&(D=D.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),u=V.hasEagerState?V.eagerState:t(u,V.action);else{var ie={lane:re,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};D===null?(_=D=ie,w=u):D=D.next=ie,Lt.lanes|=re,Ir|=re}V=V.next}while(V!==null&&V!==g);D===null?w=u:D.next=_,os(u,s.memoizedState)||(In=!0),s.memoizedState=u,s.baseState=w,s.baseQueue=D,i.lastRenderedState=u}if(t=i.interleaved,t!==null){p=t;do g=p.lane,Lt.lanes|=g,Ir|=g,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[s.memoizedState,i.dispatch]}function ou(t){var s=Yn(),i=s.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var u=i.dispatch,p=i.pending,g=s.memoizedState;if(p!==null){i.pending=null;var w=p=p.next;do g=t(g,w.action),w=w.next;while(w!==p);os(g,s.memoizedState)||(In=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),i.lastRenderedState=g}return[g,u]}function Dp(){}function Mp(t,s){var i=Lt,u=Yn(),p=s(),g=!os(u.memoizedState,p);if(g&&(u.memoizedState=p,In=!0),u=u.queue,iu($p.bind(null,i,u,t),[t]),u.getSnapshot!==s||g||en!==null&&en.memoizedState.tag&1){if(i.flags|=2048,ci(9,Op.bind(null,i,u,p,s),void 0,null),tn===null)throw Error(r(349));(Ar&30)!==0||Lp(i,s,p)}return p}function Lp(t,s,i){t.flags|=16384,t={getSnapshot:s,value:i},s=Lt.updateQueue,s===null?(s={lastEffect:null,stores:null},Lt.updateQueue=s,s.stores=[t]):(i=s.stores,i===null?s.stores=[t]:i.push(t))}function Op(t,s,i,u){s.value=i,s.getSnapshot=u,Pp(s)&&zp(t)}function $p(t,s,i){return i(function(){Pp(s)&&zp(t)})}function Pp(t){var s=t.getSnapshot;t=t.value;try{var i=s();return!os(t,i)}catch{return!0}}function zp(t){var s=Os(t,1);s!==null&&us(s,t,1,-1)}function Fp(t){var s=Cs();return typeof t=="function"&&(t=t()),s.memoizedState=s.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:t},s.queue=t,t=t.dispatch=xw.bind(null,Lt,t),[s.memoizedState,t]}function ci(t,s,i,u){return t={tag:t,create:s,destroy:i,deps:u,next:null},s=Lt.updateQueue,s===null?(s={lastEffect:null,stores:null},Lt.updateQueue=s,s.lastEffect=t.next=t):(i=s.lastEffect,i===null?s.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,s.lastEffect=t)),t}function Up(){return Yn().memoizedState}function Aa(t,s,i,u){var p=Cs();Lt.flags|=t,p.memoizedState=ci(1|s,i,void 0,u===void 0?null:u)}function Ia(t,s,i,u){var p=Yn();u=u===void 0?null:u;var g=void 0;if(Yt!==null){var w=Yt.memoizedState;if(g=w.destroy,u!==null&&tu(u,w.deps)){p.memoizedState=ci(s,i,g,u);return}}Lt.flags|=t,p.memoizedState=ci(1|s,i,g,u)}function Bp(t,s){return Aa(8390656,8,t,s)}function iu(t,s){return Ia(2048,8,t,s)}function Wp(t,s){return Ia(4,2,t,s)}function Hp(t,s){return Ia(4,4,t,s)}function Vp(t,s){if(typeof s=="function")return t=t(),s(t),function(){s(null)};if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Kp(t,s,i){return i=i!=null?i.concat([t]):null,Ia(4,4,Vp.bind(null,s,t),i)}function au(){}function Gp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&tu(s,u[1])?u[0]:(i.memoizedState=[t,s],t)}function qp(t,s){var i=Yn();s=s===void 0?null:s;var u=i.memoizedState;return u!==null&&s!==null&&tu(s,u[1])?u[0]:(t=t(),i.memoizedState=[t,s],t)}function Xp(t,s,i){return(Ar&21)===0?(t.baseState&&(t.baseState=!1,In=!0),t.memoizedState=i):(os(i,s)||(i=zo(),Lt.lanes|=i,Ir|=i,t.baseState=!0),s)}function vw(t,s){var i=nt;nt=i!==0&&4>i?i:4,t(!0);var u=eu.transition;eu.transition={};try{t(!1),s()}finally{nt=i,eu.transition=u}}function Yp(){return Yn().memoizedState}function yw(t,s,i){var u=or(t);if(i={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null},Qp(t))Zp(s,i);else if(i=Ep(t,s,i,u),i!==null){var p=Nn();us(i,t,u,p),Jp(i,s,u)}}function xw(t,s,i){var u=or(t),p={lane:u,action:i,hasEagerState:!1,eagerState:null,next:null};if(Qp(t))Zp(s,p);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var w=s.lastRenderedState,_=g(w,i);if(p.hasEagerState=!0,p.eagerState=_,os(_,w)){var D=s.interleaved;D===null?(p.next=p,qc(s)):(p.next=D.next,D.next=p),s.interleaved=p;return}}catch{}finally{}i=Ep(t,s,p,u),i!==null&&(p=Nn(),us(i,t,u,p),Jp(i,s,u))}}function Qp(t){var s=t.alternate;return t===Lt||s!==null&&s===Lt}function Zp(t,s){ii=Ra=!0;var i=t.pending;i===null?s.next=s:(s.next=i.next,i.next=s),t.pending=s}function Jp(t,s,i){if((i&4194240)!==0){var u=s.lanes;u&=t.pendingLanes,i|=u,s.lanes=i,Ks(t,i)}}var Da={readContext:Xn,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},ww={readContext:Xn,useCallback:function(t,s){return Cs().memoizedState=[t,s===void 0?null:s],t},useContext:Xn,useEffect:Bp,useImperativeHandle:function(t,s,i){return i=i!=null?i.concat([t]):null,Aa(4194308,4,Vp.bind(null,s,t),i)},useLayoutEffect:function(t,s){return Aa(4194308,4,t,s)},useInsertionEffect:function(t,s){return Aa(4,2,t,s)},useMemo:function(t,s){var i=Cs();return s=s===void 0?null:s,t=t(),i.memoizedState=[t,s],t},useReducer:function(t,s,i){var u=Cs();return s=i!==void 0?i(s):s,u.memoizedState=u.baseState=s,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:s},u.queue=t,t=t.dispatch=yw.bind(null,Lt,t),[u.memoizedState,t]},useRef:function(t){var s=Cs();return t={current:t},s.memoizedState=t},useState:Fp,useDebugValue:au,useDeferredValue:function(t){return Cs().memoizedState=t},useTransition:function(){var t=Fp(!1),s=t[0];return t=vw.bind(null,t[1]),Cs().memoizedState=t,[s,t]},useMutableSource:function(){},useSyncExternalStore:function(t,s,i){var u=Lt,p=Cs();if(_t){if(i===void 0)throw Error(r(407));i=i()}else{if(i=s(),tn===null)throw Error(r(349));(Ar&30)!==0||Lp(u,s,i)}p.memoizedState=i;var g={value:i,getSnapshot:s};return p.queue=g,Bp($p.bind(null,u,g,t),[t]),u.flags|=2048,ci(9,Op.bind(null,u,g,i,s),void 0,null),i},useId:function(){var t=Cs(),s=tn.identifierPrefix;if(_t){var i=Ls,u=Ms;i=(u&~(1<<32-kn(u)-1)).toString(32)+i,s=":"+s+"R"+i,i=ai++,0<i&&(s+="H"+i.toString(32)),s+=":"}else i=gw++,s=":"+s+"r"+i.toString(32)+":";return t.memoizedState=s},unstable_isNewReconciler:!1},kw={readContext:Xn,useCallback:Gp,useContext:Xn,useEffect:iu,useImperativeHandle:Kp,useInsertionEffect:Wp,useLayoutEffect:Hp,useMemo:qp,useReducer:ru,useRef:Up,useState:function(){return ru(li)},useDebugValue:au,useDeferredValue:function(t){var s=Yn();return Xp(s,Yt.memoizedState,t)},useTransition:function(){var t=ru(li)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Dp,useSyncExternalStore:Mp,useId:Yp,unstable_isNewReconciler:!1},Sw={readContext:Xn,useCallback:Gp,useContext:Xn,useEffect:iu,useImperativeHandle:Kp,useInsertionEffect:Wp,useLayoutEffect:Hp,useMemo:qp,useReducer:ou,useRef:Up,useState:function(){return ou(li)},useDebugValue:au,useDeferredValue:function(t){var s=Yn();return Yt===null?s.memoizedState=t:Xp(s,Yt.memoizedState,t)},useTransition:function(){var t=ou(li)[0],s=Yn().memoizedState;return[t,s]},useMutableSource:Dp,useSyncExternalStore:Mp,useId:Yp,unstable_isNewReconciler:!1};function as(t,s){if(t&&t.defaultProps){s=K({},s),t=t.defaultProps;for(var i in t)s[i]===void 0&&(s[i]=t[i]);return s}return s}function lu(t,s,i,u){s=t.memoizedState,i=i(u,s),i=i==null?s:K({},s,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Ma={isMounted:function(t){return(t=t._reactInternals)?Ke(t)===t:!1},enqueueSetState:function(t,s,i){t=t._reactInternals;var u=Nn(),p=or(t),g=$s(u,p);g.payload=s,i!=null&&(g.callback=i),s=tr(t,g,p),s!==null&&(us(s,t,p,u),Ca(s,t,p))},enqueueReplaceState:function(t,s,i){t=t._reactInternals;var u=Nn(),p=or(t),g=$s(u,p);g.tag=1,g.payload=s,i!=null&&(g.callback=i),s=tr(t,g,p),s!==null&&(us(s,t,p,u),Ca(s,t,p))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var i=Nn(),u=or(t),p=$s(i,u);p.tag=2,s!=null&&(p.callback=s),s=tr(t,p,u),s!==null&&(us(s,t,u,i),Ca(s,t,u))}};function eh(t,s,i,u,p,g,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,g,w):s.prototype&&s.prototype.isPureReactComponent?!Xo(i,u)||!Xo(p,g):!0}function th(t,s,i){var u=!1,p=Zs,g=s.contextType;return typeof g=="object"&&g!==null?g=Xn(g):(p=An(s)?Cr:pn.current,u=s.contextTypes,g=(u=u!=null)?so(t,p):Zs),s=new s(i,g),t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Ma,t.stateNode=s,s._reactInternals=t,u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=g),s}function nh(t,s,i,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,u),s.state!==t&&Ma.enqueueReplaceState(s,s.state,null)}function cu(t,s,i,u){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},Xc(t);var g=s.contextType;typeof g=="object"&&g!==null?p.context=Xn(g):(g=An(s)?Cr:pn.current,p.context=so(t,g)),p.state=t.memoizedState,g=s.getDerivedStateFromProps,typeof g=="function"&&(lu(t,s,g,i),p.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(s=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),s!==p.state&&Ma.enqueueReplaceState(p,p.state,null),ja(t,i,p,u),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function fo(t,s){try{var i="",u=s;do i+=ue(u),u=u.return;while(u);var p=i}catch(g){p=`
40
40
  Error generating stack: `+g.message+`
41
- `+g.stack}return{value:t,source:s,stack:p,digest:null}}function uu(t,s,i){return{value:t,source:null,stack:i??null,digest:s??null}}function du(t,s){try{console.error(s.value)}catch(i){setTimeout(function(){throw i})}}var ww=typeof WeakMap=="function"?WeakMap:Map;function sh(t,s,i){i=$s(-1,i),i.tag=3,i.payload={element:null};var u=s.value;return i.callback=function(){Ua||(Ua=!0,Cu=u),du(t,s)},i}function rh(t,s,i){i=$s(-1,i),i.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var p=s.value;i.payload=function(){return u(p)},i.callback=function(){du(t,s)}}var g=t.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){du(t,s),typeof u!="function"&&(sr===null?sr=new Set([this]):sr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),i}function oh(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new ww;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(p.add(i),t=Mw.bind(null,t,s,i),s.then(t,t))}function ih(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function ah(t,s,i,u,p){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(s=$s(-1,1),s.tag=2,tr(i,s,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var kw=L.ReactCurrentOwner,In=!1;function bn(t,s,i,u){s.child=t===null?jp(s,null,i,u):ao(s,t.child,i,u)}function lh(t,s,i,u,p){i=i.render;var g=s.ref;return co(s,p),u=nu(t,s,i,u,g,p),i=su(),t!==null&&!In?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Ps(t,s,p)):(_t&&i&&zc(s),s.flags|=1,bn(t,s,u,p),s.child)}function ch(t,s,i,u,p){if(t===null){var g=i.type;return typeof g=="function"&&!Du(g)&&g.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(s.tag=15,s.type=g,uh(t,s,g,u,p)):(t=Ga(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(g=t.child,(t.lanes&p)===0){var w=g.memoizedProps;if(i=i.compare,i=i!==null?i:Xo,i(w,u)&&t.ref===s.ref)return Ps(t,s,p)}return s.flags|=1,t=ar(g,u),t.ref=s.ref,t.return=s,s.child=t}function uh(t,s,i,u,p){if(t!==null){var g=t.memoizedProps;if(Xo(g,u)&&t.ref===s.ref)if(In=!1,s.pendingProps=u=g,(t.lanes&p)!==0)(t.flags&131072)!==0&&(In=!0);else return s.lanes=t.lanes,Ps(t,s,p)}return fu(t,s,i,u,p)}function dh(t,s,i){var u=s.pendingProps,p=u.children,g=t!==null?t.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},wt(ho,Un),Un|=i;else{if((i&1073741824)===0)return t=g!==null?g.baseLanes|i:i,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,wt(ho,Un),Un|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=g!==null?g.baseLanes:i,wt(ho,Un),Un|=u}else g!==null?(u=g.baseLanes|i,s.memoizedState=null):u=i,wt(ho,Un),Un|=u;return bn(t,s,p,i),s.child}function fh(t,s){var i=s.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(s.flags|=512,s.flags|=2097152)}function fu(t,s,i,u,p){var g=An(i)?Cr:pn.current;return g=so(s,g),co(s,p),i=nu(t,s,i,u,g,p),u=su(),t!==null&&!In?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Ps(t,s,p)):(_t&&u&&zc(s),s.flags|=1,bn(t,s,i,p),s.child)}function ph(t,s,i,u,p){if(An(i)){var g=!0;ya(s)}else g=!1;if(co(s,p),s.stateNode===null)Oa(t,s),th(s,i,u),cu(s,i,u,p),u=!0;else if(t===null){var w=s.stateNode,_=s.memoizedProps;w.props=_;var D=w.context,V=i.contextType;typeof V=="object"&&V!==null?V=Xn(V):(V=An(i)?Cr:pn.current,V=so(s,V));var re=i.getDerivedStateFromProps,ie=typeof re=="function"||typeof w.getSnapshotBeforeUpdate=="function";ie||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==u||D!==V)&&nh(s,w,u,V),er=!1;var se=s.memoizedState;w.state=se,ja(s,u,w,p),D=s.memoizedState,_!==u||se!==D||Rn.current||er?(typeof re=="function"&&(lu(s,i,re,u),D=s.memoizedState),(_=er||eh(s,i,_,u,se,D,V))?(ie||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=D),w.props=u,w.state=D,w.context=V,u=_):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,_p(t,s),_=s.memoizedProps,V=s.type===s.elementType?_:as(s.type,_),w.props=V,ie=s.pendingProps,se=w.context,D=i.contextType,typeof D=="object"&&D!==null?D=Xn(D):(D=An(i)?Cr:pn.current,D=so(s,D));var Ne=i.getDerivedStateFromProps;(re=typeof Ne=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==ie||se!==D)&&nh(s,w,u,D),er=!1,se=s.memoizedState,w.state=se,ja(s,u,w,p);var _e=s.memoizedState;_!==ie||se!==_e||Rn.current||er?(typeof Ne=="function"&&(lu(s,i,Ne,u),_e=s.memoizedState),(V=er||eh(s,i,V,u,se,_e,D)||!1)?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,_e,D),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,_e,D)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=_e),w.props=u,w.state=_e,w.context=D,u=V):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),u=!1)}return pu(t,s,i,u,g,p)}function pu(t,s,i,u,p,g){fh(t,s);var w=(s.flags&128)!==0;if(!u&&!w)return p&&yp(s,i,!1),Ps(t,s,g);u=s.stateNode,kw.current=s;var _=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,t!==null&&w?(s.child=ao(s,t.child,null,g),s.child=ao(s,null,_,g)):bn(t,s,_,g),s.memoizedState=u.state,p&&yp(s,i,!0),s.child}function hh(t){var s=t.stateNode;s.pendingContext?gp(t,s.pendingContext,s.pendingContext!==s.context):s.context&&gp(t,s.context,!1),Yc(t,s.containerInfo)}function mh(t,s,i,u,p){return io(),Wc(p),s.flags|=256,bn(t,s,i,u),s.child}var hu={dehydrated:null,treeContext:null,retryLane:0};function mu(t){return{baseLanes:t,cachePool:null,transitions:null}}function gh(t,s,i){var u=s.pendingProps,p=Mt.current,g=!1,w=(s.flags&128)!==0,_;if((_=w)||(_=t!==null&&t.memoizedState===null?!1:(p&2)!==0),_?(g=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),wt(Mt,p&1),t===null)return Bc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,t=u.fallback,g?(u=s.mode,g=s.child,w={mode:"hidden",children:w},(u&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=w):g=qa(w,u,0,null),t=Or(t,u,i,null),g.return=s,t.return=s,g.sibling=t,s.child=g,s.child.memoizedState=mu(i),s.memoizedState=hu,t):gu(s,w));if(p=t.memoizedState,p!==null&&(_=p.dehydrated,_!==null))return Sw(t,s,w,u,_,p,i);if(g){g=u.fallback,w=s.mode,p=t.child,_=p.sibling;var D={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==p?(u=s.child,u.childLanes=0,u.pendingProps=D,s.deletions=null):(u=ar(p,D),u.subtreeFlags=p.subtreeFlags&14680064),_!==null?g=ar(_,g):(g=Or(g,w,i,null),g.flags|=2),g.return=s,u.return=s,u.sibling=g,s.child=u,u=g,g=s.child,w=t.child.memoizedState,w=w===null?mu(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},g.memoizedState=w,g.childLanes=t.childLanes&~i,s.memoizedState=hu,u}return g=t.child,t=g.sibling,u=ar(g,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=i),u.return=s,u.sibling=null,t!==null&&(i=s.deletions,i===null?(s.deletions=[t],s.flags|=16):i.push(t)),s.child=u,s.memoizedState=null,u}function gu(t,s){return s=qa({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function La(t,s,i,u){return u!==null&&Wc(u),ao(s,t.child,null,i),t=gu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Sw(t,s,i,u,p,g,w){if(i)return s.flags&256?(s.flags&=-257,u=uu(Error(r(422))),La(t,s,w,u)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(g=u.fallback,p=s.mode,u=qa({mode:"visible",children:u.children},p,0,null),g=Or(g,p,w,null),g.flags|=2,u.return=s,g.return=s,u.sibling=g,s.child=u,(s.mode&1)!==0&&ao(s,t.child,null,w),s.child.memoizedState=mu(w),s.memoizedState=hu,g);if((s.mode&1)===0)return La(t,s,w,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var _=u.dgst;return u=_,g=Error(r(419)),u=uu(g,u,void 0),La(t,s,w,u)}if(_=(w&t.childLanes)!==0,In||_){if(u=tn,u!==null){switch(w&-w){case 4:p=2;break;case 16:p=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:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(u.suspendedLanes|w))!==0?0:p,p!==0&&p!==g.retryLane&&(g.retryLane=p,Os(t,p),us(u,t,p,-1))}return Iu(),u=uu(Error(r(421))),La(t,s,w,u)}return p.data==="$?"?(s.flags|=128,s.child=t.child,s=Lw.bind(null,t),p._reactRetry=s,null):(t=g.treeContext,Fn=Ys(p.nextSibling),zn=s,_t=!0,is=null,t!==null&&(Gn[qn++]=Ms,Gn[qn++]=Ls,Gn[qn++]=jr,Ms=t.id,Ls=t.overflow,jr=s),s=gu(s,u.children),s.flags|=4096,s)}function vh(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Gc(t.return,s,i)}function vu(t,s,i,u,p){var g=t.memoizedState;g===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=u,g.tail=i,g.tailMode=p)}function yh(t,s,i){var u=s.pendingProps,p=u.revealOrder,g=u.tail;if(bn(t,s,u.children,i),u=Mt.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vh(t,i,s);else if(t.tag===19)vh(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(wt(Mt,u),(s.mode&1)===0)s.memoizedState=null;else switch(p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&Ea(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),vu(s,!1,p,i,g);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&Ea(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}vu(s,!0,i,null,g);break;case"together":vu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Oa(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Ps(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),Ir|=s.lanes,(i&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,i=ar(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=ar(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function bw(t,s,i){switch(s.tag){case 3:hh(s),io();break;case 5:Ip(s);break;case 1:An(s.type)&&ya(s);break;case 4:Yc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,p=s.memoizedProps.value;wt(Na,u._currentValue),u._currentValue=p;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(wt(Mt,Mt.current&1),s.flags|=128,null):(i&s.child.childLanes)!==0?gh(t,s,i):(wt(Mt,Mt.current&1),t=Ps(t,s,i),t!==null?t.sibling:null);wt(Mt,Mt.current&1);break;case 19:if(u=(i&s.childLanes)!==0,(t.flags&128)!==0){if(u)return yh(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),wt(Mt,Mt.current),u)break;return null;case 22:case 23:return s.lanes=0,dh(t,s,i)}return Ps(t,s,i)}var xh,yu,wh,kh;xh=function(t,s){for(var i=s.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},yu=function(){},wh=function(t,s,i,u){var p=t.memoizedProps;if(p!==u){t=s.stateNode,Rr(Ts.current);var g=null;switch(i){case"input":p=Ee(t,p),u=Ee(t,u),g=[];break;case"select":p=K({},p,{value:void 0}),u=K({},u,{value:void 0}),g=[];break;case"textarea":p=Ot(t,p),u=Ot(t,u),g=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=ma)}ss(i,u);var w;i=null;for(V in p)if(!u.hasOwnProperty(V)&&p.hasOwnProperty(V)&&p[V]!=null)if(V==="style"){var _=p[V];for(w in _)_.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?g||(g=[]):(g=g||[]).push(V,null));for(V in u){var D=u[V];if(_=p!=null?p[V]:void 0,u.hasOwnProperty(V)&&D!==_&&(D!=null||_!=null))if(V==="style")if(_){for(w in _)!_.hasOwnProperty(w)||D&&D.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in D)D.hasOwnProperty(w)&&_[w]!==D[w]&&(i||(i={}),i[w]=D[w])}else i||(g||(g=[]),g.push(V,i)),i=D;else V==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,_=_?_.__html:void 0,D!=null&&_!==D&&(g=g||[]).push(V,D)):V==="children"?typeof D!="string"&&typeof D!="number"||(g=g||[]).push(V,""+D):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(D!=null&&V==="onScroll"&&Tt("scroll",t),g||_===D||(g=[])):(g=g||[]).push(V,D))}i&&(g=g||[]).push("style",i);var V=g;(s.updateQueue=V)&&(s.flags|=4)}},kh=function(t,s,i,u){i!==u&&(s.flags|=4)};function ui(t,s){if(!_t)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function mn(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function Nw(t,s,i){var u=s.pendingProps;switch(Fc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(s),null;case 1:return An(s.type)&&va(),mn(s),null;case 3:return u=s.stateNode,uo(),Ct(Rn),Ct(pn),Jc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(Sa(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,is!==null&&(_u(is),is=null))),yu(t,s),mn(s),null;case 5:Qc(s);var p=Rr(oi.current);if(i=s.type,t!==null&&s.stateNode!=null)wh(t,s,i,u,p),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return mn(s),null}if(t=Rr(Ts.current),Sa(s)){u=s.stateNode,i=s.type;var g=s.memoizedProps;switch(u[Ns]=s,u[ei]=g,t=(s.mode&1)!==0,i){case"dialog":Tt("cancel",u),Tt("close",u);break;case"iframe":case"object":case"embed":Tt("load",u);break;case"video":case"audio":for(p=0;p<Qo.length;p++)Tt(Qo[p],u);break;case"source":Tt("error",u);break;case"img":case"image":case"link":Tt("error",u),Tt("load",u);break;case"details":Tt("toggle",u);break;case"input":et(u,g),Tt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!g.multiple},Tt("invalid",u);break;case"textarea":G(u,g),Tt("invalid",u)}ss(i,g),p=null;for(var w in g)if(g.hasOwnProperty(w)){var _=g[w];w==="children"?typeof _=="string"?u.textContent!==_&&(g.suppressHydrationWarning!==!0&&ha(u.textContent,_,t),p=["children",_]):typeof _=="number"&&u.textContent!==""+_&&(g.suppressHydrationWarning!==!0&&ha(u.textContent,_,t),p=["children",""+_]):l.hasOwnProperty(w)&&_!=null&&w==="onScroll"&&Tt("scroll",u)}switch(i){case"input":ge(u),Be(u,g,!0);break;case"textarea":ge(u),ze(u);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(u.onclick=ma)}u=p,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ye(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(i,{is:u.is}):(t=w.createElement(i),i==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,i),t[Ns]=s,t[ei]=u,xh(t,s,!1,!1),s.stateNode=t;e:{switch(w=rs(i,u),i){case"dialog":Tt("cancel",t),Tt("close",t),p=u;break;case"iframe":case"object":case"embed":Tt("load",t),p=u;break;case"video":case"audio":for(p=0;p<Qo.length;p++)Tt(Qo[p],t);p=u;break;case"source":Tt("error",t),p=u;break;case"img":case"image":case"link":Tt("error",t),Tt("load",t),p=u;break;case"details":Tt("toggle",t),p=u;break;case"input":et(t,u),p=Ee(t,u),Tt("invalid",t);break;case"option":p=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},p=K({},u,{value:void 0}),Tt("invalid",t);break;case"textarea":G(t,u),p=Ot(t,u),Tt("invalid",t);break;default:p=u}ss(i,p),_=p;for(g in _)if(_.hasOwnProperty(g)){var D=_[g];g==="style"?xn(t,D):g==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&Z(t,D)):g==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&Pe(t,D):typeof D=="number"&&Pe(t,""+D):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(l.hasOwnProperty(g)?D!=null&&g==="onScroll"&&Tt("scroll",t):D!=null&&P(t,g,D,w))}switch(i){case"input":ge(t),Be(t,u,!1);break;case"textarea":ge(t),ze(t);break;case"option":u.value!=null&&t.setAttribute("value",""+xe(u.value));break;case"select":t.multiple=!!u.multiple,g=u.value,g!=null?kt(t,!!u.multiple,g,!1):u.defaultValue!=null&&kt(t,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=ma)}switch(i){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 mn(s),null;case 6:if(t&&s.stateNode!=null)kh(t,s,t.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Rr(oi.current),Rr(Ts.current),Sa(s)){if(u=s.stateNode,i=s.memoizedProps,u[Ns]=s,(g=u.nodeValue!==i)&&(t=zn,t!==null))switch(t.tag){case 3:ha(u.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ha(u.nodeValue,i,(t.mode&1)!==0)}g&&(s.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[Ns]=s,s.stateNode=u}return mn(s),null;case 13:if(Ct(Mt),u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(_t&&Fn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Np(),io(),s.flags|=98560,g=!1;else if(g=Sa(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Ns]=s}else io(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;mn(s),g=!1}else is!==null&&(_u(is),is=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=i,s):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(Mt.current&1)!==0?Qt===0&&(Qt=3):Iu())),s.updateQueue!==null&&(s.flags|=4),mn(s),null);case 4:return uo(),yu(t,s),t===null&&Zo(s.stateNode.containerInfo),mn(s),null;case 10:return Kc(s.type._context),mn(s),null;case 17:return An(s.type)&&va(),mn(s),null;case 19:if(Ct(Mt),g=s.memoizedState,g===null)return mn(s),null;if(u=(s.flags&128)!==0,w=g.rendering,w===null)if(u)ui(g,!1);else{if(Qt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(w=Ea(t),w!==null){for(s.flags|=128,ui(g,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=i,i=s.child;i!==null;)g=i,t=u,g.flags&=14680066,w=g.alternate,w===null?(g.childLanes=0,g.lanes=t,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=w.childLanes,g.lanes=w.lanes,g.child=w.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=w.memoizedProps,g.memoizedState=w.memoizedState,g.updateQueue=w.updateQueue,g.type=w.type,t=w.dependencies,g.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return wt(Mt,Mt.current&1|2),s.child}t=t.sibling}g.tail!==null&&At()>mo&&(s.flags|=128,u=!0,ui(g,!1),s.lanes=4194304)}else{if(!u)if(t=Ea(w),t!==null){if(s.flags|=128,u=!0,i=t.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),ui(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!_t)return mn(s),null}else 2*At()-g.renderingStartTime>mo&&i!==1073741824&&(s.flags|=128,u=!0,ui(g,!1),s.lanes=4194304);g.isBackwards?(w.sibling=s.child,s.child=w):(i=g.last,i!==null?i.sibling=w:s.child=w,g.last=w)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=At(),s.sibling=null,i=Mt.current,wt(Mt,u?i&1|2:i&1),s):(mn(s),null);case 22:case 23:return Au(),u=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Un&1073741824)!==0&&(mn(s),s.subtreeFlags&6&&(s.flags|=8192)):mn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function Tw(t,s){switch(Fc(s),s.tag){case 1:return An(s.type)&&va(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return uo(),Ct(Rn),Ct(pn),Jc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Qc(s),null;case 13:if(Ct(Mt),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));io()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return Ct(Mt),null;case 4:return uo(),null;case 10:return Kc(s.type._context),null;case 22:case 23:return Au(),null;case 24:return null;default:return null}}var $a=!1,gn=!1,Cw=typeof WeakSet=="function"?WeakSet:Set,je=null;function po(t,s){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){Pt(t,s,u)}else i.current=null}function xu(t,s,i){try{i()}catch(u){Pt(t,s,u)}}var Sh=!1;function jw(t,s){if(Ac=sa,t=ep(),bc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,_=-1,D=-1,V=0,re=0,ie=t,se=null;t:for(;;){for(var Ne;ie!==i||p!==0&&ie.nodeType!==3||(_=w+p),ie!==g||u!==0&&ie.nodeType!==3||(D=w+u),ie.nodeType===3&&(w+=ie.nodeValue.length),(Ne=ie.firstChild)!==null;)se=ie,ie=Ne;for(;;){if(ie===t)break t;if(se===i&&++V===p&&(_=w),se===g&&++re===u&&(D=w),(Ne=ie.nextSibling)!==null)break;ie=se,se=ie.parentNode}ie=Ne}i=_===-1||D===-1?null:{start:_,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ic={focusedElem:t,selectionRange:i},sa=!1,je=s;je!==null;)if(s=je,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,je=t;else for(;je!==null;){s=je;try{var _e=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Ie=_e.memoizedProps,Ut=_e.memoizedState,W=s.stateNode,$=W.getSnapshotBeforeUpdate(s.elementType===s.type?Ie:as(s.type,Ie),Ut);W.__reactInternalSnapshotBeforeUpdate=$}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(pe){Pt(s,s.return,pe)}if(t=s.sibling,t!==null){t.return=s.return,je=t;break}je=s.return}return _e=Sh,Sh=!1,_e}function di(t,s,i){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&t)===t){var g=p.destroy;p.destroy=void 0,g!==void 0&&xu(s,i,g)}p=p.next}while(p!==u)}}function Pa(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var u=i.create;i.destroy=u()}i=i.next}while(i!==s)}}function wu(t){var s=t.ref;if(s!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof s=="function"?s(t):s.current=t}}function bh(t){var s=t.alternate;s!==null&&(t.alternate=null,bh(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[Ns],delete s[ei],delete s[Oc],delete s[cw],delete s[uw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Nh(t){return t.tag===5||t.tag===3||t.tag===4}function Th(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Nh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ku(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.nodeType===8?i.parentNode.insertBefore(t,s):i.insertBefore(t,s):(i.nodeType===8?(s=i.parentNode,s.insertBefore(t,i)):(s=i,s.appendChild(t)),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=ma));else if(u!==4&&(t=t.child,t!==null))for(ku(t,s,i),t=t.sibling;t!==null;)ku(t,s,i),t=t.sibling}function Su(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(Su(t,s,i),t=t.sibling;t!==null;)Su(t,s,i),t=t.sibling}var ln=null,ls=!1;function nr(t,s,i){for(i=i.child;i!==null;)Ch(t,s,i),i=i.sibling}function Ch(t,s,i){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(wr,i)}catch{}switch(i.tag){case 5:gn||po(i,s);case 6:var u=ln,p=ls;ln=null,nr(t,s,i),ln=u,ls=p,ln!==null&&(ls?(t=ln,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):ln.removeChild(i.stateNode));break;case 18:ln!==null&&(ls?(t=ln,i=i.stateNode,t.nodeType===8?Lc(t.parentNode,i):t.nodeType===1&&Lc(t,i),Wo(t)):Lc(ln,i.stateNode));break;case 4:u=ln,p=ls,ln=i.stateNode.containerInfo,ls=!0,nr(t,s,i),ln=u,ls=p;break;case 0:case 11:case 14:case 15:if(!gn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var g=p,w=g.destroy;g=g.tag,w!==void 0&&((g&2)!==0||(g&4)!==0)&&xu(i,s,w),p=p.next}while(p!==u)}nr(t,s,i);break;case 1:if(!gn&&(po(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(_){Pt(i,s,_)}nr(t,s,i);break;case 21:nr(t,s,i);break;case 22:i.mode&1?(gn=(u=gn)||i.memoizedState!==null,nr(t,s,i),gn=u):nr(t,s,i);break;default:nr(t,s,i)}}function jh(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new Cw),s.forEach(function(u){var p=Ow.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}}function cs(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];try{var g=t,w=s,_=w;e:for(;_!==null;){switch(_.tag){case 5:ln=_.stateNode,ls=!1;break e;case 3:ln=_.stateNode.containerInfo,ls=!0;break e;case 4:ln=_.stateNode.containerInfo,ls=!0;break e}_=_.return}if(ln===null)throw Error(r(160));Ch(g,w,p),ln=null,ls=!1;var D=p.alternate;D!==null&&(D.return=null),p.return=null}catch(V){Pt(p,s,V)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Eh(s,t),s=s.sibling}function Eh(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(cs(s,t),js(t),u&4){try{di(3,t,t.return),Pa(3,t)}catch(Ie){Pt(t,t.return,Ie)}try{di(5,t,t.return)}catch(Ie){Pt(t,t.return,Ie)}}break;case 1:cs(s,t),js(t),u&512&&i!==null&&po(i,i.return);break;case 5:if(cs(s,t),js(t),u&512&&i!==null&&po(i,i.return),t.flags&32){var p=t.stateNode;try{Pe(p,"")}catch(Ie){Pt(t,t.return,Ie)}}if(u&4&&(p=t.stateNode,p!=null)){var g=t.memoizedProps,w=i!==null?i.memoizedProps:g,_=t.type,D=t.updateQueue;if(t.updateQueue=null,D!==null)try{_==="input"&&g.type==="radio"&&g.name!=null&&He(p,g),rs(_,w);var V=rs(_,g);for(w=0;w<D.length;w+=2){var re=D[w],ie=D[w+1];re==="style"?xn(p,ie):re==="dangerouslySetInnerHTML"?Z(p,ie):re==="children"?Pe(p,ie):P(p,re,ie,V)}switch(_){case"input":Se(p,g);break;case"textarea":we(p,g);break;case"select":var se=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!g.multiple;var Ne=g.value;Ne!=null?kt(p,!!g.multiple,Ne,!1):se!==!!g.multiple&&(g.defaultValue!=null?kt(p,!!g.multiple,g.defaultValue,!0):kt(p,!!g.multiple,g.multiple?[]:"",!1))}p[ei]=g}catch(Ie){Pt(t,t.return,Ie)}}break;case 6:if(cs(s,t),js(t),u&4){if(t.stateNode===null)throw Error(r(162));p=t.stateNode,g=t.memoizedProps;try{p.nodeValue=g}catch(Ie){Pt(t,t.return,Ie)}}break;case 3:if(cs(s,t),js(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Wo(s.containerInfo)}catch(Ie){Pt(t,t.return,Ie)}break;case 4:cs(s,t),js(t);break;case 13:cs(s,t),js(t),p=t.child,p.flags&8192&&(g=p.memoizedState!==null,p.stateNode.isHidden=g,!g||p.alternate!==null&&p.alternate.memoizedState!==null||(Tu=At())),u&4&&jh(t);break;case 22:if(re=i!==null&&i.memoizedState!==null,t.mode&1?(gn=(V=gn)||re,cs(s,t),gn=V):cs(s,t),js(t),u&8192){if(V=t.memoizedState!==null,(t.stateNode.isHidden=V)&&!re&&(t.mode&1)!==0)for(je=t,re=t.child;re!==null;){for(ie=je=re;je!==null;){switch(se=je,Ne=se.child,se.tag){case 0:case 11:case 14:case 15:di(4,se,se.return);break;case 1:po(se,se.return);var _e=se.stateNode;if(typeof _e.componentWillUnmount=="function"){u=se,i=se.return;try{s=u,_e.props=s.memoizedProps,_e.state=s.memoizedState,_e.componentWillUnmount()}catch(Ie){Pt(u,i,Ie)}}break;case 5:po(se,se.return);break;case 22:if(se.memoizedState!==null){Ah(ie);continue}}Ne!==null?(Ne.return=se,je=Ne):Ah(ie)}re=re.sibling}e:for(re=null,ie=t;;){if(ie.tag===5){if(re===null){re=ie;try{p=ie.stateNode,V?(g=p.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(_=ie.stateNode,D=ie.memoizedProps.style,w=D!=null&&D.hasOwnProperty("display")?D.display:null,_.style.display=yn("display",w))}catch(Ie){Pt(t,t.return,Ie)}}}else if(ie.tag===6){if(re===null)try{ie.stateNode.nodeValue=V?"":ie.memoizedProps}catch(Ie){Pt(t,t.return,Ie)}}else if((ie.tag!==22&&ie.tag!==23||ie.memoizedState===null||ie===t)&&ie.child!==null){ie.child.return=ie,ie=ie.child;continue}if(ie===t)break e;for(;ie.sibling===null;){if(ie.return===null||ie.return===t)break e;re===ie&&(re=null),ie=ie.return}re===ie&&(re=null),ie.sibling.return=ie.return,ie=ie.sibling}}break;case 19:cs(s,t),js(t),u&4&&jh(t);break;case 21:break;default:cs(s,t),js(t)}}function js(t){var s=t.flags;if(s&2){try{e:{for(var i=t.return;i!==null;){if(Nh(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(Pe(p,""),u.flags&=-33);var g=Th(t);Su(t,g,p);break;case 3:case 4:var w=u.stateNode.containerInfo,_=Th(t);ku(t,_,w);break;default:throw Error(r(161))}}catch(D){Pt(t,t.return,D)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Ew(t,s,i){je=t,_h(t)}function _h(t,s,i){for(var u=(t.mode&1)!==0;je!==null;){var p=je,g=p.child;if(p.tag===22&&u){var w=p.memoizedState!==null||$a;if(!w){var _=p.alternate,D=_!==null&&_.memoizedState!==null||gn;_=$a;var V=gn;if($a=w,(gn=D)&&!V)for(je=p;je!==null;)w=je,D=w.child,w.tag===22&&w.memoizedState!==null?Ih(p):D!==null?(D.return=w,je=D):Ih(p);for(;g!==null;)je=g,_h(g),g=g.sibling;je=p,$a=_,gn=V}Rh(t)}else(p.subtreeFlags&8772)!==0&&g!==null?(g.return=p,je=g):Rh(t)}}function Rh(t){for(;je!==null;){var s=je;if((s.flags&8772)!==0){var i=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:gn||Pa(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!gn)if(i===null)u.componentDidMount();else{var p=s.elementType===s.type?i.memoizedProps:as(s.type,i.memoizedProps);u.componentDidUpdate(p,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&Ap(s,g,u);break;case 3:var w=s.updateQueue;if(w!==null){if(i=null,s.child!==null)switch(s.child.tag){case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}Ap(s,w,i)}break;case 5:var _=s.stateNode;if(i===null&&s.flags&4){i=_;var D=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.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 re=V.memoizedState;if(re!==null){var ie=re.dehydrated;ie!==null&&Wo(ie)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gn||s.flags&512&&wu(s)}catch(se){Pt(s,s.return,se)}}if(s===t){je=null;break}if(i=s.sibling,i!==null){i.return=s.return,je=i;break}je=s.return}}function Ah(t){for(;je!==null;){var s=je;if(s===t){je=null;break}var i=s.sibling;if(i!==null){i.return=s.return,je=i;break}je=s.return}}function Ih(t){for(;je!==null;){var s=je;try{switch(s.tag){case 0:case 11:case 15:var i=s.return;try{Pa(4,s)}catch(D){Pt(s,i,D)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var p=s.return;try{u.componentDidMount()}catch(D){Pt(s,p,D)}}var g=s.return;try{wu(s)}catch(D){Pt(s,g,D)}break;case 5:var w=s.return;try{wu(s)}catch(D){Pt(s,w,D)}}}catch(D){Pt(s,s.return,D)}if(s===t){je=null;break}var _=s.sibling;if(_!==null){_.return=s.return,je=_;break}je=s.return}}var _w=Math.ceil,za=L.ReactCurrentDispatcher,bu=L.ReactCurrentOwner,Qn=L.ReactCurrentBatchConfig,rt=0,tn=null,Ht=null,cn=0,Un=0,ho=Qs(0),Qt=0,fi=null,Ir=0,Fa=0,Nu=0,pi=null,Dn=null,Tu=0,mo=1/0,zs=null,Ua=!1,Cu=null,sr=null,Ba=!1,rr=null,Wa=0,hi=0,ju=null,Ha=-1,Va=0;function Nn(){return(rt&6)!==0?At():Ha!==-1?Ha:Ha=At()}function or(t){return(t.mode&1)===0?1:(rt&2)!==0&&cn!==0?cn&-cn:fw.transition!==null?(Va===0&&(Va=zo()),Va):(t=nt,t!==0||(t=window.event,t=t===void 0?16:Mf(t.type)),t)}function us(t,s,i,u){if(50<hi)throw hi=0,ju=null,Error(r(185));Nr(t,i,u),((rt&2)===0||t!==tn)&&(t===tn&&((rt&2)===0&&(Fa|=i),Qt===4&&ir(t,cn)),Mn(t,u),i===1&&rt===0&&(s.mode&1)===0&&(mo=At()+500,xa&&Js()))}function Mn(t,s){var i=t.callbackNode;ea(t,s);var u=br(t,t===tn?cn:0);if(u===0)i!==null&&lt(i),t.callbackNode=null,t.callbackPriority=0;else if(s=u&-u,t.callbackPriority!==s){if(i!=null&&lt(i),s===1)t.tag===0?dw(Mh.bind(null,t)):xp(Mh.bind(null,t)),aw(function(){(rt&6)===0&&Js()}),i=null;else{switch(fe(u)){case 1:i=Hs;break;case 4:i=bs;break;case 16:i=Hr;break;case 536870912:i=Zi;break;default:i=Hr}i=Bh(i,Dh.bind(null,t))}t.callbackPriority=s,t.callbackNode=i}}function Dh(t,s){if(Ha=-1,Va=0,(rt&6)!==0)throw Error(r(327));var i=t.callbackNode;if(go()&&t.callbackNode!==i)return null;var u=br(t,t===tn?cn:0);if(u===0)return null;if((u&30)!==0||(u&t.expiredLanes)!==0||s)s=Ka(t,u);else{s=u;var p=rt;rt|=2;var g=Oh();(tn!==t||cn!==s)&&(zs=null,mo=At()+500,Mr(t,s));do try{Iw();break}catch(_){Lh(t,_)}while(!0);Vc(),za.current=g,rt=p,Ht!==null?s=0:(tn=null,cn=0,s=Qt)}if(s!==0){if(s===2&&(p=Po(t),p!==0&&(u=p,s=Eu(t,p))),s===1)throw i=fi,Mr(t,0),ir(t,u),Mn(t,At()),i;if(s===6)ir(t,u);else{if(p=t.current.alternate,(u&30)===0&&!Rw(p)&&(s=Ka(t,u),s===2&&(g=Po(t),g!==0&&(u=g,s=Eu(t,g))),s===1))throw i=fi,Mr(t,0),ir(t,u),Mn(t,At()),i;switch(t.finishedWork=p,t.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Lr(t,Dn,zs);break;case 3:if(ir(t,u),(u&130023424)===u&&(s=Tu+500-At(),10<s)){if(br(t,0)!==0)break;if(p=t.suspendedLanes,(p&u)!==u){Nn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Mc(Lr.bind(null,t,Dn,zs),s);break}Lr(t,Dn,zs);break;case 4:if(ir(t,u),(u&4194240)===u)break;for(s=t.eventTimes,p=-1;0<u;){var w=31-kn(u);g=1<<w,w=s[w],w>p&&(p=w),u&=~g}if(u=p,u=At()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*_w(u/1960))-u,10<u){t.timeoutHandle=Mc(Lr.bind(null,t,Dn,zs),u);break}Lr(t,Dn,zs);break;case 5:Lr(t,Dn,zs);break;default:throw Error(r(329))}}}return Mn(t,At()),t.callbackNode===i?Dh.bind(null,t):null}function Eu(t,s){var i=pi;return t.current.memoizedState.isDehydrated&&(Mr(t,s).flags|=256),t=Ka(t,s),t!==2&&(s=Dn,Dn=i,s!==null&&_u(s)),t}function _u(t){Dn===null?Dn=t:Dn.push.apply(Dn,t)}function Rw(t){for(var s=t;;){if(s.flags&16384){var i=s.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var p=i[u],g=p.getSnapshot;p=p.value;try{if(!os(g(),p))return!1}catch{return!1}}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ir(t,s){for(s&=~Nu,s&=~Fa,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var i=31-kn(s),u=1<<i;t[i]=-1,s&=~u}}function Mh(t){if((rt&6)!==0)throw Error(r(327));go();var s=br(t,0);if((s&1)===0)return Mn(t,At()),null;var i=Ka(t,s);if(t.tag!==0&&i===2){var u=Po(t);u!==0&&(s=u,i=Eu(t,u))}if(i===1)throw i=fi,Mr(t,0),ir(t,s),Mn(t,At()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Lr(t,Dn,zs),Mn(t,At()),null}function Ru(t,s){var i=rt;rt|=1;try{return t(s)}finally{rt=i,rt===0&&(mo=At()+500,xa&&Js())}}function Dr(t){rr!==null&&rr.tag===0&&(rt&6)===0&&go();var s=rt;rt|=1;var i=Qn.transition,u=nt;try{if(Qn.transition=null,nt=1,t)return t()}finally{nt=u,Qn.transition=i,rt=s,(rt&6)===0&&Js()}}function Au(){Un=ho.current,Ct(ho)}function Mr(t,s){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,iw(i)),Ht!==null)for(i=Ht.return;i!==null;){var u=i;switch(Fc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&va();break;case 3:uo(),Ct(Rn),Ct(pn),Jc();break;case 5:Qc(u);break;case 4:uo();break;case 13:Ct(Mt);break;case 19:Ct(Mt);break;case 10:Kc(u.type._context);break;case 22:case 23:Au()}i=i.return}if(tn=t,Ht=t=ar(t.current,null),cn=Un=s,Qt=0,fi=null,Nu=Fa=Ir=0,Dn=pi=null,_r!==null){for(s=0;s<_r.length;s++)if(i=_r[s],u=i.interleaved,u!==null){i.interleaved=null;var p=u.next,g=i.pending;if(g!==null){var w=g.next;g.next=p,u.next=w}i.pending=u}_r=null}return t}function Lh(t,s){do{var i=Ht;try{if(Vc(),_a.current=Da,Ra){for(var u=Lt.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}Ra=!1}if(Ar=0,en=Yt=Lt=null,ii=!1,ai=0,bu.current=null,i===null||i.return===null){Qt=1,fi=s,Ht=null;break}e:{var g=t,w=i.return,_=i,D=s;if(s=cn,_.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var V=D,re=_,ie=re.tag;if((re.mode&1)===0&&(ie===0||ie===11||ie===15)){var se=re.alternate;se?(re.updateQueue=se.updateQueue,re.memoizedState=se.memoizedState,re.lanes=se.lanes):(re.updateQueue=null,re.memoizedState=null)}var Ne=ih(w);if(Ne!==null){Ne.flags&=-257,ah(Ne,w,_,g,s),Ne.mode&1&&oh(g,V,s),s=Ne,D=V;var _e=s.updateQueue;if(_e===null){var Ie=new Set;Ie.add(D),s.updateQueue=Ie}else _e.add(D);break e}else{if((s&1)===0){oh(g,V,s),Iu();break e}D=Error(r(426))}}else if(_t&&_.mode&1){var Ut=ih(w);if(Ut!==null){(Ut.flags&65536)===0&&(Ut.flags|=256),ah(Ut,w,_,g,s),Wc(fo(D,_));break e}}g=D=fo(D,_),Qt!==4&&(Qt=2),pi===null?pi=[g]:pi.push(g),g=w;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var W=sh(g,D,s);Rp(g,W);break e;case 1:_=D;var $=g.type,H=g.stateNode;if((g.flags&128)===0&&(typeof $.getDerivedStateFromError=="function"||H!==null&&typeof H.componentDidCatch=="function"&&(sr===null||!sr.has(H)))){g.flags|=65536,s&=-s,g.lanes|=s;var pe=rh(g,_,s);Rp(g,pe);break e}}g=g.return}while(g!==null)}Ph(i)}catch(De){s=De,Ht===i&&i!==null&&(Ht=i=i.return);continue}break}while(!0)}function Oh(){var t=za.current;return za.current=Da,t===null?Da:t}function Iu(){(Qt===0||Qt===3||Qt===2)&&(Qt=4),tn===null||(Ir&268435455)===0&&(Fa&268435455)===0||ir(tn,cn)}function Ka(t,s){var i=rt;rt|=2;var u=Oh();(tn!==t||cn!==s)&&(zs=null,Mr(t,s));do try{Aw();break}catch(p){Lh(t,p)}while(!0);if(Vc(),rt=i,za.current=u,Ht!==null)throw Error(r(261));return tn=null,cn=0,Qt}function Aw(){for(;Ht!==null;)$h(Ht)}function Iw(){for(;Ht!==null&&!zt();)$h(Ht)}function $h(t){var s=Uh(t.alternate,t,Un);t.memoizedProps=t.pendingProps,s===null?Ph(t):Ht=s,bu.current=null}function Ph(t){var s=t;do{var i=s.alternate;if(t=s.return,(s.flags&32768)===0){if(i=Nw(i,s,Un),i!==null){Ht=i;return}}else{if(i=Tw(i,s),i!==null){i.flags&=32767,Ht=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Qt=6,Ht=null;return}}if(s=s.sibling,s!==null){Ht=s;return}Ht=s=t}while(s!==null);Qt===0&&(Qt=5)}function Lr(t,s,i){var u=nt,p=Qn.transition;try{Qn.transition=null,nt=1,Dw(t,s,i,u)}finally{Qn.transition=p,nt=u}return null}function Dw(t,s,i,u){do go();while(rr!==null);if((rt&6)!==0)throw Error(r(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var g=i.lanes|i.childLanes;if(ta(t,g),t===tn&&(Ht=tn=null,cn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Ba||(Ba=!0,Bh(Hr,function(){return go(),null})),g=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||g){g=Qn.transition,Qn.transition=null;var w=nt;nt=1;var _=rt;rt|=4,bu.current=null,jw(t,i),Eh(i,t),Jx(Ic),sa=!!Ac,Ic=Ac=null,t.current=i,Ew(i),ks(),rt=_,nt=w,Qn.transition=g}else t.current=i;if(Ba&&(Ba=!1,rr=t,Wa=p),g=t.pendingLanes,g===0&&(sr=null),Vr(i.stateNode),Mn(t,At()),s!==null)for(u=t.onRecoverableError,i=0;i<s.length;i++)p=s[i],u(p.value,{componentStack:p.stack,digest:p.digest});if(Ua)throw Ua=!1,t=Cu,Cu=null,t;return(Wa&1)!==0&&t.tag!==0&&go(),g=t.pendingLanes,(g&1)!==0?t===ju?hi++:(hi=0,ju=t):hi=0,Js(),null}function go(){if(rr!==null){var t=fe(Wa),s=Qn.transition,i=nt;try{if(Qn.transition=null,nt=16>t?16:t,rr===null)var u=!1;else{if(t=rr,rr=null,Wa=0,(rt&6)!==0)throw Error(r(331));var p=rt;for(rt|=4,je=t.current;je!==null;){var g=je,w=g.child;if((je.flags&16)!==0){var _=g.deletions;if(_!==null){for(var D=0;D<_.length;D++){var V=_[D];for(je=V;je!==null;){var re=je;switch(re.tag){case 0:case 11:case 15:di(8,re,g)}var ie=re.child;if(ie!==null)ie.return=re,je=ie;else for(;je!==null;){re=je;var se=re.sibling,Ne=re.return;if(bh(re),re===V){je=null;break}if(se!==null){se.return=Ne,je=se;break}je=Ne}}}var _e=g.alternate;if(_e!==null){var Ie=_e.child;if(Ie!==null){_e.child=null;do{var Ut=Ie.sibling;Ie.sibling=null,Ie=Ut}while(Ie!==null)}}je=g}}if((g.subtreeFlags&2064)!==0&&w!==null)w.return=g,je=w;else e:for(;je!==null;){if(g=je,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:di(9,g,g.return)}var W=g.sibling;if(W!==null){W.return=g.return,je=W;break e}je=g.return}}var $=t.current;for(je=$;je!==null;){w=je;var H=w.child;if((w.subtreeFlags&2064)!==0&&H!==null)H.return=w,je=H;else e:for(w=$;je!==null;){if(_=je,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Pa(9,_)}}catch(De){Pt(_,_.return,De)}if(_===w){je=null;break e}var pe=_.sibling;if(pe!==null){pe.return=_.return,je=pe;break e}je=_.return}}if(rt=p,Js(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(wr,t)}catch{}u=!0}return u}finally{nt=i,Qn.transition=s}}return!1}function zh(t,s,i){s=fo(i,s),s=sh(t,s,1),t=tr(t,s,1),s=Nn(),t!==null&&(Nr(t,1,s),Mn(t,s))}function Pt(t,s,i){if(t.tag===3)zh(t,t,i);else for(;s!==null;){if(s.tag===3){zh(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(sr===null||!sr.has(u))){t=fo(i,t),t=rh(s,t,1),s=tr(s,t,1),t=Nn(),s!==null&&(Nr(s,1,t),Mn(s,t));break}}s=s.return}}function Mw(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),s=Nn(),t.pingedLanes|=t.suspendedLanes&i,tn===t&&(cn&i)===i&&(Qt===4||Qt===3&&(cn&130023424)===cn&&500>At()-Tu?Mr(t,0):Nu|=i),Mn(t,s)}function Fh(t,s){s===0&&((t.mode&1)===0?s=1:(s=Gr,Gr<<=1,(Gr&130023424)===0&&(Gr=4194304)));var i=Nn();t=Os(t,s),t!==null&&(Nr(t,s,i),Mn(t,i))}function Lw(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),Fh(t,i)}function Ow(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),Fh(t,i)}var Uh;Uh=function(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps||Rn.current)In=!0;else{if((t.lanes&i)===0&&(s.flags&128)===0)return In=!1,bw(t,s,i);In=(t.flags&131072)!==0}else In=!1,_t&&(s.flags&1048576)!==0&&wp(s,ka,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Oa(t,s),t=s.pendingProps;var p=so(s,pn.current);co(s,i),p=nu(null,s,u,t,p,i);var g=su();return s.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,An(u)?(g=!0,ya(s)):g=!1,s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Xc(s),p.updater=Ma,s.stateNode=p,p._reactInternals=s,cu(s,u,t,i),s=pu(null,s,u,!0,g,i)):(s.tag=0,_t&&g&&zc(s),bn(null,s,p,i),s=s.child),s;case 16:u=s.elementType;e:{switch(Oa(t,s),t=s.pendingProps,p=u._init,u=p(u._payload),s.type=u,p=s.tag=Pw(u),t=as(u,t),p){case 0:s=fu(null,s,u,t,i);break e;case 1:s=ph(null,s,u,t,i);break e;case 11:s=lh(null,s,u,t,i);break e;case 14:s=ch(null,s,u,as(u.type,t),i);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),fu(t,s,u,p,i);case 1:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),ph(t,s,u,p,i);case 3:e:{if(hh(s),t===null)throw Error(r(387));u=s.pendingProps,g=s.memoizedState,p=g.element,_p(t,s),ja(s,u,null,i);var w=s.memoizedState;if(u=w.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){p=fo(Error(r(423)),s),s=mh(t,s,u,i,p);break e}else if(u!==p){p=fo(Error(r(424)),s),s=mh(t,s,u,i,p);break e}else for(Fn=Ys(s.stateNode.containerInfo.firstChild),zn=s,_t=!0,is=null,i=jp(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(io(),u===p){s=Ps(t,s,i);break e}bn(t,s,u,i)}s=s.child}return s;case 5:return Ip(s),t===null&&Bc(s),u=s.type,p=s.pendingProps,g=t!==null?t.memoizedProps:null,w=p.children,Dc(u,p)?w=null:g!==null&&Dc(u,g)&&(s.flags|=32),fh(t,s),bn(t,s,w,i),s.child;case 6:return t===null&&Bc(s),null;case 13:return gh(t,s,i);case 4:return Yc(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=ao(s,null,u,i):bn(t,s,u,i),s.child;case 11:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),lh(t,s,u,p,i);case 7:return bn(t,s,s.pendingProps,i),s.child;case 8:return bn(t,s,s.pendingProps.children,i),s.child;case 12:return bn(t,s,s.pendingProps.children,i),s.child;case 10:e:{if(u=s.type._context,p=s.pendingProps,g=s.memoizedProps,w=p.value,wt(Na,u._currentValue),u._currentValue=w,g!==null)if(os(g.value,w)){if(g.children===p.children&&!Rn.current){s=Ps(t,s,i);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var _=g.dependencies;if(_!==null){w=g.child;for(var D=_.firstContext;D!==null;){if(D.context===u){if(g.tag===1){D=$s(-1,i&-i),D.tag=2;var V=g.updateQueue;if(V!==null){V=V.shared;var re=V.pending;re===null?D.next=D:(D.next=re.next,re.next=D),V.pending=D}}g.lanes|=i,D=g.alternate,D!==null&&(D.lanes|=i),Gc(g.return,i,s),_.lanes|=i;break}D=D.next}}else if(g.tag===10)w=g.type===s.type?null:g.child;else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=i,_=w.alternate,_!==null&&(_.lanes|=i),Gc(w,i,s),w=g.sibling}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===s){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}bn(t,s,p.children,i),s=s.child}return s;case 9:return p=s.type,u=s.pendingProps.children,co(s,i),p=Xn(p),u=u(p),s.flags|=1,bn(t,s,u,i),s.child;case 14:return u=s.type,p=as(u,s.pendingProps),p=as(u.type,p),ch(t,s,u,p,i);case 15:return uh(t,s,s.type,s.pendingProps,i);case 17:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),Oa(t,s),s.tag=1,An(u)?(t=!0,ya(s)):t=!1,co(s,i),th(s,u,p),cu(s,u,p,i),pu(null,s,u,!0,t,i);case 19:return yh(t,s,i);case 22:return dh(t,s,i)}throw Error(r(156,s.tag))};function Bh(t,s){return ws(t,s)}function $w(t,s,i,u){this.tag=t,this.key=i,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(t,s,i,u){return new $w(t,s,i,u)}function Du(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Pw(t){if(typeof t=="function")return Du(t)?1:0;if(t!=null){if(t=t.$$typeof,t===me)return 11;if(t===Te)return 14}return 2}function ar(t,s){var i=t.alternate;return i===null?(i=Zn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Ga(t,s,i,u,p,g){var w=2;if(u=t,typeof t=="function")Du(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case F:return Or(i.children,p,g,s);case O:w=8,p|=8;break;case Q:return t=Zn(12,i,s,p|2),t.elementType=Q,t.lanes=g,t;case ke:return t=Zn(13,i,s,p),t.elementType=ke,t.lanes=g,t;case Le:return t=Zn(19,i,s,p),t.elementType=Le,t.lanes=g,t;case ee:return qa(i,p,g,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case J:w=10;break e;case te:w=9;break e;case me:w=11;break e;case Te:w=14;break e;case oe:w=16,u=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=Zn(w,i,s,p),s.elementType=t,s.type=u,s.lanes=g,s}function Or(t,s,i,u){return t=Zn(7,t,u,s),t.lanes=i,t}function qa(t,s,i,u){return t=Zn(22,t,u,s),t.elementType=ee,t.lanes=i,t.stateNode={isHidden:!1},t}function Mu(t,s,i){return t=Zn(6,t,null,s),t.lanes=i,t}function Lu(t,s,i){return s=Zn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function zw(t,s,i,u,p){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fo(0),this.expirationTimes=Fo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fo(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Ou(t,s,i,u,p,g,w,_,D){return t=new zw(t,s,i,_,D),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Zn(3,null,null,s),t.current=g,g.stateNode=t,g.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xc(g),t}function Fw(t,s,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:q,key:u==null?null:""+u,children:t,containerInfo:s,implementation:i}}function Wh(t){if(!t)return Zs;t=t._reactInternals;e:{if(Ke(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(An(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if(An(i))return vp(t,i,s)}return s}function Hh(t,s,i,u,p,g,w,_,D){return t=Ou(i,u,!0,t,p,g,w,_,D),t.context=Wh(null),i=t.current,u=Nn(),p=or(i),g=$s(u,p),g.callback=s??null,tr(i,g,p),t.current.lanes=p,Nr(t,p,u),Mn(t,u),t}function Xa(t,s,i,u){var p=s.current,g=Nn(),w=or(p);return i=Wh(i),s.context===null?s.context=i:s.pendingContext=i,s=$s(g,w),s.payload={element:t},u=u===void 0?null:u,u!==null&&(s.callback=u),t=tr(p,s,w),t!==null&&(us(t,p,w,g),Ca(t,p,w)),w}function Ya(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Vh(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function $u(t,s){Vh(t,s),(t=t.alternate)&&Vh(t,s)}function Uw(){return null}var Kh=typeof reportError=="function"?reportError:function(t){console.error(t)};function Pu(t){this._internalRoot=t}Qa.prototype.render=Pu.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Xa(t,s,null,null)},Qa.prototype.unmount=Pu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Dr(function(){Xa(null,t,null,null)}),s[Is]=null}};function Qa(t){this._internalRoot=t}Qa.prototype.unstable_scheduleHydration=function(t){if(t){var s=Re();t={blockedOn:null,target:t,priority:s};for(var i=0;i<Gs.length&&s!==0&&s<Gs[i].priority;i++);Gs.splice(i,0,t),i===0&&If(t)}};function zu(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Za(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Gh(){}function Bw(t,s,i,u,p){if(p){if(typeof u=="function"){var g=u;u=function(){var V=Ya(w);g.call(V)}}var w=Hh(s,u,t,0,null,!1,!1,"",Gh);return t._reactRootContainer=w,t[Is]=w.current,Zo(t.nodeType===8?t.parentNode:t),Dr(),w}for(;p=t.lastChild;)t.removeChild(p);if(typeof u=="function"){var _=u;u=function(){var V=Ya(D);_.call(V)}}var D=Ou(t,0,!1,null,null,!1,!1,"",Gh);return t._reactRootContainer=D,t[Is]=D.current,Zo(t.nodeType===8?t.parentNode:t),Dr(function(){Xa(s,D,i,u)}),D}function Ja(t,s,i,u,p){var g=i._reactRootContainer;if(g){var w=g;if(typeof p=="function"){var _=p;p=function(){var D=Ya(w);_.call(D)}}Xa(s,w,t,p)}else w=Bw(i,s,t,p,u);return Ya(w)}C=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var i=Sr(s.pendingLanes);i!==0&&(Ks(s,i|1),Mn(s,At()),(rt&6)===0&&(mo=At()+500,Js()))}break;case 13:Dr(function(){var u=Os(t,1);if(u!==null){var p=Nn();us(u,t,1,p)}}),$u(t,1)}},B=function(t){if(t.tag===13){var s=Os(t,134217728);if(s!==null){var i=Nn();us(s,t,134217728,i)}$u(t,134217728)}},ne=function(t){if(t.tag===13){var s=or(t),i=Os(t,s);if(i!==null){var u=Nn();us(i,t,s,u)}$u(t,s)}},Re=function(){return nt},Me=function(t,s){var i=nt;try{return nt=t,s()}finally{nt=i}},Wt=function(t,s,i){switch(s){case"input":if(Se(t,i),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=ga(u);if(!p)throw Error(r(90));le(u),Se(u,p)}}}break;case"textarea":we(t,i);break;case"select":s=i.value,s!=null&&kt(t,!!i.multiple,s,!1)}},Et=Ru,Nt=Dr;var Ww={usingClientEntryPoint:!1,Events:[ti,to,ga,Rt,Kt,Ru]},mi={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Hw={bundleType:mi.bundleType,version:mi.version,rendererPackageName:mi.rendererPackageName,rendererConfig:mi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:L.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=xs(t),t===null?null:t.stateNode},findFiberByHostInstance:mi.findFiberByHostInstance||Uw,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 el=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!el.isDisabled&&el.supportsFiber)try{wr=el.inject(Hw),$n=el}catch{}}return Ln.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ww,Ln.createPortal=function(t,s){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zu(s))throw Error(r(200));return Fw(t,s,null,i)},Ln.createRoot=function(t,s){if(!zu(t))throw Error(r(299));var i=!1,u="",p=Kh;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),s=Ou(t,1,!1,null,null,i,!1,u,p),t[Is]=s.current,Zo(t.nodeType===8?t.parentNode:t),new Pu(s)},Ln.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=xs(s),t=t===null?null:t.stateNode,t},Ln.flushSync=function(t){return Dr(t)},Ln.hydrate=function(t,s,i){if(!Za(s))throw Error(r(200));return Ja(null,t,s,!0,i)},Ln.hydrateRoot=function(t,s,i){if(!zu(t))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,p=!1,g="",w=Kh;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),s=Hh(s,null,t,1,i??null,p,!1,g,w),t[Is]=s.current,Zo(t),u)for(t=0;t<u.length;t++)i=u[t],p=i._getVersion,p=p(i._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[i,p]:s.mutableSourceEagerHydrationData.push(i,p);return new Qa(s)},Ln.render=function(t,s,i){if(!Za(s))throw Error(r(200));return Ja(null,t,s,!1,i)},Ln.unmountComponentAtNode=function(t){if(!Za(t))throw Error(r(40));return t._reactRootContainer?(Dr(function(){Ja(null,null,t,!1,function(){t._reactRootContainer=null,t[Is]=null})}),!0):!1},Ln.unstable_batchedUpdates=Ru,Ln.unstable_renderSubtreeIntoContainer=function(t,s,i,u){if(!Za(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Ja(t,s,i,!1,u)},Ln.version="18.3.1-next-f1338f8080-20240426",Ln}var tm;function rv(){if(tm)return Bu.exports;tm=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Bu.exports=Jw(),Bu.exports}var nm;function e0(){if(nm)return tl;nm=1;var e=rv();return tl.createRoot=e.createRoot,tl.hydrateRoot=e.hydrateRoot,tl}var t0=e0();const n0=sv(t0),sm=e=>{let n;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(n):m;if(!Object.is(k,n)){const x=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,x))}},l=()=>n,f={setState:o,getState:l,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m))},h=n=e(o,l,f);return f},s0=(e=>e?sm(e):sm),r0=e=>e;function o0(e,n=r0){const r=gt.useSyncExternalStore(e.subscribe,gt.useCallback(()=>n(e.getState()),[e,n]),gt.useCallback(()=>n(e.getInitialState()),[e,n]));return gt.useDebugValue(r),r}const i0=e=>{const n=s0(e),r=o=>o0(n,o);return Object.assign(r,n),r},a0=(e=>i0),ov="agentpane:machines",iv="agentpane:active-machine";function l0(e){return/^[a-z][a-z0-9-]{1,30}$/.test(e)}function av(e){return`${e}.repoburg.com`}function lv(e){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(e);return n?n[1]:null}function cv(e,n){try{const r=localStorage.getItem(e);return r==null?n:JSON.parse(r)}catch{return n}}function uv(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function c0(e){const{mahlas:n,hostname:r}=e??{};return typeof n=="string"&&l0(n)&&r===av(n)}function dv(){const e=cv(ov,[]);return Array.isArray(e)?e.filter(c0):[]}function u0(e){const n={mahlas:e,hostname:av(e),lastConnectedAt:new Date().toISOString()},r=dv(),o=[n,...r.filter(l=>l.mahlas!==e)];return uv(ov,o),n}function d0(){const e=cv(iv,null);return e?dv().find(n=>n.mahlas===e)??null:null}function f0(e){uv(iv,e)}function p0(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("host");if(!e)return;const n=lv(e);n&&(u0(n),f0(n))}const rm="http://localhost:9998",h0=["agent.repoburg.com"];function xt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search),n=e.get("bport");if(n)return`http://localhost:${n}`;const r=e.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(h0.includes(o))return rm;if(lv(o))return"";const l=d0();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":rm}function m0(e){const n=xt();return n?`${n.replace(/^http/,"ws")}${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}const g0="/api";class Br extends Error{constructor(r,o,l){super(r);ht(this,"status");ht(this,"body");this.name="ApiError",this.status=o,this.body=l}}function Vn(e){var n;if(e instanceof Br){const r=(n=e.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return e instanceof Error?e.message:String(e)}async function Wi(e,n,r){const o=await fetch(`${xt()}${g0}${n}`,{method:e,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,c=null;try{c=await o.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new Br(`${e} ${n} failed: ${l}`,o.status,c)}return o.json()}function jt(e){return Wi("GET",e)}function ut(e,n){return Wi("POST",e,n)}function Hi(e){return Wi("DELETE",e)}function ms(e,n){return Wi("PATCH",e,n)}function fv(e,n){return Wi("PUT",e,n)}function v0(e){return`stream-text-${e}`}const hs=new Map;function bl(e,n,r){return`${e}
41
+ `+g.stack}return{value:t,source:s,stack:p,digest:null}}function uu(t,s,i){return{value:t,source:null,stack:i??null,digest:s??null}}function du(t,s){try{console.error(s.value)}catch(i){setTimeout(function(){throw i})}}var bw=typeof WeakMap=="function"?WeakMap:Map;function sh(t,s,i){i=$s(-1,i),i.tag=3,i.payload={element:null};var u=s.value;return i.callback=function(){Ua||(Ua=!0,Cu=u),du(t,s)},i}function rh(t,s,i){i=$s(-1,i),i.tag=3;var u=t.type.getDerivedStateFromError;if(typeof u=="function"){var p=s.value;i.payload=function(){return u(p)},i.callback=function(){du(t,s)}}var g=t.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){du(t,s),typeof u!="function"&&(sr===null?sr=new Set([this]):sr.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})}),i}function oh(t,s,i){var u=t.pingCache;if(u===null){u=t.pingCache=new bw;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(i)||(p.add(i),t=$w.bind(null,t,s,i),s.then(t,t))}function ih(t){do{var s;if((s=t.tag===13)&&(s=t.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return t;t=t.return}while(t!==null);return null}function ah(t,s,i,u,p){return(t.mode&1)===0?(t===s?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(s=$s(-1,1),s.tag=2,tr(i,s,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var Nw=L.ReactCurrentOwner,In=!1;function bn(t,s,i,u){s.child=t===null?jp(s,null,i,u):ao(s,t.child,i,u)}function lh(t,s,i,u,p){i=i.render;var g=s.ref;return co(s,p),u=nu(t,s,i,u,g,p),i=su(),t!==null&&!In?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Ps(t,s,p)):(_t&&i&&zc(s),s.flags|=1,bn(t,s,u,p),s.child)}function ch(t,s,i,u,p){if(t===null){var g=i.type;return typeof g=="function"&&!Du(g)&&g.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(s.tag=15,s.type=g,uh(t,s,g,u,p)):(t=Ga(i.type,null,u,s,s.mode,p),t.ref=s.ref,t.return=s,s.child=t)}if(g=t.child,(t.lanes&p)===0){var w=g.memoizedProps;if(i=i.compare,i=i!==null?i:Xo,i(w,u)&&t.ref===s.ref)return Ps(t,s,p)}return s.flags|=1,t=ar(g,u),t.ref=s.ref,t.return=s,s.child=t}function uh(t,s,i,u,p){if(t!==null){var g=t.memoizedProps;if(Xo(g,u)&&t.ref===s.ref)if(In=!1,s.pendingProps=u=g,(t.lanes&p)!==0)(t.flags&131072)!==0&&(In=!0);else return s.lanes=t.lanes,Ps(t,s,p)}return fu(t,s,i,u,p)}function dh(t,s,i){var u=s.pendingProps,p=u.children,g=t!==null?t.memoizedState:null;if(u.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},wt(ho,Un),Un|=i;else{if((i&1073741824)===0)return t=g!==null?g.baseLanes|i:i,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:t,cachePool:null,transitions:null},s.updateQueue=null,wt(ho,Un),Un|=t,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},u=g!==null?g.baseLanes:i,wt(ho,Un),Un|=u}else g!==null?(u=g.baseLanes|i,s.memoizedState=null):u=i,wt(ho,Un),Un|=u;return bn(t,s,p,i),s.child}function fh(t,s){var i=s.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(s.flags|=512,s.flags|=2097152)}function fu(t,s,i,u,p){var g=An(i)?Cr:pn.current;return g=so(s,g),co(s,p),i=nu(t,s,i,u,g,p),u=su(),t!==null&&!In?(s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~p,Ps(t,s,p)):(_t&&u&&zc(s),s.flags|=1,bn(t,s,i,p),s.child)}function ph(t,s,i,u,p){if(An(i)){var g=!0;ya(s)}else g=!1;if(co(s,p),s.stateNode===null)Oa(t,s),th(s,i,u),cu(s,i,u,p),u=!0;else if(t===null){var w=s.stateNode,_=s.memoizedProps;w.props=_;var D=w.context,V=i.contextType;typeof V=="object"&&V!==null?V=Xn(V):(V=An(i)?Cr:pn.current,V=so(s,V));var re=i.getDerivedStateFromProps,ie=typeof re=="function"||typeof w.getSnapshotBeforeUpdate=="function";ie||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==u||D!==V)&&nh(s,w,u,V),er=!1;var se=s.memoizedState;w.state=se,ja(s,u,w,p),D=s.memoizedState,_!==u||se!==D||Rn.current||er?(typeof re=="function"&&(lu(s,i,re,u),D=s.memoizedState),(_=er||eh(s,i,_,u,se,D,V))?(ie||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=D),w.props=u,w.state=D,w.context=V,u=_):(typeof w.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{w=s.stateNode,_p(t,s),_=s.memoizedProps,V=s.type===s.elementType?_:as(s.type,_),w.props=V,ie=s.pendingProps,se=w.context,D=i.contextType,typeof D=="object"&&D!==null?D=Xn(D):(D=An(i)?Cr:pn.current,D=so(s,D));var Ne=i.getDerivedStateFromProps;(re=typeof Ne=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==ie||se!==D)&&nh(s,w,u,D),er=!1,se=s.memoizedState,w.state=se,ja(s,u,w,p);var _e=s.memoizedState;_!==ie||se!==_e||Rn.current||er?(typeof Ne=="function"&&(lu(s,i,Ne,u),_e=s.memoizedState),(V=er||eh(s,i,V,u,se,_e,D)||!1)?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(u,_e,D),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(u,_e,D)),typeof w.componentDidUpdate=="function"&&(s.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=_e),w.props=u,w.state=_e,w.context=D,u=V):(typeof w.componentDidUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&se===t.memoizedState||(s.flags|=1024),u=!1)}return pu(t,s,i,u,g,p)}function pu(t,s,i,u,p,g){fh(t,s);var w=(s.flags&128)!==0;if(!u&&!w)return p&&yp(s,i,!1),Ps(t,s,g);u=s.stateNode,Nw.current=s;var _=w&&typeof i.getDerivedStateFromError!="function"?null:u.render();return s.flags|=1,t!==null&&w?(s.child=ao(s,t.child,null,g),s.child=ao(s,null,_,g)):bn(t,s,_,g),s.memoizedState=u.state,p&&yp(s,i,!0),s.child}function hh(t){var s=t.stateNode;s.pendingContext?gp(t,s.pendingContext,s.pendingContext!==s.context):s.context&&gp(t,s.context,!1),Yc(t,s.containerInfo)}function mh(t,s,i,u,p){return io(),Wc(p),s.flags|=256,bn(t,s,i,u),s.child}var hu={dehydrated:null,treeContext:null,retryLane:0};function mu(t){return{baseLanes:t,cachePool:null,transitions:null}}function gh(t,s,i){var u=s.pendingProps,p=Mt.current,g=!1,w=(s.flags&128)!==0,_;if((_=w)||(_=t!==null&&t.memoizedState===null?!1:(p&2)!==0),_?(g=!0,s.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),wt(Mt,p&1),t===null)return Bc(s),t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((s.mode&1)===0?s.lanes=1:t.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(w=u.children,t=u.fallback,g?(u=s.mode,g=s.child,w={mode:"hidden",children:w},(u&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=w):g=qa(w,u,0,null),t=Or(t,u,i,null),g.return=s,t.return=s,g.sibling=t,s.child=g,s.child.memoizedState=mu(i),s.memoizedState=hu,t):gu(s,w));if(p=t.memoizedState,p!==null&&(_=p.dehydrated,_!==null))return Tw(t,s,w,u,_,p,i);if(g){g=u.fallback,w=s.mode,p=t.child,_=p.sibling;var D={mode:"hidden",children:u.children};return(w&1)===0&&s.child!==p?(u=s.child,u.childLanes=0,u.pendingProps=D,s.deletions=null):(u=ar(p,D),u.subtreeFlags=p.subtreeFlags&14680064),_!==null?g=ar(_,g):(g=Or(g,w,i,null),g.flags|=2),g.return=s,u.return=s,u.sibling=g,s.child=u,u=g,g=s.child,w=t.child.memoizedState,w=w===null?mu(i):{baseLanes:w.baseLanes|i,cachePool:null,transitions:w.transitions},g.memoizedState=w,g.childLanes=t.childLanes&~i,s.memoizedState=hu,u}return g=t.child,t=g.sibling,u=ar(g,{mode:"visible",children:u.children}),(s.mode&1)===0&&(u.lanes=i),u.return=s,u.sibling=null,t!==null&&(i=s.deletions,i===null?(s.deletions=[t],s.flags|=16):i.push(t)),s.child=u,s.memoizedState=null,u}function gu(t,s){return s=qa({mode:"visible",children:s},t.mode,0,null),s.return=t,t.child=s}function La(t,s,i,u){return u!==null&&Wc(u),ao(s,t.child,null,i),t=gu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Tw(t,s,i,u,p,g,w){if(i)return s.flags&256?(s.flags&=-257,u=uu(Error(r(422))),La(t,s,w,u)):s.memoizedState!==null?(s.child=t.child,s.flags|=128,null):(g=u.fallback,p=s.mode,u=qa({mode:"visible",children:u.children},p,0,null),g=Or(g,p,w,null),g.flags|=2,u.return=s,g.return=s,u.sibling=g,s.child=u,(s.mode&1)!==0&&ao(s,t.child,null,w),s.child.memoizedState=mu(w),s.memoizedState=hu,g);if((s.mode&1)===0)return La(t,s,w,null);if(p.data==="$!"){if(u=p.nextSibling&&p.nextSibling.dataset,u)var _=u.dgst;return u=_,g=Error(r(419)),u=uu(g,u,void 0),La(t,s,w,u)}if(_=(w&t.childLanes)!==0,In||_){if(u=tn,u!==null){switch(w&-w){case 4:p=2;break;case 16:p=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:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(u.suspendedLanes|w))!==0?0:p,p!==0&&p!==g.retryLane&&(g.retryLane=p,Os(t,p),us(u,t,p,-1))}return Iu(),u=uu(Error(r(421))),La(t,s,w,u)}return p.data==="$?"?(s.flags|=128,s.child=t.child,s=Pw.bind(null,t),p._reactRetry=s,null):(t=g.treeContext,Fn=Ys(p.nextSibling),zn=s,_t=!0,is=null,t!==null&&(Gn[qn++]=Ms,Gn[qn++]=Ls,Gn[qn++]=jr,Ms=t.id,Ls=t.overflow,jr=s),s=gu(s,u.children),s.flags|=4096,s)}function vh(t,s,i){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),Gc(t.return,s,i)}function vu(t,s,i,u,p){var g=t.memoizedState;g===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:p}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=u,g.tail=i,g.tailMode=p)}function yh(t,s,i){var u=s.pendingProps,p=u.revealOrder,g=u.tail;if(bn(t,s,u.children,i),u=Mt.current,(u&2)!==0)u=u&1|2,s.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vh(t,i,s);else if(t.tag===19)vh(t,i,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}u&=1}if(wt(Mt,u),(s.mode&1)===0)s.memoizedState=null;else switch(p){case"forwards":for(i=s.child,p=null;i!==null;)t=i.alternate,t!==null&&Ea(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=s.child,s.child=null):(p=i.sibling,i.sibling=null),vu(s,!1,p,i,g);break;case"backwards":for(i=null,p=s.child,s.child=null;p!==null;){if(t=p.alternate,t!==null&&Ea(t)===null){s.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}vu(s,!0,i,null,g);break;case"together":vu(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Oa(t,s){(s.mode&1)===0&&t!==null&&(t.alternate=null,s.alternate=null,s.flags|=2)}function Ps(t,s,i){if(t!==null&&(s.dependencies=t.dependencies),Ir|=s.lanes,(i&s.childLanes)===0)return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,i=ar(t,t.pendingProps),s.child=i,i.return=s;t.sibling!==null;)t=t.sibling,i=i.sibling=ar(t,t.pendingProps),i.return=s;i.sibling=null}return s.child}function Cw(t,s,i){switch(s.tag){case 3:hh(s),io();break;case 5:Ip(s);break;case 1:An(s.type)&&ya(s);break;case 4:Yc(s,s.stateNode.containerInfo);break;case 10:var u=s.type._context,p=s.memoizedProps.value;wt(Na,u._currentValue),u._currentValue=p;break;case 13:if(u=s.memoizedState,u!==null)return u.dehydrated!==null?(wt(Mt,Mt.current&1),s.flags|=128,null):(i&s.child.childLanes)!==0?gh(t,s,i):(wt(Mt,Mt.current&1),t=Ps(t,s,i),t!==null?t.sibling:null);wt(Mt,Mt.current&1);break;case 19:if(u=(i&s.childLanes)!==0,(t.flags&128)!==0){if(u)return yh(t,s,i);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),wt(Mt,Mt.current),u)break;return null;case 22:case 23:return s.lanes=0,dh(t,s,i)}return Ps(t,s,i)}var xh,yu,wh,kh;xh=function(t,s){for(var i=s.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},yu=function(){},wh=function(t,s,i,u){var p=t.memoizedProps;if(p!==u){t=s.stateNode,Rr(Ts.current);var g=null;switch(i){case"input":p=Ee(t,p),u=Ee(t,u),g=[];break;case"select":p=K({},p,{value:void 0}),u=K({},u,{value:void 0}),g=[];break;case"textarea":p=Ot(t,p),u=Ot(t,u),g=[];break;default:typeof p.onClick!="function"&&typeof u.onClick=="function"&&(t.onclick=ma)}ss(i,u);var w;i=null;for(V in p)if(!u.hasOwnProperty(V)&&p.hasOwnProperty(V)&&p[V]!=null)if(V==="style"){var _=p[V];for(w in _)_.hasOwnProperty(w)&&(i||(i={}),i[w]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?g||(g=[]):(g=g||[]).push(V,null));for(V in u){var D=u[V];if(_=p!=null?p[V]:void 0,u.hasOwnProperty(V)&&D!==_&&(D!=null||_!=null))if(V==="style")if(_){for(w in _)!_.hasOwnProperty(w)||D&&D.hasOwnProperty(w)||(i||(i={}),i[w]="");for(w in D)D.hasOwnProperty(w)&&_[w]!==D[w]&&(i||(i={}),i[w]=D[w])}else i||(g||(g=[]),g.push(V,i)),i=D;else V==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,_=_?_.__html:void 0,D!=null&&_!==D&&(g=g||[]).push(V,D)):V==="children"?typeof D!="string"&&typeof D!="number"||(g=g||[]).push(V,""+D):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(D!=null&&V==="onScroll"&&Tt("scroll",t),g||_===D||(g=[])):(g=g||[]).push(V,D))}i&&(g=g||[]).push("style",i);var V=g;(s.updateQueue=V)&&(s.flags|=4)}},kh=function(t,s,i,u){i!==u&&(s.flags|=4)};function ui(t,s){if(!_t)switch(t.tailMode){case"hidden":s=t.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function mn(t){var s=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(s)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags&14680064,u|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=i,s}function jw(t,s,i){var u=s.pendingProps;switch(Fc(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(s),null;case 1:return An(s.type)&&va(),mn(s),null;case 3:return u=s.stateNode,uo(),Ct(Rn),Ct(pn),Jc(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(t===null||t.child===null)&&(Sa(s)?s.flags|=4:t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,is!==null&&(_u(is),is=null))),yu(t,s),mn(s),null;case 5:Qc(s);var p=Rr(oi.current);if(i=s.type,t!==null&&s.stateNode!=null)wh(t,s,i,u,p),t.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!u){if(s.stateNode===null)throw Error(r(166));return mn(s),null}if(t=Rr(Ts.current),Sa(s)){u=s.stateNode,i=s.type;var g=s.memoizedProps;switch(u[Ns]=s,u[ei]=g,t=(s.mode&1)!==0,i){case"dialog":Tt("cancel",u),Tt("close",u);break;case"iframe":case"object":case"embed":Tt("load",u);break;case"video":case"audio":for(p=0;p<Qo.length;p++)Tt(Qo[p],u);break;case"source":Tt("error",u);break;case"img":case"image":case"link":Tt("error",u),Tt("load",u);break;case"details":Tt("toggle",u);break;case"input":et(u,g),Tt("invalid",u);break;case"select":u._wrapperState={wasMultiple:!!g.multiple},Tt("invalid",u);break;case"textarea":G(u,g),Tt("invalid",u)}ss(i,g),p=null;for(var w in g)if(g.hasOwnProperty(w)){var _=g[w];w==="children"?typeof _=="string"?u.textContent!==_&&(g.suppressHydrationWarning!==!0&&ha(u.textContent,_,t),p=["children",_]):typeof _=="number"&&u.textContent!==""+_&&(g.suppressHydrationWarning!==!0&&ha(u.textContent,_,t),p=["children",""+_]):l.hasOwnProperty(w)&&_!=null&&w==="onScroll"&&Tt("scroll",u)}switch(i){case"input":ge(u),Be(u,g,!0);break;case"textarea":ge(u),ze(u);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(u.onclick=ma)}u=p,s.updateQueue=u,u!==null&&(s.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Ye(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=w.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=w.createElement(i,{is:u.is}):(t=w.createElement(i),i==="select"&&(w=t,u.multiple?w.multiple=!0:u.size&&(w.size=u.size))):t=w.createElementNS(t,i),t[Ns]=s,t[ei]=u,xh(t,s,!1,!1),s.stateNode=t;e:{switch(w=rs(i,u),i){case"dialog":Tt("cancel",t),Tt("close",t),p=u;break;case"iframe":case"object":case"embed":Tt("load",t),p=u;break;case"video":case"audio":for(p=0;p<Qo.length;p++)Tt(Qo[p],t);p=u;break;case"source":Tt("error",t),p=u;break;case"img":case"image":case"link":Tt("error",t),Tt("load",t),p=u;break;case"details":Tt("toggle",t),p=u;break;case"input":et(t,u),p=Ee(t,u),Tt("invalid",t);break;case"option":p=u;break;case"select":t._wrapperState={wasMultiple:!!u.multiple},p=K({},u,{value:void 0}),Tt("invalid",t);break;case"textarea":G(t,u),p=Ot(t,u),Tt("invalid",t);break;default:p=u}ss(i,p),_=p;for(g in _)if(_.hasOwnProperty(g)){var D=_[g];g==="style"?xn(t,D):g==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&Z(t,D)):g==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&Pe(t,D):typeof D=="number"&&Pe(t,""+D):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(l.hasOwnProperty(g)?D!=null&&g==="onScroll"&&Tt("scroll",t):D!=null&&P(t,g,D,w))}switch(i){case"input":ge(t),Be(t,u,!1);break;case"textarea":ge(t),ze(t);break;case"option":u.value!=null&&t.setAttribute("value",""+xe(u.value));break;case"select":t.multiple=!!u.multiple,g=u.value,g!=null?kt(t,!!u.multiple,g,!1):u.defaultValue!=null&&kt(t,!!u.multiple,u.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=ma)}switch(i){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 mn(s),null;case 6:if(t&&s.stateNode!=null)kh(t,s,t.memoizedProps,u);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(i=Rr(oi.current),Rr(Ts.current),Sa(s)){if(u=s.stateNode,i=s.memoizedProps,u[Ns]=s,(g=u.nodeValue!==i)&&(t=zn,t!==null))switch(t.tag){case 3:ha(u.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ha(u.nodeValue,i,(t.mode&1)!==0)}g&&(s.flags|=4)}else u=(i.nodeType===9?i:i.ownerDocument).createTextNode(u),u[Ns]=s,s.stateNode=u}return mn(s),null;case 13:if(Ct(Mt),u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(_t&&Fn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)Np(),io(),s.flags|=98560,g=!1;else if(g=Sa(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[Ns]=s}else io(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;mn(s),g=!1}else is!==null&&(_u(is),is=null),g=!0;if(!g)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=i,s):(u=u!==null,u!==(t!==null&&t.memoizedState!==null)&&u&&(s.child.flags|=8192,(s.mode&1)!==0&&(t===null||(Mt.current&1)!==0?Qt===0&&(Qt=3):Iu())),s.updateQueue!==null&&(s.flags|=4),mn(s),null);case 4:return uo(),yu(t,s),t===null&&Zo(s.stateNode.containerInfo),mn(s),null;case 10:return Kc(s.type._context),mn(s),null;case 17:return An(s.type)&&va(),mn(s),null;case 19:if(Ct(Mt),g=s.memoizedState,g===null)return mn(s),null;if(u=(s.flags&128)!==0,w=g.rendering,w===null)if(u)ui(g,!1);else{if(Qt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(w=Ea(t),w!==null){for(s.flags|=128,ui(g,!1),u=w.updateQueue,u!==null&&(s.updateQueue=u,s.flags|=4),s.subtreeFlags=0,u=i,i=s.child;i!==null;)g=i,t=u,g.flags&=14680066,w=g.alternate,w===null?(g.childLanes=0,g.lanes=t,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=w.childLanes,g.lanes=w.lanes,g.child=w.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=w.memoizedProps,g.memoizedState=w.memoizedState,g.updateQueue=w.updateQueue,g.type=w.type,t=w.dependencies,g.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return wt(Mt,Mt.current&1|2),s.child}t=t.sibling}g.tail!==null&&At()>mo&&(s.flags|=128,u=!0,ui(g,!1),s.lanes=4194304)}else{if(!u)if(t=Ea(w),t!==null){if(s.flags|=128,u=!0,i=t.updateQueue,i!==null&&(s.updateQueue=i,s.flags|=4),ui(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!_t)return mn(s),null}else 2*At()-g.renderingStartTime>mo&&i!==1073741824&&(s.flags|=128,u=!0,ui(g,!1),s.lanes=4194304);g.isBackwards?(w.sibling=s.child,s.child=w):(i=g.last,i!==null?i.sibling=w:s.child=w,g.last=w)}return g.tail!==null?(s=g.tail,g.rendering=s,g.tail=s.sibling,g.renderingStartTime=At(),s.sibling=null,i=Mt.current,wt(Mt,u?i&1|2:i&1),s):(mn(s),null);case 22:case 23:return Au(),u=s.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(s.flags|=8192),u&&(s.mode&1)!==0?(Un&1073741824)!==0&&(mn(s),s.subtreeFlags&6&&(s.flags|=8192)):mn(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function Ew(t,s){switch(Fc(s),s.tag){case 1:return An(s.type)&&va(),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return uo(),Ct(Rn),Ct(pn),Jc(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 5:return Qc(s),null;case 13:if(Ct(Mt),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));io()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return Ct(Mt),null;case 4:return uo(),null;case 10:return Kc(s.type._context),null;case 22:case 23:return Au(),null;case 24:return null;default:return null}}var $a=!1,gn=!1,_w=typeof WeakSet=="function"?WeakSet:Set,je=null;function po(t,s){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(u){Pt(t,s,u)}else i.current=null}function xu(t,s,i){try{i()}catch(u){Pt(t,s,u)}}var Sh=!1;function Rw(t,s){if(Ac=sa,t=ep(),bc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var p=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,_=-1,D=-1,V=0,re=0,ie=t,se=null;t:for(;;){for(var Ne;ie!==i||p!==0&&ie.nodeType!==3||(_=w+p),ie!==g||u!==0&&ie.nodeType!==3||(D=w+u),ie.nodeType===3&&(w+=ie.nodeValue.length),(Ne=ie.firstChild)!==null;)se=ie,ie=Ne;for(;;){if(ie===t)break t;if(se===i&&++V===p&&(_=w),se===g&&++re===u&&(D=w),(Ne=ie.nextSibling)!==null)break;ie=se,se=ie.parentNode}ie=Ne}i=_===-1||D===-1?null:{start:_,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ic={focusedElem:t,selectionRange:i},sa=!1,je=s;je!==null;)if(s=je,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,je=t;else for(;je!==null;){s=je;try{var _e=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Ie=_e.memoizedProps,Ut=_e.memoizedState,W=s.stateNode,$=W.getSnapshotBeforeUpdate(s.elementType===s.type?Ie:as(s.type,Ie),Ut);W.__reactInternalSnapshotBeforeUpdate=$}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(pe){Pt(s,s.return,pe)}if(t=s.sibling,t!==null){t.return=s.return,je=t;break}je=s.return}return _e=Sh,Sh=!1,_e}function di(t,s,i){var u=s.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&t)===t){var g=p.destroy;p.destroy=void 0,g!==void 0&&xu(s,i,g)}p=p.next}while(p!==u)}}function Pa(t,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&t)===t){var u=i.create;i.destroy=u()}i=i.next}while(i!==s)}}function wu(t){var s=t.ref;if(s!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof s=="function"?s(t):s.current=t}}function bh(t){var s=t.alternate;s!==null&&(t.alternate=null,bh(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&(delete s[Ns],delete s[ei],delete s[Oc],delete s[fw],delete s[pw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Nh(t){return t.tag===5||t.tag===3||t.tag===4}function Th(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Nh(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function ku(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.nodeType===8?i.parentNode.insertBefore(t,s):i.insertBefore(t,s):(i.nodeType===8?(s=i.parentNode,s.insertBefore(t,i)):(s=i,s.appendChild(t)),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=ma));else if(u!==4&&(t=t.child,t!==null))for(ku(t,s,i),t=t.sibling;t!==null;)ku(t,s,i),t=t.sibling}function Su(t,s,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?i.insertBefore(t,s):i.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(Su(t,s,i),t=t.sibling;t!==null;)Su(t,s,i),t=t.sibling}var ln=null,ls=!1;function nr(t,s,i){for(i=i.child;i!==null;)Ch(t,s,i),i=i.sibling}function Ch(t,s,i){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(wr,i)}catch{}switch(i.tag){case 5:gn||po(i,s);case 6:var u=ln,p=ls;ln=null,nr(t,s,i),ln=u,ls=p,ln!==null&&(ls?(t=ln,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):ln.removeChild(i.stateNode));break;case 18:ln!==null&&(ls?(t=ln,i=i.stateNode,t.nodeType===8?Lc(t.parentNode,i):t.nodeType===1&&Lc(t,i),Wo(t)):Lc(ln,i.stateNode));break;case 4:u=ln,p=ls,ln=i.stateNode.containerInfo,ls=!0,nr(t,s,i),ln=u,ls=p;break;case 0:case 11:case 14:case 15:if(!gn&&(u=i.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){p=u=u.next;do{var g=p,w=g.destroy;g=g.tag,w!==void 0&&((g&2)!==0||(g&4)!==0)&&xu(i,s,w),p=p.next}while(p!==u)}nr(t,s,i);break;case 1:if(!gn&&(po(i,s),u=i.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=i.memoizedProps,u.state=i.memoizedState,u.componentWillUnmount()}catch(_){Pt(i,s,_)}nr(t,s,i);break;case 21:nr(t,s,i);break;case 22:i.mode&1?(gn=(u=gn)||i.memoizedState!==null,nr(t,s,i),gn=u):nr(t,s,i);break;default:nr(t,s,i)}}function jh(t){var s=t.updateQueue;if(s!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new _w),s.forEach(function(u){var p=zw.bind(null,t,u);i.has(u)||(i.add(u),u.then(p,p))})}}function cs(t,s){var i=s.deletions;if(i!==null)for(var u=0;u<i.length;u++){var p=i[u];try{var g=t,w=s,_=w;e:for(;_!==null;){switch(_.tag){case 5:ln=_.stateNode,ls=!1;break e;case 3:ln=_.stateNode.containerInfo,ls=!0;break e;case 4:ln=_.stateNode.containerInfo,ls=!0;break e}_=_.return}if(ln===null)throw Error(r(160));Ch(g,w,p),ln=null,ls=!1;var D=p.alternate;D!==null&&(D.return=null),p.return=null}catch(V){Pt(p,s,V)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Eh(s,t),s=s.sibling}function Eh(t,s){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(cs(s,t),js(t),u&4){try{di(3,t,t.return),Pa(3,t)}catch(Ie){Pt(t,t.return,Ie)}try{di(5,t,t.return)}catch(Ie){Pt(t,t.return,Ie)}}break;case 1:cs(s,t),js(t),u&512&&i!==null&&po(i,i.return);break;case 5:if(cs(s,t),js(t),u&512&&i!==null&&po(i,i.return),t.flags&32){var p=t.stateNode;try{Pe(p,"")}catch(Ie){Pt(t,t.return,Ie)}}if(u&4&&(p=t.stateNode,p!=null)){var g=t.memoizedProps,w=i!==null?i.memoizedProps:g,_=t.type,D=t.updateQueue;if(t.updateQueue=null,D!==null)try{_==="input"&&g.type==="radio"&&g.name!=null&&He(p,g),rs(_,w);var V=rs(_,g);for(w=0;w<D.length;w+=2){var re=D[w],ie=D[w+1];re==="style"?xn(p,ie):re==="dangerouslySetInnerHTML"?Z(p,ie):re==="children"?Pe(p,ie):P(p,re,ie,V)}switch(_){case"input":Se(p,g);break;case"textarea":we(p,g);break;case"select":var se=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!g.multiple;var Ne=g.value;Ne!=null?kt(p,!!g.multiple,Ne,!1):se!==!!g.multiple&&(g.defaultValue!=null?kt(p,!!g.multiple,g.defaultValue,!0):kt(p,!!g.multiple,g.multiple?[]:"",!1))}p[ei]=g}catch(Ie){Pt(t,t.return,Ie)}}break;case 6:if(cs(s,t),js(t),u&4){if(t.stateNode===null)throw Error(r(162));p=t.stateNode,g=t.memoizedProps;try{p.nodeValue=g}catch(Ie){Pt(t,t.return,Ie)}}break;case 3:if(cs(s,t),js(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{Wo(s.containerInfo)}catch(Ie){Pt(t,t.return,Ie)}break;case 4:cs(s,t),js(t);break;case 13:cs(s,t),js(t),p=t.child,p.flags&8192&&(g=p.memoizedState!==null,p.stateNode.isHidden=g,!g||p.alternate!==null&&p.alternate.memoizedState!==null||(Tu=At())),u&4&&jh(t);break;case 22:if(re=i!==null&&i.memoizedState!==null,t.mode&1?(gn=(V=gn)||re,cs(s,t),gn=V):cs(s,t),js(t),u&8192){if(V=t.memoizedState!==null,(t.stateNode.isHidden=V)&&!re&&(t.mode&1)!==0)for(je=t,re=t.child;re!==null;){for(ie=je=re;je!==null;){switch(se=je,Ne=se.child,se.tag){case 0:case 11:case 14:case 15:di(4,se,se.return);break;case 1:po(se,se.return);var _e=se.stateNode;if(typeof _e.componentWillUnmount=="function"){u=se,i=se.return;try{s=u,_e.props=s.memoizedProps,_e.state=s.memoizedState,_e.componentWillUnmount()}catch(Ie){Pt(u,i,Ie)}}break;case 5:po(se,se.return);break;case 22:if(se.memoizedState!==null){Ah(ie);continue}}Ne!==null?(Ne.return=se,je=Ne):Ah(ie)}re=re.sibling}e:for(re=null,ie=t;;){if(ie.tag===5){if(re===null){re=ie;try{p=ie.stateNode,V?(g=p.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(_=ie.stateNode,D=ie.memoizedProps.style,w=D!=null&&D.hasOwnProperty("display")?D.display:null,_.style.display=yn("display",w))}catch(Ie){Pt(t,t.return,Ie)}}}else if(ie.tag===6){if(re===null)try{ie.stateNode.nodeValue=V?"":ie.memoizedProps}catch(Ie){Pt(t,t.return,Ie)}}else if((ie.tag!==22&&ie.tag!==23||ie.memoizedState===null||ie===t)&&ie.child!==null){ie.child.return=ie,ie=ie.child;continue}if(ie===t)break e;for(;ie.sibling===null;){if(ie.return===null||ie.return===t)break e;re===ie&&(re=null),ie=ie.return}re===ie&&(re=null),ie.sibling.return=ie.return,ie=ie.sibling}}break;case 19:cs(s,t),js(t),u&4&&jh(t);break;case 21:break;default:cs(s,t),js(t)}}function js(t){var s=t.flags;if(s&2){try{e:{for(var i=t.return;i!==null;){if(Nh(i)){var u=i;break e}i=i.return}throw Error(r(160))}switch(u.tag){case 5:var p=u.stateNode;u.flags&32&&(Pe(p,""),u.flags&=-33);var g=Th(t);Su(t,g,p);break;case 3:case 4:var w=u.stateNode.containerInfo,_=Th(t);ku(t,_,w);break;default:throw Error(r(161))}}catch(D){Pt(t,t.return,D)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Aw(t,s,i){je=t,_h(t)}function _h(t,s,i){for(var u=(t.mode&1)!==0;je!==null;){var p=je,g=p.child;if(p.tag===22&&u){var w=p.memoizedState!==null||$a;if(!w){var _=p.alternate,D=_!==null&&_.memoizedState!==null||gn;_=$a;var V=gn;if($a=w,(gn=D)&&!V)for(je=p;je!==null;)w=je,D=w.child,w.tag===22&&w.memoizedState!==null?Ih(p):D!==null?(D.return=w,je=D):Ih(p);for(;g!==null;)je=g,_h(g),g=g.sibling;je=p,$a=_,gn=V}Rh(t)}else(p.subtreeFlags&8772)!==0&&g!==null?(g.return=p,je=g):Rh(t)}}function Rh(t){for(;je!==null;){var s=je;if((s.flags&8772)!==0){var i=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:gn||Pa(5,s);break;case 1:var u=s.stateNode;if(s.flags&4&&!gn)if(i===null)u.componentDidMount();else{var p=s.elementType===s.type?i.memoizedProps:as(s.type,i.memoizedProps);u.componentDidUpdate(p,i.memoizedState,u.__reactInternalSnapshotBeforeUpdate)}var g=s.updateQueue;g!==null&&Ap(s,g,u);break;case 3:var w=s.updateQueue;if(w!==null){if(i=null,s.child!==null)switch(s.child.tag){case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}Ap(s,w,i)}break;case 5:var _=s.stateNode;if(i===null&&s.flags&4){i=_;var D=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.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 re=V.memoizedState;if(re!==null){var ie=re.dehydrated;ie!==null&&Wo(ie)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gn||s.flags&512&&wu(s)}catch(se){Pt(s,s.return,se)}}if(s===t){je=null;break}if(i=s.sibling,i!==null){i.return=s.return,je=i;break}je=s.return}}function Ah(t){for(;je!==null;){var s=je;if(s===t){je=null;break}var i=s.sibling;if(i!==null){i.return=s.return,je=i;break}je=s.return}}function Ih(t){for(;je!==null;){var s=je;try{switch(s.tag){case 0:case 11:case 15:var i=s.return;try{Pa(4,s)}catch(D){Pt(s,i,D)}break;case 1:var u=s.stateNode;if(typeof u.componentDidMount=="function"){var p=s.return;try{u.componentDidMount()}catch(D){Pt(s,p,D)}}var g=s.return;try{wu(s)}catch(D){Pt(s,g,D)}break;case 5:var w=s.return;try{wu(s)}catch(D){Pt(s,w,D)}}}catch(D){Pt(s,s.return,D)}if(s===t){je=null;break}var _=s.sibling;if(_!==null){_.return=s.return,je=_;break}je=s.return}}var Iw=Math.ceil,za=L.ReactCurrentDispatcher,bu=L.ReactCurrentOwner,Qn=L.ReactCurrentBatchConfig,rt=0,tn=null,Ht=null,cn=0,Un=0,ho=Qs(0),Qt=0,fi=null,Ir=0,Fa=0,Nu=0,pi=null,Dn=null,Tu=0,mo=1/0,zs=null,Ua=!1,Cu=null,sr=null,Ba=!1,rr=null,Wa=0,hi=0,ju=null,Ha=-1,Va=0;function Nn(){return(rt&6)!==0?At():Ha!==-1?Ha:Ha=At()}function or(t){return(t.mode&1)===0?1:(rt&2)!==0&&cn!==0?cn&-cn:mw.transition!==null?(Va===0&&(Va=zo()),Va):(t=nt,t!==0||(t=window.event,t=t===void 0?16:Mf(t.type)),t)}function us(t,s,i,u){if(50<hi)throw hi=0,ju=null,Error(r(185));Nr(t,i,u),((rt&2)===0||t!==tn)&&(t===tn&&((rt&2)===0&&(Fa|=i),Qt===4&&ir(t,cn)),Mn(t,u),i===1&&rt===0&&(s.mode&1)===0&&(mo=At()+500,xa&&Js()))}function Mn(t,s){var i=t.callbackNode;ea(t,s);var u=br(t,t===tn?cn:0);if(u===0)i!==null&&lt(i),t.callbackNode=null,t.callbackPriority=0;else if(s=u&-u,t.callbackPriority!==s){if(i!=null&&lt(i),s===1)t.tag===0?hw(Mh.bind(null,t)):xp(Mh.bind(null,t)),uw(function(){(rt&6)===0&&Js()}),i=null;else{switch(fe(u)){case 1:i=Hs;break;case 4:i=bs;break;case 16:i=Hr;break;case 536870912:i=Zi;break;default:i=Hr}i=Bh(i,Dh.bind(null,t))}t.callbackPriority=s,t.callbackNode=i}}function Dh(t,s){if(Ha=-1,Va=0,(rt&6)!==0)throw Error(r(327));var i=t.callbackNode;if(go()&&t.callbackNode!==i)return null;var u=br(t,t===tn?cn:0);if(u===0)return null;if((u&30)!==0||(u&t.expiredLanes)!==0||s)s=Ka(t,u);else{s=u;var p=rt;rt|=2;var g=Oh();(tn!==t||cn!==s)&&(zs=null,mo=At()+500,Mr(t,s));do try{Lw();break}catch(_){Lh(t,_)}while(!0);Vc(),za.current=g,rt=p,Ht!==null?s=0:(tn=null,cn=0,s=Qt)}if(s!==0){if(s===2&&(p=Po(t),p!==0&&(u=p,s=Eu(t,p))),s===1)throw i=fi,Mr(t,0),ir(t,u),Mn(t,At()),i;if(s===6)ir(t,u);else{if(p=t.current.alternate,(u&30)===0&&!Dw(p)&&(s=Ka(t,u),s===2&&(g=Po(t),g!==0&&(u=g,s=Eu(t,g))),s===1))throw i=fi,Mr(t,0),ir(t,u),Mn(t,At()),i;switch(t.finishedWork=p,t.finishedLanes=u,s){case 0:case 1:throw Error(r(345));case 2:Lr(t,Dn,zs);break;case 3:if(ir(t,u),(u&130023424)===u&&(s=Tu+500-At(),10<s)){if(br(t,0)!==0)break;if(p=t.suspendedLanes,(p&u)!==u){Nn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Mc(Lr.bind(null,t,Dn,zs),s);break}Lr(t,Dn,zs);break;case 4:if(ir(t,u),(u&4194240)===u)break;for(s=t.eventTimes,p=-1;0<u;){var w=31-kn(u);g=1<<w,w=s[w],w>p&&(p=w),u&=~g}if(u=p,u=At()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Iw(u/1960))-u,10<u){t.timeoutHandle=Mc(Lr.bind(null,t,Dn,zs),u);break}Lr(t,Dn,zs);break;case 5:Lr(t,Dn,zs);break;default:throw Error(r(329))}}}return Mn(t,At()),t.callbackNode===i?Dh.bind(null,t):null}function Eu(t,s){var i=pi;return t.current.memoizedState.isDehydrated&&(Mr(t,s).flags|=256),t=Ka(t,s),t!==2&&(s=Dn,Dn=i,s!==null&&_u(s)),t}function _u(t){Dn===null?Dn=t:Dn.push.apply(Dn,t)}function Dw(t){for(var s=t;;){if(s.flags&16384){var i=s.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var u=0;u<i.length;u++){var p=i[u],g=p.getSnapshot;p=p.value;try{if(!os(g(),p))return!1}catch{return!1}}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ir(t,s){for(s&=~Nu,s&=~Fa,t.suspendedLanes|=s,t.pingedLanes&=~s,t=t.expirationTimes;0<s;){var i=31-kn(s),u=1<<i;t[i]=-1,s&=~u}}function Mh(t){if((rt&6)!==0)throw Error(r(327));go();var s=br(t,0);if((s&1)===0)return Mn(t,At()),null;var i=Ka(t,s);if(t.tag!==0&&i===2){var u=Po(t);u!==0&&(s=u,i=Eu(t,u))}if(i===1)throw i=fi,Mr(t,0),ir(t,s),Mn(t,At()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=s,Lr(t,Dn,zs),Mn(t,At()),null}function Ru(t,s){var i=rt;rt|=1;try{return t(s)}finally{rt=i,rt===0&&(mo=At()+500,xa&&Js())}}function Dr(t){rr!==null&&rr.tag===0&&(rt&6)===0&&go();var s=rt;rt|=1;var i=Qn.transition,u=nt;try{if(Qn.transition=null,nt=1,t)return t()}finally{nt=u,Qn.transition=i,rt=s,(rt&6)===0&&Js()}}function Au(){Un=ho.current,Ct(ho)}function Mr(t,s){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,cw(i)),Ht!==null)for(i=Ht.return;i!==null;){var u=i;switch(Fc(u),u.tag){case 1:u=u.type.childContextTypes,u!=null&&va();break;case 3:uo(),Ct(Rn),Ct(pn),Jc();break;case 5:Qc(u);break;case 4:uo();break;case 13:Ct(Mt);break;case 19:Ct(Mt);break;case 10:Kc(u.type._context);break;case 22:case 23:Au()}i=i.return}if(tn=t,Ht=t=ar(t.current,null),cn=Un=s,Qt=0,fi=null,Nu=Fa=Ir=0,Dn=pi=null,_r!==null){for(s=0;s<_r.length;s++)if(i=_r[s],u=i.interleaved,u!==null){i.interleaved=null;var p=u.next,g=i.pending;if(g!==null){var w=g.next;g.next=p,u.next=w}i.pending=u}_r=null}return t}function Lh(t,s){do{var i=Ht;try{if(Vc(),_a.current=Da,Ra){for(var u=Lt.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}Ra=!1}if(Ar=0,en=Yt=Lt=null,ii=!1,ai=0,bu.current=null,i===null||i.return===null){Qt=1,fi=s,Ht=null;break}e:{var g=t,w=i.return,_=i,D=s;if(s=cn,_.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var V=D,re=_,ie=re.tag;if((re.mode&1)===0&&(ie===0||ie===11||ie===15)){var se=re.alternate;se?(re.updateQueue=se.updateQueue,re.memoizedState=se.memoizedState,re.lanes=se.lanes):(re.updateQueue=null,re.memoizedState=null)}var Ne=ih(w);if(Ne!==null){Ne.flags&=-257,ah(Ne,w,_,g,s),Ne.mode&1&&oh(g,V,s),s=Ne,D=V;var _e=s.updateQueue;if(_e===null){var Ie=new Set;Ie.add(D),s.updateQueue=Ie}else _e.add(D);break e}else{if((s&1)===0){oh(g,V,s),Iu();break e}D=Error(r(426))}}else if(_t&&_.mode&1){var Ut=ih(w);if(Ut!==null){(Ut.flags&65536)===0&&(Ut.flags|=256),ah(Ut,w,_,g,s),Wc(fo(D,_));break e}}g=D=fo(D,_),Qt!==4&&(Qt=2),pi===null?pi=[g]:pi.push(g),g=w;do{switch(g.tag){case 3:g.flags|=65536,s&=-s,g.lanes|=s;var W=sh(g,D,s);Rp(g,W);break e;case 1:_=D;var $=g.type,H=g.stateNode;if((g.flags&128)===0&&(typeof $.getDerivedStateFromError=="function"||H!==null&&typeof H.componentDidCatch=="function"&&(sr===null||!sr.has(H)))){g.flags|=65536,s&=-s,g.lanes|=s;var pe=rh(g,_,s);Rp(g,pe);break e}}g=g.return}while(g!==null)}Ph(i)}catch(De){s=De,Ht===i&&i!==null&&(Ht=i=i.return);continue}break}while(!0)}function Oh(){var t=za.current;return za.current=Da,t===null?Da:t}function Iu(){(Qt===0||Qt===3||Qt===2)&&(Qt=4),tn===null||(Ir&268435455)===0&&(Fa&268435455)===0||ir(tn,cn)}function Ka(t,s){var i=rt;rt|=2;var u=Oh();(tn!==t||cn!==s)&&(zs=null,Mr(t,s));do try{Mw();break}catch(p){Lh(t,p)}while(!0);if(Vc(),rt=i,za.current=u,Ht!==null)throw Error(r(261));return tn=null,cn=0,Qt}function Mw(){for(;Ht!==null;)$h(Ht)}function Lw(){for(;Ht!==null&&!zt();)$h(Ht)}function $h(t){var s=Uh(t.alternate,t,Un);t.memoizedProps=t.pendingProps,s===null?Ph(t):Ht=s,bu.current=null}function Ph(t){var s=t;do{var i=s.alternate;if(t=s.return,(s.flags&32768)===0){if(i=jw(i,s,Un),i!==null){Ht=i;return}}else{if(i=Ew(i,s),i!==null){i.flags&=32767,Ht=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Qt=6,Ht=null;return}}if(s=s.sibling,s!==null){Ht=s;return}Ht=s=t}while(s!==null);Qt===0&&(Qt=5)}function Lr(t,s,i){var u=nt,p=Qn.transition;try{Qn.transition=null,nt=1,Ow(t,s,i,u)}finally{Qn.transition=p,nt=u}return null}function Ow(t,s,i,u){do go();while(rr!==null);if((rt&6)!==0)throw Error(r(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var g=i.lanes|i.childLanes;if(ta(t,g),t===tn&&(Ht=tn=null,cn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Ba||(Ba=!0,Bh(Hr,function(){return go(),null})),g=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||g){g=Qn.transition,Qn.transition=null;var w=nt;nt=1;var _=rt;rt|=4,bu.current=null,Rw(t,i),Eh(i,t),nw(Ic),sa=!!Ac,Ic=Ac=null,t.current=i,Aw(i),ks(),rt=_,nt=w,Qn.transition=g}else t.current=i;if(Ba&&(Ba=!1,rr=t,Wa=p),g=t.pendingLanes,g===0&&(sr=null),Vr(i.stateNode),Mn(t,At()),s!==null)for(u=t.onRecoverableError,i=0;i<s.length;i++)p=s[i],u(p.value,{componentStack:p.stack,digest:p.digest});if(Ua)throw Ua=!1,t=Cu,Cu=null,t;return(Wa&1)!==0&&t.tag!==0&&go(),g=t.pendingLanes,(g&1)!==0?t===ju?hi++:(hi=0,ju=t):hi=0,Js(),null}function go(){if(rr!==null){var t=fe(Wa),s=Qn.transition,i=nt;try{if(Qn.transition=null,nt=16>t?16:t,rr===null)var u=!1;else{if(t=rr,rr=null,Wa=0,(rt&6)!==0)throw Error(r(331));var p=rt;for(rt|=4,je=t.current;je!==null;){var g=je,w=g.child;if((je.flags&16)!==0){var _=g.deletions;if(_!==null){for(var D=0;D<_.length;D++){var V=_[D];for(je=V;je!==null;){var re=je;switch(re.tag){case 0:case 11:case 15:di(8,re,g)}var ie=re.child;if(ie!==null)ie.return=re,je=ie;else for(;je!==null;){re=je;var se=re.sibling,Ne=re.return;if(bh(re),re===V){je=null;break}if(se!==null){se.return=Ne,je=se;break}je=Ne}}}var _e=g.alternate;if(_e!==null){var Ie=_e.child;if(Ie!==null){_e.child=null;do{var Ut=Ie.sibling;Ie.sibling=null,Ie=Ut}while(Ie!==null)}}je=g}}if((g.subtreeFlags&2064)!==0&&w!==null)w.return=g,je=w;else e:for(;je!==null;){if(g=je,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:di(9,g,g.return)}var W=g.sibling;if(W!==null){W.return=g.return,je=W;break e}je=g.return}}var $=t.current;for(je=$;je!==null;){w=je;var H=w.child;if((w.subtreeFlags&2064)!==0&&H!==null)H.return=w,je=H;else e:for(w=$;je!==null;){if(_=je,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Pa(9,_)}}catch(De){Pt(_,_.return,De)}if(_===w){je=null;break e}var pe=_.sibling;if(pe!==null){pe.return=_.return,je=pe;break e}je=_.return}}if(rt=p,Js(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(wr,t)}catch{}u=!0}return u}finally{nt=i,Qn.transition=s}}return!1}function zh(t,s,i){s=fo(i,s),s=sh(t,s,1),t=tr(t,s,1),s=Nn(),t!==null&&(Nr(t,1,s),Mn(t,s))}function Pt(t,s,i){if(t.tag===3)zh(t,t,i);else for(;s!==null;){if(s.tag===3){zh(s,t,i);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(sr===null||!sr.has(u))){t=fo(i,t),t=rh(s,t,1),s=tr(s,t,1),t=Nn(),s!==null&&(Nr(s,1,t),Mn(s,t));break}}s=s.return}}function $w(t,s,i){var u=t.pingCache;u!==null&&u.delete(s),s=Nn(),t.pingedLanes|=t.suspendedLanes&i,tn===t&&(cn&i)===i&&(Qt===4||Qt===3&&(cn&130023424)===cn&&500>At()-Tu?Mr(t,0):Nu|=i),Mn(t,s)}function Fh(t,s){s===0&&((t.mode&1)===0?s=1:(s=Gr,Gr<<=1,(Gr&130023424)===0&&(Gr=4194304)));var i=Nn();t=Os(t,s),t!==null&&(Nr(t,s,i),Mn(t,i))}function Pw(t){var s=t.memoizedState,i=0;s!==null&&(i=s.retryLane),Fh(t,i)}function zw(t,s){var i=0;switch(t.tag){case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(r(314))}u!==null&&u.delete(s),Fh(t,i)}var Uh;Uh=function(t,s,i){if(t!==null)if(t.memoizedProps!==s.pendingProps||Rn.current)In=!0;else{if((t.lanes&i)===0&&(s.flags&128)===0)return In=!1,Cw(t,s,i);In=(t.flags&131072)!==0}else In=!1,_t&&(s.flags&1048576)!==0&&wp(s,ka,s.index);switch(s.lanes=0,s.tag){case 2:var u=s.type;Oa(t,s),t=s.pendingProps;var p=so(s,pn.current);co(s,i),p=nu(null,s,u,t,p,i);var g=su();return s.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,An(u)?(g=!0,ya(s)):g=!1,s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Xc(s),p.updater=Ma,s.stateNode=p,p._reactInternals=s,cu(s,u,t,i),s=pu(null,s,u,!0,g,i)):(s.tag=0,_t&&g&&zc(s),bn(null,s,p,i),s=s.child),s;case 16:u=s.elementType;e:{switch(Oa(t,s),t=s.pendingProps,p=u._init,u=p(u._payload),s.type=u,p=s.tag=Uw(u),t=as(u,t),p){case 0:s=fu(null,s,u,t,i);break e;case 1:s=ph(null,s,u,t,i);break e;case 11:s=lh(null,s,u,t,i);break e;case 14:s=ch(null,s,u,as(u.type,t),i);break e}throw Error(r(306,u,""))}return s;case 0:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),fu(t,s,u,p,i);case 1:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),ph(t,s,u,p,i);case 3:e:{if(hh(s),t===null)throw Error(r(387));u=s.pendingProps,g=s.memoizedState,p=g.element,_p(t,s),ja(s,u,null,i);var w=s.memoizedState;if(u=w.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){p=fo(Error(r(423)),s),s=mh(t,s,u,i,p);break e}else if(u!==p){p=fo(Error(r(424)),s),s=mh(t,s,u,i,p);break e}else for(Fn=Ys(s.stateNode.containerInfo.firstChild),zn=s,_t=!0,is=null,i=jp(s,null,u,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(io(),u===p){s=Ps(t,s,i);break e}bn(t,s,u,i)}s=s.child}return s;case 5:return Ip(s),t===null&&Bc(s),u=s.type,p=s.pendingProps,g=t!==null?t.memoizedProps:null,w=p.children,Dc(u,p)?w=null:g!==null&&Dc(u,g)&&(s.flags|=32),fh(t,s),bn(t,s,w,i),s.child;case 6:return t===null&&Bc(s),null;case 13:return gh(t,s,i);case 4:return Yc(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=ao(s,null,u,i):bn(t,s,u,i),s.child;case 11:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),lh(t,s,u,p,i);case 7:return bn(t,s,s.pendingProps,i),s.child;case 8:return bn(t,s,s.pendingProps.children,i),s.child;case 12:return bn(t,s,s.pendingProps.children,i),s.child;case 10:e:{if(u=s.type._context,p=s.pendingProps,g=s.memoizedProps,w=p.value,wt(Na,u._currentValue),u._currentValue=w,g!==null)if(os(g.value,w)){if(g.children===p.children&&!Rn.current){s=Ps(t,s,i);break e}}else for(g=s.child,g!==null&&(g.return=s);g!==null;){var _=g.dependencies;if(_!==null){w=g.child;for(var D=_.firstContext;D!==null;){if(D.context===u){if(g.tag===1){D=$s(-1,i&-i),D.tag=2;var V=g.updateQueue;if(V!==null){V=V.shared;var re=V.pending;re===null?D.next=D:(D.next=re.next,re.next=D),V.pending=D}}g.lanes|=i,D=g.alternate,D!==null&&(D.lanes|=i),Gc(g.return,i,s),_.lanes|=i;break}D=D.next}}else if(g.tag===10)w=g.type===s.type?null:g.child;else if(g.tag===18){if(w=g.return,w===null)throw Error(r(341));w.lanes|=i,_=w.alternate,_!==null&&(_.lanes|=i),Gc(w,i,s),w=g.sibling}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===s){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}bn(t,s,p.children,i),s=s.child}return s;case 9:return p=s.type,u=s.pendingProps.children,co(s,i),p=Xn(p),u=u(p),s.flags|=1,bn(t,s,u,i),s.child;case 14:return u=s.type,p=as(u,s.pendingProps),p=as(u.type,p),ch(t,s,u,p,i);case 15:return uh(t,s,s.type,s.pendingProps,i);case 17:return u=s.type,p=s.pendingProps,p=s.elementType===u?p:as(u,p),Oa(t,s),s.tag=1,An(u)?(t=!0,ya(s)):t=!1,co(s,i),th(s,u,p),cu(s,u,p,i),pu(null,s,u,!0,t,i);case 19:return yh(t,s,i);case 22:return dh(t,s,i)}throw Error(r(156,s.tag))};function Bh(t,s){return ws(t,s)}function Fw(t,s,i,u){this.tag=t,this.key=i,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(t,s,i,u){return new Fw(t,s,i,u)}function Du(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Uw(t){if(typeof t=="function")return Du(t)?1:0;if(t!=null){if(t=t.$$typeof,t===me)return 11;if(t===Te)return 14}return 2}function ar(t,s){var i=t.alternate;return i===null?(i=Zn(t.tag,s,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=s,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,s=t.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Ga(t,s,i,u,p,g){var w=2;if(u=t,typeof t=="function")Du(t)&&(w=1);else if(typeof t=="string")w=5;else e:switch(t){case F:return Or(i.children,p,g,s);case O:w=8,p|=8;break;case Q:return t=Zn(12,i,s,p|2),t.elementType=Q,t.lanes=g,t;case ke:return t=Zn(13,i,s,p),t.elementType=ke,t.lanes=g,t;case Le:return t=Zn(19,i,s,p),t.elementType=Le,t.lanes=g,t;case ee:return qa(i,p,g,s);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case J:w=10;break e;case te:w=9;break e;case me:w=11;break e;case Te:w=14;break e;case oe:w=16,u=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return s=Zn(w,i,s,p),s.elementType=t,s.type=u,s.lanes=g,s}function Or(t,s,i,u){return t=Zn(7,t,u,s),t.lanes=i,t}function qa(t,s,i,u){return t=Zn(22,t,u,s),t.elementType=ee,t.lanes=i,t.stateNode={isHidden:!1},t}function Mu(t,s,i){return t=Zn(6,t,null,s),t.lanes=i,t}function Lu(t,s,i){return s=Zn(4,t.children!==null?t.children:[],t.key,s),s.lanes=i,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}function Bw(t,s,i,u,p){this.tag=s,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fo(0),this.expirationTimes=Fo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fo(0),this.identifierPrefix=u,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Ou(t,s,i,u,p,g,w,_,D){return t=new Bw(t,s,i,_,D),s===1?(s=1,g===!0&&(s|=8)):s=0,g=Zn(3,null,null,s),t.current=g,g.stateNode=t,g.memoizedState={element:u,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xc(g),t}function Ww(t,s,i){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:q,key:u==null?null:""+u,children:t,containerInfo:s,implementation:i}}function Wh(t){if(!t)return Zs;t=t._reactInternals;e:{if(Ke(t)!==t||t.tag!==1)throw Error(r(170));var s=t;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(An(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if(An(i))return vp(t,i,s)}return s}function Hh(t,s,i,u,p,g,w,_,D){return t=Ou(i,u,!0,t,p,g,w,_,D),t.context=Wh(null),i=t.current,u=Nn(),p=or(i),g=$s(u,p),g.callback=s??null,tr(i,g,p),t.current.lanes=p,Nr(t,p,u),Mn(t,u),t}function Xa(t,s,i,u){var p=s.current,g=Nn(),w=or(p);return i=Wh(i),s.context===null?s.context=i:s.pendingContext=i,s=$s(g,w),s.payload={element:t},u=u===void 0?null:u,u!==null&&(s.callback=u),t=tr(p,s,w),t!==null&&(us(t,p,w,g),Ca(t,p,w)),w}function Ya(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Vh(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<s?i:s}}function $u(t,s){Vh(t,s),(t=t.alternate)&&Vh(t,s)}function Hw(){return null}var Kh=typeof reportError=="function"?reportError:function(t){console.error(t)};function Pu(t){this._internalRoot=t}Qa.prototype.render=Pu.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));Xa(t,s,null,null)},Qa.prototype.unmount=Pu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Dr(function(){Xa(null,t,null,null)}),s[Is]=null}};function Qa(t){this._internalRoot=t}Qa.prototype.unstable_scheduleHydration=function(t){if(t){var s=Re();t={blockedOn:null,target:t,priority:s};for(var i=0;i<Gs.length&&s!==0&&s<Gs[i].priority;i++);Gs.splice(i,0,t),i===0&&If(t)}};function zu(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Za(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Gh(){}function Vw(t,s,i,u,p){if(p){if(typeof u=="function"){var g=u;u=function(){var V=Ya(w);g.call(V)}}var w=Hh(s,u,t,0,null,!1,!1,"",Gh);return t._reactRootContainer=w,t[Is]=w.current,Zo(t.nodeType===8?t.parentNode:t),Dr(),w}for(;p=t.lastChild;)t.removeChild(p);if(typeof u=="function"){var _=u;u=function(){var V=Ya(D);_.call(V)}}var D=Ou(t,0,!1,null,null,!1,!1,"",Gh);return t._reactRootContainer=D,t[Is]=D.current,Zo(t.nodeType===8?t.parentNode:t),Dr(function(){Xa(s,D,i,u)}),D}function Ja(t,s,i,u,p){var g=i._reactRootContainer;if(g){var w=g;if(typeof p=="function"){var _=p;p=function(){var D=Ya(w);_.call(D)}}Xa(s,w,t,p)}else w=Vw(i,s,t,p,u);return Ya(w)}C=function(t){switch(t.tag){case 3:var s=t.stateNode;if(s.current.memoizedState.isDehydrated){var i=Sr(s.pendingLanes);i!==0&&(Ks(s,i|1),Mn(s,At()),(rt&6)===0&&(mo=At()+500,Js()))}break;case 13:Dr(function(){var u=Os(t,1);if(u!==null){var p=Nn();us(u,t,1,p)}}),$u(t,1)}},B=function(t){if(t.tag===13){var s=Os(t,134217728);if(s!==null){var i=Nn();us(s,t,134217728,i)}$u(t,134217728)}},ne=function(t){if(t.tag===13){var s=or(t),i=Os(t,s);if(i!==null){var u=Nn();us(i,t,s,u)}$u(t,s)}},Re=function(){return nt},Me=function(t,s){var i=nt;try{return nt=t,s()}finally{nt=i}},Wt=function(t,s,i){switch(s){case"input":if(Se(t,i),s=i.name,i.type==="radio"&&s!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<i.length;s++){var u=i[s];if(u!==t&&u.form===t.form){var p=ga(u);if(!p)throw Error(r(90));le(u),Se(u,p)}}}break;case"textarea":we(t,i);break;case"select":s=i.value,s!=null&&kt(t,!!i.multiple,s,!1)}},Et=Ru,Nt=Dr;var Kw={usingClientEntryPoint:!1,Events:[ti,to,ga,Rt,Kt,Ru]},mi={findFiberByHostInstance:Tr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Gw={bundleType:mi.bundleType,version:mi.version,rendererPackageName:mi.rendererPackageName,rendererConfig:mi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:L.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=xs(t),t===null?null:t.stateNode},findFiberByHostInstance:mi.findFiberByHostInstance||Hw,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 el=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!el.isDisabled&&el.supportsFiber)try{wr=el.inject(Gw),$n=el}catch{}}return Ln.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kw,Ln.createPortal=function(t,s){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!zu(s))throw Error(r(200));return Ww(t,s,null,i)},Ln.createRoot=function(t,s){if(!zu(t))throw Error(r(299));var i=!1,u="",p=Kh;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onRecoverableError!==void 0&&(p=s.onRecoverableError)),s=Ou(t,1,!1,null,null,i,!1,u,p),t[Is]=s.current,Zo(t.nodeType===8?t.parentNode:t),new Pu(s)},Ln.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=xs(s),t=t===null?null:t.stateNode,t},Ln.flushSync=function(t){return Dr(t)},Ln.hydrate=function(t,s,i){if(!Za(s))throw Error(r(200));return Ja(null,t,s,!0,i)},Ln.hydrateRoot=function(t,s,i){if(!zu(t))throw Error(r(405));var u=i!=null&&i.hydratedSources||null,p=!1,g="",w=Kh;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),s=Hh(s,null,t,1,i??null,p,!1,g,w),t[Is]=s.current,Zo(t),u)for(t=0;t<u.length;t++)i=u[t],p=i._getVersion,p=p(i._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[i,p]:s.mutableSourceEagerHydrationData.push(i,p);return new Qa(s)},Ln.render=function(t,s,i){if(!Za(s))throw Error(r(200));return Ja(null,t,s,!1,i)},Ln.unmountComponentAtNode=function(t){if(!Za(t))throw Error(r(40));return t._reactRootContainer?(Dr(function(){Ja(null,null,t,!1,function(){t._reactRootContainer=null,t[Is]=null})}),!0):!1},Ln.unstable_batchedUpdates=Ru,Ln.unstable_renderSubtreeIntoContainer=function(t,s,i,u){if(!Za(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Ja(t,s,i,!1,u)},Ln.version="18.3.1-next-f1338f8080-20240426",Ln}var tm;function av(){if(tm)return Bu.exports;tm=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Bu.exports=n0(),Bu.exports}var nm;function s0(){if(nm)return tl;nm=1;var e=av();return tl.createRoot=e.createRoot,tl.hydrateRoot=e.hydrateRoot,tl}var r0=s0();const o0=iv(r0),sm=e=>{let n;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(n):m;if(!Object.is(k,n)){const x=n;n=v??(typeof k!="object"||k===null)?k:Object.assign({},n,k),r.forEach(S=>S(n,x))}},l=()=>n,f={setState:o,getState:l,getInitialState:()=>h,subscribe:m=>(r.add(m),()=>r.delete(m))},h=n=e(o,l,f);return f},i0=(e=>e?sm(e):sm),a0=e=>e;function l0(e,n=a0){const r=vt.useSyncExternalStore(e.subscribe,vt.useCallback(()=>n(e.getState()),[e,n]),vt.useCallback(()=>n(e.getInitialState()),[e,n]));return vt.useDebugValue(r),r}const c0=e=>{const n=i0(e),r=o=>l0(n,o);return Object.assign(r,n),r},u0=(e=>c0),lv="agentpane:machines",cv="agentpane:active-machine";function d0(e){return/^[a-z][a-z0-9-]{1,30}$/.test(e)}function uv(e){return`${e}.repoburg.com`}function dv(e){const n=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(e);return n?n[1]:null}function fv(e,n){try{const r=localStorage.getItem(e);return r==null?n:JSON.parse(r)}catch{return n}}function pv(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function f0(e){const{mahlas:n,hostname:r}=e??{};return typeof n=="string"&&d0(n)&&r===uv(n)}function hv(){const e=fv(lv,[]);return Array.isArray(e)?e.filter(f0):[]}function p0(e){const n={mahlas:e,hostname:uv(e),lastConnectedAt:new Date().toISOString()},r=hv(),o=[n,...r.filter(l=>l.mahlas!==e)];return pv(lv,o),n}function h0(){const e=fv(cv,null);return e?hv().find(n=>n.mahlas===e)??null:null}function m0(e){pv(cv,e)}function g0(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("host");if(!e)return;const n=dv(e);n&&(p0(n),m0(n))}const rm="http://localhost:9998",v0=["agent.repoburg.com"];function gt(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search),n=e.get("bport");if(n)return`http://localhost:${n}`;const r=e.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(v0.includes(o))return rm;if(dv(o))return"";const l=h0();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":rm}function y0(e){const n=gt();return n?`${n.replace(/^http/,"ws")}${e}`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}${e}`}const x0="/api";class Br extends Error{constructor(r,o,l){super(r);ht(this,"status");ht(this,"body");this.name="ApiError",this.status=o,this.body=l}}function Vn(e){var n;if(e instanceof Br){const r=(n=e.body)==null?void 0:n.error;if(typeof r=="string"&&r)return r}return e instanceof Error?e.message:String(e)}async function Wi(e,n,r){const o=await fetch(`${gt()}${x0}${n}`,{method:e,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,c=null;try{c=await o.json();const d=c==null?void 0:c.error;typeof d=="string"&&d&&(l=`${l} — ${d}`)}catch{}throw new Br(`${e} ${n} failed: ${l}`,o.status,c)}return o.json()}function jt(e){return Wi("GET",e)}function ut(e,n){return Wi("POST",e,n)}function Hi(e){return Wi("DELETE",e)}function ms(e,n){return Wi("PATCH",e,n)}function mv(e,n){return Wi("PUT",e,n)}function w0(e){return`stream-text-${e}`}const hs=new Map;function bl(e,n,r){return`${e}
42
42
  ${n}
43
- ${r}`}function y0(e,n,r,o){const l=bl(e,n,r),c=hs.get(l);return c?(c.text+=o,c.text):(hs.set(l,{sessionId:e,turnId:n,itemId:r,text:o}),o)}function x0(e,n){for(const[o,l]of hs)(e===null||l.sessionId===e)&&hs.delete(o);const r=n.filter(o=>o&&typeof o.sessionId=="string"&&typeof o.turnId=="string"&&typeof o.itemId=="string"&&typeof o.text=="string");for(const o of r)hs.set(bl(o.sessionId,o.turnId,o.itemId),{...o});return r}function Vu(e,n,r){var c;const o=r==null?void 0:r.external_item_id;if(!r||!o)return;const l=bl(e,n,o);if(r.status==="in_progress"){const d=(c=r.data)==null?void 0:c.text;typeof d=="string"&&hs.set(l,{sessionId:e,turnId:n,itemId:o,text:d});return}hs.delete(l),r.type==="agent_message"&&hs.delete(bl(e,n,v0(n)))}function vi(e,n){for(const[r,o]of hs)o.sessionId===e&&o.turnId===n&&hs.delete(r)}function pv(e,n,r){var f;const o=e.items??[];let l=-1;for(let h=o.length-1;h>=0;h--)if(o[h].external_item_id===n){l=h;break}if(l>=0){const h=o[l];if(h.status!=="in_progress"||((f=h.data)==null?void 0:f.text)===r)return e;const m=[...o];return m[l]={...h,data:{...h.data,text:r}},{...e,items:m,...h.type==="agent_message"?{agent_response:r}:{}}}const c=new Date().toISOString(),d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:c,updated_at:c};return{...e,items:[...o,d],agent_response:r}}function w0(e){var d;const n=[...hs.values()].filter(f=>f.sessionId===e.id);if(n.length===0)return e;const r=f=>{if(f.status!=="running")return f;let h=f;for(const m of n)m.turnId===f.id&&(h=pv(h,m.itemId,m.text));return h},o=(e.turns??[]).map(r),l=(d=e.threads)==null?void 0:d.map(f=>{const h=(f.turns??[]).map(r);return h.some((m,v)=>{var k;return m!==((k=f.turns)==null?void 0:k[v])})?{...f,turns:h}:f});return o.some((f,h)=>f!==e.turns[h])||(l==null?void 0:l.some((f,h)=>{var m;return f!==((m=e.threads)==null?void 0:m[h])}))?{...e,turns:o,...l?{threads:l}:{}}:e}function k0(){return jt("/sessions")}function yi(e){return jt(`/sessions/${e}?items=summary`).then(w0)}function S0(e,n){return jt(`/sessions/${e}/turns/${n}`)}function Kd(e){return ut("/sessions",e)}function om(e){return Hi(`/sessions/${e}`)}function hv(e,n,r,o){return ut(`/sessions/${e}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function b0(e){return ut(`/sessions/${e}/cancel`)}function N0(e,n){return ut(`/sessions/${encodeURIComponent(e)}/tasks/${encodeURIComponent(n)}/stop`)}function T0(e,n){return ut(`/sessions/${e}/turns/${n}/resume`)}function C0(){return ut("/turns/resume-signed-out")}function j0(e,n){return ms(`/sessions/${e}`,{title:n})}function im(e){return ms(`/sessions/${e}`,{lifecycle:"finished"})}function am(e){return ms(`/sessions/${e}`,{lifecycle:"working"})}function E0(e,n){return ms(`/sessions/${e}`,{starred:n})}function lm(e){return ms(`/sessions/${e}`,{has_unreviewed:0})}function _0(e,n,r,o){const l={model:n,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),ms(`/sessions/${e}`,l)}function R0(e,n){return ms(`/sessions/${e}`,{runtime_config:n})}function A0(e,n){return ut(`/sessions/${e}/rewind`,{turn_id:n})}function I0(e){return ut(`/sessions/${e}/restore`,{})}function D0(e,n,r){return ut(`/sessions/${e}/branch`,{turn_id:n,title:r})}function mv(){return jt("/workspaces")}function M0(e,n){return ut("/workspaces",{path:e,label:n})}function L0(e){return ut("/workspaces/hide",{path:e})}function O0(){return jt("/workspaces/picker")}function cm(e){return jt(e?`/workspaces/browse?path=${encodeURIComponent(e)}`:"/workspaces/browse")}async function gv(){const e=await fetch(`${xt()}/api/pick-directory`);if(e.status===204)return{cancelled:!0};if(!e.ok)throw new Error(`GET /api/pick-directory failed: ${e.status} ${e.statusText}`);return e.json()}function vv(){return jt("/folders")}function $0(e,n){return ut("/folders",{workspace_path:e,name:n})}function um(e,n){return ms(`/folders/${e}`,n)}function P0(e){return Hi(`/folders/${e}`)}function z0(e){return ut("/sessions/reorder",{moves:e})}function Bs(e){return e.status==="pending"||e.status==="running"}function yv(e){return!!(e!=null&&e.turns.some(Bs))}function Xl(e){return e?e.turns.some(Bs)||(e.threads??[]).some(n=>(n.turns??[]).some(Bs)):!1}const F0="s:",xd="a:",Fr=e=>`${F0}${e}`,Mi=e=>`${xd}${e}`;function mr(e){return{kind:e.startsWith(xd)?"app":"session",id:e.slice(xd.length)}}function Gd(e){return e.activeAppTabId!==null?Mi(e.activeAppTabId):e.activeSessionId===null?null:Fr(e.activeSessionId)}function xv(e,n,r){const o=[...n.map(Fr),...r.map(Mi)],l=new Set(o),c=e.filter(h=>l.has(h)),d=new Set(c),f=o.filter(h=>!d.has(h));return f.length===0&&c.length===e.length?e:[...c,...f]}function U0(e){return e.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const o=xv(n.tabOrder,n.openTabs,n.openAppTabs);o!==n.tabOrder&&e.setState({tabOrder:o})})}function dm(e,n,r){const o=e.indexOf(n);return e.slice(o+1).find(r)??e.slice(0,Math.max(o,0)).reverse().find(r)??null}function qd(e,n){const r=d=>!n.has(d),o=Gd(e);let{activeSessionId:l,activeAppTabId:c}=e;if(o!==null&&n.has(o)){const d=dm(e.tabOrder,o,r),f=d===null?null:mr(d);c=(f==null?void 0:f.kind)==="app"?f.id:null,(f==null?void 0:f.kind)==="session"&&(l=f.id)}if(l!==null&&n.has(Fr(l))){const d=h=>r(h)&&mr(h).kind==="session",f=dm(e.tabOrder,Fr(l),d);l=f===null?null:mr(f).id}return{activeSessionId:l,activeAppTabId:c}}function wv(e,n){if(e.tabOrder.includes(n))return!1;const{kind:r,id:o}=mr(n);return(r==="app"?e.apps:e.sessions).some(c=>c.id===o)}const kv=1;function Sv(){let e="";try{e=xt()}catch{}return`agentpane:tabs:${e||window.location.origin}`}function Ku(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function fm(e){return e===null||typeof e=="string"}function B0(e){if(e==null)return null;let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==kv||!Ku(r.openTabs)||!fm(r.activeSessionId)||!Ku(r.openAppTabs)||!fm(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Ku(r.tabOrder)?r.tabOrder:[]}}const bv=[()=>window.sessionStorage,()=>window.localStorage];function W0(){const e=Sv();for(const n of bv)try{const r=B0(n().getItem(e));if(r)return r}catch{}return null}function H0(e){const n=Sv(),r=JSON.stringify({v:kv,openTabs:e.openTabs,activeSessionId:e.activeSessionId,openAppTabs:e.openAppTabs,activeAppTabId:e.activeAppTabId,tabOrder:e.tabOrder});for(const o of bv)try{o().setItem(n,r)}catch{}}function V0(e){return e.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&H0(n)})}function ji(e){return[...new Set(e)]}function K0(e,n,r,o){const l=v=>r===null||r.has(v),c=ji(((e==null?void 0:e.openTabs)??[]).filter(v=>n.has(v))),d=ji(((e==null?void 0:e.openAppTabs)??[]).filter(l));let f=(e==null?void 0:e.activeSessionId)??null;f!==null&&!n.has(f)&&(f=null),f!==null&&!c.includes(f)&&c.push(f),f??(f=c.at(-1)??null);let h=(e==null?void 0:e.activeAppTabId)??null;h!==null&&!l(h)&&(h=null),h!==null&&!d.includes(h)&&d.push(h),o!==null&&n.has(o)&&(c.includes(o)||c.push(o),f=o,h=null);const m=xv(ji((e==null?void 0:e.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:f,openAppTabs:d,activeAppTabId:h,tabOrder:m}}const Ws=new Map,Xd=new Map,Yl=new Map,Nl=new Set,Yd=new Map,Ql=new Map;function G0(e,n,r=""){Ws.set(e,n),Xd.set(e,r)}function q0(e){Ws.delete(e),Xd.delete(e)}function pl(e,n){Yl.set(e,n)}function X0(e,n){n?Nl.add(e):Nl.delete(e)}function pm(e,n,r){const o=Yl.get(e);if(!o||Nl.has(o))return;const l=Ws.get(o);l&&l({source:"agentpane-host",event:n,payload:r})}function hm(e,n){const r=Yl.get(e);if(!r||Nl.has(r))return;const o=Ws.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:e,tasks:n}})}function Y0(e,n,r,o,l,c=null){if(typeof l=="string"&&l!==Xd.get(e))return;const d=Ws.get(e);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:o,caller:c}})}function Q0(e,n,r,o){const l=Yl.get(e);if(!l)return;const c=Ws.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:e,turnId:n,itemId:r,delta:o}})}function Z0(e,n){Yd.set(e,n)}function J0(e){Yd.delete(e)}function ek(e,n){Ql.set(e,n)}function tk(e){Ql.delete(e)}function Nv(e,n={}){const r=Ql.get(e);if(r){r(n);return}const o=Ws.get(e);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function nk(){for(const e of new Set([...Ws.keys(),...Ql.keys()]))Nv(e)}function sk(e){var r;const n=Ws.get(e);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Yd.get(e))==null||r()}const rk=(e,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>e({wsConnected:r}),onTurnCreated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return!c||o.thread_id?{}:c.turns.some(d=>d.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...c,turns:[...c.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{n().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),e(l=>{const c=ur(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const f=d.turns.findIndex(h=>h.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...Tn(d,o,h=>({...h,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&f>=0?f:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{n().addLogEntry("DEBUG",`item:started — ${l.type}`),e(c=>{const d=mm(l)?cr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:Tn(f,o,h=>qu(h,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Tn(d,o,f=>qu(f,l))}}:{}})},onItemCompleted:(r,o,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",f=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?n().addToast("success",`${m} completed: ${f}`):c.status!=="stopped"&&n().addToast("error",`${m} failed: ${f}`)}e(c=>{const d=mm(l)?cr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:Tn(f,o,h=>{var v,k;let m=qu(h,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 x=m.thoughts?m.thoughts+`
44
- `+l.data.text:l.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:d}})},onItemDelta:(r,o,l,c,d)=>{Q0(r,o,l,c),e(f=>{const h=cr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:Tn(m,o,v=>lk(v,l,c,d))},retryStates:h}:{retryStates:h}})},onItemText:(r,o,l,c)=>{e(d=>{const f=d.sessionDetails[r];if(!f)return{};const h=Tn(f,o,m=>m.status==="running"?pv(m,l,c):m);return{sessionDetails:{...d.sessionDetails,[r]:h}}})},onWidgetDelta:(r,o,l,c,d)=>{e(f=>{const h=cr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:Tn(m,o,v=>ak(v,l,c,d))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,l,c,d)=>{n().dropSignedOutTurn(o);const f=(l==null?void 0:l.input_tokens)??0,h=(l==null?void 0:l.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${f} in / ${h} out`),pm(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),n().refreshApps(),e(m=>{const v=m.sessionDetails[r],k=v?Tn(v,o,T=>({...T,status:"completed",token_usage:l??T.token_usage??null,...d&&!T.agent_response?{agent_response:d}:{}})):null,x=Gu(k),S=x&&k?nl(k):"active",j=ur(m.sessions,r,T=>({is_running:x,status:S,has_unreviewed:c?1:T.has_unreviewed})),N=cr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:x,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:j,retryStates:N}:{sessions:j,retryStates:N}})},onTokenUsageUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Tn(d,o,f=>({...f,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,c)=>{n().dropSignedOutTurn(o),n().addLogEntry("ERROR",`turn:failed — ${l}`),n().addToast("error",`Turn failed — ${l}`),pm(r,"turn:failed",{sessionId:r,turnId:o,error:l}),e(d=>{const f=d.sessionDetails[r],h=l.includes("cancelled")||l.includes("aborted"),m=h?"aborted":"failed",v=f?Tn(f,o,N=>({...N,status:m,error:l,...c?{resume_state:c}:{},items:N.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=Gu(v),x=k&&v?nl(v):h?"active":"failed",S=ur(d.sessions,r,()=>({is_running:k,status:x})),j=cr(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:S,retryStates:j}:{sessions:S,retryStates:j}})},onTurnCancelled:(r,o)=>{n().dropSignedOutTurn(o),e(l=>{const c=l.sessionDetails[r],d=c?Tn(c,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(x=>x.status==="in_progress"?{...x,status:"completed"}:x)})):null,f=Gu(d),h=f&&d?nl(d):"active",m=ur(l.sessions,r,()=>({is_running:f,status:h})),v=cr(l.retryStates,o);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:f,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{n().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),n().addToast("warn",ok(l.reason)),l.reason==="auth"?e(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):n().dropSignedOutTurn(o),e(c=>{const d=c.sessionDetails[r],f=d?Tn(d,o,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,h=f?nl(f):"interrupted",m=ur(c.sessions,r,()=>({is_running:1,status:h})),v=cr(c.retryStates,o);return f?{sessionDetails:{...c.sessionDetails,[r]:{...f,is_running:1,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{n().dropSignedOutTurn(o),n().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),e(c=>{const d=ur(c.sessions,r,()=>({is_running:1,status:"running"})),f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:{...Tn(f,o,h=>({...h,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{n().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:Tn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),e(c=>({retryStates:{...c.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{e(l=>({sessions:l.sessions.map(c=>c.id===r?{...c,title:o}:c),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{e(o=>{const l=o.sessionDetails[r];return{sessions:ur(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,e(l=>{const c=l.sessionDetails[r.id],d=!!(c!=null&&c.external_thread_id)&&r.external_thread_id===null;return{sessions:ur(l.sessions,r.id,()=>o),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...o,...d?{contextUsage:null}:{}}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{hm(r,o),e(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const c={...l.backgroundTasks};return o.length>0?c[r]=o:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>e({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const o={...n().signedOutTurns};delete o[r],e({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))hm(l,c);const o={};for(const[l,c]of Object.entries(r))c.length>0&&(o[l]=c);e({backgroundTasks:o})}});function ok(e){switch(e){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 nl(e){const n=[...e.turns,...(e.threads??[]).flatMap(r=>r.turns??[])].filter(Bs);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function mm(e){return e.type!=="background_task"&&e.type!=="error"&&e.type!=="interruption"}function cr(e,n){if(!(n in e))return e;const r={...e};return delete r[n],r}function Gu(e){return e&&(e.turns.some(Bs)||(e.threads??[]).some(r=>(r.turns??[]).some(Bs)))?1:0}function ur(e,n,r){return e.some(o=>o.id===n)?e.map(o=>o.id===n?{...o,...r(o)}:o):e}function Tn(e,n,r){const o=(e.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===n)?{...l,turns:(l.turns??[]).map(c=>c.id===n?r(c):c)}:l);return{...e,turns:e.turns.map(l=>l.id===n?r(l):l),threads:o}}function Qd(e,n){for(let r=e.length-1;r>=0;r--)if(e[r].external_item_id===n)return r;return-1}function qu(e,n){const r=Qd(e.items,n.external_item_id);if(r>=0){const c=[...e.items];return c[r]=n,{...e,items:c}}if(n.type==="agent_message"){const c=e.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...e,items:[...c,n]}}const o=e.items;let l=o.length;if(e.deferred_item_count)for(;l>0&&o[l-1].created_at>n.created_at;)l--;return{...e,items:[...o.slice(0,l),n,...o.slice(l)]}}function ik(e,n){const r=c=>c.external_item_id??c.id,o=new Map(e.items.map(c=>[r(c),c])),l=n.map(c=>{var f;const d=o.get(r(c));return o.delete(r(c)),d&&((f=d.data)==null?void 0:f.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...e,items:[...l,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function ak(e,n,r,o){var f;const l=new Date().toISOString(),c=Qd(e.items,n);if(c>=0){const h=e.items[c];if(((f=h.data)==null?void 0:f.partial)!==!0||h.data.title===r&&h.data.html===o)return e;const m=[...e.items];return m[c]={...h,data:{...h.data,title:r,html:o},updated_at:l},{...e,items:m}}const d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"widget",data:{title:r,html:o,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...e,items:[...e.items,d]}}function lk(e,n,r,o){var d;const l=Qd(e.items,n);if(l>=0){const f=e.items[l],h=((d=f.data)==null?void 0:d.text)??"",m=o??h+r,v=[...e.items];return v[l]={...f,data:{...f.data,text:m}},{...e,items:v,agent_response:m}}const c={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:o??r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...e,items:[...e.items,c],agent_response:o??r}}function ck(){const e=new URLSearchParams(window.location.search);return{session:e.get("session"),thread:e.get("thread")}}function uk(){const e=new URL(window.location.href);!e.searchParams.has("session")&&!e.searchParams.has("thread")||(e.searchParams.delete("session"),e.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",e))}let Xu=0;function gm(e){return e==="sidecar"?"sidecar":"turns"}async function dk(e,n){const r=await Promise.allSettled(e.map(c=>n(c))),o=new Map;let l=null;return r.forEach((c,d)=>{var f;c.status==="fulfilled"?o.set(e[d],c.value):l===null&&(l=((f=c.reason)==null?void 0:f.message)??"Request failed")}),{updated:o,firstError:l}}function fk(e,n){const r={...e.sessionDetails};n.forEach(h=>delete r[h]);const o={...e.backgroundTasks};n.forEach(h=>delete o[h]);const l=Object.fromEntries(Object.entries(e.signedOutTurns).filter(([,h])=>!n.has(h))),c=e.openTabs.filter(h=>!n.has(h)),d=qd(e,new Set([...n].map(Fr)));let f=e.activeTurnIndex;if(d.activeSessionId!==e.activeSessionId){const h=d.activeSessionId?r[d.activeSessionId]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:e.sessions.filter(h=>!n.has(h.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:f}}function pk(e){const n={...e};return delete n.turns,delete n.threads,delete n.contextUsage,n}function vm(e,n,r){const o=n().activeSessionId;e(c=>fk(c,r));const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0})}async function ym(e,n,r,o,l){if(r.length===0)return;e({error:null});const{updated:c,firstError:d}=await dk(r,o);c.size>0&&e(h=>({sessions:h.sessions.map(m=>c.get(m.id)??m)}));const f=r.length-c.size;if(f===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{e({error:d});const h=l[0].toUpperCase()+l.slice(1);n().addToast(f===r.length?"error":"warn",`${h} ${c.size} of ${r.length} — ${f} failed`)}}const Yu=new Map,hk=(e,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=ck(),o=W0();try{const l=localStorage.getItem("agentpane:last-model-config");l&&e({lastModelConfig:JSON.parse(l)})}catch{}e({loading:!0,error:null});try{const l=n().loadApps(),[c,d,f]=await Promise.all([k0(),mv(),vv()]);e({sessions:c,workspaces:d,folders:f,loading:!1}),uk();const h=await l,m=K0(o,new Set(c.map(v=>v.id)),h?new Set(n().apps.map(v=>v.id)):null,r.session);e(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:ji([...m.openTabs,...v.openTabs]),openAppTabs:ji([...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&&(e({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(l){e({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++Xu,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=f=>f.includes(r)?f:[...f,r];if(n().sessionDetails[r]){const f=n().sessionDetails[r];e({activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:gm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),f.has_unreviewed===1&&(lm(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})));return}e({loading:!0,error:null});try{const f=await yi(r);if(l!==Xu){e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},openTabs:d(h.openTabs),loading:!1}));return}e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:gm(h.activeRightTab),...c,openTabs:d(h.openTabs),loading:!1})),f.has_unreviewed===1&&(lm(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})))}catch(f){e(l===Xu?{loading:!1,error:f.message}:{loading:!1})}},closeTab:r=>n().closeTabs([Fr(r)]),updateModelConfig:async(r,o,l)=>{const c=n().activeSessionId;if(c){e({error:null});try{const d=await _0(c,r,o,l),f={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};e({lastModelConfig:f}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(f)),e(h=>({sessions:h.sessions.map(m=>m.id===c?d:m),sessionDetails:h.sessionDetails[c]?{...h.sessionDetails,[c]:{...h.sessionDetails[c],runtime_type:d.runtime_type,model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id,...d.external_thread_id?{}:{contextUsage:null}}}:h.sessionDetails})),await n().refreshActiveSession()}catch(d){e({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{e({error:null});try{const o=await Kd(r);e(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};e({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await n().selectSession(o.id),n().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),n().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{e(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=n().sessionDetails[r];if(!o){const l=await yi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),o=l}n().sessions.some(l=>l.id===r)||n().addSession(pk(o)),await n().selectSession(r)},deleteSession:async r=>{var l;e({error:null});const o=(l=n().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await om(r),vm(e,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){e({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{e({error:null});try{const l=await j0(r,o.trim());e(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){e({error:l.message}),n().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{e({error:null});try{const o=await im(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session marked as finished")}catch(o){e({error:o.message}),n().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await ym(e,n,r,im,"marked as finished")},toggleStar:async r=>{const o=n().sessions.find(l=>l.id===r);if(o){e({error:null});try{const l=await E0(r,o.starred?0:1);e(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){e({error:l.message}),n().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{e({error:null});try{const o=await am(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session reopened")}catch(o){e({error:o.message}),n().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await ym(e,n,r,am,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;e({error:null});const o=await Promise.allSettled(r.map(d=>om(d))),l=new Set;if(o.forEach((d,f)=>{d.status==="fulfilled"&&l.add(r[f])}),l.size===0){e({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}vm(e,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`):(e({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const l=n().activeSessionId;if(l){e({error:null,submittingPrompt:r}),e(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(f=>f.id===l?{...f,is_running:1,status:"running"}:f)}:{}});try{const c=await hv(l,r,o);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),e(d=>{const f=d.sessionDetails[l];if(!f)return{submittingPrompt:null};const h=f.turns.findIndex(v=>v.id===c.id);if(h>=0)return{submittingPrompt:null,activeTurnIndex:h};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...f,turns:[...f.turns,m]}},activeTurnIndex:f.turns.length}})}catch(c){e({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),e(d=>{const f=d.sessionDetails[l];if(!f)return{};const h=Xl(f)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...f,is_running:h,status:h?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:h,status:h?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await b0(r)}catch(o){e({error:o.message})}},rewindToTurn:async(r,o)=>{e({error:null});try{const l=await A0(r,o),c=await yi(r);e(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(f=>f.id===r?{...f,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(l){e({error:l.message}),n().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{e({error:null});try{const o=await I0(r),l=await yi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:o.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(o){e({error:o.message}),n().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{e({error:null});try{const c=await D0(r,o,l);e(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){e({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=n().activeSessionId;if(o){e({error:null});try{const l=await R0(o,JSON.stringify(r));e(c=>({sessions:c.sessions.map(d=>d.id===o?l:d),sessionDetails:c.sessionDetails[o]?{...c.sessionDetails,[o]:{...c.sessionDetails[o],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const o=await yi(r);e(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(c=>c.id===r?{...c,is_running:o.is_running,status:o.status}:c)}))}catch(o){e({error:o.message})}},loadDeferredItems:(r,o)=>{const l=Yu.get(o);if(l)return l;const c=S0(r,o).then(({items:d})=>(e(f=>{const h=f.sessionDetails[r];return h?{sessionDetails:{...f.sessionDetails,[r]:Tn(h,o,m=>ik(m,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Yu.delete(o));return Yu.set(o,c),c}});async function mk(e){const{sessions:n}=await jt(`/claude-sessions?workspace=${encodeURIComponent(e)}`);return n}function gk(e,n){return ut(`/claude-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}async function vk(e){const{sessions:n}=await jt(`/codex-sessions?workspace=${encodeURIComponent(e)}`);return n}function yk(e,n){return ut(`/codex-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}const wd=["claude","codex"],Zl={claude:"Claude Code",codex:"Codex"};function Qu(e){return`${e.runtime}:${e.id}`}function Tv(e){const n=e.length===1?"session":"sessions";return new Set(e).size===1?`${e.length} ${Zl[e[0]]} ${n}`:`${e.length} ${n}`}const xk={claude:e=>mk(e),codex:e=>vk(e)},wk={claude:(e,n)=>gk(e,n),codex:(e,n)=>yk(e,n)};async function Cv(e){const n=await Promise.allSettled(wd.map(l=>xk[l](e))),r=[],o={};return n.forEach((l,c)=>{const d=wd[c];l.status==="fulfilled"?r.push(...l.value.map(f=>({...f,runtime:d}))):o[d]=Vn(l.reason)}),r.sort((l,c)=>l.last_modified<c.last_modified?1:l.last_modified>c.last_modified?-1:0),{sessions:r,errors:o}}function kk(e,n){return wk[e.runtime](e.id,n)}const xm={available:!0,reason:null};let Zu=null;const Sk=(e,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Zu??(Zu=O0().then(o=>typeof(o==null?void 0:o.available)!="boolean"?xm:(e({pickerSupport:o}),o)).catch(()=>xm).finally(()=>{Zu=null})),Zu)},createWorkspaceAt:async r=>{const o=await M0(r.trim());return e(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{e({error:null});try{const o=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return n().addToast("error",`Failed to add workspace — ${Vn(o)}`),null}},removeWorkspace:async r=>{e({error:null});try{await L0(r);const o=await mv();e({workspaces:o}),n().addToast("info","Workspace hidden")}catch(o){n().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{e({error:null});try{const o=n().lastModelConfig,l=await Kd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});e(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(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const o=await gv();if(o.cancelled||!o.path)return;await n().addWorkspace(o.path)}catch(o){n().addToast("error",`Failed to pick directory — ${o.message}`)}},importSessions:async(r,o)=>{const l=[],c=[],d=[];for(const f of[...o].reverse())try{l.unshift(await kk(f,r)),c.unshift(f.runtime)}catch(h){d.unshift({...f,error:Vn(h)})}if(l.length>0){e(h=>({sessions:[...l,...h.sessions]})),await n().selectSession(l[0].id);const f=Tv(c);n().addLogEntry("INFO",`Imported ${f} into ${r}`),n().addToast("success",l.length===1?`Imported — ${l[0].title||`${Zl[c[0]]} session`}`:`Imported ${f}`)}return{imported:l,failed:d}}}),Zd=e=>e?`?cwd=${encodeURIComponent(e)}`:"";function jv(e,n){return jt(`/providers/${encodeURIComponent(e)}/models${Zd(n)}`)}function bk(e,n){return jt(`/providers/${encodeURIComponent(e)}/inference${Zd(n)}`)}function Nk(e,n,r){return fv(`/providers/${encodeURIComponent(e)}/inference/${encodeURIComponent(n)}/credentials`,r)}function Tk(e,n,r){return Hi(`/providers/${encodeURIComponent(e)}/inference/${encodeURIComponent(n)}/credentials${Zd(r)}`)}function Ck(e){var n;return e instanceof Br&&((n=e.body)==null?void 0:n.code)==="repoburg_sign_in_required"}async function wm(){const e=await fetch(`${xt()}/auth/status`,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`auth status ${e.status}`);return await e.json()}async function jk(){const e=await fetch(`${xt()}/auth/initiate`,{method:"POST"}),n=await e.json().catch(()=>({}));if(!e.ok)throw new Error(n.error??`initiate ${e.status}`);return n}async function Ek(){await fetch(`${xt()}/auth/cancel`,{method:"POST"}).catch(()=>{})}const km="curl -fsSL https://repoburg.com/install.sh | bash",_k=2e3,Ev="agentpane:daemon-seen";function Rk(e=xt()){if(!e)return!1;try{const n=new URL(e);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function Ak(e=xt()){try{return await fetch(`${e}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function Ik(){try{return localStorage.getItem(Ev)==="true"}catch{return!1}}function Dk(){try{localStorage.setItem(Ev,"true")}catch{}}function Mk(e){let n=!1,r=!1,o=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(n||r)return;c(),r=!0;const m=await Ak();if(r=!1,!n){if(m){Dk(),h(),e.onReady();return}o||(o=!0,e.onMissing()),l=setTimeout(()=>void d(),_k)}}function f(){document.visibilityState==="visible"&&d()}function h(){n=!0,c(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),d(),h}const kd=160,Sd=480,Lk=240,Tl=220,Ok=300,$k=600,Pk=36;function Ei(e,n){return n?`${e}
45
- ${n}`:e}function Cl(){return typeof window>"u"?$k:Math.max(Tl,Math.round(window.innerWidth*.7))}const Sm="agentpane:sidebar-width",bm="agentpane:right-panel-width",Ju="agentpane:right-panel-collapsed";function Nm(e,n,r,o){try{const l=localStorage.getItem(e);if(l==null)return o;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):o}catch{return o}}function zk(e){try{return localStorage.getItem(e)==="true"}catch{return!1}}function Tm(e,n){try{localStorage.setItem(e,String(n))}catch{}}const Cm=200,Fk=(e,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,modelLists:{},modelsLoading:{},inferenceLists:{},inferenceLoading:{},inferenceErrors:{},inferenceSignIn:{},showModelSelector:!1,sidebarWidth:Nm(Sm,kd,Sd,Lk),rightPanelWidth:Nm(bm,Tl,Cl(),Ok),rightPanelCollapsed:zk(Ju),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:Rk()?"checking":"ready",setActiveTurnIndex:r=>e({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&Tm(Ju,!1),e({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>e({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>e({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>e({importSessionsWorkspace:r}),setShowRemoteModal:r=>e({showRemoteModal:r}),setShowCommandPalette:r=>e({showCommandPalette:r}),setShowModelSelector:r=>e({showModelSelector:r}),setDeepLinkThreadId:r=>e({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Sd,Math.max(kd,Math.round(r)));e({sidebarWidth:o});try{localStorage.setItem(Sm,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(Cl(),Math.max(Tl,Math.round(r)));e({rightPanelWidth:o});try{localStorage.setItem(bm,String(o))}catch{}},setRightPanelCollapsed:r=>{e({rightPanelCollapsed:r}),Tm(Ju,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){e({vscodeViewOpen:!1});return}e({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>e({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>e({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>e(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>e({daemonStatus:r}),addToast:(r,o,l,c)=>{const d=Math.random().toString(36).slice(2,9);e(f=>({toasts:[...f.toasts,{id:d,type:r,message:o,undoAction:l,undoLabel:c}]}))},removeToast:r=>{e(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});e(c=>{const d=[...c.eventLog,{time:l,level:r,message:o}];return d.length>Cm&&d.splice(0,d.length-Cm),{eventLog:d}})},loadModels:async(r,o,l)=>{const c=Ei(r,o);if(!(n().modelsLoading[c]&&!l)){e(d=>({modelsLoading:{...d.modelsLoading,[c]:!0}}));try{const d=await jv(r,o);d.length>0&&e(f=>({modelLists:{...f.modelLists,[c]:d}}))}catch{}finally{e(d=>{const f={...d.modelsLoading};return delete f[c],{modelsLoading:f}})}}},loadInferenceProviders:async(r,o)=>{const l=Ei(r,o);if(!n().inferenceLoading[l]){e(c=>({inferenceLoading:{...c.inferenceLoading,[l]:!0}}));try{const c=await bk(r,o);e(d=>{const f={...d.inferenceErrors};delete f[l];const h={...d.inferenceSignIn};return delete h[l],{inferenceLists:{...d.inferenceLists,[l]:c},inferenceErrors:f,inferenceSignIn:h}})}catch(c){e(d=>{const f={...d.inferenceSignIn};return Ck(c)?f[l]=!0:delete f[l],{inferenceErrors:{...d.inferenceErrors,[l]:Vn(c)},inferenceSignIn:f}})}finally{e(c=>{const d={...c.inferenceLoading};return delete d[l],{inferenceLoading:d}})}}},setInferenceProvider:(r,o,l)=>{const c=Ei(r,o);e(d=>{const f=d.inferenceLists[c]??[],h=f.some(m=>m.id===l.id)?f.map(m=>m.id===l.id?l:m):[...f,l];return{inferenceLists:{...d.inferenceLists,[c]:h}}})}}),Uk=(e,n)=>({createThread:async(r,o)=>{try{await ut(`/sessions/${r}/threads`,o),n().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){n().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await ut(`/sessions/${r}/threads/${o}/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,o)=>{try{await ut(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(l){n().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await ms(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){n().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await ms(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){n().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const c=await ut(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),d=`
43
+ ${r}`}function k0(e,n,r,o){const l=bl(e,n,r),c=hs.get(l);return c?(c.text+=o,c.text):(hs.set(l,{sessionId:e,turnId:n,itemId:r,text:o}),o)}function S0(e,n){for(const[o,l]of hs)(e===null||l.sessionId===e)&&hs.delete(o);const r=n.filter(o=>o&&typeof o.sessionId=="string"&&typeof o.turnId=="string"&&typeof o.itemId=="string"&&typeof o.text=="string");for(const o of r)hs.set(bl(o.sessionId,o.turnId,o.itemId),{...o});return r}function Vu(e,n,r){var c;const o=r==null?void 0:r.external_item_id;if(!r||!o)return;const l=bl(e,n,o);if(r.status==="in_progress"){const d=(c=r.data)==null?void 0:c.text;typeof d=="string"&&hs.set(l,{sessionId:e,turnId:n,itemId:o,text:d});return}hs.delete(l),r.type==="agent_message"&&hs.delete(bl(e,n,w0(n)))}function vi(e,n){for(const[r,o]of hs)o.sessionId===e&&o.turnId===n&&hs.delete(r)}function gv(e,n,r){var f;const o=e.items??[];let l=-1;for(let h=o.length-1;h>=0;h--)if(o[h].external_item_id===n){l=h;break}if(l>=0){const h=o[l];if(h.status!=="in_progress"||((f=h.data)==null?void 0:f.text)===r)return e;const m=[...o];return m[l]={...h,data:{...h.data,text:r}},{...e,items:m,...h.type==="agent_message"?{agent_response:r}:{}}}const c=new Date().toISOString(),d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:r},status:"in_progress",created_at:c,updated_at:c};return{...e,items:[...o,d],agent_response:r}}function b0(e){var d;const n=[...hs.values()].filter(f=>f.sessionId===e.id);if(n.length===0)return e;const r=f=>{if(f.status!=="running")return f;let h=f;for(const m of n)m.turnId===f.id&&(h=gv(h,m.itemId,m.text));return h},o=(e.turns??[]).map(r),l=(d=e.threads)==null?void 0:d.map(f=>{const h=(f.turns??[]).map(r);return h.some((m,v)=>{var k;return m!==((k=f.turns)==null?void 0:k[v])})?{...f,turns:h}:f});return o.some((f,h)=>f!==e.turns[h])||(l==null?void 0:l.some((f,h)=>{var m;return f!==((m=e.threads)==null?void 0:m[h])}))?{...e,turns:o,...l?{threads:l}:{}}:e}function N0(){return jt("/sessions")}function yi(e){return jt(`/sessions/${e}?items=summary`).then(b0)}function T0(e,n){return jt(`/sessions/${e}/turns/${n}`)}function Kd(e){return ut("/sessions",e)}function om(e){return Hi(`/sessions/${e}`)}function vv(e,n,r,o){return ut(`/sessions/${e}/turns`,{user_prompt:n,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function C0(e){return ut(`/sessions/${e}/cancel`)}function j0(e,n){return ut(`/sessions/${encodeURIComponent(e)}/tasks/${encodeURIComponent(n)}/stop`)}function E0(e,n){return ut(`/sessions/${e}/turns/${n}/resume`)}function _0(){return ut("/turns/resume-signed-out")}function R0(e,n){return ms(`/sessions/${e}`,{title:n})}function im(e){return ms(`/sessions/${e}`,{lifecycle:"finished"})}function am(e){return ms(`/sessions/${e}`,{lifecycle:"working"})}function A0(e,n){return ms(`/sessions/${e}`,{starred:n})}function lm(e){return ms(`/sessions/${e}`,{has_unreviewed:0})}function I0(e,n,r,o){const l={model:n,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),ms(`/sessions/${e}`,l)}function D0(e,n){return ms(`/sessions/${e}`,{runtime_config:n})}function M0(e,n){return ut(`/sessions/${e}/rewind`,{turn_id:n})}function L0(e){return ut(`/sessions/${e}/restore`,{})}function O0(e,n,r){return ut(`/sessions/${e}/branch`,{turn_id:n,title:r})}function yv(){return jt("/workspaces")}function $0(e,n){return ut("/workspaces",{path:e,label:n})}function P0(e){return ut("/workspaces/hide",{path:e})}function z0(){return jt("/workspaces/picker")}function cm(e){return jt(e?`/workspaces/browse?path=${encodeURIComponent(e)}`:"/workspaces/browse")}async function xv(){const e=await fetch(`${gt()}/api/pick-directory`);if(e.status===204)return{cancelled:!0};if(!e.ok)throw new Error(`GET /api/pick-directory failed: ${e.status} ${e.statusText}`);return e.json()}function wv(){return jt("/folders")}function F0(e,n){return ut("/folders",{workspace_path:e,name:n})}function um(e,n){return ms(`/folders/${e}`,n)}function U0(e){return Hi(`/folders/${e}`)}function B0(e){return ut("/sessions/reorder",{moves:e})}function Bs(e){return e.status==="pending"||e.status==="running"}function kv(e){return!!(e!=null&&e.turns.some(Bs))}function Xl(e){return e?e.turns.some(Bs)||(e.threads??[]).some(n=>(n.turns??[]).some(Bs)):!1}const W0="s:",xd="a:",Fr=e=>`${W0}${e}`,Mi=e=>`${xd}${e}`;function mr(e){return{kind:e.startsWith(xd)?"app":"session",id:e.slice(xd.length)}}function Gd(e){return e.activeAppTabId!==null?Mi(e.activeAppTabId):e.activeSessionId===null?null:Fr(e.activeSessionId)}function Sv(e,n,r){const o=[...n.map(Fr),...r.map(Mi)],l=new Set(o),c=e.filter(h=>l.has(h)),d=new Set(c),f=o.filter(h=>!d.has(h));return f.length===0&&c.length===e.length?e:[...c,...f]}function H0(e){return e.subscribe((n,r)=>{if(n.openTabs===r.openTabs&&n.openAppTabs===r.openAppTabs)return;const o=Sv(n.tabOrder,n.openTabs,n.openAppTabs);o!==n.tabOrder&&e.setState({tabOrder:o})})}function dm(e,n,r){const o=e.indexOf(n);return e.slice(o+1).find(r)??e.slice(0,Math.max(o,0)).reverse().find(r)??null}function qd(e,n){const r=d=>!n.has(d),o=Gd(e);let{activeSessionId:l,activeAppTabId:c}=e;if(o!==null&&n.has(o)){const d=dm(e.tabOrder,o,r),f=d===null?null:mr(d);c=(f==null?void 0:f.kind)==="app"?f.id:null,(f==null?void 0:f.kind)==="session"&&(l=f.id)}if(l!==null&&n.has(Fr(l))){const d=h=>r(h)&&mr(h).kind==="session",f=dm(e.tabOrder,Fr(l),d);l=f===null?null:mr(f).id}return{activeSessionId:l,activeAppTabId:c}}function bv(e,n){if(e.tabOrder.includes(n))return!1;const{kind:r,id:o}=mr(n);return(r==="app"?e.apps:e.sessions).some(c=>c.id===o)}const Nv=1;function Tv(){let e="";try{e=gt()}catch{}return`agentpane:tabs:${e||window.location.origin}`}function Ku(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function fm(e){return e===null||typeof e=="string"}function V0(e){if(e==null)return null;let n;try{n=JSON.parse(e)}catch{return null}if(typeof n!="object"||n===null)return null;const r=n;return r.v!==Nv||!Ku(r.openTabs)||!fm(r.activeSessionId)||!Ku(r.openAppTabs)||!fm(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId,tabOrder:Ku(r.tabOrder)?r.tabOrder:[]}}const Cv=[()=>window.sessionStorage,()=>window.localStorage];function K0(){const e=Tv();for(const n of Cv)try{const r=V0(n().getItem(e));if(r)return r}catch{}return null}function G0(e){const n=Tv(),r=JSON.stringify({v:Nv,openTabs:e.openTabs,activeSessionId:e.activeSessionId,openAppTabs:e.openAppTabs,activeAppTabId:e.activeAppTabId,tabOrder:e.tabOrder});for(const o of Cv)try{o().setItem(n,r)}catch{}}function q0(e){return e.subscribe((n,r)=>{(n.openTabs!==r.openTabs||n.activeSessionId!==r.activeSessionId||n.openAppTabs!==r.openAppTabs||n.activeAppTabId!==r.activeAppTabId||n.tabOrder!==r.tabOrder)&&G0(n)})}function ji(e){return[...new Set(e)]}function X0(e,n,r,o){const l=v=>r===null||r.has(v),c=ji(((e==null?void 0:e.openTabs)??[]).filter(v=>n.has(v))),d=ji(((e==null?void 0:e.openAppTabs)??[]).filter(l));let f=(e==null?void 0:e.activeSessionId)??null;f!==null&&!n.has(f)&&(f=null),f!==null&&!c.includes(f)&&c.push(f),f??(f=c.at(-1)??null);let h=(e==null?void 0:e.activeAppTabId)??null;h!==null&&!l(h)&&(h=null),h!==null&&!d.includes(h)&&d.push(h),o!==null&&n.has(o)&&(c.includes(o)||c.push(o),f=o,h=null);const m=Sv(ji((e==null?void 0:e.tabOrder)??[]),c,d);return{openTabs:c,activeSessionId:f,openAppTabs:d,activeAppTabId:h,tabOrder:m}}const Ws=new Map,Xd=new Map,Yl=new Map,Nl=new Set,Yd=new Map,Ql=new Map;function Y0(e,n,r=""){Ws.set(e,n),Xd.set(e,r)}function Q0(e){Ws.delete(e),Xd.delete(e)}function pl(e,n){Yl.set(e,n)}function Z0(e,n){n?Nl.add(e):Nl.delete(e)}function pm(e,n,r){const o=Yl.get(e);if(!o||Nl.has(o))return;const l=Ws.get(o);l&&l({source:"agentpane-host",event:n,payload:r})}function hm(e,n){const r=Yl.get(e);if(!r||Nl.has(r))return;const o=Ws.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:e,tasks:n}})}function J0(e,n,r,o,l,c=null){if(typeof l=="string"&&l!==Xd.get(e))return;const d=Ws.get(e);d&&d({source:"agentpane-host",event:"tool_call",payload:{callId:n,tool:r,name:r,args:o,caller:c}})}function ek(e,n,r,o){const l=Yl.get(e);if(!l)return;const c=Ws.get(l);c&&c({source:"agentpane-host",event:"turn:delta",payload:{sessionId:e,turnId:n,itemId:r,delta:o}})}function tk(e,n){Yd.set(e,n)}function nk(e){Yd.delete(e)}function sk(e,n){Ql.set(e,n)}function rk(e){Ql.delete(e)}function jv(e,n={}){const r=Ql.get(e);if(r){r(n);return}const o=Ws.get(e);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function ok(){for(const e of new Set([...Ws.keys(),...Ql.keys()]))jv(e)}function ik(e){var r;const n=Ws.get(e);n&&n({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Yd.get(e))==null||r()}const ak=(e,n)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},signedOutTurns:{},setWsConnected:r=>e({wsConnected:r}),onTurnCreated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return!c||o.thread_id?{}:c.turns.some(d=>d.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...c,turns:[...c.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{n().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),e(l=>{const c=ur(l.sessions,r,()=>({is_running:1,status:"running"})),d=l.sessionDetails[r];if(!d)return{sessions:c};const f=d.turns.findIndex(h=>h.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...Tn(d,o,h=>({...h,status:"running"})),is_running:1,status:"running"}},sessions:c,activeTurnIndex:l.activeSessionId===r&&f>=0?f:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{n().addLogEntry("DEBUG",`item:started — ${l.type}`),e(c=>{const d=mm(l)?cr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:Tn(f,o,h=>qu(h,l))},retryStates:d}:{retryStates:d}})},onItemUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Tn(d,o,f=>qu(f,l))}}:{}})},onItemCompleted:(r,o,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",f=c.description||"background task",m=d==="local_agent"?"Subagent":d==="local_bash"?"Monitor":"Task";l.status==="completed"?n().addToast("success",`${m} completed: ${f}`):c.status!=="stopped"&&n().addToast("error",`${m} failed: ${f}`)}e(c=>{const d=mm(l)?cr(c.retryStates,o):c.retryStates,f=c.sessionDetails[r];return f?{retryStates:d,sessionDetails:{...c.sessionDetails,[r]:Tn(f,o,h=>{var v,k;let m=qu(h,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 x=m.thoughts?m.thoughts+`
44
+ `+l.data.text:l.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:d}})},onItemDelta:(r,o,l,c,d)=>{ek(r,o,l,c),e(f=>{const h=cr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:Tn(m,o,v=>dk(v,l,c,d))},retryStates:h}:{retryStates:h}})},onItemText:(r,o,l,c)=>{e(d=>{const f=d.sessionDetails[r];if(!f)return{};const h=Tn(f,o,m=>m.status==="running"?gv(m,l,c):m);return{sessionDetails:{...d.sessionDetails,[r]:h}}})},onWidgetDelta:(r,o,l,c,d)=>{e(f=>{const h=cr(f.retryStates,o),m=f.sessionDetails[r];return m?{sessionDetails:{...f.sessionDetails,[r]:Tn(m,o,v=>uk(v,l,c,d))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,l,c,d)=>{n().dropSignedOutTurn(o);const f=(l==null?void 0:l.input_tokens)??0,h=(l==null?void 0:l.output_tokens)??0;n().addLogEntry("INFO",`turn:completed — ${f} in / ${h} out`),pm(r,"turn:completed",{sessionId:r,turnId:o,response:d??null}),n().refreshApps(),e(m=>{const v=m.sessionDetails[r],k=v?Tn(v,o,T=>({...T,status:"completed",token_usage:l??T.token_usage??null,...d&&!T.agent_response?{agent_response:d}:{}})):null,x=Gu(k),S=x&&k?nl(k):"active",j=ur(m.sessions,r,T=>({is_running:x,status:S,has_unreviewed:c?1:T.has_unreviewed})),N=cr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:x,status:S,has_unreviewed:c?1:k.has_unreviewed}},sessions:j,retryStates:N}:{sessions:j,retryStates:N}})},onTokenUsageUpdated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:Tn(d,o,f=>({...f,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,c)=>{n().dropSignedOutTurn(o),n().addLogEntry("ERROR",`turn:failed — ${l}`),n().addToast("error",`Turn failed — ${l}`),pm(r,"turn:failed",{sessionId:r,turnId:o,error:l}),e(d=>{const f=d.sessionDetails[r],h=l.includes("cancelled")||l.includes("aborted"),m=h?"aborted":"failed",v=f?Tn(f,o,N=>({...N,status:m,error:l,...c?{resume_state:c}:{},items:N.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=Gu(v),x=k&&v?nl(v):h?"active":"failed",S=ur(d.sessions,r,()=>({is_running:k,status:x})),j=cr(d.retryStates,o);return v?{sessionDetails:{...d.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:S,retryStates:j}:{sessions:S,retryStates:j}})},onTurnCancelled:(r,o)=>{n().dropSignedOutTurn(o),e(l=>{const c=l.sessionDetails[r],d=c?Tn(c,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(x=>x.status==="in_progress"?{...x,status:"completed"}:x)})):null,f=Gu(d),h=f&&d?nl(d):"active",m=ur(l.sessions,r,()=>({is_running:f,status:h})),v=cr(l.retryStates,o);return d?{sessionDetails:{...l.sessionDetails,[r]:{...d,is_running:f,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{n().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),n().addToast("warn",lk(l.reason)),l.reason==="auth"?e(c=>({signedOutTurns:{...c.signedOutTurns,[o]:r}})):n().dropSignedOutTurn(o),e(c=>{const d=c.sessionDetails[r],f=d?Tn(d,o,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,h=f?nl(f):"interrupted",m=ur(c.sessions,r,()=>({is_running:1,status:h})),v=cr(c.retryStates,o);return f?{sessionDetails:{...c.sessionDetails,[r]:{...f,is_running:1,status:h}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{n().dropSignedOutTurn(o),n().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),e(c=>{const d=ur(c.sessions,r,()=>({is_running:1,status:"running"})),f=c.sessionDetails[r];return f?{sessionDetails:{...c.sessionDetails,[r]:{...Tn(f,o,h=>({...h,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:d}:{sessions:d}})},onTurnResumed:(r,o)=>{n().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),n().addToast("success","Interrupted turn resumed"),e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:Tn(c,o,d=>({...d,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{n().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),e(c=>({retryStates:{...c.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{e(l=>({sessions:l.sessions.map(c=>c.id===r?{...c,title:o}:c),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{e(o=>{const l=o.sessionDetails[r];return{sessions:ur(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,e(l=>{const c=l.sessionDetails[r.id],d=!!(c!=null&&c.external_thread_id)&&r.external_thread_id===null;return{sessions:ur(l.sessions,r.id,()=>o),sessionDetails:c?{...l.sessionDetails,[r.id]:{...c,...o,...d?{contextUsage:null}:{}}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{hm(r,o),e(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const c={...l.backgroundTasks};return o.length>0?c[r]=o:delete c[r],{backgroundTasks:c}})},onSignedOutTurnsSnapshot:r=>e({signedOutTurns:Object.fromEntries(r.map(o=>[o.turnId,o.sessionId]))}),dropSignedOutTurn:r=>{if(!(r in n().signedOutTurns))return;const o={...n().signedOutTurns};delete o[r],e({signedOutTurns:o})},onBackgroundTasksSnapshot:r=>{for(const[l,c]of Object.entries(r))hm(l,c);const o={};for(const[l,c]of Object.entries(r))c.length>0&&(o[l]=c);e({backgroundTasks:o})}});function lk(e){switch(e){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 nl(e){const n=[...e.turns,...(e.threads??[]).flatMap(r=>r.turns??[])].filter(Bs);return n.length>0&&n.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function mm(e){return e.type!=="background_task"&&e.type!=="error"&&e.type!=="interruption"}function cr(e,n){if(!(n in e))return e;const r={...e};return delete r[n],r}function Gu(e){return e&&(e.turns.some(Bs)||(e.threads??[]).some(r=>(r.turns??[]).some(Bs)))?1:0}function ur(e,n,r){return e.some(o=>o.id===n)?e.map(o=>o.id===n?{...o,...r(o)}:o):e}function Tn(e,n,r){const o=(e.threads??[]).map(l=>(l.turns??[]).some(c=>c.id===n)?{...l,turns:(l.turns??[]).map(c=>c.id===n?r(c):c)}:l);return{...e,turns:e.turns.map(l=>l.id===n?r(l):l),threads:o}}function Qd(e,n){for(let r=e.length-1;r>=0;r--)if(e[r].external_item_id===n)return r;return-1}function qu(e,n){const r=Qd(e.items,n.external_item_id);if(r>=0){const c=[...e.items];return c[r]=n,{...e,items:c}}if(n.type==="agent_message"){const c=e.items.filter(d=>!(d.type==="agent_message"&&d.id.startsWith("delta-")));return{...e,items:[...c,n]}}const o=e.items;let l=o.length;if(e.deferred_item_count)for(;l>0&&o[l-1].created_at>n.created_at;)l--;return{...e,items:[...o.slice(0,l),n,...o.slice(l)]}}function ck(e,n){const r=c=>c.external_item_id??c.id,o=new Map(e.items.map(c=>[r(c),c])),l=n.map(c=>{var f;const d=o.get(r(c));return o.delete(r(c)),d&&((f=d.data)==null?void 0:f.partial)!==!0&&d.updated_at>c.updated_at?d:c});return{...e,items:[...l,...o.values()],deferred_item_count:0,deferred_tool_calls:0}}function uk(e,n,r,o){var f;const l=new Date().toISOString(),c=Qd(e.items,n);if(c>=0){const h=e.items[c];if(((f=h.data)==null?void 0:f.partial)!==!0||h.data.title===r&&h.data.html===o)return e;const m=[...e.items];return m[c]={...h,data:{...h.data,title:r,html:o},updated_at:l},{...e,items:m}}const d={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"widget",data:{title:r,html:o,error:null,partial:!0},status:"in_progress",created_at:l,updated_at:l};return{...e,items:[...e.items,d]}}function dk(e,n,r,o){var d;const l=Qd(e.items,n);if(l>=0){const f=e.items[l],h=((d=f.data)==null?void 0:d.text)??"",m=o??h+r,v=[...e.items];return v[l]={...f,data:{...f.data,text:m}},{...e,items:v,agent_response:m}}const c={id:`delta-${n}`,turn_id:e.id,external_item_id:n,type:"agent_message",data:{text:o??r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...e,items:[...e.items,c],agent_response:o??r}}function fk(){const e=new URLSearchParams(window.location.search);return{session:e.get("session"),thread:e.get("thread")}}function pk(){const e=new URL(window.location.href);!e.searchParams.has("session")&&!e.searchParams.has("thread")||(e.searchParams.delete("session"),e.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",e))}let Xu=0;function gm(e){return e==="sidecar"?"sidecar":"turns"}async function hk(e,n){const r=await Promise.allSettled(e.map(c=>n(c))),o=new Map;let l=null;return r.forEach((c,d)=>{var f;c.status==="fulfilled"?o.set(e[d],c.value):l===null&&(l=((f=c.reason)==null?void 0:f.message)??"Request failed")}),{updated:o,firstError:l}}function mk(e,n){const r={...e.sessionDetails};n.forEach(h=>delete r[h]);const o={...e.backgroundTasks};n.forEach(h=>delete o[h]);const l=Object.fromEntries(Object.entries(e.signedOutTurns).filter(([,h])=>!n.has(h))),c=e.openTabs.filter(h=>!n.has(h)),d=qd(e,new Set([...n].map(Fr)));let f=e.activeTurnIndex;if(d.activeSessionId!==e.activeSessionId){const h=d.activeSessionId?r[d.activeSessionId]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:e.sessions.filter(h=>!n.has(h.id)),sessionDetails:r,backgroundTasks:o,signedOutTurns:l,openTabs:c,...d,activeTurnIndex:f}}function gk(e){const n={...e};return delete n.turns,delete n.threads,delete n.contextUsage,n}function vm(e,n,r){const o=n().activeSessionId;e(c=>mk(c,r));const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0})}async function ym(e,n,r,o,l){if(r.length===0)return;e({error:null});const{updated:c,firstError:d}=await hk(r,o);c.size>0&&e(h=>({sessions:h.sessions.map(m=>c.get(m.id)??m)}));const f=r.length-c.size;if(f===0)n().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{e({error:d});const h=l[0].toUpperCase()+l.slice(1);n().addToast(f===r.length?"error":"warn",`${h} ${c.size} of ${r.length} — ${f} failed`)}}const Yu=new Map,vk=(e,n)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=fk(),o=K0();try{const l=localStorage.getItem("agentpane:last-model-config");l&&e({lastModelConfig:JSON.parse(l)})}catch{}e({loading:!0,error:null});try{const l=n().loadApps(),[c,d,f]=await Promise.all([N0(),yv(),wv()]);e({sessions:c,workspaces:d,folders:f,loading:!1}),pk();const h=await l,m=X0(o,new Set(c.map(v=>v.id)),h?new Set(n().apps.map(v=>v.id)):null,r.session);e(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:ji([...m.openTabs,...v.openTabs]),openAppTabs:ji([...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&&(e({deepLinkThreadId:r.thread}),n().switchRightTab("threads"))}catch(l){e({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++Xu,c=o!=null&&o.keepAppView?{}:{activeAppTabId:null},d=f=>f.includes(r)?f:[...f,r];if(n().sessionDetails[r]){const f=n().sessionDetails[r];e({activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:gm(n().activeRightTab),...c,openTabs:d(n().openTabs)}),f.has_unreviewed===1&&(lm(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})));return}e({loading:!0,error:null});try{const f=await yi(r);if(l!==Xu){e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},openTabs:d(h.openTabs),loading:!1}));return}e(h=>({sessionDetails:{...h.sessionDetails,[r]:f},activeSessionId:r,activeTurnIndex:f.turns.length>0?f.turns.length-1:0,activeRightTab:gm(h.activeRightTab),...c,openTabs:d(h.openTabs),loading:!1})),f.has_unreviewed===1&&(lm(r).catch(()=>{}),e(h=>({sessions:h.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...h.sessionDetails,[r]:{...f,has_unreviewed:0}}})))}catch(f){e(l===Xu?{loading:!1,error:f.message}:{loading:!1})}},closeTab:r=>n().closeTabs([Fr(r)]),updateModelConfig:async(r,o,l)=>{const c=n().activeSessionId;if(c){e({error:null});try{const d=await I0(c,r,o,l),f={provider:d.runtime_type,model:d.model??"",reasoning:d.model_reasoning_effort??""};e({lastModelConfig:f}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(f)),e(h=>({sessions:h.sessions.map(m=>m.id===c?d:m),sessionDetails:h.sessionDetails[c]?{...h.sessionDetails,[c]:{...h.sessionDetails[c],runtime_type:d.runtime_type,model:d.model,model_reasoning_effort:d.model_reasoning_effort,external_thread_id:d.external_thread_id,...d.external_thread_id?{}:{contextUsage:null}}}:h.sessionDetails})),await n().refreshActiveSession()}catch(d){e({error:d.message}),n().addToast("error",`Failed to update model — ${d.message}`)}}},createSession:async r=>{e({error:null});try{const o=await Kd(r);e(c=>({sessions:[o,...c.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};e({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await n().selectSession(o.id),n().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),n().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{e(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=n().sessionDetails[r];if(!o){const l=await yi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l}})),o=l}n().sessions.some(l=>l.id===r)||n().addSession(gk(o)),await n().selectSession(r)},deleteSession:async r=>{var l;e({error:null});const o=(l=n().sessions.find(c=>c.id===r))==null?void 0:l.title;try{await om(r),vm(e,n,new Set([r])),n().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),n().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(c){e({error:c.message}),n().addToast("error",`Failed to delete session — ${c.message}`)}},renameSession:async(r,o)=>{e({error:null});try{const l=await R0(r,o.trim());e(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){e({error:l.message}),n().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{e({error:null});try{const o=await im(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session marked as finished")}catch(o){e({error:o.message}),n().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await ym(e,n,r,im,"marked as finished")},toggleStar:async r=>{const o=n().sessions.find(l=>l.id===r);if(o){e({error:null});try{const l=await A0(r,o.starred?0:1);e(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){e({error:l.message}),n().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{e({error:null});try{const o=await am(r);e(l=>({sessions:l.sessions.map(c=>c.id===r?o:c)})),n().addToast("info","Session reopened")}catch(o){e({error:o.message}),n().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await ym(e,n,r,am,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;e({error:null});const o=await Promise.allSettled(r.map(d=>om(d))),l=new Set;if(o.forEach((d,f)=>{d.status==="fulfilled"&&l.add(r[f])}),l.size===0){e({error:"Failed to delete sessions"}),n().addToast("error","Failed to delete sessions");return}vm(e,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`):(e({error:"One or more sessions failed to delete"}),n().addToast("warn",`Deleted ${l.size} of ${r.length} — ${c} failed`))},submitPrompt:async(r,o)=>{const l=n().activeSessionId;if(l){e({error:null,submittingPrompt:r}),e(c=>{const d=c.sessionDetails[l];return d?{sessionDetails:{...c.sessionDetails,[l]:{...d,is_running:1,status:"running"}},sessions:c.sessions.map(f=>f.id===l?{...f,is_running:1,status:"running"}:f)}:{}});try{const c=await vv(l,r,o);n().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),e(d=>{const f=d.sessionDetails[l];if(!f)return{submittingPrompt:null};const h=f.turns.findIndex(v=>v.id===c.id);if(h>=0)return{submittingPrompt:null,activeTurnIndex:h};const m={...c,items:[]};return{submittingPrompt:null,sessionDetails:{...d.sessionDetails,[l]:{...f,turns:[...f.turns,m]}},activeTurnIndex:f.turns.length}})}catch(c){e({submittingPrompt:null,error:c.message}),n().addLogEntry("ERROR",`Turn failed — ${c.message}`),n().addToast("error",`Failed to send prompt — ${c.message}`),e(d=>{const f=d.sessionDetails[l];if(!f)return{};const h=Xl(f)?1:0;return{sessionDetails:{...d.sessionDetails,[l]:{...f,is_running:h,status:h?"running":"active"}},sessions:d.sessions.map(m=>m.id===l?{...m,is_running:h,status:h?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=n().activeSessionId;if(r)try{await C0(r)}catch(o){e({error:o.message})}},rewindToTurn:async(r,o)=>{e({error:null});try{const l=await M0(r,o),c=await yi(r);e(d=>({sessionDetails:{...d.sessionDetails,[r]:c},sessions:d.sessions.map(f=>f.id===r?{...f,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:c.turns.length>0?c.turns.length-1:0})),n().addToast("info","Rewound to selected turn")}catch(l){e({error:l.message}),n().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{e({error:null});try{const o=await L0(r),l=await yi(r);e(c=>({sessionDetails:{...c.sessionDetails,[r]:l},sessions:c.sessions.map(d=>d.id===r?{...d,external_thread_id:o.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(o){e({error:o.message}),n().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{e({error:null});try{const c=await O0(r,o,l);e(d=>({sessions:[c,...d.sessions]})),await n().selectSession(c.id),n().addToast("success","Branched from selected turn")}catch(c){e({error:c.message}),n().addToast("error",`Failed to branch — ${c.message}`)}},updateRuntimeConfig:async r=>{const o=n().activeSessionId;if(o){e({error:null});try{const l=await D0(o,JSON.stringify(r));e(c=>({sessions:c.sessions.map(d=>d.id===o?l:d),sessionDetails:c.sessionDetails[o]?{...c.sessionDetails,[o]:{...c.sessionDetails[o],runtime_config:l.runtime_config}}:c.sessionDetails}))}catch(l){e({error:l.message}),n().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=n().activeSessionId;if(r)try{const o=await yi(r);e(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(c=>c.id===r?{...c,is_running:o.is_running,status:o.status}:c)}))}catch(o){e({error:o.message})}},loadDeferredItems:(r,o)=>{const l=Yu.get(o);if(l)return l;const c=T0(r,o).then(({items:d})=>(e(f=>{const h=f.sessionDetails[r];return h?{sessionDetails:{...f.sessionDetails,[r]:Tn(h,o,m=>ck(m,d))}}:{}}),!0)).catch(d=>(n().addToast("error",`Failed to load tool calls — ${d.message}`),!1)).finally(()=>Yu.delete(o));return Yu.set(o,c),c}});async function yk(e){const{sessions:n}=await jt(`/claude-sessions?workspace=${encodeURIComponent(e)}`);return n}function xk(e,n){return ut(`/claude-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}async function wk(e){const{sessions:n}=await jt(`/codex-sessions?workspace=${encodeURIComponent(e)}`);return n}function kk(e,n){return ut(`/codex-sessions/${encodeURIComponent(e)}/import`,{workspace:n})}const wd=["claude","codex"],Zl={claude:"Claude Code",codex:"Codex"};function Qu(e){return`${e.runtime}:${e.id}`}function Ev(e){const n=e.length===1?"session":"sessions";return new Set(e).size===1?`${e.length} ${Zl[e[0]]} ${n}`:`${e.length} ${n}`}const Sk={claude:e=>yk(e),codex:e=>wk(e)},bk={claude:(e,n)=>xk(e,n),codex:(e,n)=>kk(e,n)};async function _v(e){const n=await Promise.allSettled(wd.map(l=>Sk[l](e))),r=[],o={};return n.forEach((l,c)=>{const d=wd[c];l.status==="fulfilled"?r.push(...l.value.map(f=>({...f,runtime:d}))):o[d]=Vn(l.reason)}),r.sort((l,c)=>l.last_modified<c.last_modified?1:l.last_modified>c.last_modified?-1:0),{sessions:r,errors:o}}function Nk(e,n){return bk[e.runtime](e.id,n)}const xm={available:!0,reason:null};let Zu=null;const Tk=(e,n)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=n().pickerSupport;return r?Promise.resolve(r):(Zu??(Zu=z0().then(o=>typeof(o==null?void 0:o.available)!="boolean"?xm:(e({pickerSupport:o}),o)).catch(()=>xm).finally(()=>{Zu=null})),Zu)},createWorkspaceAt:async r=>{const o=await $0(r.trim());return e(l=>({workspaces:[...l.workspaces.filter(c=>c.id!==o.id),o]})),o},addWorkspace:async r=>{e({error:null});try{const o=await n().createWorkspaceAt(r);return n().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return n().addToast("error",`Failed to add workspace — ${Vn(o)}`),null}},removeWorkspace:async r=>{e({error:null});try{await P0(r);const o=await yv();e({workspaces:o}),n().addToast("info","Workspace hidden")}catch(o){n().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{e({error:null});try{const o=n().lastModelConfig,l=await Kd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});e(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(o){e({error:o.message}),n().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await n().loadPickerSupport()).available){n().setShowAddWorkspaceDialog(!0);return}try{const o=await xv();if(o.cancelled||!o.path)return;await n().addWorkspace(o.path)}catch(o){n().addToast("error",`Failed to pick directory — ${o.message}`)}},importSessions:async(r,o)=>{const l=[],c=[],d=[];for(const f of[...o].reverse())try{l.unshift(await Nk(f,r)),c.unshift(f.runtime)}catch(h){d.unshift({...f,error:Vn(h)})}if(l.length>0){e(h=>({sessions:[...l,...h.sessions]})),await n().selectSession(l[0].id);const f=Ev(c);n().addLogEntry("INFO",`Imported ${f} into ${r}`),n().addToast("success",l.length===1?`Imported — ${l[0].title||`${Zl[c[0]]} session`}`:`Imported ${f}`)}return{imported:l,failed:d}}}),Zd=e=>e?`?cwd=${encodeURIComponent(e)}`:"";function Rv(e,n){return jt(`/providers/${encodeURIComponent(e)}/models${Zd(n)}`)}function Ck(e,n){return jt(`/providers/${encodeURIComponent(e)}/inference${Zd(n)}`)}function jk(e,n,r){return mv(`/providers/${encodeURIComponent(e)}/inference/${encodeURIComponent(n)}/credentials`,r)}function Ek(e,n,r){return Hi(`/providers/${encodeURIComponent(e)}/inference/${encodeURIComponent(n)}/credentials${Zd(r)}`)}function _k(e){var n;return e instanceof Br&&((n=e.body)==null?void 0:n.code)==="repoburg_sign_in_required"}async function wm(){const e=await fetch(`${gt()}/auth/status`,{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`auth status ${e.status}`);return await e.json()}async function Rk(){const e=await fetch(`${gt()}/auth/initiate`,{method:"POST"}),n=await e.json().catch(()=>({}));if(!e.ok)throw new Error(n.error??`initiate ${e.status}`);return n}async function Ak(){await fetch(`${gt()}/auth/cancel`,{method:"POST"}).catch(()=>{})}const km="curl -fsSL https://repoburg.com/install.sh | bash",Ik=2e3,Av="agentpane:daemon-seen";function Dk(e=gt()){if(!e)return!1;try{const n=new URL(e);return n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1")}catch{return!1}}async function Mk(e=gt()){try{return await fetch(`${e}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function Lk(){try{return localStorage.getItem(Av)==="true"}catch{return!1}}function Ok(){try{localStorage.setItem(Av,"true")}catch{}}function $k(e){let n=!1,r=!1,o=!1,l=null;function c(){l!==null&&(clearTimeout(l),l=null)}async function d(){if(n||r)return;c(),r=!0;const m=await Mk();if(r=!1,!n){if(m){Ok(),h(),e.onReady();return}o||(o=!0,e.onMissing()),l=setTimeout(()=>void d(),Ik)}}function f(){document.visibilityState==="visible"&&d()}function h(){n=!0,c(),window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),d(),h}const kd=160,Sd=480,Pk=240,Tl=220,zk=300,Fk=600,Uk=36;function Ei(e,n){return n?`${e}
45
+ ${n}`:e}function Cl(){return typeof window>"u"?Fk:Math.max(Tl,Math.round(window.innerWidth*.7))}const Sm="agentpane:sidebar-width",bm="agentpane:right-panel-width",Ju="agentpane:right-panel-collapsed";function Nm(e,n,r,o){try{const l=localStorage.getItem(e);if(l==null)return o;const c=Number(l);return Number.isFinite(c)?Math.min(r,Math.max(n,c)):o}catch{return o}}function Bk(e){try{return localStorage.getItem(e)==="true"}catch{return!1}}function Tm(e,n){try{localStorage.setItem(e,String(n))}catch{}}const Cm=200,Wk=(e,n)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,modelLists:{},modelsLoading:{},inferenceLists:{},inferenceLoading:{},inferenceErrors:{},inferenceSignIn:{},showModelSelector:!1,sidebarWidth:Nm(Sm,kd,Sd,Pk),rightPanelWidth:Nm(bm,Tl,Cl(),zk),rightPanelCollapsed:Bk(Ju),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,terminalViewOpen:!1,canGoBack:!1,canGoForward:!1,daemonStatus:Dk()?"checking":"ready",setActiveTurnIndex:r=>e({activeTurnIndex:r}),switchRightTab:r=>{n().rightPanelCollapsed&&Tm(Ju,!1),e({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>e({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>e({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>e({importSessionsWorkspace:r}),setShowRemoteModal:r=>e({showRemoteModal:r}),setShowCommandPalette:r=>e({showCommandPalette:r}),setShowModelSelector:r=>e({showModelSelector:r}),setDeepLinkThreadId:r=>e({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Sd,Math.max(kd,Math.round(r)));e({sidebarWidth:o});try{localStorage.setItem(Sm,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(Cl(),Math.max(Tl,Math.round(r)));e({rightPanelWidth:o});try{localStorage.setItem(bm,String(o))}catch{}},setRightPanelCollapsed:r=>{e({rightPanelCollapsed:r}),Tm(Ju,r)},toggleRightPanel:()=>n().setRightPanelCollapsed(!n().rightPanelCollapsed),toggleVscodeView:()=>{if(n().vscodeViewOpen){e({vscodeViewOpen:!1});return}e({vscodeViewOpen:!0,terminalViewOpen:!1,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>e({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>e({usageViewOpen:!n().usageViewOpen,terminalViewOpen:!1}),toggleTerminalView:()=>e(n().terminalViewOpen?{terminalViewOpen:!1}:{terminalViewOpen:!0,vscodeViewOpen:!1,usageViewOpen:!1}),setDaemonStatus:r=>e({daemonStatus:r}),addToast:(r,o,l,c)=>{const d=Math.random().toString(36).slice(2,9);e(f=>({toasts:[...f.toasts,{id:d,type:r,message:o,undoAction:l,undoLabel:c}]}))},removeToast:r=>{e(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});e(c=>{const d=[...c.eventLog,{time:l,level:r,message:o}];return d.length>Cm&&d.splice(0,d.length-Cm),{eventLog:d}})},loadModels:async(r,o,l)=>{const c=Ei(r,o);if(!(n().modelsLoading[c]&&!l)){e(d=>({modelsLoading:{...d.modelsLoading,[c]:!0}}));try{const d=await Rv(r,o);d.length>0&&e(f=>({modelLists:{...f.modelLists,[c]:d}}))}catch{}finally{e(d=>{const f={...d.modelsLoading};return delete f[c],{modelsLoading:f}})}}},loadInferenceProviders:async(r,o)=>{const l=Ei(r,o);if(!n().inferenceLoading[l]){e(c=>({inferenceLoading:{...c.inferenceLoading,[l]:!0}}));try{const c=await Ck(r,o);e(d=>{const f={...d.inferenceErrors};delete f[l];const h={...d.inferenceSignIn};return delete h[l],{inferenceLists:{...d.inferenceLists,[l]:c},inferenceErrors:f,inferenceSignIn:h}})}catch(c){e(d=>{const f={...d.inferenceSignIn};return _k(c)?f[l]=!0:delete f[l],{inferenceErrors:{...d.inferenceErrors,[l]:Vn(c)},inferenceSignIn:f}})}finally{e(c=>{const d={...c.inferenceLoading};return delete d[l],{inferenceLoading:d}})}}},setInferenceProvider:(r,o,l)=>{const c=Ei(r,o);e(d=>{const f=d.inferenceLists[c]??[],h=f.some(m=>m.id===l.id)?f.map(m=>m.id===l.id?l:m):[...f,l];return{inferenceLists:{...d.inferenceLists,[c]:h}}})}}),Hk=(e,n)=>({createThread:async(r,o)=>{try{await ut(`/sessions/${r}/threads`,o),n().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){n().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await ut(`/sessions/${r}/threads/${o}/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,o)=>{try{await ut(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),n().addLogEntry("INFO","Thread turn cancelled")}catch(l){n().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await ms(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){n().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await ms(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){n().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const c=await ut(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),d=`
46
46
  [Shared from a resolved discussion thread — summary of its findings]
47
47
 
48
48
  \`\`\`QUOTE
49
49
  ${c.summary}
50
50
  \`\`\`
51
51
 
52
- `;return e({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,o)=>{try{await Hi(`/sessions/${r}/threads/${o}`)}catch(l){n().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await ut(`/sessions/${r}/sidecar`,{message:o}),n().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return n().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(f=>f.id===o?{...f,turns:[...f.turns??[],{...l,items:[]}]}:f)}}}:{}})},onThreadResolved:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];if(!d)return{};const f=(d.threads??[]).map(h=>h.id===o?{...h,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:h);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:f}}}})},onThreadDeleted:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),Bk=(e,n)=>({folders:[],loadFolders:async()=>{const r=await vv();e({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await $0(r,o);return e(c=>({folders:[...c.folders,l]})),l}catch(l){return n().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await um(r,{name:o});e(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 o=n().folders,l=n().sessions;e(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 P0(r)}catch(c){e({folders:o,sessions:l}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=n().sessions,l=new Map(r.map(c=>[c.id,c]));e(c=>({sessions:c.sessions.map(d=>{const f=l.get(d.id);return f?{...d,folder_id:f.folder_id,sort_order:f.sort_order}:d})}));try{await z0(r)}catch(c){e({sessions:o}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=n().folders,l=new Map(r.map((c,d)=>[c,d]));e(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)=>um(c,{sort_order:d})))}catch(c){e({folders:o}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function jm(){return jt("/apps")}function Wk(){return jt("/apps/root")}function Em(e){return jt(`/apps/${e}/source`)}function _m(e,n=""){return jt(`/apps/${e}/state?workspace=${encodeURIComponent(n)}`)}function _v(e,n,r=""){return fv(`/apps/${e}/state?workspace=${encodeURIComponent(r)}`,n)}function Hk(e){return Hi(`/apps/${e}`)}function Vk(e){return jt(`/apps/${e}/sessions`)}async function Rm(e,n){try{return await jt(`/apps/${e}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof Br&&r.status===404)return null;throw r}}function Kk(e,n,r={}){const o=new URLSearchParams({workspace:n});return r.lifecycle&&o.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&o.set("running",String(r.running)),jt(`/apps/${e}/workspace-sessions?${o}`)}async function Gk(e,n,r){try{return await jt(`/apps/${e}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(o){if(o instanceof Br&&o.status===404)return null;throw o}}function qk(e,n){return ut(`/apps/${e}/sessions/${encodeURIComponent(n)}/cancel`)}function Xk(e,n,r){return ms(`/apps/${e}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function Yk(e,n,r,o){const l=await ut("/apps/mcp/call",{tool:`${e}__${r}`,args:o,workspace:n});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function Qk(){return jt("/apps/examples")}function Zk(e){return ut(`/apps/examples/${e}/install`,{})}function Jk(e){return ut("/apps",e)}async function Rv(e,n){let r=`${e.status} ${e.statusText}`,o=null;try{o=await e.json();const l=o==null?void 0:o.error;typeof l=="string"&&l&&(r=`${r} — ${l}`)}catch{}throw new Br(`${n} failed: ${r}`,e.status,o)}async function e1(e,n,r={}){const o=new URLSearchParams({id:e});r.data&&o.set("data","1");const l=await fetch(`${xt()}/api/apps/import?${o}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:n});return l.ok||await Rv(l,"Import"),await l.json()}async function t1(e,n={}){const r=n.data?"?data=1":"",o=await fetch(`${xt()}/api/apps/${encodeURIComponent(e)}/export${r}`);return o.ok||await Rv(o,"Export"),o.blob()}function n1(e,n,r){return ut(`/apps/mcp/calls/${e}/result`,{result:n,error:null})}function s1(e,n){return ut(`/apps/${e}/edit-session`,n)}function r1(e,n){return ut(`/apps/${e}/files`,n)}async function o1(e,n){const r=await fetch(`${xt()}/api/apps/${e}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${e}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function i1(e,n){const r=await fetch(`${xt()}/api/apps/${e}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${e}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const hl=new Set;async function ed(e,n){hl.add(n),await e().loadApps();const r=e().apps.find(o=>o.id===n);e().openAppTab(n),e().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const bd="agentpane:app-workspaces";function a1(){try{const e=JSON.parse(localStorage.getItem(bd)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}const l1=(e,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appExportId:null,appWorkspaces:a1(),loadApps:async()=>{try{const[r,o]=await Promise.all([jm(),Wk().catch(()=>null)]);return r.forEach(l=>hl.add(l.id)),e(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await jm();for(const o of r)hl.has(o.id)||(hl.add(o.id),n().addToast("success",`New mini app discovered: ${o.title}`));e({apps:r})}catch{}},openAppTab:r=>{e(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Mi(r)]),setActiveAppTab:r=>e({activeAppTabId:r}),openAppCatalog:()=>e({appCatalogOpen:!0}),closeAppCatalog:()=>e({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{e(l=>{const c={...l.appWorkspaces,[r]:o};try{localStorage.setItem(bd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await Zk(r),await ed(n,r),!0}catch(o){return n().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await Jk(r),await ed(n,r.id),!0}catch(o){return n().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppZip:async(r,o,l)=>{try{const c=await e1(r,o,l);if(await ed(n,r),c.data){const{instances:d,files:f}=c.data;n().addToast("success",`Imported ${r} with its data: ${d} state instance${d===1?"":"s"}, ${f} file${f===1?"":"s"}`)}return!0}catch(c){return n().addToast("error",`Failed to import app — ${Vn(c)}`),!1}},openAppExport:r=>e({appExportId:r}),closeAppExport:()=>e({appExportId:null}),exportApp:async(r,o)=>{try{const l=await t1(r,o),c=URL.createObjectURL(l),d=document.createElement("a");return d.href=c,d.download=`${r}.zip`,document.body.appendChild(d),d.click(),d.remove(),setTimeout(()=>URL.revokeObjectURL(c),1e4),!0}catch(l){return n().addToast("error",`Failed to export app — ${Vn(l)}`),!1}},startAppEdit:async r=>{try{const o=n().lastModelConfig,l=await s1(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});n().sessions.some(c=>c.id===l.id)||e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){n().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=n().apps.find(l=>l.id===r);if(o)try{await _v(r,{pinned:!o.pinned}),await n().loadApps()}catch(l){n().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await Hk(r);const o=n().activeSessionId;e(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(bd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(f=>f.id!==r),openAppTabs:c.openAppTabs.filter(f=>f!==r),...qd(c,new Set([Mi(r)])),appWorkspaces:d}});const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(o){n().addToast("error",`Failed to delete app — ${o.message}`)}}}),c1=(e,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const l=[...n().tabOrder],c=l.indexOf(r),d=l.indexOf(o);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),e({tabOrder:l}))},closeTabs:r=>{const o=n(),l=new Set(r.filter(h=>o.tabOrder.includes(h)));if(l.size===0)return;const c=qd(o,l),d=o.tabOrder.map((h,m)=>({key:h,index:m})).filter(h=>l.has(h.key)).reverse();e({...c,openTabs:o.openTabs.filter(h=>!l.has(Fr(h))),openAppTabs:o.openAppTabs.filter(h=>!l.has(Mi(h))),tabOrder:o.tabOrder.filter(h=>!l.has(h)),closedTabs:[...o.closedTabs,...d].slice(-20)});const f=c.activeSessionId;f!==null&&f!==o.activeSessionId&&n().selectSession(f,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),o=[...r.closedTabs];let l=o.pop();for(;l&&!wv(r,l.key);)l=o.pop();if(!l){e({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:f}=mr(l.key);d==="app"?(e({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,f]}),n().openAppTab(f)):(e({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,f]}),n().selectSession(f))}}),Am=3e3,Wn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Hn=[];let jl=0,Jd=0,El=0,ef=0,_l=0,tf=0,nf=0;const Li=new Map,Oi=new Map;let Eo=new Map,Co=0,_o=new Map,td=!1;function Rl(e,n,r){if(Hn.push({t:Date.now(),cat:e,msg:n,ms:r}),Hn.length>Am){const o=Hn.length-Am;Hn.splice(0,o),On=Math.max(0,On-o)}}function jo(e,n,r){Rl(e,n,r),console.log(`[perf:${e}] ${n}`)}function Av(e){jo("note",e)}function Iv(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function u1(e,n){let r=Eo.get(e);r||Eo.set(e,r={n:0,bytes:0}),r.n++,r.bytes+=n;let o=Li.get(e);o||Li.set(e,o={n:0,bytes:0}),o.n++,o.bytes+=n}function d1(){Co++,nf++}function f1(e){_o.set(e,(_o.get(e)??0)+1),Oi.set(e,(Oi.get(e)??0)+1)}let ml=0;function p1(){ml=performance.now()}function h1(){const e=performance.now(),n=ml?e-ml:null;ml=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-e+n;r>Wn.keypressMs&&jo("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-e)}ms)`)})}const m1=5e3,Dv=500,Im=2e3;let On=0,nd=!1;function g1(e){return ut("/perf-log",{entries:e}).then(()=>{On+=e.length})}function v1(){if(nd||On>=Hn.length)return;const e=Hn.slice(On,On+Dv);e.length!==0&&(nd=!0,g1(e).catch(()=>{Hn.length-On>Im&&(On=Math.max(On,Hn.length-Im))}).finally(()=>{nd=!1}))}function Dm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||On>=Hn.length)return;const e=Hn.slice(On,On+Dv);if(e.length!==0)try{const n=new Blob([JSON.stringify({entries:e})],{type:"application/json"});navigator.sendBeacon(`${xt()}/api/perf-log`,n),On+=e.length}catch{}}function y1(){let e=0;for(const o of Eo.values())e+=o.n;const n=[];if(e>0){const o=[...Eo.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${Iv(c.bytes)})`).join(", ");n.push(`ws ${e}/s [${o}]`)}Co>0&&n.push(`store ${Co}/s`);const r=[..._o.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const o=n.join(" · ");Rl("stat",o);const l=[..._o.values()].some(c=>c>Wn.renderPerSecLog);(e>Wn.wsPerSecLog||Co>Wn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}Eo=new Map,Co=0,_o=new Map}function x1(e){if(e instanceof Element){const n=e.id?`#${e.id}`:"",r=typeof e.className=="string"&&e.className?`.${e.className.trim().split(/\s+/)[0]}`:"";return`${e.tagName.toLowerCase()}${n}${r}`}return e?"window":"unknown"}function w1(){if(td||typeof window>"u")return()=>{};td=!0,jl=Date.now();const e=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Wn.lagMs&&(Jd++,El=Math.max(El,d),jo("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(e.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const f=h=>{const m=h-c;c=h,m>Wn.frameGapMs&&jo("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(f)};d=window.requestAnimationFrame(f),e.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var f;for(const h of d.getEntries()){const m=h.duration;if(m<Wn.longtaskBufferMs)continue;ef++,_l=Math.max(_l,m);const v=(f=h.attribution)==null?void 0:f[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Wn.longtaskLogMs?jo("longtask",x,m):Rl("longtask",x,m)}});c.observe({type:"longtask",buffered:!1}),e.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const f of d.getEntries()){const h=f.duration,m=f.processingStart-f.startTime;tf++;const v=`${f.name} ${Math.round(h)}ms (input delay ${Math.round(m)}ms) on ${x1(f.target)}`;h>=Wn.eventLogMs?jo("input",v,h):Rl("input",v,h)}});c.observe({type:"event",durationThreshold:Wn.eventBufferMs}),e.push(()=>c.disconnect())}catch{}}const o=window.setInterval(y1,1e3);e.push(()=>window.clearInterval(o)),Av("perf logger session started");const l=window.setInterval(v1,m1);return e.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Dm),e.push(()=>window.removeEventListener("beforeunload",Dm)),window.__agentPanePerf={dump:Mv,reset:Lv},()=>{e.forEach(c=>c()),td=!1}}function Mv(){const e=[],n=jl?Math.round((Date.now()-jl)/1e3):0;if(e.push("=== agent-pane perf report ==="),e.push(`uptime ${n}s · ${Hn.length} buffered entries`),e.push(`event-loop lag: ${Jd} blocks >${Wn.lagMs}ms (max ${Math.round(El)}ms)`),e.push(`long tasks: ${ef} ≥${Wn.longtaskBufferMs}ms (max ${Math.round(_l)}ms)`),e.push(`slow input events (≥${Wn.eventBufferMs}ms): ${tf}`),e.push(`store updates: ${nf} total`),Li.size>0){e.push("ws messages by type (top 15):");for(const[r,o]of[...Li.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))e.push(` ${r}: ${o.n} msgs, ${Iv(o.bytes)}`)}if(Oi.size>0){e.push("render counts by component:");for(const[r,o]of[...Oi.entries()].sort((l,c)=>c[1]-l[1]))e.push(` ${r}: ${o}`)}e.push("--- last 200 entries ---");for(const r of Hn.slice(-200))e.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return e.join(`
53
- `)}function Lv(){Hn.length=0,On=0,jl=Date.now(),Jd=0,El=0,ef=0,_l=0,tf=0,nf=0,Li.clear(),Oi.clear(),Eo=new Map,Co=0,_o=new Map}const Bt={start:w1,note:Av,trackWsEvent:u1,trackStoreUpdate:d1,trackRender:f1,markKeystroke:p1,markInputChange:h1,dump:Mv,reset:Lv},R=a0()((...e)=>({...hk(...e),...Sk(...e),...rk(...e),...Fk(...e),...Uk(...e),...Bk(...e),...l1(...e),...c1(...e)}));typeof window<"u"&&(R.subscribe(()=>Bt.trackStoreUpdate()),U0(R),V0(R));const k1="modulepreload",S1=function(e){return"/"+e},Mm={},b1=function(n,r,o){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 f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=d(r.map(m=>{if(m=S1(m),m in Mm)return;Mm[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":k1,v||(x.as="script"),x.crossOrigin="",x.href=m,h&&x.setAttribute("nonce",h),document.head.appendChild(x),v)return new Promise((S,j)=>{x.addEventListener("load",S),x.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return l.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})};function Nd(e){switch(e){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 N1(e,n,r=!1,o="working",l=0){if(o==="finished")return"";if(e==="interrupted")return"interrupted";if(n)return"running";if(l>0)return"background";if(r&&e!=="failed")return"queued";switch(e){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function T1(e,n,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(e==="interrupted")return"Interrupted";if(n)return"Running";if(l>0)return"Background";if(r&&e!=="failed")return"Review Pending";switch(e){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return e}}function Jl(e,n=0){const r=e.is_running===1,o=e.lifecycle==="finished",l=Nd(e.runtime_type),c=N1(e.status,r,e.has_unreviewed===1,e.lifecycle,n),d=T1(e.status,r,e.has_unreviewed===1,e.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:o,backgroundTaskCount:n}}function Vi(e,n,r=!0){y.useEffect(()=>{if(!r)return;function o(l){e.current&&!e.current.contains(l.target)&&n()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[e,n,r])}function Do(e,n=!0){y.useEffect(()=>{if(!n)return;function r(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n])}function sf({status:e,size:n=6,title:r}){return a.jsx("span",{className:`status-dot ${e}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function rf({iconClass:e,iconText:n,size:r=20}){return a.jsx("span",{className:`runtime-icon ${e}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
52
+ `;return e({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,o)=>{try{await Hi(`/sessions/${r}/threads/${o}`)}catch(l){n().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await ut(`/sessions/${r}/sidecar`,{message:o}),n().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return n().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:[...d.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];return d?{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:(d.threads??[]).map(f=>f.id===o?{...f,turns:[...f.turns??[],{...l,items:[]}]}:f)}}}:{}})},onThreadResolved:(r,o,l)=>{e(c=>{const d=c.sessionDetails[r];if(!d)return{};const f=(d.threads??[]).map(h=>h.id===o?{...h,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:h);return{sessionDetails:{...c.sessionDetails,[r]:{...d,threads:f}}}})},onThreadDeleted:(r,o)=>{e(l=>{const c=l.sessionDetails[r];return c?{sessionDetails:{...l.sessionDetails,[r]:{...c,threads:(c.threads??[]).filter(d=>d.id!==o)}}}:{}})}}),Vk=(e,n)=>({folders:[],loadFolders:async()=>{const r=await wv();e({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await F0(r,o);return e(c=>({folders:[...c.folders,l]})),l}catch(l){return n().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await um(r,{name:o});e(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 o=n().folders,l=n().sessions;e(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 U0(r)}catch(c){e({folders:o,sessions:l}),n().addToast("error",`Failed to delete folder — ${c.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=n().sessions,l=new Map(r.map(c=>[c.id,c]));e(c=>({sessions:c.sessions.map(d=>{const f=l.get(d.id);return f?{...d,folder_id:f.folder_id,sort_order:f.sort_order}:d})}));try{await B0(r)}catch(c){e({sessions:o}),n().addToast("error",`Failed to save session order — ${c.message}`)}},reorderFolders:async r=>{const o=n().folders,l=new Map(r.map((c,d)=>[c,d]));e(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)=>um(c,{sort_order:d})))}catch(c){e({folders:o}),n().addToast("error",`Failed to save folder order — ${c.message}`)}}});function jm(){return jt("/apps")}function Kk(){return jt("/apps/root")}function Em(e){return jt(`/apps/${e}/source`)}function _m(e,n=""){return jt(`/apps/${e}/state?workspace=${encodeURIComponent(n)}`)}function Iv(e,n,r=""){return mv(`/apps/${e}/state?workspace=${encodeURIComponent(r)}`,n)}function Gk(e){return Hi(`/apps/${e}`)}function qk(e){return jt(`/apps/${e}/sessions`)}async function Rm(e,n){try{return await jt(`/apps/${e}/sessions/${encodeURIComponent(n)}`)}catch(r){if(r instanceof Br&&r.status===404)return null;throw r}}function Xk(e,n,r={}){const o=new URLSearchParams({workspace:n});return r.lifecycle&&o.set("lifecycle",r.lifecycle),typeof r.running=="boolean"&&o.set("running",String(r.running)),jt(`/apps/${e}/workspace-sessions?${o}`)}async function Yk(e,n,r){try{return await jt(`/apps/${e}/workspace-sessions/${encodeURIComponent(r)}?workspace=${encodeURIComponent(n)}`)}catch(o){if(o instanceof Br&&o.status===404)return null;throw o}}function Qk(e,n){return ut(`/apps/${e}/sessions/${encodeURIComponent(n)}/cancel`)}function Zk(e,n,r){return ms(`/apps/${e}/sessions/${encodeURIComponent(n)}`,{lifecycle:r})}async function Jk(e,n,r,o){const l=await ut("/apps/mcp/call",{tool:`${e}__${r}`,args:o,workspace:n});if(!l.ok)throw new Error(l.error||`callTool: ${r} failed`);return l.result}function e1(){return jt("/apps/examples")}function t1(e){return ut(`/apps/examples/${e}/install`,{})}function n1(e){return ut("/apps",e)}async function Dv(e,n){let r=`${e.status} ${e.statusText}`,o=null;try{o=await e.json();const l=o==null?void 0:o.error;typeof l=="string"&&l&&(r=`${r} — ${l}`)}catch{}throw new Br(`${n} failed: ${r}`,e.status,o)}async function s1(e,n,r={}){const o=new URLSearchParams({id:e});r.data&&o.set("data","1");const l=await fetch(`${gt()}/api/apps/import?${o}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:n});return l.ok||await Dv(l,"Import"),await l.json()}async function r1(e,n={}){const r=n.data?"?data=1":"",o=await fetch(`${gt()}/api/apps/${encodeURIComponent(e)}/export${r}`);return o.ok||await Dv(o,"Export"),o.blob()}function o1(e,n,r){return ut(`/apps/mcp/calls/${e}/result`,{result:n,error:null})}function i1(e,n){return ut(`/apps/${e}/edit-session`,n)}function a1(e,n){return ut(`/apps/${e}/files`,n)}async function l1(e,n){const r=await fetch(`${gt()}/api/apps/${e}/files/${encodeURIComponent(n)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${e}/files/${n}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function c1(e,n){const r=await fetch(`${gt()}/api/apps/${e}/files/${encodeURIComponent(n)}`);if(!r.ok)throw new Error(`GET /apps/${e}/files/${n} failed: ${r.status} ${r.statusText}`);return r.blob()}const hl=new Set;async function ed(e,n){hl.add(n),await e().loadApps();const r=e().apps.find(o=>o.id===n);e().openAppTab(n),e().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??n}`)}const bd="agentpane:app-workspaces";function u1(){try{const e=JSON.parse(localStorage.getItem(bd)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}const d1=(e,n)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appExportId:null,appWorkspaces:u1(),loadApps:async()=>{try{const[r,o]=await Promise.all([jm(),Kk().catch(()=>null)]);return r.forEach(l=>hl.add(l.id)),e(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await jm();for(const o of r)hl.has(o.id)||(hl.add(o.id),n().addToast("success",`New mini app discovered: ${o.title}`));e({apps:r})}catch{}},openAppTab:r=>{e(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>n().closeTabs([Mi(r)]),setActiveAppTab:r=>e({activeAppTabId:r}),openAppCatalog:()=>e({appCatalogOpen:!0}),closeAppCatalog:()=>e({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{e(l=>{const c={...l.appWorkspaces,[r]:o};try{localStorage.setItem(bd,JSON.stringify(c))}catch{}return{appWorkspaces:c}})},installExampleApp:async r=>{try{return await t1(r),await ed(n,r),!0}catch(o){return n().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await n1(r),await ed(n,r.id),!0}catch(o){return n().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppZip:async(r,o,l)=>{try{const c=await s1(r,o,l);if(await ed(n,r),c.data){const{instances:d,files:f}=c.data;n().addToast("success",`Imported ${r} with its data: ${d} state instance${d===1?"":"s"}, ${f} file${f===1?"":"s"}`)}return!0}catch(c){return n().addToast("error",`Failed to import app — ${Vn(c)}`),!1}},openAppExport:r=>e({appExportId:r}),closeAppExport:()=>e({appExportId:null}),exportApp:async(r,o)=>{try{const l=await r1(r,o),c=URL.createObjectURL(l),d=document.createElement("a");return d.href=c,d.download=`${r}.zip`,document.body.appendChild(d),d.click(),d.remove(),setTimeout(()=>URL.revokeObjectURL(c),1e4),!0}catch(l){return n().addToast("error",`Failed to export app — ${Vn(l)}`),!1}},startAppEdit:async r=>{try{const o=n().lastModelConfig,l=await i1(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});n().sessions.some(c=>c.id===l.id)||e(c=>({sessions:[l,...c.sessions]})),await n().selectSession(l.id),n().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){n().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=n().apps.find(l=>l.id===r);if(o)try{await Iv(r,{pinned:!o.pinned}),await n().loadApps()}catch(l){n().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await Gk(r);const o=n().activeSessionId;e(c=>{const d={...c.appWorkspaces};delete d[r];try{localStorage.setItem(bd,JSON.stringify(d))}catch{}return{apps:c.apps.filter(f=>f.id!==r),openAppTabs:c.openAppTabs.filter(f=>f!==r),...qd(c,new Set([Mi(r)])),appWorkspaces:d}});const l=n().activeSessionId;l&&l!==o&&n().selectSession(l,{keepAppView:!0}),n().addToast("success",`Mini app deleted: ${r}`)}catch(o){n().addToast("error",`Failed to delete app — ${o.message}`)}}}),f1=(e,n)=>({tabOrder:[],closedTabs:[],moveTab:(r,o)=>{const l=[...n().tabOrder],c=l.indexOf(r),d=l.indexOf(o);c===-1||d===-1||c===d||(l.splice(d,0,...l.splice(c,1)),e({tabOrder:l}))},closeTabs:r=>{const o=n(),l=new Set(r.filter(h=>o.tabOrder.includes(h)));if(l.size===0)return;const c=qd(o,l),d=o.tabOrder.map((h,m)=>({key:h,index:m})).filter(h=>l.has(h.key)).reverse();e({...c,openTabs:o.openTabs.filter(h=>!l.has(Fr(h))),openAppTabs:o.openAppTabs.filter(h=>!l.has(Mi(h))),tabOrder:o.tabOrder.filter(h=>!l.has(h)),closedTabs:[...o.closedTabs,...d].slice(-20)});const f=c.activeSessionId;f!==null&&f!==o.activeSessionId&&n().selectSession(f,{keepAppView:!0})},reopenClosedTab:()=>{const r=n(),o=[...r.closedTabs];let l=o.pop();for(;l&&!bv(r,l.key);)l=o.pop();if(!l){e({closedTabs:[]});return}const c=[...r.tabOrder];c.splice(l.index,0,l.key);const{kind:d,id:f}=mr(l.key);d==="app"?(e({closedTabs:o,tabOrder:c,openAppTabs:[...r.openAppTabs,f]}),n().openAppTab(f)):(e({closedTabs:o,tabOrder:c,openTabs:[...r.openTabs,f]}),n().selectSession(f))}}),Am=3e3,Wn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Hn=[];let jl=0,Jd=0,El=0,ef=0,_l=0,tf=0,nf=0;const Li=new Map,Oi=new Map;let Eo=new Map,Co=0,_o=new Map,td=!1;function Rl(e,n,r){if(Hn.push({t:Date.now(),cat:e,msg:n,ms:r}),Hn.length>Am){const o=Hn.length-Am;Hn.splice(0,o),On=Math.max(0,On-o)}}function jo(e,n,r){Rl(e,n,r),console.log(`[perf:${e}] ${n}`)}function Mv(e){jo("note",e)}function Lv(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function p1(e,n){let r=Eo.get(e);r||Eo.set(e,r={n:0,bytes:0}),r.n++,r.bytes+=n;let o=Li.get(e);o||Li.set(e,o={n:0,bytes:0}),o.n++,o.bytes+=n}function h1(){Co++,nf++}function m1(e){_o.set(e,(_o.get(e)??0)+1),Oi.set(e,(Oi.get(e)??0)+1)}let ml=0;function g1(){ml=performance.now()}function v1(){const e=performance.now(),n=ml?e-ml:null;ml=0,requestAnimationFrame(()=>{if(n===null)return;const r=performance.now()-e+n;r>Wn.keypressMs&&jo("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(n)}ms, change→paint ${Math.round(performance.now()-e)}ms)`)})}const y1=5e3,Ov=500,Im=2e3;let On=0,nd=!1;function x1(e){return ut("/perf-log",{entries:e}).then(()=>{On+=e.length})}function w1(){if(nd||On>=Hn.length)return;const e=Hn.slice(On,On+Ov);e.length!==0&&(nd=!0,x1(e).catch(()=>{Hn.length-On>Im&&(On=Math.max(On,Hn.length-Im))}).finally(()=>{nd=!1}))}function Dm(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||On>=Hn.length)return;const e=Hn.slice(On,On+Ov);if(e.length!==0)try{const n=new Blob([JSON.stringify({entries:e})],{type:"application/json"});navigator.sendBeacon(`${gt()}/api/perf-log`,n),On+=e.length}catch{}}function k1(){let e=0;for(const o of Eo.values())e+=o.n;const n=[];if(e>0){const o=[...Eo.entries()].sort((l,c)=>c[1].n-l[1].n).map(([l,c])=>`${l}×${c.n}(${Lv(c.bytes)})`).join(", ");n.push(`ws ${e}/s [${o}]`)}Co>0&&n.push(`store ${Co}/s`);const r=[..._o.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&n.push(`renders ${r.join(" ")}`),n.length>0){const o=n.join(" · ");Rl("stat",o);const l=[..._o.values()].some(c=>c>Wn.renderPerSecLog);(e>Wn.wsPerSecLog||Co>Wn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}Eo=new Map,Co=0,_o=new Map}function S1(e){if(e instanceof Element){const n=e.id?`#${e.id}`:"",r=typeof e.className=="string"&&e.className?`.${e.className.trim().split(/\s+/)[0]}`:"";return`${e.tagName.toLowerCase()}${n}${r}`}return e?"window":"unknown"}function b1(){if(td||typeof window>"u")return()=>{};td=!0,jl=Date.now();const e=[];let n=performance.now()+250;const r=window.setInterval(()=>{const c=performance.now(),d=c-n;n=c+250,d>Wn.lagMs&&(Jd++,El=Math.max(El,d),jo("lag",`event loop blocked ${Math.round(d)}ms`))},250);if(e.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let c=performance.now(),d=0;const f=h=>{const m=h-c;c=h,m>Wn.frameGapMs&&jo("lag",`frame gap ${Math.round(m)}ms`),d=window.requestAnimationFrame(f)};d=window.requestAnimationFrame(f),e.push(()=>window.cancelAnimationFrame(d))}if(typeof PerformanceObserver<"u"){try{const c=new PerformanceObserver(d=>{var f;for(const h of d.getEntries()){const m=h.duration;if(m<Wn.longtaskBufferMs)continue;ef++,_l=Math.max(_l,m);const v=(f=h.attribution)==null?void 0:f[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Wn.longtaskLogMs?jo("longtask",x,m):Rl("longtask",x,m)}});c.observe({type:"longtask",buffered:!1}),e.push(()=>c.disconnect())}catch{}try{const c=new PerformanceObserver(d=>{for(const f of d.getEntries()){const h=f.duration,m=f.processingStart-f.startTime;tf++;const v=`${f.name} ${Math.round(h)}ms (input delay ${Math.round(m)}ms) on ${S1(f.target)}`;h>=Wn.eventLogMs?jo("input",v,h):Rl("input",v,h)}});c.observe({type:"event",durationThreshold:Wn.eventBufferMs}),e.push(()=>c.disconnect())}catch{}}const o=window.setInterval(k1,1e3);e.push(()=>window.clearInterval(o)),Mv("perf logger session started");const l=window.setInterval(w1,y1);return e.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Dm),e.push(()=>window.removeEventListener("beforeunload",Dm)),window.__agentPanePerf={dump:$v,reset:Pv},()=>{e.forEach(c=>c()),td=!1}}function $v(){const e=[],n=jl?Math.round((Date.now()-jl)/1e3):0;if(e.push("=== agent-pane perf report ==="),e.push(`uptime ${n}s · ${Hn.length} buffered entries`),e.push(`event-loop lag: ${Jd} blocks >${Wn.lagMs}ms (max ${Math.round(El)}ms)`),e.push(`long tasks: ${ef} ≥${Wn.longtaskBufferMs}ms (max ${Math.round(_l)}ms)`),e.push(`slow input events (≥${Wn.eventBufferMs}ms): ${tf}`),e.push(`store updates: ${nf} total`),Li.size>0){e.push("ws messages by type (top 15):");for(const[r,o]of[...Li.entries()].sort((l,c)=>c[1].n-l[1].n).slice(0,15))e.push(` ${r}: ${o.n} msgs, ${Lv(o.bytes)}`)}if(Oi.size>0){e.push("render counts by component:");for(const[r,o]of[...Oi.entries()].sort((l,c)=>c[1]-l[1]))e.push(` ${r}: ${o}`)}e.push("--- last 200 entries ---");for(const r of Hn.slice(-200))e.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return e.join(`
53
+ `)}function Pv(){Hn.length=0,On=0,jl=Date.now(),Jd=0,El=0,ef=0,_l=0,tf=0,nf=0,Li.clear(),Oi.clear(),Eo=new Map,Co=0,_o=new Map}const Bt={start:b1,note:Mv,trackWsEvent:p1,trackStoreUpdate:h1,trackRender:m1,markKeystroke:g1,markInputChange:v1,dump:$v,reset:Pv},R=u0()((...e)=>({...vk(...e),...Tk(...e),...ak(...e),...Wk(...e),...Hk(...e),...Vk(...e),...d1(...e),...f1(...e)}));typeof window<"u"&&(R.subscribe(()=>Bt.trackStoreUpdate()),H0(R),q0(R));const N1="modulepreload",T1=function(e){return"/"+e},Mm={},C1=function(n,r,o){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 f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=d(r.map(m=>{if(m=T1(m),m in Mm)return;Mm[m]=!0;const v=m.endsWith(".css"),k=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":N1,v||(x.as="script"),x.crossOrigin="",x.href=m,h&&x.setAttribute("nonce",h),document.head.appendChild(x),v)return new Promise((S,j)=>{x.addEventListener("load",S),x.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return l.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})};function Nd(e){switch(e){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 j1(e,n,r=!1,o="working",l=0){if(o==="finished")return"";if(e==="interrupted")return"interrupted";if(n)return"running";if(l>0)return"background";if(r&&e!=="failed")return"queued";switch(e){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function E1(e,n,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(e==="interrupted")return"Interrupted";if(n)return"Running";if(l>0)return"Background";if(r&&e!=="failed")return"Review Pending";switch(e){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return e}}function Jl(e,n=0){const r=e.is_running===1,o=e.lifecycle==="finished",l=Nd(e.runtime_type),c=j1(e.status,r,e.has_unreviewed===1,e.lifecycle,n),d=E1(e.status,r,e.has_unreviewed===1,e.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:o,backgroundTaskCount:n}}function Vi(e,n,r=!0){y.useEffect(()=>{if(!r)return;function o(l){e.current&&!e.current.contains(l.target)&&n()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[e,n,r])}function Do(e,n=!0){y.useEffect(()=>{if(!n)return;function r(o){o.key==="Escape"&&e()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,n])}function sf({status:e,size:n=6,title:r}){return a.jsx("span",{className:`status-dot ${e}`,style:n!==6?{width:n,height:n}:void 0,title:r})}function rf({iconClass:e,iconText:n,size:r=20}){return a.jsx("span",{className:`runtime-icon ${e}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:n})}/**
54
54
  * @license lucide-react v0.469.0 - ISC
55
55
  *
56
56
  * This source code is licensed under the ISC license.
57
57
  * See the LICENSE file in the root directory of this source tree.
58
- */const C1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ov=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim();/**
58
+ */const _1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zv=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim();/**
59
59
  * @license lucide-react v0.469.0 - ISC
60
60
  *
61
61
  * This source code is licensed under the ISC license.
62
62
  * See the LICENSE file in the root directory of this source tree.
63
- */var j1={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"};/**
63
+ */var R1={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"};/**
64
64
  * @license lucide-react v0.469.0 - ISC
65
65
  *
66
66
  * This source code is licensed under the ISC license.
67
67
  * See the LICENSE file in the root directory of this source tree.
68
- */const $v=y.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},h)=>y.createElement("svg",{ref:h,...j1,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Ov("lucide",l),...f},[...d.map(([m,v])=>y.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
68
+ */const Fv=y.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...f},h)=>y.createElement("svg",{ref:h,...R1,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:zv("lucide",l),...f},[...d.map(([m,v])=>y.createElement(m,v)),...Array.isArray(c)?c:[c]]));/**
69
69
  * @license lucide-react v0.469.0 - ISC
70
70
  *
71
71
  * This source code is licensed under the ISC license.
72
72
  * See the LICENSE file in the root directory of this source tree.
73
- */const ye=(e,n)=>{const r=y.forwardRef(({className:o,...l},c)=>y.createElement($v,{ref:c,iconNode:n,className:Ov(`lucide-${C1(e)}`,o),...l}));return r.displayName=`${e}`,r};/**
73
+ */const ye=(e,n)=>{const r=y.forwardRef(({className:o,...l},c)=>y.createElement(Fv,{ref:c,iconNode:n,className:zv(`lucide-${_1(e)}`,o),...l}));return r.displayName=`${e}`,r};/**
74
74
  * @license lucide-react v0.469.0 - ISC
75
75
  *
76
76
  * This source code is licensed under the ISC license.
77
77
  * See the LICENSE file in the root directory of this source tree.
78
- */const E1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
78
+ */const A1=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
79
79
  * @license lucide-react v0.469.0 - ISC
80
80
  *
81
81
  * This source code is licensed under the ISC license.
82
82
  * See the LICENSE file in the root directory of this source tree.
83
- */const _1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
83
+ */const I1=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
84
84
  * @license lucide-react v0.469.0 - ISC
85
85
  *
86
86
  * This source code is licensed under the ISC license.
87
87
  * See the LICENSE file in the root directory of this source tree.
88
- */const Pv=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
88
+ */const Uv=ye("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
89
89
  * @license lucide-react v0.469.0 - ISC
90
90
  *
91
91
  * This source code is licensed under the ISC license.
92
92
  * See the LICENSE file in the root directory of this source tree.
93
- */const R1=ye("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"}]]);/**
93
+ */const D1=ye("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"}]]);/**
94
94
  * @license lucide-react v0.469.0 - ISC
95
95
  *
96
96
  * This source code is licensed under the ISC license.
@@ -100,12 +100,12 @@ ${c.summary}
100
100
  *
101
101
  * This source code is licensed under the ISC license.
102
102
  * See the LICENSE file in the root directory of this source tree.
103
- */const A1=ye("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"}]]);/**
103
+ */const M1=ye("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"}]]);/**
104
104
  * @license lucide-react v0.469.0 - ISC
105
105
  *
106
106
  * This source code is licensed under the ISC license.
107
107
  * See the LICENSE file in the root directory of this source tree.
108
- */const I1=ye("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/**
108
+ */const L1=ye("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/**
109
109
  * @license lucide-react v0.469.0 - ISC
110
110
  *
111
111
  * This source code is licensed under the ISC license.
@@ -130,7 +130,7 @@ ${c.summary}
130
130
  *
131
131
  * This source code is licensed under the ISC license.
132
132
  * See the LICENSE file in the root directory of this source tree.
133
- */const D1=ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
133
+ */const O1=ye("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
134
134
  * @license lucide-react v0.469.0 - ISC
135
135
  *
136
136
  * This source code is licensed under the ISC license.
@@ -140,22 +140,22 @@ ${c.summary}
140
140
  *
141
141
  * This source code is licensed under the ISC license.
142
142
  * See the LICENSE file in the root directory of this source tree.
143
- */const M1=ye("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"}]]);/**
143
+ */const $1=ye("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"}]]);/**
144
144
  * @license lucide-react v0.469.0 - ISC
145
145
  *
146
146
  * This source code is licensed under the ISC license.
147
147
  * See the LICENSE file in the root directory of this source tree.
148
- */const L1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
148
+ */const P1=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
149
149
  * @license lucide-react v0.469.0 - ISC
150
150
  *
151
151
  * This source code is licensed under the ISC license.
152
152
  * See the LICENSE file in the root directory of this source tree.
153
- */const O1=ye("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"}]]);/**
153
+ */const z1=ye("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"}]]);/**
154
154
  * @license lucide-react v0.469.0 - ISC
155
155
  *
156
156
  * This source code is licensed under the ISC license.
157
157
  * See the LICENSE file in the root directory of this source tree.
158
- */const zv=ye("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"}]]);/**
158
+ */const Bv=ye("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"}]]);/**
159
159
  * @license lucide-react v0.469.0 - ISC
160
160
  *
161
161
  * This source code is licensed under the ISC license.
@@ -170,7 +170,7 @@ ${c.summary}
170
170
  *
171
171
  * This source code is licensed under the ISC license.
172
172
  * See the LICENSE file in the root directory of this source tree.
173
- */const $1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
173
+ */const F1=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
174
174
  * @license lucide-react v0.469.0 - ISC
175
175
  *
176
176
  * This source code is licensed under the ISC license.
@@ -185,22 +185,22 @@ ${c.summary}
185
185
  *
186
186
  * This source code is licensed under the ISC license.
187
187
  * See the LICENSE file in the root directory of this source tree.
188
- */const P1=ye("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"}]]);/**
188
+ */const U1=ye("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"}]]);/**
189
189
  * @license lucide-react v0.469.0 - ISC
190
190
  *
191
191
  * This source code is licensed under the ISC license.
192
192
  * See the LICENSE file in the root directory of this source tree.
193
- */const Fv=ye("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"}]]);/**
193
+ */const Wv=ye("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"}]]);/**
194
194
  * @license lucide-react v0.469.0 - ISC
195
195
  *
196
196
  * This source code is licensed under the ISC license.
197
197
  * See the LICENSE file in the root directory of this source tree.
198
- */const z1=ye("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"}]]);/**
198
+ */const B1=ye("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"}]]);/**
199
199
  * @license lucide-react v0.469.0 - ISC
200
200
  *
201
201
  * This source code is licensed under the ISC license.
202
202
  * See the LICENSE file in the root directory of this source tree.
203
- */const F1=ye("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"}]]);/**
203
+ */const W1=ye("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"}]]);/**
204
204
  * @license lucide-react v0.469.0 - ISC
205
205
  *
206
206
  * This source code is licensed under the ISC license.
@@ -215,57 +215,57 @@ ${c.summary}
215
215
  *
216
216
  * This source code is licensed under the ISC license.
217
217
  * See the LICENSE file in the root directory of this source tree.
218
- */const Uv=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
218
+ */const Hv=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
219
219
  * @license lucide-react v0.469.0 - ISC
220
220
  *
221
221
  * This source code is licensed under the ISC license.
222
222
  * See the LICENSE file in the root directory of this source tree.
223
- */const Bv=ye("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"}]]);/**
223
+ */const Vv=ye("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"}]]);/**
224
224
  * @license lucide-react v0.469.0 - ISC
225
225
  *
226
226
  * This source code is licensed under the ISC license.
227
227
  * See the LICENSE file in the root directory of this source tree.
228
- */const Wv=ye("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"}]]);/**
228
+ */const Kv=ye("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"}]]);/**
229
229
  * @license lucide-react v0.469.0 - ISC
230
230
  *
231
231
  * This source code is licensed under the ISC license.
232
232
  * See the LICENSE file in the root directory of this source tree.
233
- */const U1=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
233
+ */const H1=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
234
234
  * @license lucide-react v0.469.0 - ISC
235
235
  *
236
236
  * This source code is licensed under the ISC license.
237
237
  * See the LICENSE file in the root directory of this source tree.
238
- */const Hv=ye("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"}]]);/**
238
+ */const Gv=ye("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"}]]);/**
239
239
  * @license lucide-react v0.469.0 - ISC
240
240
  *
241
241
  * This source code is licensed under the ISC license.
242
242
  * See the LICENSE file in the root directory of this source tree.
243
- */const B1=ye("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"}]]);/**
243
+ */const V1=ye("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"}]]);/**
244
244
  * @license lucide-react v0.469.0 - ISC
245
245
  *
246
246
  * This source code is licensed under the ISC license.
247
247
  * See the LICENSE file in the root directory of this source tree.
248
- */const Vv=ye("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"}]]);/**
248
+ */const qv=ye("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"}]]);/**
249
249
  * @license lucide-react v0.469.0 - ISC
250
250
  *
251
251
  * This source code is licensed under the ISC license.
252
252
  * See the LICENSE file in the root directory of this source tree.
253
- */const W1=ye("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"}]]);/**
253
+ */const K1=ye("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"}]]);/**
254
254
  * @license lucide-react v0.469.0 - ISC
255
255
  *
256
256
  * This source code is licensed under the ISC license.
257
257
  * See the LICENSE file in the root directory of this source tree.
258
- */const H1=ye("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"}]]);/**
258
+ */const G1=ye("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"}]]);/**
259
259
  * @license lucide-react v0.469.0 - ISC
260
260
  *
261
261
  * This source code is licensed under the ISC license.
262
262
  * See the LICENSE file in the root directory of this source tree.
263
- */const V1=ye("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"}]]);/**
263
+ */const q1=ye("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"}]]);/**
264
264
  * @license lucide-react v0.469.0 - ISC
265
265
  *
266
266
  * This source code is licensed under the ISC license.
267
267
  * See the LICENSE file in the root directory of this source tree.
268
- */const K1=ye("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"}]]);/**
268
+ */const X1=ye("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"}]]);/**
269
269
  * @license lucide-react v0.469.0 - ISC
270
270
  *
271
271
  * This source code is licensed under the ISC license.
@@ -275,27 +275,27 @@ ${c.summary}
275
275
  *
276
276
  * This source code is licensed under the ISC license.
277
277
  * See the LICENSE file in the root directory of this source tree.
278
- */const G1=ye("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"}]]);/**
278
+ */const Y1=ye("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"}]]);/**
279
279
  * @license lucide-react v0.469.0 - ISC
280
280
  *
281
281
  * This source code is licensed under the ISC license.
282
282
  * See the LICENSE file in the root directory of this source tree.
283
- */const q1=ye("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"}]]);/**
283
+ */const Q1=ye("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"}]]);/**
284
284
  * @license lucide-react v0.469.0 - ISC
285
285
  *
286
286
  * This source code is licensed under the ISC license.
287
287
  * See the LICENSE file in the root directory of this source tree.
288
- */const Kv=ye("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"}]]);/**
288
+ */const Xv=ye("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"}]]);/**
289
289
  * @license lucide-react v0.469.0 - ISC
290
290
  *
291
291
  * This source code is licensed under the ISC license.
292
292
  * See the LICENSE file in the root directory of this source tree.
293
- */const Gv=ye("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
293
+ */const Yv=ye("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
294
294
  * @license lucide-react v0.469.0 - ISC
295
295
  *
296
296
  * This source code is licensed under the ISC license.
297
297
  * See the LICENSE file in the root directory of this source tree.
298
- */const X1=ye("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"}]]);/**
298
+ */const Z1=ye("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"}]]);/**
299
299
  * @license lucide-react v0.469.0 - ISC
300
300
  *
301
301
  * This source code is licensed under the ISC license.
@@ -305,27 +305,27 @@ ${c.summary}
305
305
  *
306
306
  * This source code is licensed under the ISC license.
307
307
  * See the LICENSE file in the root directory of this source tree.
308
- */const Y1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
308
+ */const J1=ye("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
309
309
  * @license lucide-react v0.469.0 - ISC
310
310
  *
311
311
  * This source code is licensed under the ISC license.
312
312
  * See the LICENSE file in the root directory of this source tree.
313
- */const Q1=ye("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"}]]);/**
313
+ */const eS=ye("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"}]]);/**
314
314
  * @license lucide-react v0.469.0 - ISC
315
315
  *
316
316
  * This source code is licensed under the ISC license.
317
317
  * See the LICENSE file in the root directory of this source tree.
318
- */const Z1=ye("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"}]]);/**
318
+ */const tS=ye("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"}]]);/**
319
319
  * @license lucide-react v0.469.0 - ISC
320
320
  *
321
321
  * This source code is licensed under the ISC license.
322
322
  * See the LICENSE file in the root directory of this source tree.
323
- */const J1=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
323
+ */const nS=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
324
324
  * @license lucide-react v0.469.0 - ISC
325
325
  *
326
326
  * This source code is licensed under the ISC license.
327
327
  * See the LICENSE file in the root directory of this source tree.
328
- */const eS=ye("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"}]]);/**
328
+ */const sS=ye("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"}]]);/**
329
329
  * @license lucide-react v0.469.0 - ISC
330
330
  *
331
331
  * This source code is licensed under the ISC license.
@@ -335,12 +335,12 @@ ${c.summary}
335
335
  *
336
336
  * This source code is licensed under the ISC license.
337
337
  * See the LICENSE file in the root directory of this source tree.
338
- */const tS=ye("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"}]]);/**
338
+ */const rS=ye("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"}]]);/**
339
339
  * @license lucide-react v0.469.0 - ISC
340
340
  *
341
341
  * This source code is licensed under the ISC license.
342
342
  * See the LICENSE file in the root directory of this source tree.
343
- */const nS=ye("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"}]]);/**
343
+ */const oS=ye("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"}]]);/**
344
344
  * @license lucide-react v0.469.0 - ISC
345
345
  *
346
346
  * This source code is licensed under the ISC license.
@@ -350,7 +350,7 @@ ${c.summary}
350
350
  *
351
351
  * This source code is licensed under the ISC license.
352
352
  * See the LICENSE file in the root directory of this source tree.
353
- */const qv=ye("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"}]]);/**
353
+ */const Qv=ye("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"}]]);/**
354
354
  * @license lucide-react v0.469.0 - ISC
355
355
  *
356
356
  * This source code is licensed under the ISC license.
@@ -360,7 +360,7 @@ ${c.summary}
360
360
  *
361
361
  * This source code is licensed under the ISC license.
362
362
  * See the LICENSE file in the root directory of this source tree.
363
- */const sS=ye("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"}]]);/**
363
+ */const iS=ye("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"}]]);/**
364
364
  * @license lucide-react v0.469.0 - ISC
365
365
  *
366
366
  * This source code is licensed under the ISC license.
@@ -370,17 +370,17 @@ ${c.summary}
370
370
  *
371
371
  * This source code is licensed under the ISC license.
372
372
  * See the LICENSE file in the root directory of this source tree.
373
- */const Xv=ye("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"}]]);/**
373
+ */const Zv=ye("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"}]]);/**
374
374
  * @license lucide-react v0.469.0 - ISC
375
375
  *
376
376
  * This source code is licensed under the ISC license.
377
377
  * See the LICENSE file in the root directory of this source tree.
378
- */const Yv=ye("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"}]]);/**
378
+ */const Jv=ye("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"}]]);/**
379
379
  * @license lucide-react v0.469.0 - ISC
380
380
  *
381
381
  * This source code is licensed under the ISC license.
382
382
  * See the LICENSE file in the root directory of this source tree.
383
- */const rS=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
383
+ */const aS=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
384
384
  * @license lucide-react v0.469.0 - ISC
385
385
  *
386
386
  * This source code is licensed under the ISC license.
@@ -390,17 +390,17 @@ ${c.summary}
390
390
  *
391
391
  * This source code is licensed under the ISC license.
392
392
  * See the LICENSE file in the root directory of this source tree.
393
- */const oS=ye("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"}]]);/**
393
+ */const lS=ye("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"}]]);/**
394
394
  * @license lucide-react v0.469.0 - ISC
395
395
  *
396
396
  * This source code is licensed under the ISC license.
397
397
  * See the LICENSE file in the root directory of this source tree.
398
- */const iS=ye("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"}]]);/**
398
+ */const cS=ye("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"}]]);/**
399
399
  * @license lucide-react v0.469.0 - ISC
400
400
  *
401
401
  * This source code is licensed under the ISC license.
402
402
  * See the LICENSE file in the root directory of this source tree.
403
- */const Qv=ye("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"}]]);/**
403
+ */const ey=ye("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"}]]);/**
404
404
  * @license lucide-react v0.469.0 - ISC
405
405
  *
406
406
  * This source code is licensed under the ISC license.
@@ -430,27 +430,27 @@ ${c.summary}
430
430
  *
431
431
  * This source code is licensed under the ISC license.
432
432
  * See the LICENSE file in the root directory of this source tree.
433
- */const aS=ye("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"}]]);/**
433
+ */const uS=ye("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"}]]);/**
434
434
  * @license lucide-react v0.469.0 - ISC
435
435
  *
436
436
  * This source code is licensed under the ISC license.
437
437
  * See the LICENSE file in the root directory of this source tree.
438
- */const lS=ye("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"}]]);/**
438
+ */const dS=ye("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"}]]);/**
439
439
  * @license lucide-react v0.469.0 - ISC
440
440
  *
441
441
  * This source code is licensed under the ISC license.
442
442
  * See the LICENSE file in the root directory of this source tree.
443
- */const cS=ye("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"}]]);/**
443
+ */const fS=ye("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"}]]);/**
444
444
  * @license lucide-react v0.469.0 - ISC
445
445
  *
446
446
  * This source code is licensed under the ISC license.
447
447
  * See the LICENSE file in the root directory of this source tree.
448
- */const Zv=ye("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"}]]);/**
448
+ */const ty=ye("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"}]]);/**
449
449
  * @license lucide-react v0.469.0 - ISC
450
450
  *
451
451
  * This source code is licensed under the ISC license.
452
452
  * See the LICENSE file in the root directory of this source tree.
453
- */const uS=ye("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"}]]);/**
453
+ */const pS=ye("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"}]]);/**
454
454
  * @license lucide-react v0.469.0 - ISC
455
455
  *
456
456
  * This source code is licensed under the ISC license.
@@ -460,15 +460,15 @@ ${c.summary}
460
460
  *
461
461
  * This source code is licensed under the ISC license.
462
462
  * See the LICENSE file in the root directory of this source tree.
463
- */const dS=ye("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"}]]),fS=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),pS=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function hS(e){return e.filter(([n])=>fS.has(n)).map(([n,r],o)=>[n,{...Object.fromEntries(Object.entries(r).filter(([l])=>pS.has(l))),key:String(o)}])}function Mo({iconNode:e,size:n=14,className:r}){const o=y.useMemo(()=>e?hS(e):[],[e]);return o.length===0?a.jsx(Vv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx($v,{iconNode:o,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Ti=rv();function mS(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>o=>{n.forEach(l=>l(o))},n)}const sc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Lo(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function lf(e){return"nodeType"in e}function En(e){var n,r;return e?Lo(e)?e:lf(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function cf(e){const{Document:n}=En(e);return e instanceof n}function Gi(e){return Lo(e)?!1:e instanceof En(e).HTMLElement}function Jv(e){return e instanceof En(e).SVGElement}function Oo(e){return e?Lo(e)?e.document:lf(e)?cf(e)?e:Gi(e)||Jv(e)?e.ownerDocument:document:document:document}const gs=sc?y.useLayoutEffect:y.useEffect;function rc(e){const n=y.useRef(e);return gs(()=>{n.current=e}),y.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n.current==null?void 0:n.current(...o)},[])}function gS(){const e=y.useRef(null),n=y.useCallback((o,l)=>{e.current=setInterval(o,l)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Fi(e,n){n===void 0&&(n=[e]);const r=y.useRef(e);return gs(()=>{r.current!==e&&(r.current=e)},n),r}function qi(e,n){const r=y.useRef();return y.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...n])}function Ml(e){const n=rc(e),r=y.useRef(null),o=y.useCallback(l=>{l!==r.current&&(n==null||n(l,r.current)),r.current=l},[]);return[r,o]}function Ll(e){const n=y.useRef();return y.useEffect(()=>{n.current=e},[e]),n.current}let rd={};function Xi(e,n){return y.useMemo(()=>{if(n)return n;const r=rd[e]==null?0:rd[e]+1;return rd[e]=r,e+"-"+r},[e,n])}function ey(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return o.reduce((c,d)=>{const f=Object.entries(d);for(const[h,m]of f){const v=c[h];v!=null&&(c[h]=v+e*m)}return c},{...n})}}const Ao=ey(1),Ol=ey(-1);function vS(e){return"clientX"in e&&"clientY"in e}function oc(e){if(!e)return!1;const{KeyboardEvent:n}=En(e.target);return n&&e instanceof n}function yS(e){if(!e)return!1;const{TouchEvent:n}=En(e.target);return n&&e instanceof n}function $l(e){if(yS(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return vS(e)?{x:e.clientX,y:e.clientY}:null}const _s=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[_s.Translate.toString(e),_s.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:o}=e;return n+" "+r+"ms "+o}}}),Pm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xS(e){return e.matches(Pm)?e:e.querySelector(Pm)}const wS={display:"none"};function kS(e){let{id:n,value:r}=e;return gt.createElement("div",{id:n,style:wS},r)}function SS(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;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 gt.createElement("div",{id:n,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function bS(){const[e,n]=y.useState("");return{announce:y.useCallback(o=>{o!=null&&n(o)},[]),announcement:e}}const ty=y.createContext(null);function NS(e){const n=y.useContext(ty);y.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function TS(){const[e]=y.useState(()=>new Set),n=y.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[y.useCallback(o=>{let{type:l,event:c}=o;e.forEach(d=>{var f;return(f=d[l])==null?void 0:f.call(d,c)})},[e]),n]}const CS={draggable:`
463
+ */const hS=ye("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"}]]),mS=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),gS=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function vS(e){return e.filter(([n])=>mS.has(n)).map(([n,r],o)=>[n,{...Object.fromEntries(Object.entries(r).filter(([l])=>gS.has(l))),key:String(o)}])}function Mo({iconNode:e,size:n=14,className:r}){const o=y.useMemo(()=>e?vS(e):[],[e]);return o.length===0?a.jsx(qv,{size:n,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(Fv,{iconNode:o,size:n,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var Ti=av();function yS(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>o=>{n.forEach(l=>l(o))},n)}const sc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Lo(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function lf(e){return"nodeType"in e}function En(e){var n,r;return e?Lo(e)?e:lf(e)&&(n=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?n:window:window}function cf(e){const{Document:n}=En(e);return e instanceof n}function Gi(e){return Lo(e)?!1:e instanceof En(e).HTMLElement}function ny(e){return e instanceof En(e).SVGElement}function Oo(e){return e?Lo(e)?e.document:lf(e)?cf(e)?e:Gi(e)||ny(e)?e.ownerDocument:document:document:document}const gs=sc?y.useLayoutEffect:y.useEffect;function rc(e){const n=y.useRef(e);return gs(()=>{n.current=e}),y.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return n.current==null?void 0:n.current(...o)},[])}function xS(){const e=y.useRef(null),n=y.useCallback((o,l)=>{e.current=setInterval(o,l)},[]),r=y.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,r]}function Fi(e,n){n===void 0&&(n=[e]);const r=y.useRef(e);return gs(()=>{r.current!==e&&(r.current=e)},n),r}function qi(e,n){const r=y.useRef();return y.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...n])}function Ml(e){const n=rc(e),r=y.useRef(null),o=y.useCallback(l=>{l!==r.current&&(n==null||n(l,r.current)),r.current=l},[]);return[r,o]}function Ll(e){const n=y.useRef();return y.useEffect(()=>{n.current=e},[e]),n.current}let rd={};function Xi(e,n){return y.useMemo(()=>{if(n)return n;const r=rd[e]==null?0:rd[e]+1;return rd[e]=r,e+"-"+r},[e,n])}function sy(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return o.reduce((c,d)=>{const f=Object.entries(d);for(const[h,m]of f){const v=c[h];v!=null&&(c[h]=v+e*m)}return c},{...n})}}const Ao=sy(1),Ol=sy(-1);function wS(e){return"clientX"in e&&"clientY"in e}function oc(e){if(!e)return!1;const{KeyboardEvent:n}=En(e.target);return n&&e instanceof n}function kS(e){if(!e)return!1;const{TouchEvent:n}=En(e.target);return n&&e instanceof n}function $l(e){if(kS(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:r}=e.touches[0];return{x:n,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:r}=e.changedTouches[0];return{x:n,y:r}}}return wS(e)?{x:e.clientX,y:e.clientY}:null}const _s=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:r}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:r}=e;return"scaleX("+n+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[_s.Translate.toString(e),_s.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:r,easing:o}=e;return n+" "+r+"ms "+o}}}),Pm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function SS(e){return e.matches(Pm)?e:e.querySelector(Pm)}const bS={display:"none"};function NS(e){let{id:n,value:r}=e;return vt.createElement("div",{id:n,style:bS},r)}function TS(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;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 vt.createElement("div",{id:n,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function CS(){const[e,n]=y.useState("");return{announce:y.useCallback(o=>{o!=null&&n(o)},[]),announcement:e}}const ry=y.createContext(null);function jS(e){const n=y.useContext(ry);y.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function ES(){const[e]=y.useState(()=>new Set),n=y.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[y.useCallback(o=>{let{type:l,event:c}=o;e.forEach(d=>{var f;return(f=d[l])==null?void 0:f.call(d,c)})},[e]),n]}const _S={draggable:`
464
464
  To pick up a draggable item, press the space bar.
465
465
  While dragging, use the arrow keys to move the item.
466
466
  Press space again to drop the item in its new position, or press escape to cancel.
467
- `},jS={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;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(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function ES(e){let{announcements:n=jS,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=CS}=e;const{announce:c,announcement:d}=bS(),f=Xi("DndLiveRegion"),[h,m]=y.useState(!1);if(y.useEffect(()=>{m(!0)},[]),NS(y.useMemo(()=>({onDragStart(k){let{active:x}=k;c(n.onDragStart({active:x}))},onDragMove(k){let{active:x,over:S}=k;n.onDragMove&&c(n.onDragMove({active:x,over:S}))},onDragOver(k){let{active:x,over:S}=k;c(n.onDragOver({active:x,over:S}))},onDragEnd(k){let{active:x,over:S}=k;c(n.onDragEnd({active:x,over:S}))},onDragCancel(k){let{active:x,over:S}=k;c(n.onDragCancel({active:x,over:S}))}}),[c,n])),!h)return null;const v=gt.createElement(gt.Fragment,null,gt.createElement(kS,{id:o,value:l.draggable}),gt.createElement(SS,{id:f,announcement:d}));return r?Ti.createPortal(v,r):v}var Zt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Zt||(Zt={}));function Pl(){}function ny(e,n){return y.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function sy(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>[...n].filter(o=>o!=null),[...n])}const vs=Object.freeze({x:0,y:0});function _S(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function RS(e,n){const r=$l(e);if(!r)return"0 0";const o={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return o.x+"% "+o.y+"%"}function AS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return r-o}function IS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return o-r}function DS(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function zm(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const ry=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=zm(n,n.left,n.top),c=[];for(const d of o){const{id:f}=d,h=r.get(f);if(h){const m=_S(zm(h),l);c.push({id:f,data:{droppableContainer:d,value:m}})}}return c.sort(AS)};function MS(e,n){const r=Math.max(n.top,e.top),o=Math.max(n.left,e.left),l=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),d=l-o,f=c-r;if(o<l&&r<c){const h=n.width*n.height,m=e.width*e.height,v=d*f,k=v/(h+m-v);return Number(k.toFixed(4))}return 0}const LS=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=[];for(const c of o){const{id:d}=c,f=r.get(d);if(f){const h=MS(f,n);h>0&&l.push({id:d,data:{droppableContainer:c,value:h}})}}return l.sort(IS)};function OS(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function oy(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:vs}function $S(e){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return l.reduce((d,f)=>({...d,top:d.top+e*f.y,bottom:d.bottom+e*f.y,left:d.left+e*f.x,right:d.right+e*f.x}),{...r})}}const PS=$S(1);function iy(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function zS(e,n,r){const o=iy(n);if(!o)return e;const{scaleX:l,scaleY:c,x:d,y:f}=o,h=e.left-d-(1-l)*parseFloat(r),m=e.top-f-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?e.width/l:e.width,k=c?e.height/c:e.height;return{width:v,height:k,top:m,right:h+v,bottom:m+k,left:h}}const FS={ignoreTransform:!1};function $o(e,n){n===void 0&&(n=FS);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:v}=En(e).getComputedStyle(e);m&&(r=zS(r,m,v))}const{top:o,left:l,width:c,height:d,bottom:f,right:h}=r;return{top:o,left:l,width:c,height:d,bottom:f,right:h}}function Fm(e){return $o(e,{ignoreTransform:!0})}function US(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function BS(e,n){return n===void 0&&(n=En(e).getComputedStyle(e)),n.position==="fixed"}function WS(e,n){n===void 0&&(n=En(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=n[l];return typeof c=="string"?r.test(c):!1})}function uf(e,n){const r=[];function o(l){if(n!=null&&r.length>=n||!l)return r;if(cf(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Gi(l)||Jv(l)||r.includes(l))return r;const c=En(e).getComputedStyle(l);return l!==e&&WS(l,c)&&r.push(l),BS(l,c)?r:o(l.parentNode)}return e?o(e):r}function ay(e){const[n]=uf(e,1);return n??null}function od(e){return!sc||!e?null:Lo(e)?e:lf(e)?cf(e)||e===Oo(e).scrollingElement?window:Gi(e)?e:null:null}function ly(e){return Lo(e)?e.scrollX:e.scrollLeft}function cy(e){return Lo(e)?e.scrollY:e.scrollTop}function Td(e){return{x:ly(e),y:cy(e)}}var an;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(an||(an={}));function uy(e){return!sc||!e?!1:e===document.scrollingElement}function dy(e){const n={x:0,y:0},r=uy(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},l=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,d=e.scrollTop>=o.y,f=e.scrollLeft>=o.x;return{isTop:l,isLeft:c,isBottom:d,isRight:f,maxScroll:o,minScroll:n}}const HS={x:.2,y:.2};function VS(e,n,r,o,l){let{top:c,left:d,right:f,bottom:h}=r;o===void 0&&(o=10),l===void 0&&(l=HS);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=dy(e),S={x:0,y:0},j={x:0,y:0},N={height:n.height*l.y,width:n.width*l.x};return!m&&c<=n.top+N.height?(S.y=an.Backward,j.y=o*Math.abs((n.top+N.height-c)/N.height)):!v&&h>=n.bottom-N.height&&(S.y=an.Forward,j.y=o*Math.abs((n.bottom-N.height-h)/N.height)),!x&&f>=n.right-N.width?(S.x=an.Forward,j.x=o*Math.abs((n.right-N.width-f)/N.width)):!k&&d<=n.left+N.width&&(S.x=an.Backward,j.x=o*Math.abs((n.left+N.width-d)/N.width)),{direction:S,speed:j}}function KS(e){if(e===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:o,bottom:l}=e.getBoundingClientRect();return{top:n,left:r,right:o,bottom:l,width:e.clientWidth,height:e.clientHeight}}function fy(e){return e.reduce((n,r)=>Ao(n,Td(r)),vs)}function GS(e){return e.reduce((n,r)=>n+ly(r),0)}function qS(e){return e.reduce((n,r)=>n+cy(r),0)}function py(e,n){if(n===void 0&&(n=$o),!e)return;const{top:r,left:o,bottom:l,right:c}=n(e);ay(e)&&(l<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const XS=[["x",["left","right"],GS],["y",["top","bottom"],qS]];class df{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 o=uf(r),l=fy(o);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,f]of XS)for(const h of d)Object.defineProperty(this,h,{get:()=>{const m=f(o),v=l[c]-m;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class _i{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=n}add(n,r,o){var l;(l=this.target)==null||l.addEventListener(n,r,o),this.listeners.push([n,r,o])}}function YS(e){const{EventTarget:n}=En(e);return e instanceof n?e:Oo(e)}function id(e,n){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+o**2)>n:"x"in n&&"y"in n?r>n.x&&o>n.y:"x"in n?r>n.x:"y"in n?o>n.y:!1}var es;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(es||(es={}));function Um(e){e.preventDefault()}function QS(e){e.stopPropagation()}var ct;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ct||(ct={}));const hy={start:[ct.Space,ct.Enter],cancel:[ct.Esc],end:[ct.Space,ct.Enter,ct.Tab]},ZS=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case ct.Right:return{...r,x:r.x+25};case ct.Left:return{...r,x:r.x-25};case ct.Down:return{...r,y:r.y+25};case ct.Up:return{...r,y:r.y-25}}};class my{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 _i(Oo(r)),this.windowListeners=new _i(En(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,o=n.node.current;o&&py(o),r(vs)}handleKeyDown(n){if(oc(n)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:c=hy,coordinateGetter:d=ZS,scrollBehavior:f="smooth"}=l,{code:h}=n;if(c.end.includes(h)){this.handleEnd(n);return}if(c.cancel.includes(h)){this.handleCancel(n);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:vs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:o.current,currentCoordinates:v});if(k){const x=Ol(k,v),S={x:0,y:0},{scrollableAncestors:j}=o.current;for(const N of j){const T=n.code,{isTop:b,isRight:A,isLeft:P,isBottom:L,maxScroll:z,minScroll:q}=dy(N),F=KS(N),O={x:Math.min(T===ct.Right?F.right-F.width/2:F.right,Math.max(T===ct.Right?F.left:F.left+F.width/2,k.x)),y:Math.min(T===ct.Down?F.bottom-F.height/2:F.bottom,Math.max(T===ct.Down?F.top:F.top+F.height/2,k.y))},Q=T===ct.Right&&!A||T===ct.Left&&!P,J=T===ct.Down&&!L||T===ct.Up&&!b;if(Q&&O.x!==k.x){const te=N.scrollLeft+x.x,me=T===ct.Right&&te<=z.x||T===ct.Left&&te>=q.x;if(me&&!x.y){N.scrollTo({left:te,behavior:f});return}me?S.x=N.scrollLeft-te:S.x=T===ct.Right?N.scrollLeft-z.x:N.scrollLeft-q.x,S.x&&N.scrollBy({left:-S.x,behavior:f});break}else if(J&&O.y!==k.y){const te=N.scrollTop+x.y,me=T===ct.Down&&te<=z.y||T===ct.Up&&te>=q.y;if(me&&!x.x){N.scrollTo({top:te,behavior:f});return}me?S.y=N.scrollTop-te:S.y=T===ct.Down?N.scrollTop-z.y:N.scrollTop-q.y,S.y&&N.scrollBy({top:-S.y,behavior:f});break}}this.handleMove(n,Ao(Ol(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:o}=this.props;n.preventDefault(),o(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()}}my.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:o=hy,onActivation:l}=n,{active:c}=r;const{code:d}=e.nativeEvent;if(o.start.includes(d)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function Bm(e){return!!(e&&"distance"in e)}function Wm(e){return!!(e&&"delay"in e)}class ff{constructor(n,r,o){var l;o===void 0&&(o=YS(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=Oo(d),this.documentListeners=new _i(this.document),this.listeners=new _i(o),this.windowListeners=new _i(En(d)),this.initialCoordinates=(l=$l(c))!=null?l:vs,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:o}}}=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,Um),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Um),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Wm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Bm(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:o,onPending:l}=this.props;l(o,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(es.Click,QS,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:o,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:f}}=c;if(!l)return;const h=(r=$l(n))!=null?r:vs,m=Ol(l,h);if(!o&&f){if(Bm(f)){if(f.tolerance!=null&&id(m,f.tolerance))return this.handleCancel();if(id(m,f.distance))return this.handleStart()}if(Wm(f)&&id(m,f.tolerance))return this.handleCancel();this.handlePending(f,m);return}n.cancelable&&n.preventDefault(),d(h)}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===ct.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const JS={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ic extends ff{constructor(n){const{event:r}=n,o=Oo(r.target);super(n,JS,o)}}ic.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const eb={move:{name:"mousemove"},end:{name:"mouseup"}};var Cd;(function(e){e[e.RightClick=2]="RightClick"})(Cd||(Cd={}));class tb extends ff{constructor(n){super(n,eb,Oo(n.event.target))}}tb.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return r.button===Cd.RightClick?!1:(o==null||o({event:r}),!0)}}];const ad={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class nb extends ff{constructor(n){super(n,ad)}static setup(){return window.addEventListener(ad.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(ad.move.name,n)};function n(){}}}nb.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var Ri;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ri||(Ri={}));var zl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(zl||(zl={}));function sb(e){let{acceleration:n,activator:r=Ri.Pointer,canScroll:o,draggingRect:l,enabled:c,interval:d=5,order:f=zl.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=e;const S=ob({delta:k,disabled:!c}),[j,N]=gS(),T=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),A=y.useMemo(()=>{switch(r){case Ri.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Ri.DraggableRect:return l}},[r,l,h]),P=y.useRef(null),L=y.useCallback(()=>{const q=P.current;if(!q)return;const F=T.current.x*b.current.x,O=T.current.y*b.current.y;q.scrollBy(F,O)},[]),z=y.useMemo(()=>f===zl.TreeOrder?[...m].reverse():m,[f,m]);y.useEffect(()=>{if(!c||!m.length||!A){N();return}for(const q of z){if((o==null?void 0:o(q))===!1)continue;const F=m.indexOf(q),O=v[F];if(!O)continue;const{direction:Q,speed:J}=VS(q,O,A,n,x);for(const te of["x","y"])S[te][Q[te]]||(J[te]=0,Q[te]=0);if(J.x>0||J.y>0){N(),P.current=q,j(L,d),T.current=J,b.current=Q;return}}T.current={x:0,y:0},b.current={x:0,y:0},N()},[n,L,o,N,c,d,JSON.stringify(A),JSON.stringify(S),j,m,z,v,JSON.stringify(x)])}const rb={x:{[an.Backward]:!1,[an.Forward]:!1},y:{[an.Backward]:!1,[an.Forward]:!1}};function ob(e){let{delta:n,disabled:r}=e;const o=Ll(n);return qi(l=>{if(r||!o||!l)return rb;const c={x:Math.sign(n.x-o.x),y:Math.sign(n.y-o.y)};return{x:{[an.Backward]:l.x[an.Backward]||c.x===-1,[an.Forward]:l.x[an.Forward]||c.x===1},y:{[an.Backward]:l.y[an.Backward]||c.y===-1,[an.Forward]:l.y[an.Forward]||c.y===1}}},[r,n,o])}function ib(e,n){const r=n!=null?e.get(n):void 0,o=r?r.node.current:null;return qi(l=>{var c;return n==null?null:(c=o??l)!=null?c:null},[o,n])}function ab(e,n){return y.useMemo(()=>e.reduce((r,o)=>{const{sensor:l}=o,c=l.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,o)}));return[...r,...c]},[]),[e,n])}var Ui;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ui||(Ui={}));var jd;(function(e){e.Optimized="optimized"})(jd||(jd={}));const Hm=new Map;function lb(e,n){let{dragging:r,dependencies:o,config:l}=n;const[c,d]=y.useState(null),{frequency:f,measure:h,strategy:m}=l,v=y.useRef(e),k=T(),x=Fi(k),S=y.useCallback(function(b){b===void 0&&(b=[]),!x.current&&d(A=>A===null?b:A.concat(b.filter(P=>!A.includes(P))))},[x]),j=y.useRef(null),N=qi(b=>{if(k&&!r)return Hm;if(!b||b===Hm||v.current!==e||c!=null){const A=new Map;for(let P of e){if(!P)continue;if(c&&c.length>0&&!c.includes(P.id)&&P.rect.current){A.set(P.id,P.rect.current);continue}const L=P.node.current,z=L?new df(h(L),L):null;P.rect.current=z,z&&A.set(P.id,z)}return A}return b},[e,c,r,k,h]);return y.useEffect(()=>{v.current=e},[e]),y.useEffect(()=>{k||S()},[r,k]),y.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),y.useEffect(()=>{k||typeof f!="number"||j.current!==null||(j.current=setTimeout(()=>{S(),j.current=null},f))},[f,k,S,...o]),{droppableRects:N,measureDroppableContainers:S,measuringScheduled:c!=null};function T(){switch(m){case Ui.Always:return!1;case Ui.BeforeDragging:return r;default:return!r}}}function pf(e,n){return qi(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function cb(e,n){return pf(e,n)}function ub(e){let{callback:n,disabled:r}=e;const o=rc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function ac(e){let{callback:n,disabled:r}=e;const o=rc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function db(e){return new df($o(e),e)}function Vm(e,n,r){n===void 0&&(n=db);const[o,l]=y.useState(null);function c(){l(h=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=h??r)!=null?m:null}const v=n(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const d=ub({callback(h){if(e)for(const m of h){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(e)){c();break}}}}),f=ac({callback:c});return gs(()=>{c(),e?(f==null||f.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(f==null||f.disconnect(),d==null||d.disconnect())},[e]),o}function fb(e){const n=pf(e);return oy(e,n)}const Km=[];function pb(e){const n=y.useRef(e),r=qi(o=>e?o&&o!==Km&&e&&n.current&&e.parentNode===n.current.parentNode?o:uf(e):Km,[e]);return y.useEffect(()=>{n.current=e},[e]),r}function hb(e){const[n,r]=y.useState(null),o=y.useRef(e),l=y.useCallback(c=>{const d=od(c.target);d&&r(f=>f?(f.set(d,Td(d)),new Map(f)):null)},[]);return y.useEffect(()=>{const c=o.current;if(e!==c){d(c);const f=e.map(h=>{const m=od(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,Td(m)]):null}).filter(h=>h!=null);r(f.length?new Map(f):null),o.current=e}return()=>{d(e),d(c)};function d(f){f.forEach(h=>{const m=od(h);m==null||m.removeEventListener("scroll",l)})}},[l,e]),y.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,d)=>Ao(c,d),vs):fy(e):vs,[e,n])}function Gm(e,n){n===void 0&&(n=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},n),y.useEffect(()=>{const o=e!==vs;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Ol(e,r.current):vs}function mb(e){y.useEffect(()=>{if(!sc)return;const n=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function gb(e,n){return y.useMemo(()=>e.reduce((r,o)=>{let{eventName:l,handler:c}=o;return r[l]=d=>{c(d,n)},r},{}),[e,n])}function gy(e){return y.useMemo(()=>e?US(e):null,[e])}const qm=[];function vb(e,n){n===void 0&&(n=$o);const[r]=e,o=gy(r?En(r):null),[l,c]=y.useState(qm);function d(){c(()=>e.length?e.map(h=>uy(h)?o:new df(n(h),h)):qm)}const f=ac({callback:d});return gs(()=>{f==null||f.disconnect(),d(),e.forEach(h=>f==null?void 0:f.observe(h))},[e]),l}function vy(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Gi(n)?n:e}function yb(e){let{measure:n}=e;const[r,o]=y.useState(null),l=y.useCallback(m=>{for(const{target:v}of m)if(Gi(v)){o(k=>{const x=n(v);return k?{...k,width:x.width,height:x.height}:x});break}},[n]),c=ac({callback:l}),d=y.useCallback(m=>{const v=vy(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?n(v):null)},[n,c]),[f,h]=Ml(d);return y.useMemo(()=>({nodeRef:f,rect:r,setRef:h}),[r,f,h])}const xb=[{sensor:ic,options:{}},{sensor:my,options:{}}],wb={current:{}},vl={draggable:{measure:Fm},droppable:{measure:Fm,strategy:Ui.WhileDragging,frequency:jd.Optimized},dragOverlay:{measure:$o}};class Ai 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,o;return(r=(o=this.get(n))==null?void 0:o.node.current)!=null?r:void 0}}const kb={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ai,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vl,measureDroppableContainers:Pl,windowRect:null,measuringScheduled:!1},yy={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pl,draggableNodes:new Map,over:null,measureDroppableContainers:Pl},Yi=y.createContext(yy),xy=y.createContext(kb);function Sb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ai}}}function bb(e,n){switch(n.type){case Zt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Zt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case Zt.DragEnd:case Zt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zt.RegisterDroppable:{const{element:r}=n,{id:o}=r,l=new Ai(e.droppable.containers);return l.set(o,r),{...e,droppable:{...e.droppable,containers:l}}}case Zt.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=n,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const d=new Ai(e.droppable.containers);return d.set(r,{...c,disabled:l}),{...e,droppable:{...e.droppable,containers:d}}}case Zt.UnregisterDroppable:{const{id:r,key:o}=n,l=e.droppable.containers.get(r);if(!l||o!==l.key)return e;const c=new Ai(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function Nb(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:l}=y.useContext(Yi),c=Ll(o),d=Ll(r==null?void 0:r.id);return y.useEffect(()=>{if(!n&&!o&&c&&d!=null){if(!oc(c)||document.activeElement===c.target)return;const f=l.get(d);if(!f)return;const{activatorNode:h,node:m}=f;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[h.current,m.current]){if(!v)continue;const k=xS(v);if(k){k.focus();break}}})}},[o,n,l,d,c]),null}function wy(e,n){let{transform:r,...o}=n;return e!=null&&e.length?e.reduce((l,c)=>c({transform:l,...o}),r):r}function Tb(e){return y.useMemo(()=>({draggable:{...vl.draggable,...e==null?void 0:e.draggable},droppable:{...vl.droppable,...e==null?void 0:e.droppable},dragOverlay:{...vl.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Cb(e){let{activeNode:n,measure:r,initialRect:o,config:l=!0}=e;const c=y.useRef(!1),{x:d,y:f}=typeof l=="boolean"?{x:l,y:l}:l;gs(()=>{if(!d&&!f||!n){c.current=!1;return}if(c.current||!o)return;const m=n==null?void 0:n.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=oy(v,o);if(d||(k.x=0),f||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=ay(m);x&&x.scrollBy({top:k.y,left:k.x})}},[n,d,f,o,r])}const lc=y.createContext({...vs,scaleX:1,scaleY:1});var fr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fr||(fr={}));const ky=y.memo(function(n){var r,o,l,c;let{id:d,accessibility:f,autoScroll:h=!0,children:m,sensors:v=xb,collisionDetection:k=LS,measuring:x,modifiers:S,...j}=n;const N=y.useReducer(bb,void 0,Sb),[T,b]=N,[A,P]=TS(),[L,z]=y.useState(fr.Uninitialized),q=L===fr.Initialized,{draggable:{active:F,nodes:O,translate:Q},droppable:{containers:J}}=T,te=F!=null?O.get(F):null,me=y.useRef({initial:null,translated:null}),ke=y.useMemo(()=>{var ft;return F!=null?{id:F,data:(ft=te==null?void 0:te.data)!=null?ft:wb,rect:me}:null},[F,te]),Le=y.useRef(null),[Te,oe]=y.useState(null),[ee,Y]=y.useState(null),ae=Fi(j,Object.values(j)),K=Xi("DndDescribedBy",d),E=y.useMemo(()=>J.getEnabled(),[J]),M=Tb(x),{droppableRects:de,measureDroppableContainers:U,measuringScheduled:ue}=lb(E,{dragging:q,dependencies:[Q.x,Q.y],config:M.droppable}),X=ib(O,F),ve=y.useMemo(()=>ee?$l(ee):null,[ee]),xe=_n(),Ae=cb(X,M.draggable.measure);Cb({activeNode:F!=null?O.get(F):null,config:xe.layoutShiftCompensation,initialRect:Ae,measure:M.draggable.measure});const Ce=Vm(X,M.draggable.measure,Ae),ge=Vm(X?X.parentElement:null),le=y.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:de,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Qe=J.getNodeFor((r=le.current.over)==null?void 0:r.id),Ee=yb({measure:M.dragOverlay.measure}),et=(o=Ee.nodeRef.current)!=null?o:X,He=q?(l=Ee.rect)!=null?l:Ce:null,Se=!!(Ee.nodeRef.current&&Ee.rect),Be=fb(Se?null:Ce),Xe=gy(et?En(et):null),at=pb(q?Qe??X:null),kt=vb(at),Ot=wy(S,{transform:{x:Q.x-Be.x,y:Q.y-Be.y,scaleX:1,scaleY:1},activatorEvent:ee,active:ke,activeNodeRect:Ce,containerNodeRect:ge,draggingNodeRect:He,over:le.current.over,overlayNodeRect:Ee.rect,scrollableAncestors:at,scrollableAncestorRects:kt,windowRect:Xe}),G=ve?Ao(ve,Q):null,we=hb(at),ze=Gm(we),Ye=Gm(we,[Ce]),vt=Ao(Ot,ze),yt=He?PS(He,Ot):null,Z=ke&&yt?k({active:ke,collisionRect:yt,droppableRects:de,droppableContainers:E,pointerCoordinates:G}):null,Pe=DS(Z,"id"),[qe,St]=y.useState(null),yn=Se?Ot:Ao(Ot,Ye),xn=OS(yn,(c=qe==null?void 0:qe.rect)!=null?c:null,Ce),ns=y.useRef(null),ss=y.useCallback((ft,bt)=>{let{sensor:Rt,options:Kt}=bt;if(Le.current==null)return;const Et=O.get(Le.current);if(!Et)return;const Nt=ft.nativeEvent,mt=new Rt({active:Le.current,activeNode:Et,event:Nt,options:Kt,context:le,onAbort(pt){if(!O.get(pt))return;const{onDragAbort:$t}=ae.current,I={id:pt};$t==null||$t(I),A({type:"onDragAbort",event:I})},onPending(pt,Jt,$t,I){if(!O.get(pt))return;const{onDragPending:ce}=ae.current,be={id:pt,constraint:Jt,initialCoordinates:$t,offset:I};ce==null||ce(be),A({type:"onDragPending",event:be})},onStart(pt){const Jt=Le.current;if(Jt==null)return;const $t=O.get(Jt);if(!$t)return;const{onDragStart:I}=ae.current,he={activatorEvent:Nt,active:{id:Jt,data:$t.data,rect:me}};Ti.unstable_batchedUpdates(()=>{I==null||I(he),z(fr.Initializing),b({type:Zt.DragStart,initialCoordinates:pt,active:Jt}),A({type:"onDragStart",event:he}),oe(ns.current),Y(Nt)})},onMove(pt){b({type:Zt.DragMove,coordinates:pt})},onEnd:Gt(Zt.DragEnd),onCancel:Gt(Zt.DragCancel)});ns.current=mt;function Gt(pt){return async function(){const{active:$t,collisions:I,over:he,scrollAdjustedTranslate:ce}=le.current;let be=null;if($t&&ce){const{cancelDrop:We}=ae.current;be={activatorEvent:Nt,active:$t,collisions:I,delta:ce,over:he},pt===Zt.DragEnd&&typeof We=="function"&&await Promise.resolve(We(be))&&(pt=Zt.DragCancel)}Le.current=null,Ti.unstable_batchedUpdates(()=>{b({type:pt}),z(fr.Uninitialized),St(null),oe(null),Y(null),ns.current=null;const We=pt===Zt.DragEnd?"onDragEnd":"onDragCancel";if(be){const tt=ae.current[We];tt==null||tt(be),A({type:We,event:be})}})}}},[O]),rs=y.useCallback((ft,bt)=>(Rt,Kt)=>{const Et=Rt.nativeEvent,Nt=O.get(Kt);if(Le.current!==null||!Nt||Et.dndKit||Et.defaultPrevented)return;const mt={active:Nt};ft(Rt,bt.options,mt)===!0&&(Et.dndKit={capturedBy:bt.sensor},Le.current=Kt,ss(Rt,bt))},[O,ss]),wn=ab(v,rs);mb(v),gs(()=>{Ce&&L===fr.Initializing&&z(fr.Initialized)},[Ce,L]),y.useEffect(()=>{const{onDragMove:ft}=ae.current,{active:bt,activatorEvent:Rt,collisions:Kt,over:Et}=le.current;if(!bt||!Rt)return;const Nt={active:bt,activatorEvent:Rt,collisions:Kt,delta:{x:vt.x,y:vt.y},over:Et};Ti.unstable_batchedUpdates(()=>{ft==null||ft(Nt),A({type:"onDragMove",event:Nt})})},[vt.x,vt.y]),y.useEffect(()=>{const{active:ft,activatorEvent:bt,collisions:Rt,droppableContainers:Kt,scrollAdjustedTranslate:Et}=le.current;if(!ft||Le.current==null||!bt||!Et)return;const{onDragOver:Nt}=ae.current,mt=Kt.get(Pe),Gt=mt&&mt.rect.current?{id:mt.id,rect:mt.rect.current,data:mt.data,disabled:mt.disabled}:null,pt={active:ft,activatorEvent:bt,collisions:Rt,delta:{x:Et.x,y:Et.y},over:Gt};Ti.unstable_batchedUpdates(()=>{St(Gt),Nt==null||Nt(pt),A({type:"onDragOver",event:pt})})},[Pe]),gs(()=>{le.current={activatorEvent:ee,active:ke,activeNode:X,collisionRect:yt,collisions:Z,droppableRects:de,draggableNodes:O,draggingNode:et,draggingNodeRect:He,droppableContainers:J,over:qe,scrollableAncestors:at,scrollAdjustedTranslate:vt},me.current={initial:He,translated:yt}},[ke,X,Z,yt,O,et,He,de,J,qe,at,vt]),sb({...xe,delta:Q,draggingRect:yt,pointerCoordinates:G,scrollableAncestors:at,scrollableAncestorRects:kt});const fn=y.useMemo(()=>({active:ke,activeNode:X,activeNodeRect:Ce,activatorEvent:ee,collisions:Z,containerNodeRect:ge,dragOverlay:Ee,draggableNodes:O,droppableContainers:J,droppableRects:de,over:qe,measureDroppableContainers:U,scrollableAncestors:at,scrollableAncestorRects:kt,measuringConfiguration:M,measuringScheduled:ue,windowRect:Xe}),[ke,X,Ce,ee,Z,ge,Ee,O,J,de,qe,U,at,kt,M,ue,Xe]),Wt=y.useMemo(()=>({activatorEvent:ee,activators:wn,active:ke,activeNodeRect:Ce,ariaDescribedById:{draggable:K},dispatch:b,draggableNodes:O,over:qe,measureDroppableContainers:U}),[ee,wn,ke,Ce,b,K,O,qe,U]);return gt.createElement(ty.Provider,{value:P},gt.createElement(Yi.Provider,{value:Wt},gt.createElement(xy.Provider,{value:fn},gt.createElement(lc.Provider,{value:xn},m)),gt.createElement(Nb,{disabled:(f==null?void 0:f.restoreFocus)===!1})),gt.createElement(ES,{...f,hiddenTextDescribedById:K}));function _n(){const ft=(Te==null?void 0:Te.autoScrollEnabled)===!1,bt=typeof h=="object"?h.enabled===!1:h===!1,Rt=q&&!ft&&!bt;return typeof h=="object"?{...h,enabled:Rt}:{enabled:Rt}}}),jb=y.createContext(null),Xm="button",Eb="Draggable";function _b(e){let{id:n,data:r,disabled:o=!1,attributes:l}=e;const c=Xi(Eb),{activators:d,activatorEvent:f,active:h,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=y.useContext(Yi),{role:S=Xm,roleDescription:j="draggable",tabIndex:N=0}=l??{},T=(h==null?void 0:h.id)===n,b=y.useContext(T?lc:jb),[A,P]=Ml(),[L,z]=Ml(),q=gb(d,n),F=Fi(r);gs(()=>(k.set(n,{id:n,key:c,node:A,activatorNode:L,data:F}),()=>{const Q=k.get(n);Q&&Q.key===c&&k.delete(n)}),[k,n]);const O=y.useMemo(()=>({role:S,tabIndex:N,"aria-disabled":o,"aria-pressed":T&&S===Xm?!0:void 0,"aria-roledescription":j,"aria-describedby":v.draggable}),[o,S,N,T,j,v.draggable]);return{active:h,activatorEvent:f,activeNodeRect:m,attributes:O,isDragging:T,listeners:o?void 0:q,node:A,over:x,setNodeRef:P,setActivatorNodeRef:z,transform:b}}function Sy(){return y.useContext(xy)}const Rb="Droppable",Ab={timeout:25};function by(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:l}=e;const c=Xi(Rb),{active:d,dispatch:f,over:h,measureDroppableContainers:m}=y.useContext(Yi),v=y.useRef({disabled:r}),k=y.useRef(!1),x=y.useRef(null),S=y.useRef(null),{disabled:j,updateMeasurementsFor:N,timeout:T}={...Ab,...l},b=Fi(N??o),A=y.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(b.current)?b.current:[b.current]),S.current=null},T)},[T]),P=ac({callback:A,disabled:j||!d}),L=y.useCallback((O,Q)=>{P&&(Q&&(P.unobserve(Q),k.current=!1),O&&P.observe(O))},[P]),[z,q]=Ml(L),F=Fi(n);return y.useEffect(()=>{!P||!z.current||(P.disconnect(),k.current=!1,P.observe(z.current))},[z,P]),y.useEffect(()=>(f({type:Zt.RegisterDroppable,element:{id:o,key:c,disabled:r,node:z,rect:x,data:F}}),()=>f({type:Zt.UnregisterDroppable,key:c,id:o})),[o]),y.useEffect(()=>{r!==v.current.disabled&&(f({type:Zt.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,f]),{active:d,rect:x,isOver:(h==null?void 0:h.id)===o,node:z,over:h,setNodeRef:q}}function Ib(e){let{animation:n,children:r}=e;const[o,l]=y.useState(null),[c,d]=y.useState(null),f=Ll(r);return!r&&!o&&f&&l(f),gs(()=>{if(!c)return;const h=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(h==null||m==null){l(null);return}Promise.resolve(n(m,c)).then(()=>{l(null)})},[n,o,c]),gt.createElement(gt.Fragment,null,r,o?y.cloneElement(o,{ref:d}):null)}const Db={x:0,y:0,scaleX:1,scaleY:1};function Mb(e){let{children:n}=e;return gt.createElement(Yi.Provider,{value:yy},gt.createElement(lc.Provider,{value:Db},n))}const Lb={position:"fixed",touchAction:"none"},Ob=e=>oc(e)?"transform 250ms ease":void 0,$b=y.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:l,children:c,className:d,rect:f,style:h,transform:m,transition:v=Ob}=e;if(!f)return null;const k=l?m:{...m,scaleX:1,scaleY:1},x={...Lb,width:f.width,height:f.height,top:f.top,left:f.left,transform:_s.Transform.toString(k),transformOrigin:l&&o?RS(o,f):void 0,transition:typeof v=="function"?v(o):v,...h};return gt.createElement(r,{className:d,style:x,ref:n},c)}),Pb=e=>n=>{let{active:r,dragOverlay:o}=n;const l={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[f,h]of Object.entries(c.active))h!==void 0&&(l[f]=r.node.style.getPropertyValue(f),r.node.style.setProperty(f,h));if(c!=null&&c.dragOverlay)for(const[f,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(f,h);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[h,m]of Object.entries(l))r.node.style.setProperty(h,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},zb=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:_s.Transform.toString(n)},{transform:_s.Transform.toString(r)}]},Fb={duration:250,easing:"ease",keyframes:zb,sideEffects:Pb({styles:{active:{opacity:"0"}}})};function Ub(e){let{config:n,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=e;return rc((c,d)=>{if(n===null)return;const f=r.get(c);if(!f)return;const h=f.node.current;if(!h)return;const m=vy(d);if(!m)return;const{transform:v}=En(d).getComputedStyle(d),k=iy(v);if(!k)return;const x=typeof n=="function"?n:Bb(n);return py(h,l.draggable.measure),x({active:{id:c,data:f.data,node:h,rect:l.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function Bb(e){const{duration:n,easing:r,sideEffects:o,keyframes:l}={...Fb,...e};return c=>{let{active:d,dragOverlay:f,transform:h,...m}=c;if(!n)return;const v={x:f.rect.left-d.rect.left,y:f.rect.top-d.rect.top},k={scaleX:h.scaleX!==1?d.rect.width*h.scaleX/f.rect.width:1,scaleY:h.scaleY!==1?d.rect.height*h.scaleY/f.rect.height:1},x={x:h.x-v.x,y:h.y-v.y,...k},S=l({...m,active:d,dragOverlay:f,transform:{initial:h,final:x}}),[j]=S,N=S[S.length-1];if(JSON.stringify(j)===JSON.stringify(N))return;const T=o==null?void 0:o({active:d,dragOverlay:f,...m}),b=f.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(A=>{b.onfinish=()=>{T==null||T(),A()}})}}let Ym=0;function Wb(e){return y.useMemo(()=>{if(e!=null)return Ym++,Ym},[e])}const Hb=gt.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:o,style:l,transition:c,modifiers:d,wrapperElement:f="div",className:h,zIndex:m=999}=e;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggableNodes:j,droppableContainers:N,dragOverlay:T,over:b,measuringConfiguration:A,scrollableAncestors:P,scrollableAncestorRects:L,windowRect:z}=Sy(),q=y.useContext(lc),F=Wb(k==null?void 0:k.id),O=wy(d,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggingNodeRect:T.rect,over:b,overlayNodeRect:T.rect,scrollableAncestors:P,scrollableAncestorRects:L,transform:q,windowRect:z}),Q=pf(x),J=Ub({config:o,draggableNodes:j,droppableContainers:N,measuringConfiguration:A}),te=Q?T.setRef:void 0;return gt.createElement(Mb,null,gt.createElement(Ib,{animation:J},k&&F?gt.createElement($b,{key:F,id:k.id,ref:te,as:f,activatorEvent:v,adjustScale:n,className:h,transition:c,rect:Q,style:{zIndex:m,...l},transform:O},r):null))});function Ny(e,n,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(n,1)[0]),o}function Vb(e,n){return e.reduce((r,o,l)=>{const c=n.get(o);return c&&(r[l]=c),r},Array(e.length))}function sl(e){return e!==null&&e>=0}function Kb(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function Gb(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const rl={scaleX:1,scaleY:1},qb=e=>{var n;let{rects:r,activeNodeRect:o,activeIndex:l,overIndex:c,index:d}=e;const f=(n=r[l])!=null?n:o;if(!f)return null;const h=Xb(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(f.left+f.width):m.left-f.left,y:0,...rl}:null}return d>l&&d<=c?{x:-f.width-h,y:0,...rl}:d<l&&d>=c?{x:f.width+h,y:0,...rl}:{x:0,y:0,...rl}};function Xb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return!o||!l&&!c?0:r<n?l?o.left-(l.left+l.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(l.left+l.width)}const Ty=e=>{let{rects:n,activeIndex:r,overIndex:o,index:l}=e;const c=Ny(n,o,r),d=n[l],f=c[l];return!f||!d?null:{x:f.left-d.left,y:f.top-d.top,scaleX:f.width/d.width,scaleY:f.height/d.height}},ol={scaleX:1,scaleY:1},Qm=e=>{var n;let{activeIndex:r,activeNodeRect:o,index:l,rects:c,overIndex:d}=e;const f=(n=c[r])!=null?n:o;if(!f)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(f.top+f.height):m.top-f.top,...ol}:null}const h=Yb(c,l,r);return l>r&&l<=d?{x:0,y:-f.height-h,...ol}:l<r&&l>=d?{x:0,y:f.height+h,...ol}:{x:0,y:0,...ol}};function Yb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return o?r<n?l?o.top-(l.top+l.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const Cy="Sortable",jy=gt.createContext({activeIndex:-1,containerId:Cy,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ty,disabled:{draggable:!1,droppable:!1}});function Ed(e){let{children:n,id:r,items:o,strategy:l=Ty,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:h,over:m,measureDroppableContainers:v}=Sy(),k=Xi(Cy,r),x=f.rect!==null,S=y.useMemo(()=>o.map(q=>typeof q=="object"&&"id"in q?q.id:q),[o]),j=d!=null,N=d?S.indexOf(d.id):-1,T=m?S.indexOf(m.id):-1,b=y.useRef(S),A=!Kb(S,b.current),P=T!==-1&&N===-1||A,L=Gb(c);gs(()=>{A&&j&&v(S)},[A,S,j,v]),y.useEffect(()=>{b.current=S},[S]);const z=y.useMemo(()=>({activeIndex:N,containerId:k,disabled:L,disableTransforms:P,items:S,overIndex:T,useDragOverlay:x,sortedRects:Vb(S,h),strategy:l}),[N,k,L.draggable,L.droppable,P,S,T,h,x,l]);return gt.createElement(jy.Provider,{value:z},n)}const Qb=e=>{let{id:n,items:r,activeIndex:o,overIndex:l}=e;return Ny(r,o,l).indexOf(n)},Zb=e=>{let{containerId:n,isSorting:r,wasDragging:o,index:l,items:c,newIndex:d,previousItems:f,previousContainerId:h,transition:m}=e;return!m||!o||f!==c&&l===d?!1:r?!0:d!==l&&n===h},Jb={duration:200,easing:"ease"},Ey="transform",eN=_s.Transition.toString({property:Ey,duration:0,easing:"linear"}),tN={roleDescription:"sortable"};function nN(e){let{disabled:n,index:r,node:o,rect:l}=e;const[c,d]=y.useState(null),f=y.useRef(r);return gs(()=>{if(!n&&r!==f.current&&o.current){const h=l.current;if(h){const m=$o(o.current,{ignoreTransform:!0}),v={x:h.left-m.left,y:h.top-m.top,scaleX:h.width/m.width,scaleY:h.height/m.height};(v.x||v.y)&&d(v)}}r!==f.current&&(f.current=r)},[n,r,o,l]),y.useEffect(()=>{c&&d(null)},[c]),c}function hf(e){let{animateLayoutChanges:n=Zb,attributes:r,disabled:o,data:l,getNewIndex:c=Qb,id:d,strategy:f,resizeObserverConfig:h,transition:m=Jb}=e;const{items:v,containerId:k,activeIndex:x,disabled:S,disableTransforms:j,sortedRects:N,overIndex:T,useDragOverlay:b,strategy:A}=y.useContext(jy),P=sN(o,S),L=v.indexOf(d),z=y.useMemo(()=>({sortable:{containerId:k,index:L,items:v},...l}),[k,l,L,v]),q=y.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:F,node:O,isOver:Q,setNodeRef:J}=by({id:d,data:z,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:q,...h}}),{active:te,activatorEvent:me,activeNodeRect:ke,attributes:Le,setNodeRef:Te,listeners:oe,isDragging:ee,over:Y,setActivatorNodeRef:ae,transform:K}=_b({id:d,data:z,attributes:{...tN,...r},disabled:P.draggable}),E=mS(J,Te),M=!!te,de=M&&!j&&sl(x)&&sl(T),U=!b&&ee,ue=U&&de?K:null,ve=de?ue??(f??A)({rects:N,activeNodeRect:ke,activeIndex:x,overIndex:T,index:L}):null,xe=sl(x)&&sl(T)?c({id:d,items:v,activeIndex:x,overIndex:T}):L,Ae=te==null?void 0:te.id,Ce=y.useRef({activeId:Ae,items:v,newIndex:xe,containerId:k}),ge=v!==Ce.current.items,le=n({active:te,containerId:k,isDragging:ee,isSorting:M,id:d,index:L,items:v,newIndex:Ce.current.newIndex,previousItems:Ce.current.items,previousContainerId:Ce.current.containerId,transition:m,wasDragging:Ce.current.activeId!=null}),Qe=nN({disabled:!le,index:L,node:O,rect:F});return y.useEffect(()=>{M&&Ce.current.newIndex!==xe&&(Ce.current.newIndex=xe),k!==Ce.current.containerId&&(Ce.current.containerId=k),v!==Ce.current.items&&(Ce.current.items=v)},[M,xe,k,v]),y.useEffect(()=>{if(Ae===Ce.current.activeId)return;if(Ae!=null&&Ce.current.activeId==null){Ce.current.activeId=Ae;return}const et=setTimeout(()=>{Ce.current.activeId=Ae},50);return()=>clearTimeout(et)},[Ae]),{active:te,activeIndex:x,attributes:Le,data:z,rect:F,index:L,newIndex:xe,items:v,isOver:Q,isSorting:M,isDragging:ee,listeners:oe,node:O,overIndex:T,over:Y,setNodeRef:E,setActivatorNodeRef:ae,setDroppableNodeRef:J,setDraggableNodeRef:Te,transform:Qe??ve,transition:Ee()};function Ee(){if(Qe||ge&&Ce.current.newIndex===L)return eN;if(!(U&&!oc(me)||!m)&&(M||le))return _s.Transition.toString({...m,property:Ey})}}function sN(e,n){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(o=e==null?void 0:e.droppable)!=null?o:n.droppable}}ct.Down,ct.Right,ct.Up,ct.Left;function il(e){const[n,r]=y.useState(()=>{try{const l=localStorage.getItem(e);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}}),o=y.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(e,JSON.stringify([...d]))}catch{}return d})},[e]);return[n,o]}function rN(e,n=!1){const[r,o]=y.useState(()=>{try{const c=localStorage.getItem(e);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),l=y.useCallback(c=>{o(c);try{localStorage.setItem(e,c?"1":"0")}catch{}},[e]);return[r,l]}async function Bi(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,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 oN(e){return e.origin_app_id!=null&&!e.user_touched&&!e.starred}const _d="(no directory)";function gr(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function Rd(e,n){if(!n||!e.cwd)return!1;const r=gr(e.cwd),o=gr(n);return r.startsWith(`${o}/`)}function iN(e,n){const r=new Map;for(const d of n){const f=d.cwd||_d,h=r.get(f)??[];h.push(d),r.set(f,h)}const o=new Set,l=new Set(e.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of e){if(d.deleted===1){o.add(d.path);continue}o.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,f]of r)o.has(d)||l.has(d)||c.push({path:d,label:d===_d?"Other":d.split("/").pop()||d,sessions:f,workspace:null});return c}function aN(e,n,r){if(n.length===0)return!1;const o=new Set(e.filter(l=>l.deleted===1).map(l=>l.path));return n.some(l=>!Rd(l,r)&&!o.has(l.cwd||_d))}function Fl(e){return[...e].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function Zm(e,n,r,o){const l=n.map(c=>({folder:c,sessions:e.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return l.push({folder:null,sessions:e.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${e.path}:finished`,hidden:!1}),l}function Jm(e,n){return{working:Fl(e.sessions.filter(r=>r.lifecycle!=="finished")),finished:Fl(e.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(e.finishedKey)}}function al(e,n){return e.folder_id&&n.has(e.folder_id)?e.folder_id:null}function lN(e){const n=new Set(e.map(o=>o.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function eg({id:e,children:n,className:r}){const{setNodeRef:o,isOver:l}=by({id:e});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:n})}function mf({inputRef:e,value:n,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:e,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"&&o(),c.key==="Escape"&&l()},onBlur:o})}function cN({s:e,backgroundTaskCount:n,isActive:r,isSelected:o,originApp:l,renaming:c,renameValue:d,renameRef:f,onRenameValue:h,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:S}){const{attributes:j,listeners:N,setNodeRef:T,transform:b,transition:A,isDragging:P}=hf({id:`s:${e.id}`}),L=Jl(e,n);return a.jsxs("div",{ref:T,style:{transform:_s.Transform.toString(b),transition:A},className:`tree-item ${r?"active":""}${o?" selected":""} ${L.isFinished?"tree-item-finished":""}${P?" dragging":""}${e.starred?" tree-item-starred":""}`,...j,...N,onClick:k,onContextMenu:x,children:[a.jsx(rf,{iconClass:L.iconClass,iconText:L.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(Mo,{iconNode:l.iconNode,size:10})}),c?a.jsx(mf,{inputRef:f,value:d,onChange:h,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:e.title||e.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${e.starred?" starred":""}`,title:e.starred?"Unstar session":"Star session",onClick:z=>{z.stopPropagation(),S()},onPointerDown:z=>z.stopPropagation(),children:a.jsx(Dl,{size:10,fill:e.starred?"currentColor":"none"})}),L.dot&&a.jsx(sf,{status:L.dot,title:L.dotTitle})]})}function uN({folder:e,count:n,collapsed:r,renaming:o,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:f,onRenameCancel:h,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:S,setNodeRef:j,transform:N,transition:T,isDragging:b,over:A}=hf({id:`f:${e.id}`}),P=A!=null&&String(A.id).startsWith("s:");return a.jsxs("div",{ref:j,style:{transform:_s.Transform.toString(N),transition:T},className:`tree-folder ${r?"collapsed":""}${b?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${P?" drop-over":""}`,...x,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(mf,{inputRef:c,value:l,onChange:d,onConfirm:f,onCancel:h}):a.jsxs(a.Fragment,{children:[a.jsx(Ro,{size:8,className:"tree-chevron"}),a.jsx(Il,{size:12}),a.jsx("span",{className:"tree-folder-label",children:e.name}),a.jsx("span",{className:"tree-count",children:n})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function dN(){const e=R(I=>I.sessions),n=R(I=>I.backgroundTasks),r=R(I=>I.workspaces),o=R(I=>I.folders),l=R(I=>I.activeSessionId),c=R(I=>I.selectSession),d=R(I=>I.deleteSession),f=R(I=>I.removeWorkspace),h=R(I=>I.createSessionInWorkspace),m=R(I=>I.pickAndAddWorkspace),v=R(I=>I.setImportSessionsWorkspace),k=R(I=>I.renameSession),x=R(I=>I.markFinished),S=R(I=>I.markFinishedMany),j=R(I=>I.toggleStar),N=R(I=>I.reopenSession),T=R(I=>I.reopenSessionMany),b=R(I=>I.deleteSessionMany),A=R(I=>I.createSidebarFolder),P=R(I=>I.renameFolder),L=R(I=>I.deleteFolder),z=R(I=>I.applyMoves),q=R(I=>I.reorderFolders),F=R(I=>I.apps),O=R(I=>I.appsRootPath),Q=R(I=>I.activeAppTabId),J=R(I=>I.openAppTab),te=R(I=>I.startAppEdit),me=R(I=>I.toggleAppPin),ke=R(I=>I.deleteApp),Le=R(I=>I.openAppExport),Te=R(I=>I.openAppCatalog),[oe,ee]=il("agentpane:sidebar-ws-collapsed"),[Y,ae]=il("agentpane:sidebar-sub-collapsed"),[K,E]=il("agentpane:sidebar-folders-collapsed"),[M,de]=il("agentpane:sidebar-app-edits-collapsed"),[U,ue]=rN("agentpane:sidebar-hide-auto-sessions"),[X,ve]=y.useState(null),[xe,Ae]=y.useState(null),[Ce,ge]=y.useState(""),[le,Qe]=y.useState(null),[Ee,et]=y.useState(new Set),[He,Se]=y.useState(null),Be=y.useRef(null),Xe=y.useRef(null),at=y.useRef(null),kt=y.useRef(!1),Ot=sy(ny(ic,{activationConstraint:{distance:5}}));function G(){et(new Set),Se(null)}Vi(Be,()=>ve(null),!!X),Do(()=>{ve(null),G()},!!X||Ee.size>0),y.useLayoutEffect(()=>{const I=Be.current;if(!X||!I)return;const he=8,{offsetWidth:ce,offsetHeight:be}=I,We=X.x+ce>window.innerWidth-he?Math.max(he,X.x-ce):X.x,tt=X.y+be>window.innerHeight-he?Math.max(he,X.y-be):X.y;I.style.left=`${We}px`,I.style.top=`${tt}px`},[X]);const we=y.useMemo(()=>new Map(e.map(I=>[I.id,I])),[e]),ze=y.useMemo(()=>new Map(o.map(I=>[I.id,I])),[o]),Ye=y.useMemo(()=>{const I=new Map;for(const he of[...o].sort((ce,be)=>ce.sort_order-be.sort_order)){const ce=I.get(he.workspace_path)??[];ce.push(he),I.set(he.workspace_path,ce)}return I},[o]);function vt(I){ee(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}function yt(I){ae(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}function Z(I){E(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}function Pe(){ue(!U),G()}function qe(I){de(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}y.useEffect(()=>{xe&&Xe.current&&(Xe.current.focus(),Xe.current.select())},[xe]),y.useEffect(()=>{var I,he,ce;kt.current||!l||(kt.current=!0,(ce=(he=(I=at.current)==null?void 0:I.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:he.scrollIntoView)==null||ce.call(he,{block:"nearest"}))},[l]);function St(I,he,ce,be=""){Ae({kind:I,id:he}),ge(ce||be)}function yn(){if(xe){const I=Ce.trim();I&&(xe.kind==="session"?k(xe.id,I):P(xe.id,I))}Ae(null)}function xn(){Ae(null),ge("")}async function ns(I){const he=lN(Ye.get(I)??[]),ce=await A(I,he);ce&&St("folder",ce.id,ce.name)}function ss(I){const he=String(I.active.id);if(he.startsWith("s:")){const ce=we.get(he.slice(2));ce&&Qe({kind:"session",label:ce.title||ce.id.slice(0,8)})}else if(he.startsWith("f:")){const ce=ze.get(he.slice(2));ce&&Qe({kind:"folder",label:ce.name})}}function rs(I){Qe(null);const{active:he,over:ce}=I;if(!ce)return;const be=String(he.id),We=String(ce.id);if(be.startsWith("s:")){const tt=we.get(be.slice(2));if(!tt)return;const Ve=tt.cwd||"(no directory)",qt=al(tt,ze);let Ke,Xt;if(We.startsWith("f:")){const lt=ze.get(We.slice(2));if(!lt)return;Ke=lt.workspace_path,Xt=lt.id}else if(We.startsWith("s:")){const lt=we.get(We.slice(2));if(!lt)return;Ke=lt.cwd||"(no directory)",Xt=al(lt,ze)}else if(We.startsWith("c:")){const lt=We.slice(2),zt=lt.lastIndexOf("|");Ke=lt.slice(0,zt);const ks=lt.slice(zt+1);Xt=ks==="root"?null:ks}else return;if(Ke!==Ve)return;const ys=Fl(e.filter(lt=>(lt.cwd||"(no directory)")===Ke&&al(lt,ze)===Xt)),Rs=ys.filter(lt=>lt.id!==tt.id);let xs=Rs.length;if(We.startsWith("s:")){const lt=Rs.findIndex(zt=>zt.id===We.slice(2));lt>=0&&(xs=lt)}const Kn=[...Rs.slice(0,xs),tt,...Rs.slice(xs)],ws=[];if(Xt===qt){if(Kn.length===ys.length&&Kn.every((lt,zt)=>lt.id===ys[zt].id))return;Kn.forEach((lt,zt)=>ws.push({id:lt.id,folder_id:Xt,sort_order:Kn.length-1-zt}))}else{const lt=Fl(e.filter(zt=>(zt.cwd||"(no directory)")===Ve&&al(zt,ze)===qt)).filter(zt=>zt.id!==tt.id);lt.forEach((zt,ks)=>ws.push({id:zt.id,folder_id:qt,sort_order:lt.length-1-ks})),Kn.forEach((zt,ks)=>ws.push({id:zt.id,folder_id:Xt,sort_order:Kn.length-1-ks}))}z(ws);return}if(be.startsWith("f:")){if(!We.startsWith("f:"))return;const tt=ze.get(be.slice(2)),Ve=ze.get(We.slice(2));if(!tt||!Ve||tt.id===Ve.id||tt.workspace_path!==Ve.workspace_path)return;const qt=(Ye.get(tt.workspace_path)??[]).map(ys=>ys.id),Ke=qt.indexOf(tt.id),Xt=qt.indexOf(Ve.id);qt.splice(Xt,0,...qt.splice(Ke,1)),q(qt)}}const wn=O?e.filter(I=>!Rd(I,O)):e,fn=new Set(U?wn.filter(I=>oN(I)&&I.id!==l).map(I=>I.id):[]),Wt=iN(r,fn.size>0?wn.filter(I=>!fn.has(I.id)):wn),_n=y.useMemo(()=>{const I=new Map;if(!O)return I;const he=gr(O);for(const ce of e){if(!Rd(ce,O))continue;const be=gr(ce.cwd).slice(he.length+1).split("/")[0],We=I.get(be)??[];We.push(ce),I.set(be,We)}return I},[e,O]);function ft(I){return{folder:null,sessions:_n.get(I)??[],finishedKey:`app:${I}:finished`,hidden:M.has(I)}}const bt=[],Rt=I=>{if(I.hidden)return;const{working:he,finished:ce,finishedCollapsed:be}=Jm(I,Y);bt.push(...he.map(We=>We.id)),be||bt.push(...ce.map(We=>We.id))};for(const I of Wt){if(oe.has(I.path))continue;const he=Ye.get(I.path)??[],ce=new Set(he.map(be=>be.id));Zm(I,he,ce,K).forEach(Rt)}F.forEach(I=>Rt(ft(I.id)));const Kt=e.filter(I=>Ee.has(I.id)),Et=Kt.filter(I=>I.lifecycle!=="finished").map(I=>I.id),Nt=Kt.filter(I=>I.lifecycle==="finished").map(I=>I.id);function mt(I,he){if(he.metaKey||he.ctrlKey){he.preventDefault(),Se(I.id),et(ce=>{const be=new Set(ce);return be.has(I.id)?be.delete(I.id):be.add(I.id),be});return}if(he.shiftKey){he.preventDefault();const ce=He??I.id;Se(ce);const be=bt.indexOf(ce),We=bt.indexOf(I.id);if(be>=0&&We>=0){const[tt,Ve]=be<We?[be,We]:[We,be];et(new Set(bt.slice(tt,Ve+1)))}return}G(),Se(I.id),c(I.id)}function Gt(I,he){he.preventDefault();const ce=Ee.has(I.id)&&Ee.size>1;Ee.has(I.id)||(et(new Set),Se(I.id)),ve({x:he.clientX,y:he.clientY,type:"session",sessionId:I.id,sessionTitle:I.title,sessionLifecycle:I.lifecycle,sessionExternalId:I.external_thread_id,multi:ce})}function pt(I){var ce;const he=I.origin_app_id?F.find(be=>be.id===I.origin_app_id):null;return a.jsx(cN,{s:I,backgroundTaskCount:((ce=n[I.id])==null?void 0:ce.length)??0,isActive:l===I.id,isSelected:Ee.has(I.id),originApp:he??null,renaming:(xe==null?void 0:xe.kind)==="session"&&xe.id===I.id,renameValue:Ce,renameRef:Xe,onRenameValue:ge,onRenameConfirm:yn,onRenameCancel:xn,onSelect:be=>mt(I,be),onToggleStar:()=>j(I.id),onCtxMenu:be=>Gt(I,be)},I.id)}function Jt(I){var ce;const he=Jl(I,((ce=n[I.id])==null?void 0:ce.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===I.id?" active":""}${Ee.has(I.id)?" selected":""}${he.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:be=>mt(I,be),onContextMenu:be=>Gt(I,be),children:[a.jsx(rf,{iconClass:he.iconClass,iconText:he.iconText,size:14}),(xe==null?void 0:xe.kind)==="session"&&xe.id===I.id?a.jsx(mf,{inputRef:Xe,value:Ce,onChange:ge,onConfirm:yn,onCancel:xn}):a.jsx("span",{className:"tree-label",children:I.title||I.id.slice(0,8)}),he.dot&&a.jsx(sf,{status:he.dot,title:he.dotTitle})]},I.id)}function $t(I,he="workspace"){const{working:ce,finished:be,finishedCollapsed:We}=Jm(I,Y),tt=he==="workspace"?pt:Jt,Ve=a.jsxs(a.Fragment,{children:[ce.length===0&&be.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ce.map(tt),be.length>0&&a.jsxs("div",{className:`tree-subgroup ${We?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>yt(I.finishedKey),children:[a.jsx(Ro,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:be.length})]}),!We&&a.jsx("div",{className:"tree-subgroup-items",children:be.map(tt)})]})]});if(he==="app")return Ve;const qt=[...ce,...be].map(Ke=>`s:${Ke.id}`);return a.jsx(Ed,{items:qt,strategy:Qm,children:Ve})}return a.jsxs("div",{className:"ide-sidebar",ref:at,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${U?" active":""}`,title:U?`Show automatic sessions (${fn.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":U?"Show automatic sessions":"Hide automatic sessions","aria-pressed":U,onClick:Pe,children:U?a.jsx(R1,{size:14}):a.jsx(vr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(hr,{size:14})})]})]}),a.jsxs(ky,{sensors:Ot,collisionDetection:ry,onDragStart:ss,onDragEnd:rs,children:[Wt.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):Wt.map(I=>{const he=oe.has(I.path),ce=Ye.get(I.path)??[],be=new Set(ce.map(Ve=>Ve.id)),We=Zm(I,ce,be,K),tt=We[We.length-1];return a.jsxs("div",{className:`tree-section ${he?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>vt(I.path),onContextMenu:Ve=>{Ve.preventDefault(),ve({x:Ve.clientX,y:Ve.clientY,type:"workspace",path:I.path})},children:[a.jsx(Ro,{size:9,className:"tree-chevron"}),a.jsx(Il,{size:14}),a.jsx("span",{className:"tree-section-label",children:I.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Ve=>{Ve.stopPropagation(),h(I.path)},children:a.jsx(hr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Ve=>{Ve.stopPropagation(),ns(I.path)},children:a.jsx(sd,{size:11})}),a.jsx("span",{className:"tree-count",children:I.sessions.length})]}),!he&&a.jsxs("div",{className:"tree-children",children:[a.jsx(Ed,{items:ce.map(Ve=>`f:${Ve.id}`),strategy:Qm,children:We.filter(Ve=>Ve.folder).map(Ve=>a.jsx(uN,{folder:Ve.folder,count:Ve.sessions.length,collapsed:Ve.hidden,renaming:(xe==null?void 0:xe.kind)==="folder"&&xe.id===Ve.folder.id,renameValue:Ce,renameRef:Xe,onRenameValue:ge,onRenameConfirm:yn,onRenameCancel:xn,onToggle:()=>Z(Ve.folder.id),onCtxMenu:qt=>{qt.preventDefault(),ve({x:qt.clientX,y:qt.clientY,type:"folder",folderId:Ve.folder.id,folderName:Ve.folder.name})},children:a.jsx(eg,{id:`c:${I.path}|${Ve.folder.id}`,children:$t(Ve)})},Ve.folder.id))}),a.jsx(eg,{id:`c:${I.path}|root`,children:$t(tt)})]})]},I.path)}),a.jsx(Hb,{children:le&&a.jsxs("div",{className:"drag-overlay",children:[le.kind==="folder"&&a.jsx(Il,{size:12}),a.jsx("span",{children:le.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:()=>Te(),children:a.jsx(hr,{size:14})})]}),F.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),F.map(I=>{const he=ft(I.id),ce=he.sessions.length>0&&!he.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${Q===I.id?" active":""}`,title:I.description??void 0,onClick:()=>J(I.id),onContextMenu:be=>{be.preventDefault(),ve({x:be.clientX,y:be.clientY,type:"app",appId:I.id,appPinned:I.pinned})},children:[he.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ce?"":" closed"}`,title:"Edit sessions of this app",onClick:be=>{be.stopPropagation(),qe(I.id)},children:a.jsx(Ro,{size:10,className:"tree-chevron"})}),a.jsx(Mo,{iconNode:I.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:I.title}),he.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:he.sessions.length}),I.pinned&&a.jsx(Dl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ce&&a.jsx("div",{className:"sidebar-app-edits",children:$t(he,"app")})]},I.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(sd,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Be,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:()=>{h(X.path),ve(null)},children:[a.jsx(hr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ns(X.path),ve(null)},children:[a.jsx(sd,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),ve(null)},children:[a.jsx(Wv,{size:12})," Import Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.path),ve(null)},children:[a.jsx(fs,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{St("folder",X.folderId,X.folderName??""),ve(null)},children:[a.jsx(gl,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{L(X.folderId),ve(null)},children:[a.jsx(fs,{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:()=>{St("session",X.sessionId,X.sessionTitle??""),ve(null)},children:[a.jsx(gl,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(X.sessionId),ve(null)},children:[a.jsx(Al,{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&&(Bi(X.sessionExternalId),ve(null))},children:[a.jsx(Pi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ve(null)},children:[a.jsx(fs,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{N(X.sessionId),ve(null)},children:[a.jsx(zi,{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&&(Bi(X.sessionExternalId),ve(null))},children:[a.jsx(Pi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ve(null)},children:[a.jsx(fs,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[Kt.length," sessions selected"]}),Et.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Et),ve(null),G()},children:[a.jsx(Al,{size:12})," Mark ",Et.length," as Finished"]}),Nt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(Nt),ve(null),G()},children:[a.jsx(zi,{size:12})," Reopen ",Nt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{b([...Ee]),ve(null),G()},children:[a.jsx(fs,{size:12})," Delete ",Kt.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{te(X.appId),ve(null)},children:[a.jsx(gl,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{me(X.appId),ve(null)},children:[a.jsx(Dl,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Le(X.appId),ve(null)},children:[a.jsx(of,{size:12})," Export App…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{ke(X.appId),ve(null)},children:[a.jsx(fs,{size:12})," Delete App"]})]})]})]})}const ll=4,fN=({transform:e})=>({...e,y:0});function tg({tabKey:e,title:n,active:r,icon:o,badge:l,onSelect:c,onClose:d,onMenu:f}){const{attributes:h,listeners:m,setNodeRef:v,transform:k,transition:x,isDragging:S}=hf({id:e});return a.jsxs("div",{ref:v,style:{transform:_s.Translate.toString(k),transition:x},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...h,...m,onClick:c,onMouseDown:j=>{j.button===1&&j.preventDefault()},onAuxClick:j=>{j.button===1&&d()},onContextMenu:j=>{j.preventDefault(),j.stopPropagation(),f(j.clientX,j.clientY)},children:[o,n,l,a.jsx("span",{className:"ide-tab-close",onClick:j=>{j.stopPropagation(),d()},children:a.jsx(jn,{size:12})})]})}function pN({menu:e,tabs:n,onDone:r}){const o=R(k=>k.closeTabs),l=R(k=>k.reopenClosedTab),c=R(k=>k.closedTabs.some(x=>wv(k,x.key))),d=y.useRef(null),[f,h]=y.useState({left:e.x,top:e.y});Vi(d,r,!0),Do(r,!0),y.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:x}=d.current.getBoundingClientRect();h({left:Math.max(ll,Math.min(e.x,window.innerWidth-k-ll)),top:Math.max(ll,Math.min(e.y,window.innerHeight-x-ll))})},[e.x,e.y]);const m=e.key!==null&&n.includes(e.key)?e.key:null,v=(k,x,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(x(),r())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...f,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>o([m])),v("Close Others",()=>o(n.filter(k=>k!==m)),n.length<2),v("Close to the Right",()=>o(n.slice(n.indexOf(m)+1)),n.at(-1)===m),v("Close All",()=>o(n))]}),v("Reopen Closed Tab",l,!c)]})}function hN(){const e=R(z=>z.tabOrder),n=R(z=>z.activeSessionId),r=R(z=>z.sessions),o=R(z=>z.backgroundTasks),l=R(z=>z.selectSession),c=R(z=>z.closeTab),d=R(z=>z.setShowNewSessionDialog),f=R(z=>z.apps),h=R(z=>z.activeAppTabId),m=R(z=>z.openAppTab),v=R(z=>z.closeAppTab),k=R(z=>z.moveTab),[x,S]=y.useState(null),j=y.useRef(null),N=sy(ny(ic,{activationConstraint:{distance:5}})),T=Gd({activeSessionId:n,activeAppTabId:h});y.useEffect(()=>{var z,q,F;(F=(q=(z=j.current)==null?void 0:z.querySelector(".ide-tab.active"))==null?void 0:q.scrollIntoView)==null||F.call(q,{block:"nearest",inline:"nearest"})},[T]);const b=e.filter(z=>{const{kind:q,id:F}=mr(z);return q==="app"||r.some(O=>O.id===F)}),A=({active:z,over:q})=>{q&&k(String(z.id),String(q.id))},P=z=>{z.preventDefault(),S({x:z.clientX,y:z.clientY,key:null})},L=z=>{var te;const{kind:q,id:F}=mr(z),O=(me,ke)=>S({x:me,y:ke,key:z});if(q==="app"){const me=f.find(ke=>ke.id===F);return a.jsx(tg,{tabKey:z,title:(me==null?void 0:me.title)??F,active:h===F,icon:a.jsx(Mo,{iconNode:me==null?void 0:me.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(F),onClose:()=>v(F),onMenu:O},z)}const Q=r.find(me=>me.id===F);if(!Q)return null;const J=Jl(Q,((te=o[F])==null?void 0:te.length)??0);return a.jsx(tg,{tabKey:z,title:Q.title||F.slice(0,8),active:n===F&&h==null,icon:a.jsx(rf,{iconClass:J.iconClass,iconText:J.iconText,size:14}),badge:J.dot&&a.jsx(sf,{status:J.dot,title:J.dotTitle}),onSelect:()=>void l(F),onClose:()=>c(F),onMenu:O},z)};return a.jsxs(ky,{sensors:N,collisionDetection:ry,modifiers:[fN],onDragEnd:A,children:[a.jsx(Ed,{items:b,strategy:qb,children:a.jsxs("div",{ref:j,className:"ide-tabs",onContextMenu:P,onWheel:z=>{z.deltaX===0&&(z.currentTarget.scrollLeft+=z.deltaY)},children:[b.map(L),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(hr,{size:14})})]})}),x&&a.jsx(pN,{menu:x,tabs:b,onDone:()=>S(null)})]})}function gf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Wr=gf();function _y(e){Wr=e}var Ii={exec:()=>null};function dt(e,n=""){let r=typeof e=="string"?e:e.source;const o={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(Cn.caret,"$1"),r=r.replace(l,d),o},getRegex:()=>new RegExp(r,n)};return o}var Cn={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:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},mN=/^(?:[ \t]*(?:\n|$))+/,gN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,vN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vf=/(?:[*+-]|\d{1,9}[.)])/,Ry=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ay=dt(Ry).replace(/bull/g,vf).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(),xN=dt(Ry).replace(/bull/g,vf).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(),yf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,wN=/^[^\n]+/,xf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,kN=dt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),SN=dt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,vf).getRegex(),cc="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",wf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bN=dt("^ {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",wf).replace("tag",cc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Iy=dt(yf).replace("hr",Qi).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",cc).getRegex(),NN=dt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Iy).getRegex(),kf={blockquote:NN,code:gN,def:kN,fences:vN,heading:yN,hr:Qi,html:bN,lheading:Ay,list:SN,newline:mN,paragraph:Iy,table:Ii,text:wN},ng=dt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qi).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",cc).getRegex(),TN={...kf,lheading:xN,table:ng,paragraph:dt(yf).replace("hr",Qi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ng).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",cc).getRegex()},CN={...kf,html:dt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wf).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:Ii,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:dt(yf).replace("hr",Qi).replace("heading",` *#{1,6} *[^
468
- ]`).replace("lheading",Ay).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},jN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,EN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Dy=/^( {2,}|\\)\n(?!\s*$)/,_N=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uc=/[\p{P}\p{S}]/u,Sf=/[\s\p{P}\p{S}]/u,My=/[^\s\p{P}\p{S}]/u,RN=dt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Sf).getRegex(),Ly=/(?!~)[\p{P}\p{S}]/u,AN=/(?!~)[\s\p{P}\p{S}]/u,IN=/(?:[^\s\p{P}\p{S}]|~)/u,DN=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Oy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,MN=dt(Oy,"u").replace(/punct/g,uc).getRegex(),LN=dt(Oy,"u").replace(/punct/g,Ly).getRegex(),$y="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ON=dt($y,"gu").replace(/notPunctSpace/g,My).replace(/punctSpace/g,Sf).replace(/punct/g,uc).getRegex(),$N=dt($y,"gu").replace(/notPunctSpace/g,IN).replace(/punctSpace/g,AN).replace(/punct/g,Ly).getRegex(),PN=dt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,My).replace(/punctSpace/g,Sf).replace(/punct/g,uc).getRegex(),zN=dt(/\\(punct)/,"gu").replace(/punct/g,uc).getRegex(),FN=dt(/^<(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(),UN=dt(wf).replace("(?:-->|$)","-->").getRegex(),BN=dt("^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",UN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ul=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,WN=dt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ul).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Py=dt(/^!?\[(label)\]\[(ref)\]/).replace("label",Ul).replace("ref",xf).getRegex(),zy=dt(/^!?\[(ref)\](?:\[\])?/).replace("ref",xf).getRegex(),HN=dt("reflink|nolink(?!\\()","g").replace("reflink",Py).replace("nolink",zy).getRegex(),bf={_backpedal:Ii,anyPunctuation:zN,autolink:FN,blockSkip:DN,br:Dy,code:EN,del:Ii,emStrongLDelim:MN,emStrongRDelimAst:ON,emStrongRDelimUnd:PN,escape:jN,link:WN,nolink:zy,punctuation:RN,reflink:Py,reflinkSearch:HN,tag:BN,text:_N,url:Ii},VN={...bf,link:dt(/^!?\[(label)\]\((.*?)\)/).replace("label",Ul).getRegex(),reflink:dt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ul).getRegex()},Ad={...bf,emStrongRDelimAst:$N,emStrongLDelim:LN,url:dt(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},KN={...Ad,br:dt(Dy).replace("{2,}","*").getRegex(),text:dt(Ad.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},cl={normal:kf,gfm:TN,pedantic:CN},xi={normal:bf,gfm:Ad,breaks:KN,pedantic:VN},GN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},sg=e=>GN[e];function Es(e,n){if(n){if(Cn.escapeTest.test(e))return e.replace(Cn.escapeReplace,sg)}else if(Cn.escapeTestNoEncode.test(e))return e.replace(Cn.escapeReplaceNoEncode,sg);return e}function rg(e){try{e=encodeURI(e).replace(Cn.percentDecode,"%")}catch{return null}return e}function og(e,n){var c;const r=e.replace(Cn.findPipe,(d,f,h)=>{let m=!1,v=f;for(;--v>=0&&h[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(Cn.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((c=o.at(-1))!=null&&c.trim())&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(Cn.slashPipe,"|");return o}function wi(e,n,r){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===n;)l++;return e.slice(0,o-l)}function qN(e,n){if(e.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===n[0])r++;else if(e[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function ig(e,n,r,o,l){const c=n.href,d=n.title||null,f=e[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:f,tokens:o.inlineTokens(f)};return o.state.inLink=!1,h}function XN(e,n,r){const o=e.match(r.other.indentCodeCompensation);if(o===null)return n;const l=o[1];return n.split(`
467
+ `},RS={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:r}=e;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(e){let{active:n,over:r}=e;return r?"Draggable item "+n.id+" was dropped over droppable area "+r.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function AS(e){let{announcements:n=RS,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=_S}=e;const{announce:c,announcement:d}=CS(),f=Xi("DndLiveRegion"),[h,m]=y.useState(!1);if(y.useEffect(()=>{m(!0)},[]),jS(y.useMemo(()=>({onDragStart(k){let{active:x}=k;c(n.onDragStart({active:x}))},onDragMove(k){let{active:x,over:S}=k;n.onDragMove&&c(n.onDragMove({active:x,over:S}))},onDragOver(k){let{active:x,over:S}=k;c(n.onDragOver({active:x,over:S}))},onDragEnd(k){let{active:x,over:S}=k;c(n.onDragEnd({active:x,over:S}))},onDragCancel(k){let{active:x,over:S}=k;c(n.onDragCancel({active:x,over:S}))}}),[c,n])),!h)return null;const v=vt.createElement(vt.Fragment,null,vt.createElement(NS,{id:o,value:l.draggable}),vt.createElement(TS,{id:f,announcement:d}));return r?Ti.createPortal(v,r):v}var Zt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Zt||(Zt={}));function Pl(){}function oy(e,n){return y.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function iy(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return y.useMemo(()=>[...n].filter(o=>o!=null),[...n])}const vs=Object.freeze({x:0,y:0});function IS(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function DS(e,n){const r=$l(e);if(!r)return"0 0";const o={x:(r.x-n.left)/n.width*100,y:(r.y-n.top)/n.height*100};return o.x+"% "+o.y+"%"}function MS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return r-o}function LS(e,n){let{data:{value:r}}=e,{data:{value:o}}=n;return o-r}function OS(e,n){if(!e||e.length===0)return null;const[r]=e;return r[n]}function zm(e,n,r){return n===void 0&&(n=e.left),r===void 0&&(r=e.top),{x:n+e.width*.5,y:r+e.height*.5}}const ay=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=zm(n,n.left,n.top),c=[];for(const d of o){const{id:f}=d,h=r.get(f);if(h){const m=IS(zm(h),l);c.push({id:f,data:{droppableContainer:d,value:m}})}}return c.sort(MS)};function $S(e,n){const r=Math.max(n.top,e.top),o=Math.max(n.left,e.left),l=Math.min(n.left+n.width,e.left+e.width),c=Math.min(n.top+n.height,e.top+e.height),d=l-o,f=c-r;if(o<l&&r<c){const h=n.width*n.height,m=e.width*e.height,v=d*f,k=v/(h+m-v);return Number(k.toFixed(4))}return 0}const PS=e=>{let{collisionRect:n,droppableRects:r,droppableContainers:o}=e;const l=[];for(const c of o){const{id:d}=c,f=r.get(d);if(f){const h=$S(f,n);h>0&&l.push({id:d,data:{droppableContainer:c,value:h}})}}return l.sort(LS)};function zS(e,n,r){return{...e,scaleX:n&&r?n.width/r.width:1,scaleY:n&&r?n.height/r.height:1}}function ly(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:vs}function FS(e){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return l.reduce((d,f)=>({...d,top:d.top+e*f.y,bottom:d.bottom+e*f.y,left:d.left+e*f.x,right:d.right+e*f.x}),{...r})}}const US=FS(1);function cy(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function BS(e,n,r){const o=cy(n);if(!o)return e;const{scaleX:l,scaleY:c,x:d,y:f}=o,h=e.left-d-(1-l)*parseFloat(r),m=e.top-f-(1-c)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?e.width/l:e.width,k=c?e.height/c:e.height;return{width:v,height:k,top:m,right:h+v,bottom:m+k,left:h}}const WS={ignoreTransform:!1};function $o(e,n){n===void 0&&(n=WS);let r=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:v}=En(e).getComputedStyle(e);m&&(r=BS(r,m,v))}const{top:o,left:l,width:c,height:d,bottom:f,right:h}=r;return{top:o,left:l,width:c,height:d,bottom:f,right:h}}function Fm(e){return $o(e,{ignoreTransform:!0})}function HS(e){const n=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:n,bottom:r,width:n,height:r}}function VS(e,n){return n===void 0&&(n=En(e).getComputedStyle(e)),n.position==="fixed"}function KS(e,n){n===void 0&&(n=En(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const c=n[l];return typeof c=="string"?r.test(c):!1})}function uf(e,n){const r=[];function o(l){if(n!=null&&r.length>=n||!l)return r;if(cf(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Gi(l)||ny(l)||r.includes(l))return r;const c=En(e).getComputedStyle(l);return l!==e&&KS(l,c)&&r.push(l),VS(l,c)?r:o(l.parentNode)}return e?o(e):r}function uy(e){const[n]=uf(e,1);return n??null}function od(e){return!sc||!e?null:Lo(e)?e:lf(e)?cf(e)||e===Oo(e).scrollingElement?window:Gi(e)?e:null:null}function dy(e){return Lo(e)?e.scrollX:e.scrollLeft}function fy(e){return Lo(e)?e.scrollY:e.scrollTop}function Td(e){return{x:dy(e),y:fy(e)}}var an;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(an||(an={}));function py(e){return!sc||!e?!1:e===document.scrollingElement}function hy(e){const n={x:0,y:0},r=py(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},o={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},l=e.scrollTop<=n.y,c=e.scrollLeft<=n.x,d=e.scrollTop>=o.y,f=e.scrollLeft>=o.x;return{isTop:l,isLeft:c,isBottom:d,isRight:f,maxScroll:o,minScroll:n}}const GS={x:.2,y:.2};function qS(e,n,r,o,l){let{top:c,left:d,right:f,bottom:h}=r;o===void 0&&(o=10),l===void 0&&(l=GS);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=hy(e),S={x:0,y:0},j={x:0,y:0},N={height:n.height*l.y,width:n.width*l.x};return!m&&c<=n.top+N.height?(S.y=an.Backward,j.y=o*Math.abs((n.top+N.height-c)/N.height)):!v&&h>=n.bottom-N.height&&(S.y=an.Forward,j.y=o*Math.abs((n.bottom-N.height-h)/N.height)),!x&&f>=n.right-N.width?(S.x=an.Forward,j.x=o*Math.abs((n.right-N.width-f)/N.width)):!k&&d<=n.left+N.width&&(S.x=an.Backward,j.x=o*Math.abs((n.left+N.width-d)/N.width)),{direction:S,speed:j}}function XS(e){if(e===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:o,bottom:l}=e.getBoundingClientRect();return{top:n,left:r,right:o,bottom:l,width:e.clientWidth,height:e.clientHeight}}function my(e){return e.reduce((n,r)=>Ao(n,Td(r)),vs)}function YS(e){return e.reduce((n,r)=>n+dy(r),0)}function QS(e){return e.reduce((n,r)=>n+fy(r),0)}function gy(e,n){if(n===void 0&&(n=$o),!e)return;const{top:r,left:o,bottom:l,right:c}=n(e);uy(e)&&(l<=0||c<=0||r>=window.innerHeight||o>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ZS=[["x",["left","right"],YS],["y",["top","bottom"],QS]];class df{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 o=uf(r),l=my(o);this.rect={...n},this.width=n.width,this.height=n.height;for(const[c,d,f]of ZS)for(const h of d)Object.defineProperty(this,h,{get:()=>{const m=f(o),v=l[c]-m;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class _i{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=n}add(n,r,o){var l;(l=this.target)==null||l.addEventListener(n,r,o),this.listeners.push([n,r,o])}}function JS(e){const{EventTarget:n}=En(e);return e instanceof n?e:Oo(e)}function id(e,n){const r=Math.abs(e.x),o=Math.abs(e.y);return typeof n=="number"?Math.sqrt(r**2+o**2)>n:"x"in n&&"y"in n?r>n.x&&o>n.y:"x"in n?r>n.x:"y"in n?o>n.y:!1}var es;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(es||(es={}));function Um(e){e.preventDefault()}function eb(e){e.stopPropagation()}var ct;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(ct||(ct={}));const vy={start:[ct.Space,ct.Enter],cancel:[ct.Esc],end:[ct.Space,ct.Enter,ct.Tab]},tb=(e,n)=>{let{currentCoordinates:r}=n;switch(e.code){case ct.Right:return{...r,x:r.x+25};case ct.Left:return{...r,x:r.x-25};case ct.Down:return{...r,y:r.y+25};case ct.Up:return{...r,y:r.y-25}}};class yy{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 _i(Oo(r)),this.windowListeners=new _i(En(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,o=n.node.current;o&&gy(o),r(vs)}handleKeyDown(n){if(oc(n)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:c=vy,coordinateGetter:d=tb,scrollBehavior:f="smooth"}=l,{code:h}=n;if(c.end.includes(h)){this.handleEnd(n);return}if(c.cancel.includes(h)){this.handleCancel(n);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:vs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=d(n,{active:r,context:o.current,currentCoordinates:v});if(k){const x=Ol(k,v),S={x:0,y:0},{scrollableAncestors:j}=o.current;for(const N of j){const T=n.code,{isTop:b,isRight:A,isLeft:P,isBottom:L,maxScroll:z,minScroll:q}=hy(N),F=XS(N),O={x:Math.min(T===ct.Right?F.right-F.width/2:F.right,Math.max(T===ct.Right?F.left:F.left+F.width/2,k.x)),y:Math.min(T===ct.Down?F.bottom-F.height/2:F.bottom,Math.max(T===ct.Down?F.top:F.top+F.height/2,k.y))},Q=T===ct.Right&&!A||T===ct.Left&&!P,J=T===ct.Down&&!L||T===ct.Up&&!b;if(Q&&O.x!==k.x){const te=N.scrollLeft+x.x,me=T===ct.Right&&te<=z.x||T===ct.Left&&te>=q.x;if(me&&!x.y){N.scrollTo({left:te,behavior:f});return}me?S.x=N.scrollLeft-te:S.x=T===ct.Right?N.scrollLeft-z.x:N.scrollLeft-q.x,S.x&&N.scrollBy({left:-S.x,behavior:f});break}else if(J&&O.y!==k.y){const te=N.scrollTop+x.y,me=T===ct.Down&&te<=z.y||T===ct.Up&&te>=q.y;if(me&&!x.x){N.scrollTo({top:te,behavior:f});return}me?S.y=N.scrollTop-te:S.y=T===ct.Down?N.scrollTop-z.y:N.scrollTop-q.y,S.y&&N.scrollBy({top:-S.y,behavior:f});break}}this.handleMove(n,Ao(Ol(k,this.referenceCoordinates),S))}}}handleMove(n,r){const{onMove:o}=this.props;n.preventDefault(),o(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()}}yy.activators=[{eventName:"onKeyDown",handler:(e,n,r)=>{let{keyboardCodes:o=vy,onActivation:l}=n,{active:c}=r;const{code:d}=e.nativeEvent;if(o.start.includes(d)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),l==null||l({event:e.nativeEvent}),!0)}return!1}}];function Bm(e){return!!(e&&"distance"in e)}function Wm(e){return!!(e&&"delay"in e)}class ff{constructor(n,r,o){var l;o===void 0&&(o=JS(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=Oo(d),this.documentListeners=new _i(this.document),this.listeners=new _i(o),this.windowListeners=new _i(En(d)),this.initialCoordinates=(l=$l(c))!=null?l:vs,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:o}}}=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,Um),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Um),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Wm(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Bm(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:o,onPending:l}=this.props;l(o,n,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:n}=this,{onStart:r}=this.props;n&&(this.activated=!0,this.documentListeners.add(es.Click,eb,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(n))}handleMove(n){var r;const{activated:o,initialCoordinates:l,props:c}=this,{onMove:d,options:{activationConstraint:f}}=c;if(!l)return;const h=(r=$l(n))!=null?r:vs,m=Ol(l,h);if(!o&&f){if(Bm(f)){if(f.tolerance!=null&&id(m,f.tolerance))return this.handleCancel();if(id(m,f.distance))return this.handleStart()}if(Wm(f)&&id(m,f.tolerance))return this.handleCancel();this.handlePending(f,m);return}n.cancelable&&n.preventDefault(),d(h)}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===ct.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const nb={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ic extends ff{constructor(n){const{event:r}=n,o=Oo(r.target);super(n,nb,o)}}ic.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const sb={move:{name:"mousemove"},end:{name:"mouseup"}};var Cd;(function(e){e[e.RightClick=2]="RightClick"})(Cd||(Cd={}));class rb extends ff{constructor(n){super(n,sb,Oo(n.event.target))}}rb.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;return r.button===Cd.RightClick?!1:(o==null||o({event:r}),!0)}}];const ad={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ob extends ff{constructor(n){super(n,ad)}static setup(){return window.addEventListener(ad.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(ad.move.name,n)};function n(){}}}ob.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:r}=e,{onActivation:o}=n;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var Ri;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ri||(Ri={}));var zl;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(zl||(zl={}));function ib(e){let{acceleration:n,activator:r=Ri.Pointer,canScroll:o,draggingRect:l,enabled:c,interval:d=5,order:f=zl.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=e;const S=lb({delta:k,disabled:!c}),[j,N]=xS(),T=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),A=y.useMemo(()=>{switch(r){case Ri.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case Ri.DraggableRect:return l}},[r,l,h]),P=y.useRef(null),L=y.useCallback(()=>{const q=P.current;if(!q)return;const F=T.current.x*b.current.x,O=T.current.y*b.current.y;q.scrollBy(F,O)},[]),z=y.useMemo(()=>f===zl.TreeOrder?[...m].reverse():m,[f,m]);y.useEffect(()=>{if(!c||!m.length||!A){N();return}for(const q of z){if((o==null?void 0:o(q))===!1)continue;const F=m.indexOf(q),O=v[F];if(!O)continue;const{direction:Q,speed:J}=qS(q,O,A,n,x);for(const te of["x","y"])S[te][Q[te]]||(J[te]=0,Q[te]=0);if(J.x>0||J.y>0){N(),P.current=q,j(L,d),T.current=J,b.current=Q;return}}T.current={x:0,y:0},b.current={x:0,y:0},N()},[n,L,o,N,c,d,JSON.stringify(A),JSON.stringify(S),j,m,z,v,JSON.stringify(x)])}const ab={x:{[an.Backward]:!1,[an.Forward]:!1},y:{[an.Backward]:!1,[an.Forward]:!1}};function lb(e){let{delta:n,disabled:r}=e;const o=Ll(n);return qi(l=>{if(r||!o||!l)return ab;const c={x:Math.sign(n.x-o.x),y:Math.sign(n.y-o.y)};return{x:{[an.Backward]:l.x[an.Backward]||c.x===-1,[an.Forward]:l.x[an.Forward]||c.x===1},y:{[an.Backward]:l.y[an.Backward]||c.y===-1,[an.Forward]:l.y[an.Forward]||c.y===1}}},[r,n,o])}function cb(e,n){const r=n!=null?e.get(n):void 0,o=r?r.node.current:null;return qi(l=>{var c;return n==null?null:(c=o??l)!=null?c:null},[o,n])}function ub(e,n){return y.useMemo(()=>e.reduce((r,o)=>{const{sensor:l}=o,c=l.activators.map(d=>({eventName:d.eventName,handler:n(d.handler,o)}));return[...r,...c]},[]),[e,n])}var Ui;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ui||(Ui={}));var jd;(function(e){e.Optimized="optimized"})(jd||(jd={}));const Hm=new Map;function db(e,n){let{dragging:r,dependencies:o,config:l}=n;const[c,d]=y.useState(null),{frequency:f,measure:h,strategy:m}=l,v=y.useRef(e),k=T(),x=Fi(k),S=y.useCallback(function(b){b===void 0&&(b=[]),!x.current&&d(A=>A===null?b:A.concat(b.filter(P=>!A.includes(P))))},[x]),j=y.useRef(null),N=qi(b=>{if(k&&!r)return Hm;if(!b||b===Hm||v.current!==e||c!=null){const A=new Map;for(let P of e){if(!P)continue;if(c&&c.length>0&&!c.includes(P.id)&&P.rect.current){A.set(P.id,P.rect.current);continue}const L=P.node.current,z=L?new df(h(L),L):null;P.rect.current=z,z&&A.set(P.id,z)}return A}return b},[e,c,r,k,h]);return y.useEffect(()=>{v.current=e},[e]),y.useEffect(()=>{k||S()},[r,k]),y.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),y.useEffect(()=>{k||typeof f!="number"||j.current!==null||(j.current=setTimeout(()=>{S(),j.current=null},f))},[f,k,S,...o]),{droppableRects:N,measureDroppableContainers:S,measuringScheduled:c!=null};function T(){switch(m){case Ui.Always:return!1;case Ui.BeforeDragging:return r;default:return!r}}}function pf(e,n){return qi(r=>e?r||(typeof n=="function"?n(e):e):null,[n,e])}function fb(e,n){return pf(e,n)}function pb(e){let{callback:n,disabled:r}=e;const o=rc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(o)},[o,r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function ac(e){let{callback:n,disabled:r}=e;const o=rc(n),l=y.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(o)},[r]);return y.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function hb(e){return new df($o(e),e)}function Vm(e,n,r){n===void 0&&(n=hb);const[o,l]=y.useState(null);function c(){l(h=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=h??r)!=null?m:null}const v=n(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const d=pb({callback(h){if(e)for(const m of h){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(e)){c();break}}}}),f=ac({callback:c});return gs(()=>{c(),e?(f==null||f.observe(e),d==null||d.observe(document.body,{childList:!0,subtree:!0})):(f==null||f.disconnect(),d==null||d.disconnect())},[e]),o}function mb(e){const n=pf(e);return ly(e,n)}const Km=[];function gb(e){const n=y.useRef(e),r=qi(o=>e?o&&o!==Km&&e&&n.current&&e.parentNode===n.current.parentNode?o:uf(e):Km,[e]);return y.useEffect(()=>{n.current=e},[e]),r}function vb(e){const[n,r]=y.useState(null),o=y.useRef(e),l=y.useCallback(c=>{const d=od(c.target);d&&r(f=>f?(f.set(d,Td(d)),new Map(f)):null)},[]);return y.useEffect(()=>{const c=o.current;if(e!==c){d(c);const f=e.map(h=>{const m=od(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,Td(m)]):null}).filter(h=>h!=null);r(f.length?new Map(f):null),o.current=e}return()=>{d(e),d(c)};function d(f){f.forEach(h=>{const m=od(h);m==null||m.removeEventListener("scroll",l)})}},[l,e]),y.useMemo(()=>e.length?n?Array.from(n.values()).reduce((c,d)=>Ao(c,d),vs):my(e):vs,[e,n])}function Gm(e,n){n===void 0&&(n=[]);const r=y.useRef(null);return y.useEffect(()=>{r.current=null},n),y.useEffect(()=>{const o=e!==vs;o&&!r.current&&(r.current=e),!o&&r.current&&(r.current=null)},[e]),r.current?Ol(e,r.current):vs}function yb(e){y.useEffect(()=>{if(!sc)return;const n=e.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of n)r==null||r()}},e.map(n=>{let{sensor:r}=n;return r}))}function xb(e,n){return y.useMemo(()=>e.reduce((r,o)=>{let{eventName:l,handler:c}=o;return r[l]=d=>{c(d,n)},r},{}),[e,n])}function xy(e){return y.useMemo(()=>e?HS(e):null,[e])}const qm=[];function wb(e,n){n===void 0&&(n=$o);const[r]=e,o=xy(r?En(r):null),[l,c]=y.useState(qm);function d(){c(()=>e.length?e.map(h=>py(h)?o:new df(n(h),h)):qm)}const f=ac({callback:d});return gs(()=>{f==null||f.disconnect(),d(),e.forEach(h=>f==null?void 0:f.observe(h))},[e]),l}function wy(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return Gi(n)?n:e}function kb(e){let{measure:n}=e;const[r,o]=y.useState(null),l=y.useCallback(m=>{for(const{target:v}of m)if(Gi(v)){o(k=>{const x=n(v);return k?{...k,width:x.width,height:x.height}:x});break}},[n]),c=ac({callback:l}),d=y.useCallback(m=>{const v=wy(m);c==null||c.disconnect(),v&&(c==null||c.observe(v)),o(v?n(v):null)},[n,c]),[f,h]=Ml(d);return y.useMemo(()=>({nodeRef:f,rect:r,setRef:h}),[r,f,h])}const Sb=[{sensor:ic,options:{}},{sensor:yy,options:{}}],bb={current:{}},vl={draggable:{measure:Fm},droppable:{measure:Fm,strategy:Ui.WhileDragging,frequency:jd.Optimized},dragOverlay:{measure:$o}};class Ai 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,o;return(r=(o=this.get(n))==null?void 0:o.node.current)!=null?r:void 0}}const Nb={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ai,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Pl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:vl,measureDroppableContainers:Pl,windowRect:null,measuringScheduled:!1},ky={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Pl,draggableNodes:new Map,over:null,measureDroppableContainers:Pl},Yi=y.createContext(ky),Sy=y.createContext(Nb);function Tb(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ai}}}function Cb(e,n){switch(n.type){case Zt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case Zt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case Zt.DragEnd:case Zt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zt.RegisterDroppable:{const{element:r}=n,{id:o}=r,l=new Ai(e.droppable.containers);return l.set(o,r),{...e,droppable:{...e.droppable,containers:l}}}case Zt.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=n,c=e.droppable.containers.get(r);if(!c||o!==c.key)return e;const d=new Ai(e.droppable.containers);return d.set(r,{...c,disabled:l}),{...e,droppable:{...e.droppable,containers:d}}}case Zt.UnregisterDroppable:{const{id:r,key:o}=n,l=e.droppable.containers.get(r);if(!l||o!==l.key)return e;const c=new Ai(e.droppable.containers);return c.delete(r),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function jb(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:l}=y.useContext(Yi),c=Ll(o),d=Ll(r==null?void 0:r.id);return y.useEffect(()=>{if(!n&&!o&&c&&d!=null){if(!oc(c)||document.activeElement===c.target)return;const f=l.get(d);if(!f)return;const{activatorNode:h,node:m}=f;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[h.current,m.current]){if(!v)continue;const k=SS(v);if(k){k.focus();break}}})}},[o,n,l,d,c]),null}function by(e,n){let{transform:r,...o}=n;return e!=null&&e.length?e.reduce((l,c)=>c({transform:l,...o}),r):r}function Eb(e){return y.useMemo(()=>({draggable:{...vl.draggable,...e==null?void 0:e.draggable},droppable:{...vl.droppable,...e==null?void 0:e.droppable},dragOverlay:{...vl.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function _b(e){let{activeNode:n,measure:r,initialRect:o,config:l=!0}=e;const c=y.useRef(!1),{x:d,y:f}=typeof l=="boolean"?{x:l,y:l}:l;gs(()=>{if(!d&&!f||!n){c.current=!1;return}if(c.current||!o)return;const m=n==null?void 0:n.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=ly(v,o);if(d||(k.x=0),f||(k.y=0),c.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=uy(m);x&&x.scrollBy({top:k.y,left:k.x})}},[n,d,f,o,r])}const lc=y.createContext({...vs,scaleX:1,scaleY:1});var fr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(fr||(fr={}));const Ny=y.memo(function(n){var r,o,l,c;let{id:d,accessibility:f,autoScroll:h=!0,children:m,sensors:v=Sb,collisionDetection:k=PS,measuring:x,modifiers:S,...j}=n;const N=y.useReducer(Cb,void 0,Tb),[T,b]=N,[A,P]=ES(),[L,z]=y.useState(fr.Uninitialized),q=L===fr.Initialized,{draggable:{active:F,nodes:O,translate:Q},droppable:{containers:J}}=T,te=F!=null?O.get(F):null,me=y.useRef({initial:null,translated:null}),ke=y.useMemo(()=>{var ft;return F!=null?{id:F,data:(ft=te==null?void 0:te.data)!=null?ft:bb,rect:me}:null},[F,te]),Le=y.useRef(null),[Te,oe]=y.useState(null),[ee,Y]=y.useState(null),ae=Fi(j,Object.values(j)),K=Xi("DndDescribedBy",d),E=y.useMemo(()=>J.getEnabled(),[J]),M=Eb(x),{droppableRects:de,measureDroppableContainers:U,measuringScheduled:ue}=db(E,{dragging:q,dependencies:[Q.x,Q.y],config:M.droppable}),X=cb(O,F),ve=y.useMemo(()=>ee?$l(ee):null,[ee]),xe=_n(),Ae=fb(X,M.draggable.measure);_b({activeNode:F!=null?O.get(F):null,config:xe.layoutShiftCompensation,initialRect:Ae,measure:M.draggable.measure});const Ce=Vm(X,M.draggable.measure,Ae),ge=Vm(X?X.parentElement:null),le=y.useRef({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:de,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Qe=J.getNodeFor((r=le.current.over)==null?void 0:r.id),Ee=kb({measure:M.dragOverlay.measure}),et=(o=Ee.nodeRef.current)!=null?o:X,He=q?(l=Ee.rect)!=null?l:Ce:null,Se=!!(Ee.nodeRef.current&&Ee.rect),Be=mb(Se?null:Ce),Xe=xy(et?En(et):null),at=gb(q?Qe??X:null),kt=wb(at),Ot=by(S,{transform:{x:Q.x-Be.x,y:Q.y-Be.y,scaleX:1,scaleY:1},activatorEvent:ee,active:ke,activeNodeRect:Ce,containerNodeRect:ge,draggingNodeRect:He,over:le.current.over,overlayNodeRect:Ee.rect,scrollableAncestors:at,scrollableAncestorRects:kt,windowRect:Xe}),G=ve?Ao(ve,Q):null,we=vb(at),ze=Gm(we),Ye=Gm(we,[Ce]),yt=Ao(Ot,ze),xt=He?US(He,Ot):null,Z=ke&&xt?k({active:ke,collisionRect:xt,droppableRects:de,droppableContainers:E,pointerCoordinates:G}):null,Pe=OS(Z,"id"),[qe,St]=y.useState(null),yn=Se?Ot:Ao(Ot,Ye),xn=zS(yn,(c=qe==null?void 0:qe.rect)!=null?c:null,Ce),ns=y.useRef(null),ss=y.useCallback((ft,bt)=>{let{sensor:Rt,options:Kt}=bt;if(Le.current==null)return;const Et=O.get(Le.current);if(!Et)return;const Nt=ft.nativeEvent,mt=new Rt({active:Le.current,activeNode:Et,event:Nt,options:Kt,context:le,onAbort(pt){if(!O.get(pt))return;const{onDragAbort:$t}=ae.current,I={id:pt};$t==null||$t(I),A({type:"onDragAbort",event:I})},onPending(pt,Jt,$t,I){if(!O.get(pt))return;const{onDragPending:ce}=ae.current,be={id:pt,constraint:Jt,initialCoordinates:$t,offset:I};ce==null||ce(be),A({type:"onDragPending",event:be})},onStart(pt){const Jt=Le.current;if(Jt==null)return;const $t=O.get(Jt);if(!$t)return;const{onDragStart:I}=ae.current,he={activatorEvent:Nt,active:{id:Jt,data:$t.data,rect:me}};Ti.unstable_batchedUpdates(()=>{I==null||I(he),z(fr.Initializing),b({type:Zt.DragStart,initialCoordinates:pt,active:Jt}),A({type:"onDragStart",event:he}),oe(ns.current),Y(Nt)})},onMove(pt){b({type:Zt.DragMove,coordinates:pt})},onEnd:Gt(Zt.DragEnd),onCancel:Gt(Zt.DragCancel)});ns.current=mt;function Gt(pt){return async function(){const{active:$t,collisions:I,over:he,scrollAdjustedTranslate:ce}=le.current;let be=null;if($t&&ce){const{cancelDrop:We}=ae.current;be={activatorEvent:Nt,active:$t,collisions:I,delta:ce,over:he},pt===Zt.DragEnd&&typeof We=="function"&&await Promise.resolve(We(be))&&(pt=Zt.DragCancel)}Le.current=null,Ti.unstable_batchedUpdates(()=>{b({type:pt}),z(fr.Uninitialized),St(null),oe(null),Y(null),ns.current=null;const We=pt===Zt.DragEnd?"onDragEnd":"onDragCancel";if(be){const tt=ae.current[We];tt==null||tt(be),A({type:We,event:be})}})}}},[O]),rs=y.useCallback((ft,bt)=>(Rt,Kt)=>{const Et=Rt.nativeEvent,Nt=O.get(Kt);if(Le.current!==null||!Nt||Et.dndKit||Et.defaultPrevented)return;const mt={active:Nt};ft(Rt,bt.options,mt)===!0&&(Et.dndKit={capturedBy:bt.sensor},Le.current=Kt,ss(Rt,bt))},[O,ss]),wn=ub(v,rs);yb(v),gs(()=>{Ce&&L===fr.Initializing&&z(fr.Initialized)},[Ce,L]),y.useEffect(()=>{const{onDragMove:ft}=ae.current,{active:bt,activatorEvent:Rt,collisions:Kt,over:Et}=le.current;if(!bt||!Rt)return;const Nt={active:bt,activatorEvent:Rt,collisions:Kt,delta:{x:yt.x,y:yt.y},over:Et};Ti.unstable_batchedUpdates(()=>{ft==null||ft(Nt),A({type:"onDragMove",event:Nt})})},[yt.x,yt.y]),y.useEffect(()=>{const{active:ft,activatorEvent:bt,collisions:Rt,droppableContainers:Kt,scrollAdjustedTranslate:Et}=le.current;if(!ft||Le.current==null||!bt||!Et)return;const{onDragOver:Nt}=ae.current,mt=Kt.get(Pe),Gt=mt&&mt.rect.current?{id:mt.id,rect:mt.rect.current,data:mt.data,disabled:mt.disabled}:null,pt={active:ft,activatorEvent:bt,collisions:Rt,delta:{x:Et.x,y:Et.y},over:Gt};Ti.unstable_batchedUpdates(()=>{St(Gt),Nt==null||Nt(pt),A({type:"onDragOver",event:pt})})},[Pe]),gs(()=>{le.current={activatorEvent:ee,active:ke,activeNode:X,collisionRect:xt,collisions:Z,droppableRects:de,draggableNodes:O,draggingNode:et,draggingNodeRect:He,droppableContainers:J,over:qe,scrollableAncestors:at,scrollAdjustedTranslate:yt},me.current={initial:He,translated:xt}},[ke,X,Z,xt,O,et,He,de,J,qe,at,yt]),ib({...xe,delta:Q,draggingRect:xt,pointerCoordinates:G,scrollableAncestors:at,scrollableAncestorRects:kt});const fn=y.useMemo(()=>({active:ke,activeNode:X,activeNodeRect:Ce,activatorEvent:ee,collisions:Z,containerNodeRect:ge,dragOverlay:Ee,draggableNodes:O,droppableContainers:J,droppableRects:de,over:qe,measureDroppableContainers:U,scrollableAncestors:at,scrollableAncestorRects:kt,measuringConfiguration:M,measuringScheduled:ue,windowRect:Xe}),[ke,X,Ce,ee,Z,ge,Ee,O,J,de,qe,U,at,kt,M,ue,Xe]),Wt=y.useMemo(()=>({activatorEvent:ee,activators:wn,active:ke,activeNodeRect:Ce,ariaDescribedById:{draggable:K},dispatch:b,draggableNodes:O,over:qe,measureDroppableContainers:U}),[ee,wn,ke,Ce,b,K,O,qe,U]);return vt.createElement(ry.Provider,{value:P},vt.createElement(Yi.Provider,{value:Wt},vt.createElement(Sy.Provider,{value:fn},vt.createElement(lc.Provider,{value:xn},m)),vt.createElement(jb,{disabled:(f==null?void 0:f.restoreFocus)===!1})),vt.createElement(AS,{...f,hiddenTextDescribedById:K}));function _n(){const ft=(Te==null?void 0:Te.autoScrollEnabled)===!1,bt=typeof h=="object"?h.enabled===!1:h===!1,Rt=q&&!ft&&!bt;return typeof h=="object"?{...h,enabled:Rt}:{enabled:Rt}}}),Rb=y.createContext(null),Xm="button",Ab="Draggable";function Ib(e){let{id:n,data:r,disabled:o=!1,attributes:l}=e;const c=Xi(Ab),{activators:d,activatorEvent:f,active:h,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=y.useContext(Yi),{role:S=Xm,roleDescription:j="draggable",tabIndex:N=0}=l??{},T=(h==null?void 0:h.id)===n,b=y.useContext(T?lc:Rb),[A,P]=Ml(),[L,z]=Ml(),q=xb(d,n),F=Fi(r);gs(()=>(k.set(n,{id:n,key:c,node:A,activatorNode:L,data:F}),()=>{const Q=k.get(n);Q&&Q.key===c&&k.delete(n)}),[k,n]);const O=y.useMemo(()=>({role:S,tabIndex:N,"aria-disabled":o,"aria-pressed":T&&S===Xm?!0:void 0,"aria-roledescription":j,"aria-describedby":v.draggable}),[o,S,N,T,j,v.draggable]);return{active:h,activatorEvent:f,activeNodeRect:m,attributes:O,isDragging:T,listeners:o?void 0:q,node:A,over:x,setNodeRef:P,setActivatorNodeRef:z,transform:b}}function Ty(){return y.useContext(Sy)}const Db="Droppable",Mb={timeout:25};function Cy(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:l}=e;const c=Xi(Db),{active:d,dispatch:f,over:h,measureDroppableContainers:m}=y.useContext(Yi),v=y.useRef({disabled:r}),k=y.useRef(!1),x=y.useRef(null),S=y.useRef(null),{disabled:j,updateMeasurementsFor:N,timeout:T}={...Mb,...l},b=Fi(N??o),A=y.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(b.current)?b.current:[b.current]),S.current=null},T)},[T]),P=ac({callback:A,disabled:j||!d}),L=y.useCallback((O,Q)=>{P&&(Q&&(P.unobserve(Q),k.current=!1),O&&P.observe(O))},[P]),[z,q]=Ml(L),F=Fi(n);return y.useEffect(()=>{!P||!z.current||(P.disconnect(),k.current=!1,P.observe(z.current))},[z,P]),y.useEffect(()=>(f({type:Zt.RegisterDroppable,element:{id:o,key:c,disabled:r,node:z,rect:x,data:F}}),()=>f({type:Zt.UnregisterDroppable,key:c,id:o})),[o]),y.useEffect(()=>{r!==v.current.disabled&&(f({type:Zt.SetDroppableDisabled,id:o,key:c,disabled:r}),v.current.disabled=r)},[o,c,r,f]),{active:d,rect:x,isOver:(h==null?void 0:h.id)===o,node:z,over:h,setNodeRef:q}}function Lb(e){let{animation:n,children:r}=e;const[o,l]=y.useState(null),[c,d]=y.useState(null),f=Ll(r);return!r&&!o&&f&&l(f),gs(()=>{if(!c)return;const h=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(h==null||m==null){l(null);return}Promise.resolve(n(m,c)).then(()=>{l(null)})},[n,o,c]),vt.createElement(vt.Fragment,null,r,o?y.cloneElement(o,{ref:d}):null)}const Ob={x:0,y:0,scaleX:1,scaleY:1};function $b(e){let{children:n}=e;return vt.createElement(Yi.Provider,{value:ky},vt.createElement(lc.Provider,{value:Ob},n))}const Pb={position:"fixed",touchAction:"none"},zb=e=>oc(e)?"transform 250ms ease":void 0,Fb=y.forwardRef((e,n)=>{let{as:r,activatorEvent:o,adjustScale:l,children:c,className:d,rect:f,style:h,transform:m,transition:v=zb}=e;if(!f)return null;const k=l?m:{...m,scaleX:1,scaleY:1},x={...Pb,width:f.width,height:f.height,top:f.top,left:f.left,transform:_s.Transform.toString(k),transformOrigin:l&&o?DS(o,f):void 0,transition:typeof v=="function"?v(o):v,...h};return vt.createElement(r,{className:d,style:x,ref:n},c)}),Ub=e=>n=>{let{active:r,dragOverlay:o}=n;const l={},{styles:c,className:d}=e;if(c!=null&&c.active)for(const[f,h]of Object.entries(c.active))h!==void 0&&(l[f]=r.node.style.getPropertyValue(f),r.node.style.setProperty(f,h));if(c!=null&&c.dragOverlay)for(const[f,h]of Object.entries(c.dragOverlay))h!==void 0&&o.node.style.setProperty(f,h);return d!=null&&d.active&&r.node.classList.add(d.active),d!=null&&d.dragOverlay&&o.node.classList.add(d.dragOverlay),function(){for(const[h,m]of Object.entries(l))r.node.style.setProperty(h,m);d!=null&&d.active&&r.node.classList.remove(d.active)}},Bb=e=>{let{transform:{initial:n,final:r}}=e;return[{transform:_s.Transform.toString(n)},{transform:_s.Transform.toString(r)}]},Wb={duration:250,easing:"ease",keyframes:Bb,sideEffects:Ub({styles:{active:{opacity:"0"}}})};function Hb(e){let{config:n,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=e;return rc((c,d)=>{if(n===null)return;const f=r.get(c);if(!f)return;const h=f.node.current;if(!h)return;const m=wy(d);if(!m)return;const{transform:v}=En(d).getComputedStyle(d),k=cy(v);if(!k)return;const x=typeof n=="function"?n:Vb(n);return gy(h,l.draggable.measure),x({active:{id:c,data:f.data,node:h,rect:l.draggable.measure(h)},draggableNodes:r,dragOverlay:{node:d,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function Vb(e){const{duration:n,easing:r,sideEffects:o,keyframes:l}={...Wb,...e};return c=>{let{active:d,dragOverlay:f,transform:h,...m}=c;if(!n)return;const v={x:f.rect.left-d.rect.left,y:f.rect.top-d.rect.top},k={scaleX:h.scaleX!==1?d.rect.width*h.scaleX/f.rect.width:1,scaleY:h.scaleY!==1?d.rect.height*h.scaleY/f.rect.height:1},x={x:h.x-v.x,y:h.y-v.y,...k},S=l({...m,active:d,dragOverlay:f,transform:{initial:h,final:x}}),[j]=S,N=S[S.length-1];if(JSON.stringify(j)===JSON.stringify(N))return;const T=o==null?void 0:o({active:d,dragOverlay:f,...m}),b=f.node.animate(S,{duration:n,easing:r,fill:"forwards"});return new Promise(A=>{b.onfinish=()=>{T==null||T(),A()}})}}let Ym=0;function Kb(e){return y.useMemo(()=>{if(e!=null)return Ym++,Ym},[e])}const Gb=vt.memo(e=>{let{adjustScale:n=!1,children:r,dropAnimation:o,style:l,transition:c,modifiers:d,wrapperElement:f="div",className:h,zIndex:m=999}=e;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggableNodes:j,droppableContainers:N,dragOverlay:T,over:b,measuringConfiguration:A,scrollableAncestors:P,scrollableAncestorRects:L,windowRect:z}=Ty(),q=y.useContext(lc),F=Kb(k==null?void 0:k.id),O=by(d,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:S,draggingNodeRect:T.rect,over:b,overlayNodeRect:T.rect,scrollableAncestors:P,scrollableAncestorRects:L,transform:q,windowRect:z}),Q=pf(x),J=Hb({config:o,draggableNodes:j,droppableContainers:N,measuringConfiguration:A}),te=Q?T.setRef:void 0;return vt.createElement($b,null,vt.createElement(Lb,{animation:J},k&&F?vt.createElement(Fb,{key:F,id:k.id,ref:te,as:f,activatorEvent:v,adjustScale:n,className:h,transition:c,rect:Q,style:{zIndex:m,...l},transform:O},r):null))});function jy(e,n,r){const o=e.slice();return o.splice(r<0?o.length+r:r,0,o.splice(n,1)[0]),o}function qb(e,n){return e.reduce((r,o,l)=>{const c=n.get(o);return c&&(r[l]=c),r},Array(e.length))}function sl(e){return e!==null&&e>=0}function Xb(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==n[r])return!1;return!0}function Yb(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const rl={scaleX:1,scaleY:1},Qb=e=>{var n;let{rects:r,activeNodeRect:o,activeIndex:l,overIndex:c,index:d}=e;const f=(n=r[l])!=null?n:o;if(!f)return null;const h=Zb(r,d,l);if(d===l){const m=r[c];return m?{x:l<c?m.left+m.width-(f.left+f.width):m.left-f.left,y:0,...rl}:null}return d>l&&d<=c?{x:-f.width-h,y:0,...rl}:d<l&&d>=c?{x:f.width+h,y:0,...rl}:{x:0,y:0,...rl}};function Zb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return!o||!l&&!c?0:r<n?l?o.left-(l.left+l.width):c.left-(o.left+o.width):c?c.left-(o.left+o.width):o.left-(l.left+l.width)}const Ey=e=>{let{rects:n,activeIndex:r,overIndex:o,index:l}=e;const c=jy(n,o,r),d=n[l],f=c[l];return!f||!d?null:{x:f.left-d.left,y:f.top-d.top,scaleX:f.width/d.width,scaleY:f.height/d.height}},ol={scaleX:1,scaleY:1},Qm=e=>{var n;let{activeIndex:r,activeNodeRect:o,index:l,rects:c,overIndex:d}=e;const f=(n=c[r])!=null?n:o;if(!f)return null;if(l===r){const m=c[d];return m?{x:0,y:r<d?m.top+m.height-(f.top+f.height):m.top-f.top,...ol}:null}const h=Jb(c,l,r);return l>r&&l<=d?{x:0,y:-f.height-h,...ol}:l<r&&l>=d?{x:0,y:f.height+h,...ol}:{x:0,y:0,...ol}};function Jb(e,n,r){const o=e[n],l=e[n-1],c=e[n+1];return o?r<n?l?o.top-(l.top+l.height):c?c.top-(o.top+o.height):0:c?c.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const _y="Sortable",Ry=vt.createContext({activeIndex:-1,containerId:_y,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ey,disabled:{draggable:!1,droppable:!1}});function Ed(e){let{children:n,id:r,items:o,strategy:l=Ey,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:h,over:m,measureDroppableContainers:v}=Ty(),k=Xi(_y,r),x=f.rect!==null,S=y.useMemo(()=>o.map(q=>typeof q=="object"&&"id"in q?q.id:q),[o]),j=d!=null,N=d?S.indexOf(d.id):-1,T=m?S.indexOf(m.id):-1,b=y.useRef(S),A=!Xb(S,b.current),P=T!==-1&&N===-1||A,L=Yb(c);gs(()=>{A&&j&&v(S)},[A,S,j,v]),y.useEffect(()=>{b.current=S},[S]);const z=y.useMemo(()=>({activeIndex:N,containerId:k,disabled:L,disableTransforms:P,items:S,overIndex:T,useDragOverlay:x,sortedRects:qb(S,h),strategy:l}),[N,k,L.draggable,L.droppable,P,S,T,h,x,l]);return vt.createElement(Ry.Provider,{value:z},n)}const eN=e=>{let{id:n,items:r,activeIndex:o,overIndex:l}=e;return jy(r,o,l).indexOf(n)},tN=e=>{let{containerId:n,isSorting:r,wasDragging:o,index:l,items:c,newIndex:d,previousItems:f,previousContainerId:h,transition:m}=e;return!m||!o||f!==c&&l===d?!1:r?!0:d!==l&&n===h},nN={duration:200,easing:"ease"},Ay="transform",sN=_s.Transition.toString({property:Ay,duration:0,easing:"linear"}),rN={roleDescription:"sortable"};function oN(e){let{disabled:n,index:r,node:o,rect:l}=e;const[c,d]=y.useState(null),f=y.useRef(r);return gs(()=>{if(!n&&r!==f.current&&o.current){const h=l.current;if(h){const m=$o(o.current,{ignoreTransform:!0}),v={x:h.left-m.left,y:h.top-m.top,scaleX:h.width/m.width,scaleY:h.height/m.height};(v.x||v.y)&&d(v)}}r!==f.current&&(f.current=r)},[n,r,o,l]),y.useEffect(()=>{c&&d(null)},[c]),c}function hf(e){let{animateLayoutChanges:n=tN,attributes:r,disabled:o,data:l,getNewIndex:c=eN,id:d,strategy:f,resizeObserverConfig:h,transition:m=nN}=e;const{items:v,containerId:k,activeIndex:x,disabled:S,disableTransforms:j,sortedRects:N,overIndex:T,useDragOverlay:b,strategy:A}=y.useContext(Ry),P=iN(o,S),L=v.indexOf(d),z=y.useMemo(()=>({sortable:{containerId:k,index:L,items:v},...l}),[k,l,L,v]),q=y.useMemo(()=>v.slice(v.indexOf(d)),[v,d]),{rect:F,node:O,isOver:Q,setNodeRef:J}=Cy({id:d,data:z,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:q,...h}}),{active:te,activatorEvent:me,activeNodeRect:ke,attributes:Le,setNodeRef:Te,listeners:oe,isDragging:ee,over:Y,setActivatorNodeRef:ae,transform:K}=Ib({id:d,data:z,attributes:{...rN,...r},disabled:P.draggable}),E=yS(J,Te),M=!!te,de=M&&!j&&sl(x)&&sl(T),U=!b&&ee,ue=U&&de?K:null,ve=de?ue??(f??A)({rects:N,activeNodeRect:ke,activeIndex:x,overIndex:T,index:L}):null,xe=sl(x)&&sl(T)?c({id:d,items:v,activeIndex:x,overIndex:T}):L,Ae=te==null?void 0:te.id,Ce=y.useRef({activeId:Ae,items:v,newIndex:xe,containerId:k}),ge=v!==Ce.current.items,le=n({active:te,containerId:k,isDragging:ee,isSorting:M,id:d,index:L,items:v,newIndex:Ce.current.newIndex,previousItems:Ce.current.items,previousContainerId:Ce.current.containerId,transition:m,wasDragging:Ce.current.activeId!=null}),Qe=oN({disabled:!le,index:L,node:O,rect:F});return y.useEffect(()=>{M&&Ce.current.newIndex!==xe&&(Ce.current.newIndex=xe),k!==Ce.current.containerId&&(Ce.current.containerId=k),v!==Ce.current.items&&(Ce.current.items=v)},[M,xe,k,v]),y.useEffect(()=>{if(Ae===Ce.current.activeId)return;if(Ae!=null&&Ce.current.activeId==null){Ce.current.activeId=Ae;return}const et=setTimeout(()=>{Ce.current.activeId=Ae},50);return()=>clearTimeout(et)},[Ae]),{active:te,activeIndex:x,attributes:Le,data:z,rect:F,index:L,newIndex:xe,items:v,isOver:Q,isSorting:M,isDragging:ee,listeners:oe,node:O,overIndex:T,over:Y,setNodeRef:E,setActivatorNodeRef:ae,setDroppableNodeRef:J,setDraggableNodeRef:Te,transform:Qe??ve,transition:Ee()};function Ee(){if(Qe||ge&&Ce.current.newIndex===L)return sN;if(!(U&&!oc(me)||!m)&&(M||le))return _s.Transition.toString({...m,property:Ay})}}function iN(e,n){var r,o;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:n.draggable,droppable:(o=e==null?void 0:e.droppable)!=null?o:n.droppable}}ct.Down,ct.Right,ct.Up,ct.Left;function il(e){const[n,r]=y.useState(()=>{try{const l=localStorage.getItem(e);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}}),o=y.useCallback(l=>{r(c=>{const d=l(new Set(c));try{localStorage.setItem(e,JSON.stringify([...d]))}catch{}return d})},[e]);return[n,o]}function aN(e,n=!1){const[r,o]=y.useState(()=>{try{const c=localStorage.getItem(e);return c==="1"?!0:c==="0"?!1:n}catch{return n}}),l=y.useCallback(c=>{o(c);try{localStorage.setItem(e,c?"1":"0")}catch{}},[e]);return[r,l]}async function Bi(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const n=document.createElement("textarea");n.value=e,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 lN(e){return e.origin_app_id!=null&&!e.user_touched&&!e.starred}const _d="(no directory)";function gr(e){return e.replaceAll("\\","/").replace(/\/+$/,"")}function Rd(e,n){if(!n||!e.cwd)return!1;const r=gr(e.cwd),o=gr(n);return r.startsWith(`${o}/`)}function cN(e,n){const r=new Map;for(const d of n){const f=d.cwd||_d,h=r.get(f)??[];h.push(d),r.set(f,h)}const o=new Set,l=new Set(e.filter(d=>d.deleted===1).map(d=>d.path)),c=[];for(const d of e){if(d.deleted===1){o.add(d.path);continue}o.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,f]of r)o.has(d)||l.has(d)||c.push({path:d,label:d===_d?"Other":d.split("/").pop()||d,sessions:f,workspace:null});return c}function uN(e,n,r){if(n.length===0)return!1;const o=new Set(e.filter(l=>l.deleted===1).map(l=>l.path));return n.some(l=>!Rd(l,r)&&!o.has(l.cwd||_d))}function Fl(e){return[...e].sort((n,r)=>r.sort_order-n.sort_order||(n.created_at<r.created_at?1:-1))}function Zm(e,n,r,o){const l=n.map(c=>({folder:c,sessions:e.sessions.filter(d=>d.folder_id===c.id),finishedKey:`folder:${c.id}:finished`,hidden:o.has(c.id)}));return l.push({folder:null,sessions:e.sessions.filter(c=>!(c.folder_id&&r.has(c.folder_id))),finishedKey:`${e.path}:finished`,hidden:!1}),l}function Jm(e,n){return{working:Fl(e.sessions.filter(r=>r.lifecycle!=="finished")),finished:Fl(e.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:n.has(e.finishedKey)}}function al(e,n){return e.folder_id&&n.has(e.folder_id)?e.folder_id:null}function dN(e){const n=new Set(e.map(o=>o.name));if(!n.has("New Folder"))return"New Folder";let r=2;for(;n.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function eg({id:e,children:n,className:r}){const{setNodeRef:o,isOver:l}=Cy({id:e});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:n})}function mf({inputRef:e,value:n,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:e,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"&&o(),c.key==="Escape"&&l()},onBlur:o})}function fN({s:e,backgroundTaskCount:n,isActive:r,isSelected:o,originApp:l,renaming:c,renameValue:d,renameRef:f,onRenameValue:h,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:S}){const{attributes:j,listeners:N,setNodeRef:T,transform:b,transition:A,isDragging:P}=hf({id:`s:${e.id}`}),L=Jl(e,n);return a.jsxs("div",{ref:T,style:{transform:_s.Transform.toString(b),transition:A},className:`tree-item ${r?"active":""}${o?" selected":""} ${L.isFinished?"tree-item-finished":""}${P?" dragging":""}${e.starred?" tree-item-starred":""}`,...j,...N,onClick:k,onContextMenu:x,children:[a.jsx(rf,{iconClass:L.iconClass,iconText:L.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(Mo,{iconNode:l.iconNode,size:10})}),c?a.jsx(mf,{inputRef:f,value:d,onChange:h,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:e.title||e.id.slice(0,8)}),!c&&a.jsx("button",{className:`star-btn${e.starred?" starred":""}`,title:e.starred?"Unstar session":"Star session",onClick:z=>{z.stopPropagation(),S()},onPointerDown:z=>z.stopPropagation(),children:a.jsx(Dl,{size:10,fill:e.starred?"currentColor":"none"})}),L.dot&&a.jsx(sf,{status:L.dot,title:L.dotTitle})]})}function pN({folder:e,count:n,collapsed:r,renaming:o,renameValue:l,renameRef:c,onRenameValue:d,onRenameConfirm:f,onRenameCancel:h,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:S,setNodeRef:j,transform:N,transition:T,isDragging:b,over:A}=hf({id:`f:${e.id}`}),P=A!=null&&String(A.id).startsWith("s:");return a.jsxs("div",{ref:j,style:{transform:_s.Transform.toString(N),transition:T},className:`tree-folder ${r?"collapsed":""}${b?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${P?" drop-over":""}`,...x,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(mf,{inputRef:c,value:l,onChange:d,onConfirm:f,onCancel:h}):a.jsxs(a.Fragment,{children:[a.jsx(Ro,{size:8,className:"tree-chevron"}),a.jsx(Il,{size:12}),a.jsx("span",{className:"tree-folder-label",children:e.name}),a.jsx("span",{className:"tree-count",children:n})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function hN(){const e=R(I=>I.sessions),n=R(I=>I.backgroundTasks),r=R(I=>I.workspaces),o=R(I=>I.folders),l=R(I=>I.activeSessionId),c=R(I=>I.selectSession),d=R(I=>I.deleteSession),f=R(I=>I.removeWorkspace),h=R(I=>I.createSessionInWorkspace),m=R(I=>I.pickAndAddWorkspace),v=R(I=>I.setImportSessionsWorkspace),k=R(I=>I.renameSession),x=R(I=>I.markFinished),S=R(I=>I.markFinishedMany),j=R(I=>I.toggleStar),N=R(I=>I.reopenSession),T=R(I=>I.reopenSessionMany),b=R(I=>I.deleteSessionMany),A=R(I=>I.createSidebarFolder),P=R(I=>I.renameFolder),L=R(I=>I.deleteFolder),z=R(I=>I.applyMoves),q=R(I=>I.reorderFolders),F=R(I=>I.apps),O=R(I=>I.appsRootPath),Q=R(I=>I.activeAppTabId),J=R(I=>I.openAppTab),te=R(I=>I.startAppEdit),me=R(I=>I.toggleAppPin),ke=R(I=>I.deleteApp),Le=R(I=>I.openAppExport),Te=R(I=>I.openAppCatalog),[oe,ee]=il("agentpane:sidebar-ws-collapsed"),[Y,ae]=il("agentpane:sidebar-sub-collapsed"),[K,E]=il("agentpane:sidebar-folders-collapsed"),[M,de]=il("agentpane:sidebar-app-edits-collapsed"),[U,ue]=aN("agentpane:sidebar-hide-auto-sessions"),[X,ve]=y.useState(null),[xe,Ae]=y.useState(null),[Ce,ge]=y.useState(""),[le,Qe]=y.useState(null),[Ee,et]=y.useState(new Set),[He,Se]=y.useState(null),Be=y.useRef(null),Xe=y.useRef(null),at=y.useRef(null),kt=y.useRef(!1),Ot=iy(oy(ic,{activationConstraint:{distance:5}}));function G(){et(new Set),Se(null)}Vi(Be,()=>ve(null),!!X),Do(()=>{ve(null),G()},!!X||Ee.size>0),y.useLayoutEffect(()=>{const I=Be.current;if(!X||!I)return;const he=8,{offsetWidth:ce,offsetHeight:be}=I,We=X.x+ce>window.innerWidth-he?Math.max(he,X.x-ce):X.x,tt=X.y+be>window.innerHeight-he?Math.max(he,X.y-be):X.y;I.style.left=`${We}px`,I.style.top=`${tt}px`},[X]);const we=y.useMemo(()=>new Map(e.map(I=>[I.id,I])),[e]),ze=y.useMemo(()=>new Map(o.map(I=>[I.id,I])),[o]),Ye=y.useMemo(()=>{const I=new Map;for(const he of[...o].sort((ce,be)=>ce.sort_order-be.sort_order)){const ce=I.get(he.workspace_path)??[];ce.push(he),I.set(he.workspace_path,ce)}return I},[o]);function yt(I){ee(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}function xt(I){ae(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}function Z(I){E(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}function Pe(){ue(!U),G()}function qe(I){de(he=>{const ce=new Set(he);return ce.has(I)?ce.delete(I):ce.add(I),ce})}y.useEffect(()=>{xe&&Xe.current&&(Xe.current.focus(),Xe.current.select())},[xe]),y.useEffect(()=>{var I,he,ce;kt.current||!l||(kt.current=!0,(ce=(he=(I=at.current)==null?void 0:I.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:he.scrollIntoView)==null||ce.call(he,{block:"nearest"}))},[l]);function St(I,he,ce,be=""){Ae({kind:I,id:he}),ge(ce||be)}function yn(){if(xe){const I=Ce.trim();I&&(xe.kind==="session"?k(xe.id,I):P(xe.id,I))}Ae(null)}function xn(){Ae(null),ge("")}async function ns(I){const he=dN(Ye.get(I)??[]),ce=await A(I,he);ce&&St("folder",ce.id,ce.name)}function ss(I){const he=String(I.active.id);if(he.startsWith("s:")){const ce=we.get(he.slice(2));ce&&Qe({kind:"session",label:ce.title||ce.id.slice(0,8)})}else if(he.startsWith("f:")){const ce=ze.get(he.slice(2));ce&&Qe({kind:"folder",label:ce.name})}}function rs(I){Qe(null);const{active:he,over:ce}=I;if(!ce)return;const be=String(he.id),We=String(ce.id);if(be.startsWith("s:")){const tt=we.get(be.slice(2));if(!tt)return;const Ve=tt.cwd||"(no directory)",qt=al(tt,ze);let Ke,Xt;if(We.startsWith("f:")){const lt=ze.get(We.slice(2));if(!lt)return;Ke=lt.workspace_path,Xt=lt.id}else if(We.startsWith("s:")){const lt=we.get(We.slice(2));if(!lt)return;Ke=lt.cwd||"(no directory)",Xt=al(lt,ze)}else if(We.startsWith("c:")){const lt=We.slice(2),zt=lt.lastIndexOf("|");Ke=lt.slice(0,zt);const ks=lt.slice(zt+1);Xt=ks==="root"?null:ks}else return;if(Ke!==Ve)return;const ys=Fl(e.filter(lt=>(lt.cwd||"(no directory)")===Ke&&al(lt,ze)===Xt)),Rs=ys.filter(lt=>lt.id!==tt.id);let xs=Rs.length;if(We.startsWith("s:")){const lt=Rs.findIndex(zt=>zt.id===We.slice(2));lt>=0&&(xs=lt)}const Kn=[...Rs.slice(0,xs),tt,...Rs.slice(xs)],ws=[];if(Xt===qt){if(Kn.length===ys.length&&Kn.every((lt,zt)=>lt.id===ys[zt].id))return;Kn.forEach((lt,zt)=>ws.push({id:lt.id,folder_id:Xt,sort_order:Kn.length-1-zt}))}else{const lt=Fl(e.filter(zt=>(zt.cwd||"(no directory)")===Ve&&al(zt,ze)===qt)).filter(zt=>zt.id!==tt.id);lt.forEach((zt,ks)=>ws.push({id:zt.id,folder_id:qt,sort_order:lt.length-1-ks})),Kn.forEach((zt,ks)=>ws.push({id:zt.id,folder_id:Xt,sort_order:Kn.length-1-ks}))}z(ws);return}if(be.startsWith("f:")){if(!We.startsWith("f:"))return;const tt=ze.get(be.slice(2)),Ve=ze.get(We.slice(2));if(!tt||!Ve||tt.id===Ve.id||tt.workspace_path!==Ve.workspace_path)return;const qt=(Ye.get(tt.workspace_path)??[]).map(ys=>ys.id),Ke=qt.indexOf(tt.id),Xt=qt.indexOf(Ve.id);qt.splice(Xt,0,...qt.splice(Ke,1)),q(qt)}}const wn=O?e.filter(I=>!Rd(I,O)):e,fn=new Set(U?wn.filter(I=>lN(I)&&I.id!==l).map(I=>I.id):[]),Wt=cN(r,fn.size>0?wn.filter(I=>!fn.has(I.id)):wn),_n=y.useMemo(()=>{const I=new Map;if(!O)return I;const he=gr(O);for(const ce of e){if(!Rd(ce,O))continue;const be=gr(ce.cwd).slice(he.length+1).split("/")[0],We=I.get(be)??[];We.push(ce),I.set(be,We)}return I},[e,O]);function ft(I){return{folder:null,sessions:_n.get(I)??[],finishedKey:`app:${I}:finished`,hidden:M.has(I)}}const bt=[],Rt=I=>{if(I.hidden)return;const{working:he,finished:ce,finishedCollapsed:be}=Jm(I,Y);bt.push(...he.map(We=>We.id)),be||bt.push(...ce.map(We=>We.id))};for(const I of Wt){if(oe.has(I.path))continue;const he=Ye.get(I.path)??[],ce=new Set(he.map(be=>be.id));Zm(I,he,ce,K).forEach(Rt)}F.forEach(I=>Rt(ft(I.id)));const Kt=e.filter(I=>Ee.has(I.id)),Et=Kt.filter(I=>I.lifecycle!=="finished").map(I=>I.id),Nt=Kt.filter(I=>I.lifecycle==="finished").map(I=>I.id);function mt(I,he){if(he.metaKey||he.ctrlKey){he.preventDefault(),Se(I.id),et(ce=>{const be=new Set(ce);return be.has(I.id)?be.delete(I.id):be.add(I.id),be});return}if(he.shiftKey){he.preventDefault();const ce=He??I.id;Se(ce);const be=bt.indexOf(ce),We=bt.indexOf(I.id);if(be>=0&&We>=0){const[tt,Ve]=be<We?[be,We]:[We,be];et(new Set(bt.slice(tt,Ve+1)))}return}G(),Se(I.id),c(I.id)}function Gt(I,he){he.preventDefault();const ce=Ee.has(I.id)&&Ee.size>1;Ee.has(I.id)||(et(new Set),Se(I.id)),ve({x:he.clientX,y:he.clientY,type:"session",sessionId:I.id,sessionTitle:I.title,sessionLifecycle:I.lifecycle,sessionExternalId:I.external_thread_id,multi:ce})}function pt(I){var ce;const he=I.origin_app_id?F.find(be=>be.id===I.origin_app_id):null;return a.jsx(fN,{s:I,backgroundTaskCount:((ce=n[I.id])==null?void 0:ce.length)??0,isActive:l===I.id,isSelected:Ee.has(I.id),originApp:he??null,renaming:(xe==null?void 0:xe.kind)==="session"&&xe.id===I.id,renameValue:Ce,renameRef:Xe,onRenameValue:ge,onRenameConfirm:yn,onRenameCancel:xn,onSelect:be=>mt(I,be),onToggleStar:()=>j(I.id),onCtxMenu:be=>Gt(I,be)},I.id)}function Jt(I){var ce;const he=Jl(I,((ce=n[I.id])==null?void 0:ce.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===I.id?" active":""}${Ee.has(I.id)?" selected":""}${he.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:be=>mt(I,be),onContextMenu:be=>Gt(I,be),children:[a.jsx(rf,{iconClass:he.iconClass,iconText:he.iconText,size:14}),(xe==null?void 0:xe.kind)==="session"&&xe.id===I.id?a.jsx(mf,{inputRef:Xe,value:Ce,onChange:ge,onConfirm:yn,onCancel:xn}):a.jsx("span",{className:"tree-label",children:I.title||I.id.slice(0,8)}),he.dot&&a.jsx(sf,{status:he.dot,title:he.dotTitle})]},I.id)}function $t(I,he="workspace"){const{working:ce,finished:be,finishedCollapsed:We}=Jm(I,Y),tt=he==="workspace"?pt:Jt,Ve=a.jsxs(a.Fragment,{children:[ce.length===0&&be.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ce.map(tt),be.length>0&&a.jsxs("div",{className:`tree-subgroup ${We?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>xt(I.finishedKey),children:[a.jsx(Ro,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:be.length})]}),!We&&a.jsx("div",{className:"tree-subgroup-items",children:be.map(tt)})]})]});if(he==="app")return Ve;const qt=[...ce,...be].map(Ke=>`s:${Ke.id}`);return a.jsx(Ed,{items:qt,strategy:Qm,children:Ve})}return a.jsxs("div",{className:"ide-sidebar",ref:at,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${U?" active":""}`,title:U?`Show automatic sessions (${fn.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":U?"Show automatic sessions":"Hide automatic sessions","aria-pressed":U,onClick:Pe,children:U?a.jsx(D1,{size:14}):a.jsx(vr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(hr,{size:14})})]})]}),a.jsxs(Ny,{sensors:Ot,collisionDetection:ay,onDragStart:ss,onDragEnd:rs,children:[Wt.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):Wt.map(I=>{const he=oe.has(I.path),ce=Ye.get(I.path)??[],be=new Set(ce.map(Ve=>Ve.id)),We=Zm(I,ce,be,K),tt=We[We.length-1];return a.jsxs("div",{className:`tree-section ${he?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>yt(I.path),onContextMenu:Ve=>{Ve.preventDefault(),ve({x:Ve.clientX,y:Ve.clientY,type:"workspace",path:I.path})},children:[a.jsx(Ro,{size:9,className:"tree-chevron"}),a.jsx(Il,{size:14}),a.jsx("span",{className:"tree-section-label",children:I.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Ve=>{Ve.stopPropagation(),h(I.path)},children:a.jsx(hr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Ve=>{Ve.stopPropagation(),ns(I.path)},children:a.jsx(sd,{size:11})}),a.jsx("span",{className:"tree-count",children:I.sessions.length})]}),!he&&a.jsxs("div",{className:"tree-children",children:[a.jsx(Ed,{items:ce.map(Ve=>`f:${Ve.id}`),strategy:Qm,children:We.filter(Ve=>Ve.folder).map(Ve=>a.jsx(pN,{folder:Ve.folder,count:Ve.sessions.length,collapsed:Ve.hidden,renaming:(xe==null?void 0:xe.kind)==="folder"&&xe.id===Ve.folder.id,renameValue:Ce,renameRef:Xe,onRenameValue:ge,onRenameConfirm:yn,onRenameCancel:xn,onToggle:()=>Z(Ve.folder.id),onCtxMenu:qt=>{qt.preventDefault(),ve({x:qt.clientX,y:qt.clientY,type:"folder",folderId:Ve.folder.id,folderName:Ve.folder.name})},children:a.jsx(eg,{id:`c:${I.path}|${Ve.folder.id}`,children:$t(Ve)})},Ve.folder.id))}),a.jsx(eg,{id:`c:${I.path}|root`,children:$t(tt)})]})]},I.path)}),a.jsx(Gb,{children:le&&a.jsxs("div",{className:"drag-overlay",children:[le.kind==="folder"&&a.jsx(Il,{size:12}),a.jsx("span",{children:le.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:()=>Te(),children:a.jsx(hr,{size:14})})]}),F.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),F.map(I=>{const he=ft(I.id),ce=he.sessions.length>0&&!he.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${Q===I.id?" active":""}`,title:I.description??void 0,onClick:()=>J(I.id),onContextMenu:be=>{be.preventDefault(),ve({x:be.clientX,y:be.clientY,type:"app",appId:I.id,appPinned:I.pinned})},children:[he.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ce?"":" closed"}`,title:"Edit sessions of this app",onClick:be=>{be.stopPropagation(),qe(I.id)},children:a.jsx(Ro,{size:10,className:"tree-chevron"})}),a.jsx(Mo,{iconNode:I.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:I.title}),he.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:he.sessions.length}),I.pinned&&a.jsx(Dl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ce&&a.jsx("div",{className:"sidebar-app-edits",children:$t(he,"app")})]},I.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(sd,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Be,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:()=>{h(X.path),ve(null)},children:[a.jsx(hr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ns(X.path),ve(null)},children:[a.jsx(sd,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),ve(null)},children:[a.jsx(Kv,{size:12})," Import Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.path),ve(null)},children:[a.jsx(fs,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{St("folder",X.folderId,X.folderName??""),ve(null)},children:[a.jsx(gl,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{L(X.folderId),ve(null)},children:[a.jsx(fs,{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:()=>{St("session",X.sessionId,X.sessionTitle??""),ve(null)},children:[a.jsx(gl,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(X.sessionId),ve(null)},children:[a.jsx(Al,{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&&(Bi(X.sessionExternalId),ve(null))},children:[a.jsx(Pi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ve(null)},children:[a.jsx(fs,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{N(X.sessionId),ve(null)},children:[a.jsx(zi,{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&&(Bi(X.sessionExternalId),ve(null))},children:[a.jsx(Pi,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{d(X.sessionId),ve(null)},children:[a.jsx(fs,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[Kt.length," sessions selected"]}),Et.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Et),ve(null),G()},children:[a.jsx(Al,{size:12})," Mark ",Et.length," as Finished"]}),Nt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(Nt),ve(null),G()},children:[a.jsx(zi,{size:12})," Reopen ",Nt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{b([...Ee]),ve(null),G()},children:[a.jsx(fs,{size:12})," Delete ",Kt.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{te(X.appId),ve(null)},children:[a.jsx(gl,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{me(X.appId),ve(null)},children:[a.jsx(Dl,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Le(X.appId),ve(null)},children:[a.jsx(of,{size:12})," Export App…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{ke(X.appId),ve(null)},children:[a.jsx(fs,{size:12})," Delete App"]})]})]})]})}const ll=4,mN=({transform:e})=>({...e,y:0});function tg({tabKey:e,title:n,active:r,icon:o,badge:l,onSelect:c,onClose:d,onMenu:f}){const{attributes:h,listeners:m,setNodeRef:v,transform:k,transition:x,isDragging:S}=hf({id:e});return a.jsxs("div",{ref:v,style:{transform:_s.Translate.toString(k),transition:x},className:`ide-tab ${r?"active":""} ${S?"dragging":""}`,title:n,...h,...m,onClick:c,onMouseDown:j=>{j.button===1&&j.preventDefault()},onAuxClick:j=>{j.button===1&&d()},onContextMenu:j=>{j.preventDefault(),j.stopPropagation(),f(j.clientX,j.clientY)},children:[o,n,l,a.jsx("span",{className:"ide-tab-close",onClick:j=>{j.stopPropagation(),d()},children:a.jsx(jn,{size:12})})]})}function gN({menu:e,tabs:n,onDone:r}){const o=R(k=>k.closeTabs),l=R(k=>k.reopenClosedTab),c=R(k=>k.closedTabs.some(x=>bv(k,x.key))),d=y.useRef(null),[f,h]=y.useState({left:e.x,top:e.y});Vi(d,r,!0),Do(r,!0),y.useLayoutEffect(()=>{if(!d.current)return;const{width:k,height:x}=d.current.getBoundingClientRect();h({left:Math.max(ll,Math.min(e.x,window.innerWidth-k-ll)),top:Math.max(ll,Math.min(e.y,window.innerHeight-x-ll))})},[e.x,e.y]);const m=e.key!==null&&n.includes(e.key)?e.key:null,v=(k,x,S=!1)=>a.jsx("div",{role:"menuitem","aria-disabled":S,className:`ctx-menu-item ${S?"ctx-disabled":""}`,onClick:()=>{S||(x(),r())},children:k});return a.jsxs("div",{ref:d,role:"menu",className:"ctx-menu",style:{position:"fixed",...f,zIndex:500},children:[m!==null&&a.jsxs(a.Fragment,{children:[v("Close",()=>o([m])),v("Close Others",()=>o(n.filter(k=>k!==m)),n.length<2),v("Close to the Right",()=>o(n.slice(n.indexOf(m)+1)),n.at(-1)===m),v("Close All",()=>o(n))]}),v("Reopen Closed Tab",l,!c)]})}function vN(){const e=R(z=>z.tabOrder),n=R(z=>z.activeSessionId),r=R(z=>z.sessions),o=R(z=>z.backgroundTasks),l=R(z=>z.selectSession),c=R(z=>z.closeTab),d=R(z=>z.setShowNewSessionDialog),f=R(z=>z.apps),h=R(z=>z.activeAppTabId),m=R(z=>z.openAppTab),v=R(z=>z.closeAppTab),k=R(z=>z.moveTab),[x,S]=y.useState(null),j=y.useRef(null),N=iy(oy(ic,{activationConstraint:{distance:5}})),T=Gd({activeSessionId:n,activeAppTabId:h});y.useEffect(()=>{var z,q,F;(F=(q=(z=j.current)==null?void 0:z.querySelector(".ide-tab.active"))==null?void 0:q.scrollIntoView)==null||F.call(q,{block:"nearest",inline:"nearest"})},[T]);const b=e.filter(z=>{const{kind:q,id:F}=mr(z);return q==="app"||r.some(O=>O.id===F)}),A=({active:z,over:q})=>{q&&k(String(z.id),String(q.id))},P=z=>{z.preventDefault(),S({x:z.clientX,y:z.clientY,key:null})},L=z=>{var te;const{kind:q,id:F}=mr(z),O=(me,ke)=>S({x:me,y:ke,key:z});if(q==="app"){const me=f.find(ke=>ke.id===F);return a.jsx(tg,{tabKey:z,title:(me==null?void 0:me.title)??F,active:h===F,icon:a.jsx(Mo,{iconNode:me==null?void 0:me.iconNode,size:12,className:"miniapp-tab-icon"}),onSelect:()=>m(F),onClose:()=>v(F),onMenu:O},z)}const Q=r.find(me=>me.id===F);if(!Q)return null;const J=Jl(Q,((te=o[F])==null?void 0:te.length)??0);return a.jsx(tg,{tabKey:z,title:Q.title||F.slice(0,8),active:n===F&&h==null,icon:a.jsx(rf,{iconClass:J.iconClass,iconText:J.iconText,size:14}),badge:J.dot&&a.jsx(sf,{status:J.dot,title:J.dotTitle}),onSelect:()=>void l(F),onClose:()=>c(F),onMenu:O},z)};return a.jsxs(Ny,{sensors:N,collisionDetection:ay,modifiers:[mN],onDragEnd:A,children:[a.jsx(Ed,{items:b,strategy:Qb,children:a.jsxs("div",{ref:j,className:"ide-tabs",onContextMenu:P,onWheel:z=>{z.deltaX===0&&(z.currentTarget.scrollLeft+=z.deltaY)},children:[b.map(L),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>d(!0),children:a.jsx(hr,{size:14})})]})}),x&&a.jsx(gN,{menu:x,tabs:b,onDone:()=>S(null)})]})}function gf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Wr=gf();function Iy(e){Wr=e}var Ii={exec:()=>null};function dt(e,n=""){let r=typeof e=="string"?e:e.source;const o={replace:(l,c)=>{let d=typeof c=="string"?c:c.source;return d=d.replace(Cn.caret,"$1"),r=r.replace(l,d),o},getRegex:()=>new RegExp(r,n)};return o}var Cn={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:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},yN=/^(?:[ \t]*(?:\n|$))+/,xN=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wN=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,kN=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,vf=/(?:[*+-]|\d{1,9}[.)])/,Dy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,My=dt(Dy).replace(/bull/g,vf).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(),SN=dt(Dy).replace(/bull/g,vf).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(),yf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bN=/^[^\n]+/,xf=/(?!\s*\])(?:\\.|[^\[\]\\])+/,NN=dt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xf).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),TN=dt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,vf).getRegex(),cc="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",wf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,CN=dt("^ {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",wf).replace("tag",cc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ly=dt(yf).replace("hr",Qi).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",cc).getRegex(),jN=dt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ly).getRegex(),kf={blockquote:jN,code:xN,def:NN,fences:wN,heading:kN,hr:Qi,html:CN,lheading:My,list:TN,newline:yN,paragraph:Ly,table:Ii,text:bN},ng=dt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qi).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",cc).getRegex(),EN={...kf,lheading:SN,table:ng,paragraph:dt(yf).replace("hr",Qi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ng).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",cc).getRegex()},_N={...kf,html:dt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wf).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:Ii,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:dt(yf).replace("hr",Qi).replace("heading",` *#{1,6} *[^
468
+ ]`).replace("lheading",My).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},RN=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,AN=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Oy=/^( {2,}|\\)\n(?!\s*$)/,IN=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,uc=/[\p{P}\p{S}]/u,Sf=/[\s\p{P}\p{S}]/u,$y=/[^\s\p{P}\p{S}]/u,DN=dt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Sf).getRegex(),Py=/(?!~)[\p{P}\p{S}]/u,MN=/(?!~)[\s\p{P}\p{S}]/u,LN=/(?:[^\s\p{P}\p{S}]|~)/u,ON=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,zy=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,$N=dt(zy,"u").replace(/punct/g,uc).getRegex(),PN=dt(zy,"u").replace(/punct/g,Py).getRegex(),Fy="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",zN=dt(Fy,"gu").replace(/notPunctSpace/g,$y).replace(/punctSpace/g,Sf).replace(/punct/g,uc).getRegex(),FN=dt(Fy,"gu").replace(/notPunctSpace/g,LN).replace(/punctSpace/g,MN).replace(/punct/g,Py).getRegex(),UN=dt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,$y).replace(/punctSpace/g,Sf).replace(/punct/g,uc).getRegex(),BN=dt(/\\(punct)/,"gu").replace(/punct/g,uc).getRegex(),WN=dt(/^<(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(),HN=dt(wf).replace("(?:-->|$)","-->").getRegex(),VN=dt("^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",HN).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ul=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,KN=dt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ul).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Uy=dt(/^!?\[(label)\]\[(ref)\]/).replace("label",Ul).replace("ref",xf).getRegex(),By=dt(/^!?\[(ref)\](?:\[\])?/).replace("ref",xf).getRegex(),GN=dt("reflink|nolink(?!\\()","g").replace("reflink",Uy).replace("nolink",By).getRegex(),bf={_backpedal:Ii,anyPunctuation:BN,autolink:WN,blockSkip:ON,br:Oy,code:AN,del:Ii,emStrongLDelim:$N,emStrongRDelimAst:zN,emStrongRDelimUnd:UN,escape:RN,link:KN,nolink:By,punctuation:DN,reflink:Uy,reflinkSearch:GN,tag:VN,text:IN,url:Ii},qN={...bf,link:dt(/^!?\[(label)\]\((.*?)\)/).replace("label",Ul).getRegex(),reflink:dt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ul).getRegex()},Ad={...bf,emStrongRDelimAst:FN,emStrongLDelim:PN,url:dt(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},XN={...Ad,br:dt(Oy).replace("{2,}","*").getRegex(),text:dt(Ad.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},cl={normal:kf,gfm:EN,pedantic:_N},xi={normal:bf,gfm:Ad,breaks:XN,pedantic:qN},YN={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},sg=e=>YN[e];function Es(e,n){if(n){if(Cn.escapeTest.test(e))return e.replace(Cn.escapeReplace,sg)}else if(Cn.escapeTestNoEncode.test(e))return e.replace(Cn.escapeReplaceNoEncode,sg);return e}function rg(e){try{e=encodeURI(e).replace(Cn.percentDecode,"%")}catch{return null}return e}function og(e,n){var c;const r=e.replace(Cn.findPipe,(d,f,h)=>{let m=!1,v=f;for(;--v>=0&&h[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(Cn.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((c=o.at(-1))!=null&&c.trim())&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(Cn.slashPipe,"|");return o}function wi(e,n,r){const o=e.length;if(o===0)return"";let l=0;for(;l<o&&e.charAt(o-l-1)===n;)l++;return e.slice(0,o-l)}function QN(e,n){if(e.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===n[0])r++;else if(e[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function ig(e,n,r,o,l){const c=n.href,d=n.title||null,f=e[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:c,title:d,text:f,tokens:o.inlineTokens(f)};return o.state.inLink=!1,h}function ZN(e,n,r){const o=e.match(r.other.indentCodeCompensation);if(o===null)return n;const l=o[1];return n.split(`
469
469
  `).map(c=>{const d=c.match(r.other.beginningSpace);if(d===null)return c;const[f]=d;return f.length>=l.length?c.slice(l.length):c}).join(`
470
470
  `)}var Bl=class{constructor(e){ht(this,"options");ht(this,"rules");ht(this,"lexer");this.options=e||Wr}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:wi(r,`
471
- `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],o=XN(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:o}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const o=wi(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:wi(n[0],`
471
+ `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const r=n[0],o=ZN(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:o}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){const o=wi(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:wi(n[0],`
472
472
  `)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let r=wi(n[0],`
473
473
  `).split(`
474
474
  `),o="",l="";const c=[];for(;r.length>0;){let d=!1;const f=[];let h;for(h=0;h<r.length;h++)if(this.rules.other.blockquoteStart.test(r[h]))f.push(r[h]),d=!0;else if(!d)f.push(r[h]);else break;r=r.slice(h);const m=f.join(`
@@ -489,7 +489,7 @@ ${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
489
489
  `+x}!S&&!x.trim()&&(S=!0),m+=q+`
490
490
  `,e=e.substring(q.length+1),k=F.slice(j)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(d=!0));let N=null,T;this.options.gfm&&(N=this.rules.other.listIsTask.exec(v),N&&(T=N[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!N,checked:T,loose:!1,text:v,tokens:[]}),l.raw+=m}const f=l.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let h=0;h<l.items.length;h++)if(this.lexer.state.top=!1,l.items[h].tokens=this.lexer.blockTokens(l.items[h].text,[]),!l.loose){const m=l.items[h].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 h=0;h<l.items.length;h++)l.items[h].loose=!0;return l}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=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:o,title:l}}}table(e){var d;const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const r=og(n[1]),o=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=n[3])!=null&&d.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
491
491
  `):[],c={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const f of o)this.rules.other.tableAlignRight.test(f)?c.align.push("right"):this.rules.other.tableAlignCenter.test(f)?c.align.push("center"):this.rules.other.tableAlignLeft.test(f)?c.align.push("left"):c.align.push(null);for(let f=0;f<r.length;f++)c.header.push({text:r[f],tokens:this.lexer.inline(r[f]),header:!0,align:c.align[f]});for(const f of l)c.rows.push(og(f,c.header.length).map((h,m)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:c.align[m]})));return c}}lheading(e){const n=this.rules.block.lheading.exec(e);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(e){const n=this.rules.block.paragraph.exec(e);if(n){const r=n[1].charAt(n[1].length-1)===`
492
- `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);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(e){const n=this.rules.inline.link.exec(e);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=wi(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=qN(n[2],"()");if(c===-2)return;if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),ig(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[o.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return ig(r,l,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...o[0]].length-1;let d,f,h=c,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*e.length+c);(o=v.exec(n))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){h+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){m+=f;continue}if(h-=f,h>0)continue;f=Math.min(f,f+h+m);const k=[...o[0]][0].length,x=e.slice(0,c+o.index+k+f);if(Math.min(c,f)%2){const j=x.slice(1,-1);return{type:"em",raw:x,text:j,tokens:this.lexer.inlineTokens(j)}}const S=x.slice(2,-2);return{type:"strong",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let n;if(n=this.rules.inline.url.exec(e)){let o,l;if(n[2]==="@")o=n[0],l="mailto:"+o;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]);o=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Fs=class Id{constructor(n){ht(this,"tokens");ht(this,"options");ht(this,"state");ht(this,"tokenizer");ht(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Wr,this.options.tokenizer=this.options.tokenizer||new Bl,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:Cn,block:cl.normal,inline:xi.normal};this.options.pedantic?(r.block=cl.pedantic,r.inline=xi.pedantic):this.options.gfm&&(r.block=cl.gfm,this.options.breaks?r.inline=xi.breaks:r.inline=xi.gfm),this.tokenizer.rules=r}static get rules(){return{block:cl,inline:xi}}static lex(n,r){return new Id(r).lex(n)}static lexInline(n,r){return new Id(r).inlineTokens(n)}lex(n){n=n.replace(Cn.carriageReturn,`
492
+ `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);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(e){const n=this.rules.inline.link.exec(e);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=wi(r.slice(0,-1),"\\");if((r.length-c.length)%2===0)return}else{const c=QN(n[2],"()");if(c===-2)return;if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(o);c&&(o=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),ig(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[o.toLowerCase()];if(!l){const c=r[0].charAt(0);return{type:"text",raw:c,text:c}}return ig(r,l,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(e);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const c=[...o[0]].length-1;let d,f,h=c,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,n=n.slice(-1*e.length+c);(o=v.exec(n))!=null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){h+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){m+=f;continue}if(h-=f,h>0)continue;f=Math.min(f,f+h+m);const k=[...o[0]][0].length,x=e.slice(0,c+o.index+k+f);if(Math.min(c,f)%2){const j=x.slice(1,-1);return{type:"em",raw:x,text:j,tokens:this.lexer.inlineTokens(j)}}const S=x.slice(2,-2);return{type:"strong",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let n;if(n=this.rules.inline.url.exec(e)){let o,l;if(n[2]==="@")o=n[0],l="mailto:"+o;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]);o=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Fs=class Id{constructor(n){ht(this,"tokens");ht(this,"options");ht(this,"state");ht(this,"tokenizer");ht(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Wr,this.options.tokenizer=this.options.tokenizer||new Bl,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:Cn,block:cl.normal,inline:xi.normal};this.options.pedantic?(r.block=cl.pedantic,r.inline=xi.pedantic):this.options.gfm&&(r.block=cl.gfm,this.options.breaks?r.inline=xi.breaks:r.inline=xi.gfm),this.tokenizer.rules=r}static get rules(){return{block:cl,inline:xi}}static lex(n,r){return new Id(r).lex(n)}static lexInline(n,r){return new Id(r).inlineTokens(n)}lex(n){n=n.replace(Cn.carriageReturn,`
493
493
  `),this.blockTokens(n,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,r=[],o=!1){var l,c,d;for(this.options.pedantic&&(n=n.replace(Cn.tabCharGlobal," ").replace(Cn.spaceLine,""));n;){let f;if((c=(l=this.options.extensions)==null?void 0:l.block)!=null&&c.some(m=>(f=m.call({lexer:this},n,r))?(n=n.substring(f.raw.length),r.push(f),!0):!1))continue;if(f=this.tokenizer.space(n)){n=n.substring(f.raw.length);const m=r.at(-1);f.raw.length===1&&m!==void 0?m.raw+=`
494
494
  `:r.push(f);continue}if(f=this.tokenizer.code(n)){n=n.substring(f.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
495
495
  `+f.raw,m.text+=`
@@ -518,18 +518,18 @@ ${this.parser.parse(e)}</blockquote>
518
518
  ${e}</tr>
519
519
  `}tablecell(e){const n=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+n+`</${r}>
520
520
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Es(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:r}){const o=this.parser.parseInline(r),l=rg(e);if(l===null)return o;e=l;let c='<a href="'+e+'"';return n&&(c+=' title="'+Es(n)+'"'),c+=">"+o+"</a>",c}image({href:e,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const l=rg(e);if(l===null)return Es(r);e=l;let c=`<img src="${e}" alt="${r}"`;return n&&(c+=` title="${Es(n)}"`),c+=">",c}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Es(e.text)}},Nf=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Us=class Dd{constructor(n){ht(this,"options");ht(this,"renderer");ht(this,"textRenderer");this.options=n||Wr,this.options.renderer=this.options.renderer||new Wl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Nf}static parse(n,r){return new Dd(r).parse(n)}static parseInline(n,r){return new Dd(r).parseInline(n)}parse(n,r=!0){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=f,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)){o+=v||"";continue}}const h=f;switch(h.type){case"space":{o+=this.renderer.space(h);continue}case"hr":{o+=this.renderer.hr(h);continue}case"heading":{o+=this.renderer.heading(h);continue}case"code":{o+=this.renderer.code(h);continue}case"table":{o+=this.renderer.table(h);continue}case"blockquote":{o+=this.renderer.blockquote(h);continue}case"list":{o+=this.renderer.list(h);continue}case"html":{o+=this.renderer.html(h);continue}case"paragraph":{o+=this.renderer.paragraph(h);continue}case"text":{let m=h,v=this.renderer.text(m);for(;d+1<n.length&&n[d+1].type==="text";)m=n[++d],v+=`
521
- `+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(n,r=this.renderer){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}const h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},yd,yl=(yd=class{constructor(e){ht(this,"options");ht(this,"block");this.options=e||Wr}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Fs.lex:Fs.lexInline}provideParser(){return this.block?Us.parse:Us.parseInline}},ht(yd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),yd),YN=class{constructor(...e){ht(this,"defaults",gf());ht(this,"options",this.setOptions);ht(this,"parse",this.parseMarkdown(!0));ht(this,"parseInline",this.parseMarkdown(!1));ht(this,"Parser",Us);ht(this,"Renderer",Wl);ht(this,"TextRenderer",Nf);ht(this,"Lexer",Fs);ht(this,"Tokenizer",Bl);ht(this,"Hooks",yl);this.use(...e)}walkTokens(e,n){var o,l;let r=[];for(const c of e)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const f of d.header)r=r.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const h of f)r=r.concat(this.walkTokens(h.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const h=d[f].flat(1/0);r=r.concat(this.walkTokens(h,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.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 f=l.renderer.apply(this,d);return f===!1&&(f=c.apply(this,d)),f}: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)}),o.extensions=n),r.renderer){const l=this.defaults.renderer||new Wl(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,f=r.renderer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new Bl(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,f=r.tokenizer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new yl;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,f=r.hooks[d],h=l[d];yl.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(f.call(l,m)).then(k=>h.call(l,k));const v=f.call(l,m);return h.call(l,v)}:l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let f=[];return f.push(c.call(this,d)),l&&(f=f.concat(l.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Fs.lex(e,n??this.defaults)}parser(e,n){return Us.parse(e,n??this.defaults)}parseMarkdown(e){return(r,o)=>{const l={...o},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=e);const f=c.hooks?c.hooks.provideLexer():e?Fs.lex:Fs.lexInline,h=c.hooks?c.hooks.provideParser():e?Us.parse:Us.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>f(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=>h(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=f(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=h(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(e,n){return r=>{if(r.message+=`
522
- Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+Es(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Ur=new YN;function Je(e,n){return Ur.parse(e,n)}Je.options=Je.setOptions=function(e){return Ur.setOptions(e),Je.defaults=Ur.defaults,_y(Je.defaults),Je};Je.getDefaults=gf;Je.defaults=Wr;Je.use=function(...e){return Ur.use(...e),Je.defaults=Ur.defaults,_y(Je.defaults),Je};Je.walkTokens=function(e,n){return Ur.walkTokens(e,n)};Je.parseInline=Ur.parseInline;Je.Parser=Us;Je.parser=Us.parse;Je.Renderer=Wl;Je.TextRenderer=Nf;Je.Lexer=Fs;Je.lexer=Fs.lex;Je.Tokenizer=Bl;Je.Hooks=yl;Je.parse=Je;Je.options;Je.setOptions;Je.use;Je.walkTokens;Je.parseInline;Us.parse;Fs.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 ag(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function QN(e){if(Array.isArray(e))return e}function ZN(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,l,c,d,f=[],h=!0,m=!1;try{if(c=(r=r.call(e)).next,n!==0)for(;!(h=(o=c.call(r)).done)&&(f.push(o.value),f.length!==n);h=!0);}catch(v){m=!0,l=v}finally{try{if(!h&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return f}}function JN(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
523
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eT(e,n){return QN(e)||ZN(e,n)||tT(e,n)||JN()}function tT(e,n){if(e){if(typeof e=="string")return ag(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ag(e,n):void 0}}const Fy=Object.entries,lg=Object.setPrototypeOf,nT=Object.isFrozen,sT=Object.getPrototypeOf,rT=Object.getOwnPropertyDescriptor;let un=Object.freeze,dn=Object.seal,So=Object.create,Uy=typeof Reflect<"u"&&Reflect,Md=Uy.apply,Ld=Uy.construct;un||(un=function(n){return n});dn||(dn=function(n){return n});Md||(Md=function(n,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),c=2;c<o;c++)l[c-2]=arguments[c];return n.apply(r,l)});Ld||(Ld=function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new n(...o)});const vo=Vt(Array.prototype.forEach),oT=Vt(Array.prototype.lastIndexOf),cg=Vt(Array.prototype.pop),yo=Vt(Array.prototype.push),iT=Vt(Array.prototype.splice),pr=Array.isArray,Ci=Vt(String.prototype.toLowerCase),ld=Vt(String.prototype.toString),ug=Vt(String.prototype.match),ki=Vt(String.prototype.replace),dg=Vt(String.prototype.indexOf),aT=Vt(String.prototype.trim),lT=Vt(Number.prototype.toString),cT=Vt(Boolean.prototype.toString),fg=typeof BigInt>"u"?null:Vt(BigInt.prototype.toString),pg=typeof Symbol>"u"?null:Vt(Symbol.prototype.toString),rn=Vt(Object.prototype.hasOwnProperty),Si=Vt(Object.prototype.toString),sn=Vt(RegExp.prototype.test),$r=uT(TypeError);function Vt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Md(e,n,o)}}function uT(e){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Ld(e,r)}}function Ze(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ci;if(lg&&lg(e,null),!pr(n))return e;let o=n.length;for(;o--;){let l=n[o];if(typeof l=="string"){const c=r(l);c!==l&&(nT(n)||(n[o]=c),l=c)}e[l]=!0}return e}function dT(e){for(let n=0;n<e.length;n++)rn(e,n)||(e[n]=null);return e}function vn(e){const n=So(null);for(const o of Fy(e)){var r=eT(o,2);const l=r[0],c=r[1];rn(e,l)&&(pr(c)?n[l]=dT(c):c&&typeof c=="object"&&c.constructor===Object?n[l]=vn(c):n[l]=c)}return n}function fT(e){switch(typeof e){case"string":return e;case"number":return lT(e);case"boolean":return cT(e);case"bigint":return fg?fg(e):"0";case"symbol":return pg?pg(e):"Symbol()";case"undefined":return Si(e);case"function":case"object":{if(e===null)return Si(e);const n=e,r=ds(n,"toString");if(typeof r=="function"){const o=r(n);return typeof o=="string"?o:Si(o)}return Si(e)}default:return Si(e)}}function ds(e,n){for(;e!==null;){const o=rT(e,n);if(o){if(o.get)return Vt(o.get);if(typeof o.value=="function")return Vt(o.value)}e=sT(e)}function r(){return null}return r}function pT(e){try{return sn(e,""),!0}catch{return!1}}const hg=un(["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"]),cd=un(["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"]),ud=un(["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"]),hT=un(["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"]),dd=un(["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"]),mT=un(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mg=un(["#text"]),gg=un(["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"]),fd=un(["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"]),vg=un(["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"]),ul=un(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),gT=dn(/{{[\w\W]*|^[\w\W]*}}/g),vT=dn(/<%[\w\W]*|^[\w\W]*%>/g),yT=dn(/\${[\w\W]*/g),xT=dn(/^data-[\-\w.\u00B7-\uFFFF]+$/),wT=dn(/^aria-[\-\w]+$/),yg=dn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kT=dn(/^(?:\w+script|data):/i),ST=dn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bT=dn(/^html$/i),NT=dn(/^[a-z][.\w]*(-[.\w]+)+$/i),xg=dn(/<[/\w!]/g),wg=dn(/<[/\w]/g),TT=dn(/<\/no(script|embed|frames)/i),CT=dn(/\/>/i),Bn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},jT=function(){return typeof window>"u"?null:window},ET=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const c="dompurify"+(o?"#"+o:"");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}},kg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},dr=function(n,r,o,l){return rn(n,r)&&pr(n[r])?Ze(l.base?vn(l.base):{},n[r],l.transform):o};function By(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jT();const n=fe=>By(fe);if(n.version="3.4.13",n.removed=[],!e||!e.document||e.document.nodeType!==Bn.document||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,l=o.currentScript;e.DocumentFragment;const c=e.HTMLTemplateElement,d=e.Node,f=e.Element,h=e.NodeFilter,m=e.NamedNodeMap;m===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const v=e.DOMParser,k=e.trustedTypes,x=f.prototype,S=ds(x,"cloneNode"),j=ds(x,"remove"),N=ds(x,"nextSibling"),T=ds(x,"childNodes"),b=ds(x,"parentNode"),A=ds(x,"shadowRoot"),P=ds(x,"attributes"),L=d&&d.prototype?ds(d.prototype,"nodeType"):null,z=d&&d.prototype?ds(d.prototype,"nodeName"):null,q=d&&d.prototype?ds(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const fe=r.createElement("template");fe.content&&fe.content.ownerDocument&&(r=fe.content.ownerDocument)}let F,O="",Q,J=!1,te=0;const me=function(){if(te>0)throw $r('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.')},ke=function(C){me(),te++;try{return F.createHTML(C)}finally{te--}},Le=function(C){me(),te++;try{return F.createScriptURL(C)}finally{te--}},Te=function(){return J||(Q=ET(k,l),J=!0),Q},oe=r,ee=oe.implementation,Y=oe.createNodeIterator,ae=oe.createDocumentFragment,K=oe.getElementsByTagName,E=o.importNode;let M=kg();n.isSupported=typeof Fy=="function"&&typeof b=="function"&&ee&&ee.createHTMLDocument!==void 0;const de=gT,U=vT,ue=yT,X=xT,ve=wT,xe=kT,Ae=ST,Ce=NT;let ge=yg,le=null;const Qe=Ze({},[...hg,...cd,...ud,...dd,...mg]);let Ee=null;const et=Ze({},[...gg,...fd,...vg,...ul]);let He=Object.seal(So(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}})),Se=null,Be=null;const Xe=Object.seal(So(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let at=!0,kt=!0,Ot=!1,G=!0,we=!1,ze=!0,Ye=!1,vt=!1,yt=null,Z=null,Pe=!1,qe=!1,St=!1,yn=!1,xn=!0,ns=!1;const ss="user-content-";let rs=!0,wn=!1,fn={},Wt=null;const _n=Ze({},["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 ft=null;const bt=Ze({},["audio","video","img","source","image","track"]);let Rt=null;const Kt=Ze({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",Nt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let Gt=mt,pt=!1,Jt=null;const $t=Ze({},[Et,Nt,mt],ld),I=un(["mi","mo","mn","ms","mtext"]);let he=Ze({},I);const ce=un(["annotation-xml"]);let be=Ze({},ce);const We=Ze({},["title","style","font","a","script"]);let tt=null;const Ve=["application/xhtml+xml","text/html"],qt="text/html";let Ke=null,Xt=null;const ys=r.createElement("form"),Rs=function(C){return C instanceof RegExp||C instanceof Function},xs=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xt&&Xt===C)return;(!C||typeof C!="object")&&(C={}),C=vn(C),tt=Ve.indexOf(C.PARSER_MEDIA_TYPE)===-1?qt:C.PARSER_MEDIA_TYPE,Ke=tt==="application/xhtml+xml"?ld:Ci,le=dr(C,"ALLOWED_TAGS",Qe,{transform:Ke}),Ee=dr(C,"ALLOWED_ATTR",et,{transform:Ke}),Jt=dr(C,"ALLOWED_NAMESPACES",$t,{transform:ld}),Rt=dr(C,"ADD_URI_SAFE_ATTR",Kt,{transform:Ke,base:Kt}),ft=dr(C,"ADD_DATA_URI_TAGS",bt,{transform:Ke,base:bt}),Wt=dr(C,"FORBID_CONTENTS",_n,{transform:Ke}),Se=dr(C,"FORBID_TAGS",vn({}),{transform:Ke}),Be=dr(C,"FORBID_ATTR",vn({}),{transform:Ke}),fn=rn(C,"USE_PROFILES")?C.USE_PROFILES&&typeof C.USE_PROFILES=="object"?vn(C.USE_PROFILES):C.USE_PROFILES:!1,at=C.ALLOW_ARIA_ATTR!==!1,kt=C.ALLOW_DATA_ATTR!==!1,Ot=C.ALLOW_UNKNOWN_PROTOCOLS||!1,G=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=C.SAFE_FOR_TEMPLATES||!1,ze=C.SAFE_FOR_XML!==!1,Ye=C.WHOLE_DOCUMENT||!1,qe=C.RETURN_DOM||!1,St=C.RETURN_DOM_FRAGMENT||!1,yn=C.RETURN_TRUSTED_TYPE||!1,Pe=C.FORCE_BODY||!1,xn=C.SANITIZE_DOM!==!1,ns=C.SANITIZE_NAMED_PROPS||!1,rs=C.KEEP_CONTENT!==!1,wn=C.IN_PLACE||!1,ge=pT(C.ALLOWED_URI_REGEXP)?C.ALLOWED_URI_REGEXP:yg,Gt=typeof C.NAMESPACE=="string"?C.NAMESPACE:mt,he=rn(C,"MATHML_TEXT_INTEGRATION_POINTS")&&C.MATHML_TEXT_INTEGRATION_POINTS&&typeof C.MATHML_TEXT_INTEGRATION_POINTS=="object"?vn(C.MATHML_TEXT_INTEGRATION_POINTS):Ze({},I),be=rn(C,"HTML_INTEGRATION_POINTS")&&C.HTML_INTEGRATION_POINTS&&typeof C.HTML_INTEGRATION_POINTS=="object"?vn(C.HTML_INTEGRATION_POINTS):Ze({},ce);const B=rn(C,"CUSTOM_ELEMENT_HANDLING")&&C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING=="object"?vn(C.CUSTOM_ELEMENT_HANDLING):So(null);if(He=So(null),rn(B,"tagNameCheck")&&Rs(B.tagNameCheck)&&(He.tagNameCheck=B.tagNameCheck),rn(B,"attributeNameCheck")&&Rs(B.attributeNameCheck)&&(He.attributeNameCheck=B.attributeNameCheck),rn(B,"allowCustomizedBuiltInElements")&&typeof B.allowCustomizedBuiltInElements=="boolean"&&(He.allowCustomizedBuiltInElements=B.allowCustomizedBuiltInElements),dn(He),we&&(kt=!1),St&&(qe=!0),fn&&(le=Ze({},mg),Ee=So(null),fn.html===!0&&(Ze(le,hg),Ze(Ee,gg)),fn.svg===!0&&(Ze(le,cd),Ze(Ee,fd),Ze(Ee,ul)),fn.svgFilters===!0&&(Ze(le,ud),Ze(Ee,fd),Ze(Ee,ul)),fn.mathMl===!0&&(Ze(le,dd),Ze(Ee,vg),Ze(Ee,ul))),Xe.tagCheck=null,Xe.attributeCheck=null,rn(C,"ADD_TAGS")&&(typeof C.ADD_TAGS=="function"?Xe.tagCheck=C.ADD_TAGS:pr(C.ADD_TAGS)&&(le===Qe&&(le=vn(le)),Ze(le,C.ADD_TAGS,Ke))),rn(C,"ADD_ATTR")&&(typeof C.ADD_ATTR=="function"?Xe.attributeCheck=C.ADD_ATTR:pr(C.ADD_ATTR)&&(Ee===et&&(Ee=vn(Ee)),Ze(Ee,C.ADD_ATTR,Ke))),rn(C,"ADD_URI_SAFE_ATTR")&&pr(C.ADD_URI_SAFE_ATTR)&&Ze(Rt,C.ADD_URI_SAFE_ATTR,Ke),rn(C,"FORBID_CONTENTS")&&pr(C.FORBID_CONTENTS)&&(Wt===_n&&(Wt=vn(Wt)),Ze(Wt,C.FORBID_CONTENTS,Ke)),rn(C,"ADD_FORBID_CONTENTS")&&pr(C.ADD_FORBID_CONTENTS)&&(Wt===_n&&(Wt=vn(Wt)),Ze(Wt,C.ADD_FORBID_CONTENTS,Ke)),rs&&(le["#text"]=!0),Ye&&Ze(le,["html","head","body"]),le.table&&(Ze(le,["tbody"]),delete Se.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ne=F;F=C.TRUSTED_TYPES_POLICY;try{O=ke("")}catch(Re){throw F=ne,Re}}else C.TRUSTED_TYPES_POLICY===null?(F=void 0,O=""):(F===void 0&&(F=Te()),F&&typeof O=="string"&&(O=ke("")));un&&un(C),Xt=C},Kn=Ze({},[...cd,...ud,...hT]),ws=Ze({},[...dd,...mT]),lt=function(C,B,ne){return B.namespaceURI===mt?C==="svg":B.namespaceURI===Et?C==="svg"&&(ne==="annotation-xml"||he[ne]):!!Kn[C]},zt=function(C,B,ne){return B.namespaceURI===mt?C==="math":B.namespaceURI===Nt?C==="math"&&be[ne]:!!ws[C]},ks=function(C,B,ne){return B.namespaceURI===Nt&&!be[ne]||B.namespaceURI===Et&&!he[ne]?!1:!ws[C]&&(We[C]||!Kn[C])},At=function(C){let B=b(C);(!B||!B.tagName)&&(B={namespaceURI:Gt,tagName:"template"});const ne=Ci(C.tagName),Re=Ci(B.tagName);return Jt[C.namespaceURI]?C.namespaceURI===Nt?lt(ne,B,Re):C.namespaceURI===Et?zt(ne,B,Re):C.namespaceURI===mt?ks(ne,B,Re):!!(tt==="application/xhtml+xml"&&Jt[C.namespaceURI]):!1},Ss=function(C){yo(n.removed,{element:C});try{b(C).removeChild(C)}catch{if(j(C),!b(C))throw $r("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Hs=function(C){xr(C);const B=T(C);if(B){const Re=[];vo(B,Me=>{yo(Re,Me)}),vo(Re,Me=>{try{j(Me)}catch{}})}const ne=P(C);if(ne)for(let Re=ne.length-1;Re>=0;--Re){const Me=ne[Re],Ue=Me&&Me.name;if(typeof Ue=="string")try{C.removeAttribute(Ue)}catch{}}},bs=function(C,B){try{yo(n.removed,{attribute:B.getAttributeNode(C),from:B})}catch{yo(n.removed,{attribute:null,from:B})}if(B.removeAttribute(C),C==="is")if(qe||St)try{Ss(B)}catch{}else try{B.setAttribute(C,"")}catch{}},Hr=function(C){const B=P(C);if(B)for(let ne=B.length-1;ne>=0;--ne){const Re=B[ne],Me=Re&&Re.name;if(!(typeof Me!="string"||Ee[Ke(Me)]))try{C.removeAttribute(Me)}catch{}}},xr=function(C){const B=[C];for(;B.length>0;){const ne=B.pop();(L?L(ne):ne.nodeType)===Bn.element&&Hr(ne);const Me=T(ne);if(Me)for(let Ue=Me.length-1;Ue>=0;--Ue)B.push(Me[Ue])}},Zi=function(C){if(!ze)return;const B=[C];for(;B.length>0;){const ne=B.pop(),Re=L?L(ne):ne.nodeType;if(Re===Bn.processingInstruction||Re===Bn.comment&&sn(wg,ne.data)){try{j(ne)}catch{}continue}if(Re===Bn.element){const Ue=ne,st=Ke(z?z(ne):ne.nodeName);try{Ue.hasAttribute&&Ue.hasAttribute("patchsrc")&&Ue.removeAttribute("patchsrc"),Ue.hasAttribute&&Ue.hasAttribute("for")&&st!=="label"&&st!=="output"&&Ue.removeAttribute("for")}catch{}}const Me=T(ne);if(Me)for(let Ue=Me.length-1;Ue>=0;--Ue)B.push(Me[Ue])}},wr=function(C){let B=null,ne=null;if(Pe)C="<remove></remove>"+C;else{const Ue=ug(C,/^[\r\n\t ]+/);ne=Ue&&Ue[0]}tt==="application/xhtml+xml"&&Gt===mt&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const Re=F?ke(C):C;if(Gt===mt)try{B=new v().parseFromString(Re,tt)}catch{}if(!B||!B.documentElement){B=ee.createDocument(Gt,"template",null);try{B.documentElement.innerHTML=pt?O:Re}catch{}}const Me=B.body||B.documentElement;return C&&ne&&Me.insertBefore(r.createTextNode(ne),Me.childNodes[0]||null),Gt===mt?K.call(B,Ye?"html":"body")[0]:Ye?B.documentElement:Me},$n=function(C){const B=q?q(C):C.ownerDocument;return Y.call(B||C,C,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Vr=function(C){return C=ki(C,de," "),C=ki(C,U," "),C=ki(C,ue," "),C},kn=function(C){var B;C.normalize();const ne=q?q(C):C.ownerDocument,Re=Y.call(ne||C,C,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let Me=Re.nextNode();for(;Me;)Me.data=Vr(Me.data),Me=Re.nextNode();const Ue=(B=C.querySelectorAll)===null||B===void 0?void 0:B.call(C,"template");Ue&&vo(Ue,st=>{Vs(st.content)&&kn(st.content)})},Kr=function(C){const B=z?z(C):null;return typeof B!="string"||Ke(B)!=="form"?!1:typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||C.attributes!==P(C)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function"||C.nodeType!==L(C)||C.childNodes!==T(C)},Vs=function(C){if(!L||typeof C!="object"||C===null)return!1;try{return L(C)===Bn.documentFragment}catch{return!1}},kr=function(C){if(!L||typeof C!="object"||C===null)return!1;try{return typeof L(C)=="number"}catch{return!1}};function Sn(fe,C,B){fe.length!==0&&vo(fe,ne=>{ne.call(n,C,B,Xt)})}const Gr=function(C,B){return!!(ze&&C.hasChildNodes()&&!kr(C.firstElementChild)&&sn(xg,C.textContent)&&sn(xg,C.innerHTML)||ze&&C.namespaceURI===mt&&B==="style"&&kr(C.firstElementChild)||C.nodeType===Bn.processingInstruction||ze&&C.nodeType===Bn.comment&&sn(wg,C.data))},Sr=function(C,B,ne){if(!Se[B]&&zo(B)&&(He.tagNameCheck instanceof RegExp&&sn(He.tagNameCheck,B)||He.tagNameCheck instanceof Function&&He.tagNameCheck(B)))return!1;if(rs&&!Wt[B]){const Re=b(C),Me=T(C);if(Me&&Re){const Ue=Me.length;for(let st=Ue-1;st>=0;--st){const ot=C===ne?S(Me[st],!0):Me[st];Re.insertBefore(ot,N(C))}}}return Ss(C),!0},br=function(C,B,ne,Re){return C.length===0?B:B===ne||B===Re?vn(B):B},Ji=function(C,B){if(Sn(M.beforeSanitizeElements,C,null),C!==B&&b(C)===null)return wn&&xr(C),!0;if(Kr(C))return Ss(C),!0;const ne=Ke(z?z(C):C.nodeName);if(le=br(M.uponSanitizeElement,le,Qe,yt),Sn(M.uponSanitizeElement,C,{tagName:ne,allowedTags:le}),C!==B&&b(C)===null)return wn&&xr(C),!0;if(Gr(C,ne))return Ss(C),!0;if(Se[ne]||!(Xe.tagCheck instanceof Function&&Xe.tagCheck(ne))&&!le[ne]){const Me=Sr(C,ne,B);return Me===!1&&Sn(M.afterSanitizeElements,C,null),Me}if((L?L(C):C.nodeType)===Bn.element&&!At(C)||(ne==="noscript"||ne==="noembed"||ne==="noframes")&&sn(TT,C.innerHTML))return Ss(C),!0;if(we&&C.nodeType===Bn.text){const Me=Vr(C.textContent);C.textContent!==Me&&(yo(n.removed,{element:C.cloneNode()}),C.textContent=Me)}return Sn(M.afterSanitizeElements,C,null),!1},ea=function(C,B,ne){if(Be[B]||ze&&B==="patchsrc"||ze&&B==="for"&&C!=="label"&&C!=="output"||xn&&(B==="id"||B==="name")&&(ne in r||ne in ys))return!1;const Re=Ee[B]||Xe.attributeCheck instanceof Function&&Xe.attributeCheck(B,C);if(!(kt&&sn(X,B))){if(!(at&&sn(ve,B))){if(Re){if(!Rt[B]){if(!sn(ge,ki(ne,Ae,""))){if(!((B==="src"||B==="xlink:href"||B==="href")&&C!=="script"&&dg(ne,"data:")===0&&ft[C])){if(!(Ot&&!sn(xe,ki(ne,Ae,"")))){if(ne)return!1}}}}}else if(!(zo(C)&&(He.tagNameCheck instanceof RegExp&&sn(He.tagNameCheck,C)||He.tagNameCheck instanceof Function&&He.tagNameCheck(C))&&(He.attributeNameCheck instanceof RegExp&&sn(He.attributeNameCheck,B)||He.attributeNameCheck instanceof Function&&He.attributeNameCheck(B,C))||B==="is"&&He.allowCustomizedBuiltInElements&&(He.tagNameCheck instanceof RegExp&&sn(He.tagNameCheck,ne)||He.tagNameCheck instanceof Function&&He.tagNameCheck(ne))))return!1}}return!0},Po=Ze({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zo=function(C){return!Po[Ci(C)]&&sn(Ce,C)},Fo=function(C,B,ne,Re){if(F&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ne)switch(k.getAttributeType(C,B)){case"TrustedHTML":return ke(Re);case"TrustedScriptURL":return Le(Re)}return Re},Nr=function(C,B,ne,Re){try{ne?C.setAttributeNS(ne,B,Re):C.setAttribute(B,Re),Kr(C)?Ss(C):cg(n.removed)}catch{bs(B,C)}},ta=function(C){Sn(M.beforeSanitizeAttributes,C,null);const B=C.attributes;if(!B||Kr(C))return;Ee=br(M.uponSanitizeAttribute,Ee,et,Z);const ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let Re=B.length;const Me=Ke(C.nodeName);for(;Re--;){const Ue=B[Re],st=Ue.name,ot=Ue.namespaceURI,It=Ue.value,Dt=Ke(st),As=It;let Ft=st==="value"?As:aT(As);if(ne.attrName=Dt,ne.attrValue=Ft,ne.keepAttr=!0,ne.forceKeepAttr=void 0,Sn(M.uponSanitizeAttribute,C,ne),Ft=ne.attrValue,ns&&(Dt==="id"||Dt==="name")&&dg(Ft,ss)!==0&&(bs(st,C),Ft=ss+Ft),ze&&sn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ft)){bs(st,C);continue}if(Dt==="attributename"&&ug(Ft,"href")){bs(st,C);continue}if(!ne.forceKeepAttr){if(!ne.keepAttr){bs(st,C);continue}if(!G&&sn(CT,Ft)){bs(st,C);continue}if(we&&(Ft=Vr(Ft)),!ea(Me,Dt,Ft)){bs(st,C);continue}Ft=Fo(Me,Dt,ot,Ft),Ft!==As&&Nr(C,st,ot,Ft)}}Sn(M.afterSanitizeAttributes,C,null)},Ks=function(C){let B=null;const ne=$n(C);for(Sn(M.beforeSanitizeShadowDOM,C,null);B=ne.nextNode();)if(Sn(M.uponSanitizeShadowNode,B,null),Ji(B,C),ta(B),Vs(B.content)&&Ks(B.content),(L?L(B):B.nodeType)===Bn.element){const Me=A(B);Vs(Me)&&(nt(Me),Ks(Me))}Sn(M.afterSanitizeShadowDOM,C,null)},nt=function(C){const B=[{node:C,shadow:null}];for(;B.length>0;){const ne=B.pop();if(ne.shadow){Ks(ne.shadow);continue}const Re=ne.node,Ue=(L?L(Re):Re.nodeType)===Bn.element,st=T(Re);if(st)for(let ot=st.length-1;ot>=0;--ot)B.push({node:st[ot],shadow:null});if(Ue){const ot=z?z(Re):null;if(typeof ot=="string"&&Ke(ot)==="template"){const It=Re.content;Vs(It)&&B.push({node:It,shadow:null})}}if(Ue){const ot=A(Re);Vs(ot)&&B.push({node:null,shadow:ot},{node:ot,shadow:null})}}};return n.sanitize=function(fe){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},B=null,ne=null,Re=null,Me=null;if(pt=!fe,pt&&(fe="<!-->"),typeof fe!="string"&&!kr(fe)&&(fe=fT(fe),typeof fe!="string"))throw $r("dirty is not a string, aborting");if(!n.isSupported)return fe;vt?(le=yt,Ee=Z):xs(C),(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&(le=vn(le)),M.uponSanitizeAttribute.length>0&&(Ee=vn(Ee)),n.removed=[];const Ue=wn&&typeof fe!="string"&&kr(fe);if(Ue){Zi(fe);const It=z?z(fe):fe.nodeName;if(typeof It=="string"){const Dt=Ke(It);if(!le[Dt]||Se[Dt])throw Hs(fe),$r("root node is forbidden and cannot be sanitized in-place")}if(Kr(fe))throw Hs(fe),$r("root node is clobbered and cannot be sanitized in-place");try{nt(fe)}catch(Dt){throw Hs(fe),Dt}}else if(kr(fe))B=wr("<!---->"),ne=B.ownerDocument.importNode(fe,!0),ne.nodeType===Bn.element&&ne.nodeName==="BODY"||ne.nodeName==="HTML"?B=ne:B.appendChild(ne),nt(ne);else{if(!qe&&!we&&!Ye&&fe.indexOf("<")===-1)return F&&yn?ke(fe):fe;if(B=wr(fe),!B)return qe?null:yn?O:""}B&&Pe&&Ss(B.firstChild);const st=Ue?fe:B;try{const It=$n(st);for(;Re=It.nextNode();)Ji(Re,st),ta(Re),Vs(Re.content)&&Ks(Re.content)}catch(It){throw Ue&&(Hs(fe),vo(n.removed,Dt=>{Dt.element&&xr(Dt.element)})),It}if(Ue)return vo(n.removed,It=>{It.element&&xr(It.element)}),we&&kn(fe),fe;if(qe){if(we&&kn(B),St)for(Me=ae.call(B.ownerDocument);B.firstChild;)Me.appendChild(B.firstChild);else Me=B;return(Ee.shadowroot||Ee.shadowrootmode)&&(Me=E.call(o,Me,!0)),Me}let ot=Ye?B.outerHTML:B.innerHTML;return Ye&&le["!doctype"]&&B.ownerDocument&&B.ownerDocument.doctype&&B.ownerDocument.doctype.name&&sn(bT,B.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+B.ownerDocument.doctype.name+`>
524
- `+ot),we&&(ot=Vr(ot)),F&&yn?ke(ot):ot},n.setConfig=function(){let fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xs(fe),vt=!0,yt=le,Z=Ee},n.clearConfig=function(){Xt=null,vt=!1,yt=null,Z=null,F=Q,O=""},n.isValidAttribute=function(fe,C,B){Xt||xs({});const ne=Ke(fe),Re=Ke(C);return ea(ne,Re,B)},n.addHook=function(fe,C){typeof C=="function"&&rn(M,fe)&&yo(M[fe],C)},n.removeHook=function(fe,C){if(rn(M,fe)){if(C!==void 0){const B=oT(M[fe],C);return B===-1?void 0:iT(M[fe],B,1)[0]}return cg(M[fe])}},n.removeHooks=function(fe){rn(M,fe)&&(M[fe]=[])},n.removeAllHooks=function(){M=kg()},n}var Tf=By();const _T=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),RT=100;function Sg(e){return _T.has(e.type)}function AT({items:e,runtimeType:n,turn:r,threads:o=[]}){const[l,c]=y.useState(!1),[d,f]=y.useState(!1);if(e.length===0)return null;const h=e.length,m=d?0:Math.max(0,h-RT),v=m>0?e.slice(m):e;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(uS,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[h," tool call",h>1?"s":""]}),a.jsx($i,{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:()=>f(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Pr,{item:k,runtimeType:n,turn:r,threads:o},k.id))]})]})}Je.setOptions({breaks:!0,gfm:!0});function IT(e){const n=Je.parse(e);return Tf.sanitize(n)}function bg(e,n){var l;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const c=r.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(o+d>n)return{node:c,offset:n-o};o+=d}return null}function DT(e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const c=o.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 f=0,h=d;if(c===n.startContainer&&(f=Math.min(n.startOffset,d)),c===n.endContainer&&(h=Math.min(n.endOffset,d)),f>=h)continue;h<d&&c.splitText(h);const m=f>0?c.splitText(f):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function MT(e,n){e.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const l=document.createTextNode(r.textContent||"");o.replaceChild(l,r),o.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const o=bg(e,r.start_offset),l=bg(e,r.end_offset);if(!o||!l)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(l.node,l.offset),DT(e,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 LT(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(e,0),o.setEnd(r.startContainer,r.startOffset);const l=o.toString().length,c=r.toString();return{start:l,end:l+c.length,text:c}}function OT({itemId:e,turnId:n,sessionId:r,content:o,threads:l}){const c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),h=y.useRef(""),m=y.useRef(0),[v,k]=y.useState(!1),[x,S]=y.useState({x:0,y:0}),[j,N]=y.useState(!1),[T,b]=y.useState({x:0,y:0}),[A,P]=y.useState(""),[L,z]=y.useState(null),[q,F]=y.useState(!1),O=R(K=>K.createThread),Q=R(K=>K.switchRightTab),J=R(K=>Xl(K.sessionDetails[r])),te=y.useCallback(async()=>{await Bi(o||""),F(!0),setTimeout(()=>F(!1),1500)},[o]),me=y.useCallback(()=>{var E;if(!L)return;const K=`
521
+ `+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(n,r=this.renderer){var l,c;let o="";for(let d=0;d<n.length;d++){const f=n[d];if((c=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&c[f.type]){const m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){o+=m||"";continue}}const h=f;switch(h.type){case"escape":{o+=r.text(h);break}case"html":{o+=r.html(h);break}case"link":{o+=r.link(h);break}case"image":{o+=r.image(h);break}case"strong":{o+=r.strong(h);break}case"em":{o+=r.em(h);break}case"codespan":{o+=r.codespan(h);break}case"br":{o+=r.br(h);break}case"del":{o+=r.del(h);break}case"text":{o+=r.text(h);break}default:{const m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},yd,yl=(yd=class{constructor(e){ht(this,"options");ht(this,"block");this.options=e||Wr}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Fs.lex:Fs.lexInline}provideParser(){return this.block?Us.parse:Us.parseInline}},ht(yd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),yd),JN=class{constructor(...e){ht(this,"defaults",gf());ht(this,"options",this.setOptions);ht(this,"parse",this.parseMarkdown(!0));ht(this,"parseInline",this.parseMarkdown(!1));ht(this,"Parser",Us);ht(this,"Renderer",Wl);ht(this,"TextRenderer",Nf);ht(this,"Lexer",Fs);ht(this,"Tokenizer",Bl);ht(this,"Hooks",yl);this.use(...e)}walkTokens(e,n){var o,l;let r=[];for(const c of e)switch(r=r.concat(n.call(this,c)),c.type){case"table":{const d=c;for(const f of d.header)r=r.concat(this.walkTokens(f.tokens,n));for(const f of d.rows)for(const h of f)r=r.concat(this.walkTokens(h.tokens,n));break}case"list":{const d=c;r=r.concat(this.walkTokens(d.items,n));break}default:{const d=c;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(f=>{const h=d[f].flat(1/0);r=r.concat(this.walkTokens(h,n))}):d.tokens&&(r=r.concat(this.walkTokens(d.tokens,n)))}}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.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 f=l.renderer.apply(this,d);return f===!1&&(f=c.apply(this,d)),f}: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)}),o.extensions=n),r.renderer){const l=this.defaults.renderer||new Wl(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,f=r.renderer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new Bl(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,f=r.tokenizer[d],h=l[d];l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new yl;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,f=r.hooks[d],h=l[d];yl.passThroughHooks.has(c)?l[d]=m=>{if(this.defaults.async)return Promise.resolve(f.call(l,m)).then(k=>h.call(l,k));const v=f.call(l,m);return h.call(l,v)}:l[d]=(...m)=>{let v=f.apply(l,m);return v===!1&&(v=h.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,c=r.walkTokens;o.walkTokens=function(d){let f=[];return f.push(c.call(this,d)),l&&(f=f.concat(l.call(this,d))),f}}this.defaults={...this.defaults,...o}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Fs.lex(e,n??this.defaults)}parser(e,n){return Us.parse(e,n??this.defaults)}parseMarkdown(e){return(r,o)=>{const l={...o},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=e);const f=c.hooks?c.hooks.provideLexer():e?Fs.lex:Fs.lexInline,h=c.hooks?c.hooks.provideParser():e?Us.parse:Us.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(r):r).then(m=>f(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=>h(m,c)).then(m=>c.hooks?c.hooks.postprocess(m):m).catch(d);try{c.hooks&&(r=c.hooks.preprocess(r));let m=f(r,c);c.hooks&&(m=c.hooks.processAllTokens(m)),c.walkTokens&&this.walkTokens(m,c.walkTokens);let v=h(m,c);return c.hooks&&(v=c.hooks.postprocess(v)),v}catch(m){return d(m)}}}onError(e,n){return r=>{if(r.message+=`
522
+ Please report this to https://github.com/markedjs/marked.`,e){const o="<p>An error occurred:</p><pre>"+Es(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Ur=new JN;function Je(e,n){return Ur.parse(e,n)}Je.options=Je.setOptions=function(e){return Ur.setOptions(e),Je.defaults=Ur.defaults,Iy(Je.defaults),Je};Je.getDefaults=gf;Je.defaults=Wr;Je.use=function(...e){return Ur.use(...e),Je.defaults=Ur.defaults,Iy(Je.defaults),Je};Je.walkTokens=function(e,n){return Ur.walkTokens(e,n)};Je.parseInline=Ur.parseInline;Je.Parser=Us;Je.parser=Us.parse;Je.Renderer=Wl;Je.TextRenderer=Nf;Je.Lexer=Fs;Je.lexer=Fs.lex;Je.Tokenizer=Bl;Je.Hooks=yl;Je.parse=Je;Je.options;Je.setOptions;Je.use;Je.walkTokens;Je.parseInline;Us.parse;Fs.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 ag(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function eT(e){if(Array.isArray(e))return e}function tT(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,l,c,d,f=[],h=!0,m=!1;try{if(c=(r=r.call(e)).next,n!==0)for(;!(h=(o=c.call(r)).done)&&(f.push(o.value),f.length!==n);h=!0);}catch(v){m=!0,l=v}finally{try{if(!h&&r.return!=null&&(d=r.return(),Object(d)!==d))return}finally{if(m)throw l}}return f}}function nT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
523
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sT(e,n){return eT(e)||tT(e,n)||rT(e,n)||nT()}function rT(e,n){if(e){if(typeof e=="string")return ag(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ag(e,n):void 0}}const Wy=Object.entries,lg=Object.setPrototypeOf,oT=Object.isFrozen,iT=Object.getPrototypeOf,aT=Object.getOwnPropertyDescriptor;let un=Object.freeze,dn=Object.seal,So=Object.create,Hy=typeof Reflect<"u"&&Reflect,Md=Hy.apply,Ld=Hy.construct;un||(un=function(n){return n});dn||(dn=function(n){return n});Md||(Md=function(n,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),c=2;c<o;c++)l[c-2]=arguments[c];return n.apply(r,l)});Ld||(Ld=function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new n(...o)});const vo=Vt(Array.prototype.forEach),lT=Vt(Array.prototype.lastIndexOf),cg=Vt(Array.prototype.pop),yo=Vt(Array.prototype.push),cT=Vt(Array.prototype.splice),pr=Array.isArray,Ci=Vt(String.prototype.toLowerCase),ld=Vt(String.prototype.toString),ug=Vt(String.prototype.match),ki=Vt(String.prototype.replace),dg=Vt(String.prototype.indexOf),uT=Vt(String.prototype.trim),dT=Vt(Number.prototype.toString),fT=Vt(Boolean.prototype.toString),fg=typeof BigInt>"u"?null:Vt(BigInt.prototype.toString),pg=typeof Symbol>"u"?null:Vt(Symbol.prototype.toString),rn=Vt(Object.prototype.hasOwnProperty),Si=Vt(Object.prototype.toString),sn=Vt(RegExp.prototype.test),$r=pT(TypeError);function Vt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Md(e,n,o)}}function pT(e){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return Ld(e,r)}}function Ze(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ci;if(lg&&lg(e,null),!pr(n))return e;let o=n.length;for(;o--;){let l=n[o];if(typeof l=="string"){const c=r(l);c!==l&&(oT(n)||(n[o]=c),l=c)}e[l]=!0}return e}function hT(e){for(let n=0;n<e.length;n++)rn(e,n)||(e[n]=null);return e}function vn(e){const n=So(null);for(const o of Wy(e)){var r=sT(o,2);const l=r[0],c=r[1];rn(e,l)&&(pr(c)?n[l]=hT(c):c&&typeof c=="object"&&c.constructor===Object?n[l]=vn(c):n[l]=c)}return n}function mT(e){switch(typeof e){case"string":return e;case"number":return dT(e);case"boolean":return fT(e);case"bigint":return fg?fg(e):"0";case"symbol":return pg?pg(e):"Symbol()";case"undefined":return Si(e);case"function":case"object":{if(e===null)return Si(e);const n=e,r=ds(n,"toString");if(typeof r=="function"){const o=r(n);return typeof o=="string"?o:Si(o)}return Si(e)}default:return Si(e)}}function ds(e,n){for(;e!==null;){const o=aT(e,n);if(o){if(o.get)return Vt(o.get);if(typeof o.value=="function")return Vt(o.value)}e=iT(e)}function r(){return null}return r}function gT(e){try{return sn(e,""),!0}catch{return!1}}const hg=un(["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"]),cd=un(["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"]),ud=un(["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"]),vT=un(["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"]),dd=un(["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"]),yT=un(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mg=un(["#text"]),gg=un(["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"]),fd=un(["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"]),vg=un(["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"]),ul=un(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xT=dn(/{{[\w\W]*|^[\w\W]*}}/g),wT=dn(/<%[\w\W]*|^[\w\W]*%>/g),kT=dn(/\${[\w\W]*/g),ST=dn(/^data-[\-\w.\u00B7-\uFFFF]+$/),bT=dn(/^aria-[\-\w]+$/),yg=dn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),NT=dn(/^(?:\w+script|data):/i),TT=dn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),CT=dn(/^html$/i),jT=dn(/^[a-z][.\w]*(-[.\w]+)+$/i),xg=dn(/<[/\w!]/g),wg=dn(/<[/\w]/g),ET=dn(/<\/no(script|embed|frames)/i),_T=dn(/\/>/i),Bn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},RT=function(){return typeof window>"u"?null:window},AT=function(n,r){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const c="dompurify"+(o?"#"+o:"");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}},kg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},dr=function(n,r,o,l){return rn(n,r)&&pr(n[r])?Ze(l.base?vn(l.base):{},n[r],l.transform):o};function Vy(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:RT();const n=fe=>Vy(fe);if(n.version="3.4.13",n.removed=[],!e||!e.document||e.document.nodeType!==Bn.document||!e.Element)return n.isSupported=!1,n;let r=e.document;const o=r,l=o.currentScript;e.DocumentFragment;const c=e.HTMLTemplateElement,d=e.Node,f=e.Element,h=e.NodeFilter,m=e.NamedNodeMap;m===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const v=e.DOMParser,k=e.trustedTypes,x=f.prototype,S=ds(x,"cloneNode"),j=ds(x,"remove"),N=ds(x,"nextSibling"),T=ds(x,"childNodes"),b=ds(x,"parentNode"),A=ds(x,"shadowRoot"),P=ds(x,"attributes"),L=d&&d.prototype?ds(d.prototype,"nodeType"):null,z=d&&d.prototype?ds(d.prototype,"nodeName"):null,q=d&&d.prototype?ds(d.prototype,"ownerDocument"):null;if(typeof c=="function"){const fe=r.createElement("template");fe.content&&fe.content.ownerDocument&&(r=fe.content.ownerDocument)}let F,O="",Q,J=!1,te=0;const me=function(){if(te>0)throw $r('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.')},ke=function(C){me(),te++;try{return F.createHTML(C)}finally{te--}},Le=function(C){me(),te++;try{return F.createScriptURL(C)}finally{te--}},Te=function(){return J||(Q=AT(k,l),J=!0),Q},oe=r,ee=oe.implementation,Y=oe.createNodeIterator,ae=oe.createDocumentFragment,K=oe.getElementsByTagName,E=o.importNode;let M=kg();n.isSupported=typeof Wy=="function"&&typeof b=="function"&&ee&&ee.createHTMLDocument!==void 0;const de=xT,U=wT,ue=kT,X=ST,ve=bT,xe=NT,Ae=TT,Ce=jT;let ge=yg,le=null;const Qe=Ze({},[...hg,...cd,...ud,...dd,...mg]);let Ee=null;const et=Ze({},[...gg,...fd,...vg,...ul]);let He=Object.seal(So(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}})),Se=null,Be=null;const Xe=Object.seal(So(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let at=!0,kt=!0,Ot=!1,G=!0,we=!1,ze=!0,Ye=!1,yt=!1,xt=null,Z=null,Pe=!1,qe=!1,St=!1,yn=!1,xn=!0,ns=!1;const ss="user-content-";let rs=!0,wn=!1,fn={},Wt=null;const _n=Ze({},["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 ft=null;const bt=Ze({},["audio","video","img","source","image","track"]);let Rt=null;const Kt=Ze({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",Nt="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let Gt=mt,pt=!1,Jt=null;const $t=Ze({},[Et,Nt,mt],ld),I=un(["mi","mo","mn","ms","mtext"]);let he=Ze({},I);const ce=un(["annotation-xml"]);let be=Ze({},ce);const We=Ze({},["title","style","font","a","script"]);let tt=null;const Ve=["application/xhtml+xml","text/html"],qt="text/html";let Ke=null,Xt=null;const ys=r.createElement("form"),Rs=function(C){return C instanceof RegExp||C instanceof Function},xs=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Xt&&Xt===C)return;(!C||typeof C!="object")&&(C={}),C=vn(C),tt=Ve.indexOf(C.PARSER_MEDIA_TYPE)===-1?qt:C.PARSER_MEDIA_TYPE,Ke=tt==="application/xhtml+xml"?ld:Ci,le=dr(C,"ALLOWED_TAGS",Qe,{transform:Ke}),Ee=dr(C,"ALLOWED_ATTR",et,{transform:Ke}),Jt=dr(C,"ALLOWED_NAMESPACES",$t,{transform:ld}),Rt=dr(C,"ADD_URI_SAFE_ATTR",Kt,{transform:Ke,base:Kt}),ft=dr(C,"ADD_DATA_URI_TAGS",bt,{transform:Ke,base:bt}),Wt=dr(C,"FORBID_CONTENTS",_n,{transform:Ke}),Se=dr(C,"FORBID_TAGS",vn({}),{transform:Ke}),Be=dr(C,"FORBID_ATTR",vn({}),{transform:Ke}),fn=rn(C,"USE_PROFILES")?C.USE_PROFILES&&typeof C.USE_PROFILES=="object"?vn(C.USE_PROFILES):C.USE_PROFILES:!1,at=C.ALLOW_ARIA_ATTR!==!1,kt=C.ALLOW_DATA_ATTR!==!1,Ot=C.ALLOW_UNKNOWN_PROTOCOLS||!1,G=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=C.SAFE_FOR_TEMPLATES||!1,ze=C.SAFE_FOR_XML!==!1,Ye=C.WHOLE_DOCUMENT||!1,qe=C.RETURN_DOM||!1,St=C.RETURN_DOM_FRAGMENT||!1,yn=C.RETURN_TRUSTED_TYPE||!1,Pe=C.FORCE_BODY||!1,xn=C.SANITIZE_DOM!==!1,ns=C.SANITIZE_NAMED_PROPS||!1,rs=C.KEEP_CONTENT!==!1,wn=C.IN_PLACE||!1,ge=gT(C.ALLOWED_URI_REGEXP)?C.ALLOWED_URI_REGEXP:yg,Gt=typeof C.NAMESPACE=="string"?C.NAMESPACE:mt,he=rn(C,"MATHML_TEXT_INTEGRATION_POINTS")&&C.MATHML_TEXT_INTEGRATION_POINTS&&typeof C.MATHML_TEXT_INTEGRATION_POINTS=="object"?vn(C.MATHML_TEXT_INTEGRATION_POINTS):Ze({},I),be=rn(C,"HTML_INTEGRATION_POINTS")&&C.HTML_INTEGRATION_POINTS&&typeof C.HTML_INTEGRATION_POINTS=="object"?vn(C.HTML_INTEGRATION_POINTS):Ze({},ce);const B=rn(C,"CUSTOM_ELEMENT_HANDLING")&&C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING=="object"?vn(C.CUSTOM_ELEMENT_HANDLING):So(null);if(He=So(null),rn(B,"tagNameCheck")&&Rs(B.tagNameCheck)&&(He.tagNameCheck=B.tagNameCheck),rn(B,"attributeNameCheck")&&Rs(B.attributeNameCheck)&&(He.attributeNameCheck=B.attributeNameCheck),rn(B,"allowCustomizedBuiltInElements")&&typeof B.allowCustomizedBuiltInElements=="boolean"&&(He.allowCustomizedBuiltInElements=B.allowCustomizedBuiltInElements),dn(He),we&&(kt=!1),St&&(qe=!0),fn&&(le=Ze({},mg),Ee=So(null),fn.html===!0&&(Ze(le,hg),Ze(Ee,gg)),fn.svg===!0&&(Ze(le,cd),Ze(Ee,fd),Ze(Ee,ul)),fn.svgFilters===!0&&(Ze(le,ud),Ze(Ee,fd),Ze(Ee,ul)),fn.mathMl===!0&&(Ze(le,dd),Ze(Ee,vg),Ze(Ee,ul))),Xe.tagCheck=null,Xe.attributeCheck=null,rn(C,"ADD_TAGS")&&(typeof C.ADD_TAGS=="function"?Xe.tagCheck=C.ADD_TAGS:pr(C.ADD_TAGS)&&(le===Qe&&(le=vn(le)),Ze(le,C.ADD_TAGS,Ke))),rn(C,"ADD_ATTR")&&(typeof C.ADD_ATTR=="function"?Xe.attributeCheck=C.ADD_ATTR:pr(C.ADD_ATTR)&&(Ee===et&&(Ee=vn(Ee)),Ze(Ee,C.ADD_ATTR,Ke))),rn(C,"ADD_URI_SAFE_ATTR")&&pr(C.ADD_URI_SAFE_ATTR)&&Ze(Rt,C.ADD_URI_SAFE_ATTR,Ke),rn(C,"FORBID_CONTENTS")&&pr(C.FORBID_CONTENTS)&&(Wt===_n&&(Wt=vn(Wt)),Ze(Wt,C.FORBID_CONTENTS,Ke)),rn(C,"ADD_FORBID_CONTENTS")&&pr(C.ADD_FORBID_CONTENTS)&&(Wt===_n&&(Wt=vn(Wt)),Ze(Wt,C.ADD_FORBID_CONTENTS,Ke)),rs&&(le["#text"]=!0),Ye&&Ze(le,["html","head","body"]),le.table&&(Ze(le,["tbody"]),delete Se.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw $r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ne=F;F=C.TRUSTED_TYPES_POLICY;try{O=ke("")}catch(Re){throw F=ne,Re}}else C.TRUSTED_TYPES_POLICY===null?(F=void 0,O=""):(F===void 0&&(F=Te()),F&&typeof O=="string"&&(O=ke("")));un&&un(C),Xt=C},Kn=Ze({},[...cd,...ud,...vT]),ws=Ze({},[...dd,...yT]),lt=function(C,B,ne){return B.namespaceURI===mt?C==="svg":B.namespaceURI===Et?C==="svg"&&(ne==="annotation-xml"||he[ne]):!!Kn[C]},zt=function(C,B,ne){return B.namespaceURI===mt?C==="math":B.namespaceURI===Nt?C==="math"&&be[ne]:!!ws[C]},ks=function(C,B,ne){return B.namespaceURI===Nt&&!be[ne]||B.namespaceURI===Et&&!he[ne]?!1:!ws[C]&&(We[C]||!Kn[C])},At=function(C){let B=b(C);(!B||!B.tagName)&&(B={namespaceURI:Gt,tagName:"template"});const ne=Ci(C.tagName),Re=Ci(B.tagName);return Jt[C.namespaceURI]?C.namespaceURI===Nt?lt(ne,B,Re):C.namespaceURI===Et?zt(ne,B,Re):C.namespaceURI===mt?ks(ne,B,Re):!!(tt==="application/xhtml+xml"&&Jt[C.namespaceURI]):!1},Ss=function(C){yo(n.removed,{element:C});try{b(C).removeChild(C)}catch{if(j(C),!b(C))throw $r("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Hs=function(C){xr(C);const B=T(C);if(B){const Re=[];vo(B,Me=>{yo(Re,Me)}),vo(Re,Me=>{try{j(Me)}catch{}})}const ne=P(C);if(ne)for(let Re=ne.length-1;Re>=0;--Re){const Me=ne[Re],Ue=Me&&Me.name;if(typeof Ue=="string")try{C.removeAttribute(Ue)}catch{}}},bs=function(C,B){try{yo(n.removed,{attribute:B.getAttributeNode(C),from:B})}catch{yo(n.removed,{attribute:null,from:B})}if(B.removeAttribute(C),C==="is")if(qe||St)try{Ss(B)}catch{}else try{B.setAttribute(C,"")}catch{}},Hr=function(C){const B=P(C);if(B)for(let ne=B.length-1;ne>=0;--ne){const Re=B[ne],Me=Re&&Re.name;if(!(typeof Me!="string"||Ee[Ke(Me)]))try{C.removeAttribute(Me)}catch{}}},xr=function(C){const B=[C];for(;B.length>0;){const ne=B.pop();(L?L(ne):ne.nodeType)===Bn.element&&Hr(ne);const Me=T(ne);if(Me)for(let Ue=Me.length-1;Ue>=0;--Ue)B.push(Me[Ue])}},Zi=function(C){if(!ze)return;const B=[C];for(;B.length>0;){const ne=B.pop(),Re=L?L(ne):ne.nodeType;if(Re===Bn.processingInstruction||Re===Bn.comment&&sn(wg,ne.data)){try{j(ne)}catch{}continue}if(Re===Bn.element){const Ue=ne,st=Ke(z?z(ne):ne.nodeName);try{Ue.hasAttribute&&Ue.hasAttribute("patchsrc")&&Ue.removeAttribute("patchsrc"),Ue.hasAttribute&&Ue.hasAttribute("for")&&st!=="label"&&st!=="output"&&Ue.removeAttribute("for")}catch{}}const Me=T(ne);if(Me)for(let Ue=Me.length-1;Ue>=0;--Ue)B.push(Me[Ue])}},wr=function(C){let B=null,ne=null;if(Pe)C="<remove></remove>"+C;else{const Ue=ug(C,/^[\r\n\t ]+/);ne=Ue&&Ue[0]}tt==="application/xhtml+xml"&&Gt===mt&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const Re=F?ke(C):C;if(Gt===mt)try{B=new v().parseFromString(Re,tt)}catch{}if(!B||!B.documentElement){B=ee.createDocument(Gt,"template",null);try{B.documentElement.innerHTML=pt?O:Re}catch{}}const Me=B.body||B.documentElement;return C&&ne&&Me.insertBefore(r.createTextNode(ne),Me.childNodes[0]||null),Gt===mt?K.call(B,Ye?"html":"body")[0]:Ye?B.documentElement:Me},$n=function(C){const B=q?q(C):C.ownerDocument;return Y.call(B||C,C,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Vr=function(C){return C=ki(C,de," "),C=ki(C,U," "),C=ki(C,ue," "),C},kn=function(C){var B;C.normalize();const ne=q?q(C):C.ownerDocument,Re=Y.call(ne||C,C,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null);let Me=Re.nextNode();for(;Me;)Me.data=Vr(Me.data),Me=Re.nextNode();const Ue=(B=C.querySelectorAll)===null||B===void 0?void 0:B.call(C,"template");Ue&&vo(Ue,st=>{Vs(st.content)&&kn(st.content)})},Kr=function(C){const B=z?z(C):null;return typeof B!="string"||Ke(B)!=="form"?!1:typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||C.attributes!==P(C)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function"||C.nodeType!==L(C)||C.childNodes!==T(C)},Vs=function(C){if(!L||typeof C!="object"||C===null)return!1;try{return L(C)===Bn.documentFragment}catch{return!1}},kr=function(C){if(!L||typeof C!="object"||C===null)return!1;try{return typeof L(C)=="number"}catch{return!1}};function Sn(fe,C,B){fe.length!==0&&vo(fe,ne=>{ne.call(n,C,B,Xt)})}const Gr=function(C,B){return!!(ze&&C.hasChildNodes()&&!kr(C.firstElementChild)&&sn(xg,C.textContent)&&sn(xg,C.innerHTML)||ze&&C.namespaceURI===mt&&B==="style"&&kr(C.firstElementChild)||C.nodeType===Bn.processingInstruction||ze&&C.nodeType===Bn.comment&&sn(wg,C.data))},Sr=function(C,B,ne){if(!Se[B]&&zo(B)&&(He.tagNameCheck instanceof RegExp&&sn(He.tagNameCheck,B)||He.tagNameCheck instanceof Function&&He.tagNameCheck(B)))return!1;if(rs&&!Wt[B]){const Re=b(C),Me=T(C);if(Me&&Re){const Ue=Me.length;for(let st=Ue-1;st>=0;--st){const ot=C===ne?S(Me[st],!0):Me[st];Re.insertBefore(ot,N(C))}}}return Ss(C),!0},br=function(C,B,ne,Re){return C.length===0?B:B===ne||B===Re?vn(B):B},Ji=function(C,B){if(Sn(M.beforeSanitizeElements,C,null),C!==B&&b(C)===null)return wn&&xr(C),!0;if(Kr(C))return Ss(C),!0;const ne=Ke(z?z(C):C.nodeName);if(le=br(M.uponSanitizeElement,le,Qe,xt),Sn(M.uponSanitizeElement,C,{tagName:ne,allowedTags:le}),C!==B&&b(C)===null)return wn&&xr(C),!0;if(Gr(C,ne))return Ss(C),!0;if(Se[ne]||!(Xe.tagCheck instanceof Function&&Xe.tagCheck(ne))&&!le[ne]){const Me=Sr(C,ne,B);return Me===!1&&Sn(M.afterSanitizeElements,C,null),Me}if((L?L(C):C.nodeType)===Bn.element&&!At(C)||(ne==="noscript"||ne==="noembed"||ne==="noframes")&&sn(ET,C.innerHTML))return Ss(C),!0;if(we&&C.nodeType===Bn.text){const Me=Vr(C.textContent);C.textContent!==Me&&(yo(n.removed,{element:C.cloneNode()}),C.textContent=Me)}return Sn(M.afterSanitizeElements,C,null),!1},ea=function(C,B,ne){if(Be[B]||ze&&B==="patchsrc"||ze&&B==="for"&&C!=="label"&&C!=="output"||xn&&(B==="id"||B==="name")&&(ne in r||ne in ys))return!1;const Re=Ee[B]||Xe.attributeCheck instanceof Function&&Xe.attributeCheck(B,C);if(!(kt&&sn(X,B))){if(!(at&&sn(ve,B))){if(Re){if(!Rt[B]){if(!sn(ge,ki(ne,Ae,""))){if(!((B==="src"||B==="xlink:href"||B==="href")&&C!=="script"&&dg(ne,"data:")===0&&ft[C])){if(!(Ot&&!sn(xe,ki(ne,Ae,"")))){if(ne)return!1}}}}}else if(!(zo(C)&&(He.tagNameCheck instanceof RegExp&&sn(He.tagNameCheck,C)||He.tagNameCheck instanceof Function&&He.tagNameCheck(C))&&(He.attributeNameCheck instanceof RegExp&&sn(He.attributeNameCheck,B)||He.attributeNameCheck instanceof Function&&He.attributeNameCheck(B,C))||B==="is"&&He.allowCustomizedBuiltInElements&&(He.tagNameCheck instanceof RegExp&&sn(He.tagNameCheck,ne)||He.tagNameCheck instanceof Function&&He.tagNameCheck(ne))))return!1}}return!0},Po=Ze({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zo=function(C){return!Po[Ci(C)]&&sn(Ce,C)},Fo=function(C,B,ne,Re){if(F&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ne)switch(k.getAttributeType(C,B)){case"TrustedHTML":return ke(Re);case"TrustedScriptURL":return Le(Re)}return Re},Nr=function(C,B,ne,Re){try{ne?C.setAttributeNS(ne,B,Re):C.setAttribute(B,Re),Kr(C)?Ss(C):cg(n.removed)}catch{bs(B,C)}},ta=function(C){Sn(M.beforeSanitizeAttributes,C,null);const B=C.attributes;if(!B||Kr(C))return;Ee=br(M.uponSanitizeAttribute,Ee,et,Z);const ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0};let Re=B.length;const Me=Ke(C.nodeName);for(;Re--;){const Ue=B[Re],st=Ue.name,ot=Ue.namespaceURI,It=Ue.value,Dt=Ke(st),As=It;let Ft=st==="value"?As:uT(As);if(ne.attrName=Dt,ne.attrValue=Ft,ne.keepAttr=!0,ne.forceKeepAttr=void 0,Sn(M.uponSanitizeAttribute,C,ne),Ft=ne.attrValue,ns&&(Dt==="id"||Dt==="name")&&dg(Ft,ss)!==0&&(bs(st,C),Ft=ss+Ft),ze&&sn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ft)){bs(st,C);continue}if(Dt==="attributename"&&ug(Ft,"href")){bs(st,C);continue}if(!ne.forceKeepAttr){if(!ne.keepAttr){bs(st,C);continue}if(!G&&sn(_T,Ft)){bs(st,C);continue}if(we&&(Ft=Vr(Ft)),!ea(Me,Dt,Ft)){bs(st,C);continue}Ft=Fo(Me,Dt,ot,Ft),Ft!==As&&Nr(C,st,ot,Ft)}}Sn(M.afterSanitizeAttributes,C,null)},Ks=function(C){let B=null;const ne=$n(C);for(Sn(M.beforeSanitizeShadowDOM,C,null);B=ne.nextNode();)if(Sn(M.uponSanitizeShadowNode,B,null),Ji(B,C),ta(B),Vs(B.content)&&Ks(B.content),(L?L(B):B.nodeType)===Bn.element){const Me=A(B);Vs(Me)&&(nt(Me),Ks(Me))}Sn(M.afterSanitizeShadowDOM,C,null)},nt=function(C){const B=[{node:C,shadow:null}];for(;B.length>0;){const ne=B.pop();if(ne.shadow){Ks(ne.shadow);continue}const Re=ne.node,Ue=(L?L(Re):Re.nodeType)===Bn.element,st=T(Re);if(st)for(let ot=st.length-1;ot>=0;--ot)B.push({node:st[ot],shadow:null});if(Ue){const ot=z?z(Re):null;if(typeof ot=="string"&&Ke(ot)==="template"){const It=Re.content;Vs(It)&&B.push({node:It,shadow:null})}}if(Ue){const ot=A(Re);Vs(ot)&&B.push({node:null,shadow:ot},{node:ot,shadow:null})}}};return n.sanitize=function(fe){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},B=null,ne=null,Re=null,Me=null;if(pt=!fe,pt&&(fe="<!-->"),typeof fe!="string"&&!kr(fe)&&(fe=mT(fe),typeof fe!="string"))throw $r("dirty is not a string, aborting");if(!n.isSupported)return fe;yt?(le=xt,Ee=Z):xs(C),(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&(le=vn(le)),M.uponSanitizeAttribute.length>0&&(Ee=vn(Ee)),n.removed=[];const Ue=wn&&typeof fe!="string"&&kr(fe);if(Ue){Zi(fe);const It=z?z(fe):fe.nodeName;if(typeof It=="string"){const Dt=Ke(It);if(!le[Dt]||Se[Dt])throw Hs(fe),$r("root node is forbidden and cannot be sanitized in-place")}if(Kr(fe))throw Hs(fe),$r("root node is clobbered and cannot be sanitized in-place");try{nt(fe)}catch(Dt){throw Hs(fe),Dt}}else if(kr(fe))B=wr("<!---->"),ne=B.ownerDocument.importNode(fe,!0),ne.nodeType===Bn.element&&ne.nodeName==="BODY"||ne.nodeName==="HTML"?B=ne:B.appendChild(ne),nt(ne);else{if(!qe&&!we&&!Ye&&fe.indexOf("<")===-1)return F&&yn?ke(fe):fe;if(B=wr(fe),!B)return qe?null:yn?O:""}B&&Pe&&Ss(B.firstChild);const st=Ue?fe:B;try{const It=$n(st);for(;Re=It.nextNode();)Ji(Re,st),ta(Re),Vs(Re.content)&&Ks(Re.content)}catch(It){throw Ue&&(Hs(fe),vo(n.removed,Dt=>{Dt.element&&xr(Dt.element)})),It}if(Ue)return vo(n.removed,It=>{It.element&&xr(It.element)}),we&&kn(fe),fe;if(qe){if(we&&kn(B),St)for(Me=ae.call(B.ownerDocument);B.firstChild;)Me.appendChild(B.firstChild);else Me=B;return(Ee.shadowroot||Ee.shadowrootmode)&&(Me=E.call(o,Me,!0)),Me}let ot=Ye?B.outerHTML:B.innerHTML;return Ye&&le["!doctype"]&&B.ownerDocument&&B.ownerDocument.doctype&&B.ownerDocument.doctype.name&&sn(CT,B.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+B.ownerDocument.doctype.name+`>
524
+ `+ot),we&&(ot=Vr(ot)),F&&yn?ke(ot):ot},n.setConfig=function(){let fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xs(fe),yt=!0,xt=le,Z=Ee},n.clearConfig=function(){Xt=null,yt=!1,xt=null,Z=null,F=Q,O=""},n.isValidAttribute=function(fe,C,B){Xt||xs({});const ne=Ke(fe),Re=Ke(C);return ea(ne,Re,B)},n.addHook=function(fe,C){typeof C=="function"&&rn(M,fe)&&yo(M[fe],C)},n.removeHook=function(fe,C){if(rn(M,fe)){if(C!==void 0){const B=lT(M[fe],C);return B===-1?void 0:cT(M[fe],B,1)[0]}return cg(M[fe])}},n.removeHooks=function(fe){rn(M,fe)&&(M[fe]=[])},n.removeAllHooks=function(){M=kg()},n}var Tf=Vy();const IT=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),DT=100;function Sg(e){return IT.has(e.type)}function MT({items:e,runtimeType:n,turn:r,threads:o=[]}){const[l,c]=y.useState(!1),[d,f]=y.useState(!1);if(e.length===0)return null;const h=e.length,m=d?0:Math.max(0,h-DT),v=m>0?e.slice(m):e;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(pS,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[h," tool call",h>1?"s":""]}),a.jsx($i,{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:()=>f(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Pr,{item:k,runtimeType:n,turn:r,threads:o},k.id))]})]})}Je.setOptions({breaks:!0,gfm:!0});function LT(e){const n=Je.parse(e);return Tf.sanitize(n)}function bg(e,n){var l;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const c=r.currentNode,d=((l=c.textContent)==null?void 0:l.length)??0;if(o+d>n)return{node:c,offset:n-o};o+=d}return null}function OT(e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const c=o.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 f=0,h=d;if(c===n.startContainer&&(f=Math.min(n.startOffset,d)),c===n.endContainer&&(h=Math.min(n.endOffset,d)),f>=h)continue;h<d&&c.splitText(h);const m=f>0?c.splitText(f):c,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function $T(e,n){e.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const l=document.createTextNode(r.textContent||"");o.replaceChild(l,r),o.normalize()});for(const r of n){if(r.start_offset===null||r.end_offset===null)continue;const o=bg(e,r.start_offset),l=bg(e,r.end_offset);if(!o||!l)continue;const c=document.createRange();c.setStart(o.node,o.offset),c.setEnd(l.node,l.offset),OT(e,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 PT(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const r=n.getRangeAt(0);if(r.collapsed||!e.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(e,0),o.setEnd(r.startContainer,r.startOffset);const l=o.toString().length,c=r.toString();return{start:l,end:l+c.length,text:c}}function zT({itemId:e,turnId:n,sessionId:r,content:o,threads:l}){const c=y.useRef(null),d=y.useRef(null),f=y.useRef(null),h=y.useRef(""),m=y.useRef(0),[v,k]=y.useState(!1),[x,S]=y.useState({x:0,y:0}),[j,N]=y.useState(!1),[T,b]=y.useState({x:0,y:0}),[A,P]=y.useState(""),[L,z]=y.useState(null),[q,F]=y.useState(!1),O=R(K=>K.createThread),Q=R(K=>K.switchRightTab),J=R(K=>Xl(K.sessionDetails[r])),te=y.useCallback(async()=>{await Bi(o||""),F(!0),setTimeout(()=>F(!1),1500)},[o]),me=y.useCallback(()=>{var E;if(!L)return;const K=`
525
525
  \`\`\`QUOTE
526
526
  ${L.text}
527
527
  \`\`\`
528
528
 
529
- `;R.setState({quotedText:K}),k(!1),z(null),(E=window.getSelection())==null||E.removeAllRanges()},[L]),ke=y.useMemo(()=>IT(o||"…"),[o]),Le=y.useMemo(()=>l.filter(K=>K.item_id===e),[l,e]);y.useEffect(()=>{c.current&&MT(c.current,Le)},[ke,Le]),y.useEffect(()=>{h.current=A},[A]),y.useEffect(()=>{function K(E){d.current&&!d.current.contains(E.target)&&(k(!1),h.current.trim()||N(!1))}return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const Te=y.useCallback(()=>{k(!1),h.current.trim()||N(!1)},[]),oe=y.useCallback(()=>{const K=c.current;if(!K)return;const E=LT(K);if(E&&E.text.trim().length>0){const M=window.getSelection();if(M&&M.rangeCount>0&&M.anchorNode&&M.focusNode){const U=M.getRangeAt(0).getBoundingClientRect(),ue=28,X=6,ve=170;let xe=!1;try{const ge=document.createRange();ge.setStart(M.focusNode,M.focusOffset),ge.setEnd(M.focusNode,M.focusOffset);const le=document.createRange();le.setStart(M.anchorNode,M.anchorOffset),le.setEnd(M.anchorNode,M.anchorOffset),xe=le.compareBoundaryPoints(Range.START_TO_START,ge)>0}catch{xe=!1}let Ae=U.top-ue-X;Ae<8&&(Ae=U.bottom+X);let Ce=xe?U.left-ve:U.right;Ce=Math.max(8,Math.min(Ce,window.innerWidth-ve-8)),S({x:Ce,y:Ae}),k(!0),z(E)}}else k(!1)},[]);y.useEffect(()=>{function K(E){const M=E.target;M&&(M.closest(".selection-actions")||M.closest(".thread-create-popover"))||oe()}return document.addEventListener("mouseup",K),()=>document.removeEventListener("mouseup",K)},[oe]);const ee=y.useCallback(()=>{k(!1),N(!0),b({x:x.x,y:x.y})},[x]);y.useLayoutEffect(()=>{if(!j)return;const K=f.current;if(!K)return;const E=K.offsetWidth,M=K.offsetHeight,de=8;let U=x.x,ue=x.y;U-E<de&&(U=E+de),U>window.innerWidth-de&&(U=window.innerWidth-de),ue<de&&(ue=de),ue+M>window.innerHeight-de&&(ue=window.innerHeight-M-de),b({x:U,y:ue})},[j,x]);const Y=y.useCallback(async()=>{var K;J||!L||!A.trim()||(await O(r,{itemId:e,turnId:n,startOffset:L.start,endOffset:L.end,selectedText:L.text,message:A.trim()}),P(""),N(!1),z(null),(K=window.getSelection())==null||K.removeAllRanges(),Q("threads"))},[L,A,O,r,e,n,Q,J]),ae=y.useCallback(K=>{const E=K.target;if(E.tagName==="MARK"&&E.hasAttribute("data-thread-id")){K.preventDefault(),Q("threads");const M=E.getAttribute("data-thread-id");setTimeout(()=>{const de=document.getElementById(`thread-${M}`);de&&(de.scrollIntoView({behavior:"smooth",block:"center"}),de.classList.add("thread-card-highlighted"),setTimeout(()=>de.classList.remove("thread-card-highlighted"),1500))},100)}},[Q]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:ke},onMouseDown:Te,onClick:ae}),a.jsx("button",{className:`copy-text-btn${q?" copied":""}`,onClick:te,title:q?"Copied":"Copy message","aria-label":"Copy message text",children:q?a.jsx(ps,{size:14}):a.jsx(Pi,{size:14})}),v&&!j&&a.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!J&&a.jsxs("button",{className:"discuss-button",onClick:ee,title:"Start a discussion about this text",children:[a.jsx(q1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your message",children:[a.jsx(qv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),j&&a.jsxs("div",{ref:f,className:"thread-create-popover",style:{left:T.x,top:T.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',L==null?void 0:L.text.slice(0,80),L&&L.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{N(!1),z(null)},children:a.jsx(jn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:A,onChange:K=>P(K.target.value),autoFocus:!0,rows:2,onKeyDown:K=>{if(K.key==="Enter"&&(K.metaKey||K.ctrlKey)&&(K.preventDefault(),Y()),K.key==="Escape")if(h.current.trim()){const E=Date.now();m.current&&E-m.current<400?(m.current=0,N(!1),z(null)):m.current=E}else N(!1),z(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:Y,disabled:!A.trim()||J,title:J?"Wait for the running turn to finish first":void 0,children:[a.jsx(Ki,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const Ng=y.memo(OT),Hl=new Map,Wy=new Set,Od=new Set,Tg=new Map;function Hy(){Od.forEach(e=>e())}function Vy(e,n){return`${e}:${n}`}function $T(e,n,r,o,l){var h;const c=Vy(n,r),d=Hl.get(e)??new Map,f=new Map(d);((h=f.get(c))==null?void 0:h.answer)===l?f.delete(c):f.set(c,{itemIndex:n,groupIndex:r,question:o,answer:l}),Hl.set(e,f),Hy()}function PT(e){Hl.delete(e),Hy()}function zT(e){Wy.add(e),PT(e)}function FT(e){const n=y.useCallback(r=>(Od.add(r),()=>{Od.delete(r)}),[]);return y.useSyncExternalStore(n,()=>Hl.get(e)??Tg,()=>Tg)}function UT(e){return[...e].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
529
+ `;R.setState({quotedText:K}),k(!1),z(null),(E=window.getSelection())==null||E.removeAllRanges()},[L]),ke=y.useMemo(()=>LT(o||"…"),[o]),Le=y.useMemo(()=>l.filter(K=>K.item_id===e),[l,e]);y.useEffect(()=>{c.current&&$T(c.current,Le)},[ke,Le]),y.useEffect(()=>{h.current=A},[A]),y.useEffect(()=>{function K(E){d.current&&!d.current.contains(E.target)&&(k(!1),h.current.trim()||N(!1))}return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[]);const Te=y.useCallback(()=>{k(!1),h.current.trim()||N(!1)},[]),oe=y.useCallback(()=>{const K=c.current;if(!K)return;const E=PT(K);if(E&&E.text.trim().length>0){const M=window.getSelection();if(M&&M.rangeCount>0&&M.anchorNode&&M.focusNode){const U=M.getRangeAt(0).getBoundingClientRect(),ue=28,X=6,ve=170;let xe=!1;try{const ge=document.createRange();ge.setStart(M.focusNode,M.focusOffset),ge.setEnd(M.focusNode,M.focusOffset);const le=document.createRange();le.setStart(M.anchorNode,M.anchorOffset),le.setEnd(M.anchorNode,M.anchorOffset),xe=le.compareBoundaryPoints(Range.START_TO_START,ge)>0}catch{xe=!1}let Ae=U.top-ue-X;Ae<8&&(Ae=U.bottom+X);let Ce=xe?U.left-ve:U.right;Ce=Math.max(8,Math.min(Ce,window.innerWidth-ve-8)),S({x:Ce,y:Ae}),k(!0),z(E)}}else k(!1)},[]);y.useEffect(()=>{function K(E){const M=E.target;M&&(M.closest(".selection-actions")||M.closest(".thread-create-popover"))||oe()}return document.addEventListener("mouseup",K),()=>document.removeEventListener("mouseup",K)},[oe]);const ee=y.useCallback(()=>{k(!1),N(!0),b({x:x.x,y:x.y})},[x]);y.useLayoutEffect(()=>{if(!j)return;const K=f.current;if(!K)return;const E=K.offsetWidth,M=K.offsetHeight,de=8;let U=x.x,ue=x.y;U-E<de&&(U=E+de),U>window.innerWidth-de&&(U=window.innerWidth-de),ue<de&&(ue=de),ue+M>window.innerHeight-de&&(ue=window.innerHeight-M-de),b({x:U,y:ue})},[j,x]);const Y=y.useCallback(async()=>{var K;J||!L||!A.trim()||(await O(r,{itemId:e,turnId:n,startOffset:L.start,endOffset:L.end,selectedText:L.text,message:A.trim()}),P(""),N(!1),z(null),(K=window.getSelection())==null||K.removeAllRanges(),Q("threads"))},[L,A,O,r,e,n,Q,J]),ae=y.useCallback(K=>{const E=K.target;if(E.tagName==="MARK"&&E.hasAttribute("data-thread-id")){K.preventDefault(),Q("threads");const M=E.getAttribute("data-thread-id");setTimeout(()=>{const de=document.getElementById(`thread-${M}`);de&&(de.scrollIntoView({behavior:"smooth",block:"center"}),de.classList.add("thread-card-highlighted"),setTimeout(()=>de.classList.remove("thread-card-highlighted"),1500))},100)}},[Q]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:d,children:[a.jsx("div",{ref:c,dangerouslySetInnerHTML:{__html:ke},onMouseDown:Te,onClick:ae}),a.jsx("button",{className:`copy-text-btn${q?" copied":""}`,onClick:te,title:q?"Copied":"Copy message","aria-label":"Copy message text",children:q?a.jsx(ps,{size:14}):a.jsx(Pi,{size:14})}),v&&!j&&a.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!J&&a.jsxs("button",{className:"discuss-button",onClick:ee,title:"Start a discussion about this text",children:[a.jsx(Q1,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your message",children:[a.jsx(Qv,{size:14}),a.jsx("span",{children:"Quote"})]})]}),j&&a.jsxs("div",{ref:f,className:"thread-create-popover",style:{left:T.x,top:T.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',L==null?void 0:L.text.slice(0,80),L&&L.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{N(!1),z(null)},children:a.jsx(jn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:A,onChange:K=>P(K.target.value),autoFocus:!0,rows:2,onKeyDown:K=>{if(K.key==="Enter"&&(K.metaKey||K.ctrlKey)&&(K.preventDefault(),Y()),K.key==="Escape")if(h.current.trim()){const E=Date.now();m.current&&E-m.current<400?(m.current=0,N(!1),z(null)):m.current=E}else N(!1),z(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:Y,disabled:!A.trim()||J,title:J?"Wait for the running turn to finish first":void 0,children:[a.jsx(Ki,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const Ng=y.memo(zT),Hl=new Map,Ky=new Set,Od=new Set,Tg=new Map;function Gy(){Od.forEach(e=>e())}function qy(e,n){return`${e}:${n}`}function FT(e,n,r,o,l){var h;const c=qy(n,r),d=Hl.get(e)??new Map,f=new Map(d);((h=f.get(c))==null?void 0:h.answer)===l?f.delete(c):f.set(c,{itemIndex:n,groupIndex:r,question:o,answer:l}),Hl.set(e,f),Gy()}function UT(e){Hl.delete(e),Gy()}function BT(e){Ky.add(e),UT(e)}function WT(e){const n=y.useCallback(r=>(Od.add(r),()=>{Od.delete(r)}),[]);return y.useSyncExternalStore(n,()=>Hl.get(e)??Tg,()=>Tg)}function HT(e){return[...e].sort((n,r)=>n.itemIndex-r.itemIndex||n.groupIndex-r.groupIndex).map(n=>`> ${n.question}
530
530
  ${n.answer}`).join(`
531
531
 
532
- `)}function Cg({item:e,turn:n}){var S;const r=e.data??{},o=y.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(j=>!!j&&Array.isArray(j.selections)&&j.selections.length>0):[],[r.groups]),l=FT(n.id),c=R(j=>n.session_id?j.sessionDetails[n.session_id]:null),d=R(j=>j.activeSessionId),f=n.items.filter(j=>j.type==="ask_user"||j.type==="final_result").findIndex(j=>j.id===e.id),h=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,m=Wy.has(n.id),v=m||yv(c)||!h||n.session_id!==d,k=(j,N,T)=>{v||$T(n.id,f,j,N,T)},x=()=>{const j=[...l.values()];if(j.length===0)return;const N=UT(j);zT(n.id),R.getState().submitPrompt(N)};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(M1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?a.jsxs("div",{className:"ask-user-groups",children:[o.map((j,N)=>a.jsxs("div",{className:"ask-user-group",children:[j.question&&a.jsx("div",{className:"ask-user-question",children:j.question}),a.jsx("div",{className:"ask-user-options",children:j.selections.map(T=>{var A;const b=((A=l.get(Vy(f,N)))==null?void 0:A.answer)===T;return a.jsx("button",{type:"button",className:`ask-user-option ${b?"selected":""}`,disabled:v,onClick:()=>k(N,j.question,T),children:T},T)})})]},N)),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:x,children:[a.jsx(Ki,{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 BT={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function xl(e){return e&&BT[e]||"interrupted"}function Vl(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function WT(e){switch(e.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=Vl(e.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 HT(e){return e.items.filter(n=>n.type==="interruption").map(n=>n.data)}function VT({item:e}){const n=e.data,r=Vl(n.interrupted_at);let o="";switch(n.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=n.resumed_at?`resumed ${Vl(n.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return a.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",xl(n.reason),") · ",o]})})}function KT({turn:e,label:n}){const[r,o]=y.useState(!1),l=R(d=>d.addToast),c=()=>{o(!0),T0(e.session_id,e.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>o(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[a.jsx(Xv,{size:12}),n]})}function GT({turn:e}){const n=e.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=e.interrupt_reason,o=HT(e),l=o[o.length-1],c=Vl(e.interrupted_at??(l==null?void 0:l.interrupted_at));let d,f=null,h=null;switch(n){case"waiting":{const m=r==="usage_limit"&&!e.resume_at;d=WT(e),f=m?(l==null?void 0:l.detail)??null:null,h=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${xl(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,f=e.error&&!e.error.startsWith("Automatic resume stopped")?e.error:null,h="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${xl(r)}) — too long ago to resume automatically.`,h="Resume";break;default:d=`Interrupted (${xl(r)}) — this turn cannot be resumed.`,f=e.error}return a.jsxs("div",{className:"interruption-banner","data-state":n,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(Zv,{size:12}):a.jsx(ec,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,f&&a.jsx("span",{className:"banner-detail",children:f})]}),h&&a.jsx(KT,{turn:e,label:h})]})}function qT({turnId:e}){const n=R(o=>o.retryStates[e]);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(Zv,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const XT='(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});',YT=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],Ky="agentpane-widget",Gy="agentpane-pane",qy="allow-scripts allow-popups allow-popups-to-escape-sandbox",bi=YT.join(" "),Xy=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${bi}`,`style-src 'unsafe-inline' ${bi}`,`img-src data: blob: ${bi}`,`font-src data: ${bi}`,`connect-src ${bi}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Yy(){const e=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,o)=>(e==null?void 0:e.getPropertyValue(r).trim())||o;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 Qy=`window.addEventListener('click', function (e) {
532
+ `)}function Cg({item:e,turn:n}){var S;const r=e.data??{},o=y.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(j=>!!j&&Array.isArray(j.selections)&&j.selections.length>0):[],[r.groups]),l=WT(n.id),c=R(j=>n.session_id?j.sessionDetails[n.session_id]:null),d=R(j=>j.activeSessionId),f=n.items.filter(j=>j.type==="ask_user"||j.type==="final_result").findIndex(j=>j.id===e.id),h=c?((S=c.turns[c.turns.length-1])==null?void 0:S.id)===n.id:!0,m=Ky.has(n.id),v=m||kv(c)||!h||n.session_id!==d,k=(j,N,T)=>{v||FT(n.id,f,j,N,T)},x=()=>{const j=[...l.values()];if(j.length===0)return;const N=HT(j);BT(n.id),R.getState().submitPrompt(N)};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($1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?a.jsxs("div",{className:"ask-user-groups",children:[o.map((j,N)=>a.jsxs("div",{className:"ask-user-group",children:[j.question&&a.jsx("div",{className:"ask-user-question",children:j.question}),a.jsx("div",{className:"ask-user-options",children:j.selections.map(T=>{var A;const b=((A=l.get(qy(f,N)))==null?void 0:A.answer)===T;return a.jsx("button",{type:"button",className:`ask-user-option ${b?"selected":""}`,disabled:v,onClick:()=>k(N,j.question,T),children:T},T)})})]},N)),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:x,children:[a.jsx(Ki,{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 VT={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error",auth:"signed out",usage_limit:"usage limit"};function xl(e){return e&&VT[e]||"interrupted"}function Vl(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function KT(e){switch(e.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=Vl(e.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 GT(e){return e.items.filter(n=>n.type==="interruption").map(n=>n.data)}function qT({item:e}){const n=e.data,r=Vl(n.interrupted_at);let o="";switch(n.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=n.resumed_at?`resumed ${Vl(n.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return a.jsx("div",{className:"interruption-marker",title:n.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",xl(n.reason),") · ",o]})})}function XT({turn:e,label:n}){const[r,o]=y.useState(!1),l=R(d=>d.addToast),c=()=>{o(!0),E0(e.session_id,e.id).catch(d=>l("error",`Could not resume the turn — ${d.message}`)).finally(()=>o(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:c,disabled:r,children:[a.jsx(Zv,{size:12}),n]})}function YT({turn:e}){const n=e.resume_state;if(!n||n==="cancelled"||n==="resumed")return null;const r=e.interrupt_reason,o=GT(e),l=o[o.length-1],c=Vl(e.interrupted_at??(l==null?void 0:l.interrupted_at));let d,f=null,h=null;switch(n){case"waiting":{const m=r==="usage_limit"&&!e.resume_at;d=KT(e),f=m?(l==null?void 0:l.detail)??null:null,h=r==="auth"||m?"Resume":"Resume now";break}case"resuming":d=`Interrupted (${xl(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);d=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,f=e.error&&!e.error.startsWith("Automatic resume stopped")?e.error:null,h="Resume";break}case"skipped":d=`Interrupted${c?` ${c}`:""} (${xl(r)}) — too long ago to resume automatically.`,h="Resume";break;default:d=`Interrupted (${xl(r)}) — this turn cannot be resumed.`,f=e.error}return a.jsxs("div",{className:"interruption-banner","data-state":n,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(ty,{size:12}):a.jsx(ec,{size:12})}),a.jsxs("span",{className:"banner-text",children:[d,f&&a.jsx("span",{className:"banner-detail",children:f})]}),h&&a.jsx(XT,{turn:e,label:h})]})}function QT({turnId:e}){const n=R(o=>o.retryStates[e]);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(ty,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",n.attempt," of ",n.maxRetries,")…"]})]})}const ZT='(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});',JT=["https://cdnjs.cloudflare.com","https://cdn.jsdelivr.net","https://unpkg.com","https://esm.sh"],Xy="agentpane-widget",Yy="agentpane-pane",Qy="allow-scripts allow-popups allow-popups-to-escape-sandbox",bi=JT.join(" "),Zy=["default-src 'none'",`script-src 'unsafe-inline' 'unsafe-eval' ${bi}`,`style-src 'unsafe-inline' ${bi}`,`img-src data: blob: ${bi}`,`font-src data: ${bi}`,`connect-src ${bi}`,"media-src data: blob:","frame-src 'none'","form-action 'none'","base-uri 'none'"].join("; ");function Jy(){const e=typeof document<"u"?getComputedStyle(document.documentElement):null,n=(r,o)=>(e==null?void 0:e.getPropertyValue(r).trim())||o;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 ex=`window.addEventListener('click', function (e) {
533
533
  if (e.defaultPrevented || e.button !== 0) return;
534
534
  var a = e.target && e.target.closest ? e.target.closest('a[href]') : null;
535
535
  if (!a) return;
@@ -540,9 +540,9 @@ ${n.answer}`).join(`
540
540
  try {
541
541
  window.open(new URL(href).href, '_blank', 'noopener,noreferrer');
542
542
  } catch (err) {}
543
- });`,QT=`(function () {
544
- var SELF = '${Ky}';
545
- var PANE = '${Gy}';
543
+ });`,eC=`(function () {
544
+ var SELF = '${Xy}';
545
+ var PANE = '${Yy}';
546
546
  var SCRIPT_TIMEOUT_MS = 15000;
547
547
  var root = document.getElementById('root');
548
548
  var finished = false;
@@ -638,7 +638,7 @@ ${n.answer}`).join(`
638
638
  post({ type: 'error', message: message });
639
639
  });
640
640
 
641
- ${Qy}
641
+ ${ex}
642
642
 
643
643
  // The frame is as tall as the document's content: the bottom of the
644
644
  // lowest in-flow child of <body> (#root, or what a script appended), plus
@@ -681,21 +681,21 @@ ${n.answer}`).join(`
681
681
  }).observe(document.body, { childList: true });
682
682
  reportHeight();
683
683
  post({ type: 'ready' });
684
- })();`;function $d(e){return`<script>${e.replace(/<\/script/gi,"<\\/script")}<\/script>`}function ZT(){const e=Object.entries(Yy()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Xy}">`,"<style>",`:root { ${e} 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>",$d(XT),'</head><body><div id="root"></div>',$d(QT),"</body></html>"].join(`
685
- `)}let jg=null;function JT(){return jg??(jg=ZT()),jg}const eC=4e3,tC=3,bo=new Map,nC=500;function sC(e,n){if(bo.delete(e),bo.set(e,n),bo.size>nC){const r=bo.keys().next().value;r!==void 0&&bo.delete(r)}}function rC({widgetId:e,title:n,html:r,final:o,onError:l}){const c=y.useRef(null),[d,f]=y.useState(()=>bo.get(e)??0),h=y.useRef({html:r,final:o});h.current={html:r,final:o};const m=y.useRef(l);m.current=l;const v=y.useRef(0),k=y.useRef(null),x=y.useCallback(()=>{var T;const S=(T=c.current)==null?void 0:T.contentWindow;if(!S||v.current===0||v.current>tC)return;const j=h.current,N=k.current;N&&(N.final||N.html===j.html&&N.final===j.final)||(k.current=j,S.postMessage({source:Gy,type:"content",html:j.html,final:j.final},"*"))},[]);return y.useEffect(()=>{function S(j){var b;const N=c.current;if(!N||j.source!==N.contentWindow)return;const T=j.data;if(!(!T||typeof T!="object"||T.source!==Ky))if(T.type==="ready")v.current+=1,k.current=null,x();else if(T.type==="height"&&typeof T.height=="number"&&Number.isFinite(T.height)){const A=Math.min(eC,Math.max(0,Math.ceil(T.height)));f(A),sC(e,A)}else T.type==="error"&&typeof T.message=="string"&&((b=m.current)==null||b.call(m,T.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[e,x]),y.useEffect(()=>{x()},[r,o,x]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:qy,srcDoc:JT(),title:n||"Widget",style:{height:`${d}px`}})}const oC=720,iC=20;function Pd(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function aC(e,n){const r=Object.entries(Yy()).map(([o,l])=>`${o}: ${l};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Xy}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Pd(e||"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: ${oC}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",$d(Qy),'</head><body><div id="root">',n,"</div></body></html>"].join(`
686
- `)}function lC(e,n){const r=Pd(e||"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="${qy}" title="${r}" srcdoc="${Pd(aC(e,n))}"></iframe>`,"</body></html>"].join(`
687
- `)}const xo=new Map;function cC(e,n,r){const o=lC(n,r);let l=xo.get(e);l&&l.doc!==o&&(URL.revokeObjectURL(l.url),l=void 0),l??(l={doc:o,url:URL.createObjectURL(new Blob([o],{type:"text/html;charset=utf-8"}))}),xo.delete(e),xo.set(e,l);for(const[d,f]of xo){if(xo.size<=iC)break;URL.revokeObjectURL(f.url),xo.delete(d)}const c=window.open(l.url,"_blank");c&&(c.opener=null)}function uC({item:e}){const[n,r]=y.useState(null),o=e.data??{},l=typeof o.title=="string"?o.title.trim():"",c=typeof o.html=="string"?o.html:"",d=o.partial===!0,f=typeof o.error=="string"&&o.error?o.error:null,h=e.external_item_id??e.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(oS,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),f&&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:()=>cC(h,l,c),children:a.jsx(af,{size:14})})]}),c.trim()?a.jsx(rC,{widgetId:h,title:l,html:c,final:!d,onError:r}):!f&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),f&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:f})}),n&&!f&&a.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}function Kl(e){return`Message from ${(e==null?void 0:e.trim())||"another session"}`}function Cf(e){return(e??[]).filter(n=>n.task_type!=="local_agent").length}function jf(e){switch(e){case"local_agent":return"subagent";case"local_bash":return"monitor";case"background_terminal":return"command";default:return"task"}}function Zy(e,n){switch(jf(e)){case"subagent":return`Subagent${n?`: ${n}`:""}`;case"monitor":return"Monitor";case"command":return"Background command";default:return"Background Task"}}const dC={subagent:vr,monitor:Yv,command:tc,task:zv};Je.setOptions({breaks:!0,gfm:!0});const fC=10,pC=100;function Jy({name:e,body:n}){return a.jsxs("div",{className:"render-content peer-message",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--purple)",color:"#fff"},children:a.jsx(Gv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Kl(e)})]}),a.jsx("p",{className:"user-message",children:n})]})}function hC({attachments:e}){const[n,r]=y.useState(null);return y.useEffect(()=>{if(!n)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),!Array.isArray(e)||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:e.map((o,l)=>{const c=o.media_type.startsWith("image/"),d=`data:${o.media_type};base64,${o.data}`;return a.jsxs("span",{className:"attachment-pill",title:o.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:o.name,className:"attachment-pill-thumb"}):a.jsx(Fv,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),n&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[a.jsx("img",{src:n,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(jn,{size:20})})]})})]})}function mC(e){const n=Je.parse(e);return Tf.sanitize(n)}function Eg(e){var n;return(n=e.data)!=null&&n.text?e.data.text:""}function gC(e){const n=e.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:e}const _g='<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 vC(e){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${_g}</body>`):e+_g}function yC({html:e}){const[n,r]=y.useState(480),o=y.useRef(null);return y.useEffect(()=>{function l(c){var d;c.source===((d=o.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:o,sandbox:"allow-scripts",srcDoc:vC(e),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Rg=1e4;function xC({item:e,runtimeType:n,turn:r,threads:o}){var f,h,m,v,k,x,S,j,N,T;const l=e.status==="in_progress",[c,d]=y.useState(!1);switch(e.type){case"agent_message":{const{iconClass:b,iconText:A}=Nd(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:A}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(Ng,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:Eg(e)||"…",threads:o,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(A1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:mC(Eg(e))}})]});case"command_execution":{const b=e.data||{},A=gC(b.command||""),P=b.aggregated_output||"",L=b.exit_code,z=l?"running…":L!==null?`exit ${L}`:"",q=P.length>Rg,F=q&&!c?P.slice(0,Rg)+`
688
- … (truncated, click to expand)`:P;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(tc,{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:A})}),P&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:F})}),q&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(O=>!O),children:c?"Show less":`Show full output (${(P.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(f=e.data)==null?void 0:f.changes,A=Array.isArray(b)?b:[],P=`${A.length} file${A.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(P1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:P})]}),a.jsx("div",{className:"file-change-list",children:A.map((L,z)=>{const q=L.kind==="add"?"A":L.kind==="delete"?"D":"M",F=L.kind==="add"?"fc-add":L.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${F}`,children:q}),a.jsx("span",{className:"fc-name",children:L.path})]},z)})})]})}case"mcp_tool_call":{const b=e.data||{},A=b.tool||"mcp";if(A==="Agent"){const J=b.arguments,te=(J==null?void 0:J.description)||(J==null?void 0:J.prompt)||"Subagent",me=e.status==="failed",ke=l?"running…":me?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(vr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:te}),a.jsx("span",{className:`agent-call-status ${l?"running":me?"failed":"done"}`,children:ke})]})}const P=b.server||"",L=b.arguments,z=b.result,q=b.error,F=e.status==="failed"||!!q,O=l?"running…":F?"failed":"done",Q=((h=z==null?void 0:z.content)==null?void 0:h.filter(J=>J.type==="text").map(J=>J.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(nS,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",A]}),P&&a.jsx("span",{className:"turn-header-meta",children:P}),a.jsx("span",{className:"turn-header-meta",style:F?{color:"var(--red)"}:void 0,children:O})]}),L&&Object.keys(L).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(L).map(([J,te])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:J}),J==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(te)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof te=="string"?te:JSON.stringify(te,null,2)})]},J))}),Q.length>0&&Q.map((J,te)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:J})},te)),q&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:q})})]})}case"web_search":{const b=((m=e.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(rS,{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=e.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(V1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:b.map((A,P)=>a.jsxs("li",{className:A.completed?"todo-done":"todo-pending",children:[A.completed?a.jsx(ps,{size:14}):a.jsx(yr,{size:14})," ",A.text]},P))})]})}case"ask_user":return a.jsx(Cg,{item:e,turn:r});case"final_result":{const b=e.data??{},A=b.text||"",P=b.html||null,L=Array.isArray(b.groups)?b.groups.filter(F=>!!F&&Array.isArray(F.selections)&&F.selections.length>0):[],{iconClass:z,iconText:q}=Nd(n??"codex");return a.jsxs(a.Fragment,{children:[(A||P)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${z}`,children:q}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),A&&a.jsx(Ng,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:A,threads:o,runtimeType:n}),P&&a.jsx(yC,{html:P})]}),L.length>0&&a.jsx(Cg,{item:e,turn:r})]})}case"background_task":{const b=e.data||{},A=b.task_type||"unknown",P=b.subagent_type||null,L=b.description||"",z=b.status||"running",q=b.last_tool_name||null,F=b.token_count||null,O=dC[jf(A)],Q=Zy(A,P),J=z==="running"?"running…":z==="completed"?"done":z==="failed"?"failed":z==="stopped"?"stopped":z,te=e.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(O,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Q}),a.jsx("span",{className:"turn-header-meta",style:te?{color:"var(--red)"}:void 0,children:J})]}),L&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:L}),q&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",q,F!=null&&` · ${F.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=e.data)==null?void 0:k.trigger)??"auto",A=typeof((x=e.data)==null?void 0:x.pre_tokens)=="number"?e.data.pre_tokens:null,P=typeof((S=e.data)==null?void 0:S.post_tokens)=="number"?e.data.post_tokens:null,L=b==="manual"?"Context compacted (/compact)":"Context auto-compacted",z=A!==null&&P!==null?`${A.toLocaleString()} → ${P.toLocaleString()} tokens (${A>0?Math.round((1-P/A)*100):0}% reduction)`:A!==null?`${A.toLocaleString()} tokens before`:P!==null?`${P.toLocaleString()} tokens after`:null;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:L})]}),z&&a.jsx("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:z})]})}case"interruption":return a.jsx(VT,{item:e});case"peer_message":return a.jsx(Jy,{name:(j=e.data)==null?void 0:j.name,body:((N=e.data)==null?void 0:N.body)??""});case"widget":return a.jsx(uC,{item:e});case"error":{const b=((T=e.data)==null?void 0:T.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(ec,{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 Pr=y.memo(xC,(e,n)=>e.item===n.item&&e.runtimeType===n.runtimeType&&e.threads===n.threads&&e.turn.id===n.turn.id);function wC(e){return e.type==="widget"?`widget-${e.external_item_id??e.id}`:e.id}function kC({turn:e,runtimeType:n,threads:r=[]}){Bt.trackRender("TurnContent");const[o,l]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(!1),[m,v]=y.useState(!1),k=R(U=>U.loadDeferredItems),x=e.items.some(U=>U.type==="background_task"&&U.status==="in_progress");y.useEffect(()=>{e.status==="running"||e.status==="pending"?l(!0):e.status==="completed"&&!x&&l(!1)},[e.status,x]);const S=e.deferred_item_count??0,j=Bs(e),N=y.useRef(j);y.useEffect(()=>{const U=N.current&&!j&&e.status==="completed"&&!x;if(N.current=j,U||!o||S===0||m||j&&!c)return;let ue=!1;return k(e.session_id,e.id).then(X=>{!X&&!ue&&v(!0)}),()=>{ue=!0}},[o,S,m,j,c,e.status,x,k,e.session_id,e.id]);let T=-1;for(let U=e.items.length-1;U>=0;U--)if(e.items[U].type==="agent_message"){T=U;break}const b=T>=0,A=b?e.items.slice(0,T):e.items,P=e.items.some(U=>U.type==="final_result"||U.type==="ask_user"),L=!b&&e.status==="completed"&&e.agent_response&&!P?{id:`response-${e.id}`,turn_id:e.id,external_item_id:`response-${e.id}`,type:"agent_message",data:{text:e.agent_response},status:"completed",created_at:e.created_at,updated_at:e.updated_at}:null,z=A.filter(U=>{var ue;return!(U.type==="reasoning"&&(!((ue=U.data)!=null&&ue.text)||U.data.text===""))}),q=e.items.some(U=>{var ue;return U.type==="interruption"&&((ue=U.data)==null?void 0:ue.reason)==="auth"}),F=e.items.some(U=>{var ue;return U.type==="interruption"&&((ue=U.data)==null?void 0:ue.reason)==="usage_limit"}),O=z.filter(U=>{var ue,X;return!(U.type==="background_task"||U.type==="ask_user"||U.type==="final_result"||U.type==="widget"||U.type==="context_compaction"||U.type==="peer_message"||q&&U.type==="error"&&((ue=U.data)==null?void 0:ue.error)==="authentication_failed"||F&&U.type==="error"&&((X=U.data)==null?void 0:X.error)==="rate_limit")}),Q=c?0:Math.max(0,O.length-pC),J=Q>0?O.slice(Q):O,te=[];let me=null;for(const U of J)U.type==="agent_message"?(me&&te.push(me),me={agentMessage:U,toolItems:[],otherItems:[]}):U.type==="interruption"||U.type==="error"?(me&&te.push(me),te.push({agentMessage:null,toolItems:[],otherItems:[U]}),me=null):(me||(me={agentMessage:null,toolItems:[],otherItems:[]}),Sg(U)?me.toolItems.push(U):me.otherItems.push(U));me&&te.push(me);const ke=e.status==="running"||e.status==="pending",Le=U=>{var ue;return U.type==="widget"&&(ke||((ue=U.data)==null?void 0:ue.partial)!==!0)},Te=b?e.items[T]:L,oe=[...A.filter(U=>Le(U)||U.type==="context_compaction"||U.type==="peer_message"),...Te?[Te]:[],...b?e.items.slice(T+1).filter(U=>U.type!=="ask_user"&&U.type!=="background_task"&&U.type!=="final_result"&&(U.type!=="widget"||Le(U))):[]],ee=e.items.filter(U=>U.type==="background_task"),Y=f?0:Math.max(0,ee.length-fC),ae=Y>0?ee.slice(Y):ee,K=O.filter(U=>Sg(U)).length+(e.deferred_tool_calls??0),E=K>0||j&&(O.length>0||S>0),M=e.status==="pending"&&e.resume_state==="waiting",de=e.resume_state==="gave_up"||e.resume_state==="skipped"||e.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[e.origin==="peer"?a.jsx(Jy,{name:e.origin_name,body:e.user_prompt}):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:e.user_prompt}),Array.isArray(e.attachments)&&e.attachments.length>0&&a.jsx(hC,{attachments:e.attachments})]}),E&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(U=>!U),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(B1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:K>0?`${K} tool call${K>1?"s":""}`:M?"interrupted":"thinking…"}),a.jsx($i,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&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"}):j&&!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||j)&&a.jsxs(a.Fragment,{children:[S===0&&Q>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Q," earlier step",Q>1?"s":""]})}),te.map((U,ue)=>a.jsxs("div",{className:"intermediate-segment",children:[U.agentMessage&&a.jsx(Pr,{item:U.agentMessage,runtimeType:n,turn:e,threads:r}),U.otherItems.map(X=>a.jsx(Pr,{item:X,runtimeType:n,turn:e,threads:r},X.id)),U.toolItems.length>0&&a.jsx(AT,{items:U.toolItems,runtimeType:n,turn:e,threads:r})]},ue))]})]})]}),Y>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",Y," earlier background task",Y>1?"s":""]})}),ae.map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},`task-${U.id}`)),oe.map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},wC(U))),e.items.filter(U=>U.type==="final_result").map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},`final-${U.id}`)),e.items.filter(U=>U.type==="ask_user").map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},`ask-${U.id}`)),e.items.length===0&&!e.error&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.status==="running"?"Agent is thinking…":"Waiting to start…"})}),e.error&&!de&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:e.error})})}),e.status==="running"&&a.jsx(qT,{turnId:e.id}),a.jsx(GT,{turn:e}),e.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(yr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const SC=y.memo(kC),bC=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function NC(){const e=R(b=>b.workspaces),n=R(b=>b.loadPickerSupport),r=R(b=>b.pickAndAddWorkspace),o=R(b=>b.createSessionInWorkspace),l=R(b=>b.setImportSessionsWorkspace);y.useEffect(()=>{n()},[n]);const c=e.filter(b=>b.deleted===0),[d,f]=y.useState(null),h=c.find(b=>b.path===d)??c[c.length-1]??null,m=(h==null?void 0:h.path)??null,[v,k]=y.useState(null);y.useEffect(()=>{if(!m)return;let b=!1;return Cv(m).then(({sessions:A})=>{b||k({path:m,runtimes:A.map(P=>P.runtime)})}),()=>{b=!0}},[m]);const x=v&&v.path===m?v.runtimes:[],S=x.length,[j,N]=y.useState(!1);async function T(b){N(!0);try{await o(b)}finally{N(!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${h?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:h?a.jsx(ps,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),h?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:h.path,children:h.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(F1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${h?" 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"}),h&&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:b=>f(b.target.value),children:c.map(b=>a.jsx("option",{value:b.path,children:b.label||b.path},b.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:j,onClick:()=>void T(m),children:[a.jsx(hr,{size:14})," New session"]}),S>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Wv,{size:14})," Import ",Tv(x)]})]}),S>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," 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 and Codex sessions, and press"," ",a.jsx("kbd",{children:bC})," for the command palette."]})]})})}const TC=[],dl=50;function CC(){Bt.trackRender("RenderArea");const e=R(S=>S.activeSessionId),n=R(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=R(S=>S.submittingPrompt),o=R(S=>S.loading),l=R(S=>!S.activeSessionId&&!aN(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??TC,f=y.useRef(null),[h,m]=y.useState(dl);y.useEffect(()=>{m(dl)},[e]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-h),x=v.slice(k);return y.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e,c.length]),o&&!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:f,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+dl),children:["Show ",Math.min(dl,k)," earlier turns (",k," hidden)"]})}),x.map((S,j)=>a.jsx("div",{id:`turn-${k+j}`,className:"turn-block",children:a.jsx(SC,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):l?a.jsx(NC,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const jC=y.memo(CC),EC=[{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 _C(e){return e.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function RC(e,n,r=[]){const o=[...EC,..._C(r)],l=new Set;return o.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!n[c.capability])||e&&!c.label.toLowerCase().includes(e.toLowerCase())))}function AC({commands:e,selectedIndex:n,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),e.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),e.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>o(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 pd({title:e,options:n,currentValue:r,onSelect:o,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:e})]}),n.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>o(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 IC(e){return jt("/skills")}function DC({filter:e,onSelect:n,onClose:r}){const[o,l]=y.useState([]),[c,d]=y.useState(!0),[f,h]=y.useState(0),m=y.useRef(null);y.useEffect(()=>{IC().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(e.toLowerCase())||k.description.toLowerCase().includes(e.toLowerCase()));return y.useEffect(()=>{h(0)},[e]),y.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),h(S=>Math.min(S+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),h(S=>Math.max(S-1,0))):x.key==="Enter"?(x.preventDefault(),v[f]&&n(v[f])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,f,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,x)=>a.jsxs("div",{className:`slash-popup-item ${x===f?"selected":""}`,onMouseEnter:()=>h(x),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 ex(){return jt("/providers")}function MC(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return jt(`/providers/${e}/commands${r}`)}const LC={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function OC(e){const[n,r]=y.useState([]),[o,l]=y.useState(!0);y.useEffect(()=>{ex().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=n.find(d=>d.id===e)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??LC,loading:o}}const wo=32,hd=200;function Ag(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function Ig(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let Dg=0;function $C(){return Dg+=1,`att-${Date.now()}-${Dg}`}function PC(){Bt.trackRender("CommandInputBar");const[e,n]=y.useState(""),r=y.useRef(null),o=y.useRef(wo),l=y.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:f,setShowModelSelector:h}=R(),m=R(G=>G.activeSessionId),v=R(G=>G.activeSessionId?G.sessionDetails[G.activeSessionId]:null),k=R(G=>G.quotedText),x=yv(v),S=!!(v!=null&&v.turns.some(G=>G.status==="pending"&&G.resume_state==="waiting")),j=!m,{capabilities:N}=OC(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,b=N.imageAttachments,[A,P]=y.useState([]),[L,z]=y.useState(!1),[q,F]=y.useState(null),[O,Q]=y.useState([]);y.useEffect(()=>{if(!T){Q([]);return}let G=!1;return MC(T,(v==null?void 0:v.cwd)??void 0).then(we=>{G||Q(we)}).catch(()=>{G||Q([])}),()=>{G=!0}},[T,v==null?void 0:v.cwd]);const[J,te]=y.useState(!1),[me,ke]=y.useState(""),[Le,Te]=y.useState(0),[oe,ee]=y.useState(void 0),[Y,ae]=y.useState(!1),[K,E]=y.useState(""),[M,de]=y.useState([]),U=J?RC(me,N,O):[];y.useEffect(()=>{k!==null&&(n(G=>G+k),setTimeout(()=>{if(r.current){le(),r.current.focus();const G=r.current.value.length;r.current.setSelectionRange(G,G)}},0),R.setState({quotedText:null}))},[k]),y.useEffect(()=>{if(!x)return;function G(we){we.key==="Escape"&&(we.preventDefault(),d())}return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[x,d]),y.useEffect(()=>{te(!1),ee(void 0),ae(!1),de([]),P(G=>{for(const we of G)we.previewUrl&&URL.revokeObjectURL(we.previewUrl);return[]})},[m]),y.useEffect(()=>{if(!q)return;function G(we){we.key==="Escape"&&(we.preventDefault(),F(null))}return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[q]);const ue=y.useCallback(G=>{if(!G)return;const we=Array.from(G);for(const ze of we){const Ye=new FileReader;Ye.onload=()=>{const yt=Ye.result.split(",")[1]??"",Z=ze.type.startsWith("image/")?URL.createObjectURL(ze):void 0;P(Pe=>[...Pe,{id:$C(),name:ze.name,media_type:ze.type||"application/octet-stream",data:yt,previewUrl:Z,size:ze.size}])},Ye.readAsDataURL(ze)}},[]),X=y.useCallback(G=>{P(we=>{const ze=we.find(Ye=>Ye.id===G);return ze!=null&&ze.previewUrl&&URL.revokeObjectURL(ze.previewUrl),we.filter(Ye=>Ye.id!==G)})},[]),ve=y.useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(!b||x)&&z(!0)},[b,x]),xe=y.useCallback(G=>{G.preventDefault(),G.stopPropagation(),z(!1)},[]),Ae=y.useCallback(G=>{G.preventDefault(),G.stopPropagation(),z(!1),!(!b||x)&&ue(G.dataTransfer.files)},[b,x,ue]),Ce=y.useCallback(G=>{var Ye;if(!b)return;const we=(Ye=G.clipboardData)==null?void 0:Ye.items;if(!we)return;const ze=[];for(let vt=0;vt<we.length;vt++){const yt=we[vt];if(yt.type.startsWith("image/")){const Z=yt.getAsFile();Z&&ze.push(Z)}}ze.length>0&&(G.preventDefault(),ue(ze))},[b,ue]);function ge(G){const we=r.current;we&&(we.style.height=`${G}px`,o.current=G)}function le(){const G=r.current;if(G){if(G.scrollHeight>G.clientHeight){const we=Math.min(G.scrollHeight,hd);we!==o.current&&ge(we);return}o.current>wo&&(G.style.height="auto",ge(Math.min(G.scrollHeight,hd)))}}function Qe(){const G=e.trim();if(!G||x)return;let we=G;M.length>0&&(we=`${M.map(vt=>`$${vt.name}`).join(" ")}
684
+ })();`;function $d(e){return`<script>${e.replace(/<\/script/gi,"<\\/script")}<\/script>`}function tC(){const e=Object.entries(Jy()).map(([n,r])=>`${n}: ${r};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Zy}">`,"<style>",`:root { ${e} 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>",$d(ZT),'</head><body><div id="root"></div>',$d(eC),"</body></html>"].join(`
685
+ `)}let jg=null;function nC(){return jg??(jg=tC()),jg}const sC=4e3,rC=3,bo=new Map,oC=500;function iC(e,n){if(bo.delete(e),bo.set(e,n),bo.size>oC){const r=bo.keys().next().value;r!==void 0&&bo.delete(r)}}function aC({widgetId:e,title:n,html:r,final:o,onError:l}){const c=y.useRef(null),[d,f]=y.useState(()=>bo.get(e)??0),h=y.useRef({html:r,final:o});h.current={html:r,final:o};const m=y.useRef(l);m.current=l;const v=y.useRef(0),k=y.useRef(null),x=y.useCallback(()=>{var T;const S=(T=c.current)==null?void 0:T.contentWindow;if(!S||v.current===0||v.current>rC)return;const j=h.current,N=k.current;N&&(N.final||N.html===j.html&&N.final===j.final)||(k.current=j,S.postMessage({source:Yy,type:"content",html:j.html,final:j.final},"*"))},[]);return y.useEffect(()=>{function S(j){var b;const N=c.current;if(!N||j.source!==N.contentWindow)return;const T=j.data;if(!(!T||typeof T!="object"||T.source!==Xy))if(T.type==="ready")v.current+=1,k.current=null,x();else if(T.type==="height"&&typeof T.height=="number"&&Number.isFinite(T.height)){const A=Math.min(sC,Math.max(0,Math.ceil(T.height)));f(A),iC(e,A)}else T.type==="error"&&typeof T.message=="string"&&((b=m.current)==null||b.call(m,T.message.slice(0,500)))}return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[e,x]),y.useEffect(()=>{x()},[r,o,x]),a.jsx("iframe",{ref:c,className:"widget-frame",sandbox:Qy,srcDoc:nC(),title:n||"Widget",style:{height:`${d}px`}})}const lC=720,cC=20;function Pd(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function uC(e,n){const r=Object.entries(Jy()).map(([o,l])=>`${o}: ${l};`).join(" ");return["<!DOCTYPE html>","<html><head>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="${Zy}">`,'<meta name="viewport" content="width=device-width, initial-scale=1">',`<title>${Pd(e||"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: ${lC}px; margin: 0 auto; }`,"*, *::before, *::after { box-sizing: border-box; }","</style>",$d(ex),'</head><body><div id="root">',n,"</div></body></html>"].join(`
686
+ `)}function dC(e,n){const r=Pd(e||"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="${Qy}" title="${r}" srcdoc="${Pd(uC(e,n))}"></iframe>`,"</body></html>"].join(`
687
+ `)}const xo=new Map;function fC(e,n,r){const o=dC(n,r);let l=xo.get(e);l&&l.doc!==o&&(URL.revokeObjectURL(l.url),l=void 0),l??(l={doc:o,url:URL.createObjectURL(new Blob([o],{type:"text/html;charset=utf-8"}))}),xo.delete(e),xo.set(e,l);for(const[d,f]of xo){if(xo.size<=cC)break;URL.revokeObjectURL(f.url),xo.delete(d)}const c=window.open(l.url,"_blank");c&&(c.opener=null)}function pC({item:e}){const[n,r]=y.useState(null),o=e.data??{},l=typeof o.title=="string"?o.title.trim():"",c=typeof o.html=="string"?o.html:"",d=o.partial===!0,f=typeof o.error=="string"&&o.error?o.error:null,h=e.external_item_id??e.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(lS,{size:14})}),a.jsx("span",{className:"turn-header-title",children:l||"Visual"}),d&&a.jsx("span",{className:"turn-header-meta",children:"drawing…"}),f&&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:()=>fC(h,l,c),children:a.jsx(af,{size:14})})]}),c.trim()?a.jsx(aC,{widgetId:h,title:l,html:c,final:!d,onError:r}):!f&&a.jsx("div",{className:"widget-placeholder",children:d?"Drawing…":"Nothing to show"}),f&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:f})}),n&&!f&&a.jsxs("div",{className:"widget-script-error",title:n,children:["Script error: ",n]})]})}function Kl(e){return`Message from ${(e==null?void 0:e.trim())||"another session"}`}function Cf(e){return(e??[]).filter(n=>n.task_type!=="local_agent").length}function jf(e){switch(e){case"local_agent":return"subagent";case"local_bash":return"monitor";case"background_terminal":return"command";default:return"task"}}function tx(e,n){switch(jf(e)){case"subagent":return`Subagent${n?`: ${n}`:""}`;case"monitor":return"Monitor";case"command":return"Background command";default:return"Background Task"}}const hC={subagent:vr,monitor:Jv,command:tc,task:Bv};Je.setOptions({breaks:!0,gfm:!0});const mC=10,gC=100;function nx({name:e,body:n}){return a.jsxs("div",{className:"render-content peer-message",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--purple)",color:"#fff"},children:a.jsx(Yv,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Kl(e)})]}),a.jsx("p",{className:"user-message",children:n})]})}function vC({attachments:e}){const[n,r]=y.useState(null);return y.useEffect(()=>{if(!n)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),!Array.isArray(e)||e.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:e.map((o,l)=>{const c=o.media_type.startsWith("image/"),d=`data:${o.media_type};base64,${o.data}`;return a.jsxs("span",{className:"attachment-pill",title:o.name,onClick:c?()=>r(d):void 0,style:c?{cursor:"pointer"}:void 0,children:[c?a.jsx("img",{src:d,alt:o.name,className:"attachment-pill-thumb"}):a.jsx(Wv,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),n&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[a.jsx("img",{src:n,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(jn,{size:20})})]})})]})}function yC(e){const n=Je.parse(e);return Tf.sanitize(n)}function Eg(e){var n;return(n=e.data)!=null&&n.text?e.data.text:""}function xC(e){const n=e.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return n?n[1]:e}const _g='<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 wC(e){return/<\/body>/i.test(e)?e.replace(/<\/body>/i,`${_g}</body>`):e+_g}function kC({html:e}){const[n,r]=y.useState(480),o=y.useRef(null);return y.useEffect(()=>{function l(c){var d;c.source===((d=o.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:o,sandbox:"allow-scripts",srcDoc:wC(e),title:"HTML content",style:{width:"100%",height:`${n}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Rg=1e4;function SC({item:e,runtimeType:n,turn:r,threads:o}){var f,h,m,v,k,x,S,j,N,T;const l=e.status==="in_progress",[c,d]=y.useState(!1);switch(e.type){case"agent_message":{const{iconClass:b,iconText:A}=Nd(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:A}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(Ng,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:Eg(e)||"…",threads:o,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(M1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:yC(Eg(e))}})]});case"command_execution":{const b=e.data||{},A=xC(b.command||""),P=b.aggregated_output||"",L=b.exit_code,z=l?"running…":L!==null?`exit ${L}`:"",q=P.length>Rg,F=q&&!c?P.slice(0,Rg)+`
688
+ … (truncated, click to expand)`:P;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(tc,{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:A})}),P&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:F})}),q&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>d(O=>!O),children:c?"Show less":`Show full output (${(P.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const b=(f=e.data)==null?void 0:f.changes,A=Array.isArray(b)?b:[],P=`${A.length} file${A.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(U1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:P})]}),a.jsx("div",{className:"file-change-list",children:A.map((L,z)=>{const q=L.kind==="add"?"A":L.kind==="delete"?"D":"M",F=L.kind==="add"?"fc-add":L.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${F}`,children:q}),a.jsx("span",{className:"fc-name",children:L.path})]},z)})})]})}case"mcp_tool_call":{const b=e.data||{},A=b.tool||"mcp";if(A==="Agent"){const J=b.arguments,te=(J==null?void 0:J.description)||(J==null?void 0:J.prompt)||"Subagent",me=e.status==="failed",ke=l?"running…":me?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(vr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:te}),a.jsx("span",{className:`agent-call-status ${l?"running":me?"failed":"done"}`,children:ke})]})}const P=b.server||"",L=b.arguments,z=b.result,q=b.error,F=e.status==="failed"||!!q,O=l?"running…":F?"failed":"done",Q=((h=z==null?void 0:z.content)==null?void 0:h.filter(J=>J.type==="text").map(J=>J.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(oS,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",A]}),P&&a.jsx("span",{className:"turn-header-meta",children:P}),a.jsx("span",{className:"turn-header-meta",style:F?{color:"var(--red)"}:void 0,children:O})]}),L&&Object.keys(L).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(L).map(([J,te])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:J}),J==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(te)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof te=="string"?te:JSON.stringify(te,null,2)})]},J))}),Q.length>0&&Q.map((J,te)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:J})},te)),q&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:q})})]})}case"web_search":{const b=((m=e.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(aS,{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=e.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(q1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:b.map((A,P)=>a.jsxs("li",{className:A.completed?"todo-done":"todo-pending",children:[A.completed?a.jsx(ps,{size:14}):a.jsx(yr,{size:14})," ",A.text]},P))})]})}case"ask_user":return a.jsx(Cg,{item:e,turn:r});case"final_result":{const b=e.data??{},A=b.text||"",P=b.html||null,L=Array.isArray(b.groups)?b.groups.filter(F=>!!F&&Array.isArray(F.selections)&&F.selections.length>0):[],{iconClass:z,iconText:q}=Nd(n??"codex");return a.jsxs(a.Fragment,{children:[(A||P)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${z}`,children:q}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),A&&a.jsx(Ng,{itemId:e.id,turnId:r.id,sessionId:r.session_id,content:A,threads:o,runtimeType:n}),P&&a.jsx(kC,{html:P})]}),L.length>0&&a.jsx(Cg,{item:e,turn:r})]})}case"background_task":{const b=e.data||{},A=b.task_type||"unknown",P=b.subagent_type||null,L=b.description||"",z=b.status||"running",q=b.last_tool_name||null,F=b.token_count||null,O=hC[jf(A)],Q=tx(A,P),J=z==="running"?"running…":z==="completed"?"done":z==="failed"?"failed":z==="stopped"?"stopped":z,te=e.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(O,{size:14})}),a.jsx("span",{className:"turn-header-title",children:Q}),a.jsx("span",{className:"turn-header-meta",style:te?{color:"var(--red)"}:void 0,children:J})]}),L&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:L}),q&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",q,F!=null&&` · ${F.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=e.data)==null?void 0:k.trigger)??"auto",A=typeof((x=e.data)==null?void 0:x.pre_tokens)=="number"?e.data.pre_tokens:null,P=typeof((S=e.data)==null?void 0:S.post_tokens)=="number"?e.data.post_tokens:null,L=b==="manual"?"Context compacted (/compact)":"Context auto-compacted",z=A!==null&&P!==null?`${A.toLocaleString()} → ${P.toLocaleString()} tokens (${A>0?Math.round((1-P/A)*100):0}% reduction)`:A!==null?`${A.toLocaleString()} tokens before`:P!==null?`${P.toLocaleString()} tokens after`:null;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(Z1,{size:14})}),a.jsx("span",{className:"turn-header-title",children:L})]}),z&&a.jsx("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:z})]})}case"interruption":return a.jsx(qT,{item:e});case"peer_message":return a.jsx(nx,{name:(j=e.data)==null?void 0:j.name,body:((N=e.data)==null?void 0:N.body)??""});case"widget":return a.jsx(pC,{item:e});case"error":{const b=((T=e.data)==null?void 0:T.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(ec,{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 Pr=y.memo(SC,(e,n)=>e.item===n.item&&e.runtimeType===n.runtimeType&&e.threads===n.threads&&e.turn.id===n.turn.id);function bC(e){return e.type==="widget"?`widget-${e.external_item_id??e.id}`:e.id}function NC({turn:e,runtimeType:n,threads:r=[]}){Bt.trackRender("TurnContent");const[o,l]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(!1),[m,v]=y.useState(!1),k=R(U=>U.loadDeferredItems),x=e.items.some(U=>U.type==="background_task"&&U.status==="in_progress");y.useEffect(()=>{e.status==="running"||e.status==="pending"?l(!0):e.status==="completed"&&!x&&l(!1)},[e.status,x]);const S=e.deferred_item_count??0,j=Bs(e),N=y.useRef(j);y.useEffect(()=>{const U=N.current&&!j&&e.status==="completed"&&!x;if(N.current=j,U||!o||S===0||m||j&&!c)return;let ue=!1;return k(e.session_id,e.id).then(X=>{!X&&!ue&&v(!0)}),()=>{ue=!0}},[o,S,m,j,c,e.status,x,k,e.session_id,e.id]);let T=-1;for(let U=e.items.length-1;U>=0;U--)if(e.items[U].type==="agent_message"){T=U;break}const b=T>=0,A=b?e.items.slice(0,T):e.items,P=e.items.some(U=>U.type==="final_result"||U.type==="ask_user"),L=!b&&e.status==="completed"&&e.agent_response&&!P?{id:`response-${e.id}`,turn_id:e.id,external_item_id:`response-${e.id}`,type:"agent_message",data:{text:e.agent_response},status:"completed",created_at:e.created_at,updated_at:e.updated_at}:null,z=A.filter(U=>{var ue;return!(U.type==="reasoning"&&(!((ue=U.data)!=null&&ue.text)||U.data.text===""))}),q=e.items.some(U=>{var ue;return U.type==="interruption"&&((ue=U.data)==null?void 0:ue.reason)==="auth"}),F=e.items.some(U=>{var ue;return U.type==="interruption"&&((ue=U.data)==null?void 0:ue.reason)==="usage_limit"}),O=z.filter(U=>{var ue,X;return!(U.type==="background_task"||U.type==="ask_user"||U.type==="final_result"||U.type==="widget"||U.type==="context_compaction"||U.type==="peer_message"||q&&U.type==="error"&&((ue=U.data)==null?void 0:ue.error)==="authentication_failed"||F&&U.type==="error"&&((X=U.data)==null?void 0:X.error)==="rate_limit")}),Q=c?0:Math.max(0,O.length-gC),J=Q>0?O.slice(Q):O,te=[];let me=null;for(const U of J)U.type==="agent_message"?(me&&te.push(me),me={agentMessage:U,toolItems:[],otherItems:[]}):U.type==="interruption"||U.type==="error"?(me&&te.push(me),te.push({agentMessage:null,toolItems:[],otherItems:[U]}),me=null):(me||(me={agentMessage:null,toolItems:[],otherItems:[]}),Sg(U)?me.toolItems.push(U):me.otherItems.push(U));me&&te.push(me);const ke=e.status==="running"||e.status==="pending",Le=U=>{var ue;return U.type==="widget"&&(ke||((ue=U.data)==null?void 0:ue.partial)!==!0)},Te=b?e.items[T]:L,oe=[...A.filter(U=>Le(U)||U.type==="context_compaction"||U.type==="peer_message"),...Te?[Te]:[],...b?e.items.slice(T+1).filter(U=>U.type!=="ask_user"&&U.type!=="background_task"&&U.type!=="final_result"&&(U.type!=="widget"||Le(U))):[]],ee=e.items.filter(U=>U.type==="background_task"),Y=f?0:Math.max(0,ee.length-mC),ae=Y>0?ee.slice(Y):ee,K=O.filter(U=>Sg(U)).length+(e.deferred_tool_calls??0),E=K>0||j&&(O.length>0||S>0),M=e.status==="pending"&&e.resume_state==="waiting",de=e.resume_state==="gave_up"||e.resume_state==="skipped"||e.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[e.origin==="peer"?a.jsx(nx,{name:e.origin_name,body:e.user_prompt}):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:e.user_prompt}),Array.isArray(e.attachments)&&e.attachments.length>0&&a.jsx(vC,{attachments:e.attachments})]}),E&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(U=>!U),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(V1,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:K>0?`${K} tool call${K>1?"s":""}`:M?"interrupted":"thinking…"}),a.jsx($i,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&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"}):j&&!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||j)&&a.jsxs(a.Fragment,{children:[S===0&&Q>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>d(!0),children:["Show ",Q," earlier step",Q>1?"s":""]})}),te.map((U,ue)=>a.jsxs("div",{className:"intermediate-segment",children:[U.agentMessage&&a.jsx(Pr,{item:U.agentMessage,runtimeType:n,turn:e,threads:r}),U.otherItems.map(X=>a.jsx(Pr,{item:X,runtimeType:n,turn:e,threads:r},X.id)),U.toolItems.length>0&&a.jsx(MT,{items:U.toolItems,runtimeType:n,turn:e,threads:r})]},ue))]})]})]}),Y>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",Y," earlier background task",Y>1?"s":""]})}),ae.map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},`task-${U.id}`)),oe.map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},bC(U))),e.items.filter(U=>U.type==="final_result").map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},`final-${U.id}`)),e.items.filter(U=>U.type==="ask_user").map(U=>a.jsx(Pr,{item:U,runtimeType:n,turn:e,threads:r},`ask-${U.id}`)),e.items.length===0&&!e.error&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:e.status==="running"?"Agent is thinking…":"Waiting to start…"})}),e.error&&!de&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:e.error})})}),e.status==="running"&&a.jsx(QT,{turnId:e.id}),a.jsx(YT,{turn:e}),e.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(yr,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const TC=y.memo(NC),CC=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function jC(){const e=R(b=>b.workspaces),n=R(b=>b.loadPickerSupport),r=R(b=>b.pickAndAddWorkspace),o=R(b=>b.createSessionInWorkspace),l=R(b=>b.setImportSessionsWorkspace);y.useEffect(()=>{n()},[n]);const c=e.filter(b=>b.deleted===0),[d,f]=y.useState(null),h=c.find(b=>b.path===d)??c[c.length-1]??null,m=(h==null?void 0:h.path)??null,[v,k]=y.useState(null);y.useEffect(()=>{if(!m)return;let b=!1;return _v(m).then(({sessions:A})=>{b||k({path:m,runtimes:A.map(P=>P.runtime)})}),()=>{b=!0}},[m]);const x=v&&v.path===m?v.runtimes:[],S=x.length,[j,N]=y.useState(!1);async function T(b){N(!0);try{await o(b)}finally{N(!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${h?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:h?a.jsx(ps,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),h?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:h.path,children:h.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(W1,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${h?" 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"}),h&&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:b=>f(b.target.value),children:c.map(b=>a.jsx("option",{value:b.path,children:b.label||b.path},b.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:j,onClick:()=>void T(m),children:[a.jsx(hr,{size:14})," New session"]}),S>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Kv,{size:14})," Import ",Ev(x)]})]}),S>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," or ",a.jsx("code",{children:"codex"})," 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 and Codex sessions, and press"," ",a.jsx("kbd",{children:CC})," for the command palette."]})]})})}const EC=[],dl=50;function _C(){Bt.trackRender("RenderArea");const e=R(S=>S.activeSessionId),n=R(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=R(S=>S.submittingPrompt),o=R(S=>S.loading),l=R(S=>!S.activeSessionId&&!uN(S.workspaces,S.sessions,S.appsRootPath)),c=(n==null?void 0:n.turns)??[],d=(n==null?void 0:n.threads)??EC,f=y.useRef(null),[h,m]=y.useState(dl);y.useEffect(()=>{m(dl)},[e]);const v=c.filter(S=>!S.thread_id),k=Math.max(0,v.length-h),x=v.slice(k);return y.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[e,c.length]),o&&!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:f,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+dl),children:["Show ",Math.min(dl,k)," earlier turns (",k," hidden)"]})}),x.map((S,j)=>a.jsx("div",{id:`turn-${k+j}`,className:"turn-block",children:a.jsx(TC,{turn:S,runtimeType:n.runtime_type,threads:d})},S.id))]}):l?a.jsx(jC,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const RC=y.memo(_C),AC=[{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 IC(e){return e.map(n=>({id:n.name,label:`/${n.name}`,hint:n.description,capability:null,insertAsText:!0}))}function DC(e,n,r=[]){const o=[...AC,...IC(r)],l=new Set;return o.filter(c=>!(l.has(c.label)||(l.add(c.label),c.capability&&!n[c.capability])||e&&!c.label.toLowerCase().includes(e.toLowerCase())))}function MC({commands:e,selectedIndex:n,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),e.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),e.map((l,c)=>a.jsxs("div",{className:`slash-popup-item ${c===n?"selected":""}`,onMouseEnter:()=>o(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 pd({title:e,options:n,currentValue:r,onSelect:o,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:e})]}),n.map(c=>a.jsxs("div",{className:`slash-popup-item ${c.value===r?"selected":""}`,onClick:()=>o(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 LC(e){return jt("/skills")}function OC({filter:e,onSelect:n,onClose:r}){const[o,l]=y.useState([]),[c,d]=y.useState(!0),[f,h]=y.useState(0),m=y.useRef(null);y.useEffect(()=>{LC().then(l).catch(()=>l([])).finally(()=>d(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(e.toLowerCase())||k.description.toLowerCase().includes(e.toLowerCase()));return y.useEffect(()=>{h(0)},[e]),y.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),h(S=>Math.min(S+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),h(S=>Math.max(S-1,0))):x.key==="Enter"?(x.preventDefault(),v[f]&&n(v[f])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,f,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,x)=>a.jsxs("div",{className:`slash-popup-item ${x===f?"selected":""}`,onMouseEnter:()=>h(x),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 sx(){return jt("/providers")}function $C(e,n){const r=n?`?cwd=${encodeURIComponent(n)}`:"";return jt(`/providers/${e}/commands${r}`)}const PC={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function zC(e){const[n,r]=y.useState([]),[o,l]=y.useState(!0);y.useEffect(()=>{sx().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const c=n.find(d=>d.id===e)??null;return{provider:c,capabilities:(c==null?void 0:c.capabilities)??PC,loading:o}}const wo=32,hd=200;function Ag(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function Ig(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let Dg=0;function FC(){return Dg+=1,`att-${Date.now()}-${Dg}`}function UC(){Bt.trackRender("CommandInputBar");const[e,n]=y.useState(""),r=y.useRef(null),o=y.useRef(wo),l=y.useRef(null),{submitPrompt:c,cancelTurn:d,updateRuntimeConfig:f,setShowModelSelector:h}=R(),m=R(G=>G.activeSessionId),v=R(G=>G.activeSessionId?G.sessionDetails[G.activeSessionId]:null),k=R(G=>G.quotedText),x=kv(v),S=!!(v!=null&&v.turns.some(G=>G.status==="pending"&&G.resume_state==="waiting")),j=!m,{capabilities:N}=zC(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,b=N.imageAttachments,[A,P]=y.useState([]),[L,z]=y.useState(!1),[q,F]=y.useState(null),[O,Q]=y.useState([]);y.useEffect(()=>{if(!T){Q([]);return}let G=!1;return $C(T,(v==null?void 0:v.cwd)??void 0).then(we=>{G||Q(we)}).catch(()=>{G||Q([])}),()=>{G=!0}},[T,v==null?void 0:v.cwd]);const[J,te]=y.useState(!1),[me,ke]=y.useState(""),[Le,Te]=y.useState(0),[oe,ee]=y.useState(void 0),[Y,ae]=y.useState(!1),[K,E]=y.useState(""),[M,de]=y.useState([]),U=J?DC(me,N,O):[];y.useEffect(()=>{k!==null&&(n(G=>G+k),setTimeout(()=>{if(r.current){le(),r.current.focus();const G=r.current.value.length;r.current.setSelectionRange(G,G)}},0),R.setState({quotedText:null}))},[k]),y.useEffect(()=>{if(!x)return;function G(we){we.key==="Escape"&&(we.preventDefault(),d())}return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[x,d]),y.useEffect(()=>{te(!1),ee(void 0),ae(!1),de([]),P(G=>{for(const we of G)we.previewUrl&&URL.revokeObjectURL(we.previewUrl);return[]})},[m]),y.useEffect(()=>{if(!q)return;function G(we){we.key==="Escape"&&(we.preventDefault(),F(null))}return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[q]);const ue=y.useCallback(G=>{if(!G)return;const we=Array.from(G);for(const ze of we){const Ye=new FileReader;Ye.onload=()=>{const xt=Ye.result.split(",")[1]??"",Z=ze.type.startsWith("image/")?URL.createObjectURL(ze):void 0;P(Pe=>[...Pe,{id:FC(),name:ze.name,media_type:ze.type||"application/octet-stream",data:xt,previewUrl:Z,size:ze.size}])},Ye.readAsDataURL(ze)}},[]),X=y.useCallback(G=>{P(we=>{const ze=we.find(Ye=>Ye.id===G);return ze!=null&&ze.previewUrl&&URL.revokeObjectURL(ze.previewUrl),we.filter(Ye=>Ye.id!==G)})},[]),ve=y.useCallback(G=>{G.preventDefault(),G.stopPropagation(),!(!b||x)&&z(!0)},[b,x]),xe=y.useCallback(G=>{G.preventDefault(),G.stopPropagation(),z(!1)},[]),Ae=y.useCallback(G=>{G.preventDefault(),G.stopPropagation(),z(!1),!(!b||x)&&ue(G.dataTransfer.files)},[b,x,ue]),Ce=y.useCallback(G=>{var Ye;if(!b)return;const we=(Ye=G.clipboardData)==null?void 0:Ye.items;if(!we)return;const ze=[];for(let yt=0;yt<we.length;yt++){const xt=we[yt];if(xt.type.startsWith("image/")){const Z=xt.getAsFile();Z&&ze.push(Z)}}ze.length>0&&(G.preventDefault(),ue(ze))},[b,ue]);function ge(G){const we=r.current;we&&(we.style.height=`${G}px`,o.current=G)}function le(){const G=r.current;if(G){if(G.scrollHeight>G.clientHeight){const we=Math.min(G.scrollHeight,hd);we!==o.current&&ge(we);return}o.current>wo&&(G.style.height="auto",ge(Math.min(G.scrollHeight,hd)))}}function Qe(){const G=e.trim();if(!G||x)return;let we=G;M.length>0&&(we=`${M.map(yt=>`$${yt.name}`).join(" ")}
689
689
 
690
- ${G}`);const ze=A.map(({id:Ye,previewUrl:vt,size:yt,...Z})=>Z);n(""),de([]),ge(wo),te(!1),ee(void 0),ae(!1);for(const Ye of A)Ye.previewUrl&&URL.revokeObjectURL(Ye.previewUrl);P([]),c(we,ze.length>0?ze:void 0)}function Ee(G){if(G.insertAsText){const we=`/${G.id} `;n(we),te(!1),ee(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const ze=we.length;r.current.setSelectionRange(ze,ze),le()}});return}G.subPopup?ee(G.subPopup):G.id==="skills"?(ae(!0),E(""),te(!1),n("")):G.id==="model"?(h(!0),te(!1),n("")):(te(!1),n(""))}function et(G){de(we=>[...we,G]),ae(!1),n(""),ge(wo)}function He(G){const we=Ag(v==null?void 0:v.runtime_config);oe==="sandbox"?we.sandboxMode=G:oe==="websearch"?we.webSearchMode=G:oe==="network"&&(we.networkAccessEnabled=G==="true"),f(we),ee(void 0),te(!1),n(""),ge(wo)}function Se(G){if(Bt.markKeystroke(),J&&!oe){if(G.key==="ArrowDown"){G.preventDefault(),Te(we=>Math.min(we+1,U.length-1));return}if(G.key==="ArrowUp"){G.preventDefault(),Te(we=>Math.max(we-1,0));return}if(G.key==="Enter"){G.preventDefault(),U[Le]&&Ee(U[Le]);return}if(G.key==="Escape"){G.preventDefault(),te(!1),n("");return}}if(oe&&G.key==="Escape"){G.preventDefault(),ee(void 0);return}if(G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&!x){G.preventDefault(),Qe();return}G.key==="Escape"&&x&&(G.preventDefault(),d())}function Be(G){Bt.markInputChange();const we=G.target.value;n(we),le(),we.startsWith("/")&&!we.includes(" ")&&!x?(te(!0),ke(we.slice(1)),Te(0)):(te(!1),ee(void 0)),we.startsWith("$")&&!x?(ae(!0),E(we.slice(1))):we.startsWith("$")||ae(!1)}const Xe=Ag(v==null?void 0:v.runtime_config),at=[{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"}],kt=[{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${L?" drag-over":""}`,onDragOver:ve,onDragLeave:xe,onDrop:Ae,children:[J&&!oe&&a.jsx(AC,{commands:U,selectedIndex:Le,onSelect:Ee,onHover:Te}),J&&oe==="sandbox"&&a.jsx(pd,{title:"Sandbox Mode",options:at,currentValue:Xe.sandboxMode,onSelect:He,onClose:()=>ee(void 0)}),J&&oe==="websearch"&&a.jsx(pd,{title:"Web Search",options:kt,currentValue:Xe.webSearchMode,onSelect:He,onClose:()=>ee(void 0)}),J&&oe==="network"&&a.jsx(pd,{title:"Network Access",options:Ot,currentValue:Xe.networkAccessEnabled===!0?"true":"false",onSelect:He,onClose:()=>ee(void 0)}),Y&&a.jsx(DC,{filter:K,onSelect:et,onClose:()=>{ae(!1),n("")}}),M.length>0&&a.jsx("div",{className:"skill-badges",children:M.map(G=>a.jsxs("span",{className:"skill-badge",children:["$",G.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>de(we=>we.filter(ze=>ze.id!==G.id)),children:"×"})]},G.id))}),A.length>0&&a.jsx("div",{className:"attachment-preview-area",children:A.map(G=>a.jsxs("div",{className:"attachment-chip",title:G.name,children:[G.previewUrl?a.jsx("img",{src:G.previewUrl,alt:G.name,className:"attachment-thumb",onClick:()=>F(G),style:{cursor:"pointer"}}):a.jsx(Fv,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:G.name}),a.jsx("span",{className:"attachment-size",children:Ig(G.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>X(G.id),title:"Remove attachment",children:a.jsx(jn,{size:14})})]},G.id))}),b&&!x&&!j&&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:G=>{ue(G.target.files),G.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[b&&!x&&!j&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var G;return(G=l.current)==null?void 0:G.click()},title:"Attach files",disabled:x,children:a.jsx(eS,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:j?"Select or create a session…":S?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:e,disabled:x||j,rows:1,style:{minHeight:wo,maxHeight:hd},onChange:Be,onKeyDown:Se,onPaste:Ce}),x?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(yr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:Qe,disabled:!e.trim()||j,title:"Send (⌘↵)",children:a.jsx(Pv,{size:16})})]}),q&&a.jsx("div",{className:"image-preview-modal",onClick:()=>F(null),children:a.jsxs("div",{className:"image-preview-content",onClick:G=>G.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:Ig(q.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>F(null),children:a.jsx(jn,{size:20})})]})})]})}function zC(){const e=R(T=>T.activeSessionId),n=R(T=>T.activeSessionId?T.sessionDetails[T.activeSessionId]:null),r=R(T=>T.activeTurnIndex),o=R(T=>T.setActiveTurnIndex),l=R(T=>T.rewindToTurn),c=R(T=>T.restoreSession),d=R(T=>T.branchFromTurn),f=(n==null?void 0:n.turns)??[],h=Xl(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 until you send the next message, which deletes them.",[x,S]=y.useState(null),j=y.useRef(null);if(Vi(j,()=>S(null),!!x),Do(()=>S(null),!!x),f.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function N(T){o(T),requestAnimationFrame(()=>{var b;(b=document.getElementById(`turn-${T}`))==null||b.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),f.map((T,b)=>{const A=b===r,P=T.user_prompt.length>50?T.user_prompt.slice(0,50)+"…":T.user_prompt,L=T.status==="running"||T.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${A?"active":""}`,onClick:()=>N(b),onContextMenu:z=>{z.preventDefault(),S({x:z.clientX,y:z.clientY,turnId:T.id,turnIndex:b,isLast:b===f.length-1,isSlashCommand:T.user_prompt.trimStart().startsWith("/")})},children:[T.origin==="peer"?a.jsx("span",{className:"turn-item-icon",style:{background:"var(--purple)",color:"#fff"},title:Kl(T.origin_name),children:a.jsx(Gv,{size:12})}):a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(cS,{size:12})}),a.jsx("span",{className:"turn-item-label",children:P}),L&&a.jsx("span",{className:"turn-item-status",children:T.status==="pending"&&T.resume_state==="waiting"?"interrupted":"running…"})]})},T.id)}),x&&a.jsxs("div",{ref:j,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${x.isLast||h||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||h||x.isSlashCommand||(window.confirm(k)&&l(e,x.turnId),S(null))},children:[a.jsx(sS,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(e),S(null)},children:[a.jsx(zi,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(e,x.turnId),S(null)},children:[a.jsx(Bv,{size:12})," Branch from Here"]})]})]})}const FC={subagent:vr,monitor:Yv,command:tc,task:zv},Mg=2e4;function UC(e){const n=[];return e.forEach((r,o)=>{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:o,turnPrompt:r.user_prompt})}}),n}function BC({entry:e,sessionId:n}){const{item:r,turnIndex:o,turnPrompt:l}=e,c=R(ee=>ee.addToast),[d,f]=y.useState(!1),h=r.data||{},m=h.task_type||"unknown",v=h.subagent_type||null,k=h.description||"",x=h.summary||null,S=h.last_tool_name||null,j=h.token_count||null,N=h.output||"",T=r.status==="in_progress",b=h.status||"running",A=!T&&b==="running"?"stopped":b,P=h.task_id||null,L=FC[jf(m)],z=Zy(m,v),q=A==="running"?"running…":A==="completed"?"done":A==="failed"?"failed":A==="stopped"?"stopped":A,F=A==="failed"||r.status==="failed"&&A!=="stopped",[O,Q]=y.useState(T),[J,te]=y.useState(!1),me=y.useRef(null);y.useEffect(()=>{T&&Q(!0)},[T]),y.useEffect(()=>{O&&T&&me.current&&(me.current.scrollTop=me.current.scrollHeight)},[O,T,N]);const ke=N.length>Mg,Le=ke&&!J?N.slice(0,Mg)+`
691
- … (truncated, click to expand)`:N,Te=T?null:A==="completed"?a.jsx(ps,{size:12}):F?a.jsx(ec,{size:12}):a.jsx(yr,{size:12});async function oe(ee){if(ee.stopPropagation(),!(!n||!P||d)){f(!0);try{await N0(n,P)}catch(Y){c("error",`Could not stop the task — ${Y.message}`)}finally{f(!1)}}}return a.jsxs("div",{className:`task-card ${T?"task-running":""} ${F?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Q(ee=>!ee),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(L,{size:14})}),a.jsx("span",{className:"task-card-type",children:z}),a.jsxs("span",{className:`task-card-status ${F?"task-status-failed":T?"task-status-running":"task-status-done"}`,children:[Te," ",q]}),T&&P&&n&&a.jsxs("button",{className:"task-card-stop",onClick:oe,disabled:d,title:"Stop this task","aria-label":"Stop task",children:[a.jsx(yr,{size:10})," ",d?"Stopping…":"Stop"]}),a.jsx($i,{size:14,className:"task-card-chevron",style:{transform:O?"rotate(90deg)":"none",marginLeft:"auto"}})]}),k&&a.jsx("div",{className:"task-card-desc",children:k}),T&&S&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",S,j!=null&&` · ${j.toLocaleString()} tokens`]}),O&&a.jsxs("div",{className:"task-card-body",children:[N?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:me,children:a.jsx("code",{children:Le})}),ke&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>te(ee=>!ee),children:J?"Show less":`Show full output (${(N.length/1024).toFixed(0)}KB)`})]}):x?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:x})}):T?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:l,children:["from turn ",o+1,": ",l.length>60?l.slice(0,60)+"…":l]})]})]})}const WC=y.memo(BC);function HC(){const e=R(f=>f.activeSessionId),n=R(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),r=R(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),o=(n==null?void 0:n.turns)??[],l=UC(o),c=[...l].sort((f,h)=>{const m=f.item.status==="in_progress",v=h.item.status==="in_progress";return m&&!v?-1:!m&&v?1:h.turnIndex-f.turnIndex}),d=Cf(r);return l.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 (",l.length,")",d>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",d," running"]})]}),c.map(f=>a.jsx(WC,{entry:f,sessionId:e},f.item.id))]})}const VC=y.memo(HC),KC="Your job is to answer questions about this session:",Lg="Understand the user's question below, read the session file given above, and answer.",GC=new Set(["claude","codex"]);function qC(e){return GC.has(e)}function Ef(e){return e.kind==="sidecar"}function XC(e){const n=(e??[]).filter(Ef);return n.length?n[n.length-1]:null}function YC(e){if(!e.startsWith(KC))return e;const n=e.indexOf(Lg);return n<0?e:e.slice(n+Lg.length).replace(/^\n+/,"")}function QC({thread:e,onClose:n}){const{activeSessionId:r,resolveThread:o,shareThread:l}=R(),[c,d]=y.useState(""),[f,h]=y.useState(!1),[m,v]=y.useState(!1);async function k(){if(!r||f)return;h(!0),await l(r,e.id,c)?n():h(!1)}async function x(){!r||m||(v(!0),await o(r,e.id),n())}const S=f||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:a.jsxs("div",{className:"dialog",onClick:j=>j.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(jn,{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:j=>d(j.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:x,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(on,{size:13,className:"spin"}):a.jsx(Al,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[f?a.jsx(on,{size:13,className:"spin"}):a.jsx(iS,{size:13}),f?"Summarizing…":"Share & Resolve"]})]})]})})}const Og=[];Je.setOptions({breaks:!0,gfm:!0});function ZC(e){const n=Je.parse(e);return Tf.sanitize(n)}function JC(e){var n,r,o;if(e.type==="agent_message"||e.type==="final_result"){const l=(n=e.data)==null?void 0:n.text;return typeof l=="string"&&l?l:null}if(e.type==="ask_user"){const l=Array.isArray((r=e.data)==null?void 0:r.groups)?e.data.groups:[],c=[(o=e.data)==null?void 0:o.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
690
+ ${G}`);const ze=A.map(({id:Ye,previewUrl:yt,size:xt,...Z})=>Z);n(""),de([]),ge(wo),te(!1),ee(void 0),ae(!1);for(const Ye of A)Ye.previewUrl&&URL.revokeObjectURL(Ye.previewUrl);P([]),c(we,ze.length>0?ze:void 0)}function Ee(G){if(G.insertAsText){const we=`/${G.id} `;n(we),te(!1),ee(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const ze=we.length;r.current.setSelectionRange(ze,ze),le()}});return}G.subPopup?ee(G.subPopup):G.id==="skills"?(ae(!0),E(""),te(!1),n("")):G.id==="model"?(h(!0),te(!1),n("")):(te(!1),n(""))}function et(G){de(we=>[...we,G]),ae(!1),n(""),ge(wo)}function He(G){const we=Ag(v==null?void 0:v.runtime_config);oe==="sandbox"?we.sandboxMode=G:oe==="websearch"?we.webSearchMode=G:oe==="network"&&(we.networkAccessEnabled=G==="true"),f(we),ee(void 0),te(!1),n(""),ge(wo)}function Se(G){if(Bt.markKeystroke(),J&&!oe){if(G.key==="ArrowDown"){G.preventDefault(),Te(we=>Math.min(we+1,U.length-1));return}if(G.key==="ArrowUp"){G.preventDefault(),Te(we=>Math.max(we-1,0));return}if(G.key==="Enter"){G.preventDefault(),U[Le]&&Ee(U[Le]);return}if(G.key==="Escape"){G.preventDefault(),te(!1),n("");return}}if(oe&&G.key==="Escape"){G.preventDefault(),ee(void 0);return}if(G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&!x){G.preventDefault(),Qe();return}G.key==="Escape"&&x&&(G.preventDefault(),d())}function Be(G){Bt.markInputChange();const we=G.target.value;n(we),le(),we.startsWith("/")&&!we.includes(" ")&&!x?(te(!0),ke(we.slice(1)),Te(0)):(te(!1),ee(void 0)),we.startsWith("$")&&!x?(ae(!0),E(we.slice(1))):we.startsWith("$")||ae(!1)}const Xe=Ag(v==null?void 0:v.runtime_config),at=[{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"}],kt=[{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${L?" drag-over":""}`,onDragOver:ve,onDragLeave:xe,onDrop:Ae,children:[J&&!oe&&a.jsx(MC,{commands:U,selectedIndex:Le,onSelect:Ee,onHover:Te}),J&&oe==="sandbox"&&a.jsx(pd,{title:"Sandbox Mode",options:at,currentValue:Xe.sandboxMode,onSelect:He,onClose:()=>ee(void 0)}),J&&oe==="websearch"&&a.jsx(pd,{title:"Web Search",options:kt,currentValue:Xe.webSearchMode,onSelect:He,onClose:()=>ee(void 0)}),J&&oe==="network"&&a.jsx(pd,{title:"Network Access",options:Ot,currentValue:Xe.networkAccessEnabled===!0?"true":"false",onSelect:He,onClose:()=>ee(void 0)}),Y&&a.jsx(OC,{filter:K,onSelect:et,onClose:()=>{ae(!1),n("")}}),M.length>0&&a.jsx("div",{className:"skill-badges",children:M.map(G=>a.jsxs("span",{className:"skill-badge",children:["$",G.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>de(we=>we.filter(ze=>ze.id!==G.id)),children:"×"})]},G.id))}),A.length>0&&a.jsx("div",{className:"attachment-preview-area",children:A.map(G=>a.jsxs("div",{className:"attachment-chip",title:G.name,children:[G.previewUrl?a.jsx("img",{src:G.previewUrl,alt:G.name,className:"attachment-thumb",onClick:()=>F(G),style:{cursor:"pointer"}}):a.jsx(Wv,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:G.name}),a.jsx("span",{className:"attachment-size",children:Ig(G.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>X(G.id),title:"Remove attachment",children:a.jsx(jn,{size:14})})]},G.id))}),b&&!x&&!j&&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:G=>{ue(G.target.files),G.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[b&&!x&&!j&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var G;return(G=l.current)==null?void 0:G.click()},title:"Attach files",disabled:x,children:a.jsx(sS,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:j?"Select or create a session…":S?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:e,disabled:x||j,rows:1,style:{minHeight:wo,maxHeight:hd},onChange:Be,onKeyDown:Se,onPaste:Ce}),x?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>d(),title:"Stop (Esc)",children:a.jsx(yr,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:Qe,disabled:!e.trim()||j,title:"Send (⌘↵)",children:a.jsx(Uv,{size:16})})]}),q&&a.jsx("div",{className:"image-preview-modal",onClick:()=>F(null),children:a.jsxs("div",{className:"image-preview-content",onClick:G=>G.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:Ig(q.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>F(null),children:a.jsx(jn,{size:20})})]})})]})}function BC(){const e=R(T=>T.activeSessionId),n=R(T=>T.activeSessionId?T.sessionDetails[T.activeSessionId]:null),r=R(T=>T.activeTurnIndex),o=R(T=>T.setActiveTurnIndex),l=R(T=>T.rewindToTurn),c=R(T=>T.restoreSession),d=R(T=>T.branchFromTurn),f=(n==null?void 0:n.turns)??[],h=Xl(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 until you send the next message, which deletes them.",[x,S]=y.useState(null),j=y.useRef(null);if(Vi(j,()=>S(null),!!x),Do(()=>S(null),!!x),f.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function N(T){o(T),requestAnimationFrame(()=>{var b;(b=document.getElementById(`turn-${T}`))==null||b.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),f.map((T,b)=>{const A=b===r,P=T.user_prompt.length>50?T.user_prompt.slice(0,50)+"…":T.user_prompt,L=T.status==="running"||T.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${A?"active":""}`,onClick:()=>N(b),onContextMenu:z=>{z.preventDefault(),S({x:z.clientX,y:z.clientY,turnId:T.id,turnIndex:b,isLast:b===f.length-1,isSlashCommand:T.user_prompt.trimStart().startsWith("/")})},children:[T.origin==="peer"?a.jsx("span",{className:"turn-item-icon",style:{background:"var(--purple)",color:"#fff"},title:Kl(T.origin_name),children:a.jsx(Yv,{size:12})}):a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(fS,{size:12})}),a.jsx("span",{className:"turn-item-label",children:P}),L&&a.jsx("span",{className:"turn-item-status",children:T.status==="pending"&&T.resume_state==="waiting"?"interrupted":"running…"})]})},T.id)}),x&&a.jsxs("div",{ref:j,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${x.isLast||h||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||h||x.isSlashCommand||(window.confirm(k)&&l(e,x.turnId),S(null))},children:[a.jsx(iS,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{c(e),S(null)},children:[a.jsx(zi,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{d(e,x.turnId),S(null)},children:[a.jsx(Vv,{size:12})," Branch from Here"]})]})]})}const WC={subagent:vr,monitor:Jv,command:tc,task:Bv},Mg=2e4;function HC(e){const n=[];return e.forEach((r,o)=>{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:o,turnPrompt:r.user_prompt})}}),n}function VC({entry:e,sessionId:n}){const{item:r,turnIndex:o,turnPrompt:l}=e,c=R(ee=>ee.addToast),[d,f]=y.useState(!1),h=r.data||{},m=h.task_type||"unknown",v=h.subagent_type||null,k=h.description||"",x=h.summary||null,S=h.last_tool_name||null,j=h.token_count||null,N=h.output||"",T=r.status==="in_progress",b=h.status||"running",A=!T&&b==="running"?"stopped":b,P=h.task_id||null,L=WC[jf(m)],z=tx(m,v),q=A==="running"?"running…":A==="completed"?"done":A==="failed"?"failed":A==="stopped"?"stopped":A,F=A==="failed"||r.status==="failed"&&A!=="stopped",[O,Q]=y.useState(T),[J,te]=y.useState(!1),me=y.useRef(null);y.useEffect(()=>{T&&Q(!0)},[T]),y.useEffect(()=>{O&&T&&me.current&&(me.current.scrollTop=me.current.scrollHeight)},[O,T,N]);const ke=N.length>Mg,Le=ke&&!J?N.slice(0,Mg)+`
691
+ … (truncated, click to expand)`:N,Te=T?null:A==="completed"?a.jsx(ps,{size:12}):F?a.jsx(ec,{size:12}):a.jsx(yr,{size:12});async function oe(ee){if(ee.stopPropagation(),!(!n||!P||d)){f(!0);try{await j0(n,P)}catch(Y){c("error",`Could not stop the task — ${Y.message}`)}finally{f(!1)}}}return a.jsxs("div",{className:`task-card ${T?"task-running":""} ${F?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Q(ee=>!ee),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(L,{size:14})}),a.jsx("span",{className:"task-card-type",children:z}),a.jsxs("span",{className:`task-card-status ${F?"task-status-failed":T?"task-status-running":"task-status-done"}`,children:[Te," ",q]}),T&&P&&n&&a.jsxs("button",{className:"task-card-stop",onClick:oe,disabled:d,title:"Stop this task","aria-label":"Stop task",children:[a.jsx(yr,{size:10})," ",d?"Stopping…":"Stop"]}),a.jsx($i,{size:14,className:"task-card-chevron",style:{transform:O?"rotate(90deg)":"none",marginLeft:"auto"}})]}),k&&a.jsx("div",{className:"task-card-desc",children:k}),T&&S&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",S,j!=null&&` · ${j.toLocaleString()} tokens`]}),O&&a.jsxs("div",{className:"task-card-body",children:[N?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:me,children:a.jsx("code",{children:Le})}),ke&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>te(ee=>!ee),children:J?"Show less":`Show full output (${(N.length/1024).toFixed(0)}KB)`})]}):x?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:x})}):T?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:l,children:["from turn ",o+1,": ",l.length>60?l.slice(0,60)+"…":l]})]})]})}const KC=y.memo(VC);function GC(){const e=R(f=>f.activeSessionId),n=R(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),r=R(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),o=(n==null?void 0:n.turns)??[],l=HC(o),c=[...l].sort((f,h)=>{const m=f.item.status==="in_progress",v=h.item.status==="in_progress";return m&&!v?-1:!m&&v?1:h.turnIndex-f.turnIndex}),d=Cf(r);return l.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 (",l.length,")",d>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",d," running"]})]}),c.map(f=>a.jsx(KC,{entry:f,sessionId:e},f.item.id))]})}const qC=y.memo(GC),XC="Your job is to answer questions about this session:",Lg="Understand the user's question below, read the session file given above, and answer.",YC=new Set(["claude","codex"]);function QC(e){return YC.has(e)}function Ef(e){return e.kind==="sidecar"}function ZC(e){const n=(e??[]).filter(Ef);return n.length?n[n.length-1]:null}function JC(e){if(!e.startsWith(XC))return e;const n=e.indexOf(Lg);return n<0?e:e.slice(n+Lg.length).replace(/^\n+/,"")}function ej({thread:e,onClose:n}){const{activeSessionId:r,resolveThread:o,shareThread:l}=R(),[c,d]=y.useState(""),[f,h]=y.useState(!1),[m,v]=y.useState(!1);async function k(){if(!r||f)return;h(!0),await l(r,e.id,c)?n():h(!1)}async function x(){!r||m||(v(!0),await o(r,e.id),n())}const S=f||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:n,children:a.jsxs("div",{className:"dialog",onClick:j=>j.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(jn,{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:j=>d(j.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:x,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(on,{size:13,className:"spin"}):a.jsx(Al,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[f?a.jsx(on,{size:13,className:"spin"}):a.jsx(cS,{size:13}),f?"Summarizing…":"Share & Resolve"]})]})]})})}const Og=[];Je.setOptions({breaks:!0,gfm:!0});function tj(e){const n=Je.parse(e);return Tf.sanitize(n)}function nj(e){var n,r,o;if(e.type==="agent_message"||e.type==="final_result"){const l=(n=e.data)==null?void 0:n.text;return typeof l=="string"&&l?l:null}if(e.type==="ask_user"){const l=Array.isArray((r=e.data)==null?void 0:r.groups)?e.data.groups:[],c=[(o=e.data)==null?void 0:o.question,...l.map(d=>d.question)].filter(d=>typeof d=="string"&&!!d);return c.length?c.join(`
692
692
 
693
- `):null}return null}function ej(e){const n=e.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:e}function tx({turn:e,formatPrompt:n=ej}){var d,f;const r=e.origin==="peer",o=r?e.user_prompt:n(e.user_prompt),l=[];for(const h of e.items){if(h.type==="peer_message"){const v=(d=h.data)==null?void 0:d.body;typeof v=="string"&&v&&l.push({peer:!0,text:v,name:(f=h.data)==null?void 0:f.name});continue}const m=JC(h);m!==null&&l.push({peer:!1,text:m})}const c=l.some(h=>!h.peer);return!c&&e.status==="completed"&&e.agent_response&&l.push({peer:!1,text:e.agent_response}),a.jsxs("div",{className:"thread-card-turn",children:[r?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Kl(e.origin_name)}),o]}):a.jsx("div",{className:"thread-card-user-message",children:o}),l.map((h,m)=>h.peer?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Kl(h.name)}),h.text]},m):a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:ZC(h.text)}},m)),!c&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:e.status==="running"?"AI is responding…":"Waiting…"}),e.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:e.error||"Turn failed"})]})}function tj({thread:e,threadTurns:n,onStop:r,onResolve:o,onReopen:l,onDelete:c,onFollowup:d,onLocate:f}){var ke,Le,Te;const[h,m]=y.useState(""),[v,k]=y.useState(!0),x=y.useRef(null),S=y.useRef(null),[j,N]=y.useState(!1),[T,b]=y.useState({x:0,y:0}),[A,P]=y.useState(""),L=n.some(Bs),z=28,q=120,F=y.useRef(z);y.useEffect(()=>{const oe=S.current;oe&&(oe.scrollTop=oe.scrollHeight)},[n.length,v]);function O(oe){const ee=x.current;ee&&(ee.style.height=`${oe}px`,F.current=oe)}function Q(){const oe=x.current;if(oe){if(oe.scrollHeight>oe.clientHeight){const ee=Math.min(oe.scrollHeight,q);ee!==F.current&&O(ee);return}F.current>z&&(oe.style.height="auto",O(Math.min(oe.scrollHeight,q)))}}const J=y.useCallback(()=>{N(!1)},[]),te=y.useCallback(()=>{const oe=S.current;if(!oe)return;const ee=window.getSelection();if(!ee||ee.rangeCount===0||ee.isCollapsed){N(!1);return}const Y=ee.getRangeAt(0);if(!oe.contains(Y.commonAncestorContainer)){N(!1);return}const ae=Y.commonAncestorContainer.nodeType===Node.TEXT_NODE?Y.commonAncestorContainer.parentElement:Y.commonAncestorContainer;if(!(ae!=null&&ae.closest(".thread-card-ai-response"))){N(!1);return}const K=ee.toString();if(!K.trim()){N(!1);return}const E=Y.getBoundingClientRect(),M=28,de=6,U=170;let ue=!1;if(ee.anchorNode&&ee.focusNode)try{const xe=document.createRange();xe.setStart(ee.focusNode,ee.focusOffset),xe.setEnd(ee.focusNode,ee.focusOffset);const Ae=document.createRange();Ae.setStart(ee.anchorNode,ee.anchorOffset),Ae.setEnd(ee.anchorNode,ee.anchorOffset),ue=Ae.compareBoundaryPoints(Range.START_TO_START,xe)>0}catch{ue=!1}let X=E.top-M-de;X<8&&(X=E.bottom+de);let ve=ue?E.left-U:E.right;ve=Math.max(8,Math.min(ve,window.innerWidth-U-8)),b({x:ve,y:X}),P(K),N(!0)},[]);y.useEffect(()=>{function oe(ee){const Y=ee.target;Y&&Y.closest(".selection-actions")||te()}return document.addEventListener("mouseup",oe),()=>document.removeEventListener("mouseup",oe)},[te]);const me=y.useCallback(()=>{var ee;const oe=`
693
+ `):null}return null}function sj(e){const n=e.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return n?n[1]:e}function rx({turn:e,formatPrompt:n=sj}){var d,f;const r=e.origin==="peer",o=r?e.user_prompt:n(e.user_prompt),l=[];for(const h of e.items){if(h.type==="peer_message"){const v=(d=h.data)==null?void 0:d.body;typeof v=="string"&&v&&l.push({peer:!0,text:v,name:(f=h.data)==null?void 0:f.name});continue}const m=nj(h);m!==null&&l.push({peer:!1,text:m})}const c=l.some(h=>!h.peer);return!c&&e.status==="completed"&&e.agent_response&&l.push({peer:!1,text:e.agent_response}),a.jsxs("div",{className:"thread-card-turn",children:[r?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Kl(e.origin_name)}),o]}):a.jsx("div",{className:"thread-card-user-message",children:o}),l.map((h,m)=>h.peer?a.jsxs("div",{className:"thread-card-user-message thread-card-peer-message",children:[a.jsx("div",{className:"thread-card-peer-label",children:Kl(h.name)}),h.text]},m):a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:tj(h.text)}},m)),!c&&(e.status==="pending"||e.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:e.status==="running"?"AI is responding…":"Waiting…"}),e.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:e.error||"Turn failed"})]})}function rj({thread:e,threadTurns:n,onStop:r,onResolve:o,onReopen:l,onDelete:c,onFollowup:d,onLocate:f}){var ke,Le,Te;const[h,m]=y.useState(""),[v,k]=y.useState(!0),x=y.useRef(null),S=y.useRef(null),[j,N]=y.useState(!1),[T,b]=y.useState({x:0,y:0}),[A,P]=y.useState(""),L=n.some(Bs),z=28,q=120,F=y.useRef(z);y.useEffect(()=>{const oe=S.current;oe&&(oe.scrollTop=oe.scrollHeight)},[n.length,v]);function O(oe){const ee=x.current;ee&&(ee.style.height=`${oe}px`,F.current=oe)}function Q(){const oe=x.current;if(oe){if(oe.scrollHeight>oe.clientHeight){const ee=Math.min(oe.scrollHeight,q);ee!==F.current&&O(ee);return}F.current>z&&(oe.style.height="auto",O(Math.min(oe.scrollHeight,q)))}}const J=y.useCallback(()=>{N(!1)},[]),te=y.useCallback(()=>{const oe=S.current;if(!oe)return;const ee=window.getSelection();if(!ee||ee.rangeCount===0||ee.isCollapsed){N(!1);return}const Y=ee.getRangeAt(0);if(!oe.contains(Y.commonAncestorContainer)){N(!1);return}const ae=Y.commonAncestorContainer.nodeType===Node.TEXT_NODE?Y.commonAncestorContainer.parentElement:Y.commonAncestorContainer;if(!(ae!=null&&ae.closest(".thread-card-ai-response"))){N(!1);return}const K=ee.toString();if(!K.trim()){N(!1);return}const E=Y.getBoundingClientRect(),M=28,de=6,U=170;let ue=!1;if(ee.anchorNode&&ee.focusNode)try{const xe=document.createRange();xe.setStart(ee.focusNode,ee.focusOffset),xe.setEnd(ee.focusNode,ee.focusOffset);const Ae=document.createRange();Ae.setStart(ee.anchorNode,ee.anchorOffset),Ae.setEnd(ee.anchorNode,ee.anchorOffset),ue=Ae.compareBoundaryPoints(Range.START_TO_START,xe)>0}catch{ue=!1}let X=E.top-M-de;X<8&&(X=E.bottom+de);let ve=ue?E.left-U:E.right;ve=Math.max(8,Math.min(ve,window.innerWidth-U-8)),b({x:ve,y:X}),P(K),N(!0)},[]);y.useEffect(()=>{function oe(ee){const Y=ee.target;Y&&Y.closest(".selection-actions")||te()}return document.addEventListener("mouseup",oe),()=>document.removeEventListener("mouseup",oe)},[te]);const me=y.useCallback(()=>{var ee;const oe=`
694
694
  \`\`\`QUOTE
695
695
  ${A}
696
696
  \`\`\`
697
697
 
698
- `;m(Y=>Y+oe),N(!1),P(""),(ee=window.getSelection())==null||ee.removeAllRanges(),setTimeout(()=>{if(x.current){Q(),x.current.focus();const Y=x.current.value.length;x.current.setSelectionRange(Y,Y)}},0)},[A]);return a.jsxs("div",{className:`thread-card ${e.status==="resolved"?"thread-resolved":""}`,id:`thread-${e.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(oe=>!oe),children:[a.jsx("div",{className:"thread-card-quote",children:e.selected_text===null?((Te=(Le=(ke=e.turns)==null?void 0:ke[0])==null?void 0:Le.user_prompt)==null?void 0:Te.slice(0,100))||"Quick question":`“${e.selected_text.slice(0,100)}${e.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[e.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:oe=>{oe.stopPropagation(),f()},title:"Scroll to text",children:a.jsx(Y1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${e.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:e.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:J,children:[n.map(oe=>a.jsx(tx,{turn:oe},oe.id)),n.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),j&&a.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your follow-up",children:[a.jsx(qv,{size:14}),a.jsx("span",{children:"Quote"})]})}),e.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:L?"Agent is running…":"Type a follow-up…",value:h,onChange:oe=>{Bt.markInputChange(),m(oe.target.value),Q()},disabled:L,rows:1,style:{minHeight:z,maxHeight:q},onKeyDown:oe=>{Bt.markKeystroke(),oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&!L&&h.trim()&&(oe.preventDefault(),d(h.trim()),m(""),O(z))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:L||!h.trim(),onClick:()=>{d(h.trim()),m("")},children:a.jsx(Ki,{size:13})}),L&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(yr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[e.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(Al,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(zi,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(fs,{size:13})," Delete"]})]})]})]})}function nj(){Bt.trackRender("ThreadsPanel");const e=R(b=>b.activeSessionId),n=R(b=>{var A;return b.activeSessionId?((A=b.sessionDetails[b.activeSessionId])==null?void 0:A.threads)??Og:Og}),r=y.useMemo(()=>n.filter(b=>!Ef(b)),[n]),o=R(b=>b.followupThread),l=R(b=>b.cancelThreadTurn),c=R(b=>b.reopenThread),d=R(b=>b.deleteThread),f=R(b=>b.deepLinkThreadId),h=R(b=>b.setDeepLinkThreadId),[m,v]=y.useState("open"),[k,x]=y.useState(null);y.useEffect(()=>{if(!f)return;const b=f;h(null),v(P=>r.some(L=>L.id===b&&L.status==="open")?P:"all");const A=setTimeout(()=>{const P=document.getElementById(`thread-${b}`);P&&(P.scrollIntoView({behavior:"smooth",block:"center"}),P.classList.add("thread-card-highlighted"),setTimeout(()=>P.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(A)},[f,h,r]);const S=r.filter(b=>m==="open"?b.status==="open":m==="resolved"?b.status==="resolved":!0),j=r.filter(b=>b.status==="open").length,N=r.filter(b=>b.status==="resolved").length;function T(b){setTimeout(()=>{const A=document.querySelector(`mark[data-thread-id="${b}"]`);A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add("thread-mark-flash"),setTimeout(()=>A.classList.remove("thread-mark-flash"),1500))},50)}return e?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Kv,{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 (",j,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",N,")"]}),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(b=>a.jsx(tj,{thread:b,threadTurns:b.turns??[],onStop:()=>l(e,b.id),onResolve:()=>x(b),onReopen:()=>c(e,b.id),onDelete:()=>d(e,b.id),onFollowup:A=>o(e,b.id,A),onLocate:()=>T(b.id)},b.id)),k&&a.jsx(QC,{thread:k,onClose:()=>x(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function sj(){const e=R(f=>f.apps),n=R(f=>f.activeAppTabId),r=R(f=>f.openAppTab),o=R(f=>f.startAppEdit),l=R(f=>f.toggleAppPin),c=R(f=>f.deleteApp),d=R(f=>f.openAppExport);return e.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:e.map(f=>a.jsxs("div",{className:`apps-panel-row${n===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[a.jsx(Mo,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&a.jsx("span",{className:"apps-panel-desc",children:f.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:h=>{h.stopPropagation(),o(f.id)},children:a.jsx(gl,{size:12})}),a.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:h=>{h.stopPropagation(),l(f.id)},children:a.jsx(Dl,{size:12,fill:f.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action",title:"Export app (.zip)",onClick:h=>{h.stopPropagation(),d(f.id)},children:a.jsx(of,{size:12})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:h=>{h.stopPropagation(),c(f.id)},children:a.jsx(fs,{size:12})})]},f.id))})}const rj=24;function oj(){Bt.trackRender("SidecarPanel");const e=R(b=>b.activeSessionId),n=R(b=>{var A;return b.activeSessionId?(A=b.sessionDetails[b.activeSessionId])==null?void 0:A.runtime_type:void 0}),r=R(b=>{var A;return b.activeSessionId?XC((A=b.sessionDetails[b.activeSessionId])==null?void 0:A.threads):null}),o=R(b=>b.askSidecar),l=R(b=>b.cancelThreadTurn),c=R(b=>b.deleteThread),[d,f]=y.useState(""),[h,m]=y.useState(!1),v=y.useRef(null),k=y.useRef(!0),x=(r==null?void 0:r.turns)??[],S=x[x.length-1],j=x.some(Bs);if(y.useEffect(()=>{k.current=!0},[e,x.length]),y.useEffect(()=>{const b=v.current;b&&k.current&&(b.scrollTop=b.scrollHeight)},[e,x.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!e||!n)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!qC(n))return a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const N=!j&&!h&&d.trim().length>0;async function T(){if(!e||!N)return;m(!0);const b=await o(e,d.trim());m(!1),b&&f("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:b=>{const A=b.currentTarget;k.current=A.scrollHeight-A.scrollTop-A.clientHeight<=rj},children:x.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{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?"})]}):x.map(b=>a.jsx(tx,{turn:b,formatPrompt:YC},b.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:j?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:j,onChange:b=>{Bt.markInputChange(),f(b.target.value)},onKeyDown:b=>{Bt.markKeystroke(),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),T())}}),j&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(e,r.id),children:a.jsx(yr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!N,onClick:()=>void T(),children:a.jsx(Ki,{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:j,onClick:()=>c(e,r.id),children:[a.jsx(fs,{size:13})," Clear"]})})]})]})}function ij(){var h;Bt.trackRender("RightPanel");const e=R(m=>m.activeRightTab),n=R(m=>m.switchRightTab),r=R(m=>m.rightPanelCollapsed),o=R(m=>m.toggleRightPanel),l=R(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=R(m=>m.activeSessionId?Cf(m.backgroundTasks[m.activeSessionId]):0),d=((h=l==null?void 0:l.threads)==null?void 0:h.filter(m=>m.status==="open"&&!Ef(m)).length)??0,f=[{id:"turns",label:"Turns",icon:H1},{id:"sidecar",label:"Sidecar",icon:vr},{id:"tasks",label:"Tasks",icon:W1,badge:c||void 0},{id:"threads",label:"Threads",icon:Kv,badge:d||void 0},{id:"apps",label:"Apps",icon:Vv}];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:o,children:a.jsx(Z1,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),f.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 ${e===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:f.map(m=>a.jsxs("div",{className:`right-tab ${e===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:o,children:a.jsx(Q1,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[e==="turns"&&a.jsx(zC,{}),e==="sidecar"&&a.jsx(oj,{}),e==="tasks"&&a.jsx(VC,{}),e==="threads"&&a.jsx(nj,{}),e==="apps"&&a.jsx(sj,{})]})]})}function Gl(e){return jt(`/vscode-web/status?folder=${encodeURIComponent(e??"")}`)}function nx(e){return ut("/vscode-web/start",{folder:e})}function aj(e){return ut("/vscode-web/heartbeat",{id:e})}const lj=1e3,cj=12e4;function uj(){const e=xt();return e===""||e===window.location.origin}function sx(e){var r;const n=e.activeSessionId?e.sessions.find(o=>o.id===e.activeSessionId):null;return n!=null&&n.cwd?n.cwd:((r=e.workspaces.find(o=>o.deleted===0))==null?void 0:r.path)??null}function rx(e,n,r){return`${xt()}/vscode/${e}/?tkn=${n}${r?`&folder=${encodeURIComponent(r)}`:""}`}async function dj(e){let n=await Gl(e);(n.state==="stopped"||n.state==="error")&&(n=await nx(e));const r=Date.now()+cj;for(;n.state==="starting"&&Date.now()<r;)await new Promise(o=>setTimeout(o,lj)),n=await Gl(e);return n}function md(e,n){try{e.document.title="VS Code",e.document.body.style.cssText="margin:0;height:100vh;display:flex;align-items:center;justify-content:center;font:14px system-ui,sans-serif;color:#555",e.document.body.textContent=n}catch{}}function fj(e,n){const r=window.open("","_blank");if(!r){n();return}r.opener=null,md(r,"Starting VS Code — first start downloads the server component (~20 s)…"),dj(e).then(o=>{r.closed||(o.state==="running"&&o.id&&o.token?r.location.replace(rx(o.id,o.token,e)):md(r,`VS Code could not start${o.error?`: ${o.error}`:"."}`))}).catch(o=>{r.closed||md(r,`VS Code could not start: ${o.message}`)})}const zd=[{id:"codex",label:"Codex",available:!0,models:[]},{id:"claude",label:"Claude",available:!0,models:[]},{id:"repoburg",label:"Repoburg",available:!0,models:[],routesInference:!0}];function pj(e){return zd.find(n=>n.id===e)}function hj(e){const n=pj(e);return(n==null?void 0:n.models)??[]}function ox(e,n){const r=e?Ei(e,n):"",o=R(h=>r?h.modelLists[r]:void 0),l=R(h=>r?!!h.modelsLoading[r]:!1),c=R(h=>h.loadModels),d=y.useCallback(()=>{e&&c(e,n??void 0)},[e,n,c]);return y.useEffect(d,[d]),{models:o??(e?hj(e):[]),loading:l,refresh:d}}const mj=[];function gj(e,n){const r=e?Ei(e,n):"",o=R(m=>r?m.inferenceLists[r]:void 0)??mj,l=R(m=>r?!!m.inferenceLoading[r]:!1),c=R(m=>r?m.inferenceErrors[r]??null:null),d=R(m=>r?!!m.inferenceSignIn[r]:!1),f=R(m=>m.loadInferenceProviders),h=y.useCallback(()=>{e&&f(e,n??void 0)},[e,n,f]);return y.useEffect(h,[h]),{providers:o,loading:l,error:c,signInRequired:d,refresh:h}}function vj({runtimeId:e,provider:n,cwd:r,onChange:o,onCancel:l}){const c=n.configured,[d,f]=y.useState(""),[h,m]=y.useState(n.baseUrl??n.defaultBaseUrl??""),[v,k]=y.useState(!1),[x,S]=y.useState(null),[j,N]=y.useState(!1),T=n.needsBaseUrl&&h.trim()!==(n.baseUrl??""),b=!v&&(d.trim().length>0||c&&T);async function A(L){if(L.preventDefault(),!!b){k(!0),S(null);try{const z=await Nk(e,n.id,{...d.trim()?{apiKey:d.trim()}:{},...n.needsBaseUrl&&h.trim()?{baseUrl:h.trim()}:{},...r?{cwd:r}:{}});f(""),o(z)}catch(z){S(Vn(z))}finally{k(!1)}}}async function P(){if(!j){N(!0);return}k(!0),S(null);try{o(await Tk(e,n.id,r))}catch(L){S(Vn(L))}finally{k(!1),N(!1)}}return a.jsxs("form",{className:"model-selector-keyform",onSubmit:A,children:[a.jsx("div",{className:"model-selector-keyform-title",children:c?`Replace the ${n.label} key`:`${n.label} needs an API key`}),n.description&&a.jsx("div",{className:"model-selector-keyform-desc",children:n.description}),c&&n.maskedKey&&a.jsxs("div",{className:"model-selector-keyform-desc",children:["Saved key ",n.maskedKey,n.source==="project"?" (this workspace)":""]}),n.needsBaseUrl&&a.jsxs("label",{className:"model-selector-keyform-label",children:["Base URL",a.jsx("input",{className:"model-selector-keyform-input",type:"url",value:h,placeholder:n.defaultBaseUrl??"https://host/v1",onChange:L=>m(L.target.value),spellCheck:!1})]}),a.jsxs("label",{className:"model-selector-keyform-label",children:["API key",a.jsx("input",{className:"model-selector-keyform-input",type:"password",value:d,placeholder:c?"New key":n.keyPlaceholder??"API key",onChange:L=>f(L.target.value),autoComplete:"off",spellCheck:!1,autoFocus:!0})]}),x&&a.jsx("div",{className:"model-selector-keyform-error",role:"alert",children:x}),a.jsxs("div",{className:"model-selector-keyform-actions",children:[a.jsx("button",{type:"submit",className:"model-selector-keyform-save",disabled:!b,children:v?"Checking…":"Save and check"}),l&&a.jsx("button",{type:"button",className:"model-selector-keyform-link",onClick:l,disabled:v,children:"Cancel"})]}),n.keyUrl&&a.jsxs("a",{className:"model-selector-keyform-link",href:n.keyUrl,target:"_blank",rel:"noreferrer",children:["Get a key ",a.jsx(af,{size:10})]}),a.jsx("div",{className:"model-selector-keyform-note",children:"Saved for all workspaces in ~/.repoburg."}),c&&a.jsx("button",{type:"button",className:"model-selector-keyform-link model-selector-keyform-remove",onClick:P,disabled:v,children:j?"Click again to remove the key":"Remove key"})]})}const yj=2e3;function xj({onSignedIn:e}){const[n,r]=y.useState(null),[o,l]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(null),m=y.useRef(e);m.current=e;const v=(n==null?void 0:n.state)==="pending";y.useEffect(()=>{let S=!0;return wm().then(j=>{var N;S&&(j.status==="authorized"?l(!0):((N=j.login)==null?void 0:N.state)==="pending"&&r(j.login))}).catch(()=>{}),()=>{S=!1}},[]),y.useEffect(()=>{if(!v)return;let S=!0;const j=setInterval(async()=>{var T,b;const N=await wm().catch(()=>null);!S||!N||(N.status==="authorized"?(S=!1,clearInterval(j),r(null),m.current()):((T=N.login)==null?void 0:T.state)!=="pending"&&(r(null),h(((b=N.login)==null?void 0:b.error)??"The sign-in expired. Try again.")))},yj);return()=>{S=!1,clearInterval(j)}},[v]);async function k(){d(!0),h(null);const S=window.open("about:blank","_blank");try{const j=await jk();r(j),S&&(S.opener=null,S.location.href=j.loginUrl)}catch(j){S==null||S.close(),h(j.message||"Could not start the sign-in.")}finally{d(!1)}}function x(){Ek(),r(null)}return o?a.jsxs("div",{className:"model-selector-keyform model-selector-signin",children:[a.jsx("div",{className:"model-selector-keyform-title",children:"Signed in to Repoburg"}),a.jsx("div",{className:"model-selector-keyform-actions",children:a.jsx("button",{type:"button",className:"model-selector-keyform-save",onClick:()=>m.current(),children:"Start Repoburg"})})]}):a.jsxs("div",{className:"model-selector-keyform model-selector-signin",children:[a.jsx("div",{className:"model-selector-keyform-title",children:"Sign in to Repoburg"}),a.jsx("div",{className:"model-selector-keyform-desc",children:"This machine is not signed in, so Repoburg cannot start in this project."}),v?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"model-selector-keyform-desc",children:["Approve code ",a.jsx("span",{className:"model-selector-signin-code",children:n.userCode})," in the sign-in tab. Waiting…"]}),a.jsxs("div",{className:"model-selector-keyform-actions",children:[a.jsx("a",{className:"model-selector-keyform-link",href:n.loginUrl,target:"_blank",rel:"noreferrer",children:"Open sign-in page"}),a.jsx("button",{type:"button",className:"model-selector-keyform-link",onClick:x,children:"Cancel"})]})]}):a.jsx("div",{className:"model-selector-keyform-actions",children:a.jsx("button",{type:"button",className:"model-selector-keyform-save",onClick:()=>void k(),disabled:c,children:c?"Starting…":"Sign in"})}),f&&a.jsx("div",{className:"model-selector-keyform-error",role:"alert",children:f})]})}const wj=12;function kj(e,n){const r=e.indexOf("/");if(r<=0)return;const o=e.slice(0,r);return n.includes(o)?o:n.includes("openrouter")?"openrouter":void 0}function Sj(){var we,ze,Ye,vt,yt;const{activeSessionId:e,sessions:n,updateModelConfig:r}=R(),o=R(Z=>Z.showModelSelector),l=R(Z=>Z.setShowModelSelector),c=R(Z=>Z.loadModels),d=R(Z=>Z.setInferenceProvider),f=n.find(Z=>Z.id===e),h=R(Z=>e?Z.sessionDetails[e]:void 0),m=f==null?void 0:f.runtime_type,v=zd.find(Z=>Z.id===m),k=!!(v!=null&&v.routesInference),{models:x,loading:S,refresh:j}=ox(m,f==null?void 0:f.cwd),{providers:N,loading:T,error:b,signInRequired:A,refresh:P}=gj(k?m:null,f==null?void 0:f.cwd),[L,z]=y.useState(!1),[q,F]=y.useState(null),[O,Q]=y.useState(!1),[J,te]=y.useState(""),me=y.useRef(null),ke=y.useRef(null);Vi(me,()=>z(!1),L),Do(()=>z(!1),L),y.useEffect(()=>{o&&(z(!0),l(!1))},[o,l]),y.useEffect(()=>{L&&(j(),P(),F(null),Q(!1),te(""))},[L,j,P]);const Le=N.length>0;y.useEffect(()=>{Le&&j()},[Le,j]);const Te=x.length;if(y.useEffect(()=>{var Z,Pe,qe;L&&((qe=(Pe=(Z=ke.current)==null?void 0:Z.querySelector(".model-selector-item.selected"))==null?void 0:Pe.scrollIntoView)==null||qe.call(Pe,{block:"nearest"}))},[L,q,Te]),!f||!m)return null;const oe=f.model??"",ee=f.model_reasoning_effort??"",Y=N.map(Z=>Z.id),ae=(Z,Pe)=>{var qe;return Z.slug===Pe||(((qe=Z.aliases)==null?void 0:qe.includes(Pe))??!1)},K=[...x];oe&&!K.some(Z=>ae(Z,oe))&&K.unshift({slug:oe,displayName:oe,description:"Custom model",defaultReasoning:((we=x[0])==null?void 0:we.defaultReasoning)??"medium",reasoningLevels:((ze=x[0])==null?void 0:ze.reasoningLevels)??[]});function E(Z){return K.find(Pe=>ae(Pe,Z))}function M(Z){var Pe;return((Pe=E(Z))==null?void 0:Pe.reasoningLevels)??[]}function de(Z){var Pe;return(Pe=E(Z))==null?void 0:Pe.defaultReasoning}const U=Z=>Z.inferenceProvider??kj(Z.slug,Y),ue=E(oe),X=oe||(E("default")?"default":""),ve=X?M(X):[],xe=((h==null?void 0:h.turns.length)??0)>0||(((Ye=h==null?void 0:h.threads)==null?void 0:Ye.length)??0)>0,Ae=ue?U(ue):void 0,Ce=N.find(Z=>Z.id===Ae),ge=q??Ae??((vt=N.find(Z=>Z.configured))==null?void 0:vt.id)??((yt=N[0])==null?void 0:yt.id),le=N.find(Z=>Z.id===ge),Qe=(v==null?void 0:v.label)??m,Ee=(ue==null?void 0:ue.displayName)??(oe||"Default"),et=ve.find(Z=>Z.effort===ee),Se=x.some(Z=>ae(Z,X))&&ve.length===0?"Default":(et==null?void 0:et.label)??(ee||"Default");function Be(Z){const Pe=M(Z),qe=Pe.some(xn=>xn.effort===ee),St=de(Z),yn=Pe.length===0?null:qe?ee:St&&Pe.some(xn=>xn.effort===St)?St:null;r(Z,yn),z(!1)}function Xe(Z){r(oe||null,Z),z(!1)}function at(Z){F(Z),Q(!1),te("")}function kt(Z){d(m,(f==null?void 0:f.cwd)??void 0,Z),Q(!1),c(m,(f==null?void 0:f.cwd)??void 0,!0)}function Ot(Z){return Z.map(Pe=>{const qe=ae(Pe,oe);return a.jsxs("div",{className:`model-selector-item ${qe?"selected":""}`,onClick:()=>Be(Pe.slug),title:Pe.slug,children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:Pe.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:Pe.description})]}),qe&&a.jsx(ps,{size:12})]},Pe.slug)})}function G(){if(!le)return a.jsx("div",{className:"model-selector-empty",children:T?"Starting Repoburg…":"Select an inference provider"});if(!le.configured||O)return a.jsx(vj,{runtimeId:m,provider:le,cwd:(f==null?void 0:f.cwd)??void 0,onChange:kt,onCancel:le.configured?()=>Q(!1):void 0},le.id);const Z=K.filter(St=>U(St)===le.id),Pe=J.trim().toLowerCase(),qe=Pe?Z.filter(St=>`${St.displayName} ${St.slug} ${St.description}`.toLowerCase().includes(Pe)):Z;return a.jsxs(a.Fragment,{children:[Z.length>wj&&a.jsx("input",{className:"model-selector-search",type:"search",value:J,placeholder:`Search ${Z.length} models`,onChange:St=>te(St.target.value),autoFocus:!0}),S&&Z.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!S&&Z.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),Z.length>0&&qe.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No model matches"}),Ot(qe),a.jsxs("button",{type:"button",className:"model-selector-key-footer",onClick:()=>Q(!0),children:[a.jsx(Hv,{size:10})," Key ",le.maskedKey??""," · Change"]})]})}return a.jsxs("div",{className:"model-selector",ref:me,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>z(!L),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:Qe}),k&&Ae&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-inference",children:(Ce==null?void 0:Ce.label)??Ae})]}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:Ee}),Se!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:Se})]}),a.jsx(Ro,{size:12,className:"model-selector-chevron"})]}),L&&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"}),zd.map(Z=>{const Pe=xe&&Z.id!==m;return a.jsxs("div",{className:`model-selector-item ${Z.id===m?"selected":""} ${!Z.available||Pe?"disabled":""}`,title:Pe?"A session keeps its provider once it has turns — start a new session to use another provider":void 0,onClick:()=>{if(!(!Z.available||Pe)){if(Z.id===m){Z.routesInference||z(!1);return}r(null,null,Z.id)}},children:[a.jsx("span",{children:Z.label}),!Z.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(G1,{size:10})," Soon"]}),Z.id===m&&a.jsx(ps,{size:12})]},Z.id)})]}),k&&a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Inference"}),N.length===0&&(A&&!T?a.jsx(xj,{onSignedIn:P}):a.jsx("div",{className:"model-selector-empty",children:T?"Starting Repoburg…":b??"No inference providers"})),N.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.id===ge?"selected":""}`,title:Z.configured?`${Z.description} · key ${Z.maskedKey??""}`:`${Z.description} · needs an API key`,onClick:()=>at(Z.id),children:[a.jsx("span",{className:`model-selector-status ${Z.configured?"ready":""}`}),a.jsx("span",{className:"model-selector-item-name",children:Z.label}),!Z.configured&&a.jsx("span",{className:"model-selector-key-tag",children:"Key"}),Z.id===Ae&&a.jsx(ps,{size:12})]},Z.id))]}),a.jsxs("div",{ref:ke,className:`model-selector-column ${k?"model-selector-column-wide":""}`,children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),k?G():a.jsxs(a.Fragment,{children:[S&&K.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!S&&K.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),Ot(K)]})]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),ve.length===0&&a.jsx("div",{className:"model-selector-empty",children:X?"This model has no thinking levels":"Select a model first"}),ve.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.effort===ee?"selected":""}`,onClick:()=>Xe(Z.effort),children:[a.jsx("span",{children:Z.label}),Z.effort===ee&&a.jsx(ps,{size:12})]},Z.effort))]})]})]})}const bj=new Set(["localhost","127.0.0.1","[::1]"]);function Nj(){const e=xt()||window.location.origin;let n;try{n=new URL(e).hostname}catch{return null}return bj.has(n)?`${e}/tabtape/`:null}function Ni(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function $g(){const e=R(r=>r.canGoBack),n=R(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!e,onClick:()=>window.history.back(),children:a.jsx(E1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:a.jsx(_1,{size:14})})]})}function Pg(){const e=R(n=>n.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>e(!0),children:[a.jsx(dS,{size:14})," Repoburg"]})}function zg(){const e=R(r=>r.usageViewOpen),n=R(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Usage Center",onClick:n,children:[a.jsx(Uv,{size:14})," Usage"]})}function Fg(){const e=R(o=>o.vscodeViewOpen),n=R(o=>o.toggleVscodeView);function r(){if(e||uj()){n();return}const o=R.getState();fj(sx(o),()=>o.addToast("error","The browser blocked the VS Code tab — allow pop-ups for this site and try again."))}return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open VS Code",onClick:r,children:[a.jsx(O1,{size:14})," Code"]})}function Ug(){const e=R(r=>r.terminalViewOpen),n=R(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open a terminal",onClick:n,children:[a.jsx(Qv,{size:14})," Terminal"]})}function Bg(){const e=Nj();return e?a.jsxs(a.Fragment,{children:[a.jsxs("a",{className:"sb-item sb-btn sb-link",href:e,target:"_blank",rel:"noopener noreferrer",title:"Open tabtape in a new tab",children:[a.jsx(I1,{size:14})," tabtape"]}),a.jsx("div",{className:"sb-divider",children:"|"})]}):null}function Tj(){Bt.trackRender("StatusBar");const e=R(v=>v.activeSessionId),n=R(v=>e?v.sessions.find(k=>k.id===e)??null:null),r=R(v=>e?v.sessionDetails[e]??null:null),o=R(v=>e?v.backgroundTasks[e]:void 0),l=R(v=>v.wsConnected),c=R(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx($g,{}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Fg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Ug,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(zg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bg,{}),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(Lm,{size:14})," K"]})]});const f=o??[],h=Jl(n,f.length),m=Cf(f);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx($g,{}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Fg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Ug,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(zg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bg,{}),a.jsx(Sj,{}),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(tc,{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:h.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:h.dot==="background"?h.dotTitle:void 0,children:h.label}),d&&a.jsx(Cj,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Lm,{size:14})," K"]})]})}function Cj({usage:e}){const n=e.percentage>=85?"var(--red)":e.percentage>=60?"var(--amber)":"var(--green)",r=`${Ni(e.totalTokens)} / ${Ni(e.contextWindow)} tokens`+(e.autoCompactThreshold?` · auto-compacts at ${Ni(e.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(e.percentage),"% / ",Ni(e.totalTokens)," / ",Ni(e.contextWindow)]})})]})}const jj=1e3,Ej=5*6e4;function _j({children:e}){const n=R(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[e,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(jn,{size:16})})]})}function Rj(){const e=R(x=>x.vscodeState),n=R(x=>x.vscodeId),r=R(x=>x.vscodeToken),o=R(x=>x.setVscodeView),l=R(sx),[c,d]=y.useState(!1),[f,h]=y.useState(0),m=y.useRef(null),v=rx(n??"",r??"",l);y.useEffect(()=>{let x=!1;function S(){m.current&&(clearInterval(m.current),m.current=null)}async function j(){try{let T=await Gl(l);if((T.state==="stopped"||T.state==="error")&&(T=await nx(l)),x||(o(T.state,T.id,T.token),T.state==="running"||T.state==="error"))return;m.current=setInterval(async()=>{const b=await Gl(l);x||(o(b.state,b.id,b.token),(b.state==="running"||b.state==="error"||b.state==="stopped")&&S())},jj)}catch{x||o("error",null,null)}}j();const N=setInterval(()=>{const T=R.getState().vscodeId;T&&aj(T).catch(()=>{})},Ej);return()=>{x=!0,S(),clearInterval(N)}},[f,l,o]);function k(){d(!1),o("starting",null,null),h(x=>x+1)}return e!=="running"||!r||!n?a.jsx(_j,{children:e==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:k,children:[a.jsx(zi,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(on,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(on,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:v,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]})}function Aj(e){const n=new URLSearchParams;return e.since&&n.set("since",e.since),e.until&&n.set("until",e.until),n.set("tz",e.timezone),e.fresh&&n.set("fresh","1"),jt(`/usage/report?${n.toString()}`)}const Ij=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function No(e){return Math.round(e).toLocaleString("en-US")}function ts(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function To(e){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(e)}function _f(e){const n=e.startsWith("anthropic/claude-")?e.slice(17):e.startsWith("claude-")?e.slice(7):e,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const Dj={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function wl(e){return Dj[e]??e.charAt(0).toUpperCase()+e.slice(1)}const ql=e=>String(e).padStart(2,"0");function dc(e){return`${e.getFullYear()}-${ql(e.getMonth()+1)}-${ql(e.getDate())}`}function Mj(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${dc(n)} ${ql(n.getHours())}:${ql(n.getMinutes())}`}function Wg(e,n=new Date){if(e==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return e==="7d"?r.setDate(r.getDate()-6):e==="30d"?r.setDate(r.getDate()-29):e==="month"&&r.setDate(1),{since:dc(r),until:null}}function Hg(e){const n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function Rf(e,n){const r=[],o=new Date(`${e}T00:00:00Z`),l=new Date(`${n}T00:00:00Z`);for(;o<=l&&r.length<3700;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1);return r}const Lj=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Fd(e){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(e);if(!n)return e;const r=Lj[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function Oj(e,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(e))/1e3));if(r<45)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const l=Math.round(o/60);return l<24?`${l} h ago`:dc(new Date(e))}const zr=7,$j=92;function ix(e,n){const r=n.indexOf(e);return r>=0&&r<zr?r:zr}function kl(e){return e<zr?`var(--usage-series-${e+1})`:"var(--usage-series-other)"}function Pj(e,n){return Rf(Hg(e),Hg(n)).filter((r,o)=>o%7===0)}function zj(e,n){const{daily:r}=e;if(r.length===0)return null;const o=e.window.since??r[0].period,l=r[r.length-1].period,c=e.window.until??(n>l?n:l),d=Rf(o,c);if(d.length<2)return null;const f=d.length>$j,h=new Map((f?e.weekly:r).map(x=>[x.period,x])),m=new Map,v=(f?Pj(o,c):d).map(x=>{const S=h.get(x),j=new Map;let N=0;for(const A of(S==null?void 0:S.breakdown)??[]){if(A.cost_usd<=0)continue;const P=ix(A.model,e.model_order),L=j.get(P)??{slot:P,label:P<zr?_f(A.model):"Other",cost:0};L.cost+=A.cost_usd,N+=A.cost_usd,j.set(P,L)}const T=((S==null?void 0:S.cost_usd)??0)-N;if(T>.005){const A=j.get(zr)??{slot:zr,label:"Other",cost:0};A.cost+=T,j.set(zr,A)}const b=[...j.values()].sort((A,P)=>A.slot-P.slot);for(const A of b)m.set(A.slot,A.label);return{period:x,label:f?`Week of ${Fd(x)}`:Fd(x),total:b.reduce((A,P)=>A+P.cost,0),segments:b}});if(!v.some(x=>x.total>0))return null;const k=[...m.entries()].sort((x,S)=>x[0]-S[0]).map(([x,S])=>({slot:x,label:S}));return{unit:f?"week":"day",columns:v,series:k}}function Fj(e){if(!(e>0))return[0,1];if(e<.01)return[0,.01];const n=e/4,r=10**Math.floor(Math.log10(n)),o=n/r,l=(o<=1?1:o<=2?2:o<=2.5?2.5:o<=5?5:10)*r,c=[];for(let d=0;d*l<e+l*1e-9||c.length<2;d++)c.push(d*l);return c[c.length-1]<e&&c.push(c.length*l),c}function Uj(e,n){if(e>=1e4)return`$${To(e)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const ko=e=>`${e}%`;function Bj({data:e}){const{columns:n,series:r,unit:o}=e,[l,c]=y.useState(null),d=y.useMemo(()=>Fj(Math.max(...n.map(N=>N.total))),[n]),f=d[d.length-1],h=d[1]-d[0],m=n.reduce((N,T,b)=>T.total>n[N].total?b:N,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,x=N=>{const T={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};N.key in T&&(N.preventDefault(),c(b=>Math.min(k-1,Math.max(0,(b??k-1)+T[N.key]))))},S=l===null?null:n[l],j=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:o==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&a.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(N=>a.jsxs("li",{className:"usage-legend-item",children:[a.jsx("span",{className:"usage-swatch",style:{background:kl(N.slot)}}),N.label]},N.slot))})]}),a.jsxs("div",{className:"usage-plot-wrap",children:[a.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(N=>a.jsx("span",{className:"usage-ytick",style:{bottom:ko(N/f*100)},children:Uj(N,h)},N))}),a.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${o==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${o}s.`,onKeyDown:x,onFocus:()=>c(N=>N??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(N=>a.jsx("div",{className:`usage-gridline${N===0?" usage-gridline-base":""}`,style:{bottom:ko(N/f*100)}},N)),a.jsx("div",{className:"usage-cols",children:n.map((N,T)=>a.jsxs("div",{className:`usage-col${l===T?" usage-col-active":""}`,"data-period":N.period,onMouseEnter:()=>c(T),children:[T===m&&N.total>0&&l!==T&&a.jsx("span",{className:"usage-peak",style:{bottom:`calc(${ko(N.total/f*100)} + 3px)`},children:ts(N.total)}),N.total>0&&a.jsx("div",{className:"usage-bar",style:{height:ko(N.total/f*100)},children:N.segments.map(b=>a.jsx("div",{className:"usage-seg",style:{flexGrow:b.cost,background:kl(b.slot)}},b.slot))})]},N.period))}),S&&a.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:ko(j),transform:j<20?"translateX(-12px)":j>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((N,T)=>T.cost-N.cost).map(N=>a.jsxs("div",{className:"usage-tooltip-line",children:[a.jsx("span",{className:"usage-swatch",style:{background:kl(N.slot)}}),a.jsx("span",{className:"usage-tooltip-model",children:N.label}),a.jsx("span",{children:ts(N.cost)})]},N.slot))]})]}),a.jsx("div",{}),a.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((N,T)=>(k-1-T)%v===0?a.jsx("span",{className:"usage-xtick",style:{left:ko((T+.5)/k*100),transform:T===0&&k>1?"translateX(-30%)":T===k-1?"translateX(-70%)":"translateX(-50%)"},children:Fd(N.period)},N.period):null)})]})]})}const Vg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],Wj={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},gd=50,Hj={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function Vj(e){return e.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}),Hj)}function vd({t:e}){return a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"usage-num",children:No(e.input_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.output_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.cache_creation_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.cache_read_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.total_tokens)}),a.jsx("td",{className:"usage-num usage-cost",children:ts(e.cost_usd)})]})}function Kj({models:e,order:n}){return a.jsx("span",{className:"usage-models",children:e.map(r=>a.jsxs("span",{className:"usage-model",title:r,children:[a.jsx("span",{className:"usage-swatch",style:{background:kl(ix(r,n))}}),_f(r)]},r))})}function Gj({row:e,onOpen:n}){const r=e.pane_session;if(!r)return a.jsx("span",{className:"usage-session-id usage-session-id-main",title:e.period,children:e.period});const o=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 "${o}"`,onClick:()=>n(r.id),children:o}),r.kind==="discussion"&&a.jsx("span",{className:"usage-tag",children:"discussion"})]}),a.jsx("span",{className:"usage-session-id",title:e.period,children:e.period})]})}function qj({report:e,onOpenSession:n}){var j;const[r,o]=y.useState("daily"),[l,c]=y.useState(!1),[d,f]=y.useState(!1),h=r==="session",m=h?e.sessions:e[r],v=h&&!d?m.slice(0,gd):m,k=h?Vj(e.sessions):e.totals,x=h?10:9,S=Wj[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:Vg.map(N=>a.jsx("button",{role:"tab","aria-selected":r===N.id,className:`usage-tab${r===N.id?" usage-tab-active":""}`,onClick:()=>o(N.id),children:N.label},N.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:N=>c(N.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:(j=Vg.find(N=>N.id===r))==null?void 0:j.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)"}),h&&a.jsx("th",{children:"Last Activity"})]})}),a.jsxs("tbody",{children:[m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:x,className:"usage-empty",children:"No usage in this range."})}),v.map(N=>{const T=h?N:null;return a.jsxs(y.Fragment,{children:[a.jsxs("tr",{className:"usage-row",children:[a.jsx("td",{className:"usage-period",children:T?a.jsx(Gj,{row:T,onOpen:n}):N.period}),a.jsx("td",{children:T?wl(T.agent):N.agents.map(wl).join(", ")}),a.jsx("td",{children:a.jsx(Kj,{models:N.models,order:e.model_order})}),a.jsx(vd,{t:N}),T&&a.jsx("td",{className:"usage-when",children:T.last_activity?Mj(T.last_activity):"—"})]}),l&&N.breakdown.map(b=>a.jsxs("tr",{className:"usage-sub",children:[a.jsx("td",{}),a.jsx("td",{children:wl(b.agent)}),a.jsxs("td",{title:b.model,children:[a.jsx("span",{className:"usage-branch",children:"└─"})," ",_f(b.model)]}),a.jsx(vd,{t:b}),T&&a.jsx("td",{})]},`${b.agent}\0${b.model}`))]},N.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(vd,{t:k}),h&&a.jsx("td",{})]})})]})}),h&&m.length>gd&&a.jsx("button",{className:"usage-more",onClick:()=>f(N=>!N),children:d?`Show the top ${gd}`:`Show all ${m.length} sessions`})]})}const ax="agentpane:usage-budget",Xj=6e4;function Yj(){try{const e=Number(localStorage.getItem(ax));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function Qj(e){try{localStorage.setItem(ax,String(e))}catch{}}function Zj(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Sl({label:e,value:n,title:r,children:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:e}),a.jsx("div",{className:"usage-kpi-value",title:r,children:n}),o]})}function Jj({spent:e}){const[n,r]=y.useState(Yj),o=n>0?e/n:0,l=o>=1?"over":o>=.8?"near":"ok",c=d=>{const f=Number(d.replace(",",".")),h=Number.isFinite(f)&&f>0?f:0;r(h),Qj(h)};return a.jsxs(Sl,{label:"This month",value:ts(e),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(e,n),children:a.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,o*100)}%`}})}),a.jsx("div",{className:`usage-kpi-sub${l==="over"?" usage-over":""}`,children:l==="over"?a.jsxs(a.Fragment,{children:[a.jsx(nc,{size:11})," ",ts(e-n)," over the ",ts(n)," budget"]}):`${ts(n-e)} 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 eE=(e,n)=>e.since===n.since&&e.until===n.until;function tE(){const e=R(P=>P.toggleUsageView),n=R(P=>P.selectSession),[r,o]=y.useState("30d"),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState(!1),v=y.useMemo(Zj,[]),k=y.useRef(0),x=y.useCallback(P=>{const L=++k.current,{since:z,until:q}=Wg(r),F=async O=>{const Q=await Aj({since:z,until:q,timezone:v,fresh:O});L===k.current&&(c(Q),f(null),!O&&Q.generated_at&&Date.now()-Date.parse(Q.generated_at)>Xj&&await F(!0))};m(!0),F(P).catch(O=>{L===k.current&&f(O.message)}).finally(()=>{L===k.current&&m(!1)})},[r,v]);y.useEffect(()=>{x(!1)},[x]),y.useEffect(()=>()=>{k.current++},[]);const S=P=>{e(),n(P)},j=dc(new Date),N=y.useMemo(()=>l?zj(l,j):null,[l,j]),T=h&&l!==null&&!eE(l.window,Wg(r)),b=l==null?void 0:l.totals,A=l&&l.daily.length>0?Rf(l.window.since??l.daily[0].period,l.window.until??j).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(Uv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[Ij.map(P=>a.jsx("button",{className:`usage-range-btn${r===P.id?" usage-range-btn-active":""}`,"aria-pressed":r===P.id,onClick:()=>o(P.id),children:P.label},P.id)),a.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>x(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:a.jsx($m,{size:13,className:h?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:e,children:a.jsx(jn,{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($m,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),l&&b&&a.jsxs("div",{className:`usage-body${T?" usage-body-stale":""}`,"aria-busy":h,children:[l.source.ccusage_error&&a.jsxs("div",{className:"usage-warning",role:"alert",children:[a.jsx(nc,{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(Sl,{label:"Cost (USD)",value:ts(b.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(P=>`${wl(P.agent)} ${ts(P.cost_usd)}`).join(" · ")})}),a.jsx(Jj,{spent:l.month_to_date_cost_usd}),a.jsxs(Sl,{label:"Total tokens",value:To(b.total_tokens),title:`${No(b.total_tokens)} tokens`,children:[a.jsxs("div",{className:"usage-kpi-sub",children:["Input ",To(b.input_tokens)," · Output ",To(b.output_tokens)]}),a.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",To(b.cache_creation_tokens)," · Cache Read"," ",To(b.cache_read_tokens)]})]}),a.jsx(Sl,{label:"Daily average",value:A>0?ts(b.cost_usd/A):"—",children:a.jsx("div",{className:"usage-kpi-sub",children:A>0?`over ${A} ${A===1?"day":"days"} · ${l.daily.length} with usage`:"No usage in this range"})})]}),N&&a.jsx(Bj,{data:N}),a.jsx(qj,{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 ${Oj(l.generated_at)}`]})]})]})}const Kg="claude auth login";function nE(){const e=R(f=>Object.keys(f.signedOutTurns).length),n=R(f=>f.terminalViewOpen),r=R(f=>f.toggleTerminalView),o=R(f=>f.addToast),[l,c]=y.useState(!1);if(e===0)return null;const d=()=>{c(!0),C0().catch(f=>o("error",`Could not resume the turns — ${Vn(f)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Hv,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",e===1?"1 turn is":`${e} turns are`," waiting. Run"," ",a.jsx("code",{children:Kg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Bi(Kg),children:[a.jsx(Pi,{size:12}),"Copy"]}),!n&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(Qv,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(Xv,{size:12}),e===1?"Resume turn":"Resume turns"]})]})}const Gg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,sE=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,rE={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function lx(){return xt()||window.location.origin}function cx(e,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 o=r.trim();if(Gg.test(o))return o;const l=sE.exec(o);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===e&&Gg.test(l[2])?l[2]:null}function qg(e){return/^https?:\/\//i.test(e.url)?e:{...e,url:`${lx()}${e.url}`}}function oE(e){return rE[e.slice(e.lastIndexOf(".")+1)]??"application/octet-stream"}function ux(e){return new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");n(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(e)})}function iE(e,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(e);return r?{type:n||r[1]||void 0,data:e.slice(r[0].length)}:{type:n,data:e}}async function dx(e){if(e instanceof Blob){const n=e.name;return{name:typeof n=="string"&&n?n:void 0,type:e.type||void 0,data:await ux(e)}}if(e&&typeof e=="object"&&typeof e.data=="string"){const n=e;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 aE(e){const n=await dx(e);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function lE(e,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<n.length;l++){const c=n[l],d=await dx(c);if(d){const{type:m,data:v}=iE(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const f=cx(e,c);if(!f)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const h=await r(f);o.push({name:f,media_type:oE(f),data:await ux(h)})}return o}const cE=`function (config) {
698
+ `;m(Y=>Y+oe),N(!1),P(""),(ee=window.getSelection())==null||ee.removeAllRanges(),setTimeout(()=>{if(x.current){Q(),x.current.focus();const Y=x.current.value.length;x.current.setSelectionRange(Y,Y)}},0)},[A]);return a.jsxs("div",{className:`thread-card ${e.status==="resolved"?"thread-resolved":""}`,id:`thread-${e.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(oe=>!oe),children:[a.jsx("div",{className:"thread-card-quote",children:e.selected_text===null?((Te=(Le=(ke=e.turns)==null?void 0:ke[0])==null?void 0:Le.user_prompt)==null?void 0:Te.slice(0,100))||"Quick question":`“${e.selected_text.slice(0,100)}${e.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[e.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:oe=>{oe.stopPropagation(),f()},title:"Scroll to text",children:a.jsx(J1,{size:12})}),a.jsx("span",{className:`thread-status-badge ${e.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:e.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:J,children:[n.map(oe=>a.jsx(rx,{turn:oe},oe.id)),n.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),j&&a.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:a.jsxs("button",{className:"discuss-button",onClick:me,title:"Quote this text in your follow-up",children:[a.jsx(Qv,{size:14}),a.jsx("span",{children:"Quote"})]})}),e.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:L?"Agent is running…":"Type a follow-up…",value:h,onChange:oe=>{Bt.markInputChange(),m(oe.target.value),Q()},disabled:L,rows:1,style:{minHeight:z,maxHeight:q},onKeyDown:oe=>{Bt.markKeystroke(),oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&!L&&h.trim()&&(oe.preventDefault(),d(h.trim()),m(""),O(z))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:L||!h.trim(),onClick:()=>{d(h.trim()),m("")},children:a.jsx(Ki,{size:13})}),L&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(yr,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[e.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(Al,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(zi,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:c,title:"Delete thread",children:[a.jsx(fs,{size:13})," Delete"]})]})]})]})}function oj(){Bt.trackRender("ThreadsPanel");const e=R(b=>b.activeSessionId),n=R(b=>{var A;return b.activeSessionId?((A=b.sessionDetails[b.activeSessionId])==null?void 0:A.threads)??Og:Og}),r=y.useMemo(()=>n.filter(b=>!Ef(b)),[n]),o=R(b=>b.followupThread),l=R(b=>b.cancelThreadTurn),c=R(b=>b.reopenThread),d=R(b=>b.deleteThread),f=R(b=>b.deepLinkThreadId),h=R(b=>b.setDeepLinkThreadId),[m,v]=y.useState("open"),[k,x]=y.useState(null);y.useEffect(()=>{if(!f)return;const b=f;h(null),v(P=>r.some(L=>L.id===b&&L.status==="open")?P:"all");const A=setTimeout(()=>{const P=document.getElementById(`thread-${b}`);P&&(P.scrollIntoView({behavior:"smooth",block:"center"}),P.classList.add("thread-card-highlighted"),setTimeout(()=>P.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(A)},[f,h,r]);const S=r.filter(b=>m==="open"?b.status==="open":m==="resolved"?b.status==="resolved":!0),j=r.filter(b=>b.status==="open").length,N=r.filter(b=>b.status==="resolved").length;function T(b){setTimeout(()=>{const A=document.querySelector(`mark[data-thread-id="${b}"]`);A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add("thread-mark-flash"),setTimeout(()=>A.classList.remove("thread-mark-flash"),1500))},50)}return e?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Xv,{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 (",j,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",N,")"]}),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(b=>a.jsx(rj,{thread:b,threadTurns:b.turns??[],onStop:()=>l(e,b.id),onResolve:()=>x(b),onReopen:()=>c(e,b.id),onDelete:()=>d(e,b.id),onFollowup:A=>o(e,b.id,A),onLocate:()=>T(b.id)},b.id)),k&&a.jsx(ej,{thread:k,onClose:()=>x(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function ij(){const e=R(f=>f.apps),n=R(f=>f.activeAppTabId),r=R(f=>f.openAppTab),o=R(f=>f.startAppEdit),l=R(f=>f.toggleAppPin),c=R(f=>f.deleteApp),d=R(f=>f.openAppExport);return e.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:e.map(f=>a.jsxs("div",{className:`apps-panel-row${n===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[a.jsx(Mo,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&a.jsx("span",{className:"apps-panel-desc",children:f.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:h=>{h.stopPropagation(),o(f.id)},children:a.jsx(gl,{size:12})}),a.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:h=>{h.stopPropagation(),l(f.id)},children:a.jsx(Dl,{size:12,fill:f.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action",title:"Export app (.zip)",onClick:h=>{h.stopPropagation(),d(f.id)},children:a.jsx(of,{size:12})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:h=>{h.stopPropagation(),c(f.id)},children:a.jsx(fs,{size:12})})]},f.id))})}const aj=24;function lj(){Bt.trackRender("SidecarPanel");const e=R(b=>b.activeSessionId),n=R(b=>{var A;return b.activeSessionId?(A=b.sessionDetails[b.activeSessionId])==null?void 0:A.runtime_type:void 0}),r=R(b=>{var A;return b.activeSessionId?ZC((A=b.sessionDetails[b.activeSessionId])==null?void 0:A.threads):null}),o=R(b=>b.askSidecar),l=R(b=>b.cancelThreadTurn),c=R(b=>b.deleteThread),[d,f]=y.useState(""),[h,m]=y.useState(!1),v=y.useRef(null),k=y.useRef(!0),x=(r==null?void 0:r.turns)??[],S=x[x.length-1],j=x.some(Bs);if(y.useEffect(()=>{k.current=!0},[e,x.length]),y.useEffect(()=>{const b=v.current;b&&k.current&&(b.scrollTop=b.scrollHeight)},[e,x.length,S==null?void 0:S.items.length,S==null?void 0:S.status]),!e||!n)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!QC(n))return a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",n," sessions yet."]})]});const N=!j&&!h&&d.trim().length>0;async function T(){if(!e||!N)return;m(!0);const b=await o(e,d.trim());m(!1),b&&f("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsx("div",{ref:v,className:"sidecar-conversation",onScroll:b=>{const A=b.currentTarget;k.current=A.scrollHeight-A.scrollTop-A.clientHeight<=aj},children:x.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(vr,{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?"})]}):x.map(b=>a.jsx(rx,{turn:b,formatPrompt:JC},b.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:j?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:d,rows:2,disabled:j,onChange:b=>{Bt.markInputChange(),f(b.target.value)},onKeyDown:b=>{Bt.markKeystroke(),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),T())}}),j&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(e,r.id),children:a.jsx(yr,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!N,onClick:()=>void T(),children:a.jsx(Ki,{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:j,onClick:()=>c(e,r.id),children:[a.jsx(fs,{size:13})," Clear"]})})]})]})}function cj(){var h;Bt.trackRender("RightPanel");const e=R(m=>m.activeRightTab),n=R(m=>m.switchRightTab),r=R(m=>m.rightPanelCollapsed),o=R(m=>m.toggleRightPanel),l=R(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),c=R(m=>m.activeSessionId?Cf(m.backgroundTasks[m.activeSessionId]):0),d=((h=l==null?void 0:l.threads)==null?void 0:h.filter(m=>m.status==="open"&&!Ef(m)).length)??0,f=[{id:"turns",label:"Turns",icon:G1},{id:"sidecar",label:"Sidecar",icon:vr},{id:"tasks",label:"Tasks",icon:K1,badge:c||void 0},{id:"threads",label:"Threads",icon:Xv,badge:d||void 0},{id:"apps",label:"Apps",icon:qv}];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:o,children:a.jsx(tS,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),f.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 ${e===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:f.map(m=>a.jsxs("div",{className:`right-tab ${e===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:o,children:a.jsx(eS,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[e==="turns"&&a.jsx(BC,{}),e==="sidecar"&&a.jsx(lj,{}),e==="tasks"&&a.jsx(qC,{}),e==="threads"&&a.jsx(oj,{}),e==="apps"&&a.jsx(ij,{})]})]})}function Gl(e){return jt(`/vscode-web/status?folder=${encodeURIComponent(e??"")}`)}function ox(e){return ut("/vscode-web/start",{folder:e})}function uj(e){return ut("/vscode-web/heartbeat",{id:e})}const dj=1e3,fj=12e4;function pj(){const e=gt();return e===""||e===window.location.origin}function ix(e){var r;const n=e.activeSessionId?e.sessions.find(o=>o.id===e.activeSessionId):null;return n!=null&&n.cwd?n.cwd:((r=e.workspaces.find(o=>o.deleted===0))==null?void 0:r.path)??null}function ax(e,n,r){return`${gt()}/vscode/${e}/?tkn=${n}${r?`&folder=${encodeURIComponent(r)}`:""}`}async function hj(e){let n=await Gl(e);(n.state==="stopped"||n.state==="error")&&(n=await ox(e));const r=Date.now()+fj;for(;n.state==="starting"&&Date.now()<r;)await new Promise(o=>setTimeout(o,dj)),n=await Gl(e);return n}function md(e,n){try{e.document.title="VS Code",e.document.body.style.cssText="margin:0;height:100vh;display:flex;align-items:center;justify-content:center;font:14px system-ui,sans-serif;color:#555",e.document.body.textContent=n}catch{}}function mj(e,n){const r=window.open("","_blank");if(!r){n();return}r.opener=null,md(r,"Starting VS Code — first start downloads the server component (~20 s)…"),hj(e).then(o=>{r.closed||(o.state==="running"&&o.id&&o.token?r.location.replace(ax(o.id,o.token,e)):md(r,`VS Code could not start${o.error?`: ${o.error}`:"."}`))}).catch(o=>{r.closed||md(r,`VS Code could not start: ${o.message}`)})}const zd=[{id:"codex",label:"Codex",available:!0,models:[]},{id:"claude",label:"Claude",available:!0,models:[]},{id:"repoburg",label:"Repoburg",available:!0,models:[],routesInference:!0}];function gj(e){return zd.find(n=>n.id===e)}function vj(e){const n=gj(e);return(n==null?void 0:n.models)??[]}function lx(e,n){const r=e?Ei(e,n):"",o=R(h=>r?h.modelLists[r]:void 0),l=R(h=>r?!!h.modelsLoading[r]:!1),c=R(h=>h.loadModels),d=y.useCallback(()=>{e&&c(e,n??void 0)},[e,n,c]);return y.useEffect(d,[d]),{models:o??(e?vj(e):[]),loading:l,refresh:d}}const yj=[];function xj(e,n){const r=e?Ei(e,n):"",o=R(m=>r?m.inferenceLists[r]:void 0)??yj,l=R(m=>r?!!m.inferenceLoading[r]:!1),c=R(m=>r?m.inferenceErrors[r]??null:null),d=R(m=>r?!!m.inferenceSignIn[r]:!1),f=R(m=>m.loadInferenceProviders),h=y.useCallback(()=>{e&&f(e,n??void 0)},[e,n,f]);return y.useEffect(h,[h]),{providers:o,loading:l,error:c,signInRequired:d,refresh:h}}function wj({runtimeId:e,provider:n,cwd:r,onChange:o,onCancel:l}){const c=n.configured,[d,f]=y.useState(""),[h,m]=y.useState(n.baseUrl??n.defaultBaseUrl??""),[v,k]=y.useState(!1),[x,S]=y.useState(null),[j,N]=y.useState(!1),T=n.needsBaseUrl&&h.trim()!==(n.baseUrl??""),b=!v&&(d.trim().length>0||c&&T);async function A(L){if(L.preventDefault(),!!b){k(!0),S(null);try{const z=await jk(e,n.id,{...d.trim()?{apiKey:d.trim()}:{},...n.needsBaseUrl&&h.trim()?{baseUrl:h.trim()}:{},...r?{cwd:r}:{}});f(""),o(z)}catch(z){S(Vn(z))}finally{k(!1)}}}async function P(){if(!j){N(!0);return}k(!0),S(null);try{o(await Ek(e,n.id,r))}catch(L){S(Vn(L))}finally{k(!1),N(!1)}}return a.jsxs("form",{className:"model-selector-keyform",onSubmit:A,children:[a.jsx("div",{className:"model-selector-keyform-title",children:c?`Replace the ${n.label} key`:`${n.label} needs an API key`}),n.description&&a.jsx("div",{className:"model-selector-keyform-desc",children:n.description}),c&&n.maskedKey&&a.jsxs("div",{className:"model-selector-keyform-desc",children:["Saved key ",n.maskedKey,n.source==="project"?" (this workspace)":""]}),n.needsBaseUrl&&a.jsxs("label",{className:"model-selector-keyform-label",children:["Base URL",a.jsx("input",{className:"model-selector-keyform-input",type:"url",value:h,placeholder:n.defaultBaseUrl??"https://host/v1",onChange:L=>m(L.target.value),spellCheck:!1})]}),a.jsxs("label",{className:"model-selector-keyform-label",children:["API key",a.jsx("input",{className:"model-selector-keyform-input",type:"password",value:d,placeholder:c?"New key":n.keyPlaceholder??"API key",onChange:L=>f(L.target.value),autoComplete:"off",spellCheck:!1,autoFocus:!0})]}),x&&a.jsx("div",{className:"model-selector-keyform-error",role:"alert",children:x}),a.jsxs("div",{className:"model-selector-keyform-actions",children:[a.jsx("button",{type:"submit",className:"model-selector-keyform-save",disabled:!b,children:v?"Checking…":"Save and check"}),l&&a.jsx("button",{type:"button",className:"model-selector-keyform-link",onClick:l,disabled:v,children:"Cancel"})]}),n.keyUrl&&a.jsxs("a",{className:"model-selector-keyform-link",href:n.keyUrl,target:"_blank",rel:"noreferrer",children:["Get a key ",a.jsx(af,{size:10})]}),a.jsx("div",{className:"model-selector-keyform-note",children:"Saved for all workspaces in ~/.repoburg."}),c&&a.jsx("button",{type:"button",className:"model-selector-keyform-link model-selector-keyform-remove",onClick:P,disabled:v,children:j?"Click again to remove the key":"Remove key"})]})}const kj=2e3;function Sj({onSignedIn:e}){const[n,r]=y.useState(null),[o,l]=y.useState(!1),[c,d]=y.useState(!1),[f,h]=y.useState(null),m=y.useRef(e);m.current=e;const v=(n==null?void 0:n.state)==="pending";y.useEffect(()=>{let S=!0;return wm().then(j=>{var N;S&&(j.status==="authorized"?l(!0):((N=j.login)==null?void 0:N.state)==="pending"&&r(j.login))}).catch(()=>{}),()=>{S=!1}},[]),y.useEffect(()=>{if(!v)return;let S=!0;const j=setInterval(async()=>{var T,b;const N=await wm().catch(()=>null);!S||!N||(N.status==="authorized"?(S=!1,clearInterval(j),r(null),m.current()):((T=N.login)==null?void 0:T.state)!=="pending"&&(r(null),h(((b=N.login)==null?void 0:b.error)??"The sign-in expired. Try again.")))},kj);return()=>{S=!1,clearInterval(j)}},[v]);async function k(){d(!0),h(null);const S=window.open("about:blank","_blank");try{const j=await Rk();r(j),S&&(S.opener=null,S.location.href=j.loginUrl)}catch(j){S==null||S.close(),h(j.message||"Could not start the sign-in.")}finally{d(!1)}}function x(){Ak(),r(null)}return o?a.jsxs("div",{className:"model-selector-keyform model-selector-signin",children:[a.jsx("div",{className:"model-selector-keyform-title",children:"Signed in to Repoburg"}),a.jsx("div",{className:"model-selector-keyform-actions",children:a.jsx("button",{type:"button",className:"model-selector-keyform-save",onClick:()=>m.current(),children:"Start Repoburg"})})]}):a.jsxs("div",{className:"model-selector-keyform model-selector-signin",children:[a.jsx("div",{className:"model-selector-keyform-title",children:"Sign in to Repoburg"}),a.jsx("div",{className:"model-selector-keyform-desc",children:"This machine is not signed in, so Repoburg cannot start in this project."}),v?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"model-selector-keyform-desc",children:["Approve code ",a.jsx("span",{className:"model-selector-signin-code",children:n.userCode})," in the sign-in tab. Waiting…"]}),a.jsxs("div",{className:"model-selector-keyform-actions",children:[a.jsx("a",{className:"model-selector-keyform-link",href:n.loginUrl,target:"_blank",rel:"noreferrer",children:"Open sign-in page"}),a.jsx("button",{type:"button",className:"model-selector-keyform-link",onClick:x,children:"Cancel"})]})]}):a.jsx("div",{className:"model-selector-keyform-actions",children:a.jsx("button",{type:"button",className:"model-selector-keyform-save",onClick:()=>void k(),disabled:c,children:c?"Starting…":"Sign in"})}),f&&a.jsx("div",{className:"model-selector-keyform-error",role:"alert",children:f})]})}const bj=12;function Nj(e,n){const r=e.indexOf("/");if(r<=0)return;const o=e.slice(0,r);return n.includes(o)?o:n.includes("openrouter")?"openrouter":void 0}function Tj(){var we,ze,Ye,yt,xt;const{activeSessionId:e,sessions:n,updateModelConfig:r}=R(),o=R(Z=>Z.showModelSelector),l=R(Z=>Z.setShowModelSelector),c=R(Z=>Z.loadModels),d=R(Z=>Z.setInferenceProvider),f=n.find(Z=>Z.id===e),h=R(Z=>e?Z.sessionDetails[e]:void 0),m=f==null?void 0:f.runtime_type,v=zd.find(Z=>Z.id===m),k=!!(v!=null&&v.routesInference),{models:x,loading:S,refresh:j}=lx(m,f==null?void 0:f.cwd),{providers:N,loading:T,error:b,signInRequired:A,refresh:P}=xj(k?m:null,f==null?void 0:f.cwd),[L,z]=y.useState(!1),[q,F]=y.useState(null),[O,Q]=y.useState(!1),[J,te]=y.useState(""),me=y.useRef(null),ke=y.useRef(null);Vi(me,()=>z(!1),L),Do(()=>z(!1),L),y.useEffect(()=>{o&&(z(!0),l(!1))},[o,l]),y.useEffect(()=>{L&&(j(),P(),F(null),Q(!1),te(""))},[L,j,P]);const Le=N.length>0;y.useEffect(()=>{Le&&j()},[Le,j]);const Te=x.length;if(y.useEffect(()=>{var Z,Pe,qe;L&&((qe=(Pe=(Z=ke.current)==null?void 0:Z.querySelector(".model-selector-item.selected"))==null?void 0:Pe.scrollIntoView)==null||qe.call(Pe,{block:"nearest"}))},[L,q,Te]),!f||!m)return null;const oe=f.model??"",ee=f.model_reasoning_effort??"",Y=N.map(Z=>Z.id),ae=(Z,Pe)=>{var qe;return Z.slug===Pe||(((qe=Z.aliases)==null?void 0:qe.includes(Pe))??!1)},K=[...x];oe&&!K.some(Z=>ae(Z,oe))&&K.unshift({slug:oe,displayName:oe,description:"Custom model",defaultReasoning:((we=x[0])==null?void 0:we.defaultReasoning)??"medium",reasoningLevels:((ze=x[0])==null?void 0:ze.reasoningLevels)??[]});function E(Z){return K.find(Pe=>ae(Pe,Z))}function M(Z){var Pe;return((Pe=E(Z))==null?void 0:Pe.reasoningLevels)??[]}function de(Z){var Pe;return(Pe=E(Z))==null?void 0:Pe.defaultReasoning}const U=Z=>Z.inferenceProvider??Nj(Z.slug,Y),ue=E(oe),X=oe||(E("default")?"default":""),ve=X?M(X):[],xe=((h==null?void 0:h.turns.length)??0)>0||(((Ye=h==null?void 0:h.threads)==null?void 0:Ye.length)??0)>0,Ae=ue?U(ue):void 0,Ce=N.find(Z=>Z.id===Ae),ge=q??Ae??((yt=N.find(Z=>Z.configured))==null?void 0:yt.id)??((xt=N[0])==null?void 0:xt.id),le=N.find(Z=>Z.id===ge),Qe=(v==null?void 0:v.label)??m,Ee=(ue==null?void 0:ue.displayName)??(oe||"Default"),et=ve.find(Z=>Z.effort===ee),Se=x.some(Z=>ae(Z,X))&&ve.length===0?"Default":(et==null?void 0:et.label)??(ee||"Default");function Be(Z){const Pe=M(Z),qe=Pe.some(xn=>xn.effort===ee),St=de(Z),yn=Pe.length===0?null:qe?ee:St&&Pe.some(xn=>xn.effort===St)?St:null;r(Z,yn),z(!1)}function Xe(Z){r(oe||null,Z),z(!1)}function at(Z){F(Z),Q(!1),te("")}function kt(Z){d(m,(f==null?void 0:f.cwd)??void 0,Z),Q(!1),c(m,(f==null?void 0:f.cwd)??void 0,!0)}function Ot(Z){return Z.map(Pe=>{const qe=ae(Pe,oe);return a.jsxs("div",{className:`model-selector-item ${qe?"selected":""}`,onClick:()=>Be(Pe.slug),title:Pe.slug,children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:Pe.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:Pe.description})]}),qe&&a.jsx(ps,{size:12})]},Pe.slug)})}function G(){if(!le)return a.jsx("div",{className:"model-selector-empty",children:T?"Starting Repoburg…":"Select an inference provider"});if(!le.configured||O)return a.jsx(wj,{runtimeId:m,provider:le,cwd:(f==null?void 0:f.cwd)??void 0,onChange:kt,onCancel:le.configured?()=>Q(!1):void 0},le.id);const Z=K.filter(St=>U(St)===le.id),Pe=J.trim().toLowerCase(),qe=Pe?Z.filter(St=>`${St.displayName} ${St.slug} ${St.description}`.toLowerCase().includes(Pe)):Z;return a.jsxs(a.Fragment,{children:[Z.length>bj&&a.jsx("input",{className:"model-selector-search",type:"search",value:J,placeholder:`Search ${Z.length} models`,onChange:St=>te(St.target.value),autoFocus:!0}),S&&Z.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!S&&Z.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),Z.length>0&&qe.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No model matches"}),Ot(qe),a.jsxs("button",{type:"button",className:"model-selector-key-footer",onClick:()=>Q(!0),children:[a.jsx(Gv,{size:10})," Key ",le.maskedKey??""," · Change"]})]})}return a.jsxs("div",{className:"model-selector",ref:me,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>z(!L),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:Qe}),k&&Ae&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-inference",children:(Ce==null?void 0:Ce.label)??Ae})]}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:Ee}),Se!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:Se})]}),a.jsx(Ro,{size:12,className:"model-selector-chevron"})]}),L&&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"}),zd.map(Z=>{const Pe=xe&&Z.id!==m;return a.jsxs("div",{className:`model-selector-item ${Z.id===m?"selected":""} ${!Z.available||Pe?"disabled":""}`,title:Pe?"A session keeps its provider once it has turns — start a new session to use another provider":void 0,onClick:()=>{if(!(!Z.available||Pe)){if(Z.id===m){Z.routesInference||z(!1);return}r(null,null,Z.id)}},children:[a.jsx("span",{children:Z.label}),!Z.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(Y1,{size:10})," Soon"]}),Z.id===m&&a.jsx(ps,{size:12})]},Z.id)})]}),k&&a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Inference"}),N.length===0&&(A&&!T?a.jsx(Sj,{onSignedIn:P}):a.jsx("div",{className:"model-selector-empty",children:T?"Starting Repoburg…":b??"No inference providers"})),N.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.id===ge?"selected":""}`,title:Z.configured?`${Z.description} · key ${Z.maskedKey??""}`:`${Z.description} · needs an API key`,onClick:()=>at(Z.id),children:[a.jsx("span",{className:`model-selector-status ${Z.configured?"ready":""}`}),a.jsx("span",{className:"model-selector-item-name",children:Z.label}),!Z.configured&&a.jsx("span",{className:"model-selector-key-tag",children:"Key"}),Z.id===Ae&&a.jsx(ps,{size:12})]},Z.id))]}),a.jsxs("div",{ref:ke,className:`model-selector-column ${k?"model-selector-column-wide":""}`,children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),k?G():a.jsxs(a.Fragment,{children:[S&&K.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!S&&K.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),Ot(K)]})]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),ve.length===0&&a.jsx("div",{className:"model-selector-empty",children:X?"This model has no thinking levels":"Select a model first"}),ve.map(Z=>a.jsxs("div",{className:`model-selector-item ${Z.effort===ee?"selected":""}`,onClick:()=>Xe(Z.effort),children:[a.jsx("span",{children:Z.label}),Z.effort===ee&&a.jsx(ps,{size:12})]},Z.effort))]})]})]})}const Cj=new Set(["localhost","127.0.0.1","[::1]"]);function jj(){const e=gt()||window.location.origin;let n;try{n=new URL(e).hostname}catch{return null}return Cj.has(n)?`${e}/tabtape/`:null}function Ni(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function $g(){const e=R(r=>r.canGoBack),n=R(r=>r.canGoForward);return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"sb-item sb-btn",title:"Back","aria-label":"Back",disabled:!e,onClick:()=>window.history.back(),children:a.jsx(A1,{size:14})}),a.jsx("button",{className:"sb-item sb-btn",title:"Forward","aria-label":"Forward",disabled:!n,onClick:()=>window.history.forward(),children:a.jsx(I1,{size:14})})]})}function Pg(){const e=R(n=>n.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>e(!0),children:[a.jsx(hS,{size:14})," Repoburg"]})}function zg(){const e=R(r=>r.usageViewOpen),n=R(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Usage Center",onClick:n,children:[a.jsx(Hv,{size:14})," Usage"]})}function Fg(){const e=R(o=>o.vscodeViewOpen),n=R(o=>o.toggleVscodeView);function r(){if(e||pj()){n();return}const o=R.getState();mj(ix(o),()=>o.addToast("error","The browser blocked the VS Code tab — allow pop-ups for this site and try again."))}return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open VS Code",onClick:r,children:[a.jsx(z1,{size:14})," Code"]})}function Ug(){const e=R(r=>r.terminalViewOpen),n=R(r=>r.toggleTerminalView);return a.jsxs("button",{className:`sb-item sb-btn${e?" sb-item-active":""}`,title:e?"Back to the agent view":"Open a terminal",onClick:n,children:[a.jsx(ey,{size:14})," Terminal"]})}function Bg(){const e=jj();return e?a.jsxs(a.Fragment,{children:[a.jsxs("a",{className:"sb-item sb-btn sb-link",href:e,target:"_blank",rel:"noopener noreferrer",title:"Open tabtape in a new tab",children:[a.jsx(L1,{size:14})," tabtape"]}),a.jsx("div",{className:"sb-divider",children:"|"})]}):null}function Ej(){Bt.trackRender("StatusBar");const e=R(v=>v.activeSessionId),n=R(v=>e?v.sessions.find(k=>k.id===e)??null:null),r=R(v=>e?v.sessionDetails[e]??null:null),o=R(v=>e?v.backgroundTasks[e]:void 0),l=R(v=>v.wsConnected),c=R(v=>v.switchRightTab),d=(r==null?void 0:r.contextUsage)??null;if(!n)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx($g,{}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Fg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Ug,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(zg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bg,{}),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(Lm,{size:14})," K"]})]});const f=o??[],h=Jl(n,f.length),m=Cf(f);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx($g,{}),a.jsx(Pg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Fg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Ug,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(zg,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bg,{}),a.jsx(Tj,{}),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(tc,{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:h.dot==="background"?{color:"var(--purple)"}:n.status==="failed"?{color:"var(--red)"}:void 0,title:h.dot==="background"?h.dotTitle:void 0,children:h.label}),d&&a.jsx(_j,{usage:d}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Lm,{size:14})," K"]})]})}function _j({usage:e}){const n=e.percentage>=85?"var(--red)":e.percentage>=60?"var(--amber)":"var(--green)",r=`${Ni(e.totalTokens)} / ${Ni(e.contextWindow)} tokens`+(e.autoCompactThreshold?` · auto-compacts at ${Ni(e.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(e.percentage),"% / ",Ni(e.totalTokens)," / ",Ni(e.contextWindow)]})})]})}const Rj=1e3,Aj=5*6e4;function Ij({children:e}){const n=R(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[e,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(jn,{size:16})})]})}function Dj(){const e=R(x=>x.vscodeState),n=R(x=>x.vscodeId),r=R(x=>x.vscodeToken),o=R(x=>x.setVscodeView),l=R(ix),[c,d]=y.useState(!1),[f,h]=y.useState(0),m=y.useRef(null),v=ax(n??"",r??"",l);y.useEffect(()=>{let x=!1;function S(){m.current&&(clearInterval(m.current),m.current=null)}async function j(){try{let T=await Gl(l);if((T.state==="stopped"||T.state==="error")&&(T=await ox(l)),x||(o(T.state,T.id,T.token),T.state==="running"||T.state==="error"))return;m.current=setInterval(async()=>{const b=await Gl(l);x||(o(b.state,b.id,b.token),(b.state==="running"||b.state==="error"||b.state==="stopped")&&S())},Rj)}catch{x||o("error",null,null)}}j();const N=setInterval(()=>{const T=R.getState().vscodeId;T&&uj(T).catch(()=>{})},Aj);return()=>{x=!0,S(),clearInterval(N)}},[f,l,o]);function k(){d(!1),o("starting",null,null),h(x=>x+1)}return e!=="running"||!r||!n?a.jsx(Ij,{children:e==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:k,children:[a.jsx(zi,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(on,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):a.jsxs("div",{className:"vscode-view",children:[!c&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(on,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:v,title:"VS Code",className:"vscode-view-frame",onLoad:()=>d(!0)},n)]})}function Mj(e){const n=new URLSearchParams;return e.since&&n.set("since",e.since),e.until&&n.set("until",e.until),n.set("tz",e.timezone),e.fresh&&n.set("fresh","1"),jt(`/usage/report?${n.toString()}`)}const Lj=[{id:"today",label:"Today"},{id:"7d",label:"7 days"},{id:"30d",label:"30 days"},{id:"month",label:"This month"},{id:"all",label:"All"}];function No(e){return Math.round(e).toLocaleString("en-US")}function ts(e){return`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function To(e){return new Intl.NumberFormat("en-US",{notation:"compact",maximumSignificantDigits:3}).format(e)}function _f(e){const n=e.startsWith("anthropic/claude-")?e.slice(17):e.startsWith("claude-")?e.slice(7):e,r=n.split("-");return r.length>=3&&r[r.length-1].length===8?r.slice(0,-1).join("-"):n}const Oj={claude:"Claude",codex:"Codex",repoburg:"Repoburg",opencode:"OpenCode",amp:"Amp",droid:"Droid",gemini:"Gemini",copilot:"Copilot",pi:"pi",kimi:"Kimi",qwen:"Qwen"};function wl(e){return Oj[e]??e.charAt(0).toUpperCase()+e.slice(1)}const ql=e=>String(e).padStart(2,"0");function dc(e){return`${e.getFullYear()}-${ql(e.getMonth()+1)}-${ql(e.getDate())}`}function $j(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${dc(n)} ${ql(n.getHours())}:${ql(n.getMinutes())}`}function Wg(e,n=new Date){if(e==="all")return{since:null,until:null};const r=new Date(n.getFullYear(),n.getMonth(),n.getDate());return e==="7d"?r.setDate(r.getDate()-6):e==="30d"?r.setDate(r.getDate()-29):e==="month"&&r.setDate(1),{since:dc(r),until:null}}function Hg(e){const n=new Date(`${e}T00:00:00Z`);return n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7),n.toISOString().slice(0,10)}function Rf(e,n){const r=[],o=new Date(`${e}T00:00:00Z`),l=new Date(`${n}T00:00:00Z`);for(;o<=l&&r.length<3700;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1);return r}const Pj=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Fd(e){const n=/^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(e);if(!n)return e;const r=Pj[Number(n[2])-1]??n[2];return n[3]?`${r} ${Number(n[3])}`:`${r} ${n[1]}`}function zj(e,n=Date.now()){const r=Math.max(0,Math.round((n-Date.parse(e))/1e3));if(r<45)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const l=Math.round(o/60);return l<24?`${l} h ago`:dc(new Date(e))}const zr=7,Fj=92;function cx(e,n){const r=n.indexOf(e);return r>=0&&r<zr?r:zr}function kl(e){return e<zr?`var(--usage-series-${e+1})`:"var(--usage-series-other)"}function Uj(e,n){return Rf(Hg(e),Hg(n)).filter((r,o)=>o%7===0)}function Bj(e,n){const{daily:r}=e;if(r.length===0)return null;const o=e.window.since??r[0].period,l=r[r.length-1].period,c=e.window.until??(n>l?n:l),d=Rf(o,c);if(d.length<2)return null;const f=d.length>Fj,h=new Map((f?e.weekly:r).map(x=>[x.period,x])),m=new Map,v=(f?Uj(o,c):d).map(x=>{const S=h.get(x),j=new Map;let N=0;for(const A of(S==null?void 0:S.breakdown)??[]){if(A.cost_usd<=0)continue;const P=cx(A.model,e.model_order),L=j.get(P)??{slot:P,label:P<zr?_f(A.model):"Other",cost:0};L.cost+=A.cost_usd,N+=A.cost_usd,j.set(P,L)}const T=((S==null?void 0:S.cost_usd)??0)-N;if(T>.005){const A=j.get(zr)??{slot:zr,label:"Other",cost:0};A.cost+=T,j.set(zr,A)}const b=[...j.values()].sort((A,P)=>A.slot-P.slot);for(const A of b)m.set(A.slot,A.label);return{period:x,label:f?`Week of ${Fd(x)}`:Fd(x),total:b.reduce((A,P)=>A+P.cost,0),segments:b}});if(!v.some(x=>x.total>0))return null;const k=[...m.entries()].sort((x,S)=>x[0]-S[0]).map(([x,S])=>({slot:x,label:S}));return{unit:f?"week":"day",columns:v,series:k}}function Wj(e){if(!(e>0))return[0,1];if(e<.01)return[0,.01];const n=e/4,r=10**Math.floor(Math.log10(n)),o=n/r,l=(o<=1?1:o<=2?2:o<=2.5?2.5:o<=5?5:10)*r,c=[];for(let d=0;d*l<e+l*1e-9||c.length<2;d++)c.push(d*l);return c[c.length-1]<e&&c.push(c.length*l),c}function Hj(e,n){if(e>=1e4)return`$${To(e)}`;let r=0;for(;r<3&&Math.abs(Math.round(n*10**r)-n*10**r)>1e-9;)r++;return`$${e.toLocaleString("en-US",{minimumFractionDigits:r,maximumFractionDigits:r})}`}const ko=e=>`${e}%`;function Vj({data:e}){const{columns:n,series:r,unit:o}=e,[l,c]=y.useState(null),d=y.useMemo(()=>Wj(Math.max(...n.map(N=>N.total))),[n]),f=d[d.length-1],h=d[1]-d[0],m=n.reduce((N,T,b)=>T.total>n[N].total?b:N,0),v=Math.max(1,Math.ceil(n.length/8)),k=n.length,x=N=>{const T={ArrowLeft:-1,ArrowRight:1,Home:-k,End:k};N.key in T&&(N.preventDefault(),c(b=>Math.min(k-1,Math.max(0,(b??k-1)+T[N.key]))))},S=l===null?null:n[l],j=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:o==="week"?"Weekly cost (USD)":"Daily cost (USD)"}),r.length>=2&&a.jsx("ul",{className:"usage-legend","aria-label":"Models",children:r.map(N=>a.jsxs("li",{className:"usage-legend-item",children:[a.jsx("span",{className:"usage-swatch",style:{background:kl(N.slot)}}),N.label]},N.slot))})]}),a.jsxs("div",{className:"usage-plot-wrap",children:[a.jsx("div",{className:"usage-yaxis","aria-hidden":"true",children:d.map(N=>a.jsx("span",{className:"usage-ytick",style:{bottom:ko(N/f*100)},children:Hj(N,h)},N))}),a.jsxs("div",{className:"usage-plot",role:"group",tabIndex:0,"aria-label":`${o==="week"?"Weekly":"Daily"} cost chart. Arrow keys move between ${o}s.`,onKeyDown:x,onFocus:()=>c(N=>N??k-1),onBlur:()=>c(null),onMouseLeave:()=>c(null),children:[d.map(N=>a.jsx("div",{className:`usage-gridline${N===0?" usage-gridline-base":""}`,style:{bottom:ko(N/f*100)}},N)),a.jsx("div",{className:"usage-cols",children:n.map((N,T)=>a.jsxs("div",{className:`usage-col${l===T?" usage-col-active":""}`,"data-period":N.period,onMouseEnter:()=>c(T),children:[T===m&&N.total>0&&l!==T&&a.jsx("span",{className:"usage-peak",style:{bottom:`calc(${ko(N.total/f*100)} + 3px)`},children:ts(N.total)}),N.total>0&&a.jsx("div",{className:"usage-bar",style:{height:ko(N.total/f*100)},children:N.segments.map(b=>a.jsx("div",{className:"usage-seg",style:{flexGrow:b.cost,background:kl(b.slot)}},b.slot))})]},N.period))}),S&&a.jsxs("div",{className:"usage-tooltip",role:"status",style:{left:ko(j),transform:j<20?"translateX(-12px)":j>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((N,T)=>T.cost-N.cost).map(N=>a.jsxs("div",{className:"usage-tooltip-line",children:[a.jsx("span",{className:"usage-swatch",style:{background:kl(N.slot)}}),a.jsx("span",{className:"usage-tooltip-model",children:N.label}),a.jsx("span",{children:ts(N.cost)})]},N.slot))]})]}),a.jsx("div",{}),a.jsx("div",{className:"usage-xaxis","aria-hidden":"true",children:n.map((N,T)=>(k-1-T)%v===0?a.jsx("span",{className:"usage-xtick",style:{left:ko((T+.5)/k*100),transform:T===0&&k>1?"translateX(-30%)":T===k-1?"translateX(-70%)":"translateX(-50%)"},children:Fd(N.period)},N.period):null)})]})]})}const Vg=[{id:"daily",label:"Daily",column:"Date"},{id:"weekly",label:"Weekly",column:"Week"},{id:"monthly",label:"Monthly",column:"Month"},{id:"session",label:"Session",column:"Session"}],Kj={weekly:"Weeks start on Monday.",session:"Sessions last active in this range, with their whole usage."},gd=50,Gj={input_tokens:0,output_tokens:0,cache_creation_tokens:0,cache_read_tokens:0,total_tokens:0,cost_usd:0};function qj(e){return e.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}),Gj)}function vd({t:e}){return a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"usage-num",children:No(e.input_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.output_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.cache_creation_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.cache_read_tokens)}),a.jsx("td",{className:"usage-num",children:No(e.total_tokens)}),a.jsx("td",{className:"usage-num usage-cost",children:ts(e.cost_usd)})]})}function Xj({models:e,order:n}){return a.jsx("span",{className:"usage-models",children:e.map(r=>a.jsxs("span",{className:"usage-model",title:r,children:[a.jsx("span",{className:"usage-swatch",style:{background:kl(cx(r,n))}}),_f(r)]},r))})}function Yj({row:e,onOpen:n}){const r=e.pane_session;if(!r)return a.jsx("span",{className:"usage-session-id usage-session-id-main",title:e.period,children:e.period});const o=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 "${o}"`,onClick:()=>n(r.id),children:o}),r.kind==="discussion"&&a.jsx("span",{className:"usage-tag",children:"discussion"})]}),a.jsx("span",{className:"usage-session-id",title:e.period,children:e.period})]})}function Qj({report:e,onOpenSession:n}){var j;const[r,o]=y.useState("daily"),[l,c]=y.useState(!1),[d,f]=y.useState(!1),h=r==="session",m=h?e.sessions:e[r],v=h&&!d?m.slice(0,gd):m,k=h?qj(e.sessions):e.totals,x=h?10:9,S=Kj[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:Vg.map(N=>a.jsx("button",{role:"tab","aria-selected":r===N.id,className:`usage-tab${r===N.id?" usage-tab-active":""}`,onClick:()=>o(N.id),children:N.label},N.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:N=>c(N.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:(j=Vg.find(N=>N.id===r))==null?void 0:j.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)"}),h&&a.jsx("th",{children:"Last Activity"})]})}),a.jsxs("tbody",{children:[m.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:x,className:"usage-empty",children:"No usage in this range."})}),v.map(N=>{const T=h?N:null;return a.jsxs(y.Fragment,{children:[a.jsxs("tr",{className:"usage-row",children:[a.jsx("td",{className:"usage-period",children:T?a.jsx(Yj,{row:T,onOpen:n}):N.period}),a.jsx("td",{children:T?wl(T.agent):N.agents.map(wl).join(", ")}),a.jsx("td",{children:a.jsx(Xj,{models:N.models,order:e.model_order})}),a.jsx(vd,{t:N}),T&&a.jsx("td",{className:"usage-when",children:T.last_activity?$j(T.last_activity):"—"})]}),l&&N.breakdown.map(b=>a.jsxs("tr",{className:"usage-sub",children:[a.jsx("td",{}),a.jsx("td",{children:wl(b.agent)}),a.jsxs("td",{title:b.model,children:[a.jsx("span",{className:"usage-branch",children:"└─"})," ",_f(b.model)]}),a.jsx(vd,{t:b}),T&&a.jsx("td",{})]},`${b.agent}\0${b.model}`))]},N.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(vd,{t:k}),h&&a.jsx("td",{})]})})]})}),h&&m.length>gd&&a.jsx("button",{className:"usage-more",onClick:()=>f(N=>!N),children:d?`Show the top ${gd}`:`Show all ${m.length} sessions`})]})}const ux="agentpane:usage-budget",Zj=6e4;function Jj(){try{const e=Number(localStorage.getItem(ux));return Number.isFinite(e)&&e>0?e:0}catch{return 0}}function eE(e){try{localStorage.setItem(ux,String(e))}catch{}}function tE(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Sl({label:e,value:n,title:r,children:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:e}),a.jsx("div",{className:"usage-kpi-value",title:r,children:n}),o]})}function nE({spent:e}){const[n,r]=y.useState(Jj),o=n>0?e/n:0,l=o>=1?"over":o>=.8?"near":"ok",c=d=>{const f=Number(d.replace(",",".")),h=Number.isFinite(f)&&f>0?f:0;r(h),eE(h)};return a.jsxs(Sl,{label:"This month",value:ts(e),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(e,n),children:a.jsx("div",{className:"usage-meter-fill",style:{width:`${Math.min(100,o*100)}%`}})}),a.jsx("div",{className:`usage-kpi-sub${l==="over"?" usage-over":""}`,children:l==="over"?a.jsxs(a.Fragment,{children:[a.jsx(nc,{size:11})," ",ts(e-n)," over the ",ts(n)," budget"]}):`${ts(n-e)} 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 sE=(e,n)=>e.since===n.since&&e.until===n.until;function rE(){const e=R(P=>P.toggleUsageView),n=R(P=>P.selectSession),[r,o]=y.useState("30d"),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState(!1),v=y.useMemo(tE,[]),k=y.useRef(0),x=y.useCallback(P=>{const L=++k.current,{since:z,until:q}=Wg(r),F=async O=>{const Q=await Mj({since:z,until:q,timezone:v,fresh:O});L===k.current&&(c(Q),f(null),!O&&Q.generated_at&&Date.now()-Date.parse(Q.generated_at)>Zj&&await F(!0))};m(!0),F(P).catch(O=>{L===k.current&&f(O.message)}).finally(()=>{L===k.current&&m(!1)})},[r,v]);y.useEffect(()=>{x(!1)},[x]),y.useEffect(()=>()=>{k.current++},[]);const S=P=>{e(),n(P)},j=dc(new Date),N=y.useMemo(()=>l?Bj(l,j):null,[l,j]),T=h&&l!==null&&!sE(l.window,Wg(r)),b=l==null?void 0:l.totals,A=l&&l.daily.length>0?Rf(l.window.since??l.daily[0].period,l.window.until??j).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(Hv,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[Lj.map(P=>a.jsx("button",{className:`usage-range-btn${r===P.id?" usage-range-btn-active":""}`,"aria-pressed":r===P.id,onClick:()=>o(P.id),children:P.label},P.id)),a.jsx("button",{className:"usage-range-btn usage-refresh",onClick:()=>x(!0),title:"Read the logs again (runs ccusage)","aria-label":"Refresh",children:a.jsx($m,{size:13,className:h?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:e,children:a.jsx(jn,{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($m,{size:14,className:"spin"})," Reading the Claude Code and Codex logs with ccusage…"]}),l&&b&&a.jsxs("div",{className:`usage-body${T?" usage-body-stale":""}`,"aria-busy":h,children:[l.source.ccusage_error&&a.jsxs("div",{className:"usage-warning",role:"alert",children:[a.jsx(nc,{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(Sl,{label:"Cost (USD)",value:ts(b.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(P=>`${wl(P.agent)} ${ts(P.cost_usd)}`).join(" · ")})}),a.jsx(nE,{spent:l.month_to_date_cost_usd}),a.jsxs(Sl,{label:"Total tokens",value:To(b.total_tokens),title:`${No(b.total_tokens)} tokens`,children:[a.jsxs("div",{className:"usage-kpi-sub",children:["Input ",To(b.input_tokens)," · Output ",To(b.output_tokens)]}),a.jsxs("div",{className:"usage-kpi-sub",children:["Cache Create ",To(b.cache_creation_tokens)," · Cache Read"," ",To(b.cache_read_tokens)]})]}),a.jsx(Sl,{label:"Daily average",value:A>0?ts(b.cost_usd/A):"—",children:a.jsx("div",{className:"usage-kpi-sub",children:A>0?`over ${A} ${A===1?"day":"days"} · ${l.daily.length} with usage`:"No usage in this range"})})]}),N&&a.jsx(Vj,{data:N}),a.jsx(Qj,{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 ${zj(l.generated_at)}`]})]})]})}const Kg="claude auth login";function oE(){const e=R(f=>Object.keys(f.signedOutTurns).length),n=R(f=>f.terminalViewOpen),r=R(f=>f.toggleTerminalView),o=R(f=>f.addToast),[l,c]=y.useState(!1);if(e===0)return null;const d=()=>{c(!0),_0().catch(f=>o("error",`Could not resume the turns — ${Vn(f)}`)).finally(()=>c(!1))};return a.jsxs("div",{className:"signed-out-band",role:"status",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Gv,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Claude is signed out — ",e===1?"1 turn is":`${e} turns are`," waiting. Run"," ",a.jsx("code",{children:Kg})," in a terminal, then resume."]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:()=>void Bi(Kg),children:[a.jsx(Pi,{size:12}),"Copy"]}),!n&&a.jsxs("button",{type:"button",className:"banner-action",onClick:r,children:[a.jsx(ey,{size:12}),"Open terminal"]}),a.jsxs("button",{type:"button",className:"banner-action",onClick:d,disabled:l,children:[a.jsx(Zv,{size:12}),e===1?"Resume turn":"Resume turns"]})]})}const Gg=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,iE=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,aE={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function dx(){return gt()||window.location.origin}function fx(e,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 o=r.trim();if(Gg.test(o))return o;const l=iE.exec(o);if(!l)return null;let c;try{c=decodeURIComponent(l[1])}catch{return null}return c===e&&Gg.test(l[2])?l[2]:null}function qg(e){return/^https?:\/\//i.test(e.url)?e:{...e,url:`${dx()}${e.url}`}}function lE(e){return aE[e.slice(e.lastIndexOf(".")+1)]??"application/octet-stream"}function px(e){return new Promise((n,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");n(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(e)})}function cE(e,n){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(e);return r?{type:n||r[1]||void 0,data:e.slice(r[0].length)}:{type:n,data:e}}async function hx(e){if(e instanceof Blob){const n=e.name;return{name:typeof n=="string"&&n?n:void 0,type:e.type||void 0,data:await px(e)}}if(e&&typeof e=="object"&&typeof e.data=="string"){const n=e;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 uE(e){const n=await hx(e);if(!n)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return n}async function dE(e,n,r){if(n==null)return[];if(!Array.isArray(n))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<n.length;l++){const c=n[l],d=await hx(c);if(d){const{type:m,data:v}=cE(d.data,d.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:d.name??`attachment-${l+1}`,media_type:m,data:v});continue}const f=fx(e,c);if(!f)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const h=await r(f);o.push({name:f,media_type:lE(f),data:await px(h)})}return o}const fE=`function (config) {
699
699
  var nextId = 1;
700
700
  var pending = new Map();
701
701
  var listeners = [];
@@ -854,9 +854,9 @@ ${A}
854
854
  stack: (r && r.stack) || '', line: 0, col: 0
855
855
  }, '*');
856
856
  });
857
- }`;function uE(e){return`(${cE})(${JSON.stringify(e)});`}function Xg(e){return e.replace(/<\/script/gi,"<\\/script")}function dE(e,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,c;for(;(c=o.exec(e))!==null;)l=c.index;return l}function Yg(e,n,r){const o=dE(e,n);return o===-1?e+r:e.slice(0,o)+r+e.slice(o)}function fE(e,n,r){let o=e;const l=`<script>${Xg(n)}<\/script>`;if(/<\/head>/i.test(o)?o=Yg(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const c=`<script>${Xg(r)}<\/script>`;o=Yg(o,"</body>",c)}return o}function pE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`tab-${e.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function hE(e){var r;if(!(e instanceof Br)||e.status!==409)return null;const n=(r=e.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function mE({appId:e,workspace:n=""}){const r=y.useRef(null),o=y.useRef({pinned:!1,data:null}),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState([]);y.useEffect(()=>{let S=!0;const j=pE(),N=b=>{const A=o.current.version;typeof b.version=="number"&&typeof A=="number"&&b.version<A||(o.current=b)};G0(e,b=>{var A,P;return(P=(A=r.current)==null?void 0:A.contentWindow)==null?void 0:P.postMessage(b,"*")},n);const T=async b=>{var F,O,Q,J,te,me,ke,Le,Te,oe,ee,Y,ae,K,E,M,de,U,ue,X,ve,xe,Ae,Ce;if(b.source!==((F=r.current)==null?void 0:F.contentWindow))return;const A=b.data;if(!A||A.source!=="agentpane-app")return;if(A.report==="error"){const ge={message:String(A.message??"Unknown error"),stack:String(A.stack??"")};m(le=>{const Qe=le[le.length-1];return Qe&&Qe.message===ge.message?le:[...le,ge].slice(-20)});return}if(typeof A.method!="string")return;let P=!0,L,z,q=null;try{switch(A.method){case"getApp":L={id:e,workspace:n};break;case"getState":try{const ge=await _m(e,n);N(ge),L=ge}catch{L=o.current}break;case"setState":{const ge=((O=A.params)==null?void 0:O.data)??null,le=(Q=A.params)==null?void 0:Q.ifVersion,Qe={data:ge,writer:j};typeof le=="number"&&(Qe.ifVersion=le);try{const Ee=await _v(e,Qe,n);N(Ee),L=Ee}catch(Ee){if(q=hE(Ee),!q)throw Ee;N(q);const et=Ee.body;throw new Error(typeof(et==null?void 0:et.error)=="string"?et.error:"App state changed since that version")}break}case"createSession":{const ge=A.params??{},le=await Kd({title:typeof ge.title=="string"?ge.title:void 0,runtime_type:typeof ge.runtime_type=="string"?ge.runtime_type:void 0,model:typeof ge.model=="string"?ge.model:void 0,model_reasoning_effort:typeof ge.model_reasoning_effort=="string"?ge.model_reasoning_effort:void 0,cwd:typeof ge.cwd=="string"?ge.cwd:void 0,origin_app_id:e,origin_app_workspace:n});pl(le.id,e),R.getState().addSession(le),L=le;break}case"submitTurn":{const ge=String(((J=A.params)==null?void 0:J.sessionId)??"");if(!await Rm(e,ge))throw new Error(`submitTurn: ${ge} is not a session of this app`);const le=String(((te=A.params)==null?void 0:te.prompt)??""),Qe=await lE(e,(me=A.params)==null?void 0:me.attachments,et=>i1(e,et)),Ee=await hv(ge,le,Qe.length?Qe:void 0,{originAppId:e});pl(ge,e),L=Ee;break}case"getSession":{L=await Rm(e,String(((ke=A.params)==null?void 0:ke.sessionId)??""));break}case"listSessions":{const ge=(Le=A.params)==null?void 0:Le.lifecycle,le=(Te=A.params)==null?void 0:Te.running;L=await Kk(e,n,{lifecycle:ge==="working"||ge==="finished"?ge:void 0,running:typeof le=="boolean"?le:void 0});break}case"getSessionInfo":{L=await Gk(e,n,String(((oe=A.params)==null?void 0:oe.sessionId)??""));break}case"cancelTurn":{L=await qk(e,String(((ee=A.params)==null?void 0:ee.sessionId)??""));break}case"setSessionLifecycle":{L=await Xk(e,String(((Y=A.params)==null?void 0:Y.sessionId)??""),String(((ae=A.params)==null?void 0:ae.lifecycle)??""));break}case"callTool":{const ge=(K=A.params)==null?void 0:K.args;L=await Yk(e,n,String(((E=A.params)==null?void 0:E.tool)??""),ge&&typeof ge=="object"?ge:{});break}case"listProviders":{L=await ex();break}case"listModels":{const ge=typeof((M=A.params)==null?void 0:M.runtime)=="string"?A.params.runtime.trim():"";if(!ge)throw new Error("listModels: runtime is required");const le=(de=A.params)==null?void 0:de.cwd;L=await jv(ge,typeof le=="string"&&le?le:void 0);break}case"pickDirectory":{if(R.getState().activeAppTabId!==e)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");L=await gv();break}case"resolveToolCall":{const ge=String(((U=A.params)==null?void 0:U.callId)??""),le=(ue=A.params)==null?void 0:ue.result;await n1(ge,le),L={ok:!0};break}case"openSession":{if(R.getState().activeAppTabId!==e)throw new Error("openSession: the app is not on screen — call it from a click in the app");const ge=typeof((X=A.params)==null?void 0:X.sessionId)=="string"?A.params.sessionId.trim():"";if(!ge)throw new Error("openSession: sessionId is required");try{await R.getState().revealSession(ge)}catch(le){throw new Error(`openSession: ${le instanceof Error?le.message:String(le)}`)}L={ok:!0};break}case"uploadFile":{const ge=await aE((ve=A.params)==null?void 0:ve.file);try{L=qg(await r1(e,ge))}catch(le){throw new Error(`uploadFile: ${le instanceof Error?le.message:String(le)}`)}break}case"getFile":{const ge=cx(e,(xe=A.params)==null?void 0:xe.ref),le=ge?await o1(e,ge):null;L=le?qg(le):null;break}default:throw new Error(`Unknown bridge method: ${A.method}`)}}catch(ge){P=!1,z=ge instanceof Error?ge.message:String(ge)}(Ce=(Ae=r.current)==null?void 0:Ae.contentWindow)==null||Ce.postMessage(q?{source:"agentpane-host",id:A.id,ok:P,error:z,code:"conflict",state:q}:{source:"agentpane-host",id:A.id,ok:P,result:L,error:z},"*")};return window.addEventListener("message",T),ek(e,b=>{var A,P;typeof b.workspace=="string"&&b.workspace!==n||b.writer!==j&&((P=(A=r.current)==null?void 0:A.contentWindow)==null||P.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof b.version=="number"?{version:b.version}:{}},"*"))}),Z0(e,()=>{Em(e).then(b=>{S&&(c(b),m([]))}).catch(()=>{})}),(async()=>{try{const[b,A,P]=await Promise.all([Em(e),_m(e,n),Vk(e).catch(()=>[])]);if(!S)return;o.current=A,P.forEach(L=>pl(L.id,e)),c(b)}catch(b){S&&f(b instanceof Error?b.message:String(b))}})(),()=>{S=!1,q0(e),J0(e),tk(e),window.removeEventListener("message",T)}},[e,n]),y.useEffect(()=>{l&&X0(e,l.manifest.headlessSessions===!0)},[e,l]);const v=y.useMemo(()=>l?fE(l.html,uE({appId:e,apiOrigin:lx()}),l.js):"",[l,e]);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)??[],x=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${x?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:x?`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,j)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},j))]}),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: ${e}`,srcDoc:v}),h.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:h.map((S,j)=>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})]},j))})]})}function gE({appId:e,active:n}){const r=R(x=>x.apps),o=R(x=>x.workspaces),l=R(x=>x.appWorkspaces),c=R(x=>x.setAppWorkspace),d=R(x=>x.setActiveAppTab),f=R(x=>x.startAppEdit),h=r.find(x=>x.id===e),m=l[e]??"",v=o.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.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(Mo,{iconNode:h==null?void 0:h.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(h==null?void 0:h.title)??e}),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:x=>c(e,x.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(x=>a.jsx("option",{value:x.path,children:x.label||x.path.split("/").pop()||x.path},x.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 f(e),children:[a.jsx(tS,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:a.jsx(jn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(mE,{appId:e,workspace:m},`${e}:${m}`)})]})}function vE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const[c,d]=y.useState(!1),f=y.useRef(0),h=y.useRef(0),m=y.useCallback(x=>{const S=x.clientX-f.current,j=e==="left"?h.current+S:h.current-S,N=Math.min(r,Math.max(n,j));l(N)},[e,n,r,l]),v=y.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:y.useCallback(x=>{var S,j;x.preventDefault(),x.stopPropagation();try{(j=(S=x.currentTarget)==null?void 0:S.setPointerCapture)==null||j.call(S,x.pointerId)}catch{}f.current=x.clientX,h.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:c}}function Qg({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:c,dragging:d}=vE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${e}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e} panel`,"data-resizing":d?"":void 0})}const yE=y.lazy(()=>b1(()=>import("./TerminalView-DQaRNqT-.js"),__vite__mapDeps([0,1])));function xE(){Bt.trackRender("IdeWorkspace");const e=R(S=>S.sidebarWidth),n=R(S=>S.rightPanelWidth),r=R(S=>S.setSidebarWidth),o=R(S=>S.setRightPanelWidth),l=R(S=>S.rightPanelCollapsed),c=R(S=>S.vscodeViewOpen),d=R(S=>S.usageViewOpen),f=R(S=>S.terminalViewOpen),[h,m]=y.useState(!1);f&&!h&&m(!0);const v=R(S=>S.activeAppTabId),k=R(S=>S.openAppTabs);y.useEffect(()=>{const S=()=>{const j=Cl(),{rightPanelWidth:N,setRightPanelWidth:T}=R.getState();N>j&&T(j)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=l?`${e}px 6px 1fr ${Pk}px`:`${e}px 6px 1fr 6px ${n}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(nE,{}),a.jsxs("div",{className:`ide-layout ${c||d||f?"ide-hidden":""}`,style:{gridTemplateColumns:x},children:[a.jsx(dN,{}),a.jsx(Qg,{side:"left",minWidth:kd,maxWidth:Sd,getWidth:()=>R.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(hN,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(gE,{appId:S,active:v===S},S)),v==null&&a.jsx(jC,{})]}),a.jsx(PC,{})]}),!l&&a.jsx(Qg,{side:"right",minWidth:Tl,maxWidth:Cl(),getWidth:()=>R.getState().rightPanelWidth,setWidth:o}),a.jsx(ij,{})]}),c&&a.jsx(Rj,{}),d&&a.jsx(tE,{}),h&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(yE,{visible:f})}),a.jsx(Tj,{})]})}function wE(){var z,q,F;const{showNewSessionDialog:e,setShowNewSessionDialog:n,createSession:r,lastModelConfig:o}=R(),l=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[f,h]=y.useState(""),[m,v]=y.useState(c),[k,x]=y.useState(d),[S,j]=y.useState(""),{models:N}=ox(e?l:null);if(!e)return null;const T=O=>N.find(Q=>Q.slug===O),b=m?((z=T(m))==null?void 0:z.reasoningLevels)??[]:[];function A(){r({title:f.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),h(""),j("")}function P(O){O.key==="Escape"&&n(!1)}function L(O){var te,me,ke;v(O);const Q=((te=T(O))==null?void 0:te.reasoningLevels)??[];Q.some(Le=>Le.effort===k)||x(((me=T(O))==null?void 0:me.defaultReasoning)??((ke=Q[0])==null?void 0:ke.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:O=>O.stopPropagation(),onKeyDown:P,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(jn,{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:f,onChange:O=>h(O.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:O=>L(O.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),N.map(O=>a.jsxs("option",{value:O.slug,children:[O.displayName," — ",O.description]},O.slug))]})]}),b.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:O=>x(O.target.value),children:[a.jsxs("option",{value:"",children:["Default",(q=T(m))!=null&&q.defaultReasoning?` (${(F=T(m))==null?void 0:F.defaultReasoning})`:""]}),b.map(O=>a.jsx("option",{value:O.effort,children:O.label},O.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:O=>j(O.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:A,children:"Create"})]})]})})}function kE(e,n){const r=n!==""&&(e===n||e.startsWith(`${n}/`)),o=[r?{label:"~",path:n}:{label:"/",path:"/"}],l=e.slice(r?n.length:0);let c=o[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,o.push({label:d,path:c});return o}function SE(e){const n=e.filter(l=>l.deleted===0).at(-1);if(!n)return;const r=gr(n.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function bE(){return R(n=>n.showAddWorkspaceDialog)?a.jsx(NE,{}):null}function NE(){var F;const e=R(O=>O.setShowAddWorkspaceDialog),n=R(O=>O.workspaces),r=R(O=>O.createWorkspaceAt),o=R(O=>O.addToast),[l,c]=y.useState(null),[d,f]=y.useState(!0),[h,m]=y.useState(null),[v,k]=y.useState(!1),x=y.useRef(0),[S]=y.useState(()=>SE(R.getState().workspaces)),j=y.useRef(null),N=y.useCallback(()=>{v||e(!1)},[v,e]);Do(N);const T=y.useCallback(async(O,Q=!1)=>{const J=++x.current;f(!0);let te=null,me=null;try{te=await cm(O)}catch(ke){if(me=Vn(ke),Q&&O)try{te=await cm(),me=null}catch(Le){me=Vn(Le)}}J===x.current&&(te&&c(te),m(me),f(!1))},[]);y.useEffect(()=>{T(S,!0)},[T,S]);const b=l==null?void 0:l.path;y.useEffect(()=>{j.current&&(j.current.scrollTop=0)},[b]);const A=new Set(n.filter(O=>O.deleted===0).map(O=>gr(O.path)));async function P(O){if(!v){k(!0),m(null);try{const Q=await r(O);e(!1),o("success",`Workspace added — ${Q.path}`)}catch(Q){m(Vn(Q)),k(!1)}}}const L=l?kE(l.path,l.home):[],z=((F=L.at(-1))==null?void 0:F.label)??"",q=l!==null&&A.has(gr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:N,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:O=>O.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:N,"aria-label":"Close",disabled:v,children:a.jsx(jn,{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 T(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Pv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:L.map((O,Q)=>a.jsxs(y.Fragment,{children:[Q>0&&a.jsx($i,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Q===L.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:O.path,children:O.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void T(O.path),title:O.path,children:O.label})]},O.path))}),d&&l&&a.jsx(on,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:j,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(O=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void T(O.path),title:O.path,"aria-label":O.git?`${O.name} (git repository)`:O.name,children:[O.git?a.jsx(z1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(Il,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:O.name}),a.jsx($i,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),A.has(gr(O.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void P(O.path),disabled:v,"aria-label":`Add ${O.name}`,children:"Add"})]},O.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(on,{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."]}),h&&a.jsx("p",{className:"folder-error",role:"alert",children:h})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:N,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void P(l.path),disabled:!l||d||v||q,children:v?"Adding…":q?"Already added":`Add “${z}”`})]})]})})}const Ud=6e4,Bd=60*Ud,fl=24*Bd;function TE(e,n=Date.now()){const r=Date.parse(e);if(Number.isNaN(r))return"";const o=Math.max(0,n-r);return o<Ud?"just now":o<Bd?`${Math.floor(o/Ud)} min ago`:o<fl?`${Math.floor(o/Bd)} h ago`:o<2*fl?"yesterday":o<7*fl?`${Math.floor(o/fl)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function CE(){const e=R(n=>n.importSessionsWorkspace);return e?a.jsx(jE,{workspace:e},e):null}function jE({workspace:e}){const n=R(F=>F.setImportSessionsWorkspace),r=R(F=>F.importSessions),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState({}),[m,v]=y.useState(new Set),[k,x]=y.useState(!1),[S,j]=y.useState(new Map),N=y.useCallback(()=>{k||n(null)},[k,n]);Do(N),y.useEffect(()=>{let F=!1;return Cv(e).then(({sessions:O,errors:Q})=>{if(F)return;const J=Object.values(Q);if(J.length===wd.length){d([...new Set(J)].join("; "));return}l(O),h(Q)}).catch(O=>{F||d(Vn(O))}),()=>{F=!0}},[e]);function T(F){v(O=>{const Q=new Set(O);return Q.has(F)?Q.delete(F):Q.add(F),Q})}const b=o??[],A=F=>Qu({runtime:F.runtime,id:F.session_id}),P=b.length>0&&b.every(F=>m.has(A(F)));async function L(){const F=b.filter(J=>m.has(A(J))).map(J=>({runtime:J.runtime,id:J.session_id}));if(F.length===0)return;x(!0);const{failed:O}=await r(e,F);if(x(!1),O.length===0){n(null);return}const Q=new Set(O.map(Qu));l(J=>(J??[]).filter(te=>!m.has(A(te))||Q.has(A(te)))),v(Q),j(new Map(O.map(J=>[Qu(J),J.error])))}const z=e.split("/").pop()||e,q=m.size;return a.jsx("div",{className:"dialog-overlay",onClick:N,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import sessions"}),a.jsx("button",{className:"dialog-close",onClick:N,"aria-label":"Close",disabled:k,children:a.jsx(jn,{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"})," or ",a.jsx("code",{children:"codex"})," in"," ",a.jsx("strong",{title:e,children:z}),", in a terminal or an IDE. An imported session keeps its history and continues the same conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(on,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code or Codex sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," or"," ",a.jsx("code",{children:"codex"})," in this folder will show up here.",a.jsx(Zg,{errors:f})]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:P,disabled:k,onChange:()=>v(P?new Set:new Set(b.map(A)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(F=>{const O=A(F),Q=S.get(O);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${m.has(O)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:m.has(O),disabled:k,onChange:()=>T(O)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:F.title,children:F.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{className:`import-row-runtime ${F.runtime}`,children:Zl[F.runtime]}),a.jsx("span",{title:new Date(F.last_modified).toLocaleString(),children:TE(F.last_modified)}),F.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(Bv,{size:10})," ",F.git_branch]})]}),F.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(nc,{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."]}),Q&&a.jsx("span",{className:"import-row-error",role:"alert",children:Q})]})]})},O)})}),a.jsx(Zg,{errors:f})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:N,disabled:k,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void L(),disabled:q===0||k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(on,{size:12,className:"spin"})," Importing…"]}):q>1?`Import ${q} sessions`:"Import"})]})]})})}function Zg({errors:e}){const n=Object.entries(e);return n.length===0?null:a.jsx(a.Fragment,{children:n.map(([r,o])=>a.jsxs("p",{className:"import-note",children:["Could not list the ",Zl[r]," sessions — ",o]},r))})}const EE=50*1024*1024;function _E(e){const n=e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function RE(e){return _E(e.replace(/\.zip$/i,"").replace(/\s*\(\d+\)$/,""))}const AE=new TextEncoder().encode(".agentpane-data/data.json");async function IE(e){const n=new Uint8Array(await e.arrayBuffer()),r=AE;e:for(let o=0;o<=n.length-r.length;o++){for(let l=0;l<r.length;l++)if(n[o+l]!==r[l])continue e;return!0}return!1}function DE(){const{appCatalogOpen:e,closeAppCatalog:n,apps:r,installExampleApp:o,createSkeletonApp:l,importAppZip:c}=R(),[d,f]=y.useState("examples"),[h,m]=y.useState(null),[v,k]=y.useState(null),[x,S]=y.useState(!1),[j,N]=y.useState(""),[T,b]=y.useState(""),[A,P]=y.useState(""),[L,z]=y.useState(""),[q,F]=y.useState(null),[O,Q]=y.useState(null),[J,te]=y.useState(""),[me,ke]=y.useState(null);if(y.useEffect(()=>{e&&(m(null),Qk().then(m).catch(()=>m([])))},[e]),!e)return null;const Le=new Set(r.map(E=>E.id));async function Te(E){k(E);try{await o(E)&&n()}finally{k(null)}}async function oe(){if(x)return;const E=j.trim(),M=T.trim();if(!(!E||!M)){S(!0);try{await l({id:E,title:M,description:A.trim()||void 0,icon:L.trim()||void 0})&&(N(""),b(""),P(""),z(""),n())}finally{S(!1)}}}async function ee(E){var de;const M=((de=E.target.files)==null?void 0:de[0])??null;if(Q(null),F(null),ke(null),!!M){if(!/\.zip$/i.test(M.name)){Q("Choose a .zip file.");return}if(M.size>EE){Q("The archive is larger than 50 MB.");return}te(RE(M.name)),ke(await IE(M).catch(()=>!1)?!0:null),F(M)}}async function Y(){if(!(x||!q||!J.trim())){S(!0);try{await c(J.trim(),q,{data:me===!0})&&(F(null),te(""),n())}finally{S(!1)}}}function ae(E){E.key==="Escape"&&n()}const K=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"import",label:"Import"}];return a.jsx("div",{className:"dialog-overlay",onClick:n,children:a.jsxs("div",{className:"dialog app-catalog",onClick:E=>E.stopPropagation(),onKeyDown:ae,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:K.map(E=>a.jsx("button",{className:`catalog-tab${d===E.key?" active":""}`,onClick:()=>f(E.key),children:E.label},E.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:h===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):h.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):h.map(E=>{const M=Le.has(E.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(Mo,{iconNode:E.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:E.title}),E.description&&a.jsx("span",{className:"example-desc",children:E.description})]}),a.jsx("button",{className:"example-install",disabled:M||v===E.id,onClick:()=>Te(E.id),title:M?"Already installed":"Install this example",children:M?"Installed":v===E.id?"Installing…":"Install"})]},E.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:j,onChange:E=>N(E.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:T,onChange:E=>b(E.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:A,onChange:E=>P(E.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:L,onChange:E=>z(E.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!j.trim()||!T.trim(),onClick:oe,children:[a.jsx(hr,{size:13})," Create App"]})]}),d==="import"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Choose a mini app archive (.zip), as Export downloads it. A missing manifest.json is generated from the app id."}),a.jsx("input",{type:"file",accept:".zip,application/zip","aria-label":"App archive",onChange:E=>void ee(E)}),O&&a.jsx("div",{className:"catalog-upload-error",children:O}),q&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:J,onChange:E=>te(E.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[q.name," (",Math.max(1,Math.round(q.size/1024))," KB)"]}),me!==null&&a.jsxs("label",{className:"app-export-option",children:[a.jsx("input",{type:"checkbox",checked:me,onChange:E=>ke(E.target.checked)}),a.jsxs("span",{children:["Import data",a.jsx("span",{className:"app-export-option-hint",children:"The archive carries the app’s saved state and stored files."})]})]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!q||!J.trim(),onClick:Y,children:[a.jsx(lS,{size:13})," ",x?"Importing…":"Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function ME(){var k;const e=R(x=>x.appExportId),n=R(x=>x.apps),r=R(x=>x.closeAppExport),o=R(x=>x.exportApp),[l,c]=y.useState(!1),[d,f]=y.useState(!1);if(y.useEffect(()=>{c(!1)},[e]),!e)return null;const h=e,m=((k=n.find(x=>x.id===h))==null?void 0:k.title)??h;async function v(){if(!d){f(!0);try{await o(h,{data:l})&&r()}finally{f(!1)}}}return a.jsx("div",{className:"dialog-overlay",onClick:r,children:a.jsxs("div",{className:"dialog app-export",role:"dialog","aria-label":"Export Mini App",onClick:x=>x.stopPropagation(),onKeyDown:x=>{x.key==="Escape"&&r()},children:[a.jsxs("div",{className:"dialog-header",children:[a.jsxs("span",{className:"dialog-title",children:["Export ",m]}),a.jsx("button",{className:"dialog-close",onClick:r,children:"✕"})]}),a.jsxs("div",{className:"dialog-body catalog-body",children:[a.jsxs("div",{className:"catalog-upload-hint",children:["Downloads the app’s files as ",a.jsxs("code",{children:[h,".zip"]}),". Import it from Add Mini App → Import."]}),a.jsxs("label",{className:"app-export-option",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:x=>c(x.target.checked),autoFocus:!0}),a.jsxs("span",{children:["Include data",a.jsx("span",{className:"app-export-option-hint",children:"The app’s saved state (global and per workspace) and the files it stored. It may hold private content."})]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:d,onClick:v,children:[a.jsx(of,{size:13})," ",d?"Exporting…":l?"Export with data":"Export"]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:r,children:"Cancel"})})]})})}function LE(){const e=R(k=>k.showCommandPalette),n=R(k=>k.setShowCommandPalette),r=R(),[o,l]=y.useState(""),[c,d]=y.useState(0),f=y.useRef(null),h=y.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,x=Xl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:hr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:fs,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Ki,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:yr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:K1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:vr,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:J1,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:jn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=y.useMemo(()=>{const k=o.toLowerCase().trim(),x=h.filter(S=>S.available);return k?x.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):x},[h,o]);y.useEffect(()=>{e&&(l(""),d(0),setTimeout(()=>{var k;return(k=f.current)==null?void 0:k.focus()},50))},[e]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[c];x&&(x.action(),n(!1))}else k.key==="Escape"&&n(!1)}return e?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:f,type:"text",placeholder:"Type a command…",value:o,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,x)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${x===c?"selected":""}`,onClick:()=>{k.action(),n(!1)},onMouseEnter:()=>d(x),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}),x===c&&a.jsx($1,{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 Jg=/^[a-z][a-z0-9-]{1,30}$/,OE=2e3,$E=2e3;function PE(){const{showRemoteModal:e,setShowRemoteModal:n,selectSession:r}=R(),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState(!1),[m,v]=y.useState(!1),[k,x]=y.useState(!1),[S,j]=y.useState(!1),[N,T]=y.useState("main"),[b,A]=y.useState(null),[P,L]=y.useState(null),[z,q]=y.useState(!1),[F,O]=y.useState(null),[Q,J]=y.useState({kind:"setup"}),[te,me]=y.useState(""),[ke,Le]=y.useState(!1),[Te,oe]=y.useState(null),ee=y.useRef(null);Vi(ee,()=>j(!1),S);const Y=m||k,ae=y.useCallback(async()=>{h(!0),d(null);try{const Se=await fetch(`${xt()}/remote/status`,{headers:{Accept:"application/json"}});if(!Se.ok)throw new Error(`status ${Se.status}`);l(await Se.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{h(!1)}},[]),K=y.useCallback(async()=>{try{const Se=await fetch(`${xt()}/auth/status`,{headers:{Accept:"application/json"}});if(!Se.ok)throw new Error(`auth status ${Se.status}`);const Be=await Se.json();return A(Be),Be}catch{return null}},[]);y.useEffect(()=>{e&&(T("main"),oe(null),L(null),O(null),ae(),K())},[e,ae,K]);const E=Te!==null&&Te.state==="running";y.useEffect(()=>{if(!E)return;const Se=setInterval(async()=>{try{const Be=await fetch(`${xt()}/remote/enable`,{headers:{Accept:"application/json"}});Be.ok&&oe(await Be.json())}catch{}},OE);return()=>clearInterval(Se)},[E]);const M=N==="login"&&(P==null?void 0:P.state)==="pending";if(y.useEffect(()=>{if(!M)return;const Se=setInterval(async()=>{const Be=await K();Be&&(Be.status==="authorized"?(clearInterval(Se),L(null),X()):Be.login&&Be.login.state!=="pending"&&L(Be.login))},$E);return()=>clearInterval(Se)},[M,K,Q]),y.useEffect(()=>{(Te==null?void 0:Te.state)==="needs_login"&&(J({kind:"enable",mahlas:Te.mahlas??te}),oe(null),T("login"))},[Te,te]),!e)return null;const de=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function U(Se){Se.key==="Escape"&&n(!1)}async function ue(){const Se=b??await K();(Se==null?void 0:Se.status)==="authorized"?T("setup"):(J({kind:"setup"}),T("login"))}function X(){const Se=Q;J({kind:"setup"}),Se.kind==="enable"?Ce(Se.mahlas):Se.kind==="remove"?(T("main"),Ee()):T("setup")}async function ve(){q(!0),O(null);const Se=window.open("about:blank","_blank");try{const Be=await fetch(`${xt()}/auth/initiate`,{method:"POST"}),Xe=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(Xe.error??`initiate ${Be.status}`);L(Xe),Se&&(Se.opener=null,Se.location.href=Xe.loginUrl)}catch(Be){Se==null||Se.close(),O(Be.message||"Could not start the sign-in.")}finally{q(!1)}}function xe(){(P==null?void 0:P.state)==="pending"&&fetch(`${xt()}/auth/cancel`,{method:"POST"}).catch(()=>{}),L(null),O(null),T("main")}async function Ae(){await fetch(`${xt()}/auth/logout`,{method:"POST"}).catch(()=>{}),A(null),J({kind:"setup"}),L(null),T("login")}async function Ce(Se){if(Jg.test(Se)){Le(!0);try{const Be=await fetch(`${xt()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:Se})});if(!Be.ok)throw new Error(`enable ${Be.status}`);oe(await Be.json()),T("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{Le(!1)}}}function ge(){Te!=null&&Te.troubleshootingSessionId&&(r(Te.troubleshootingSessionId),n(!1))}async function le(){v(!0);try{await fetch(`${xt()}/remote/disable`,{method:"POST"}),await ae()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function Qe(){j(!1),window.confirm(`Remove the tunnel completely?
857
+ }`;function pE(e){return`(${fE})(${JSON.stringify(e)});`}function Xg(e){return e.replace(/<\/script/gi,"<\\/script")}function hE(e,n){const r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,c;for(;(c=o.exec(e))!==null;)l=c.index;return l}function Yg(e,n,r){const o=hE(e,n);return o===-1?e+r:e.slice(0,o)+r+e.slice(o)}function mE(e,n,r){let o=e;const l=`<script>${Xg(n)}<\/script>`;if(/<\/head>/i.test(o)?o=Yg(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const c=`<script>${Xg(r)}<\/script>`;o=Yg(o,"</body>",c)}return o}function gE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`tab-${e.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function vE(e){var r;if(!(e instanceof Br)||e.status!==409)return null;const n=(r=e.body)==null?void 0:r.state;return n&&typeof n=="object"?n:null}function yE({appId:e,workspace:n=""}){const r=y.useRef(null),o=y.useRef({pinned:!1,data:null}),[l,c]=y.useState(null),[d,f]=y.useState(null),[h,m]=y.useState([]);y.useEffect(()=>{let S=!0;const j=gE(),N=b=>{const A=o.current.version;typeof b.version=="number"&&typeof A=="number"&&b.version<A||(o.current=b)};Y0(e,b=>{var A,P;return(P=(A=r.current)==null?void 0:A.contentWindow)==null?void 0:P.postMessage(b,"*")},n);const T=async b=>{var F,O,Q,J,te,me,ke,Le,Te,oe,ee,Y,ae,K,E,M,de,U,ue,X,ve,xe,Ae,Ce;if(b.source!==((F=r.current)==null?void 0:F.contentWindow))return;const A=b.data;if(!A||A.source!=="agentpane-app")return;if(A.report==="error"){const ge={message:String(A.message??"Unknown error"),stack:String(A.stack??"")};m(le=>{const Qe=le[le.length-1];return Qe&&Qe.message===ge.message?le:[...le,ge].slice(-20)});return}if(typeof A.method!="string")return;let P=!0,L,z,q=null;try{switch(A.method){case"getApp":L={id:e,workspace:n};break;case"getState":try{const ge=await _m(e,n);N(ge),L=ge}catch{L=o.current}break;case"setState":{const ge=((O=A.params)==null?void 0:O.data)??null,le=(Q=A.params)==null?void 0:Q.ifVersion,Qe={data:ge,writer:j};typeof le=="number"&&(Qe.ifVersion=le);try{const Ee=await Iv(e,Qe,n);N(Ee),L=Ee}catch(Ee){if(q=vE(Ee),!q)throw Ee;N(q);const et=Ee.body;throw new Error(typeof(et==null?void 0:et.error)=="string"?et.error:"App state changed since that version")}break}case"createSession":{const ge=A.params??{},le=await Kd({title:typeof ge.title=="string"?ge.title:void 0,runtime_type:typeof ge.runtime_type=="string"?ge.runtime_type:void 0,model:typeof ge.model=="string"?ge.model:void 0,model_reasoning_effort:typeof ge.model_reasoning_effort=="string"?ge.model_reasoning_effort:void 0,cwd:typeof ge.cwd=="string"?ge.cwd:void 0,origin_app_id:e,origin_app_workspace:n});pl(le.id,e),R.getState().addSession(le),L=le;break}case"submitTurn":{const ge=String(((J=A.params)==null?void 0:J.sessionId)??"");if(!await Rm(e,ge))throw new Error(`submitTurn: ${ge} is not a session of this app`);const le=String(((te=A.params)==null?void 0:te.prompt)??""),Qe=await dE(e,(me=A.params)==null?void 0:me.attachments,et=>c1(e,et)),Ee=await vv(ge,le,Qe.length?Qe:void 0,{originAppId:e});pl(ge,e),L=Ee;break}case"getSession":{L=await Rm(e,String(((ke=A.params)==null?void 0:ke.sessionId)??""));break}case"listSessions":{const ge=(Le=A.params)==null?void 0:Le.lifecycle,le=(Te=A.params)==null?void 0:Te.running;L=await Xk(e,n,{lifecycle:ge==="working"||ge==="finished"?ge:void 0,running:typeof le=="boolean"?le:void 0});break}case"getSessionInfo":{L=await Yk(e,n,String(((oe=A.params)==null?void 0:oe.sessionId)??""));break}case"cancelTurn":{L=await Qk(e,String(((ee=A.params)==null?void 0:ee.sessionId)??""));break}case"setSessionLifecycle":{L=await Zk(e,String(((Y=A.params)==null?void 0:Y.sessionId)??""),String(((ae=A.params)==null?void 0:ae.lifecycle)??""));break}case"callTool":{const ge=(K=A.params)==null?void 0:K.args;L=await Jk(e,n,String(((E=A.params)==null?void 0:E.tool)??""),ge&&typeof ge=="object"?ge:{});break}case"listProviders":{L=await sx();break}case"listModels":{const ge=typeof((M=A.params)==null?void 0:M.runtime)=="string"?A.params.runtime.trim():"";if(!ge)throw new Error("listModels: runtime is required");const le=(de=A.params)==null?void 0:de.cwd;L=await Rv(ge,typeof le=="string"&&le?le:void 0);break}case"pickDirectory":{if(R.getState().activeAppTabId!==e)throw new Error("pickDirectory: the app is not on screen — call it from a click in the app");L=await xv();break}case"resolveToolCall":{const ge=String(((U=A.params)==null?void 0:U.callId)??""),le=(ue=A.params)==null?void 0:ue.result;await o1(ge,le),L={ok:!0};break}case"openSession":{if(R.getState().activeAppTabId!==e)throw new Error("openSession: the app is not on screen — call it from a click in the app");const ge=typeof((X=A.params)==null?void 0:X.sessionId)=="string"?A.params.sessionId.trim():"";if(!ge)throw new Error("openSession: sessionId is required");try{await R.getState().revealSession(ge)}catch(le){throw new Error(`openSession: ${le instanceof Error?le.message:String(le)}`)}L={ok:!0};break}case"uploadFile":{const ge=await uE((ve=A.params)==null?void 0:ve.file);try{L=qg(await a1(e,ge))}catch(le){throw new Error(`uploadFile: ${le instanceof Error?le.message:String(le)}`)}break}case"getFile":{const ge=fx(e,(xe=A.params)==null?void 0:xe.ref),le=ge?await l1(e,ge):null;L=le?qg(le):null;break}default:throw new Error(`Unknown bridge method: ${A.method}`)}}catch(ge){P=!1,z=ge instanceof Error?ge.message:String(ge)}(Ce=(Ae=r.current)==null?void 0:Ae.contentWindow)==null||Ce.postMessage(q?{source:"agentpane-host",id:A.id,ok:P,error:z,code:"conflict",state:q}:{source:"agentpane-host",id:A.id,ok:P,result:L,error:z},"*")};return window.addEventListener("message",T),sk(e,b=>{var A,P;typeof b.workspace=="string"&&b.workspace!==n||b.writer!==j&&((P=(A=r.current)==null?void 0:A.contentWindow)==null||P.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof b.version=="number"?{version:b.version}:{}},"*"))}),tk(e,()=>{Em(e).then(b=>{S&&(c(b),m([]))}).catch(()=>{})}),(async()=>{try{const[b,A,P]=await Promise.all([Em(e),_m(e,n),qk(e).catch(()=>[])]);if(!S)return;o.current=A,P.forEach(L=>pl(L.id,e)),c(b)}catch(b){S&&f(b instanceof Error?b.message:String(b))}})(),()=>{S=!1,Q0(e),nk(e),rk(e),window.removeEventListener("message",T)}},[e,n]),y.useEffect(()=>{l&&Z0(e,l.manifest.headlessSessions===!0)},[e,l]);const v=y.useMemo(()=>l?mE(l.html,pE({appId:e,apiOrigin:dx()}),l.js):"",[l,e]);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)??[],x=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${x?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:x?`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,j)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},j))]}),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: ${e}`,srcDoc:v}),h.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:h.map((S,j)=>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})]},j))})]})}function xE({appId:e,active:n}){const r=R(x=>x.apps),o=R(x=>x.workspaces),l=R(x=>x.appWorkspaces),c=R(x=>x.setAppWorkspace),d=R(x=>x.setActiveAppTab),f=R(x=>x.startAppEdit),h=r.find(x=>x.id===e),m=l[e]??"",v=o.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.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(Mo,{iconNode:h==null?void 0:h.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(h==null?void 0:h.title)??e}),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:x=>c(e,x.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(x=>a.jsx("option",{value:x.path,children:x.label||x.path.split("/").pop()||x.path},x.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 f(e),children:[a.jsx(rS,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>d(null),children:a.jsx(jn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(yE,{appId:e,workspace:m},`${e}:${m}`)})]})}function wE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const[c,d]=y.useState(!1),f=y.useRef(0),h=y.useRef(0),m=y.useCallback(x=>{const S=x.clientX-f.current,j=e==="left"?h.current+S:h.current-S,N=Math.min(r,Math.max(n,j));l(N)},[e,n,r,l]),v=y.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),d(!1)},[m]);return{onPointerDown:y.useCallback(x=>{var S,j;x.preventDefault(),x.stopPropagation();try{(j=(S=x.currentTarget)==null?void 0:S.setPointerCapture)==null||j.call(S,x.pointerId)}catch{}f.current=x.clientX,h.current=o(),d(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:c}}function Qg({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:c,dragging:d}=wE({side:e,minWidth:n,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${e}${d?" dragging":""}`,onPointerDown:c,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e} panel`,"data-resizing":d?"":void 0})}const kE=y.lazy(()=>C1(()=>import("./TerminalView-DhSqcUfd.js"),__vite__mapDeps([0,1])));function SE(){Bt.trackRender("IdeWorkspace");const e=R(S=>S.sidebarWidth),n=R(S=>S.rightPanelWidth),r=R(S=>S.setSidebarWidth),o=R(S=>S.setRightPanelWidth),l=R(S=>S.rightPanelCollapsed),c=R(S=>S.vscodeViewOpen),d=R(S=>S.usageViewOpen),f=R(S=>S.terminalViewOpen),[h,m]=y.useState(!1);f&&!h&&m(!0);const v=R(S=>S.activeAppTabId),k=R(S=>S.openAppTabs);y.useEffect(()=>{const S=()=>{const j=Cl(),{rightPanelWidth:N,setRightPanelWidth:T}=R.getState();N>j&&T(j)};return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=l?`${e}px 6px 1fr ${Uk}px`:`${e}px 6px 1fr 6px ${n}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsx(oE,{}),a.jsxs("div",{className:`ide-layout ${c||d||f?"ide-hidden":""}`,style:{gridTemplateColumns:x},children:[a.jsx(hN,{}),a.jsx(Qg,{side:"left",minWidth:kd,maxWidth:Sd,getWidth:()=>R.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(vN,{}),a.jsxs("div",{className:"ide-render",children:[k.map(S=>a.jsx(xE,{appId:S,active:v===S},S)),v==null&&a.jsx(RC,{})]}),a.jsx(UC,{})]}),!l&&a.jsx(Qg,{side:"right",minWidth:Tl,maxWidth:Cl(),getWidth:()=>R.getState().rightPanelWidth,setWidth:o}),a.jsx(cj,{})]}),c&&a.jsx(Dj,{}),d&&a.jsx(rE,{}),h&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(kE,{visible:f})}),a.jsx(Ej,{})]})}function bE(){var z,q,F;const{showNewSessionDialog:e,setShowNewSessionDialog:n,createSession:r,lastModelConfig:o}=R(),l=(o==null?void 0:o.provider)??"codex",c=(o==null?void 0:o.model)??"",d=(o==null?void 0:o.reasoning)??"",[f,h]=y.useState(""),[m,v]=y.useState(c),[k,x]=y.useState(d),[S,j]=y.useState(""),{models:N}=lx(e?l:null);if(!e)return null;const T=O=>N.find(Q=>Q.slug===O),b=m?((z=T(m))==null?void 0:z.reasoningLevels)??[]:[];function A(){r({title:f.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),h(""),j("")}function P(O){O.key==="Escape"&&n(!1)}function L(O){var te,me,ke;v(O);const Q=((te=T(O))==null?void 0:te.reasoningLevels)??[];Q.some(Le=>Le.effort===k)||x(((me=T(O))==null?void 0:me.defaultReasoning)??((ke=Q[0])==null?void 0:ke.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:O=>O.stopPropagation(),onKeyDown:P,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(jn,{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:f,onChange:O=>h(O.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:O=>L(O.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),N.map(O=>a.jsxs("option",{value:O.slug,children:[O.displayName," — ",O.description]},O.slug))]})]}),b.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:O=>x(O.target.value),children:[a.jsxs("option",{value:"",children:["Default",(q=T(m))!=null&&q.defaultReasoning?` (${(F=T(m))==null?void 0:F.defaultReasoning})`:""]}),b.map(O=>a.jsx("option",{value:O.effort,children:O.label},O.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:O=>j(O.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:A,children:"Create"})]})]})})}function NE(e,n){const r=n!==""&&(e===n||e.startsWith(`${n}/`)),o=[r?{label:"~",path:n}:{label:"/",path:"/"}],l=e.slice(r?n.length:0);let c=o[0].path;for(const d of l.split("/").filter(Boolean))c=c==="/"?`/${d}`:`${c}/${d}`,o.push({label:d,path:c});return o}function TE(e){const n=e.filter(l=>l.deleted===0).at(-1);if(!n)return;const r=gr(n.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function CE(){return R(n=>n.showAddWorkspaceDialog)?a.jsx(jE,{}):null}function jE(){var F;const e=R(O=>O.setShowAddWorkspaceDialog),n=R(O=>O.workspaces),r=R(O=>O.createWorkspaceAt),o=R(O=>O.addToast),[l,c]=y.useState(null),[d,f]=y.useState(!0),[h,m]=y.useState(null),[v,k]=y.useState(!1),x=y.useRef(0),[S]=y.useState(()=>TE(R.getState().workspaces)),j=y.useRef(null),N=y.useCallback(()=>{v||e(!1)},[v,e]);Do(N);const T=y.useCallback(async(O,Q=!1)=>{const J=++x.current;f(!0);let te=null,me=null;try{te=await cm(O)}catch(ke){if(me=Vn(ke),Q&&O)try{te=await cm(),me=null}catch(Le){me=Vn(Le)}}J===x.current&&(te&&c(te),m(me),f(!1))},[]);y.useEffect(()=>{T(S,!0)},[T,S]);const b=l==null?void 0:l.path;y.useEffect(()=>{j.current&&(j.current.scrollTop=0)},[b]);const A=new Set(n.filter(O=>O.deleted===0).map(O=>gr(O.path)));async function P(O){if(!v){k(!0),m(null);try{const Q=await r(O);e(!1),o("success",`Workspace added — ${Q.path}`)}catch(Q){m(Vn(Q)),k(!1)}}}const L=l?NE(l.path,l.home):[],z=((F=L.at(-1))==null?void 0:F.label)??"",q=l!==null&&A.has(gr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:N,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:O=>O.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:N,"aria-label":"Close",disabled:v,children:a.jsx(jn,{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 T(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Uv,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:L.map((O,Q)=>a.jsxs(y.Fragment,{children:[Q>0&&a.jsx($i,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),Q===L.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:O.path,children:O.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void T(O.path),title:O.path,children:O.label})]},O.path))}),d&&l&&a.jsx(on,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:j,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(O=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void T(O.path),title:O.path,"aria-label":O.git?`${O.name} (git repository)`:O.name,children:[O.git?a.jsx(B1,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(Il,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:O.name}),a.jsx($i,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),A.has(gr(O.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void P(O.path),disabled:v,"aria-label":`Add ${O.name}`,children:"Add"})]},O.path)):d&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(on,{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."]}),h&&a.jsx("p",{className:"folder-error",role:"alert",children:h})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:N,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void P(l.path),disabled:!l||d||v||q,children:v?"Adding…":q?"Already added":`Add “${z}”`})]})]})})}const Ud=6e4,Bd=60*Ud,fl=24*Bd;function EE(e,n=Date.now()){const r=Date.parse(e);if(Number.isNaN(r))return"";const o=Math.max(0,n-r);return o<Ud?"just now":o<Bd?`${Math.floor(o/Ud)} min ago`:o<fl?`${Math.floor(o/Bd)} h ago`:o<2*fl?"yesterday":o<7*fl?`${Math.floor(o/fl)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function _E(){const e=R(n=>n.importSessionsWorkspace);return e?a.jsx(RE,{workspace:e},e):null}function RE({workspace:e}){const n=R(F=>F.setImportSessionsWorkspace),r=R(F=>F.importSessions),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState({}),[m,v]=y.useState(new Set),[k,x]=y.useState(!1),[S,j]=y.useState(new Map),N=y.useCallback(()=>{k||n(null)},[k,n]);Do(N),y.useEffect(()=>{let F=!1;return _v(e).then(({sessions:O,errors:Q})=>{if(F)return;const J=Object.values(Q);if(J.length===wd.length){d([...new Set(J)].join("; "));return}l(O),h(Q)}).catch(O=>{F||d(Vn(O))}),()=>{F=!0}},[e]);function T(F){v(O=>{const Q=new Set(O);return Q.has(F)?Q.delete(F):Q.add(F),Q})}const b=o??[],A=F=>Qu({runtime:F.runtime,id:F.session_id}),P=b.length>0&&b.every(F=>m.has(A(F)));async function L(){const F=b.filter(J=>m.has(A(J))).map(J=>({runtime:J.runtime,id:J.session_id}));if(F.length===0)return;x(!0);const{failed:O}=await r(e,F);if(x(!1),O.length===0){n(null);return}const Q=new Set(O.map(Qu));l(J=>(J??[]).filter(te=>!m.has(A(te))||Q.has(A(te)))),v(Q),j(new Map(O.map(J=>[Qu(J),J.error])))}const z=e.split("/").pop()||e,q=m.size;return a.jsx("div",{className:"dialog-overlay",onClick:N,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import sessions"}),a.jsx("button",{className:"dialog-close",onClick:N,"aria-label":"Close",disabled:k,children:a.jsx(jn,{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"})," or ",a.jsx("code",{children:"codex"})," in"," ",a.jsx("strong",{title:e,children:z}),", in a terminal or an IDE. An imported session keeps its history and continues the same conversation."]}),c?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",c]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(on,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code or Codex sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," or"," ",a.jsx("code",{children:"codex"})," in this folder will show up here.",a.jsx(Zg,{errors:f})]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:P,disabled:k,onChange:()=>v(P?new Set:new Set(b.map(A)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(F=>{const O=A(F),Q=S.get(O);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${m.has(O)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:m.has(O),disabled:k,onChange:()=>T(O)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:F.title,children:F.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{className:`import-row-runtime ${F.runtime}`,children:Zl[F.runtime]}),a.jsx("span",{title:new Date(F.last_modified).toLocaleString(),children:EE(F.last_modified)}),F.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(Vv,{size:10})," ",F.git_branch]})]}),F.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(nc,{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."]}),Q&&a.jsx("span",{className:"import-row-error",role:"alert",children:Q})]})]})},O)})}),a.jsx(Zg,{errors:f})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:N,disabled:k,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void L(),disabled:q===0||k,children:k?a.jsxs(a.Fragment,{children:[a.jsx(on,{size:12,className:"spin"})," Importing…"]}):q>1?`Import ${q} sessions`:"Import"})]})]})})}function Zg({errors:e}){const n=Object.entries(e);return n.length===0?null:a.jsx(a.Fragment,{children:n.map(([r,o])=>a.jsxs("p",{className:"import-note",children:["Could not list the ",Zl[r]," sessions — ",o]},r))})}const AE=50*1024*1024;function IE(e){const n=e.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(n)?n:""}function DE(e){return IE(e.replace(/\.zip$/i,"").replace(/\s*\(\d+\)$/,""))}const ME=new TextEncoder().encode(".agentpane-data/data.json");async function LE(e){const n=new Uint8Array(await e.arrayBuffer()),r=ME;e:for(let o=0;o<=n.length-r.length;o++){for(let l=0;l<r.length;l++)if(n[o+l]!==r[l])continue e;return!0}return!1}function OE(){const{appCatalogOpen:e,closeAppCatalog:n,apps:r,installExampleApp:o,createSkeletonApp:l,importAppZip:c}=R(),[d,f]=y.useState("examples"),[h,m]=y.useState(null),[v,k]=y.useState(null),[x,S]=y.useState(!1),[j,N]=y.useState(""),[T,b]=y.useState(""),[A,P]=y.useState(""),[L,z]=y.useState(""),[q,F]=y.useState(null),[O,Q]=y.useState(null),[J,te]=y.useState(""),[me,ke]=y.useState(null);if(y.useEffect(()=>{e&&(m(null),e1().then(m).catch(()=>m([])))},[e]),!e)return null;const Le=new Set(r.map(E=>E.id));async function Te(E){k(E);try{await o(E)&&n()}finally{k(null)}}async function oe(){if(x)return;const E=j.trim(),M=T.trim();if(!(!E||!M)){S(!0);try{await l({id:E,title:M,description:A.trim()||void 0,icon:L.trim()||void 0})&&(N(""),b(""),P(""),z(""),n())}finally{S(!1)}}}async function ee(E){var de;const M=((de=E.target.files)==null?void 0:de[0])??null;if(Q(null),F(null),ke(null),!!M){if(!/\.zip$/i.test(M.name)){Q("Choose a .zip file.");return}if(M.size>AE){Q("The archive is larger than 50 MB.");return}te(DE(M.name)),ke(await LE(M).catch(()=>!1)?!0:null),F(M)}}async function Y(){if(!(x||!q||!J.trim())){S(!0);try{await c(J.trim(),q,{data:me===!0})&&(F(null),te(""),n())}finally{S(!1)}}}function ae(E){E.key==="Escape"&&n()}const K=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"import",label:"Import"}];return a.jsx("div",{className:"dialog-overlay",onClick:n,children:a.jsxs("div",{className:"dialog app-catalog",onClick:E=>E.stopPropagation(),onKeyDown:ae,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:K.map(E=>a.jsx("button",{className:`catalog-tab${d===E.key?" active":""}`,onClick:()=>f(E.key),children:E.label},E.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[d==="examples"&&a.jsx("div",{className:"catalog-examples",children:h===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):h.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):h.map(E=>{const M=Le.has(E.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(Mo,{iconNode:E.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:E.title}),E.description&&a.jsx("span",{className:"example-desc",children:E.description})]}),a.jsx("button",{className:"example-install",disabled:M||v===E.id,onClick:()=>Te(E.id),title:M?"Already installed":"Install this example",children:M?"Installed":v===E.id?"Installing…":"Install"})]},E.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:j,onChange:E=>N(E.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:T,onChange:E=>b(E.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:A,onChange:E=>P(E.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:L,onChange:E=>z(E.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!j.trim()||!T.trim(),onClick:oe,children:[a.jsx(hr,{size:13})," Create App"]})]}),d==="import"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Choose a mini app archive (.zip), as Export downloads it. A missing manifest.json is generated from the app id."}),a.jsx("input",{type:"file",accept:".zip,application/zip","aria-label":"App archive",onChange:E=>void ee(E)}),O&&a.jsx("div",{className:"catalog-upload-error",children:O}),q&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:J,onChange:E=>te(E.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[q.name," (",Math.max(1,Math.round(q.size/1024))," KB)"]}),me!==null&&a.jsxs("label",{className:"app-export-option",children:[a.jsx("input",{type:"checkbox",checked:me,onChange:E=>ke(E.target.checked)}),a.jsxs("span",{children:["Import data",a.jsx("span",{className:"app-export-option-hint",children:"The archive carries the app’s saved state and stored files."})]})]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!q||!J.trim(),onClick:Y,children:[a.jsx(dS,{size:13})," ",x?"Importing…":"Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:n,children:"Close"})})]})})}function $E(){var k;const e=R(x=>x.appExportId),n=R(x=>x.apps),r=R(x=>x.closeAppExport),o=R(x=>x.exportApp),[l,c]=y.useState(!1),[d,f]=y.useState(!1);if(y.useEffect(()=>{c(!1)},[e]),!e)return null;const h=e,m=((k=n.find(x=>x.id===h))==null?void 0:k.title)??h;async function v(){if(!d){f(!0);try{await o(h,{data:l})&&r()}finally{f(!1)}}}return a.jsx("div",{className:"dialog-overlay",onClick:r,children:a.jsxs("div",{className:"dialog app-export",role:"dialog","aria-label":"Export Mini App",onClick:x=>x.stopPropagation(),onKeyDown:x=>{x.key==="Escape"&&r()},children:[a.jsxs("div",{className:"dialog-header",children:[a.jsxs("span",{className:"dialog-title",children:["Export ",m]}),a.jsx("button",{className:"dialog-close",onClick:r,children:"✕"})]}),a.jsxs("div",{className:"dialog-body catalog-body",children:[a.jsxs("div",{className:"catalog-upload-hint",children:["Downloads the app’s files as ",a.jsxs("code",{children:[h,".zip"]}),". Import it from Add Mini App → Import."]}),a.jsxs("label",{className:"app-export-option",children:[a.jsx("input",{type:"checkbox",checked:l,onChange:x=>c(x.target.checked),autoFocus:!0}),a.jsxs("span",{children:["Include data",a.jsx("span",{className:"app-export-option-hint",children:"The app’s saved state (global and per workspace) and the files it stored. It may hold private content."})]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:d,onClick:v,children:[a.jsx(of,{size:13})," ",d?"Exporting…":l?"Export with data":"Export"]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:r,children:"Cancel"})})]})})}function PE(){const e=R(k=>k.showCommandPalette),n=R(k=>k.setShowCommandPalette),r=R(),[o,l]=y.useState(""),[c,d]=y.useState(0),f=y.useRef(null),h=y.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,x=Xl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:hr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:fs,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:Ki,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:yr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:X1,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:vr,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:nS,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:jn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=y.useMemo(()=>{const k=o.toLowerCase().trim(),x=h.filter(S=>S.available);return k?x.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):x},[h,o]);y.useEffect(()=>{e&&(l(""),d(0),setTimeout(()=>{var k;return(k=f.current)==null?void 0:k.focus()},50))},[e]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),d(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),d(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[c];x&&(x.action(),n(!1))}else k.key==="Escape"&&n(!1)}return e?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:f,type:"text",placeholder:"Type a command…",value:o,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,x)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${x===c?"selected":""}`,onClick:()=>{k.action(),n(!1)},onMouseEnter:()=>d(x),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}),x===c&&a.jsx(F1,{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 Jg=/^[a-z][a-z0-9-]{1,30}$/,zE=2e3,FE=2e3;function UE(){const{showRemoteModal:e,setShowRemoteModal:n,selectSession:r}=R(),[o,l]=y.useState(null),[c,d]=y.useState(null),[f,h]=y.useState(!1),[m,v]=y.useState(!1),[k,x]=y.useState(!1),[S,j]=y.useState(!1),[N,T]=y.useState("main"),[b,A]=y.useState(null),[P,L]=y.useState(null),[z,q]=y.useState(!1),[F,O]=y.useState(null),[Q,J]=y.useState({kind:"setup"}),[te,me]=y.useState(""),[ke,Le]=y.useState(!1),[Te,oe]=y.useState(null),ee=y.useRef(null);Vi(ee,()=>j(!1),S);const Y=m||k,ae=y.useCallback(async()=>{h(!0),d(null);try{const Se=await fetch(`${gt()}/remote/status`,{headers:{Accept:"application/json"}});if(!Se.ok)throw new Error(`status ${Se.status}`);l(await Se.json())}catch{l(null),d("Machine management is only available from this machine's local pane.")}finally{h(!1)}},[]),K=y.useCallback(async()=>{try{const Se=await fetch(`${gt()}/auth/status`,{headers:{Accept:"application/json"}});if(!Se.ok)throw new Error(`auth status ${Se.status}`);const Be=await Se.json();return A(Be),Be}catch{return null}},[]);y.useEffect(()=>{e&&(T("main"),oe(null),L(null),O(null),ae(),K())},[e,ae,K]);const E=Te!==null&&Te.state==="running";y.useEffect(()=>{if(!E)return;const Se=setInterval(async()=>{try{const Be=await fetch(`${gt()}/remote/enable`,{headers:{Accept:"application/json"}});Be.ok&&oe(await Be.json())}catch{}},zE);return()=>clearInterval(Se)},[E]);const M=N==="login"&&(P==null?void 0:P.state)==="pending";if(y.useEffect(()=>{if(!M)return;const Se=setInterval(async()=>{const Be=await K();Be&&(Be.status==="authorized"?(clearInterval(Se),L(null),X()):Be.login&&Be.login.state!=="pending"&&L(Be.login))},FE);return()=>clearInterval(Se)},[M,K,Q]),y.useEffect(()=>{(Te==null?void 0:Te.state)==="needs_login"&&(J({kind:"enable",mahlas:Te.mahlas??te}),oe(null),T("login"))},[Te,te]),!e)return null;const de=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function U(Se){Se.key==="Escape"&&n(!1)}async function ue(){const Se=b??await K();(Se==null?void 0:Se.status)==="authorized"?T("setup"):(J({kind:"setup"}),T("login"))}function X(){const Se=Q;J({kind:"setup"}),Se.kind==="enable"?Ce(Se.mahlas):Se.kind==="remove"?(T("main"),Ee()):T("setup")}async function ve(){q(!0),O(null);const Se=window.open("about:blank","_blank");try{const Be=await fetch(`${gt()}/auth/initiate`,{method:"POST"}),Xe=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(Xe.error??`initiate ${Be.status}`);L(Xe),Se&&(Se.opener=null,Se.location.href=Xe.loginUrl)}catch(Be){Se==null||Se.close(),O(Be.message||"Could not start the sign-in.")}finally{q(!1)}}function xe(){(P==null?void 0:P.state)==="pending"&&fetch(`${gt()}/auth/cancel`,{method:"POST"}).catch(()=>{}),L(null),O(null),T("main")}async function Ae(){await fetch(`${gt()}/auth/logout`,{method:"POST"}).catch(()=>{}),A(null),J({kind:"setup"}),L(null),T("login")}async function Ce(Se){if(Jg.test(Se)){Le(!0);try{const Be=await fetch(`${gt()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:Se})});if(!Be.ok)throw new Error(`enable ${Be.status}`);oe(await Be.json()),T("setup")}catch{d("Could not start the setup — check the daemon logs.")}finally{Le(!1)}}}function ge(){Te!=null&&Te.troubleshootingSessionId&&(r(Te.troubleshootingSessionId),n(!1))}async function le(){v(!0);try{await fetch(`${gt()}/remote/disable`,{method:"POST"}),await ae()}catch{d("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function Qe(){j(!1),window.confirm(`Remove the tunnel completely?
858
858
 
859
859
  This deletes the Cloudflare tunnel, its DNS record and sign-in sessions, and this machine's remote state. The mahlas is released.
860
860
 
861
- This cannot be undone.`)&&await Ee()}async function Ee(){x(!0);try{const Se=await fetch(`${xt()}/remote/uninstall`,{method:"DELETE"});if(Se.status===401){J({kind:"remove"}),T("login");return}if(!Se.ok)throw new Error(`uninstall ${Se.status}`);await ae()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}function et(){const Se=(P==null?void 0:P.state)==="pending",Be=P!==null&&P.state!=="pending";return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-hint",children:Q.kind==="setup"?"Remote access needs a Repoburg account, so that only you can open this machine from the web.":"The Repoburg account on this machine has expired. Sign in again to continue."}),!Se&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void ve(),disabled:z,children:[z?a.jsx(on,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Continue with Google"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The first sign-in creates your account."})]}),Se&&P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-hint",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(on,{size:14,className:"spin"})," Finish signing in in the browser tab that opened."]}),a.jsx("div",{className:"dialog-hint",children:"Approve only if the page shows this code:"}),a.jsx("div",{style:{padding:"8px 0",textAlign:"center",fontFamily:"var(--font-mono)",fontSize:18,letterSpacing:"0.15em",background:"var(--surface-2)",borderRadius:"var(--r-sm)"},"data-testid":"login-code",children:P.userCode}),a.jsxs("a",{className:"dialog-hint",href:P.loginUrl,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--accent)"},children:["Open the sign-in page again ",a.jsx(af,{size:12})]})]}),(F||Be&&(P==null?void 0:P.error))&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:F??(P==null?void 0:P.error)}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:xe,children:"Back"})})]})}function He(){if(!Te)return a.jsxs(a.Fragment,{children:[(b==null?void 0:b.email)&&a.jsxs("div",{className:"dialog-hint",children:["Signed in as ",a.jsx("strong",{children:b.email})," — only this account can open the machine."," ",a.jsx("button",{type:"button",onClick:()=>void Ae(),style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"underline",cursor:"pointer",font:"inherit"},children:"Use another account"})]}),a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:te,onChange:at=>me(at.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:()=>T("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Jg.test(te)||ke,onClick:()=>void Ce(te),children:[ke?a.jsx(on,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const Se=["detect","provision","install","verify","ready"],Be=Se.indexOf(Te.step),Xe=Te.state==="ready";return a.jsxs(a.Fragment,{children:[Te.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(on,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),Te.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(ps,{size:14})," Setup complete — you can close this window."]}),Te.state==="ready"&&Te.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${Te.hostname}`,target:"_blank",rel:"noreferrer",children:Te.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:Se.map((at,kt)=>{const Ot=Xe||Be>-1&&kt<Be,G=!Xe&&kt===Be&&Te.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:Ot||G?1:.4,color:Ot?"var(--green)":void 0},children:[Ot?a.jsx(ps,{size:13}):G?a.jsx(on,{size:13,className:"spin"}):a.jsx(L1,{size:9,style:{marginLeft:2,marginRight:2}}),at]},at)})}),Te.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:Te.logs.slice(-3).map(at=>at.message).join(`
862
- `)}),Te.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:ge,children:"Open troubleshooting session"})})]}),Te.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",Te.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void ae(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:Se=>Se.stopPropagation(),onKeyDown:U,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(jn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[f&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(on,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),N==="login"?et():N==="setup"?He():a.jsxs(a.Fragment,{children:[de&&(o==null?void 0:o.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.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 le(),disabled:Y,children:[m?a.jsx(on,{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:()=>j(Se=>!Se),disabled:Y,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(on,{size:14,className:"spin"}):a.jsx(Ro,{size:14})}),S&&a.jsx("div",{ref:ee,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 Qe(),children:[a.jsx(fs,{size:12})," Remove tunnel"]})})]})]}),!de&&a.jsx(a.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Ce(o.tunnel.mahlas),disabled:ke,children:[ke?a.jsx(on,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Om,{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:()=>void ue(),children:[a.jsx(Om,{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 zE={success:D1,error:ec,info:U1,warn:nc},FE=4e3;function UE({toast:e}){const n=R(d=>d.removeToast),r=zE[e.type],o=y.useRef(null);y.useEffect(()=>{function d(){o.current=setTimeout(()=>n(e.id),FE)}return d(),()=>{o.current&&clearTimeout(o.current)}},[e.id,n]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>n(e.id),2e3)}return a.jsxs("div",{className:`toast toast-${e.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:e.message}),e.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=e.undoAction)==null||d.call(e),n(e.id)},children:[a.jsx(aS,{size:12})," ",e.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>n(e.id),children:a.jsx(jn,{size:14})})]})}function BE(){const e=R(n=>n.toasts);return e.length===0?null:a.jsx("div",{className:"toast-container",children:e.map(n=>a.jsx(UE,{toast:n},n.id))})}function WE(){const[e]=y.useState(Ik),[n,r]=y.useState(!1),[o,l]=y.useState(!1),c=y.useRef(void 0);y.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Bi(km)&&(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"}),e&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[e&&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:km}),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(ps,{size:15}):a.jsx(Pi,{size:15})})]}),!e&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(e||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(on,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Io=null,Di=1e3;const HE=1e4;function Wd(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(m0("/ws")),Jn.onopen=()=>{const e=Di>1e3;if(Di=1e3,R.getState().setWsConnected(!0),R.getState().addLogEntry("INFO","WebSocket connected"),e){nk();const n=R.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{R.getState().setWsConnected(!1),R.getState().addLogEntry("WARN","WebSocket disconnected"),R.getState().addToast("warn","WebSocket disconnected — reconnecting…"),KE()},Jn.onerror=()=>{},Jn.onmessage=e=>{try{const n=JSON.parse(e.data);Bt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof e.data=="string"?e.data.length:0);const r=GE[n.event];r&&r(n.data)}catch{}})}function VE(){Io&&(clearTimeout(Io),Io=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),R.getState().setWsConnected(!1)}function KE(){Io||(Io=window.setTimeout(()=>{Io=null,Wd()},Di),Di=Math.min(Di*2,HE))}const GE={"turn:created":e=>{const n=e;R.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":e=>{const n=e;Bt.note(`turn:started — ${n.turnId.slice(0,8)}`),R.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":e=>{const n=e,r=y0(n.sessionId,n.turnId,n.itemId,n.delta);R.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta,r)},"streams:snapshot":e=>{const n=e,r=R.getState();for(const o of x0(n.sessionId??null,Array.isArray(n.streams)?n.streams:[]))r.onItemText(o.sessionId,o.turnId,o.itemId,o.text)},"widget:delta":e=>{const n=e;typeof n.itemId!="string"||typeof n.html!="string"||R.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":e=>{const n=e;Bt.note(`turn:completed — ${n.turnId.slice(0,8)}`),vi(n.sessionId,n.turnId),R.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":e=>{const n=e;R.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":e=>{const n=e,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};R.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":e=>{const n=e;vi(n.sessionId,n.turnId),R.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":e=>{const n=e;Bt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),vi(n.sessionId,n.turnId),R.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":e=>{const n=e;vi(n.sessionId,n.turnId),R.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":e=>{const n=e;R.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":e=>{const n=e;R.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":e=>{const n=e;vi(n.sessionId,n.turnId),R.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":e=>{const n=e;R.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":e=>{const n=e;R.getState().onSessionTouched(n.sessionId)},"session:created":e=>{const{session:n}=e;n.origin_app_id&&pl(n.id,n.origin_app_id),R.getState().addSession(n)},"session:resync":e=>{const n=e,r=R.getState();r.activeSessionId===n.sessionId&&r.refreshActiveSession()},"session:updated":e=>{const n=e;R.getState().onSessionUpdated(n.session)},background_tasks:e=>{const n=e;Bt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),R.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":e=>{const n=e;R.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":e=>{const n=e;R.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":e=>{const n=e;R.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":e=>{const n=e;R.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":e=>{const n=e;R.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":e=>{const n=e;R.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":e=>{const n=e;Y0(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":e=>{sk(e.appId),R.getState().refreshApps()},"app:state_changed":e=>{const{appId:n,...r}=e;Nv(n,r)}};function qE(){const e=R(n=>n.init);return y.useEffect(()=>{p0();function n(){e(),Wd()}const{daemonStatus:r,setDaemonStatus:o}=R.getState();let l=null;r==="ready"?n():l=Mk({onMissing:()=>o("missing"),onReady:()=>{o("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=R.getState(),f=d.activeSessionId;if(!f)return;const h=d.sessionDetails[f];d.wsConnected||Wd(),h&&h.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),VE(),document.removeEventListener("visibilitychange",c)}},[e]),null}const fx="agentpaneView";function Hd(e){return{tab:Gd(e),vscode:e.vscodeViewOpen,usage:e.usageViewOpen,terminal:e.terminalViewOpen}}function px(e,n){return e.tab===n.tab&&e.vscode===n.vscode&&e.usage===n.usage&&e.terminal===n.terminal}function ev(e){return e.tab===null&&!e.vscode&&!e.usage&&!e.terminal}function tv(e,n){return n.tab!==null&&!e.tabOrder.includes(n.tab)?!1:!px(n,Hd(e))}function nv(e){const n=e==null?void 0:e[fx];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function XE(e,n){e.getState().vscodeViewOpen!==n.vscode&&e.getState().toggleVscodeView(),e.getState().usageViewOpen!==n.usage&&e.getState().toggleUsageView(),e.getState().terminalViewOpen!==n.terminal&&e.getState().toggleTerminalView();const r=e.getState();if(n.tab===null)return;const{kind:o,id:l}=mr(n.tab);o==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function YE(e){let n=nv(window.history.state)??{index:0,newest:0,view:Hd(e.getState())},r=n.newest,o=!1;const l=new Map([[n.index,n.view]]),c=x=>{const S=e.getState();for(let j=n.index+x;j>=0&&j<=r;j+=x){const N=l.get(j);if(!N||tv(S,N))return!0}return!1},d=()=>{const x=c(-1),S=c(1),j=e.getState();(j.canGoBack!==x||j.canGoForward!==S)&&e.setState({canGoBack:x,canGoForward:S})},f=()=>({[fx]:{...n,newest:r}}),h=()=>{window.history.replaceState({...window.history.state,...f()},"")},m=x=>{if(l.set(n.index,n.view),ev(n.view))n={...n,view:x},h();else{n={index:n.index+1,newest:n.index+1,view:x},r=n.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(f(),"")}l.set(n.index,x)},v=x=>{const S=nv(x.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const j=e.getState(),N=Math.sign(S.index-n.index);if(N!==0&&!tv(j,S.view)){const T=S.index+N;window.history.go(T<0||T>r?n.index-S.index:N);return}n=S,h(),o=!0;try{XE(e,S.view)}finally{o=!1}d()};h(),d(),window.addEventListener("popstate",v);const k=e.subscribe((x,S)=>{const j=x.activeSessionId!==S.activeSessionId||x.activeAppTabId!==S.activeAppTabId||x.vscodeViewOpen!==S.vscodeViewOpen||x.usageViewOpen!==S.usageViewOpen||x.terminalViewOpen!==S.terminalViewOpen;if(!(!j&&x.tabOrder===S.tabOrder)){if(j&&!o){const N=Hd(x);!ev(N)&&!px(N,n.view)&&m(N)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function QE(){const e=R(c=>c.loading),n=R(c=>c.error),r=R(c=>c.sessions),o=R(c=>c.daemonStatus),l=R(c=>c.setShowCommandPalette);return y.useEffect(()=>Bt.start(),[]),y.useEffect(()=>YE(R),[]),y.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(qE,{}),o==="missing"?a.jsx(WE,{}):o==="checking"||e&&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(xE,{}),a.jsx(wE,{}),a.jsx(bE,{}),a.jsx(CE,{}),a.jsx(DE,{}),a.jsx(ME,{}),a.jsx(PE,{}),a.jsx(LE,{}),a.jsx(BE,{})]})]})}n0.createRoot(document.getElementById("root")).render(a.jsx(gt.StrictMode,{children:a.jsx(QE,{})}));export{zi as R,jn as X,m0 as b,ye as c,a as j,y as r,R as u};
861
+ This cannot be undone.`)&&await Ee()}async function Ee(){x(!0);try{const Se=await fetch(`${gt()}/remote/uninstall`,{method:"DELETE"});if(Se.status===401){J({kind:"remove"}),T("login");return}if(!Se.ok)throw new Error(`uninstall ${Se.status}`);await ae()}catch{d("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}function et(){const Se=(P==null?void 0:P.state)==="pending",Be=P!==null&&P.state!=="pending";return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-hint",children:Q.kind==="setup"?"Remote access needs a Repoburg account, so that only you can open this machine from the web.":"The Repoburg account on this machine has expired. Sign in again to continue."}),!Se&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void ve(),disabled:z,children:[z?a.jsx(on,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Continue with Google"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The first sign-in creates your account."})]}),Se&&P&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-hint",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(on,{size:14,className:"spin"})," Finish signing in in the browser tab that opened."]}),a.jsx("div",{className:"dialog-hint",children:"Approve only if the page shows this code:"}),a.jsx("div",{style:{padding:"8px 0",textAlign:"center",fontFamily:"var(--font-mono)",fontSize:18,letterSpacing:"0.15em",background:"var(--surface-2)",borderRadius:"var(--r-sm)"},"data-testid":"login-code",children:P.userCode}),a.jsxs("a",{className:"dialog-hint",href:P.loginUrl,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--accent)"},children:["Open the sign-in page again ",a.jsx(af,{size:12})]})]}),(F||Be&&(P==null?void 0:P.error))&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:F??(P==null?void 0:P.error)}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:xe,children:"Back"})})]})}function He(){if(!Te)return a.jsxs(a.Fragment,{children:[(b==null?void 0:b.email)&&a.jsxs("div",{className:"dialog-hint",children:["Signed in as ",a.jsx("strong",{children:b.email})," — only this account can open the machine."," ",a.jsx("button",{type:"button",onClick:()=>void Ae(),style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"underline",cursor:"pointer",font:"inherit"},children:"Use another account"})]}),a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:te,onChange:at=>me(at.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:()=>T("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Jg.test(te)||ke,onClick:()=>void Ce(te),children:[ke?a.jsx(on,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const Se=["detect","provision","install","verify","ready"],Be=Se.indexOf(Te.step),Xe=Te.state==="ready";return a.jsxs(a.Fragment,{children:[Te.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(on,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),Te.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(ps,{size:14})," Setup complete — you can close this window."]}),Te.state==="ready"&&Te.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${Te.hostname}`,target:"_blank",rel:"noreferrer",children:Te.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:Se.map((at,kt)=>{const Ot=Xe||Be>-1&&kt<Be,G=!Xe&&kt===Be&&Te.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:Ot||G?1:.4,color:Ot?"var(--green)":void 0},children:[Ot?a.jsx(ps,{size:13}):G?a.jsx(on,{size:13,className:"spin"}):a.jsx(P1,{size:9,style:{marginLeft:2,marginRight:2}}),at]},at)})}),Te.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:Te.logs.slice(-3).map(at=>at.message).join(`
862
+ `)}),Te.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:ge,children:"Open troubleshooting session"})})]}),Te.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",Te.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void ae(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>n(!1),children:a.jsxs("div",{className:"dialog",onClick:Se=>Se.stopPropagation(),onKeyDown:U,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(jn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[f&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(on,{size:14,className:"spin"})," Loading machine status…"]}),c&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:c}),N==="login"?et():N==="setup"?He():a.jsxs(a.Fragment,{children:[de&&(o==null?void 0:o.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.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 le(),disabled:Y,children:[m?a.jsx(on,{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:()=>j(Se=>!Se),disabled:Y,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(on,{size:14,className:"spin"}):a.jsx(Ro,{size:14})}),S&&a.jsx("div",{ref:ee,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 Qe(),children:[a.jsx(fs,{size:12})," Remove tunnel"]})})]})]}),!de&&a.jsx(a.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Ce(o.tunnel.mahlas),disabled:ke,children:[ke?a.jsx(on,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Om,{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:()=>void ue(),children:[a.jsx(Om,{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 BE={success:O1,error:ec,info:H1,warn:nc},WE=4e3;function HE({toast:e}){const n=R(d=>d.removeToast),r=BE[e.type],o=y.useRef(null);y.useEffect(()=>{function d(){o.current=setTimeout(()=>n(e.id),WE)}return d(),()=>{o.current&&clearTimeout(o.current)}},[e.id,n]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function c(){o.current=setTimeout(()=>n(e.id),2e3)}return a.jsxs("div",{className:`toast toast-${e.type}`,onMouseEnter:l,onMouseLeave:c,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:e.message}),e.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var d;(d=e.undoAction)==null||d.call(e),n(e.id)},children:[a.jsx(uS,{size:12})," ",e.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>n(e.id),children:a.jsx(jn,{size:14})})]})}function VE(){const e=R(n=>n.toasts);return e.length===0?null:a.jsx("div",{className:"toast-container",children:e.map(n=>a.jsx(HE,{toast:n},n.id))})}function KE(){const[e]=y.useState(Lk),[n,r]=y.useState(!1),[o,l]=y.useState(!1),c=y.useRef(void 0);y.useEffect(()=>()=>clearTimeout(c.current),[]);async function d(){await Bi(km)&&(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"}),e&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[e&&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:km}),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(ps,{size:15}):a.jsx(Pi,{size:15})})]}),!e&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(e||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(on,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Io=null,Di=1e3;const GE=1e4;function Wd(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(y0("/ws")),Jn.onopen=()=>{const e=Di>1e3;if(Di=1e3,R.getState().setWsConnected(!0),R.getState().addLogEntry("INFO","WebSocket connected"),e){ok();const n=R.getState();n.activeSessionId&&(n.refreshActiveSession(),n.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{R.getState().setWsConnected(!1),R.getState().addLogEntry("WARN","WebSocket disconnected"),R.getState().addToast("warn","WebSocket disconnected — reconnecting…"),XE()},Jn.onerror=()=>{},Jn.onmessage=e=>{try{const n=JSON.parse(e.data);Bt.trackWsEvent(typeof n.event=="string"?n.event:"unknown",typeof e.data=="string"?e.data.length:0);const r=YE[n.event];r&&r(n.data)}catch{}})}function qE(){Io&&(clearTimeout(Io),Io=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),R.getState().setWsConnected(!1)}function XE(){Io||(Io=window.setTimeout(()=>{Io=null,Wd()},Di),Di=Math.min(Di*2,GE))}const YE={"turn:created":e=>{const n=e;R.getState().onTurnCreated(n.sessionId,n.turn)},"turn:started":e=>{const n=e;Bt.note(`turn:started — ${n.turnId.slice(0,8)}`),R.getState().onTurnStarted(n.sessionId,n.turnId)},"item:started":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemStarted(n.sessionId,n.turnId,n.item)},"item:updated":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemUpdated(n.sessionId,n.turnId,n.item)},"item:completed":e=>{const n=e;Vu(n.sessionId,n.turnId,n.item),R.getState().onItemCompleted(n.sessionId,n.turnId,n.item)},"item:delta":e=>{const n=e,r=k0(n.sessionId,n.turnId,n.itemId,n.delta);R.getState().onItemDelta(n.sessionId,n.turnId,n.itemId,n.delta,r)},"streams:snapshot":e=>{const n=e,r=R.getState();for(const o of S0(n.sessionId??null,Array.isArray(n.streams)?n.streams:[]))r.onItemText(o.sessionId,o.turnId,o.itemId,o.text)},"widget:delta":e=>{const n=e;typeof n.itemId!="string"||typeof n.html!="string"||R.getState().onWidgetDelta(n.sessionId,n.turnId,n.itemId,typeof n.title=="string"?n.title:"",n.html)},"turn:completed":e=>{const n=e;Bt.note(`turn:completed — ${n.turnId.slice(0,8)}`),vi(n.sessionId,n.turnId),R.getState().onTurnCompleted(n.sessionId,n.turnId,n.usage,n.hasUnreviewed,n.response??void 0)},"turn:tokenUsage":e=>{const n=e;R.getState().onTokenUsageUpdated(n.sessionId,n.turnId,n.usage)},"turn:contextUsage":e=>{const n=e,r={totalTokens:n.totalTokens,contextWindow:n.contextWindow,percentage:n.percentage,...n.autoCompactThreshold?{autoCompactThreshold:n.autoCompactThreshold}:{}};R.getState().onContextUsageUpdated(n.sessionId,r)},"turn:failed":e=>{const n=e;vi(n.sessionId,n.turnId),R.getState().onTurnFailed(n.sessionId,n.turnId,n.error,n.resumeState)},"turn:interrupted":e=>{const n=e;Bt.note(`turn:interrupted — ${n.turnId.slice(0,8)} (${n.reason})`),vi(n.sessionId,n.turnId),R.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":e=>{const n=e;vi(n.sessionId,n.turnId),R.getState().onTurnResuming(n.sessionId,n.turnId,n.attempt)},"turn:resumed":e=>{const n=e;R.getState().onTurnResumed(n.sessionId,n.turnId)},"turn:retrying":e=>{const n=e;R.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":e=>{const n=e;vi(n.sessionId,n.turnId),R.getState().onTurnCancelled(n.sessionId,n.turnId)},"session:title":e=>{const n=e;R.getState().onSessionTitle(n.sessionId,n.title)},"session:touched":e=>{const n=e;R.getState().onSessionTouched(n.sessionId)},"session:created":e=>{const{session:n}=e;n.origin_app_id&&pl(n.id,n.origin_app_id),R.getState().addSession(n)},"session:resync":e=>{const n=e,r=R.getState();r.activeSessionId===n.sessionId&&r.refreshActiveSession()},"session:updated":e=>{const n=e;R.getState().onSessionUpdated(n.session)},background_tasks:e=>{const n=e;Bt.note(`background_tasks — ${n.tasks.length} live (${n.tasks.map(r=>r.task_type).join(", ")||"none"})`),R.getState().onBackgroundTasksChanged(n.sessionId,n.tasks)},"background_tasks:snapshot":e=>{const n=e;R.getState().onBackgroundTasksSnapshot(n.sessions??{})},"signed_out_turns:snapshot":e=>{const n=e;R.getState().onSignedOutTurnsSnapshot(n.turns??[])},"thread:created":e=>{const n=e;R.getState().onThreadCreated(n.sessionId,n.thread,n.turn)},"thread:followup":e=>{const n=e;R.getState().onThreadFollowup(n.sessionId,n.threadId,n.turn)},"thread:resolved":e=>{const n=e;R.getState().onThreadResolved(n.sessionId,n.threadId,n.status)},"thread:deleted":e=>{const n=e;R.getState().onThreadDeleted(n.sessionId,n.threadId)},"app:tool_call":e=>{const n=e;J0(n.appId,n.callId,n.tool,n.args??{},n.workspace,n.caller)},"app:source:updated":e=>{ik(e.appId),R.getState().refreshApps()},"app:state_changed":e=>{const{appId:n,...r}=e;jv(n,r)}};function QE(){const e=R(n=>n.init);return y.useEffect(()=>{g0();function n(){e(),Wd()}const{daemonStatus:r,setDaemonStatus:o}=R.getState();let l=null;r==="ready"?n():l=$k({onMissing:()=>o("missing"),onReady:()=>{o("ready"),n()}});function c(){if(document.visibilityState!=="visible")return;const d=R.getState(),f=d.activeSessionId;if(!f)return;const h=d.sessionDetails[f];d.wsConnected||Wd(),h&&h.is_running===1&&(d.refreshActiveSession(),d.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",c),()=>{l==null||l(),qE(),document.removeEventListener("visibilitychange",c)}},[e]),null}const mx="agentpaneView";function Hd(e){return{tab:Gd(e),vscode:e.vscodeViewOpen,usage:e.usageViewOpen,terminal:e.terminalViewOpen}}function gx(e,n){return e.tab===n.tab&&e.vscode===n.vscode&&e.usage===n.usage&&e.terminal===n.terminal}function ev(e){return e.tab===null&&!e.vscode&&!e.usage&&!e.terminal}function tv(e,n){return n.tab!==null&&!e.tabOrder.includes(n.tab)?!1:!gx(n,Hd(e))}function nv(e){const n=e==null?void 0:e[mx];return typeof(n==null?void 0:n.index)!="number"?null:{...n,view:{...n.view,terminal:!!n.view.terminal}}}function ZE(e,n){e.getState().vscodeViewOpen!==n.vscode&&e.getState().toggleVscodeView(),e.getState().usageViewOpen!==n.usage&&e.getState().toggleUsageView(),e.getState().terminalViewOpen!==n.terminal&&e.getState().toggleTerminalView();const r=e.getState();if(n.tab===null)return;const{kind:o,id:l}=mr(n.tab);o==="app"?r.openAppTab(l):r.activeSessionId===l?r.setActiveAppTab(null):r.selectSession(l)}function JE(e){let n=nv(window.history.state)??{index:0,newest:0,view:Hd(e.getState())},r=n.newest,o=!1;const l=new Map([[n.index,n.view]]),c=x=>{const S=e.getState();for(let j=n.index+x;j>=0&&j<=r;j+=x){const N=l.get(j);if(!N||tv(S,N))return!0}return!1},d=()=>{const x=c(-1),S=c(1),j=e.getState();(j.canGoBack!==x||j.canGoForward!==S)&&e.setState({canGoBack:x,canGoForward:S})},f=()=>({[mx]:{...n,newest:r}}),h=()=>{window.history.replaceState({...window.history.state,...f()},"")},m=x=>{if(l.set(n.index,n.view),ev(n.view))n={...n,view:x},h();else{n={index:n.index+1,newest:n.index+1,view:x},r=n.index;for(const S of l.keys())S>r&&l.delete(S);window.history.pushState(f(),"")}l.set(n.index,x)},v=x=>{const S=nv(x.state);if(!S)return;l.set(S.index,S.view),r=Math.max(r,S.index);const j=e.getState(),N=Math.sign(S.index-n.index);if(N!==0&&!tv(j,S.view)){const T=S.index+N;window.history.go(T<0||T>r?n.index-S.index:N);return}n=S,h(),o=!0;try{ZE(e,S.view)}finally{o=!1}d()};h(),d(),window.addEventListener("popstate",v);const k=e.subscribe((x,S)=>{const j=x.activeSessionId!==S.activeSessionId||x.activeAppTabId!==S.activeAppTabId||x.vscodeViewOpen!==S.vscodeViewOpen||x.usageViewOpen!==S.usageViewOpen||x.terminalViewOpen!==S.terminalViewOpen;if(!(!j&&x.tabOrder===S.tabOrder)){if(j&&!o){const N=Hd(x);!ev(N)&&!gx(N,n.view)&&m(N)}d()}});return()=>{k(),window.removeEventListener("popstate",v)}}function e_(){const e=R(c=>c.loading),n=R(c=>c.error),r=R(c=>c.sessions),o=R(c=>c.daemonStatus),l=R(c=>c.setShowCommandPalette);return y.useEffect(()=>Bt.start(),[]),y.useEffect(()=>JE(R),[]),y.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(QE,{}),o==="missing"?a.jsx(KE,{}):o==="checking"||e&&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(SE,{}),a.jsx(bE,{}),a.jsx(CE,{}),a.jsx(_E,{}),a.jsx(OE,{}),a.jsx($E,{}),a.jsx(UE,{}),a.jsx(PE,{}),a.jsx(VE,{})]})]})}const t_=20,n_=[/ResizeObserver loop/,/^Script error\.?$/,/(chrome|moz|safari(-web)?)-extension:\/\//];let sv=0;const rv=new Set;function s_(e){if(e instanceof Error)return{message:e.message||e.name,stack:e.stack};if(typeof e=="string")return{message:e};try{return{message:JSON.stringify(e)??String(e)}}catch{return{message:String(e)}}}function ov(e,n,r){const{message:o,stack:l}=s_(n),c=o||r||"Unknown error";if(n_.some(f=>f.test(c)||(l?f.test(l):!1)))return;const d=`${e}|${c}`;if(!(rv.has(d)||sv>=t_)){rv.add(d),sv+=1;try{fetch(`${gt()}/telemetry/client`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e,message:c.slice(0,2e3),...l?{stack:l.slice(0,8e3)}:{},page:window.location.pathname}),keepalive:!0}).catch(()=>{})}catch{}}}function r_(){const e=r=>ov("error",r.error,r.message),n=r=>ov("unhandledrejection",r.reason);return window.addEventListener("error",e),window.addEventListener("unhandledrejection",n),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",n)}}r_();o0.createRoot(document.getElementById("root")).render(a.jsx(vt.StrictMode,{children:a.jsx(e_,{})}));export{zi as R,jn as X,y0 as b,ye as c,a as j,y as r,R as u};