@anhlp/alp 0.0.1-beta.4 → 0.0.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -412
- package/bin/alp.js +5 -0
- package/lib/launcher.js +136 -0
- package/package.json +18 -105
- package/dist/THIRD-PARTY-NOTICES.txt +0 -626
- package/dist/acp.js +0 -19936
- package/dist/alpd.js +0 -49562
- package/docs/modular-monorepo.md +0 -214
- package/packages/cli/README.md +0 -7
- package/packages/cli/dist/THIRD-PARTY-NOTICES.txt +0 -651
- package/packages/cli/dist/acp/agent.d.ts +0 -37
- package/packages/cli/dist/acp/agent.js +0 -489
- package/packages/cli/dist/acp/main.d.ts +0 -4
- package/packages/cli/dist/acp/main.js +0 -23
- package/packages/cli/dist/acp.js +0 -19936
- package/packages/cli/dist/alp-web/THIRD-PARTY-NOTICES.txt +0 -2590
- package/packages/cli/dist/alp-web/alp-boundary.json +0 -15
- package/packages/cli/dist/alp-web/apple-touch-icon.png +0 -0
- package/packages/cli/dist/alp-web/assets/TerminalPanel-DLuoa74B.css +0 -1
- package/packages/cli/dist/alp-web/assets/TerminalPanel-PrU2l3u5.js +0 -16
- package/packages/cli/dist/alp-web/assets/index-BJdBTDFX.css +0 -1
- package/packages/cli/dist/alp-web/assets/index-DpfiPv5s.js +0 -52
- package/packages/cli/dist/alp-web/favicon-attention.svg +0 -6
- package/packages/cli/dist/alp-web/favicon-running.svg +0 -6
- package/packages/cli/dist/alp-web/favicon.svg +0 -5
- package/packages/cli/dist/alp-web/index.html +0 -20
- package/packages/cli/dist/alp-web.js +0 -9640
- package/packages/cli/dist/alpd.js +0 -49562
- package/packages/cli/dist/backup.d.ts +0 -4
- package/packages/cli/dist/backup.js +0 -146
- package/packages/cli/dist/build-manifest.json +0 -240
- package/packages/cli/dist/cli.d.ts +0 -2
- package/packages/cli/dist/cli.js +0 -30
- package/packages/cli/dist/daemon.d.ts +0 -35
- package/packages/cli/dist/daemon.js +0 -126
- package/packages/cli/dist/index.d.ts +0 -1
- package/packages/cli/dist/index.js +0 -5
- package/packages/cli/dist/interfaces.d.ts +0 -24
- package/packages/cli/dist/interfaces.js +0 -156
- package/packages/cli/dist/library.d.ts +0 -140
- package/packages/cli/dist/library.js +0 -319
- package/packages/cli/dist/paths.d.ts +0 -3
- package/packages/cli/dist/paths.js +0 -18
- package/packages/cli/dist/projects.d.ts +0 -9
- package/packages/cli/dist/projects.js +0 -159
- package/packages/cli/dist/schedules.d.ts +0 -2
- package/packages/cli/dist/schedules.js +0 -45
- package/packages/cli/dist/sessions.d.ts +0 -43
- package/packages/cli/dist/sessions.js +0 -458
- package/packages/cli/dist/tasks.d.ts +0 -29
- package/packages/cli/dist/tasks.js +0 -345
- package/packages/cli/dist/terminal.d.ts +0 -8
- package/packages/cli/dist/terminal.js +0 -79
- package/packages/cli/dist/usage.d.ts +0 -3
- package/packages/cli/dist/usage.js +0 -78
- package/packages/cli/dist/web-service.d.ts +0 -38
- package/packages/cli/dist/web-service.js +0 -119
- package/packages/client/README.md +0 -29
- package/packages/client/dist/acp-probe.d.ts +0 -44
- package/packages/client/dist/acp-probe.js +0 -37
- package/packages/client/dist/antigravity-probe.d.ts +0 -34
- package/packages/client/dist/antigravity-probe.js +0 -95
- package/packages/client/dist/command.d.ts +0 -5
- package/packages/client/dist/command.js +0 -33
- package/packages/client/dist/doctor.d.ts +0 -13
- package/packages/client/dist/doctor.js +0 -587
- package/packages/client/dist/index.d.ts +0 -151
- package/packages/client/dist/index.js +0 -533
- package/packages/client/dist/integration-lock.d.ts +0 -35
- package/packages/client/dist/integration-lock.js +0 -179
- package/packages/client/dist/ipc.d.ts +0 -42
- package/packages/client/dist/ipc.js +0 -69
- package/packages/client/dist/library-test.d.ts +0 -94
- package/packages/client/dist/library-test.js +0 -37
- package/packages/client/dist/mcp-probe.d.ts +0 -24
- package/packages/client/dist/mcp-probe.js +0 -147
- package/packages/client/dist/portable.d.ts +0 -19
- package/packages/client/dist/portable.js +0 -33
- package/packages/client/dist/prompt.d.ts +0 -32
- package/packages/client/dist/prompt.js +0 -59
- package/packages/client/dist/render.d.ts +0 -6
- package/packages/client/dist/render.js +0 -120
- package/packages/client/dist/rpc/client.d.ts +0 -82
- package/packages/client/dist/rpc/client.js +0 -292
- package/packages/client/dist/rpc/errors.d.ts +0 -42
- package/packages/client/dist/rpc/errors.js +0 -34
- package/packages/client/dist/rpc/framing.d.ts +0 -21
- package/packages/client/dist/rpc/framing.js +0 -57
- package/packages/client/dist/rpc/handshake.d.ts +0 -19
- package/packages/client/dist/rpc/handshake.js +0 -8
- package/packages/client/dist/rpc/reconnect.d.ts +0 -97
- package/packages/client/dist/rpc/reconnect.js +0 -227
- package/packages/client/dist/rpc/registry.d.ts +0 -211
- package/packages/client/dist/rpc/registry.js +0 -145
- package/packages/client/dist/rpc/timers.d.ts +0 -11
- package/packages/client/dist/rpc/timers.js +0 -11
- package/packages/client/dist/service.d.ts +0 -50
- package/packages/client/dist/service.js +0 -143
- package/packages/client/dist/setup.d.ts +0 -2
- package/packages/client/dist/setup.js +0 -146
- package/packages/client/dist/supervise.d.ts +0 -14
- package/packages/client/dist/supervise.js +0 -87
- package/packages/client/dist/websocket.d.ts +0 -51
- package/packages/client/dist/websocket.js +0 -190
- package/packages/core/README.md +0 -7
- package/packages/core/dist/adapter.d.ts +0 -20
- package/packages/core/dist/adapter.js +0 -30
- package/packages/core/dist/atomic.d.ts +0 -2
- package/packages/core/dist/atomic.js +0 -28
- package/packages/core/dist/backup.d.ts +0 -27
- package/packages/core/dist/backup.js +0 -681
- package/packages/core/dist/beads.d.ts +0 -65
- package/packages/core/dist/beads.js +0 -213
- package/packages/core/dist/delegation.d.ts +0 -2
- package/packages/core/dist/delegation.js +0 -32
- package/packages/core/dist/errors.d.ts +0 -4
- package/packages/core/dist/errors.js +0 -11
- package/packages/core/dist/formulas.d.ts +0 -25
- package/packages/core/dist/formulas.js +0 -201
- package/packages/core/dist/hook-run.d.ts +0 -44
- package/packages/core/dist/hook-run.js +0 -60
- package/packages/core/dist/hooks.d.ts +0 -35
- package/packages/core/dist/hooks.js +0 -30
- package/packages/core/dist/index.d.ts +0 -31
- package/packages/core/dist/index.js +0 -65
- package/packages/core/dist/init.d.ts +0 -30
- package/packages/core/dist/init.js +0 -89
- package/packages/core/dist/library-edit.d.ts +0 -93
- package/packages/core/dist/library-edit.js +0 -368
- package/packages/core/dist/library.d.ts +0 -28
- package/packages/core/dist/library.js +0 -108
- package/packages/core/dist/log.d.ts +0 -37
- package/packages/core/dist/log.js +0 -156
- package/packages/core/dist/migrations.d.ts +0 -9
- package/packages/core/dist/migrations.js +0 -95
- package/packages/core/dist/models.d.ts +0 -11
- package/packages/core/dist/models.js +0 -44
- package/packages/core/dist/permissions.d.ts +0 -14
- package/packages/core/dist/permissions.js +0 -229
- package/packages/core/dist/profiles.d.ts +0 -27
- package/packages/core/dist/profiles.js +0 -122
- package/packages/core/dist/promptsafe.d.ts +0 -1
- package/packages/core/dist/promptsafe.js +0 -13
- package/packages/core/dist/providers.d.ts +0 -90
- package/packages/core/dist/providers.js +0 -101
- package/packages/core/dist/resolver.d.ts +0 -41
- package/packages/core/dist/resolver.js +0 -240
- package/packages/core/dist/safe-path.d.ts +0 -2
- package/packages/core/dist/safe-path.js +0 -24
- package/packages/core/dist/shell.d.ts +0 -16
- package/packages/core/dist/shell.js +0 -22
- package/packages/core/dist/state-schema.d.ts +0 -9
- package/packages/core/dist/state-schema.js +0 -54
- package/packages/core/dist/task-rows.d.ts +0 -47
- package/packages/core/dist/task-rows.js +0 -45
- package/packages/core/dist/tasks.d.ts +0 -128
- package/packages/core/dist/tasks.js +0 -835
- package/packages/core/dist/teams.d.ts +0 -80
- package/packages/core/dist/teams.js +0 -159
- package/packages/core/dist/template-path.d.ts +0 -2
- package/packages/core/dist/template-path.js +0 -10
- package/packages/core/dist/trust.d.ts +0 -8
- package/packages/core/dist/trust.js +0 -47
- package/packages/core/dist/types.d.ts +0 -51
- package/packages/core/dist/upgrade.d.ts +0 -10
- package/packages/core/dist/upgrade.js +0 -200
- package/packages/core/dist/user-settings.d.ts +0 -6
- package/packages/core/dist/user-settings.js +0 -72
- package/packages/core/dist/user-worktree.d.ts +0 -29
- package/packages/core/dist/user-worktree.js +0 -242
- package/packages/core/dist/validation.d.ts +0 -17
- package/packages/core/dist/validation.js +0 -296
- package/packages/core/dist/verify.d.ts +0 -15
- package/packages/core/dist/verify.js +0 -123
- package/packages/core/dist/workflow.d.ts +0 -45
- package/packages/core/dist/workflow.js +0 -33
- package/templates/ALP.md +0 -52
- package/templates/agents/lead/AGENT.md +0 -90
- package/templates/agents/main/AGENT.md +0 -150
- package/templates/agents/oracle/AGENT.md +0 -44
- package/templates/agents/peer/AGENT.md +0 -55
- package/templates/agents/reviewer/AGENT.md +0 -80
- package/templates/agents/supervisor/AGENT.md +0 -72
- package/templates/providers/antigravity.json +0 -6
- package/templates/providers/opencode.json +0 -7
- package/templates/role-skills.json +0 -8
- package/templates/skills/bug-loop/SKILL.md +0 -44
- package/templates/skills/bug-loop/references/test-proof.md +0 -25
- package/templates/skills/goal-griller/SKILL.md +0 -49
- package/templates/skills/prompt-leverage/SKILL.md +0 -37
- package/templates/skills/prompt-leverage/references/brief-template.md +0 -27
- package/templates/skills/sequence-execution-plan/SKILL.md +0 -42
- package/templates/skills/sequence-execution-plan/references/plan-template.md +0 -22
- package/templates/skills/smart-commits/SKILL.md +0 -40
- package/templates/skills/xia/SKILL.md +0 -42
- package/templates/teams/cafe/HOUSE_RULES.md +0 -1
- package/templates/teams/cafe/team.json +0 -15
- package/templates/teams/pho/HOUSE_RULES.md +0 -1
- package/templates/teams/pho/team.json +0 -14
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-PrU2l3u5.js","assets/TerminalPanel-DLuoa74B.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
function qw(s,n){for(var i=0;i<n.length;i++){const r=n[i];if(typeof r!="string"&&!Array.isArray(r)){for(const c in r)if(c!=="default"&&!(c in s)){const u=Object.getOwnPropertyDescriptor(r,c);u&&Object.defineProperty(s,c,u.get?u:{enumerable:!0,get:()=>r[c]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function Bw(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ld={exports:{}},Nr={};var Yg;function Uw(){if(Yg)return Nr;Yg=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(r,c,u){var d=null;if(u!==void 0&&(d=""+u),c.key!==void 0&&(d=""+c.key),"key"in c){u={};for(var h in c)h!=="key"&&(u[h]=c[h])}else u=c;return c=u.ref,{$$typeof:s,type:r,key:d,ref:c!==void 0?c:null,props:u}}return Nr.Fragment=n,Nr.jsx=i,Nr.jsxs=i,Nr}var Vg;function $w(){return Vg||(Vg=1,ld.exports=Uw()),ld.exports}var o=$w(),cd={exports:{}},Ue={};var Kg;function Hw(){if(Kg)return Ue;Kg=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.iterator;function w(N){return N===null||typeof N!="object"?null:(N=y&&N[y]||N["@@iterator"],typeof N=="function"?N:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,S={};function E(N,X,P){this.props=N,this.context=X,this.refs=S,this.updater=P||k}E.prototype.isReactComponent={},E.prototype.setState=function(N,X){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,X,"setState")},E.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function q(){}q.prototype=E.prototype;function L(N,X,P){this.props=N,this.context=X,this.refs=S,this.updater=P||k}var M=L.prototype=new q;M.constructor=L,T(M,E.prototype),M.isPureReactComponent=!0;var R=Array.isArray,$={H:null,A:null,T:null,S:null,V:null},_=Object.prototype.hasOwnProperty;function V(N,X,P,ee,oe,re){return P=re.ref,{$$typeof:s,type:N,key:X,ref:P!==void 0?P:null,props:re}}function A(N,X){return V(N.type,X,void 0,void 0,void 0,N.props)}function I(N){return typeof N=="object"&&N!==null&&N.$$typeof===s}function O(N){var X={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(P){return X[P]})}var ce=/\/+/g;function le(N,X){return typeof N=="object"&&N!==null&&N.key!=null?O(""+N.key):X.toString(36)}function pe(){}function ie(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(pe,pe):(N.status="pending",N.then(function(X){N.status==="pending"&&(N.status="fulfilled",N.value=X)},function(X){N.status==="pending"&&(N.status="rejected",N.reason=X)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function de(N,X,P,ee,oe){var re=typeof N;(re==="undefined"||re==="boolean")&&(N=null);var Z=!1;if(N===null)Z=!0;else switch(re){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(N.$$typeof){case s:case n:Z=!0;break;case x:return Z=N._init,de(Z(N._payload),X,P,ee,oe)}}if(Z)return oe=oe(N),Z=ee===""?"."+le(N,0):ee,R(oe)?(P="",Z!=null&&(P=Z.replace(ce,"$&/")+"/"),de(oe,X,P,"",function(he){return he})):oe!=null&&(I(oe)&&(oe=A(oe,P+(oe.key==null||N&&N.key===oe.key?"":(""+oe.key).replace(ce,"$&/")+"/")+Z)),X.push(oe)),1;Z=0;var fe=ee===""?".":ee+":";if(R(N))for(var ge=0;ge<N.length;ge++)ee=N[ge],re=fe+le(ee,ge),Z+=de(ee,X,P,re,oe);else if(ge=w(N),typeof ge=="function")for(N=ge.call(N),ge=0;!(ee=N.next()).done;)ee=ee.value,re=fe+le(ee,ge++),Z+=de(ee,X,P,re,oe);else if(re==="object"){if(typeof N.then=="function")return de(ie(N),X,P,ee,oe);throw X=String(N),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return Z}function B(N,X,P){if(N==null)return N;var ee=[],oe=0;return de(N,ee,"","",function(re){return X.call(P,re,oe++)}),ee}function W(N){if(N._status===-1){var X=N._result;X=X(),X.then(function(P){(N._status===0||N._status===-1)&&(N._status=1,N._result=P)},function(P){(N._status===0||N._status===-1)&&(N._status=2,N._result=P)}),N._status===-1&&(N._status=0,N._result=X)}if(N._status===1)return N._result.default;throw N._result}var ne=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)};function me(){}return Ue.Children={map:B,forEach:function(N,X,P){B(N,function(){X.apply(this,arguments)},P)},count:function(N){var X=0;return B(N,function(){X++}),X},toArray:function(N){return B(N,function(X){return X})||[]},only:function(N){if(!I(N))throw Error("React.Children.only expected to receive a single React element child.");return N}},Ue.Component=E,Ue.Fragment=i,Ue.Profiler=c,Ue.PureComponent=L,Ue.StrictMode=r,Ue.Suspense=m,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(N){return $.H.useMemoCache(N)}},Ue.cache=function(N){return function(){return N.apply(null,arguments)}},Ue.cloneElement=function(N,X,P){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var ee=T({},N.props),oe=N.key,re=void 0;if(X!=null)for(Z in X.ref!==void 0&&(re=void 0),X.key!==void 0&&(oe=""+X.key),X)!_.call(X,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&X.ref===void 0||(ee[Z]=X[Z]);var Z=arguments.length-2;if(Z===1)ee.children=P;else if(1<Z){for(var fe=Array(Z),ge=0;ge<Z;ge++)fe[ge]=arguments[ge+2];ee.children=fe}return V(N.type,oe,void 0,void 0,re,ee)},Ue.createContext=function(N){return N={$$typeof:d,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:u,_context:N},N},Ue.createElement=function(N,X,P){var ee,oe={},re=null;if(X!=null)for(ee in X.key!==void 0&&(re=""+X.key),X)_.call(X,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(oe[ee]=X[ee]);var Z=arguments.length-2;if(Z===1)oe.children=P;else if(1<Z){for(var fe=Array(Z),ge=0;ge<Z;ge++)fe[ge]=arguments[ge+2];oe.children=fe}if(N&&N.defaultProps)for(ee in Z=N.defaultProps,Z)oe[ee]===void 0&&(oe[ee]=Z[ee]);return V(N,re,void 0,void 0,null,oe)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(N){return{$$typeof:h,render:N}},Ue.isValidElement=I,Ue.lazy=function(N){return{$$typeof:x,_payload:{_status:-1,_result:N},_init:W}},Ue.memo=function(N,X){return{$$typeof:g,type:N,compare:X===void 0?null:X}},Ue.startTransition=function(N){var X=$.T,P={};$.T=P;try{var ee=N(),oe=$.S;oe!==null&&oe(P,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(me,ne)}catch(re){ne(re)}finally{$.T=X}},Ue.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ue.use=function(N){return $.H.use(N)},Ue.useActionState=function(N,X,P){return $.H.useActionState(N,X,P)},Ue.useCallback=function(N,X){return $.H.useCallback(N,X)},Ue.useContext=function(N){return $.H.useContext(N)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(N,X){return $.H.useDeferredValue(N,X)},Ue.useEffect=function(N,X,P){var ee=$.H;if(typeof P=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return ee.useEffect(N,X)},Ue.useId=function(){return $.H.useId()},Ue.useImperativeHandle=function(N,X,P){return $.H.useImperativeHandle(N,X,P)},Ue.useInsertionEffect=function(N,X){return $.H.useInsertionEffect(N,X)},Ue.useLayoutEffect=function(N,X){return $.H.useLayoutEffect(N,X)},Ue.useMemo=function(N,X){return $.H.useMemo(N,X)},Ue.useOptimistic=function(N,X){return $.H.useOptimistic(N,X)},Ue.useReducer=function(N,X,P){return $.H.useReducer(N,X,P)},Ue.useRef=function(N){return $.H.useRef(N)},Ue.useState=function(N){return $.H.useState(N)},Ue.useSyncExternalStore=function(N,X,P){return $.H.useSyncExternalStore(N,X,P)},Ue.useTransition=function(){return $.H.useTransition()},Ue.version="19.1.0",Ue}var Xg;function bf(){return Xg||(Xg=1,cd.exports=Hw()),cd.exports}var v=bf();const Gw=Bw(v),Iw=qw({__proto__:null,default:Gw},[v]);var ud={exports:{}},Tr={},dd={exports:{}},fd={};var Qg;function Yw(){return Qg||(Qg=1,(function(s){function n(B,W){var ne=B.length;B.push(W);e:for(;0<ne;){var me=ne-1>>>1,N=B[me];if(0<c(N,W))B[me]=W,B[ne]=N,ne=me;else break e}}function i(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var W=B[0],ne=B.pop();if(ne!==W){B[0]=ne;e:for(var me=0,N=B.length,X=N>>>1;me<X;){var P=2*(me+1)-1,ee=B[P],oe=P+1,re=B[oe];if(0>c(ee,ne))oe<N&&0>c(re,ee)?(B[me]=re,B[oe]=ne,me=oe):(B[me]=ee,B[P]=ne,me=P);else if(oe<N&&0>c(re,ne))B[me]=re,B[oe]=ne,me=oe;else break e}}return W}function c(B,W){var ne=B.sortIndex-W.sortIndex;return ne!==0?ne:B.id-W.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;s.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();s.unstable_now=function(){return d.now()-h}}var m=[],g=[],x=1,y=null,w=3,k=!1,T=!1,S=!1,E=!1,q=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function R(B){for(var W=i(g);W!==null;){if(W.callback===null)r(g);else if(W.startTime<=B)r(g),W.sortIndex=W.expirationTime,n(m,W);else break;W=i(g)}}function $(B){if(S=!1,R(B),!T)if(i(m)!==null)T=!0,_||(_=!0,le());else{var W=i(g);W!==null&&de($,W.startTime-B)}}var _=!1,V=-1,A=5,I=-1;function O(){return E?!0:!(s.unstable_now()-I<A)}function ce(){if(E=!1,_){var B=s.unstable_now();I=B;var W=!0;try{e:{T=!1,S&&(S=!1,L(V),V=-1),k=!0;var ne=w;try{t:{for(R(B),y=i(m);y!==null&&!(y.expirationTime>B&&O());){var me=y.callback;if(typeof me=="function"){y.callback=null,w=y.priorityLevel;var N=me(y.expirationTime<=B);if(B=s.unstable_now(),typeof N=="function"){y.callback=N,R(B),W=!0;break t}y===i(m)&&r(m),R(B)}else r(m);y=i(m)}if(y!==null)W=!0;else{var X=i(g);X!==null&&de($,X.startTime-B),W=!1}}break e}finally{y=null,w=ne,k=!1}W=void 0}}finally{W?le():_=!1}}}var le;if(typeof M=="function")le=function(){M(ce)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,ie=pe.port2;pe.port1.onmessage=ce,le=function(){ie.postMessage(null)}}else le=function(){q(ce,0)};function de(B,W){V=q(function(){B(s.unstable_now())},W)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(B){B.callback=null},s.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<B?Math.floor(1e3/B):5},s.unstable_getCurrentPriorityLevel=function(){return w},s.unstable_next=function(B){switch(w){case 1:case 2:case 3:var W=3;break;default:W=w}var ne=w;w=W;try{return B()}finally{w=ne}},s.unstable_requestPaint=function(){E=!0},s.unstable_runWithPriority=function(B,W){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ne=w;w=B;try{return W()}finally{w=ne}},s.unstable_scheduleCallback=function(B,W,ne){var me=s.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?me+ne:me):ne=me,B){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=ne+N,B={id:x++,callback:W,priorityLevel:B,startTime:ne,expirationTime:N,sortIndex:-1},ne>me?(B.sortIndex=ne,n(g,B),i(m)===null&&B===i(g)&&(S?(L(V),V=-1):S=!0,de($,ne-me))):(B.sortIndex=N,n(m,B),T||k||(T=!0,_||(_=!0,le()))),B},s.unstable_shouldYield=O,s.unstable_wrapCallback=function(B){var W=w;return function(){var ne=w;w=W;try{return B.apply(this,arguments)}finally{w=ne}}}})(fd)),fd}var Zg;function Vw(){return Zg||(Zg=1,dd.exports=Yw()),dd.exports}var hd={exports:{}},It={};var Wg;function Kw(){if(Wg)return It;Wg=1;var s=bf();function n(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(m,g,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:m,containerInfo:g,implementation:x}}var d=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return It.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,It.createPortal=function(m,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(n(299));return u(m,g,null,x)},It.flushSync=function(m){var g=d.T,x=r.p;try{if(d.T=null,r.p=2,m)return m()}finally{d.T=g,r.p=x,r.d.f()}},It.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,r.d.C(m,g))},It.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},It.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var x=g.as,y=h(x,g.crossOrigin),w=typeof g.integrity=="string"?g.integrity:void 0,k=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?r.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:k}):x==="script"&&r.d.X(m,{crossOrigin:y,integrity:w,fetchPriority:k,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},It.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=h(g.as,g.crossOrigin);r.d.M(m,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&r.d.M(m)},It.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,y=h(x,g.crossOrigin);r.d.L(m,x,{crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},It.preloadModule=function(m,g){if(typeof m=="string")if(g){var x=h(g.as,g.crossOrigin);r.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else r.d.m(m)},It.requestFormReset=function(m){r.d.r(m)},It.unstable_batchedUpdates=function(m,g){return m(g)},It.useFormState=function(m,g,x){return d.H.useFormState(m,g,x)},It.useFormStatus=function(){return d.H.useHostTransitionStatus()},It.version="19.1.0",It}var Pg;function Xw(){if(Pg)return hd.exports;Pg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),hd.exports=Kw(),hd.exports}var Fg;function Qw(){if(Fg)return Tr;Fg=1;var s=Vw(),n=bf(),i=Xw();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(u(e)!==e)throw Error(r(188))}function m(e){var t=e.alternate;if(!t){if(t=u(e),t===null)throw Error(r(188));return t!==e?null:e}for(var a=e,l=t;;){var f=a.return;if(f===null)break;var p=f.alternate;if(p===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===a)return h(f),e;if(p===l)return h(f),t;p=p.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=p;else{for(var b=!1,j=f.child;j;){if(j===a){b=!0,a=f,l=p;break}if(j===l){b=!0,l=f,a=p;break}j=j.sibling}if(!b){for(j=p.child;j;){if(j===a){b=!0,a=p,l=f;break}if(j===l){b=!0,l=p,a=f;break}j=j.sibling}if(!b)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,y=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),q=Symbol.for("react.provider"),L=Symbol.for("react.consumer"),M=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=ce&&e[ce]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Symbol.for("react.client.reference");function ie(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case E:return"Profiler";case S:return"StrictMode";case $:return"Suspense";case _:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case M:return(e.displayName||"Context")+".Provider";case L:return(e._context.displayName||"Context")+".Consumer";case R:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case A:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var de=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},me=[],N=-1;function X(e){return{current:e}}function P(e){0>N||(e.current=me[N],me[N]=null,N--)}function ee(e,t){N++,me[N]=e.current,e.current=t}var oe=X(null),re=X(null),Z=X(null),fe=X(null);function ge(e,t){switch(ee(Z,t),ee(re,e),ee(oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yg(t),e=bg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}P(oe),ee(oe,e)}function he(){P(oe),P(re),P(Z)}function nt(e){e.memoizedState!==null&&ee(fe,e);var t=oe.current,a=bg(t,e.type);t!==a&&(ee(re,e),ee(oe,a))}function $e(e){re.current===e&&(P(oe),P(re)),fe.current===e&&(P(fe),vr._currentValue=ne)}var ct=Object.prototype.hasOwnProperty,ht=s.unstable_scheduleCallback,ve=s.unstable_cancelCallback,xe=s.unstable_shouldYield,Ee=s.unstable_requestPaint,je=s.unstable_now,Ot=s.unstable_getCurrentPriorityLevel,pn=s.unstable_ImmediatePriority,Ce=s.unstable_UserBlockingPriority,st=s.unstable_NormalPriority,ue=s.unstable_LowPriority,Se=s.unstable_IdlePriority,pt=s.log,gn=s.unstable_setDisableYieldValue,wt=null,it=null;function Nt(e){if(typeof pt=="function"&&gn(e),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(wt,e)}catch{}}var xt=Math.clz32?Math.clz32:eo,Rn=Math.log,Jr=Math.LN2;function eo(e){return e>>>=0,e===0?32:31-(Rn(e)/Jr|0)|0}var Vs=256,Ks=4194304;function Ln(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ci(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,p=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~p,l!==0?f=Ln(l):(b&=j,b!==0?f=Ln(b):a||(a=j&~e,a!==0&&(f=Ln(a))))):(j=l&~p,j!==0?f=Ln(j):b!==0?f=Ln(b):a||(a=l&~e,a!==0&&(f=Ln(a)))),f===0?0:t!==0&&t!==f&&(t&p)===0&&(p=f&-f,a=t&-t,p>=a||p===32&&(a&4194048)!==0)?t:f}function U(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function se(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ye(){var e=Vs;return Vs<<=1,(Vs&4194048)===0&&(Vs=256),e}function Ne(){var e=Ks;return Ks<<=1,(Ks&62914560)===0&&(Ks=4194304),e}function Te(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Ze(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,a,l,f,p){var b=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var j=e.entanglements,C=e.expirationTimes,G=e.hiddenUpdates;for(a=b&~a;0<a;){var F=31-xt(a),te=1<<F;j[F]=0,C[F]=-1;var K=G[F];if(K!==null)for(G[F]=null,F=0;F<K.length;F++){var Q=K[F];Q!==null&&(Q.lane&=-536870913)}a&=~te}l!==0&&kt(e,l,0),p!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=p&~(b&~t))}function kt(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-xt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&4194090}function Ye(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-xt(a),f=1<<l;f&t|e[l]&t&&(e[l]|=t),a&=~f}}function at(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xs(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qs(){var e=W.p;return e!==0?e:(e=window.event,e===void 0?32:Bg(e.type))}function sn(e,t){var a=W.p;try{return W.p=e,t()}finally{W.p=a}}var On=Math.random().toString(36).slice(2),Ht="__reactFiber$"+On,Wt="__reactProps$"+On,Mi="__reactContainer$"+On,ec="__reactEvents$"+On,A1="__reactListeners$"+On,E1="__reactHandles$"+On,rh="__reactResources$"+On,za="__reactMarker$"+On;function tc(e){delete e[Ht],delete e[Wt],delete e[ec],delete e[A1],delete e[E1]}function zi(e){var t=e[Ht];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Mi]||a[Ht]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=jg(e);e!==null;){if(a=e[Ht])return a;e=jg(e)}return t}e=a,a=e.parentNode}return null}function _i(e){if(e=e[Ht]||e[Mi]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function _a(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ri(e){var t=e[rh];return t||(t=e[rh]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function zt(e){e[za]=!0}var oh=new Set,lh={};function Zs(e,t){Li(e,t),Li(e+"Capture",t)}function Li(e,t){for(lh[e]=t,e=0;e<t.length;e++)oh.add(t[e])}var C1=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ch={},uh={};function M1(e){return ct.call(uh,e)?!0:ct.call(ch,e)?!1:C1.test(e)?uh[e]=!0:(ch[e]=!0,!1)}function to(e,t,a){if(M1(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function no(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Kn(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}var nc,dh;function Oi(e){if(nc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);nc=t&&t[1]||"",dh=-1<a.stack.indexOf(`
|
|
3
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
-
`+nc+e+dh}var sc=!1;function ic(e,t){if(!e||sc)return"";sc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(Q){var K=Q}Reflect.construct(e,[],te)}else{try{te.call()}catch(Q){K=Q}e.call(te.prototype)}}else{try{throw Error()}catch(Q){K=Q}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(Q){if(Q&&K&&typeof Q.stack=="string")return[Q.stack,K.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),b=p[0],j=p[1];if(b&&j){var C=b.split(`
|
|
5
|
-
`),G=j.split(`
|
|
6
|
-
`);for(f=l=0;l<C.length&&!C[l].includes("DetermineComponentFrameRoot");)l++;for(;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;if(l===C.length||f===G.length)for(l=C.length-1,f=G.length-1;1<=l&&0<=f&&C[l]!==G[f];)f--;for(;1<=l&&0<=f;l--,f--)if(C[l]!==G[f]){if(l!==1||f!==1)do if(l--,f--,0>f||C[l]!==G[f]){var F=`
|
|
7
|
-
`+C[l].replace(" at new "," at ");return e.displayName&&F.includes("<anonymous>")&&(F=F.replace("<anonymous>",e.displayName)),F}while(1<=l&&0<=f);break}}}finally{sc=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Oi(a):""}function z1(e){switch(e.tag){case 26:case 27:case 5:return Oi(e.type);case 16:return Oi("Lazy");case 13:return Oi("Suspense");case 19:return Oi("SuspenseList");case 0:case 15:return ic(e.type,!1);case 11:return ic(e.type.render,!1);case 1:return ic(e.type,!0);case 31:return Oi("Activity");default:return""}}function fh(e){try{var t="";do t+=z1(e),e=e.return;while(e);return t}catch(a){return`
|
|
8
|
-
Error generating stack: `+a.message+`
|
|
9
|
-
`+a.stack}}function xn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function hh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _1(e){var t=hh(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,p=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return f.call(this)},set:function(b){l=""+b,p.call(this,b)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function so(e){e._valueTracker||(e._valueTracker=_1(e))}function mh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=hh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function io(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var R1=/[\n"\\]/g;function yn(e){return e.replace(R1,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ac(e,t,a,l,f,p,b,j){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+xn(t)):e.value!==""+xn(t)&&(e.value=""+xn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?rc(e,b,xn(t)):a!=null?rc(e,b,xn(a)):l!=null&&e.removeAttribute("value"),f==null&&p!=null&&(e.defaultChecked=!!p),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+xn(j):e.removeAttribute("name")}function ph(e,t,a,l,f,p,b,j){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.type=p),t!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||t!=null))return;a=a!=null?""+xn(a):"",t=t!=null?""+xn(t):a,j||t===e.value||(e.value=t),e.defaultValue=t}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=j?e.checked:!!l,e.defaultChecked=!!l,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b)}function rc(e,t,a){t==="number"&&io(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Di(e,t,a,l){if(e=e.options,t){t={};for(var f=0;f<a.length;f++)t["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=t.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+xn(a),t=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}t!==null||e[f].disabled||(t=e[f])}t!==null&&(t.selected=!0)}}function gh(e,t,a){if(t!=null&&(t=""+xn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+xn(a):""}function xh(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(r(92));if(de(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=xn(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l)}function qi(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var L1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function yh(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||L1.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function bh(e,t,a){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in t)l=t[f],t.hasOwnProperty(f)&&a[f]!==l&&yh(e,f,l)}else for(var p in t)t.hasOwnProperty(p)&&yh(e,p,t[p])}function oc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var O1=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),D1=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ao(e){return D1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var lc=null;function cc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bi=null,Ui=null;function vh(e){var t=_i(e);if(t&&(e=t.stateNode)){var a=e[Wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ac(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+yn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var f=l[Wt]||null;if(!f)throw Error(r(90));ac(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&mh(l)}break e;case"textarea":gh(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Di(e,!!a.multiple,t,!1)}}}var uc=!1;function wh(e,t,a){if(uc)return e(t,a);uc=!0;try{var l=e(t);return l}finally{if(uc=!1,(Bi!==null||Ui!==null)&&(Vo(),Bi&&(t=Bi,e=Ui,Ui=Bi=null,vh(t),e)))for(t=0;t<e.length;t++)vh(e[t])}}function Ra(e,t){var a=e.stateNode;if(a===null)return null;var l=a[Wt]||null;if(l===null)return null;a=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,t,typeof a));return a}var Xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dc=!1;if(Xn)try{var La={};Object.defineProperty(La,"passive",{get:function(){dc=!0}}),window.addEventListener("test",La,La),window.removeEventListener("test",La,La)}catch{dc=!1}var hs=null,fc=null,ro=null;function kh(){if(ro)return ro;var e,t=fc,a=t.length,l,f="value"in hs?hs.value:hs.textContent,p=f.length;for(e=0;e<a&&t[e]===f[e];e++);var b=a-e;for(l=1;l<=b&&t[a-l]===f[p-l];l++);return ro=f.slice(e,1<l?1-l:void 0)}function oo(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function lo(){return!0}function jh(){return!1}function Pt(e){function t(a,l,f,p,b){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=p,this.target=b,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(a=e[j],this[j]=a?a(p):p[j]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?lo:jh,this.isPropagationStopped=jh,this}return x(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=lo)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=lo)},persist:function(){},isPersistent:lo}),t}var Ws={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},co=Pt(Ws),Oa=x({},Ws,{view:0,detail:0}),q1=Pt(Oa),hc,mc,Da,uo=x({},Oa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Da&&(Da&&e.type==="mousemove"?(hc=e.screenX-Da.screenX,mc=e.screenY-Da.screenY):mc=hc=0,Da=e),hc)},movementY:function(e){return"movementY"in e?e.movementY:mc}}),Sh=Pt(uo),B1=x({},uo,{dataTransfer:0}),U1=Pt(B1),$1=x({},Oa,{relatedTarget:0}),pc=Pt($1),H1=x({},Ws,{animationName:0,elapsedTime:0,pseudoElement:0}),G1=Pt(H1),I1=x({},Ws,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Y1=Pt(I1),V1=x({},Ws,{data:0}),Nh=Pt(V1),K1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X1={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"},Q1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z1(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Q1[e])?!!t[e]:!1}function gc(){return Z1}var W1=x({},Oa,{key:function(e){if(e.key){var t=K1[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=oo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?X1[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gc,charCode:function(e){return e.type==="keypress"?oo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?oo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),P1=Pt(W1),F1=x({},uo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Th=Pt(F1),J1=x({},Oa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gc}),ev=Pt(J1),tv=x({},Ws,{propertyName:0,elapsedTime:0,pseudoElement:0}),nv=Pt(tv),sv=x({},uo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),iv=Pt(sv),av=x({},Ws,{newState:0,oldState:0}),rv=Pt(av),ov=[9,13,27,32],xc=Xn&&"CompositionEvent"in window,qa=null;Xn&&"documentMode"in document&&(qa=document.documentMode);var lv=Xn&&"TextEvent"in window&&!qa,Ah=Xn&&(!xc||qa&&8<qa&&11>=qa),Eh=" ",Ch=!1;function Mh(e,t){switch(e){case"keyup":return ov.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $i=!1;function cv(e,t){switch(e){case"compositionend":return zh(t);case"keypress":return t.which!==32?null:(Ch=!0,Eh);case"textInput":return e=t.data,e===Eh&&Ch?null:e;default:return null}}function uv(e,t){if($i)return e==="compositionend"||!xc&&Mh(e,t)?(e=kh(),ro=fc=hs=null,$i=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ah&&t.locale!=="ko"?null:t.data;default:return null}}var dv={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 _h(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dv[e.type]:t==="textarea"}function Rh(e,t,a,l){Bi?Ui?Ui.push(l):Ui=[l]:Bi=l,t=Po(t,"onChange"),0<t.length&&(a=new co("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var Ba=null,Ua=null;function fv(e){hg(e,0)}function fo(e){var t=_a(e);if(mh(t))return e}function Lh(e,t){if(e==="change")return t}var Oh=!1;if(Xn){var yc;if(Xn){var bc="oninput"in document;if(!bc){var Dh=document.createElement("div");Dh.setAttribute("oninput","return;"),bc=typeof Dh.oninput=="function"}yc=bc}else yc=!1;Oh=yc&&(!document.documentMode||9<document.documentMode)}function qh(){Ba&&(Ba.detachEvent("onpropertychange",Bh),Ua=Ba=null)}function Bh(e){if(e.propertyName==="value"&&fo(Ua)){var t=[];Rh(t,Ua,e,cc(e)),wh(fv,t)}}function hv(e,t,a){e==="focusin"?(qh(),Ba=t,Ua=a,Ba.attachEvent("onpropertychange",Bh)):e==="focusout"&&qh()}function mv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fo(Ua)}function pv(e,t){if(e==="click")return fo(t)}function gv(e,t){if(e==="input"||e==="change")return fo(t)}function xv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var an=typeof Object.is=="function"?Object.is:xv;function $a(e,t){if(an(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!ct.call(t,f)||!an(e[f],t[f]))return!1}return!0}function Uh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $h(e,t){var a=Uh(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Uh(a)}}function Hh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=io(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=io(e.document)}return t}function vc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var yv=Xn&&"documentMode"in document&&11>=document.documentMode,Hi=null,wc=null,Ha=null,kc=!1;function Ih(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;kc||Hi==null||Hi!==io(l)||(l=Hi,"selectionStart"in l&&vc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ha&&$a(Ha,l)||(Ha=l,l=Po(wc,"onSelect"),0<l.length&&(t=new co("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=Hi)))}function Ps(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Gi={animationend:Ps("Animation","AnimationEnd"),animationiteration:Ps("Animation","AnimationIteration"),animationstart:Ps("Animation","AnimationStart"),transitionrun:Ps("Transition","TransitionRun"),transitionstart:Ps("Transition","TransitionStart"),transitioncancel:Ps("Transition","TransitionCancel"),transitionend:Ps("Transition","TransitionEnd")},jc={},Yh={};Xn&&(Yh=document.createElement("div").style,"AnimationEvent"in window||(delete Gi.animationend.animation,delete Gi.animationiteration.animation,delete Gi.animationstart.animation),"TransitionEvent"in window||delete Gi.transitionend.transition);function Fs(e){if(jc[e])return jc[e];if(!Gi[e])return e;var t=Gi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Yh)return jc[e]=t[a];return e}var Vh=Fs("animationend"),Kh=Fs("animationiteration"),Xh=Fs("animationstart"),bv=Fs("transitionrun"),vv=Fs("transitionstart"),wv=Fs("transitioncancel"),Qh=Fs("transitionend"),Zh=new Map,Sc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Sc.push("scrollEnd");function En(e,t){Zh.set(e,t),Zs(t,[e])}var Wh=new WeakMap;function bn(e,t){if(typeof e=="object"&&e!==null){var a=Wh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:fh(t)},Wh.set(e,t),t)}return{value:e,source:t,stack:fh(t)}}var vn=[],Ii=0,Nc=0;function ho(){for(var e=Ii,t=Nc=Ii=0;t<e;){var a=vn[t];vn[t++]=null;var l=vn[t];vn[t++]=null;var f=vn[t];vn[t++]=null;var p=vn[t];if(vn[t++]=null,l!==null&&f!==null){var b=l.pending;b===null?f.next=f:(f.next=b.next,b.next=f),l.pending=f}p!==0&&Ph(a,f,p)}}function mo(e,t,a,l){vn[Ii++]=e,vn[Ii++]=t,vn[Ii++]=a,vn[Ii++]=l,Nc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Tc(e,t,a,l){return mo(e,t,a,l),po(e)}function Yi(e,t){return mo(e,null,null,t),po(e)}function Ph(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,p=e.return;p!==null;)p.childLanes|=a,l=p.alternate,l!==null&&(l.childLanes|=a),p.tag===22&&(e=p.stateNode,e===null||e._visibility&1||(f=!0)),e=p,p=p.return;return e.tag===3?(p=e.stateNode,f&&t!==null&&(f=31-xt(a),e=p.hiddenUpdates,l=e[f],l===null?e[f]=[t]:l.push(t),t.lane=a|536870912),p):null}function po(e){if(50<fr)throw fr=0,_u=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vi={};function kv(e,t,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(e,t,a,l){return new kv(e,t,a,l)}function Ac(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qn(e,t){var a=e.alternate;return a===null?(a=rn(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Fh(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function go(e,t,a,l,f,p){var b=0;if(l=e,typeof e=="function")Ac(e)&&(b=1);else if(typeof e=="string")b=Sw(e,a,oe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=rn(31,a,t,f),e.elementType=I,e.lanes=p,e;case T:return Js(a.children,f,p,t);case S:b=8,f|=24;break;case E:return e=rn(12,a,t,f|2),e.elementType=E,e.lanes=p,e;case $:return e=rn(13,a,t,f),e.elementType=$,e.lanes=p,e;case _:return e=rn(19,a,t,f),e.elementType=_,e.lanes=p,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:case M:b=10;break e;case L:b=9;break e;case R:b=11;break e;case V:b=14;break e;case A:b=16,l=null;break e}b=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=rn(b,a,t,f),t.elementType=e,t.type=l,t.lanes=p,t}function Js(e,t,a,l){return e=rn(7,e,l,t),e.lanes=a,e}function Ec(e,t,a){return e=rn(6,e,null,t),e.lanes=a,e}function Cc(e,t,a){return t=rn(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ki=[],Xi=0,xo=null,yo=0,wn=[],kn=0,ei=null,Zn=1,Wn="";function ti(e,t){Ki[Xi++]=yo,Ki[Xi++]=xo,xo=e,yo=t}function Jh(e,t,a){wn[kn++]=Zn,wn[kn++]=Wn,wn[kn++]=ei,ei=e;var l=Zn;e=Wn;var f=32-xt(l)-1;l&=~(1<<f),a+=1;var p=32-xt(t)+f;if(30<p){var b=f-f%5;p=(l&(1<<b)-1).toString(32),l>>=b,f-=b,Zn=1<<32-xt(t)+f|a<<f|l,Wn=p+e}else Zn=1<<p|a<<f|l,Wn=e}function Mc(e){e.return!==null&&(ti(e,1),Jh(e,1,0))}function zc(e){for(;e===xo;)xo=Ki[--Xi],Ki[Xi]=null,yo=Ki[--Xi],Ki[Xi]=null;for(;e===ei;)ei=wn[--kn],wn[kn]=null,Wn=wn[--kn],wn[kn]=null,Zn=wn[--kn],wn[kn]=null}var Kt=null,yt=null,Pe=!1,ni=null,Dn=!1,_c=Error(r(519));function si(e){var t=Error(r(418,""));throw Ya(bn(t,e)),_c}function em(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[Ht]=e,t[Wt]=l,a){case"dialog":Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":case"embed":Ke("load",t);break;case"video":case"audio":for(a=0;a<mr.length;a++)Ke(mr[a],t);break;case"source":Ke("error",t);break;case"img":case"image":case"link":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"input":Ke("invalid",t),ph(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),so(t);break;case"select":Ke("invalid",t);break;case"textarea":Ke("invalid",t),xh(t,l.value,l.defaultValue,l.children),so(t)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||xg(t.textContent,a)?(l.popover!=null&&(Ke("beforetoggle",t),Ke("toggle",t)),l.onScroll!=null&&Ke("scroll",t),l.onScrollEnd!=null&&Ke("scrollend",t),l.onClick!=null&&(t.onclick=Fo),t=!0):t=!1,t||si(e)}function tm(e){for(Kt=e.return;Kt;)switch(Kt.tag){case 5:case 13:Dn=!1;return;case 27:case 3:Dn=!0;return;default:Kt=Kt.return}}function Ga(e){if(e!==Kt)return!1;if(!Pe)return tm(e),Pe=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Qu(e.type,e.memoizedProps)),a=!a),a&&yt&&si(e),tm(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(a=e.data,a==="/$"){if(t===0){yt=Mn(e.nextSibling);break e}t--}else a!=="$"&&a!=="$!"&&a!=="$?"||t++;e=e.nextSibling}yt=null}}else t===27?(t=yt,Cs(e.type)?(e=Fu,Fu=null,yt=e):yt=t):yt=Kt?Mn(e.stateNode.nextSibling):null;return!0}function Ia(){yt=Kt=null,Pe=!1}function nm(){var e=ni;return e!==null&&(en===null?en=e:en.push.apply(en,e),ni=null),e}function Ya(e){ni===null?ni=[e]:ni.push(e)}var Rc=X(null),ii=null,Pn=null;function ms(e,t,a){ee(Rc,t._currentValue),t._currentValue=a}function Fn(e){e._currentValue=Rc.current,P(Rc)}function Lc(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Oc(e,t,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var p=f.dependencies;if(p!==null){var b=f.child;p=p.firstContext;e:for(;p!==null;){var j=p;p=f;for(var C=0;C<t.length;C++)if(j.context===t[C]){p.lanes|=a,j=p.alternate,j!==null&&(j.lanes|=a),Lc(p.return,a,e),l||(b=null);break e}p=j.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(r(341));b.lanes|=a,p=b.alternate,p!==null&&(p.lanes|=a),Lc(b,a,e),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===e){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function Va(e,t,a,l){e=null;for(var f=t,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var j=f.type;an(f.pendingProps.value,b.value)||(e!==null?e.push(j):e=[j])}}else if(f===fe.current){if(b=f.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(vr):e=[vr])}f=f.return}e!==null&&Oc(t,e,a,l),t.flags|=262144}function bo(e){for(e=e.firstContext;e!==null;){if(!an(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ai(e){ii=e,Pn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Gt(e){return sm(ii,e)}function vo(e,t){return ii===null&&ai(e),sm(e,t)}function sm(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Pn===null){if(e===null)throw Error(r(308));Pn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Pn=Pn.next=t;return a}var jv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},Sv=s.unstable_scheduleCallback,Nv=s.unstable_NormalPriority,Et={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dc(){return{controller:new jv,data:new Map,refCount:0}}function Ka(e){e.refCount--,e.refCount===0&&Sv(Nv,function(){e.controller.abort()})}var Xa=null,qc=0,Qi=0,Zi=null;function Tv(e,t){if(Xa===null){var a=Xa=[];qc=0,Qi=Uu(),Zi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return qc++,t.then(im,im),t}function im(){if(--qc===0&&Xa!==null){Zi!==null&&(Zi.status="fulfilled");var e=Xa;Xa=null,Qi=0,Zi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Av(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var f=0;f<a.length;f++)(0,a[f])(t)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var am=B.S;B.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&Tv(e,t),am!==null&&am(e,t)};var ri=X(null);function Bc(){var e=ri.current;return e!==null?e:dt.pooledCache}function wo(e,t){t===null?ee(ri,ri.current):ee(ri,t.pool)}function rm(){var e=Bc();return e===null?null:{parent:Et._currentValue,pool:e}}var Qa=Error(r(460)),om=Error(r(474)),ko=Error(r(542)),Uc={then:function(){}};function lm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jo(){}function cm(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(jo,jo),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,dm(e),e;default:if(typeof t.status=="string")t.then(jo,jo);else{if(e=dt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var f=t;f.status="fulfilled",f.value=l}},function(l){if(t.status==="pending"){var f=t;f.status="rejected",f.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,dm(e),e}throw Za=t,Qa}}var Za=null;function um(){if(Za===null)throw Error(r(459));var e=Za;return Za=null,e}function dm(e){if(e===Qa||e===ko)throw Error(r(483))}var ps=!1;function $c(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function gs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xs(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(et&2)!==0){var f=l.pending;return f===null?t.next=t:(t.next=f.next,f.next=t),l.pending=t,t=po(e),Ph(e,null,a),t}return mo(e,l,t,a),po(e)}function Wa(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Ye(e,a)}}function Gc(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=b:p=p.next=b,a=a.next}while(a!==null);p===null?f=p=t:p=p.next=t}else f=p=t;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Ic=!1;function Pa(){if(Ic){var e=Zi;if(e!==null)throw e}}function Fa(e,t,a,l){Ic=!1;var f=e.updateQueue;ps=!1;var p=f.firstBaseUpdate,b=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var C=j,G=C.next;C.next=null,b===null?p=G:b.next=G,b=C;var F=e.alternate;F!==null&&(F=F.updateQueue,j=F.lastBaseUpdate,j!==b&&(j===null?F.firstBaseUpdate=G:j.next=G,F.lastBaseUpdate=C))}if(p!==null){var te=f.baseState;b=0,F=G=C=null,j=p;do{var K=j.lane&-536870913,Q=K!==j.lane;if(Q?(Qe&K)===K:(l&K)===K){K!==0&&K===Qi&&(Ic=!0),F!==null&&(F=F.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var Re=e,Me=j;K=t;var lt=a;switch(Me.tag){case 1:if(Re=Me.payload,typeof Re=="function"){te=Re.call(lt,te,K);break e}te=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Me.payload,K=typeof Re=="function"?Re.call(lt,te,K):Re,K==null)break e;te=x({},te,K);break e;case 2:ps=!0}}K=j.callback,K!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=f.callbacks,Q===null?f.callbacks=[K]:Q.push(K))}else Q={lane:K,tag:j.tag,payload:j.payload,callback:j.callback,next:null},F===null?(G=F=Q,C=te):F=F.next=Q,b|=K;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;Q=j,j=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);F===null&&(C=te),f.baseState=C,f.firstBaseUpdate=G,f.lastBaseUpdate=F,p===null&&(f.shared.lanes=0),Ns|=b,e.lanes=b,e.memoizedState=te}}function fm(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function hm(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)fm(a[e],t)}var Wi=X(null),So=X(0);function mm(e,t){e=as,ee(So,e),ee(Wi,t),as=e|t.baseLanes}function Yc(){ee(So,as),ee(Wi,Wi.current)}function Vc(){as=So.current,P(Wi),P(So)}var ys=0,He=null,rt=null,Tt=null,No=!1,Pi=!1,oi=!1,To=0,Ja=0,Fi=null,Ev=0;function jt(){throw Error(r(321))}function Kc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!an(e[a],t[a]))return!1;return!0}function Xc(e,t,a,l,f,p){return ys=p,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=e===null||e.memoizedState===null?Pm:Fm,oi=!1,p=a(l,f),oi=!1,Pi&&(p=gm(t,a,l,f)),pm(e),p}function pm(e){B.H=_o;var t=rt!==null&&rt.next!==null;if(ys=0,Tt=rt=He=null,No=!1,Ja=0,Fi=null,t)throw Error(r(300));e===null||_t||(e=e.dependencies,e!==null&&bo(e)&&(_t=!0))}function gm(e,t,a,l){He=e;var f=0;do{if(Pi&&(Fi=null),Ja=0,Pi=!1,25<=f)throw Error(r(301));if(f+=1,Tt=rt=null,e.updateQueue!=null){var p=e.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}B.H=Ov,p=t(a,l)}while(Pi);return p}function Cv(){var e=B.H,t=e.useState()[0];return t=typeof t.then=="function"?er(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(He.flags|=1024),t}function Qc(){var e=To!==0;return To=0,e}function Zc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Wc(e){if(No){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}No=!1}ys=0,Tt=rt=He=null,Pi=!1,Ja=To=0,Fi=null}function Ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tt===null?He.memoizedState=Tt=e:Tt=Tt.next=e,Tt}function At(){if(rt===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Tt===null?He.memoizedState:Tt.next;if(t!==null)Tt=t,rt=e;else{if(e===null)throw He.alternate===null?Error(r(467)):Error(r(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Tt===null?He.memoizedState=Tt=e:Tt=Tt.next=e}return Tt}function Pc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function er(e){var t=Ja;return Ja+=1,Fi===null&&(Fi=[]),e=cm(Fi,e,t),t=He,(Tt===null?t.memoizedState:Tt.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?Pm:Fm),e}function Ao(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return er(e);if(e.$$typeof===M)return Gt(e)}throw Error(r(438,String(e)))}function Fc(e){var t=null,a=He.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=He.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(f){return f.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Pc(),He.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=O;return t.index++,a}function Jn(e,t){return typeof t=="function"?t(e):t}function Eo(e){var t=At();return Jc(t,rt,e)}function Jc(e,t,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,p=l.pending;if(p!==null){if(f!==null){var b=f.next;f.next=p.next,p.next=b}t.baseQueue=f=p,l.pending=null}if(p=e.baseState,f===null)e.memoizedState=p;else{t=f.next;var j=b=null,C=null,G=t,F=!1;do{var te=G.lane&-536870913;if(te!==G.lane?(Qe&te)===te:(ys&te)===te){var K=G.revertLane;if(K===0)C!==null&&(C=C.next={lane:0,revertLane:0,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),te===Qi&&(F=!0);else if((ys&K)===K){G=G.next,K===Qi&&(F=!0);continue}else te={lane:0,revertLane:G.revertLane,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},C===null?(j=C=te,b=p):C=C.next=te,He.lanes|=K,Ns|=K;te=G.action,oi&&a(p,te),p=G.hasEagerState?G.eagerState:a(p,te)}else K={lane:te,revertLane:G.revertLane,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},C===null?(j=C=K,b=p):C=C.next=K,He.lanes|=te,Ns|=te;G=G.next}while(G!==null&&G!==t);if(C===null?b=p:C.next=j,!an(p,e.memoizedState)&&(_t=!0,F&&(a=Zi,a!==null)))throw a;e.memoizedState=p,e.baseState=b,e.baseQueue=C,l.lastRenderedState=p}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function eu(e){var t=At(),a=t.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,p=t.memoizedState;if(f!==null){a.pending=null;var b=f=f.next;do p=e(p,b.action),b=b.next;while(b!==f);an(p,t.memoizedState)||(_t=!0),t.memoizedState=p,t.baseQueue===null&&(t.baseState=p),a.lastRenderedState=p}return[p,l]}function xm(e,t,a){var l=He,f=At(),p=Pe;if(p){if(a===void 0)throw Error(r(407));a=a()}else a=t();var b=!an((rt||f).memoizedState,a);b&&(f.memoizedState=a,_t=!0),f=f.queue;var j=vm.bind(null,l,f,e);if(tr(2048,8,j,[e]),f.getSnapshot!==t||b||Tt!==null&&Tt.memoizedState.tag&1){if(l.flags|=2048,Ji(9,Co(),bm.bind(null,l,f,a,t),null),dt===null)throw Error(r(349));p||(ys&124)!==0||ym(l,t,a)}return a}function ym(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=He.updateQueue,t===null?(t=Pc(),He.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function bm(e,t,a,l){t.value=a,t.getSnapshot=l,wm(t)&&km(e)}function vm(e,t,a){return a(function(){wm(t)&&km(e)})}function wm(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!an(e,a)}catch{return!0}}function km(e){var t=Yi(e,2);t!==null&&dn(t,e,2)}function tu(e){var t=Ft();if(typeof e=="function"){var a=e;if(e=a(),oi){Nt(!0);try{a()}finally{Nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:e},t}function jm(e,t,a,l){return e.baseState=a,Jc(e,rt,typeof l=="function"?l:Jn)}function Mv(e,t,a,l,f){if(zo(e))throw Error(r(485));if(e=t.action,e!==null){var p={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){p.listeners.push(b)}};B.T!==null?a(!0):p.isTransition=!1,l(p),a=t.pending,a===null?(p.next=t.pending=p,Sm(t,p)):(p.next=a.next,t.pending=a.next=p)}}function Sm(e,t){var a=t.action,l=t.payload,f=e.state;if(t.isTransition){var p=B.T,b={};B.T=b;try{var j=a(f,l),C=B.S;C!==null&&C(b,j),Nm(e,t,j)}catch(G){nu(e,t,G)}finally{B.T=p}}else try{p=a(f,l),Nm(e,t,p)}catch(G){nu(e,t,G)}}function Nm(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Tm(e,t,l)},function(l){return nu(e,t,l)}):Tm(e,t,a)}function Tm(e,t,a){t.status="fulfilled",t.value=a,Am(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Sm(e,a)))}function nu(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,Am(t),t=t.next;while(t!==l)}e.action=null}function Am(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Em(e,t){return t}function Cm(e,t){if(Pe){var a=dt.formState;if(a!==null){e:{var l=He;if(Pe){if(yt){t:{for(var f=yt,p=Dn;f.nodeType!==8;){if(!p){f=null;break t}if(f=Mn(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){yt=Mn(f.nextSibling),l=f.data==="F!";break e}}si(l)}l=!1}l&&(t=a[0])}}return a=Ft(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Em,lastRenderedState:t},a.queue=l,a=Qm.bind(null,He,l),l.dispatch=a,l=tu(!1),p=ou.bind(null,He,!1,l.queue),l=Ft(),f={state:t,dispatch:null,action:e,pending:null},l.queue=f,a=Mv.bind(null,He,f,p,a),f.dispatch=a,l.memoizedState=e,[t,a,!1]}function Mm(e){var t=At();return zm(t,rt,e)}function zm(e,t,a){if(t=Jc(e,t,Em)[0],e=Eo(Jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=er(t)}catch(b){throw b===Qa?ko:b}else l=t;t=At();var f=t.queue,p=f.dispatch;return a!==t.memoizedState&&(He.flags|=2048,Ji(9,Co(),zv.bind(null,f,a),null)),[l,p,e]}function zv(e,t){e.action=t}function _m(e){var t=At(),a=rt;if(a!==null)return zm(t,a,e);At(),t=t.memoizedState,a=At();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function Ji(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=He.updateQueue,t===null&&(t=Pc(),He.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Co(){return{destroy:void 0,resource:void 0}}function Rm(){return At().memoizedState}function Mo(e,t,a,l){var f=Ft();l=l===void 0?null:l,He.flags|=e,f.memoizedState=Ji(1|t,Co(),a,l)}function tr(e,t,a,l){var f=At();l=l===void 0?null:l;var p=f.memoizedState.inst;rt!==null&&l!==null&&Kc(l,rt.memoizedState.deps)?f.memoizedState=Ji(t,p,a,l):(He.flags|=e,f.memoizedState=Ji(1|t,p,a,l))}function Lm(e,t){Mo(8390656,8,e,t)}function Om(e,t){tr(2048,8,e,t)}function Dm(e,t){return tr(4,2,e,t)}function qm(e,t){return tr(4,4,e,t)}function Bm(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Um(e,t,a){a=a!=null?a.concat([e]):null,tr(4,4,Bm.bind(null,t,e),a)}function su(){}function $m(e,t){var a=At();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&Kc(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Hm(e,t){var a=At();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&Kc(t,l[1]))return l[0];if(l=e(),oi){Nt(!0);try{e()}finally{Nt(!1)}}return a.memoizedState=[l,t],l}function iu(e,t,a){return a===void 0||(ys&1073741824)!==0?e.memoizedState=t:(e.memoizedState=a,e=Yp(),He.lanes|=e,Ns|=e,a)}function Gm(e,t,a,l){return an(a,t)?a:Wi.current!==null?(e=iu(e,a,l),an(e,t)||(_t=!0),e):(ys&42)===0?(_t=!0,e.memoizedState=a):(e=Yp(),He.lanes|=e,Ns|=e,t)}function Im(e,t,a,l,f){var p=W.p;W.p=p!==0&&8>p?p:8;var b=B.T,j={};B.T=j,ou(e,!1,t,a);try{var C=f(),G=B.S;if(G!==null&&G(j,C),C!==null&&typeof C=="object"&&typeof C.then=="function"){var F=Av(C,l);nr(e,t,F,un(e))}else nr(e,t,l,un(e))}catch(te){nr(e,t,{then:function(){},status:"rejected",reason:te},un())}finally{W.p=p,B.T=b}}function _v(){}function au(e,t,a,l){if(e.tag!==5)throw Error(r(476));var f=Ym(e).queue;Im(e,f,t,ne,a===null?_v:function(){return Vm(e),a(l)})}function Ym(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:ne},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Vm(e){var t=Ym(e).next.queue;nr(e,t,{},un())}function ru(){return Gt(vr)}function Km(){return At().memoizedState}function Xm(){return At().memoizedState}function Rv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=un();e=gs(a);var l=xs(t,e,a);l!==null&&(dn(l,t,a),Wa(l,t,a)),t={cache:Dc()},e.payload=t;return}t=t.return}}function Lv(e,t,a){var l=un();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},zo(e)?Zm(t,a):(a=Tc(e,t,a,l),a!==null&&(dn(a,e,l),Wm(a,t,l)))}function Qm(e,t,a){var l=un();nr(e,t,a,l)}function nr(e,t,a,l){var f={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(zo(e))Zm(t,f);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=t.lastRenderedReducer,p!==null))try{var b=t.lastRenderedState,j=p(b,a);if(f.hasEagerState=!0,f.eagerState=j,an(j,b))return mo(e,t,f,0),dt===null&&ho(),!1}catch{}if(a=Tc(e,t,f,l),a!==null)return dn(a,e,l),Wm(a,t,l),!0}return!1}function ou(e,t,a,l){if(l={lane:2,revertLane:Uu(),action:l,hasEagerState:!1,eagerState:null,next:null},zo(e)){if(t)throw Error(r(479))}else t=Tc(e,a,l,2),t!==null&&dn(t,e,2)}function zo(e){var t=e.alternate;return e===He||t!==null&&t===He}function Zm(e,t){Pi=No=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Wm(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Ye(e,a)}}var _o={readContext:Gt,use:Ao,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt},Pm={readContext:Gt,use:Ao,useCallback:function(e,t){return Ft().memoizedState=[e,t===void 0?null:t],e},useContext:Gt,useEffect:Lm,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Mo(4194308,4,Bm.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Mo(4194308,4,e,t)},useInsertionEffect:function(e,t){Mo(4,2,e,t)},useMemo:function(e,t){var a=Ft();t=t===void 0?null:t;var l=e();if(oi){Nt(!0);try{e()}finally{Nt(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=Ft();if(a!==void 0){var f=a(t);if(oi){Nt(!0);try{a(t)}finally{Nt(!1)}}}else f=t;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=Lv.bind(null,He,e),[l.memoizedState,e]},useRef:function(e){var t=Ft();return e={current:e},t.memoizedState=e},useState:function(e){e=tu(e);var t=e.queue,a=Qm.bind(null,He,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:su,useDeferredValue:function(e,t){var a=Ft();return iu(a,e,t)},useTransition:function(){var e=tu(!1);return e=Im.bind(null,He,e.queue,!0,!1),Ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=He,f=Ft();if(Pe){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),dt===null)throw Error(r(349));(Qe&124)!==0||ym(l,t,a)}f.memoizedState=a;var p={value:a,getSnapshot:t};return f.queue=p,Lm(vm.bind(null,l,p,e),[e]),l.flags|=2048,Ji(9,Co(),bm.bind(null,l,p,a,t),null),a},useId:function(){var e=Ft(),t=dt.identifierPrefix;if(Pe){var a=Wn,l=Zn;a=(l&~(1<<32-xt(l)-1)).toString(32)+a,t="«"+t+"R"+a,a=To++,0<a&&(t+="H"+a.toString(32)),t+="»"}else a=Ev++,t="«"+t+"r"+a.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:ru,useFormState:Cm,useActionState:Cm,useOptimistic:function(e){var t=Ft();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=ou.bind(null,He,!0,a),a.dispatch=t,[e,t]},useMemoCache:Fc,useCacheRefresh:function(){return Ft().memoizedState=Rv.bind(null,He)}},Fm={readContext:Gt,use:Ao,useCallback:$m,useContext:Gt,useEffect:Om,useImperativeHandle:Um,useInsertionEffect:Dm,useLayoutEffect:qm,useMemo:Hm,useReducer:Eo,useRef:Rm,useState:function(){return Eo(Jn)},useDebugValue:su,useDeferredValue:function(e,t){var a=At();return Gm(a,rt.memoizedState,e,t)},useTransition:function(){var e=Eo(Jn)[0],t=At().memoizedState;return[typeof e=="boolean"?e:er(e),t]},useSyncExternalStore:xm,useId:Km,useHostTransitionStatus:ru,useFormState:Mm,useActionState:Mm,useOptimistic:function(e,t){var a=At();return jm(a,rt,e,t)},useMemoCache:Fc,useCacheRefresh:Xm},Ov={readContext:Gt,use:Ao,useCallback:$m,useContext:Gt,useEffect:Om,useImperativeHandle:Um,useInsertionEffect:Dm,useLayoutEffect:qm,useMemo:Hm,useReducer:eu,useRef:Rm,useState:function(){return eu(Jn)},useDebugValue:su,useDeferredValue:function(e,t){var a=At();return rt===null?iu(a,e,t):Gm(a,rt.memoizedState,e,t)},useTransition:function(){var e=eu(Jn)[0],t=At().memoizedState;return[typeof e=="boolean"?e:er(e),t]},useSyncExternalStore:xm,useId:Km,useHostTransitionStatus:ru,useFormState:_m,useActionState:_m,useOptimistic:function(e,t){var a=At();return rt!==null?jm(a,rt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Fc,useCacheRefresh:Xm},ea=null,sr=0;function Ro(e){var t=sr;return sr+=1,ea===null&&(ea=[]),cm(ea,e,t)}function ir(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Lo(e,t){throw t.$$typeof===y?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Jm(e){var t=e._init;return t(e._payload)}function ep(e){function t(D,z){if(e){var H=D.deletions;H===null?(D.deletions=[z],D.flags|=16):H.push(z)}}function a(D,z){if(!e)return null;for(;z!==null;)t(D,z),z=z.sibling;return null}function l(D){for(var z=new Map;D!==null;)D.key!==null?z.set(D.key,D):z.set(D.index,D),D=D.sibling;return z}function f(D,z){return D=Qn(D,z),D.index=0,D.sibling=null,D}function p(D,z,H){return D.index=H,e?(H=D.alternate,H!==null?(H=H.index,H<z?(D.flags|=67108866,z):H):(D.flags|=67108866,z)):(D.flags|=1048576,z)}function b(D){return e&&D.alternate===null&&(D.flags|=67108866),D}function j(D,z,H,J){return z===null||z.tag!==6?(z=Ec(H,D.mode,J),z.return=D,z):(z=f(z,H),z.return=D,z)}function C(D,z,H,J){var ke=H.type;return ke===T?F(D,z,H.props.children,J,H.key):z!==null&&(z.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===A&&Jm(ke)===z.type)?(z=f(z,H.props),ir(z,H),z.return=D,z):(z=go(H.type,H.key,H.props,null,D.mode,J),ir(z,H),z.return=D,z)}function G(D,z,H,J){return z===null||z.tag!==4||z.stateNode.containerInfo!==H.containerInfo||z.stateNode.implementation!==H.implementation?(z=Cc(H,D.mode,J),z.return=D,z):(z=f(z,H.children||[]),z.return=D,z)}function F(D,z,H,J,ke){return z===null||z.tag!==7?(z=Js(H,D.mode,J,ke),z.return=D,z):(z=f(z,H),z.return=D,z)}function te(D,z,H){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=Ec(""+z,D.mode,H),z.return=D,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case w:return H=go(z.type,z.key,z.props,null,D.mode,H),ir(H,z),H.return=D,H;case k:return z=Cc(z,D.mode,H),z.return=D,z;case A:var J=z._init;return z=J(z._payload),te(D,z,H)}if(de(z)||le(z))return z=Js(z,D.mode,H,null),z.return=D,z;if(typeof z.then=="function")return te(D,Ro(z),H);if(z.$$typeof===M)return te(D,vo(D,z),H);Lo(D,z)}return null}function K(D,z,H,J){var ke=z!==null?z.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return ke!==null?null:j(D,z,""+H,J);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return H.key===ke?C(D,z,H,J):null;case k:return H.key===ke?G(D,z,H,J):null;case A:return ke=H._init,H=ke(H._payload),K(D,z,H,J)}if(de(H)||le(H))return ke!==null?null:F(D,z,H,J,null);if(typeof H.then=="function")return K(D,z,Ro(H),J);if(H.$$typeof===M)return K(D,z,vo(D,H),J);Lo(D,H)}return null}function Q(D,z,H,J,ke){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return D=D.get(H)||null,j(z,D,""+J,ke);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return D=D.get(J.key===null?H:J.key)||null,C(z,D,J,ke);case k:return D=D.get(J.key===null?H:J.key)||null,G(z,D,J,ke);case A:var Ie=J._init;return J=Ie(J._payload),Q(D,z,H,J,ke)}if(de(J)||le(J))return D=D.get(H)||null,F(z,D,J,ke,null);if(typeof J.then=="function")return Q(D,z,H,Ro(J),ke);if(J.$$typeof===M)return Q(D,z,H,vo(z,J),ke);Lo(z,J)}return null}function Re(D,z,H,J){for(var ke=null,Ie=null,Ae=z,_e=z=0,Lt=null;Ae!==null&&_e<H.length;_e++){Ae.index>_e?(Lt=Ae,Ae=null):Lt=Ae.sibling;var We=K(D,Ae,H[_e],J);if(We===null){Ae===null&&(Ae=Lt);break}e&&Ae&&We.alternate===null&&t(D,Ae),z=p(We,z,_e),Ie===null?ke=We:Ie.sibling=We,Ie=We,Ae=Lt}if(_e===H.length)return a(D,Ae),Pe&&ti(D,_e),ke;if(Ae===null){for(;_e<H.length;_e++)Ae=te(D,H[_e],J),Ae!==null&&(z=p(Ae,z,_e),Ie===null?ke=Ae:Ie.sibling=Ae,Ie=Ae);return Pe&&ti(D,_e),ke}for(Ae=l(Ae);_e<H.length;_e++)Lt=Q(Ae,D,_e,H[_e],J),Lt!==null&&(e&&Lt.alternate!==null&&Ae.delete(Lt.key===null?_e:Lt.key),z=p(Lt,z,_e),Ie===null?ke=Lt:Ie.sibling=Lt,Ie=Lt);return e&&Ae.forEach(function(Ls){return t(D,Ls)}),Pe&&ti(D,_e),ke}function Me(D,z,H,J){if(H==null)throw Error(r(151));for(var ke=null,Ie=null,Ae=z,_e=z=0,Lt=null,We=H.next();Ae!==null&&!We.done;_e++,We=H.next()){Ae.index>_e?(Lt=Ae,Ae=null):Lt=Ae.sibling;var Ls=K(D,Ae,We.value,J);if(Ls===null){Ae===null&&(Ae=Lt);break}e&&Ae&&Ls.alternate===null&&t(D,Ae),z=p(Ls,z,_e),Ie===null?ke=Ls:Ie.sibling=Ls,Ie=Ls,Ae=Lt}if(We.done)return a(D,Ae),Pe&&ti(D,_e),ke;if(Ae===null){for(;!We.done;_e++,We=H.next())We=te(D,We.value,J),We!==null&&(z=p(We,z,_e),Ie===null?ke=We:Ie.sibling=We,Ie=We);return Pe&&ti(D,_e),ke}for(Ae=l(Ae);!We.done;_e++,We=H.next())We=Q(Ae,D,_e,We.value,J),We!==null&&(e&&We.alternate!==null&&Ae.delete(We.key===null?_e:We.key),z=p(We,z,_e),Ie===null?ke=We:Ie.sibling=We,Ie=We);return e&&Ae.forEach(function(Dw){return t(D,Dw)}),Pe&&ti(D,_e),ke}function lt(D,z,H,J){if(typeof H=="object"&&H!==null&&H.type===T&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case w:e:{for(var ke=H.key;z!==null;){if(z.key===ke){if(ke=H.type,ke===T){if(z.tag===7){a(D,z.sibling),J=f(z,H.props.children),J.return=D,D=J;break e}}else if(z.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===A&&Jm(ke)===z.type){a(D,z.sibling),J=f(z,H.props),ir(J,H),J.return=D,D=J;break e}a(D,z);break}else t(D,z);z=z.sibling}H.type===T?(J=Js(H.props.children,D.mode,J,H.key),J.return=D,D=J):(J=go(H.type,H.key,H.props,null,D.mode,J),ir(J,H),J.return=D,D=J)}return b(D);case k:e:{for(ke=H.key;z!==null;){if(z.key===ke)if(z.tag===4&&z.stateNode.containerInfo===H.containerInfo&&z.stateNode.implementation===H.implementation){a(D,z.sibling),J=f(z,H.children||[]),J.return=D,D=J;break e}else{a(D,z);break}else t(D,z);z=z.sibling}J=Cc(H,D.mode,J),J.return=D,D=J}return b(D);case A:return ke=H._init,H=ke(H._payload),lt(D,z,H,J)}if(de(H))return Re(D,z,H,J);if(le(H)){if(ke=le(H),typeof ke!="function")throw Error(r(150));return H=ke.call(H),Me(D,z,H,J)}if(typeof H.then=="function")return lt(D,z,Ro(H),J);if(H.$$typeof===M)return lt(D,z,vo(D,H),J);Lo(D,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,z!==null&&z.tag===6?(a(D,z.sibling),J=f(z,H),J.return=D,D=J):(a(D,z),J=Ec(H,D.mode,J),J.return=D,D=J),b(D)):a(D,z)}return function(D,z,H,J){try{sr=0;var ke=lt(D,z,H,J);return ea=null,ke}catch(Ae){if(Ae===Qa||Ae===ko)throw Ae;var Ie=rn(29,Ae,null,D.mode);return Ie.lanes=J,Ie.return=D,Ie}}}var ta=ep(!0),tp=ep(!1),jn=X(null),qn=null;function bs(e){var t=e.alternate;ee(Ct,Ct.current&1),ee(jn,e),qn===null&&(t===null||Wi.current!==null||t.memoizedState!==null)&&(qn=e)}function np(e){if(e.tag===22){if(ee(Ct,Ct.current),ee(jn,e),qn===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(qn=e)}}else vs()}function vs(){ee(Ct,Ct.current),ee(jn,jn.current)}function es(e){P(jn),qn===e&&(qn=null),P(Ct)}var Ct=X(0);function Oo(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||Pu(a)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function lu(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:x({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var cu={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=un(),f=gs(l);f.payload=t,a!=null&&(f.callback=a),t=xs(e,f,l),t!==null&&(dn(t,e,l),Wa(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=un(),f=gs(l);f.tag=1,f.payload=t,a!=null&&(f.callback=a),t=xs(e,f,l),t!==null&&(dn(t,e,l),Wa(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=un(),l=gs(a);l.tag=2,t!=null&&(l.callback=t),t=xs(e,l,a),t!==null&&(dn(t,e,a),Wa(t,e,a))}};function sp(e,t,a,l,f,p,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,p,b):t.prototype&&t.prototype.isPureReactComponent?!$a(a,l)||!$a(f,p):!0}function ip(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&cu.enqueueReplaceState(t,t.state,null)}function li(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=x({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}var Do=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function ap(e){Do(e)}function rp(e){console.error(e)}function op(e){Do(e)}function qo(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function lp(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function uu(e,t,a){return a=gs(a),a.tag=3,a.payload={element:null},a.callback=function(){qo(e,t)},a}function cp(e){return e=gs(e),e.tag=3,e}function up(e,t,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var p=l.value;e.payload=function(){return f(p)},e.callback=function(){lp(t,a,l)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){lp(t,a,l),typeof f!="function"&&(Ts===null?Ts=new Set([this]):Ts.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function Dv(e,t,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&Va(t,a,f,!0),a=jn.current,a!==null){switch(a.tag){case 13:return qn===null?Lu():a.alternate===null&&bt===0&&(bt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Uc?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Du(e,l,f)),!1;case 22:return a.flags|=65536,l===Uc?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Du(e,l,f)),!1}throw Error(r(435,a.tag))}return Du(e,l,f),Lu(),!1}if(Pe)return t=jn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=f,l!==_c&&(e=Error(r(422),{cause:l}),Ya(bn(e,a)))):(l!==_c&&(t=Error(r(423),{cause:l}),Ya(bn(t,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=bn(l,a),f=uu(e.stateNode,l,f),Gc(e,f),bt!==4&&(bt=2)),!1;var p=Error(r(520),{cause:l});if(p=bn(p,a),dr===null?dr=[p]:dr.push(p),bt!==4&&(bt=2),t===null)return!0;l=bn(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=uu(a.stateNode,l,e),Gc(a,e),!1;case 1:if(t=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Ts===null||!Ts.has(p))))return a.flags|=65536,f&=-f,a.lanes|=f,f=cp(f),up(f,e,a,l),Gc(a,f),!1}a=a.return}while(a!==null);return!1}var dp=Error(r(461)),_t=!1;function Dt(e,t,a,l){t.child=e===null?tp(t,null,a,l):ta(t,e.child,a,l)}function fp(e,t,a,l,f){a=a.render;var p=t.ref;if("ref"in l){var b={};for(var j in l)j!=="ref"&&(b[j]=l[j])}else b=l;return ai(t),l=Xc(e,t,a,b,p,f),j=Qc(),e!==null&&!_t?(Zc(e,t,f),ts(e,t,f)):(Pe&&j&&Mc(t),t.flags|=1,Dt(e,t,l,f),t.child)}function hp(e,t,a,l,f){if(e===null){var p=a.type;return typeof p=="function"&&!Ac(p)&&p.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=p,mp(e,t,p,l,f)):(e=go(a.type,null,l,t,t.mode,f),e.ref=t.ref,e.return=t,t.child=e)}if(p=e.child,!yu(e,f)){var b=p.memoizedProps;if(a=a.compare,a=a!==null?a:$a,a(b,l)&&e.ref===t.ref)return ts(e,t,f)}return t.flags|=1,e=Qn(p,l),e.ref=t.ref,e.return=t,t.child=e}function mp(e,t,a,l,f){if(e!==null){var p=e.memoizedProps;if($a(p,l)&&e.ref===t.ref)if(_t=!1,t.pendingProps=l=p,yu(e,f))(e.flags&131072)!==0&&(_t=!0);else return t.lanes=e.lanes,ts(e,t,f)}return du(e,t,a,l,f)}function pp(e,t,a){var l=t.pendingProps,f=l.children,p=e!==null?e.memoizedState:null;if(l.mode==="hidden"){if((t.flags&128)!==0){if(l=p!==null?p.baseLanes|a:a,e!==null){for(f=t.child=e.child,p=0;f!==null;)p=p|f.lanes|f.childLanes,f=f.sibling;t.childLanes=p&~l}else t.childLanes=0,t.child=null;return gp(e,t,l,a)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&wo(t,p!==null?p.cachePool:null),p!==null?mm(t,p):Yc(),np(t);else return t.lanes=t.childLanes=536870912,gp(e,t,p!==null?p.baseLanes|a:a,a)}else p!==null?(wo(t,p.cachePool),mm(t,p),vs(),t.memoizedState=null):(e!==null&&wo(t,null),Yc(),vs());return Dt(e,t,f,a),t.child}function gp(e,t,a,l){var f=Bc();return f=f===null?null:{parent:Et._currentValue,pool:f},t.memoizedState={baseLanes:a,cachePool:f},e!==null&&wo(t,null),Yc(),np(t),e!==null&&Va(e,t,l,!0),null}function Bo(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function du(e,t,a,l,f){return ai(t),a=Xc(e,t,a,l,void 0,f),l=Qc(),e!==null&&!_t?(Zc(e,t,f),ts(e,t,f)):(Pe&&l&&Mc(t),t.flags|=1,Dt(e,t,a,f),t.child)}function xp(e,t,a,l,f,p){return ai(t),t.updateQueue=null,a=gm(t,l,a,f),pm(e),l=Qc(),e!==null&&!_t?(Zc(e,t,p),ts(e,t,p)):(Pe&&l&&Mc(t),t.flags|=1,Dt(e,t,a,p),t.child)}function yp(e,t,a,l,f){if(ai(t),t.stateNode===null){var p=Vi,b=a.contextType;typeof b=="object"&&b!==null&&(p=Gt(b)),p=new a(l,p),t.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=cu,t.stateNode=p,p._reactInternals=t,p=t.stateNode,p.props=l,p.state=t.memoizedState,p.refs={},$c(t),b=a.contextType,p.context=typeof b=="object"&&b!==null?Gt(b):Vi,p.state=t.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(lu(t,a,b,l),p.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(b=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),b!==p.state&&cu.enqueueReplaceState(p,p.state,null),Fa(t,l,p,f),Pa(),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){p=t.stateNode;var j=t.memoizedProps,C=li(a,j);p.props=C;var G=p.context,F=a.contextType;b=Vi,typeof F=="object"&&F!==null&&(b=Gt(F));var te=a.getDerivedStateFromProps;F=typeof te=="function"||typeof p.getSnapshotBeforeUpdate=="function",j=t.pendingProps!==j,F||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(j||G!==b)&&ip(t,p,l,b),ps=!1;var K=t.memoizedState;p.state=K,Fa(t,l,p,f),Pa(),G=t.memoizedState,j||K!==G||ps?(typeof te=="function"&&(lu(t,a,te,l),G=t.memoizedState),(C=ps||sp(t,a,C,l,K,G,b))?(F||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(t.flags|=4194308)):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=G),p.props=l,p.state=G,p.context=b,l=C):(typeof p.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{p=t.stateNode,Hc(e,t),b=t.memoizedProps,F=li(a,b),p.props=F,te=t.pendingProps,K=p.context,G=a.contextType,C=Vi,typeof G=="object"&&G!==null&&(C=Gt(G)),j=a.getDerivedStateFromProps,(G=typeof j=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(b!==te||K!==C)&&ip(t,p,l,C),ps=!1,K=t.memoizedState,p.state=K,Fa(t,l,p,f),Pa();var Q=t.memoizedState;b!==te||K!==Q||ps||e!==null&&e.dependencies!==null&&bo(e.dependencies)?(typeof j=="function"&&(lu(t,a,j,l),Q=t.memoizedState),(F=ps||sp(t,a,F,l,K,Q,C)||e!==null&&e.dependencies!==null&&bo(e.dependencies))?(G||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,Q,C),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,Q,C)),typeof p.componentDidUpdate=="function"&&(t.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof p.componentDidUpdate!="function"||b===e.memoizedProps&&K===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&K===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=Q),p.props=l,p.state=Q,p.context=C,l=F):(typeof p.componentDidUpdate!="function"||b===e.memoizedProps&&K===e.memoizedState||(t.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&K===e.memoizedState||(t.flags|=1024),l=!1)}return p=l,Bo(e,t),l=(t.flags&128)!==0,p||l?(p=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:p.render(),t.flags|=1,e!==null&&l?(t.child=ta(t,e.child,null,f),t.child=ta(t,null,a,f)):Dt(e,t,a,f),t.memoizedState=p.state,e=t.child):e=ts(e,t,f),e}function bp(e,t,a,l){return Ia(),t.flags|=256,Dt(e,t,a,l),t.child}var fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:rm()}}function mu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Sn),e}function vp(e,t,a){var l=t.pendingProps,f=!1,p=(t.flags&128)!==0,b;if((b=p)||(b=e!==null&&e.memoizedState===null?!1:(Ct.current&2)!==0),b&&(f=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Pe){if(f?bs(t):vs(),Pe){var j=yt,C;if(C=j){e:{for(C=j,j=Dn;C.nodeType!==8;){if(!j){j=null;break e}if(C=Mn(C.nextSibling),C===null){j=null;break e}}j=C}j!==null?(t.memoizedState={dehydrated:j,treeContext:ei!==null?{id:Zn,overflow:Wn}:null,retryLane:536870912,hydrationErrors:null},C=rn(18,null,null,0),C.stateNode=j,C.return=t,t.child=C,Kt=t,yt=null,C=!0):C=!1}C||si(t)}if(j=t.memoizedState,j!==null&&(j=j.dehydrated,j!==null))return Pu(j)?t.lanes=32:t.lanes=536870912,null;es(t)}return j=l.children,l=l.fallback,f?(vs(),f=t.mode,j=Uo({mode:"hidden",children:j},f),l=Js(l,f,a,null),j.return=t,l.return=t,j.sibling=l,t.child=j,f=t.child,f.memoizedState=hu(a),f.childLanes=mu(e,b,a),t.memoizedState=fu,l):(bs(t),pu(t,j))}if(C=e.memoizedState,C!==null&&(j=C.dehydrated,j!==null)){if(p)t.flags&256?(bs(t),t.flags&=-257,t=gu(e,t,a)):t.memoizedState!==null?(vs(),t.child=e.child,t.flags|=128,t=null):(vs(),f=l.fallback,j=t.mode,l=Uo({mode:"visible",children:l.children},j),f=Js(f,j,a,null),f.flags|=2,l.return=t,f.return=t,l.sibling=f,t.child=l,ta(t,e.child,null,a),l=t.child,l.memoizedState=hu(a),l.childLanes=mu(e,b,a),t.memoizedState=fu,t=f);else if(bs(t),Pu(j)){if(b=j.nextSibling&&j.nextSibling.dataset,b)var G=b.dgst;b=G,l=Error(r(419)),l.stack="",l.digest=b,Ya({value:l,source:null,stack:null}),t=gu(e,t,a)}else if(_t||Va(e,t,a,!1),b=(a&e.childLanes)!==0,_t||b){if(b=dt,b!==null&&(l=a&-a,l=(l&42)!==0?1:at(l),l=(l&(b.suspendedLanes|a))!==0?0:l,l!==0&&l!==C.retryLane))throw C.retryLane=l,Yi(e,l),dn(b,e,l),dp;j.data==="$?"||Lu(),t=gu(e,t,a)}else j.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=C.treeContext,yt=Mn(j.nextSibling),Kt=t,Pe=!0,ni=null,Dn=!1,e!==null&&(wn[kn++]=Zn,wn[kn++]=Wn,wn[kn++]=ei,Zn=e.id,Wn=e.overflow,ei=t),t=pu(t,l.children),t.flags|=4096);return t}return f?(vs(),f=l.fallback,j=t.mode,C=e.child,G=C.sibling,l=Qn(C,{mode:"hidden",children:l.children}),l.subtreeFlags=C.subtreeFlags&65011712,G!==null?f=Qn(G,f):(f=Js(f,j,a,null),f.flags|=2),f.return=t,l.return=t,l.sibling=f,t.child=l,l=f,f=t.child,j=e.child.memoizedState,j===null?j=hu(a):(C=j.cachePool,C!==null?(G=Et._currentValue,C=C.parent!==G?{parent:G,pool:G}:C):C=rm(),j={baseLanes:j.baseLanes|a,cachePool:C}),f.memoizedState=j,f.childLanes=mu(e,b,a),t.memoizedState=fu,l):(bs(t),a=e.child,e=a.sibling,a=Qn(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=a,t.memoizedState=null,a)}function pu(e,t){return t=Uo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Uo(e,t){return e=rn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function gu(e,t,a){return ta(t,e.child,null,a),e=pu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wp(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Lc(e.return,t,a)}function xu(e,t,a,l,f){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=l,p.tail=a,p.tailMode=f)}function kp(e,t,a){var l=t.pendingProps,f=l.revealOrder,p=l.tail;if(Dt(e,t,l.children,a),l=Ct.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wp(e,a,t);else if(e.tag===19)wp(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}switch(ee(Ct,l),f){case"forwards":for(a=t.child,f=null;a!==null;)e=a.alternate,e!==null&&Oo(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=t.child,t.child=null):(f=a.sibling,a.sibling=null),xu(t,!1,f,a,p);break;case"backwards":for(a=null,f=t.child,t.child=null;f!==null;){if(e=f.alternate,e!==null&&Oo(e)===null){t.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}xu(t,!0,a,null,p);break;case"together":xu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ts(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ns|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Va(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,a=Qn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Qn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&bo(e)))}function qv(e,t,a){switch(t.tag){case 3:ge(t,t.stateNode.containerInfo),ms(t,Et,e.memoizedState.cache),Ia();break;case 27:case 5:nt(t);break;case 4:ge(t,t.stateNode.containerInfo);break;case 10:ms(t,t.type,t.memoizedProps.value);break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(bs(t),t.flags|=128,null):(a&t.child.childLanes)!==0?vp(e,t,a):(bs(t),e=ts(e,t,a),e!==null?e.sibling:null);bs(t);break;case 19:var f=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(Va(e,t,a,!1),l=(a&t.childLanes)!==0),f){if(l)return kp(e,t,a);t.flags|=128}if(f=t.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ee(Ct,Ct.current),l)break;return null;case 22:case 23:return t.lanes=0,pp(e,t,a);case 24:ms(t,Et,e.memoizedState.cache)}return ts(e,t,a)}function jp(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)_t=!0;else{if(!yu(e,a)&&(t.flags&128)===0)return _t=!1,qv(e,t,a);_t=(e.flags&131072)!==0}else _t=!1,Pe&&(t.flags&1048576)!==0&&Jh(t,yo,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var l=t.elementType,f=l._init;if(l=f(l._payload),t.type=l,typeof l=="function")Ac(l)?(e=li(l,e),t.tag=1,t=yp(null,t,l,e,a)):(t.tag=0,t=du(null,t,l,e,a));else{if(l!=null){if(f=l.$$typeof,f===R){t.tag=11,t=fp(null,t,l,e,a);break e}else if(f===V){t.tag=14,t=hp(null,t,l,e,a);break e}}throw t=ie(l)||l,Error(r(306,t,""))}}return t;case 0:return du(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,f=li(l,t.pendingProps),yp(e,t,l,f,a);case 3:e:{if(ge(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var p=t.memoizedState;f=p.element,Hc(e,t),Fa(t,l,null,a);var b=t.memoizedState;if(l=b.cache,ms(t,Et,l),l!==p.cache&&Oc(t,[Et],a,!0),Pa(),l=b.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=p,t.memoizedState=p,t.flags&256){t=bp(e,t,l,a);break e}else if(l!==f){f=bn(Error(r(424)),t),Ya(f),t=bp(e,t,l,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,yt=Mn(e.firstChild),Kt=t,Pe=!0,ni=null,Dn=!0,a=tp(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ia(),l===f){t=ts(e,t,a);break e}Dt(e,t,l,a)}t=t.child}return t;case 26:return Bo(e,t),e===null?(a=Ag(t.type,null,t.pendingProps,null))?t.memoizedState=a:Pe||(a=t.type,e=t.pendingProps,l=Jo(Z.current).createElement(a),l[Ht]=t,l[Wt]=e,Bt(l,a,e),zt(l),t.stateNode=l):t.memoizedState=Ag(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return nt(t),e===null&&Pe&&(l=t.stateNode=Sg(t.type,t.pendingProps,Z.current),Kt=t,Dn=!0,f=yt,Cs(t.type)?(Fu=f,yt=Mn(l.firstChild)):yt=f),Dt(e,t,t.pendingProps.children,a),Bo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pe&&((f=l=yt)&&(l=dw(l,t.type,t.pendingProps,Dn),l!==null?(t.stateNode=l,Kt=t,yt=Mn(l.firstChild),Dn=!1,f=!0):f=!1),f||si(t)),nt(t),f=t.type,p=t.pendingProps,b=e!==null?e.memoizedProps:null,l=p.children,Qu(f,p)?l=null:b!==null&&Qu(f,b)&&(t.flags|=32),t.memoizedState!==null&&(f=Xc(e,t,Cv,null,null,a),vr._currentValue=f),Bo(e,t),Dt(e,t,l,a),t.child;case 6:return e===null&&Pe&&((e=a=yt)&&(a=fw(a,t.pendingProps,Dn),a!==null?(t.stateNode=a,Kt=t,yt=null,e=!0):e=!1),e||si(t)),null;case 13:return vp(e,t,a);case 4:return ge(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ta(t,null,l,a):Dt(e,t,l,a),t.child;case 11:return fp(e,t,t.type,t.pendingProps,a);case 7:return Dt(e,t,t.pendingProps,a),t.child;case 8:return Dt(e,t,t.pendingProps.children,a),t.child;case 12:return Dt(e,t,t.pendingProps.children,a),t.child;case 10:return l=t.pendingProps,ms(t,t.type,l.value),Dt(e,t,l.children,a),t.child;case 9:return f=t.type._context,l=t.pendingProps.children,ai(t),f=Gt(f),l=l(f),t.flags|=1,Dt(e,t,l,a),t.child;case 14:return hp(e,t,t.type,t.pendingProps,a);case 15:return mp(e,t,t.type,t.pendingProps,a);case 19:return kp(e,t,a);case 31:return l=t.pendingProps,a=t.mode,l={mode:l.mode,children:l.children},e===null?(a=Uo(l,a),a.ref=t.ref,t.child=a,a.return=t,t=a):(a=Qn(e.child,l),a.ref=t.ref,t.child=a,a.return=t,t=a),t;case 22:return pp(e,t,a);case 24:return ai(t),l=Gt(Et),e===null?(f=Bc(),f===null&&(f=dt,p=Dc(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=a),f=p),t.memoizedState={parent:l,cache:f},$c(t),ms(t,Et,f)):((e.lanes&a)!==0&&(Hc(e,t),Fa(t,null,null,a),Pa()),f=e.memoizedState,p=t.memoizedState,f.parent!==l?(f={parent:l,cache:l},t.memoizedState=f,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=f),ms(t,Et,l)):(l=p.cache,ms(t,Et,l),l!==f.cache&&Oc(t,[Et],a,!0))),Dt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function ns(e){e.flags|=4}function Sp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_g(t)){if(t=jn.current,t!==null&&((Qe&4194048)===Qe?qn!==null:(Qe&62914560)!==Qe&&(Qe&536870912)===0||t!==qn))throw Za=Uc,om;e.flags|=8192}}function $o(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ne():536870912,e.lanes|=t,aa|=t)}function ar(e,t){if(!Pe)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function gt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function Bv(e,t,a){var l=t.pendingProps;switch(zc(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(t),null;case 1:return gt(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Fn(Et),he(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ga(t)?ns(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,nm())),gt(t),null;case 26:return a=t.memoizedState,e===null?(ns(t),a!==null?(gt(t),Sp(t,a)):(gt(t),t.flags&=-16777217)):a?a!==e.memoizedState?(ns(t),gt(t),Sp(t,a)):(gt(t),t.flags&=-16777217):(e.memoizedProps!==l&&ns(t),gt(t),t.flags&=-16777217),null;case 27:$e(t),a=Z.current;var f=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return gt(t),null}e=oe.current,Ga(t)?em(t):(e=Sg(f,l,a),t.stateNode=e,ns(t))}return gt(t),null;case 5:if($e(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return gt(t),null}if(e=oe.current,Ga(t))em(t);else{switch(f=Jo(Z.current),e){case 1:e=f.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:e=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":e=f.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":e=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":e=f.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?e.multiple=!0:l.size&&(e.size=l.size);break;default:e=typeof l.is=="string"?f.createElement(a,{is:l.is}):f.createElement(a)}}e[Ht]=t,e[Wt]=l;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)e.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=e;e:switch(Bt(e,a,l),a){case"button":case"input":case"select":case"textarea":e=!!l.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&ns(t)}}return gt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ns(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=Z.current,Ga(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,f=Kt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[Ht]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||xg(e.nodeValue,a)),e||si(t)}else e=Jo(e).createTextNode(l),e[Ht]=t,t.stateNode=e}return gt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Ga(t),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=t.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[Ht]=t}else Ia(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;gt(t),f=!1}else f=nm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return t.flags&256?(es(t),t):(es(t),null)}if(es(t),(t.flags&128)!==0)return t.lanes=a,t;if(a=l!==null,e=e!==null&&e.memoizedState!==null,a){l=t.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool);var p=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==f&&(l.flags|=2048)}return a!==e&&a&&(t.child.flags|=8192),$o(t,t.updateQueue),gt(t),null;case 4:return he(),e===null&&Iu(t.stateNode.containerInfo),gt(t),null;case 10:return Fn(t.type),gt(t),null;case 19:if(P(Ct),f=t.memoizedState,f===null)return gt(t),null;if(l=(t.flags&128)!==0,p=f.rendering,p===null)if(l)ar(f,!1);else{if(bt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(p=Oo(e),p!==null){for(t.flags|=128,ar(f,!1),e=p.updateQueue,t.updateQueue=e,$o(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Fh(a,e),a=a.sibling;return ee(Ct,Ct.current&1|2),t.child}e=e.sibling}f.tail!==null&&je()>Io&&(t.flags|=128,l=!0,ar(f,!1),t.lanes=4194304)}else{if(!l)if(e=Oo(p),e!==null){if(t.flags|=128,l=!0,e=e.updateQueue,t.updateQueue=e,$o(t,e),ar(f,!0),f.tail===null&&f.tailMode==="hidden"&&!p.alternate&&!Pe)return gt(t),null}else 2*je()-f.renderingStartTime>Io&&a!==536870912&&(t.flags|=128,l=!0,ar(f,!1),t.lanes=4194304);f.isBackwards?(p.sibling=t.child,t.child=p):(e=f.last,e!==null?e.sibling=p:t.child=p,f.last=p)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=je(),t.sibling=null,e=Ct.current,ee(Ct,l?e&1|2:e&1),t):(gt(t),null);case 22:case 23:return es(t),Vc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(gt(t),t.subtreeFlags&6&&(t.flags|=8192)):gt(t),a=t.updateQueue,a!==null&&$o(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&P(ri),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Fn(Et),gt(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Uv(e,t){switch(zc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Fn(Et),he(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return $e(t),null;case 13:if(es(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(Ct),null;case 4:return he(),null;case 10:return Fn(t.type),null;case 22:case 23:return es(t),Vc(),e!==null&&P(ri),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Fn(Et),null;case 25:return null;default:return null}}function Np(e,t){switch(zc(t),t.tag){case 3:Fn(Et),he();break;case 26:case 27:case 5:$e(t);break;case 4:he();break;case 13:es(t);break;case 19:P(Ct);break;case 10:Fn(t.type);break;case 22:case 23:es(t),Vc(),e!==null&&P(ri);break;case 24:Fn(Et)}}function rr(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var p=a.create,b=a.inst;l=p(),b.destroy=l}a=a.next}while(a!==f)}}catch(j){ut(t,t.return,j)}}function ws(e,t,a){try{var l=t.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var p=f.next;l=p;do{if((l.tag&e)===e){var b=l.inst,j=b.destroy;if(j!==void 0){b.destroy=void 0,f=t;var C=a,G=j;try{G()}catch(F){ut(f,C,F)}}}l=l.next}while(l!==p)}}catch(F){ut(t,t.return,F)}}function Tp(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{hm(t,a)}catch(l){ut(e,e.return,l)}}}function Ap(e,t,a){a.props=li(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){ut(e,t,l)}}function or(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){ut(e,t,f)}}function Bn(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){ut(e,t,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){ut(e,t,f)}else a.current=null}function Ep(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){ut(e,e.return,f)}}function bu(e,t,a){try{var l=e.stateNode;rw(l,e.type,a,t),l[Wt]=t}catch(f){ut(e,e.return,f)}}function Cp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Cs(e.type)||e.tag===4}function vu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Cs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wu(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Fo));else if(l!==4&&(l===27&&Cs(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(wu(e,t,a),e=e.sibling;e!==null;)wu(e,t,a),e=e.sibling}function Ho(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&Cs(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Ho(e,t,a),e=e.sibling;e!==null;)Ho(e,t,a),e=e.sibling}function Mp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=t.attributes;f.length;)t.removeAttributeNode(f[0]);Bt(t,l,a),t[Ht]=e,t[Wt]=a}catch(p){ut(e,e.return,p)}}var ss=!1,St=!1,ku=!1,zp=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function $v(e,t){if(e=e.containerInfo,Ku=al,e=Gh(e),vc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var b=0,j=-1,C=-1,G=0,F=0,te=e,K=null;t:for(;;){for(var Q;te!==a||f!==0&&te.nodeType!==3||(j=b+f),te!==p||l!==0&&te.nodeType!==3||(C=b+l),te.nodeType===3&&(b+=te.nodeValue.length),(Q=te.firstChild)!==null;)K=te,te=Q;for(;;){if(te===e)break t;if(K===a&&++G===f&&(j=b),K===p&&++F===l&&(C=b),(Q=te.nextSibling)!==null)break;te=K,K=te.parentNode}te=Q}a=j===-1||C===-1?null:{start:j,end:C}}else a=null}a=a||{start:0,end:0}}else a=null;for(Xu={focusedElem:e,selectionRange:a},al=!1,Rt=t;Rt!==null;)if(t=Rt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,Rt=e;else for(;Rt!==null;){switch(t=Rt,p=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if((e&1024)!==0&&p!==null){e=void 0,a=t,f=p.memoizedProps,p=p.memoizedState,l=a.stateNode;try{var Re=li(a.type,f,a.elementType===a.type);e=l.getSnapshotBeforeUpdate(Re,p),l.__reactInternalSnapshotBeforeUpdate=e}catch(Me){ut(a,a.return,Me)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Wu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Wu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,Rt=e;break}Rt=t.return}}function _p(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ks(e,a),l&4&&rr(5,a);break;case 1:if(ks(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(b){ut(a,a.return,b)}else{var f=li(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(f,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){ut(a,a.return,b)}}l&64&&Tp(a),l&512&&or(a,a.return);break;case 3:if(ks(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{hm(e,t)}catch(b){ut(a,a.return,b)}}break;case 27:t===null&&l&4&&Mp(a);case 26:case 5:ks(e,a),t===null&&l&4&&Ep(a),l&512&&or(a,a.return);break;case 12:ks(e,a);break;case 13:ks(e,a),l&4&&Op(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Zv.bind(null,a),hw(e,a))));break;case 22:if(l=a.memoizedState!==null||ss,!l){t=t!==null&&t.memoizedState!==null||St,f=ss;var p=St;ss=l,(St=t)&&!p?js(e,a,(a.subtreeFlags&8772)!==0):ks(e,a),ss=f,St=p}break;case 30:break;default:ks(e,a)}}function Rp(e){var t=e.alternate;t!==null&&(e.alternate=null,Rp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&tc(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var mt=null,Jt=!1;function is(e,t,a){for(a=a.child;a!==null;)Lp(e,t,a),a=a.sibling}function Lp(e,t,a){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(wt,a)}catch{}switch(a.tag){case 26:St||Bn(a,t),is(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:St||Bn(a,t);var l=mt,f=Jt;Cs(a.type)&&(mt=a.stateNode,Jt=!1),is(e,t,a),gr(a.stateNode),mt=l,Jt=f;break;case 5:St||Bn(a,t);case 6:if(l=mt,f=Jt,mt=null,is(e,t,a),mt=l,Jt=f,mt!==null)if(Jt)try{(mt.nodeType===9?mt.body:mt.nodeName==="HTML"?mt.ownerDocument.body:mt).removeChild(a.stateNode)}catch(p){ut(a,t,p)}else try{mt.removeChild(a.stateNode)}catch(p){ut(a,t,p)}break;case 18:mt!==null&&(Jt?(e=mt,kg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),Sr(e)):kg(mt,a.stateNode));break;case 4:l=mt,f=Jt,mt=a.stateNode.containerInfo,Jt=!0,is(e,t,a),mt=l,Jt=f;break;case 0:case 11:case 14:case 15:St||ws(2,a,t),St||ws(4,a,t),is(e,t,a);break;case 1:St||(Bn(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Ap(a,t,l)),is(e,t,a);break;case 21:is(e,t,a);break;case 22:St=(l=St)||a.memoizedState!==null,is(e,t,a),St=l;break;default:is(e,t,a)}}function Op(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Sr(e)}catch(a){ut(t,t.return,a)}}function Hv(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new zp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new zp),t;default:throw Error(r(435,e.tag))}}function ju(e,t){var a=Hv(e);t.forEach(function(l){var f=Wv.bind(null,e,l);a.has(l)||(a.add(l),l.then(f,f))})}function on(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],p=e,b=t,j=b;e:for(;j!==null;){switch(j.tag){case 27:if(Cs(j.type)){mt=j.stateNode,Jt=!1;break e}break;case 5:mt=j.stateNode,Jt=!1;break e;case 3:case 4:mt=j.stateNode.containerInfo,Jt=!0;break e}j=j.return}if(mt===null)throw Error(r(160));Lp(p,b,f),mt=null,Jt=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)Dp(t,e),t=t.sibling}var Cn=null;function Dp(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),ln(e),l&4&&(ws(3,e,e.return),rr(3,e),ws(5,e,e.return));break;case 1:on(t,e),ln(e),l&512&&(St||a===null||Bn(a,a.return)),l&64&&ss&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Cn;if(on(t,e),ln(e),l&512&&(St||a===null||Bn(a,a.return)),l&4){var p=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":p=f.getElementsByTagName("title")[0],(!p||p[za]||p[Ht]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(l),f.head.insertBefore(p,f.querySelector("head > title"))),Bt(p,l,a),p[Ht]=e,zt(p),l=p;break e;case"link":var b=Mg("link","href",f).get(l+(a.href||""));if(b){for(var j=0;j<b.length;j++)if(p=b[j],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){b.splice(j,1);break t}}p=f.createElement(l),Bt(p,l,a),f.head.appendChild(p);break;case"meta":if(b=Mg("meta","content",f).get(l+(a.content||""))){for(j=0;j<b.length;j++)if(p=b[j],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){b.splice(j,1);break t}}p=f.createElement(l),Bt(p,l,a),f.head.appendChild(p);break;default:throw Error(r(468,l))}p[Ht]=e,zt(p),l=p}e.stateNode=l}else zg(f,e.type,e.stateNode);else e.stateNode=Cg(f,l,e.memoizedProps);else p!==l?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,l===null?zg(f,e.type,e.stateNode):Cg(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&bu(e,e.memoizedProps,a.memoizedProps)}break;case 27:on(t,e),ln(e),l&512&&(St||a===null||Bn(a,a.return)),a!==null&&l&4&&bu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(on(t,e),ln(e),l&512&&(St||a===null||Bn(a,a.return)),e.flags&32){f=e.stateNode;try{qi(f,"")}catch(Q){ut(e,e.return,Q)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,bu(e,f,a!==null?a.memoizedProps:f)),l&1024&&(ku=!0);break;case 6:if(on(t,e),ln(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(Q){ut(e,e.return,Q)}}break;case 3:if(nl=null,f=Cn,Cn=el(t.containerInfo),on(t,e),Cn=f,ln(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Sr(t.containerInfo)}catch(Q){ut(e,e.return,Q)}ku&&(ku=!1,qp(e));break;case 4:l=Cn,Cn=el(e.stateNode.containerInfo),on(t,e),ln(e),Cn=l;break;case 12:on(t,e),ln(e);break;case 13:on(t,e),ln(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Cu=je()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ju(e,l)));break;case 22:f=e.memoizedState!==null;var C=a!==null&&a.memoizedState!==null,G=ss,F=St;if(ss=G||f,St=F||C,on(t,e),St=F,ss=G,ln(e),l&8192)e:for(t=e.stateNode,t._visibility=f?t._visibility&-2:t._visibility|1,f&&(a===null||C||ss||St||ci(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){C=a=t;try{if(p=C.stateNode,f)b=p.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{j=C.stateNode;var te=C.memoizedProps.style,K=te!=null&&te.hasOwnProperty("display")?te.display:null;j.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(Q){ut(C,C.return,Q)}}}else if(t.tag===6){if(a===null){C=t;try{C.stateNode.nodeValue=f?"":C.memoizedProps}catch(Q){ut(C,C.return,Q)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,ju(e,a))));break;case 19:on(t,e),ln(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ju(e,l)));break;case 30:break;case 21:break;default:on(t,e),ln(e)}}function ln(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(Cp(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,p=vu(e);Ho(e,p,f);break;case 5:var b=a.stateNode;a.flags&32&&(qi(b,""),a.flags&=-33);var j=vu(e);Ho(e,j,b);break;case 3:case 4:var C=a.stateNode.containerInfo,G=vu(e);wu(e,G,C);break;default:throw Error(r(161))}}catch(F){ut(e,e.return,F)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function qp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;qp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ks(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)_p(e,t.alternate,t),t=t.sibling}function ci(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ws(4,t,t.return),ci(t);break;case 1:Bn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Ap(t,t.return,a),ci(t);break;case 27:gr(t.stateNode);case 26:case 5:Bn(t,t.return),ci(t);break;case 22:t.memoizedState===null&&ci(t);break;case 30:ci(t);break;default:ci(t)}e=e.sibling}}function js(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,f=e,p=t,b=p.flags;switch(p.tag){case 0:case 11:case 15:js(f,p,a),rr(4,p);break;case 1:if(js(f,p,a),l=p,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){ut(l,l.return,G)}if(l=p,f=l.updateQueue,f!==null){var j=l.stateNode;try{var C=f.shared.hiddenCallbacks;if(C!==null)for(f.shared.hiddenCallbacks=null,f=0;f<C.length;f++)fm(C[f],j)}catch(G){ut(l,l.return,G)}}a&&b&64&&Tp(p),or(p,p.return);break;case 27:Mp(p);case 26:case 5:js(f,p,a),a&&l===null&&b&4&&Ep(p),or(p,p.return);break;case 12:js(f,p,a);break;case 13:js(f,p,a),a&&b&4&&Op(f,p);break;case 22:p.memoizedState===null&&js(f,p,a),or(p,p.return);break;case 30:break;default:js(f,p,a)}t=t.sibling}}function Su(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ka(a))}function Nu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ka(e))}function Un(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bp(e,t,a,l),t=t.sibling}function Bp(e,t,a,l){var f=t.flags;switch(t.tag){case 0:case 11:case 15:Un(e,t,a,l),f&2048&&rr(9,t);break;case 1:Un(e,t,a,l);break;case 3:Un(e,t,a,l),f&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ka(e)));break;case 12:if(f&2048){Un(e,t,a,l),e=t.stateNode;try{var p=t.memoizedProps,b=p.id,j=p.onPostCommit;typeof j=="function"&&j(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(C){ut(t,t.return,C)}}else Un(e,t,a,l);break;case 13:Un(e,t,a,l);break;case 23:break;case 22:p=t.stateNode,b=t.alternate,t.memoizedState!==null?p._visibility&2?Un(e,t,a,l):lr(e,t):p._visibility&2?Un(e,t,a,l):(p._visibility|=2,na(e,t,a,l,(t.subtreeFlags&10256)!==0)),f&2048&&Su(b,t);break;case 24:Un(e,t,a,l),f&2048&&Nu(t.alternate,t);break;default:Un(e,t,a,l)}}function na(e,t,a,l,f){for(f=f&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var p=e,b=t,j=a,C=l,G=b.flags;switch(b.tag){case 0:case 11:case 15:na(p,b,j,C,f),rr(8,b);break;case 23:break;case 22:var F=b.stateNode;b.memoizedState!==null?F._visibility&2?na(p,b,j,C,f):lr(p,b):(F._visibility|=2,na(p,b,j,C,f)),f&&G&2048&&Su(b.alternate,b);break;case 24:na(p,b,j,C,f),f&&G&2048&&Nu(b.alternate,b);break;default:na(p,b,j,C,f)}t=t.sibling}}function lr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,f=l.flags;switch(l.tag){case 22:lr(a,l),f&2048&&Su(l.alternate,l);break;case 24:lr(a,l),f&2048&&Nu(l.alternate,l);break;default:lr(a,l)}t=t.sibling}}var cr=8192;function sa(e){if(e.subtreeFlags&cr)for(e=e.child;e!==null;)Up(e),e=e.sibling}function Up(e){switch(e.tag){case 26:sa(e),e.flags&cr&&e.memoizedState!==null&&Tw(Cn,e.memoizedState,e.memoizedProps);break;case 5:sa(e);break;case 3:case 4:var t=Cn;Cn=el(e.stateNode.containerInfo),sa(e),Cn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=cr,cr=16777216,sa(e),cr=t):sa(e));break;default:sa(e)}}function $p(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ur(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];Rt=l,Gp(l,e)}$p(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hp(e),e=e.sibling}function Hp(e){switch(e.tag){case 0:case 11:case 15:ur(e),e.flags&2048&&ws(9,e,e.return);break;case 3:ur(e);break;case 12:ur(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Go(e)):ur(e);break;default:ur(e)}}function Go(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];Rt=l,Gp(l,e)}$p(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ws(8,t,t.return),Go(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Go(t));break;default:Go(t)}e=e.sibling}}function Gp(e,t){for(;Rt!==null;){var a=Rt;switch(a.tag){case 0:case 11:case 15:ws(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ka(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Rt=l;else e:for(a=e;Rt!==null;){l=Rt;var f=l.sibling,p=l.return;if(Rp(l),l===a){Rt=null;break e}if(f!==null){f.return=p,Rt=f;break e}Rt=p}}}var Gv={getCacheForType:function(e){var t=Gt(Et),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a}},Iv=typeof WeakMap=="function"?WeakMap:Map,et=0,dt=null,Ve=null,Qe=0,tt=0,cn=null,Ss=!1,ia=!1,Tu=!1,as=0,bt=0,Ns=0,ui=0,Au=0,Sn=0,aa=0,dr=null,en=null,Eu=!1,Cu=0,Io=1/0,Yo=null,Ts=null,qt=0,As=null,ra=null,oa=0,Mu=0,zu=null,Ip=null,fr=0,_u=null;function un(){if((et&2)!==0&&Qe!==0)return Qe&-Qe;if(B.T!==null){var e=Qi;return e!==0?e:Uu()}return Qs()}function Yp(){Sn===0&&(Sn=(Qe&536870912)===0||Pe?ye():536870912);var e=jn.current;return e!==null&&(e.flags|=32),Sn}function dn(e,t,a){(e===dt&&(tt===2||tt===9)||e.cancelPendingCommit!==null)&&(la(e,0),Es(e,Qe,Sn,!1)),Ze(e,a),((et&2)===0||e!==dt)&&(e===dt&&((et&2)===0&&(ui|=a),bt===4&&Es(e,Qe,Sn,!1)),$n(e))}function Vp(e,t,a){if((et&6)!==0)throw Error(r(327));var l=!a&&(t&124)===0&&(t&e.expiredLanes)===0||U(e,t),f=l?Kv(e,t):Ou(e,t,!0),p=l;do{if(f===0){ia&&!l&&Es(e,t,0,!1);break}else{if(a=e.current.alternate,p&&!Yv(a)){f=Ou(e,t,!1),p=!1;continue}if(f===2){if(p=t,e.errorRecoveryDisabledLanes&p)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var j=e;f=dr;var C=j.current.memoizedState.isDehydrated;if(C&&(la(j,b).flags|=256),b=Ou(j,b,!1),b!==2){if(Tu&&!C){j.errorRecoveryDisabledLanes|=p,ui|=p,f=4;break e}p=en,en=f,p!==null&&(en===null?en=p:en.push.apply(en,p))}f=b}if(p=!1,f!==2)continue}}if(f===1){la(e,0),Es(e,t,0,!0);break}e:{switch(l=e,p=f,p){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Es(l,t,Sn,!Ss);break e;case 2:en=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(f=Cu+300-je(),10<f)){if(Es(l,t,Sn,!Ss),Ci(l,0,!0)!==0)break e;l.timeoutHandle=vg(Kp.bind(null,l,a,en,Yo,Eu,t,Sn,ui,aa,Ss,p,2,-0,0),f);break e}Kp(l,a,en,Yo,Eu,t,Sn,ui,aa,Ss,p,0,-0,0)}}break}while(!0);$n(e)}function Kp(e,t,a,l,f,p,b,j,C,G,F,te,K,Q){if(e.timeoutHandle=-1,te=t.subtreeFlags,(te&8192||(te&16785408)===16785408)&&(br={stylesheets:null,count:0,unsuspend:Nw},Up(t),te=Aw(),te!==null)){e.cancelPendingCommit=te(Jp.bind(null,e,t,p,a,l,f,b,j,C,F,1,K,Q)),Es(e,p,b,!G);return}Jp(e,t,p,a,l,f,b,j,C)}function Yv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],p=f.getSnapshot;f=f.value;try{if(!an(p(),f))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Es(e,t,a,l){t&=~Au,t&=~ui,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var f=t;0<f;){var p=31-xt(f),b=1<<p;l[p]=-1,f&=~b}a!==0&&kt(e,a,t)}function Vo(){return(et&6)===0?(hr(0),!1):!0}function Ru(){if(Ve!==null){if(tt===0)var e=Ve.return;else e=Ve,Pn=ii=null,Wc(e),ea=null,sr=0,e=Ve;for(;e!==null;)Np(e.alternate,e),e=e.return;Ve=null}}function la(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,lw(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ru(),dt=e,Ve=a=Qn(e.current,null),Qe=t,tt=0,cn=null,Ss=!1,ia=U(e,t),Tu=!1,aa=Sn=Au=ui=Ns=bt=0,en=dr=null,Eu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var f=31-xt(l),p=1<<f;t|=e[f],l&=~p}return as=t,ho(),a}function Xp(e,t){He=null,B.H=_o,t===Qa||t===ko?(t=um(),tt=3):t===om?(t=um(),tt=4):tt=t===dp?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,cn=t,Ve===null&&(bt=1,qo(e,bn(t,e.current)))}function Qp(){var e=B.H;return B.H=_o,e===null?_o:e}function Zp(){var e=B.A;return B.A=Gv,e}function Lu(){bt=4,Ss||(Qe&4194048)!==Qe&&jn.current!==null||(ia=!0),(Ns&134217727)===0&&(ui&134217727)===0||dt===null||Es(dt,Qe,Sn,!1)}function Ou(e,t,a){var l=et;et|=2;var f=Qp(),p=Zp();(dt!==e||Qe!==t)&&(Yo=null,la(e,t)),t=!1;var b=bt;e:do try{if(tt!==0&&Ve!==null){var j=Ve,C=cn;switch(tt){case 8:Ru(),b=6;break e;case 3:case 2:case 9:case 6:jn.current===null&&(t=!0);var G=tt;if(tt=0,cn=null,ca(e,j,C,G),a&&ia){b=0;break e}break;default:G=tt,tt=0,cn=null,ca(e,j,C,G)}}Vv(),b=bt;break}catch(F){Xp(e,F)}while(!0);return t&&e.shellSuspendCounter++,Pn=ii=null,et=l,B.H=f,B.A=p,Ve===null&&(dt=null,Qe=0,ho()),b}function Vv(){for(;Ve!==null;)Wp(Ve)}function Kv(e,t){var a=et;et|=2;var l=Qp(),f=Zp();dt!==e||Qe!==t?(Yo=null,Io=je()+500,la(e,t)):ia=U(e,t);e:do try{if(tt!==0&&Ve!==null){t=Ve;var p=cn;t:switch(tt){case 1:tt=0,cn=null,ca(e,t,p,1);break;case 2:case 9:if(lm(p)){tt=0,cn=null,Pp(t);break}t=function(){tt!==2&&tt!==9||dt!==e||(tt=7),$n(e)},p.then(t,t);break e;case 3:tt=7;break e;case 4:tt=5;break e;case 7:lm(p)?(tt=0,cn=null,Pp(t)):(tt=0,cn=null,ca(e,t,p,7));break;case 5:var b=null;switch(Ve.tag){case 26:b=Ve.memoizedState;case 5:case 27:var j=Ve;if(!b||_g(b)){tt=0,cn=null;var C=j.sibling;if(C!==null)Ve=C;else{var G=j.return;G!==null?(Ve=G,Ko(G)):Ve=null}break t}}tt=0,cn=null,ca(e,t,p,5);break;case 6:tt=0,cn=null,ca(e,t,p,6);break;case 8:Ru(),bt=6;break e;default:throw Error(r(462))}}Xv();break}catch(F){Xp(e,F)}while(!0);return Pn=ii=null,B.H=l,B.A=f,et=a,Ve!==null?0:(dt=null,Qe=0,ho(),bt)}function Xv(){for(;Ve!==null&&!xe();)Wp(Ve)}function Wp(e){var t=jp(e.alternate,e,as);e.memoizedProps=e.pendingProps,t===null?Ko(e):Ve=t}function Pp(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=xp(a,t,t.pendingProps,t.type,void 0,Qe);break;case 11:t=xp(a,t,t.pendingProps,t.type.render,t.ref,Qe);break;case 5:Wc(t);default:Np(a,t),t=Ve=Fh(t,as),t=jp(a,t,as)}e.memoizedProps=e.pendingProps,t===null?Ko(e):Ve=t}function ca(e,t,a,l){Pn=ii=null,Wc(t),ea=null,sr=0;var f=t.return;try{if(Dv(e,f,t,a,Qe)){bt=1,qo(e,bn(a,e.current)),Ve=null;return}}catch(p){if(f!==null)throw Ve=f,p;bt=1,qo(e,bn(a,e.current)),Ve=null;return}t.flags&32768?(Pe||l===1?e=!0:ia||(Qe&536870912)!==0?e=!1:(Ss=e=!0,(l===2||l===9||l===3||l===6)&&(l=jn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Fp(t,e)):Ko(t)}function Ko(e){var t=e;do{if((t.flags&32768)!==0){Fp(t,Ss);return}e=t.return;var a=Bv(t.alternate,t,as);if(a!==null){Ve=a;return}if(t=t.sibling,t!==null){Ve=t;return}Ve=t=e}while(t!==null);bt===0&&(bt=5)}function Fp(e,t){do{var a=Uv(e.alternate,e);if(a!==null){a.flags&=32767,Ve=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=a}while(e!==null);bt=6,Ve=null}function Jp(e,t,a,l,f,p,b,j,C){e.cancelPendingCommit=null;do Xo();while(qt!==0);if((et&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(p=t.lanes|t.childLanes,p|=Nc,Je(e,a,p,b,j,C),e===dt&&(Ve=dt=null,Qe=0),ra=t,As=e,oa=a,Mu=p,zu=f,Ip=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Pv(st,function(){return ig(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=W.p,W.p=2,b=et,et|=4;try{$v(e,t,a)}finally{et=b,W.p=f,B.T=l}}qt=1,eg(),tg(),ng()}}function eg(){if(qt===1){qt=0;var e=As,t=ra,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var l=W.p;W.p=2;var f=et;et|=4;try{Dp(t,e);var p=Xu,b=Gh(e.containerInfo),j=p.focusedElem,C=p.selectionRange;if(b!==j&&j&&j.ownerDocument&&Hh(j.ownerDocument.documentElement,j)){if(C!==null&&vc(j)){var G=C.start,F=C.end;if(F===void 0&&(F=G),"selectionStart"in j)j.selectionStart=G,j.selectionEnd=Math.min(F,j.value.length);else{var te=j.ownerDocument||document,K=te&&te.defaultView||window;if(K.getSelection){var Q=K.getSelection(),Re=j.textContent.length,Me=Math.min(C.start,Re),lt=C.end===void 0?Me:Math.min(C.end,Re);!Q.extend&&Me>lt&&(b=lt,lt=Me,Me=b);var D=$h(j,Me),z=$h(j,lt);if(D&&z&&(Q.rangeCount!==1||Q.anchorNode!==D.node||Q.anchorOffset!==D.offset||Q.focusNode!==z.node||Q.focusOffset!==z.offset)){var H=te.createRange();H.setStart(D.node,D.offset),Q.removeAllRanges(),Me>lt?(Q.addRange(H),Q.extend(z.node,z.offset)):(H.setEnd(z.node,z.offset),Q.addRange(H))}}}}for(te=[],Q=j;Q=Q.parentNode;)Q.nodeType===1&&te.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<te.length;j++){var J=te[j];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}al=!!Ku,Xu=Ku=null}finally{et=f,W.p=l,B.T=a}}e.current=t,qt=2}}function tg(){if(qt===2){qt=0;var e=As,t=ra,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var l=W.p;W.p=2;var f=et;et|=4;try{_p(e,t.alternate,t)}finally{et=f,W.p=l,B.T=a}}qt=3}}function ng(){if(qt===4||qt===3){qt=0,Ee();var e=As,t=ra,a=oa,l=Ip;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?qt=5:(qt=0,ra=As=null,sg(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ts=null),Xs(a),t=t.stateNode,it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(wt,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=B.T,f=W.p,W.p=2,B.T=null;try{for(var p=e.onRecoverableError,b=0;b<l.length;b++){var j=l[b];p(j.value,{componentStack:j.stack})}}finally{B.T=t,W.p=f}}(oa&3)!==0&&Xo(),$n(e),f=e.pendingLanes,(a&4194090)!==0&&(f&42)!==0?e===_u?fr++:(fr=0,_u=e):fr=0,hr(0)}}function sg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ka(t)))}function Xo(e){return eg(),tg(),ng(),ig()}function ig(){if(qt!==5)return!1;var e=As,t=Mu;Mu=0;var a=Xs(oa),l=B.T,f=W.p;try{W.p=32>a?32:a,B.T=null,a=zu,zu=null;var p=As,b=oa;if(qt=0,ra=As=null,oa=0,(et&6)!==0)throw Error(r(331));var j=et;if(et|=4,Hp(p.current),Bp(p,p.current,b,a),et=j,hr(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(wt,p)}catch{}return!0}finally{W.p=f,B.T=l,sg(e,t)}}function ag(e,t,a){t=bn(a,t),t=uu(e.stateNode,t,2),e=xs(e,t,2),e!==null&&(Ze(e,2),$n(e))}function ut(e,t,a){if(e.tag===3)ag(e,e,a);else for(;t!==null;){if(t.tag===3){ag(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ts===null||!Ts.has(l))){e=bn(a,e),a=cp(2),l=xs(t,a,2),l!==null&&(up(a,l,t,e),Ze(l,2),$n(l));break}}t=t.return}}function Du(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Iv;var f=new Set;l.set(t,f)}else f=l.get(t),f===void 0&&(f=new Set,l.set(t,f));f.has(a)||(Tu=!0,f.add(a),e=Qv.bind(null,e,t,a),t.then(e,e))}function Qv(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,dt===e&&(Qe&a)===a&&(bt===4||bt===3&&(Qe&62914560)===Qe&&300>je()-Cu?(et&2)===0&&la(e,0):Au|=a,aa===Qe&&(aa=0)),$n(e)}function rg(e,t){t===0&&(t=Ne()),e=Yi(e,t),e!==null&&(Ze(e,t),$n(e))}function Zv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),rg(e,a)}function Wv(e,t){var a=0;switch(e.tag){case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),rg(e,a)}function Pv(e,t){return ht(e,t)}var Qo=null,ua=null,qu=!1,Zo=!1,Bu=!1,di=0;function $n(e){e!==ua&&e.next===null&&(ua===null?Qo=ua=e:ua=ua.next=e),Zo=!0,qu||(qu=!0,Jv())}function hr(e,t){if(!Bu&&Zo){Bu=!0;do for(var a=!1,l=Qo;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var p=0;else{var b=l.suspendedLanes,j=l.pingedLanes;p=(1<<31-xt(42|e)+1)-1,p&=f&~(b&~j),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,ug(l,p))}else p=Qe,p=Ci(l,l===dt?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||U(l,p)||(a=!0,ug(l,p));l=l.next}while(a);Bu=!1}}function Fv(){og()}function og(){Zo=qu=!1;var e=0;di!==0&&(ow()&&(e=di),di=0);for(var t=je(),a=null,l=Qo;l!==null;){var f=l.next,p=lg(l,t);p===0?(l.next=null,a===null?Qo=f:a.next=f,f===null&&(ua=a)):(a=l,(e!==0||(p&3)!==0)&&(Zo=!0)),l=f}hr(e)}function lg(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,p=e.pendingLanes&-62914561;0<p;){var b=31-xt(p),j=1<<b,C=f[b];C===-1?((j&a)===0||(j&l)!==0)&&(f[b]=se(j,t)):C<=t&&(e.expiredLanes|=j),p&=~j}if(t=dt,a=Qe,a=Ci(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(tt===2||tt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ve(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||U(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&ve(l),Xs(a)){case 2:case 8:a=Ce;break;case 32:a=st;break;case 268435456:a=Se;break;default:a=st}return l=cg.bind(null,e),a=ht(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&ve(l),e.callbackPriority=2,e.callbackNode=null,2}function cg(e,t){if(qt!==0&&qt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Xo()&&e.callbackNode!==a)return null;var l=Qe;return l=Ci(e,e===dt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Vp(e,l,t),lg(e,je()),e.callbackNode!=null&&e.callbackNode===a?cg.bind(null,e):null)}function ug(e,t){if(Xo())return null;Vp(e,t,!0)}function Jv(){cw(function(){(et&6)!==0?ht(pn,Fv):og()})}function Uu(){return di===0&&(di=ye()),di}function dg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ao(""+e)}function fg(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function ew(e,t,a,l,f){if(t==="submit"&&a&&a.stateNode===f){var p=dg((f[Wt]||null).action),b=l.submitter;b&&(t=(t=b[Wt]||null)?dg(t.formAction):b.getAttribute("formAction"),t!==null&&(p=t,b=null));var j=new co("action","action",null,l,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(di!==0){var C=b?fg(f,b):new FormData(f);au(a,{pending:!0,data:C,method:f.method,action:p},null,C)}}else typeof p=="function"&&(j.preventDefault(),C=b?fg(f,b):new FormData(f),au(a,{pending:!0,data:C,method:f.method,action:p},p,C))},currentTarget:f}]})}}for(var $u=0;$u<Sc.length;$u++){var Hu=Sc[$u],tw=Hu.toLowerCase(),nw=Hu[0].toUpperCase()+Hu.slice(1);En(tw,"on"+nw)}En(Vh,"onAnimationEnd"),En(Kh,"onAnimationIteration"),En(Xh,"onAnimationStart"),En("dblclick","onDoubleClick"),En("focusin","onFocus"),En("focusout","onBlur"),En(bv,"onTransitionRun"),En(vv,"onTransitionStart"),En(wv,"onTransitionCancel"),En(Qh,"onTransitionEnd"),Li("onMouseEnter",["mouseout","mouseover"]),Li("onMouseLeave",["mouseout","mouseover"]),Li("onPointerEnter",["pointerout","pointerover"]),Li("onPointerLeave",["pointerout","pointerover"]),Zs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Zs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Zs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Zs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Zs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Zs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mr="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("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(mr));function hg(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var p=void 0;if(t)for(var b=l.length-1;0<=b;b--){var j=l[b],C=j.instance,G=j.currentTarget;if(j=j.listener,C!==p&&f.isPropagationStopped())break e;p=j,f.currentTarget=G;try{p(f)}catch(F){Do(F)}f.currentTarget=null,p=C}else for(b=0;b<l.length;b++){if(j=l[b],C=j.instance,G=j.currentTarget,j=j.listener,C!==p&&f.isPropagationStopped())break e;p=j,f.currentTarget=G;try{p(f)}catch(F){Do(F)}f.currentTarget=null,p=C}}}}function Ke(e,t){var a=t[ec];a===void 0&&(a=t[ec]=new Set);var l=e+"__bubble";a.has(l)||(mg(t,e,2,!1),a.add(l))}function Gu(e,t,a){var l=0;t&&(l|=4),mg(a,e,l,t)}var Wo="_reactListening"+Math.random().toString(36).slice(2);function Iu(e){if(!e[Wo]){e[Wo]=!0,oh.forEach(function(a){a!=="selectionchange"&&(sw.has(a)||Gu(a,!1,e),Gu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wo]||(t[Wo]=!0,Gu("selectionchange",!1,t))}}function mg(e,t,a,l){switch(Bg(t)){case 2:var f=Mw;break;case 8:f=zw;break;default:f=sd}a=f.bind(null,t,a,e),f=void 0,!dc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(t,a,{capture:!0,passive:f}):e.addEventListener(t,a,!0):f!==void 0?e.addEventListener(t,a,{passive:f}):e.addEventListener(t,a,!1)}function Yu(e,t,a,l,f){var p=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var b=l.tag;if(b===3||b===4){var j=l.stateNode.containerInfo;if(j===f)break;if(b===4)for(b=l.return;b!==null;){var C=b.tag;if((C===3||C===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;j!==null;){if(b=zi(j),b===null)return;if(C=b.tag,C===5||C===6||C===26||C===27){l=p=b;continue e}j=j.parentNode}}l=l.return}wh(function(){var G=p,F=cc(a),te=[];e:{var K=Zh.get(e);if(K!==void 0){var Q=co,Re=e;switch(e){case"keypress":if(oo(a)===0)break e;case"keydown":case"keyup":Q=P1;break;case"focusin":Re="focus",Q=pc;break;case"focusout":Re="blur",Q=pc;break;case"beforeblur":case"afterblur":Q=pc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=U1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=ev;break;case Vh:case Kh:case Xh:Q=G1;break;case Qh:Q=nv;break;case"scroll":case"scrollend":Q=q1;break;case"wheel":Q=iv;break;case"copy":case"cut":case"paste":Q=Y1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Th;break;case"toggle":case"beforetoggle":Q=rv}var Me=(t&4)!==0,lt=!Me&&(e==="scroll"||e==="scrollend"),D=Me?K!==null?K+"Capture":null:K;Me=[];for(var z=G,H;z!==null;){var J=z;if(H=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||H===null||D===null||(J=Ra(z,D),J!=null&&Me.push(pr(z,J,H))),lt)break;z=z.return}0<Me.length&&(K=new Q(K,Re,null,a,F),te.push({event:K,listeners:Me}))}}if((t&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",K&&a!==lc&&(Re=a.relatedTarget||a.fromElement)&&(zi(Re)||Re[Mi]))break e;if((Q||K)&&(K=F.window===F?F:(K=F.ownerDocument)?K.defaultView||K.parentWindow:window,Q?(Re=a.relatedTarget||a.toElement,Q=G,Re=Re?zi(Re):null,Re!==null&&(lt=u(Re),Me=Re.tag,Re!==lt||Me!==5&&Me!==27&&Me!==6)&&(Re=null)):(Q=null,Re=G),Q!==Re)){if(Me=Sh,J="onMouseLeave",D="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Me=Th,J="onPointerLeave",D="onPointerEnter",z="pointer"),lt=Q==null?K:_a(Q),H=Re==null?K:_a(Re),K=new Me(J,z+"leave",Q,a,F),K.target=lt,K.relatedTarget=H,J=null,zi(F)===G&&(Me=new Me(D,z+"enter",Re,a,F),Me.target=H,Me.relatedTarget=lt,J=Me),lt=J,Q&&Re)t:{for(Me=Q,D=Re,z=0,H=Me;H;H=da(H))z++;for(H=0,J=D;J;J=da(J))H++;for(;0<z-H;)Me=da(Me),z--;for(;0<H-z;)D=da(D),H--;for(;z--;){if(Me===D||D!==null&&Me===D.alternate)break t;Me=da(Me),D=da(D)}Me=null}else Me=null;Q!==null&&pg(te,K,Q,Me,!1),Re!==null&<!==null&&pg(te,lt,Re,Me,!0)}}e:{if(K=G?_a(G):window,Q=K.nodeName&&K.nodeName.toLowerCase(),Q==="select"||Q==="input"&&K.type==="file")var ke=Lh;else if(_h(K))if(Oh)ke=gv;else{ke=mv;var Ie=hv}else Q=K.nodeName,!Q||Q.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?G&&oc(G.elementType)&&(ke=Lh):ke=pv;if(ke&&(ke=ke(e,G))){Rh(te,ke,a,F);break e}Ie&&Ie(e,K,G),e==="focusout"&&G&&K.type==="number"&&G.memoizedProps.value!=null&&rc(K,"number",K.value)}switch(Ie=G?_a(G):window,e){case"focusin":(_h(Ie)||Ie.contentEditable==="true")&&(Hi=Ie,wc=G,Ha=null);break;case"focusout":Ha=wc=Hi=null;break;case"mousedown":kc=!0;break;case"contextmenu":case"mouseup":case"dragend":kc=!1,Ih(te,a,F);break;case"selectionchange":if(yv)break;case"keydown":case"keyup":Ih(te,a,F)}var Ae;if(xc)e:{switch(e){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else $i?Mh(e,a)&&(_e="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(_e="onCompositionStart");_e&&(Ah&&a.locale!=="ko"&&($i||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&$i&&(Ae=kh()):(hs=F,fc="value"in hs?hs.value:hs.textContent,$i=!0)),Ie=Po(G,_e),0<Ie.length&&(_e=new Nh(_e,e,null,a,F),te.push({event:_e,listeners:Ie}),Ae?_e.data=Ae:(Ae=zh(a),Ae!==null&&(_e.data=Ae)))),(Ae=lv?cv(e,a):uv(e,a))&&(_e=Po(G,"onBeforeInput"),0<_e.length&&(Ie=new Nh("onBeforeInput","beforeinput",null,a,F),te.push({event:Ie,listeners:_e}),Ie.data=Ae)),ew(te,e,G,a,F)}hg(te,t)})}function pr(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Po(e,t){for(var a=t+"Capture",l=[];e!==null;){var f=e,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=Ra(e,a),f!=null&&l.unshift(pr(e,f,p)),f=Ra(e,t),f!=null&&l.push(pr(e,f,p))),e.tag===3)return l;e=e.return}return[]}function da(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function pg(e,t,a,l,f){for(var p=t._reactName,b=[];a!==null&&a!==l;){var j=a,C=j.alternate,G=j.stateNode;if(j=j.tag,C!==null&&C===l)break;j!==5&&j!==26&&j!==27||G===null||(C=G,f?(G=Ra(a,p),G!=null&&b.unshift(pr(a,G,C))):f||(G=Ra(a,p),G!=null&&b.push(pr(a,G,C)))),a=a.return}b.length!==0&&e.push({event:t,listeners:b})}var iw=/\r\n?/g,aw=/\u0000|\uFFFD/g;function gg(e){return(typeof e=="string"?e:""+e).replace(iw,`
|
|
10
|
-
`).replace(aw,"")}function xg(e,t){return t=gg(t),gg(e)===t}function Fo(){}function ot(e,t,a,l,f,p){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&qi(e,""+l);break;case"className":no(e,"class",l);break;case"tabIndex":no(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":no(e,a,l);break;case"style":bh(e,l,p);break;case"data":if(t!=="object"){no(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ao(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(t!=="input"&&ot(e,t,"name",f.name,f,null),ot(e,t,"formEncType",f.formEncType,f,null),ot(e,t,"formMethod",f.formMethod,f,null),ot(e,t,"formTarget",f.formTarget,f,null)):(ot(e,t,"encType",f.encType,f,null),ot(e,t,"method",f.method,f,null),ot(e,t,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ao(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Fo);break;case"onScroll":l!=null&&Ke("scroll",e);break;case"onScrollEnd":l!=null&&Ke("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=ao(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Ke("beforetoggle",e),Ke("toggle",e),to(e,"popover",l);break;case"xlinkActuate":Kn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Kn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Kn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Kn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Kn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Kn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Kn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":to(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=O1.get(a)||a,to(e,a,l))}}function Vu(e,t,a,l,f,p){switch(a){case"style":bh(e,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&Ke("scroll",e);break;case"onScrollEnd":l!=null&&Ke("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Fo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lh.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),t=a.slice(2,f?a.length-7:void 0),p=e[Wt]||null,p=p!=null?p[a]:null,typeof p=="function"&&e.removeEventListener(t,p,f),typeof l=="function")){typeof p!="function"&&p!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):to(e,a,l)}}}function Bt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",e),Ke("load",e);var l=!1,f=!1,p;for(p in a)if(a.hasOwnProperty(p)){var b=a[p];if(b!=null)switch(p){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:ot(e,t,p,b,a,null)}}f&&ot(e,t,"srcSet",a.srcSet,a,null),l&&ot(e,t,"src",a.src,a,null);return;case"input":Ke("invalid",e);var j=p=b=f=null,C=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var F=a[l];if(F!=null)switch(l){case"name":f=F;break;case"type":b=F;break;case"checked":C=F;break;case"defaultChecked":G=F;break;case"value":p=F;break;case"defaultValue":j=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(r(137,t));break;default:ot(e,t,l,F,a,null)}}ph(e,p,j,C,G,b,f,!1),so(e);return;case"select":Ke("invalid",e),l=b=p=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":p=j;break;case"defaultValue":b=j;break;case"multiple":l=j;default:ot(e,t,f,j,a,null)}t=p,a=b,e.multiple=!!l,t!=null?Di(e,!!l,t,!1):a!=null&&Di(e,!!l,a,!0);return;case"textarea":Ke("invalid",e),p=f=l=null;for(b in a)if(a.hasOwnProperty(b)&&(j=a[b],j!=null))switch(b){case"value":l=j;break;case"defaultValue":f=j;break;case"children":p=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:ot(e,t,b,j,a,null)}xh(e,l,f,p),so(e);return;case"option":for(C in a)a.hasOwnProperty(C)&&(l=a[C],l!=null)&&(C==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":ot(e,t,C,l,a,null));return;case"dialog":Ke("beforetoggle",e),Ke("toggle",e),Ke("cancel",e),Ke("close",e);break;case"iframe":case"object":Ke("load",e);break;case"video":case"audio":for(l=0;l<mr.length;l++)Ke(mr[l],e);break;case"image":Ke("error",e),Ke("load",e);break;case"details":Ke("toggle",e);break;case"embed":case"source":case"link":Ke("error",e),Ke("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(l=a[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:ot(e,t,G,l,a,null)}return;default:if(oc(t)){for(F in a)a.hasOwnProperty(F)&&(l=a[F],l!==void 0&&Vu(e,t,F,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&ot(e,t,j,l,a,null))}function rw(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,b=null,j=null,C=null,G=null,F=null;for(Q in a){var te=a[Q];if(a.hasOwnProperty(Q)&&te!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":C=te;default:l.hasOwnProperty(Q)||ot(e,t,Q,null,l,te)}}for(var K in l){var Q=l[K];if(te=a[K],l.hasOwnProperty(K)&&(Q!=null||te!=null))switch(K){case"type":p=Q;break;case"name":f=Q;break;case"checked":G=Q;break;case"defaultChecked":F=Q;break;case"value":b=Q;break;case"defaultValue":j=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,t));break;default:Q!==te&&ot(e,t,K,Q,l,te)}}ac(e,b,j,C,G,F,p,f);return;case"select":Q=b=j=K=null;for(p in a)if(C=a[p],a.hasOwnProperty(p)&&C!=null)switch(p){case"value":break;case"multiple":Q=C;default:l.hasOwnProperty(p)||ot(e,t,p,null,l,C)}for(f in l)if(p=l[f],C=a[f],l.hasOwnProperty(f)&&(p!=null||C!=null))switch(f){case"value":K=p;break;case"defaultValue":j=p;break;case"multiple":b=p;default:p!==C&&ot(e,t,f,p,l,C)}t=j,a=b,l=Q,K!=null?Di(e,!!a,K,!1):!!l!=!!a&&(t!=null?Di(e,!!a,t,!0):Di(e,!!a,a?[]:"",!1));return;case"textarea":Q=K=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:ot(e,t,j,null,l,f)}for(b in l)if(f=l[b],p=a[b],l.hasOwnProperty(b)&&(f!=null||p!=null))switch(b){case"value":K=f;break;case"defaultValue":Q=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==p&&ot(e,t,b,f,l,p)}gh(e,K,Q);return;case"option":for(var Re in a)K=a[Re],a.hasOwnProperty(Re)&&K!=null&&!l.hasOwnProperty(Re)&&(Re==="selected"?e.selected=!1:ot(e,t,Re,null,l,K));for(C in l)K=l[C],Q=a[C],l.hasOwnProperty(C)&&K!==Q&&(K!=null||Q!=null)&&(C==="selected"?e.selected=K&&typeof K!="function"&&typeof K!="symbol":ot(e,t,C,K,l,Q));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Me in a)K=a[Me],a.hasOwnProperty(Me)&&K!=null&&!l.hasOwnProperty(Me)&&ot(e,t,Me,null,l,K);for(G in l)if(K=l[G],Q=a[G],l.hasOwnProperty(G)&&K!==Q&&(K!=null||Q!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,t));break;default:ot(e,t,G,K,l,Q)}return;default:if(oc(t)){for(var lt in a)K=a[lt],a.hasOwnProperty(lt)&&K!==void 0&&!l.hasOwnProperty(lt)&&Vu(e,t,lt,void 0,l,K);for(F in l)K=l[F],Q=a[F],!l.hasOwnProperty(F)||K===Q||K===void 0&&Q===void 0||Vu(e,t,F,K,l,Q);return}}for(var D in a)K=a[D],a.hasOwnProperty(D)&&K!=null&&!l.hasOwnProperty(D)&&ot(e,t,D,null,l,K);for(te in l)K=l[te],Q=a[te],!l.hasOwnProperty(te)||K===Q||K==null&&Q==null||ot(e,t,te,K,l,Q)}var Ku=null,Xu=null;function Jo(e){return e.nodeType===9?e:e.ownerDocument}function yg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Qu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Zu=null;function ow(){var e=window.event;return e&&e.type==="popstate"?e===Zu?!1:(Zu=e,!0):(Zu=null,!1)}var vg=typeof setTimeout=="function"?setTimeout:void 0,lw=typeof clearTimeout=="function"?clearTimeout:void 0,wg=typeof Promise=="function"?Promise:void 0,cw=typeof queueMicrotask=="function"?queueMicrotask:typeof wg<"u"?function(e){return wg.resolve(null).then(e).catch(uw)}:vg;function uw(e){setTimeout(function(){throw e})}function Cs(e){return e==="head"}function kg(e,t){var a=t,l=0,f=0;do{var p=a.nextSibling;if(e.removeChild(a),p&&p.nodeType===8)if(a=p.data,a==="/$"){if(0<l&&8>l){a=l;var b=e.ownerDocument;if(a&1&&gr(b.documentElement),a&2&&gr(b.body),a&4)for(a=b.head,gr(a),b=a.firstChild;b;){var j=b.nextSibling,C=b.nodeName;b[za]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&b.rel.toLowerCase()==="stylesheet"||a.removeChild(b),b=j}}if(f===0){e.removeChild(p),Sr(t);return}f--}else a==="$"||a==="$?"||a==="$!"?f++:l=a.charCodeAt(0)-48;else l=0;a=p}while(a);Sr(t)}function Wu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Wu(a),tc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function dw(e,t,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[za])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(p=e.getAttribute("rel"),p==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(p!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(p=e.getAttribute("src"),(p!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===p)return e}else return e;if(e=Mn(e.nextSibling),e===null)break}return null}function fw(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Mn(e.nextSibling),e===null))return null;return e}function Pu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function hw(e,t){var a=e.ownerDocument;if(e.data!=="$?"||a.readyState==="complete")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Mn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="F!"||t==="F")break;if(t==="/$")return null}}return e}var Fu=null;function jg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"){if(t===0)return e;t--}else a==="/$"&&t++}e=e.previousSibling}return null}function Sg(e,t,a){switch(t=Jo(a),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function gr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);tc(e)}var Nn=new Map,Ng=new Set;function el(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var rs=W.d;W.d={f:mw,r:pw,D:gw,C:xw,L:yw,m:bw,X:ww,S:vw,M:kw};function mw(){var e=rs.f(),t=Vo();return e||t}function pw(e){var t=_i(e);t!==null&&t.tag===5&&t.type==="form"?Vm(t):rs.r(e)}var fa=typeof document>"u"?null:document;function Tg(e,t,a){var l=fa;if(l&&typeof t=="string"&&t){var f=yn(t);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),Ng.has(f)||(Ng.add(f),e={rel:e,crossOrigin:a,href:t},l.querySelector(f)===null&&(t=l.createElement("link"),Bt(t,"link",e),zt(t),l.head.appendChild(t)))}}function gw(e){rs.D(e),Tg("dns-prefetch",e,null)}function xw(e,t){rs.C(e,t),Tg("preconnect",e,t)}function yw(e,t,a){rs.L(e,t,a);var l=fa;if(l&&e&&t){var f='link[rel="preload"][as="'+yn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+yn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+yn(a.imageSizes)+'"]')):f+='[href="'+yn(e)+'"]';var p=f;switch(t){case"style":p=ha(e);break;case"script":p=ma(e)}Nn.has(p)||(e=x({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Nn.set(p,e),l.querySelector(f)!==null||t==="style"&&l.querySelector(xr(p))||t==="script"&&l.querySelector(yr(p))||(t=l.createElement("link"),Bt(t,"link",e),zt(t),l.head.appendChild(t)))}}function bw(e,t){rs.m(e,t);var a=fa;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",f='link[rel="modulepreload"][as="'+yn(l)+'"][href="'+yn(e)+'"]',p=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=ma(e)}if(!Nn.has(p)&&(e=x({rel:"modulepreload",href:e},t),Nn.set(p,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(yr(p)))return}l=a.createElement("link"),Bt(l,"link",e),zt(l),a.head.appendChild(l)}}}function vw(e,t,a){rs.S(e,t,a);var l=fa;if(l&&e){var f=Ri(l).hoistableStyles,p=ha(e);t=t||"default";var b=f.get(p);if(!b){var j={loading:0,preload:null};if(b=l.querySelector(xr(p)))j.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Nn.get(p))&&Ju(e,a);var C=b=l.createElement("link");zt(C),Bt(C,"link",e),C._p=new Promise(function(G,F){C.onload=G,C.onerror=F}),C.addEventListener("load",function(){j.loading|=1}),C.addEventListener("error",function(){j.loading|=2}),j.loading|=4,tl(b,t,l)}b={type:"stylesheet",instance:b,count:1,state:j},f.set(p,b)}}}function ww(e,t){rs.X(e,t);var a=fa;if(a&&e){var l=Ri(a).hoistableScripts,f=ma(e),p=l.get(f);p||(p=a.querySelector(yr(f)),p||(e=x({src:e,async:!0},t),(t=Nn.get(f))&&ed(e,t),p=a.createElement("script"),zt(p),Bt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function kw(e,t){rs.M(e,t);var a=fa;if(a&&e){var l=Ri(a).hoistableScripts,f=ma(e),p=l.get(f);p||(p=a.querySelector(yr(f)),p||(e=x({src:e,async:!0,type:"module"},t),(t=Nn.get(f))&&ed(e,t),p=a.createElement("script"),zt(p),Bt(p,"link",e),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(f,p))}}function Ag(e,t,a,l){var f=(f=Z.current)?el(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=ha(a.href),a=Ri(f).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ha(a.href);var p=Ri(f).hoistableStyles,b=p.get(e);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(e,b),(p=f.querySelector(xr(e)))&&!p._p&&(b.instance=p,b.state.loading=5),Nn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Nn.set(e,a),p||jw(f,e,a,b.state))),t&&l===null)throw Error(r(528,""));return b}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ma(a),a=Ri(f).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function ha(e){return'href="'+yn(e)+'"'}function xr(e){return'link[rel="stylesheet"]['+e+"]"}function Eg(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function jw(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Bt(t,"link",a),zt(t),e.head.appendChild(t))}function ma(e){return'[src="'+yn(e)+'"]'}function yr(e){return"script[async]"+e}function Cg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+yn(a.href)+'"]');if(l)return t.instance=l,zt(l),l;var f=x({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),zt(l),Bt(l,"style",f),tl(l,a.precedence,e),t.instance=l;case"stylesheet":f=ha(a.href);var p=e.querySelector(xr(f));if(p)return t.state.loading|=4,t.instance=p,zt(p),p;l=Eg(a),(f=Nn.get(f))&&Ju(l,f),p=(e.ownerDocument||e).createElement("link"),zt(p);var b=p;return b._p=new Promise(function(j,C){b.onload=j,b.onerror=C}),Bt(p,"link",l),t.state.loading|=4,tl(p,a.precedence,e),t.instance=p;case"script":return p=ma(a.src),(f=e.querySelector(yr(p)))?(t.instance=f,zt(f),f):(l=a,(f=Nn.get(p))&&(l=x({},a),ed(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),zt(f),Bt(f,"link",l),e.head.appendChild(f),t.instance=f);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,tl(l,a.precedence,e));return t.instance}function tl(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,p=f,b=0;b<l.length;b++){var j=l[b];if(j.dataset.precedence===t)p=j;else if(p!==f)break}p?p.parentNode.insertBefore(e,p.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ed(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var nl=null;function Mg(e,t,a){if(nl===null){var l=new Map,f=nl=new Map;f.set(a,l)}else f=nl,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var p=a[f];if(!(p[za]||p[Ht]||e==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var b=p.getAttribute(t)||"";b=e+b;var j=l.get(b);j?j.push(p):l.set(b,[p])}}return l}function zg(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Sw(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function _g(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}var br=null;function Nw(){}function Tw(e,t,a){if(br===null)throw Error(r(475));var l=br;if(t.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(t.state.loading&4)===0){if(t.instance===null){var f=ha(a.href),p=e.querySelector(xr(f));if(p){e=p._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(l.count++,l=sl.bind(l),e.then(l,l)),t.state.loading|=4,t.instance=p,zt(p);return}p=e.ownerDocument||e,a=Eg(a),(f=Nn.get(f))&&Ju(a,f),p=p.createElement("link"),zt(p);var b=p;b._p=new Promise(function(j,C){b.onload=j,b.onerror=C}),Bt(p,"link",a),t.instance=p}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(t,e),(e=t.state.preload)&&(t.state.loading&3)===0&&(l.count++,t=sl.bind(l),e.addEventListener("load",t),e.addEventListener("error",t))}}function Aw(){if(br===null)throw Error(r(475));var e=br;return e.stylesheets&&e.count===0&&td(e,e.stylesheets),0<e.count?function(t){var a=setTimeout(function(){if(e.stylesheets&&td(e,e.stylesheets),e.unsuspend){var l=e.unsuspend;e.unsuspend=null,l()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(a)}}:null}function sl(){if(this.count--,this.count===0){if(this.stylesheets)td(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var il=null;function td(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,il=new Map,t.forEach(Ew,e),il=null,sl.call(e))}function Ew(e,t){if(!(t.state.loading&4)){var a=il.get(e);if(a)var l=a.get(null);else{a=new Map,il.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var b=f[p];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),l=b)}l&&a.set(null,l)}f=t.instance,b=f.getAttribute("data-precedence"),p=a.get(b)||l,p===l&&a.set(null,f),a.set(b,f),this.count++,l=sl.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),p?p.parentNode.insertBefore(f,p.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),t.state.loading|=4}}var vr={$$typeof:M,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function Cw(e,t,a,l,f,p,b,j){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Te(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Te(0),this.hiddenUpdates=Te(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=j,this.incompleteTransitions=new Map}function Rg(e,t,a,l,f,p,b,j,C,G,F,te){return e=new Cw(e,t,a,b,j,C,G,te),t=1,p===!0&&(t|=24),p=rn(3,null,null,t),e.current=p,p.stateNode=e,t=Dc(),t.refCount++,e.pooledCache=t,t.refCount++,p.memoizedState={element:l,isDehydrated:a,cache:t},$c(p),e}function Lg(e){return e?(e=Vi,e):Vi}function Og(e,t,a,l,f,p){f=Lg(f),l.context===null?l.context=f:l.pendingContext=f,l=gs(t),l.payload={element:a},p=p===void 0?null:p,p!==null&&(l.callback=p),a=xs(e,l,t),a!==null&&(dn(a,e,t),Wa(a,e,t))}function Dg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function nd(e,t){Dg(e,t),(e=e.alternate)&&Dg(e,t)}function qg(e){if(e.tag===13){var t=Yi(e,67108864);t!==null&&dn(t,e,67108864),nd(e,67108864)}}var al=!0;function Mw(e,t,a,l){var f=B.T;B.T=null;var p=W.p;try{W.p=2,sd(e,t,a,l)}finally{W.p=p,B.T=f}}function zw(e,t,a,l){var f=B.T;B.T=null;var p=W.p;try{W.p=8,sd(e,t,a,l)}finally{W.p=p,B.T=f}}function sd(e,t,a,l){if(al){var f=id(l);if(f===null)Yu(e,t,l,rl,a),Ug(e,l);else if(Rw(f,e,t,a,l))l.stopPropagation();else if(Ug(e,l),t&4&&-1<_w.indexOf(e)){for(;f!==null;){var p=_i(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var b=Ln(p.pendingLanes);if(b!==0){var j=p;for(j.pendingLanes|=2,j.entangledLanes|=2;b;){var C=1<<31-xt(b);j.entanglements[1]|=C,b&=~C}$n(p),(et&6)===0&&(Io=je()+500,hr(0))}}break;case 13:j=Yi(p,2),j!==null&&dn(j,p,2),Vo(),nd(p,2)}if(p=id(l),p===null&&Yu(e,t,l,rl,a),p===f)break;f=p}f!==null&&l.stopPropagation()}else Yu(e,t,l,null,a)}}function id(e){return e=cc(e),ad(e)}var rl=null;function ad(e){if(rl=null,e=zi(e),e!==null){var t=u(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=d(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return rl=e,null}function Bg(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ot()){case pn:return 2;case Ce:return 8;case st:case ue:return 32;case Se:return 268435456;default:return 32}default:return 32}}var rd=!1,Ms=null,zs=null,_s=null,wr=new Map,kr=new Map,Rs=[],_w="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ug(e,t){switch(e){case"focusin":case"focusout":Ms=null;break;case"dragenter":case"dragleave":zs=null;break;case"mouseover":case"mouseout":_s=null;break;case"pointerover":case"pointerout":wr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":kr.delete(t.pointerId)}}function jr(e,t,a,l,f,p){return e===null||e.nativeEvent!==p?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:p,targetContainers:[f]},t!==null&&(t=_i(t),t!==null&&qg(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,f!==null&&t.indexOf(f)===-1&&t.push(f),e)}function Rw(e,t,a,l,f){switch(t){case"focusin":return Ms=jr(Ms,e,t,a,l,f),!0;case"dragenter":return zs=jr(zs,e,t,a,l,f),!0;case"mouseover":return _s=jr(_s,e,t,a,l,f),!0;case"pointerover":var p=f.pointerId;return wr.set(p,jr(wr.get(p)||null,e,t,a,l,f)),!0;case"gotpointercapture":return p=f.pointerId,kr.set(p,jr(kr.get(p)||null,e,t,a,l,f)),!0}return!1}function $g(e){var t=zi(e.target);if(t!==null){var a=u(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,sn(e.priority,function(){if(a.tag===13){var l=un();l=at(l);var f=Yi(a,l);f!==null&&dn(f,a,l),nd(a,l)}});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ol(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=id(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);lc=l,a.target.dispatchEvent(l),lc=null}else return t=_i(a),t!==null&&qg(t),e.blockedOn=a,!1;t.shift()}return!0}function Hg(e,t,a){ol(e)&&a.delete(t)}function Lw(){rd=!1,Ms!==null&&ol(Ms)&&(Ms=null),zs!==null&&ol(zs)&&(zs=null),_s!==null&&ol(_s)&&(_s=null),wr.forEach(Hg),kr.forEach(Hg)}function ll(e,t){e.blockedOn===t&&(e.blockedOn=null,rd||(rd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Lw)))}var cl=null;function Gg(e){cl!==e&&(cl=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){cl===e&&(cl=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],f=e[t+2];if(typeof l!="function"){if(ad(l||a)===null)continue;break}var p=_i(a);p!==null&&(e.splice(t,3),t-=3,au(p,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Sr(e){function t(C){return ll(C,e)}Ms!==null&&ll(Ms,e),zs!==null&&ll(zs,e),_s!==null&&ll(_s,e),wr.forEach(t),kr.forEach(t);for(var a=0;a<Rs.length;a++){var l=Rs[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Rs.length&&(a=Rs[0],a.blockedOn===null);)$g(a),a.blockedOn===null&&Rs.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],p=a[l+1],b=f[Wt]||null;if(typeof p=="function")b||Gg(a);else if(b){var j=null;if(p&&p.hasAttribute("formAction")){if(f=p,b=p[Wt]||null)j=b.formAction;else if(ad(f)!==null)continue}else j=b.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),Gg(a)}}}function od(e){this._internalRoot=e}ul.prototype.render=od.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,l=un();Og(a,l,e,t,null,null)},ul.prototype.unmount=od.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Og(e.current,2,null,e,null,null),Vo(),t[Mi]=null}};function ul(e){this._internalRoot=e}ul.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qs();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Rs.length&&t!==0&&t<Rs[a].priority;a++);Rs.splice(a,0,e),a===0&&$g(e)}};var Ig=n.version;if(Ig!=="19.1.0")throw Error(r(527,Ig,"19.1.0"));W.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var Ow={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var dl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!dl.isDisabled&&dl.supportsFiber)try{wt=dl.inject(Ow),it=dl}catch{}}return Tr.createRoot=function(e,t){if(!c(e))throw Error(r(299));var a=!1,l="",f=ap,p=rp,b=op,j=null;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(f=t.onUncaughtError),t.onCaughtError!==void 0&&(p=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(j=t.unstable_transitionCallbacks)),t=Rg(e,1,!1,null,null,a,l,f,p,b,j,null),e[Mi]=t.current,Iu(e),new od(t)},Tr.hydrateRoot=function(e,t,a){if(!c(e))throw Error(r(299));var l=!1,f="",p=ap,b=rp,j=op,C=null,G=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(C=a.unstable_transitionCallbacks),a.formState!==void 0&&(G=a.formState)),t=Rg(e,1,!0,t,a??null,l,f,p,b,j,C,G),t.context=Lg(null),a=t.current,l=un(),l=at(l),f=gs(l),f.callback=null,xs(a,f,l),a=l,t.current.lanes=a,Ze(t,a),$n(t),e[Mi]=t.current,Iu(e),new ul(t)},Tr.version="19.1.0",Tr}var Jg;function Zw(){if(Jg)return ud.exports;Jg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),ud.exports=Qw(),ud.exports}var Ww=Zw();const Pw=1,Gd=16*1024*1024;class vf extends Error{constructor(n){super(n?.message??"ALP daemon request failed"),this.code=n?.code,this.data=n?.data}}const Fw=Object.freeze({failed:1e3,notFound:1001,forbidden:1003,conflict:1004,unavailable:1005,protocol:1006}),Sl=Object.freeze({maxReadBytes:1024*1024,maxListEntries:1e3,maxPathLength:4096}),gi=Object.freeze({maxPerPrincipal:4,maxPerDaemon:16,maxInputBytes:64*1024,maxOutputFrameBytes:64*1024,replayBytes:1024*1024,idleMs:1800*1e3,maxLifetimeMs:480*60*1e3,reconnectMs:60*1e3,minCols:2,maxCols:500,minRows:1,maxRows:200}),ex=s=>typeof s=="string"&&/^term_[0-9a-f]{32}$/.test(s),Jw=new Set([".git",".alp",".ssh",".gnupg",".aws",".azure",".kube",".docker","gcloud"]),ek=new Set([".netrc","_netrc",".npmrc",".yarnrc.yml",".pypirc",".pgpass",".htpasswd",".git-credentials",".dockercfg",".boto",".s3cfg",".mcp.json","auth.json","kubeconfig","settings.local.json",".vault-token","application_default_credentials.json","token.json"]),tk=new Set(["gh/hosts.yml"]),nk=new Set(["credential","credentials","secret","secrets"]),sk=new Set(["ts","tsx","mts","cts","js","jsx","mjs","cjs","py","go","rs","java","kt","kts","rb","php","cs","swift","c","cc","cpp","h","hpp","m","mm","scala","dart","vue","svelte"]),ik=new Set(["pem","key","p12","pfx","p8","jks","keystore","ppk","der","gpg","pgp","asc","kdbx","ovpn","tfstate","tfvars"]),ak=/^(?:\.env|id_|service[-_]?account)|_history$|\.tfstate\.backup$/;function Ai(s){let n="";for(const i of String(s).toLowerCase().split(/[\\/]/)){if(!i)continue;if(tk.has(`${n}/${i}`)||(n=i,Jw.has(i)||ek.has(i)||ak.test(i)))return!0;const r=i.lastIndexOf("."),c=r>=0?i.slice(r+1):"";if(ik.has(c))return!0;const u=i.replace(/^\.+/,"").split(".");if(u.length>1&&u.pop(),u.some(d=>nk.has(d))&&!sk.has(c))return!0}return!1}const qy=Symbol.for("@anhlp/alp-client/AlpClientError");class Fe extends Error{constructor(n,{reason:i,cause:r,data:c}){super(n,r===void 0?void 0:{cause:r}),this.name="AlpClientError",this.reason=i,this.data=c,Object.defineProperty(this,qy,{value:!0})}}function wf(s,n){return typeof s=="object"&&s!==null&&s[qy]===!0&&(n===void 0||s.reason===n)}function Vr(s){let n=0;for(let i=0;i<s.length;i++){const r=s.charCodeAt(i);r<128?n+=1:r<2048?n+=2:r>=55296&&r<=56319&&i+1<s.length&&(s.charCodeAt(i+1)&64512)===56320?(n+=4,i++):n+=3}return n}const rk=2147483647;function Id(s,n="timeoutMs"){if(!(s===void 0||s===1/0)){if(typeof s!="number"||Number.isNaN(s)||s<0)throw new TypeError(`${n} must be a non-negative number of milliseconds`);return s>rk?void 0:s}}const Ar="ALP daemon connection closed",ok=4096,lk=s=>{setTimeout(()=>{throw s},0)};function ck(s){for(const n of["send","onMessage","onClose","close"])if(typeof s?.[n]!="function")throw new TypeError(`ALP transport must implement ${n}()`)}const tx=s=>new Fe("ALP request aborted",{reason:"aborted",cause:s.reason}),Er=(s,n)=>Object.prototype.hasOwnProperty.call(s,n);class uk{#e;#k=0;#m=new Map;#n=new Set;#i=new Set;#h=new Set;#r=new Set;#f=[];#a;#s;#g;#l;#y;constructor(n,{maxPending:i=ok,maxFrame:r=Gd,timeoutMs:c,onListenerError:u=lk}={}){ck(n),this.#e=n,this.#s=i,this.#g=r,Id(c),this.#l=c,this.#y=u,this.#f.push(n.onMessage(d=>this.#u(d))),this.#f.push(n.onClose(d=>this.#j(this.#w(d)))),n.state==="closed"&&this.#j(new Fe(Ar,{reason:"disconnected"}))}get closed(){return this.#a!==void 0}get pendingCount(){return this.#m.size}request(n,i={},{signal:r,timeoutMs:c=this.#l}={}){if(this.#a)return Promise.reject(new Fe(Ar,{reason:this.#a.reason==="closed"?"closed":"disconnected",cause:this.#a}));if(r?.aborted)return Promise.reject(tx(r));if(this.#m.size>=this.#s)return Promise.reject(new Fe(`Too many ALP requests waiting for an answer (${this.#s})`,{reason:"overloaded"}));let u;try{u=Id(c)}catch(m){return Promise.reject(m)}const d=++this.#k;let h;try{h=JSON.stringify({jsonrpc:"2.0",id:d,method:n,params:i})}catch(m){return Promise.reject(m)}return Vr(h)>=this.#g?Promise.reject(new Fe(`ALP request ${n} exceeds the ${this.#g}-byte frame limit`,{reason:"send_failed"})):new Promise((m,g)=>{let x;const y=()=>{this.#m.delete(d)&&(w(),g(tx(r)))},w=()=>{x!==void 0&&clearTimeout(x),r?.removeEventListener("abort",y)};this.#m.set(d,{resolve:m,reject:g,cleanup:w}),u!==void 0&&(x=setTimeout(()=>{this.#m.delete(d)&&(w(),g(new Fe(`ALP request ${n} timed out after ${c} ms`,{reason:"timeout"})))},u)),r?.addEventListener("abort",y,{once:!0});try{this.#e.send(h)}catch(k){this.#e.state==="closed"?this.#j(new Fe(Ar,{reason:"disconnected",cause:k})):this.#m.delete(d)&&(w(),g(new Fe(`Could not send ALP request ${n}: ${k instanceof Error?k.message:String(k)}`,{reason:"send_failed",cause:k})))}})}onEvent(n){return this.#v(this.#n,n)}onNotification(n){return this.#v(this.#i,n)}onRequest(n){return this.#v(this.#r,n)}onClose(n){return this.#v(this.#h,n)}close(){this.#a||this.#j(new Fe(Ar,{reason:"closed"}))}#v(n,i){if(typeof i!="function")throw new TypeError("ALP client listener must be a function");return this.#a?()=>!1:(n.add(i),()=>n.delete(i))}#w(n={}){if(n.error instanceof Fe)return n.error;const i=n.code!==void 0||n.reason?{code:n.code,reason:n.reason}:void 0;return new Fe(n.error?.message??Ar,{reason:"disconnected",cause:n.error,data:i})}#b(n){this.#j(new Fe(n,{reason:"protocol"}))}#p(n,...i){try{n(...i)}catch(r){this.#y(r)}}#u(n){if(this.#a)return;if(typeof n!="string")return this.#b("Invalid frame from ALP daemon");let i;try{i=JSON.parse(n)}catch{return this.#b("Invalid frame from ALP daemon")}if(typeof i!="object"||i===null||Array.isArray(i))return this.#b("Invalid frame from ALP daemon");const r=i.id!==void 0&&i.id!==null;if(i.method==="event"){for(const u of[...this.#n])this.#p(u,i.params);for(const u of[...this.#i])this.#p(u,i.method,i.params);return}if(typeof i.method=="string"&&r&&!Er(i,"result")&&!Er(i,"error"))return this.#N(i.id,i.method,i.params??{});if(typeof i.method=="string"&&!r){for(const u of[...this.#i])this.#p(u,i.method,i.params);return}const c=this.#m.get(i.id);c&&(this.#m.delete(i.id),c.cleanup(),Er(i,"error")&&typeof i.error=="object"&&i.error!==null?c.reject(new vf(i.error)):Er(i,"result")&&!Er(i,"error")?c.resolve(i.result):c.reject(new Fe("Malformed response from ALP daemon",{reason:"protocol",data:{id:i.id}})))}#N(n,i,r){const c=m=>{try{const g=JSON.stringify({jsonrpc:"2.0",id:n,...m});return Vr(g)<this.#g?g:void 0}catch{return}},u=m=>{if(!this.#a){if(m===void 0)return this.#j(new Fe("ALP reply exceeds the frame limit",{reason:"protocol"}));try{this.#e.send(m)}catch(g){this.#j(new Fe("Could not send ALP reply",{reason:"send_failed",cause:g}))}}},d=m=>{const g=m&&typeof m.code=="number"?m.code:1e3,x=m instanceof Error?m.message:String(m),y=x.length>2e3?`${x.slice(0,2e3)}...`:x,w=m&&m.data!==void 0?{data:m.data}:{};return c({error:{code:g,message:y,...w}})??c({error:{code:g,message:y}})??c({error:{code:-32603,message:"The reply could not be sent"}})},[h]=this.#r;if(!h)return u(d(Object.assign(new Error(`Unknown method '${i}'`),{code:-32601})));Promise.resolve().then(async()=>{try{const m=await h(i,r),g=c({result:m===void 0?{}:m});u(g??d(new Error(`The result of ${i} cannot be serialized or exceeds the ${this.#g}-byte frame limit`)))}catch(m){u(d(m))}})}#j(n){if(this.#a)return;this.#a=n;for(const c of this.#f.splice(0))try{c()}catch{}try{this.#e.close()}catch{}const i=[...this.#m.values()];this.#m.clear();for(const c of i)c.cleanup(),c.reject(n);const r=[...this.#h];this.#n.clear(),this.#i.clear(),this.#r.clear(),this.#h.clear();for(const c of r)this.#p(c,n)}}function nx(s,n={name:"alp",version:"0"},i){return s.request("daemon.hello",{protocolVersion:Pw,client:n},i)}function dk(s,{initialMs:n=250,maxMs:i=1e4,factor:r=2,jitter:c=.2}={},u=Math.random){const d=Math.min(i,n*r**Math.max(0,s-1));return Math.max(0,Math.round(d*(1+c*(2*u()-1))))}function fk(s){return!(s instanceof vf&&s.code===Fw.protocol)}function hk(){if(typeof globalThis.AbortController=="function"){const i=new globalThis.AbortController;return{signal:i.signal,abort:r=>i.abort(r)}}const s=new Set,n={aborted:!1,reason:void 0,addEventListener(i,r){s.add(r)},removeEventListener(i,r){s.delete(r)}};return{signal:n,abort(i){if(!n.aborted){n.aborted=!0,n.reason=i;for(const r of[...s])r();s.clear()}}}}function sx({connect:s,onConnect:n,onDisconnect:i,backoff:r={},maxAttempts:c=1/0,stableMs:u=5e3,shouldRetry:d=fk,client:h,random:m=Math.random}){if(typeof s!="function")throw new TypeError("createReconnectingClient needs connect()");let g="connecting",x,y=0,w=!1,k;const T=hk(),S=new Set,E=new Set,q=new Set,L=new Set,M=h?.onListenerError??(A=>{setTimeout(()=>{throw A},0)}),R=(A,...I)=>{try{A(...I)}catch(O){M(O)}},$=(A,I)=>{g=A;for(const O of[...q])if(R(O,A,I),g!==A)return;if(A==="open"&&x)for(const O of[...L])L.delete(O),O.resolve(x);if(A==="stopped")for(const O of[...L])L.delete(O),O.reject(I??new Fe("ALP connection stopped",{reason:"closed"}))},_=A=>{if(g!=="stopped"){if(y>=c||!d(A))return $("stopped",A);$("waiting",A),g==="waiting"&&(k=setTimeout(()=>{k=void 0,V()},dk(y,r,m)))}},V=async()=>{if(g==="stopped")return;y++,$("connecting");const{signal:A}=T;if(g!=="connecting"||A.aborted)return;let I;const O=()=>I?.close();A.addEventListener("abort",O,{once:!0});try{const ie=await s({attempt:y,signal:A});if(A.aborted){try{ie.close()}catch{}return}if(I=new uk(ie,h),I.onEvent(de=>{for(const B of[...S])R(B,de)}),I.onNotification((de,B)=>{for(const W of[...E])R(W,de,B)}),n&&await n(I,{attempt:y,reconnect:w,signal:A}),A.aborted){I.close();return}if(I.closed)throw new Fe("ALP connection closed during onConnect",{reason:"disconnected"})}catch(ie){return I?.close(),A.aborted?void 0:_(ie instanceof Error?ie:new Error(String(ie)))}finally{A.removeEventListener("abort",O)}const ce=I;x=ce;const le=w;w=!0;const pe=Date.now();ce.onClose(ie=>{x===ce&&(x=void 0,Date.now()-pe>=u&&(y=0),R(()=>i?.(ie,{reconnect:le})),_(ie))}),$("open")};return V(),{get state(){return g},get client(){return x},get attempt(){return y},ready({signal:A}={}){return g==="open"&&x?Promise.resolve(x):g==="stopped"?Promise.reject(new Fe("ALP connection stopped",{reason:"closed"})):new Promise((I,O)=>{const ce={resolve:pe=>{A?.removeEventListener("abort",le),I(pe)},reject:pe=>{A?.removeEventListener("abort",le),O(pe)}},le=()=>{L.delete(ce),O(new Fe("Waiting for the ALP connection was aborted",{reason:"aborted",cause:A?.reason}))};if(A?.aborted)return le();L.add(ce),A?.addEventListener("abort",le,{once:!0})})},request(A,I,O){return g!=="open"||!x?Promise.reject(new Fe("ALP daemon connection closed",{reason:g==="stopped"?"closed":"disconnected"})):x.request(A,I,O)},onEvent(A){return S.add(A),()=>S.delete(A)},onNotification(A){return E.add(A),()=>E.delete(A)},onState(A){return q.add(A),()=>q.delete(A)},stop(){if(g==="stopped")return;k!==void 0&&(clearTimeout(k),k=void 0),T.abort(new Fe("ALP connection stopped",{reason:"closed"}));const A=x;x=void 0,$("stopped"),A?.close(),S.clear(),E.clear(),q.clear()}}}const fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function mk(s){let n="",i=0;for(;i+2<s.length;i+=3){const r=s[i]<<16|s[i+1]<<8|s[i+2];n+=fi[r>>18]+fi[r>>12&63]+fi[r>>6&63]+fi[r&63]}if(i<s.length){const r=s[i]<<16|(i+1<s.length?s[i+1]:0)<<8;n+=fi[r>>18]+fi[r>>12&63]+(i+1<s.length?fi[r>>6&63]:"=")+"="}return n}async function By(s){const n=globalThis.crypto?.subtle;if(!n)throw new Error("SHA-256 needs WebCrypto here; pass sha256 yourself");const i=new Uint8Array(await n.digest("SHA-256",s));return Array.from(i,r=>r.toString(16).padStart(2,"0")).join("")}function md(s){const n={begin:i=>s.request("attachment.begin",i),chunk:i=>s.request("attachment.chunk",i),commit:i=>s.request("attachment.commit",i),abort:i=>s.request("attachment.abort",{uploadId:i}),get:i=>s.request("attachment.get",{attachmentId:i}),delete:i=>s.request("attachment.delete",{attachmentId:i}),async upload({sessionId:i,name:r,mimeType:c,data:u,requestId:d,sha256:h,maxChunkBytes:m,onProgress:g}){const x=h??await By(u),y=await n.begin({sessionId:i,name:r,size:u.length,mimeType:c,sha256:x,requestId:d});if(y.state==="committed"&&y.attachmentId)return(await n.get(y.attachmentId)).attachment;const w=Math.max(1,Math.min(y.maxChunkBytes,m??1/0));let k=y.received;for(let T=0;k<u.length;){const S=Math.min(u.length,k+w);try{const{received:E}=await n.chunk({uploadId:y.uploadId,offset:k,data:mk(u.subarray(k,S))});k=E}catch(E){const q=E?.data;if(q?.reason!=="offset_mismatch"||!Number.isSafeInteger(q.received)||++T>3)throw E;k=q.received;continue}g?.(k,u.length)}return(await n.commit({uploadId:y.uploadId,sha256:x})).attachment}};return n}class wa extends Error{constructor(n="The gateway refused this access token. It may be mistyped, revoked, rotated or expired."){super(n),this.name="AuthenticationError"}}class Xe extends Error{constructor(n){super(n),this.name="ConfigurationError"}}class pi extends Error{constructor(n){super(n),this.name="TransientError"}}class Uy extends Error{constructor(n,i){super(n),this.name="CreateOutcomeUnknownError",this.sessionId=i}}const pk=new Set(["attachment_unsupported","attachment_limit","attachment_unavailable","attachment_too_large","attachment_forbidden","attachment_referenced","quota_exceeded","invalid_name","invalid_data","hash_mismatch","upload_incomplete","chunk_conflict","offset_mismatch","request_conflict","persistence_failed","upload_expired"]),gk=s=>s&&typeof s=="object"&&s.data&&typeof s.data.reason=="string"?s.data.reason:void 0,kf=s=>s instanceof vf||!!s&&typeof s=="object"&&typeof s.code=="number"&&!wf(s);function pd(s){const n=kf(s)?s.code:void 0;return n===1001||n===1003||n===-32601||n===-32602}function qe(s){if(s instanceof wa)return{message:s.message,sent:"no",terminal:!0};if(s instanceof Xe)return{message:s.message,sent:"no",terminal:!0};if(s instanceof pi)return{message:s.message,sent:"no",terminal:!1};if(s instanceof Uy)return{message:s.message,sent:"unknown",terminal:!1};if(wf(s))switch(s.reason){case"send_failed":case"overloaded":return{message:"The request could not be sent. Nothing reached the host.",sent:"no",terminal:!1};case"closed":return{message:"Disconnected from the host.",sent:"unknown",terminal:!1};case"timeout":return{message:"The host did not answer in time. The request may still have run.",sent:"unknown",terminal:!1};case"aborted":return{message:"Stopped waiting for the host. The request may still have run.",sent:"unknown",terminal:!1};case"protocol":return{message:"The host sent something this app does not understand.",sent:"unknown",terminal:!1};default:return{message:"The connection dropped before the host answered. The request may still have run.",sent:"unknown",terminal:!1}}if(kf(s)){const n=typeof s.code=="number"?s.code:1e3,i=gk(s),r={code:n,...i?{reason:i}:{},sent:"yes",terminal:!1};if(n===1e3&&(i==="gateway_timeout"||i==="daemon_disconnected"))return{...r,sent:"unknown",message:i==="gateway_timeout"?"The host took too long to answer. The request may still have run.":"The gateway lost the host before it answered. The request may still have run."};if(n===1004&&i==="outcome_unknown")return{...r,sent:"unknown",message:"The host cannot tell whether the agent received this message. Check the conversation before sending it again."};if(i&&pk.has(i)&&s.message)return{...r,message:/[.!?]$/.test(s.message)?s.message:`${s.message}.`};if(n===1005&&i==="not_sent")return{...r,sent:"no",message:"The gateway was too busy to pass the request on. Nothing reached the host."};if(n===1005&&i==="rate_limited")return{...r,sent:"no",message:"Too many requests at once. Wait a moment and try again."};if(n===1005&&i==="too_many_pending")return{...r,sent:"no",message:"Too many requests are waiting. Wait a moment and try again."};if(n===1005&&i==="busy")return{...r,message:"Tasks are locked by another writer on the host. Try again in a moment."};if(n===1003&&i==="grant"){const c=s.data?.permission;return{...r,message:`Your access token does not allow this${c?` (needs ${c})`:""}.`}}return n===1003&&i==="mode"?{...r,message:"Your access token cannot drive a session in this mode. Ask the host owner for a token with that mode, or use a session in a granted mode."}:n===1003&&i==="outside_workspace"?{...r,message:"That workspace is not granted to your access token."}:n===1003&&i==="spec_field"?{...r,message:"The host refused one of the session settings."}:n===1003?{...r,message:"The host refused this request."}:n===1001?{...r,message:"Not found on the host. It may have been removed or expired."}:n===1004&&i==="revision_conflict"?{...r,message:"It changed on the host meanwhile. The latest version is shown; try again if you still want to."}:n===1004&&i==="task_state"?{...r,message:"The task's current state does not allow that."}:n===1004&&i==="key_conflict"?{...r,message:"That request id was already used for something else."}:n===-32601?{...r,message:"The host does not offer this through the gateway."}:n===-32602?{...r,message:"The host refused the request as invalid."}:n===1006?{...r,terminal:!0,message:"This host speaks a different protocol version. Update ALP on the host or this app."}:{...r,message:s.message?`The host could not do that: ${s.message}`:"The host could not do that."}}return{message:s instanceof Error&&s.message?s.message:"Something went wrong.",sent:"unknown",terminal:!1}}const Lr=Object.freeze({blocked_path:"This file is never shown remotely: secrets, keys, .git and ALP configuration are blocked.",ignored:"This file is ignored by .gitignore, so it is hidden by default.",linked:"This path is a link, or it changed while it was read. Links are not followed.",binary:"Binary preview unavailable",too_large:"This file is too large to display",not_found:"This file or folder is not on the host. It may have been moved or removed.",invalid_path:"That is not a valid path in this workspace.",not_directory:"The workspace folder cannot be read on the host."});class xi extends Error{constructor(n){super(n.message),this.name="FileAccessError",this.failure=n,this.reason=n.reason}}function xk(s){if(s instanceof xi)return s.failure;const n=qe(s),i=n.reason;if(!kf(s)||!i)return n;const r=Lr[i];return!r||i==="not_found"&&n.code!==1001?n:{...n,message:r}}const gd=["name","modified","size"],xd=Object.freeze({name:"Name",modified:"Modified",size:"Size"});function ix(s){const n=gd.indexOf(s);return gd[(n+1)%gd.length]}function Hs(s){if(typeof s!="string")return;let n=s;for(;n.startsWith("./");)n=n.slice(2);if(!(!n||n.length>Sl.maxPathLength)&&!(n.startsWith("/")||/^[a-zA-Z]:/.test(n)||/[\\\0]/.test(n))&&!n.split("/").some(i=>!i||i==="."||i===".."))return n}const Yd=s=>{const n=typeof s=="string"?Date.parse(s):NaN;return Number.isFinite(n)?n:0};function yk(s,n){const i=n?`${n}/`:"",r=[],c=new Set;for(const d of Array.isArray(s?.entries)?s.entries:[]){if(!d||typeof d!="object")continue;const{name:h,kind:m}=d;if(typeof h!="string"||!h||h.includes("/")||m!=="file"&&m!=="directory")continue;const g=Hs(d.path);if(!(!g||g!==`${i}${h}`||Ai(g)||c.has(g))&&(c.add(g),r.push({name:h,path:g,kind:m,...m==="file"&&typeof d.size=="number"&&Number.isFinite(d.size)&&d.size>=0?{size:d.size}:{},...typeof d.modifiedAt=="string"&&Yd(d.modifiedAt)?{modifiedAt:d.modifiedAt}:{}}),r.length>=Sl.maxListEntries))break}const u=Array.isArray(s?.entries)&&s.entries.length>Sl.maxListEntries;return{entries:r,truncated:s?.truncated===!0||u}}const bk=s=>s.startsWith(".");function vk(s,n){return[...s].sort((i,r)=>i.kind!==r.kind?i.kind==="directory"?-1:1:n==="modified"?Yd(r.modifiedAt)-Yd(i.modifiedAt)||i.name.localeCompare(r.name):n==="size"&&(r.size??0)-(i.size??0)||i.name.localeCompare(r.name))}function wk(s,n){return s.includes(n)?s.filter(i=>i!==n):[...s,n]}function kk(s,n,{sort:i,showHidden:r}){const c=new Set(n),u=[],d=(h,m)=>{const g=s[h];if(!g||g.status==="loading"){u.push({kind:"status",path:h,depth:m,status:"loading"});return}if(g.status==="error"){u.push({kind:"status",path:h,depth:m,status:"error",...g.error?{message:g.error}:{}});return}const x=vk((g.entries??[]).filter(y=>r||!bk(y.name)),i);x.length||u.push({kind:"status",path:h,depth:m,status:"empty"});for(const y of x){const w=y.kind==="directory"&&c.has(y.path);u.push({kind:"entry",entry:y,depth:m,open:w}),w&&d(y.path,m+1)}g.truncated&&u.push({kind:"status",path:h,depth:m,status:"truncated"})};return d("",0),u}function jk(s){return typeof s!="number"||!Number.isFinite(s)||s<0?"":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Sk(s){if(!s)return 0;const n=s.split(`
|
|
11
|
-
`).length;return s.endsWith(`
|
|
12
|
-
`)?n-1:n}const Nk=s=>/\.(md|markdown|mdx)$/i.test(s),Tk=0,qr=1,ax=Object.freeze({unsupportedData:4003,tooLarge:4009}),Ak=250,Ek=123;function Vd(s){const n=/^([a-z][a-z0-9+.-]*:\/\/)(?:[^/?#\\]*@)?([^/?#\\@]*)([^?#]*)/i.exec(String(s));return n?`${n[1]}${n[2]}${n[3]}`:"<websocket>"}function rx(s,n){const r=((s instanceof Error?s.message:String(s??"")).split(String(n)).join(Vd(n))||"WebSocket error").replace(/[a-z][a-z0-9+.-]*:\/\/[^\s'"<>]+/gi,u=>Vd(u)),c=new Error(r);return s instanceof Error&&s.name&&(c.name=s.name),c}function Ck(s){let n=s;for(;Vr(n)>Ek;)n=n.slice(0,-1);return n}function xl(s,n,i){if(!(s.readyState!==Tk&&s.readyState!==qr)){try{n===void 0?s.close():s.close(n,Ck(i??""));return}catch{}try{s.close()}catch{}}}function $y(s){typeof s.addEventListener=="function"&&s.addEventListener("error",()=>{})}function ka(s,n,i){if(typeof s.addEventListener=="function")return s.addEventListener(n,i),()=>s.removeEventListener?.(n,i);const r=`on${n}`,c=s[r];return s[r]=u=>{c?.(u),i(u)},()=>{s[r]=c??null}}const Hy=s=>{const n=s?.error instanceof Error&&s.error.message||typeof s?.message=="string"&&s.message||"WebSocket error";return s?.error instanceof Error&&s.error.message?s.error:new Error(n)};function Mk(s,{maxFrame:n=Gd,maxBufferedBytes:i=4*Gd}={}){if(s.readyState!==qr)throw new Fe("WebSocket is not open",{reason:"disconnected"});$y(s);try{s.binaryType="arraybuffer"}catch{}const r=new Set,c=new Set;let u;const d=[];let h,m;const g=y=>{if(u)return;u=y,m!==void 0&&clearTimeout(m);for(const k of d.splice(0))k();r.clear();const w=[...c];c.clear();for(const k of w)k(y)},x=(y,w)=>{const k=new Fe(y,{reason:"protocol"});xl(s,w,y),g({error:k})};return d.push(ka(s,"message",y=>{if(u)return;const w=y?.data;if(typeof w!="string")return x("Binary WebSocket messages are not ALP frames",ax.unsupportedData);if(Vr(w)>n)return x(`ALP frame exceeds ${n} bytes`,ax.tooLarge);for(const k of w.includes(`
|
|
13
|
-
`)?w.split(`
|
|
14
|
-
`):[w]){if(u)return;if(k.trim())for(const T of[...r])T(k)}})),d.push(ka(s,"close",y=>g({error:h,code:typeof y?.code=="number"?y.code:void 0,reason:typeof y?.reason=="string"&&y.reason?y.reason:void 0}))),d.push(ka(s,"error",y=>{h||(h=Hy(y),m=setTimeout(()=>g({error:h}),Ak),xl(s))})),{get state(){return u||s.readyState!==qr?"closed":"open"},send(y){if(u||s.readyState!==qr)throw new Fe("WebSocket is not open",{reason:"send_failed"});if((s.bufferedAmount??0)+Vr(y)>i)throw new Fe(`WebSocket send buffer is over ${i} bytes`,{reason:"send_failed"});s.send(y)},onMessage(y){return u?()=>!1:(r.add(y),()=>r.delete(y))},onClose(y){return u?()=>!1:(c.add(y),()=>c.delete(y))},close(){xl(s,1e3,"client closed"),g({code:1e3,reason:"client closed"})}}}function zk(s,{WebSocket:n,protocols:i,createSocket:r,signal:c,timeoutMs:u=15e3,...d}={}){const h=Vd(s);let m;try{m=Id(u)}catch(y){return Promise.reject(y)}if(c?.aborted)return Promise.reject(new Fe(`Connecting to ${h} was aborted`,{reason:"aborted",cause:c.reason}));const g=n??globalThis.WebSocket;if(!r&&typeof g!="function")return Promise.reject(new TypeError("No WebSocket implementation: pass options.WebSocket or options.createSocket"));let x;try{x=r?r(s,i):i===void 0?new g(s):new g(s,i)}catch(y){return Promise.reject(new Fe(`Could not connect to ${h}`,{reason:"disconnected",cause:rx(y,s)}))}return $y(x),new Promise((y,w)=>{const k=[];let T;const S=()=>{for(const M of k.splice(0))M();T!==void 0&&clearTimeout(T),c?.removeEventListener("abort",q)},E=M=>{S(),xl(x),w(M)},q=()=>E(new Fe(`Connecting to ${h} was aborted`,{reason:"aborted",cause:c?.reason})),L=()=>{S();try{y(Mk(x,d))}catch(M){w(M)}};if(x.readyState===qr)return L();k.push(ka(x,"open",L)),k.push(ka(x,"error",M=>E(new Fe(`Could not connect to ${h}`,{reason:"disconnected",cause:rx(Hy(M),s)})))),k.push(ka(x,"close",M=>E(new Fe(`Could not connect to ${h}`,{reason:"disconnected",data:{code:M?.code,reason:M?.reason||void 0}})))),c?.addEventListener("abort",q,{once:!0}),m!==void 0&&(T=setTimeout(()=>E(new Fe(`Connecting to ${h} timed out after ${u} ms`,{reason:"timeout"})),m))})}const _k=new Set(["localhost","127.0.0.1"]);function Gy(s){let n;try{n=new URL(String(s).trim())}catch{throw new Xe("Enter the gateway address, such as https://alp.example.com or http://127.0.0.1:7434.")}if(n.username||n.password||n.search||n.hash)throw new Xe("Use a gateway address without a user name, password, query or fragment.");if(n.protocol!=="https:"&&!(n.protocol==="http:"&&_k.has(n.hostname)))throw new Xe("Use https, or http only on this machine (127.0.0.1 or localhost, for example through an SSH tunnel).");return`${n.origin}${n.pathname.replace(/\/+$/,"")}`}const fl=s=>Array.isArray(s)&&s.every(n=>typeof n=="string");function Rk(s){if(!s||typeof s!="object")return;const{websocket:n,subprotocols:i,principal:r}=s;if(n!=="/v1/ws"||!fl(i)||!i.includes("alp.v1")||!r||typeof r.id!="string"||!fl(r.permissions)||!fl(r.workspaces)||r.modes!==void 0&&!fl(r.modes))return;const c={id:r.id,...typeof r.label=="string"?{label:r.label}:{},permissions:[...r.permissions],workspaces:[...r.workspaces],...Array.isArray(r.workspaceRoots)?{workspaceRoots:r.workspaceRoots.filter(u=>u&&typeof u.path=="string"&&typeof u.canonical=="string").map(u=>({path:u.path,canonical:u.canonical}))}:{},...r.modes?{modes:[...r.modes]}:{}};return{websocket:n,subprotocols:i,principal:c}}async function Lk(s){try{const n=await s.json();return typeof n?.error=="string"?n.error:void 0}catch{return}}function Ok(s,n){const i=new AbortController,r=setTimeout(()=>i.abort(new pi("The gateway did not answer in time.")),n),c=()=>i.abort(s?.reason);return s?.aborted?c():s?.addEventListener("abort",c,{once:!0}),{signal:i.signal,done(){clearTimeout(r),s?.removeEventListener("abort",c)}}}async function Dk({url:s,token:n,signal:i,timeoutMs:r=15e3,fetch:c=globalThis.fetch.bind(globalThis),WebSocket:u}){const d=Gy(s);if(!n||/\s/.test(n))throw new wa("Enter the access token printed by alp-gateway credential create.");const h=Ok(i,r);let m;try{m=await c(`${d}/v1/tickets`,{method:"POST",credentials:"omit",cache:"no-store",redirect:"error",referrerPolicy:"no-referrer",headers:{authorization:`Bearer ${n}`},signal:h.signal})}catch(g){throw h.done(),i?.aborted?i.reason??g:h.signal.reason instanceof pi?h.signal.reason:new pi("Cannot reach the gateway. Check that it is running at this address and that it allows this page's origin (alp-gateway serve --origin).")}try{if(m.status===401)throw new wa;if(m.status===403){const w=await Lk(m);throw new Xe(w==="tls_required"?"The gateway only accepts this connection over HTTPS.":"The gateway does not allow this page's origin. Start it with --origin set to this page's address.")}if(m.status===421)throw new Xe("The gateway does not know this host name. Add it with alp-gateway serve --public-host.");if(m.status===429)throw new pi("The gateway is limiting requests from this address. Wait a moment.");if(m.status!==201)throw new pi(`The gateway is not ready (HTTP ${m.status}).`);const g=Rk(await m.json().catch(()=>{}));if(!g)throw new Xe("The gateway answered with an unexpected ticket. Check that the address points to an ALP gateway.");const x=`${d.replace(/^http/,"ws")}${g.websocket}`;return{transport:await zk(x,{protocols:g.subprotocols,signal:h.signal,timeoutMs:r,...u?{WebSocket:u}:{}}).catch(w=>{throw i?.aborted?i.reason??w:new pi("The gateway accepted the token but the live connection failed. Retrying may help.")}),principal:g.principal}}finally{h.done()}}function yl(s,n){return!s||!n?void 0:(s.workspaceRoots?.length?s.workspaceRoots:s.workspaces.map(r=>({path:r,canonical:r}))).find(r=>r.path===n||r.canonical===n)}function ze(s,n){return s?s.permissions.includes(n)?!0:n.endsWith(".read")&&s.permissions.includes(n.replace(/\.read$/,".write")):!1}const jf="alp-web:link-token",qk=/^alpgw1\.[a-f0-9]{16}\.[A-Za-z0-9_-]{43}$/,Bk="This link's access token is no longer valid. Run `alp web` again to open ALP with a new link.",Uk="This page is not on this machine's loopback address, so it did not use the access token in its link. Open the address `alp web` printed.",$k="The access token in this link is incomplete or damaged. Run `alp web` again, or copy its whole address.",Hk=new Set(["127.0.0.1","localhost"]),Iy=s=>typeof s=="string"&&qk.test(s);function Gk(s){const n=String(s??"").replace(/^#/,"");if(!n)return;const i=new URLSearchParams(n);if(!i.has("token"))return;const r=i.get("token");return Iy(r)?{token:r}:{malformed:!0}}const Yy=s=>s.protocol==="http:"&&Hk.has(s.hostname);function Ik(s){let n;try{n=s?.getItem(jf)}catch{return}if(n!=null){if(Iy(n))return n;bl(s)}}function bl(s){try{s?.removeItem(jf)}catch{}}function Vy({location:s,history:n,storage:i}){const r=Gk(s.hash);r&&n.replaceState(n.state,"",`${s.pathname}${s.search}`);const c=Yy(s);if(r&&"malformed"in r)return{error:$k};if(r&&!c)return{error:Uk};if(r){try{i?.setItem(jf,r.token)}catch{}return{url:s.origin,token:r.token}}if(!c)return;const u=Ik(i);return u?{url:s.origin,token:u}:void 0}const Yk="http://127.0.0.1:7434",Ky=({location:s,dev:n=!1})=>!n&&Yy(s);function Vk({location:s,remembered:n,dev:i=!1}){return n||(Ky({location:s,dev:i})?s.origin:Yk)}function Bl(s=16){const n=new Uint8Array(Math.ceil(s/2));return globalThis.crypto.getRandomValues(n),Array.from(n,i=>i.toString(16).padStart(2,"0")).join("").slice(0,s)}const Kk=()=>`web_${Bl(16)}`,yd=()=>`web-msg-${Bl(20)}`,Xk=()=>`web-task-${Bl(16)}`,Sf=()=>`web-conv-${Bl(16)}`,Qk="Files in the workspace are not changed or restored: only the conversation goes back.",Zk="Files are not copied: the fork works on the current files of where it runs.",Kd={runtime_unsupported:"This session runs on a runtime that cannot fork or rewind its conversation.",not_persistent:"This session keeps no native conversation to fork or rewind.",not_root:"Only a main conversation can be forked or rewound; an agent's work belongs to its requester."},bd=Object.freeze({session_busy:"The session or one of its agents is still working. Wait until everything is idle, then try again.",stale_generation:"The conversation changed since this view loaded. It was reloaded; check it and try again.",turn_not_found:"That message is no longer part of this conversation. It was reloaded; try again.",turn_in_progress:"A turn is still running. Wait until it ends, then try again.",empty_prefix:"Nothing comes before the first message. Start a new session instead.",boundary_unmapped:"The agent's runtime cannot go back to exactly this point (that turn was not started by ALP). Choose another message.",runtime_unsupported:Kd.runtime_unsupported,native_refused:"The agent's runtime refused it. Nothing changed.",outcome_unknown:"The host cannot tell whether it happened. Check the session list and this conversation before trying again; a new attempt is a new request.",key_conflict:"That request id was already used for something else. Try again.",branch_not_found:"That branch is no longer kept on the host.",not_root:Kd.not_root,outside_workspace:"That workspace is not granted to your access token.",attachment_forbidden:"This conversation holds an attachment your access token may not use.",request_conflict:"A session with that id already exists.",persistence_failed:"The host could not finish saving it. Trying again finishes it."}),Wk=s=>typeof s?.data?.reason=="string"?s.data.reason:void 0;function Aa(s){const n=s,i=Wk(n),r=typeof n?.code=="number"?n.code:void 0,c=qe(s),u=c.sent!=="yes"&&i!=="outcome_unknown",d=i==="stale_generation"||i==="turn_not_found";if(i==="persistence_failed")return{message:bd.persistence_failed,reason:i,code:r,retrySame:!0,reload:!1};if(r===1003&&i==="grant")return{message:`Your access token cannot do this (it needs ${typeof n?.data?.permission=="string"?n.data.permission:"session.write"}).`,reason:i,code:r,retrySame:!1,reload:!1};if(i&&bd[i])return{message:bd[i],reason:i,code:r,retrySame:!1,reload:d};if(u){const h=c.sent==="no"?" Trying again is safe.":" It may have happened: trying again sends the same request, which the host answers only once.";return{message:`${c.message}${c.terminal?"":h}`,...i?{reason:i}:{},code:r,retrySame:!c.terminal,reload:!1}}return r===-32601?{message:"This host does not offer it. Update ALP on the host.",code:r,retrySame:!1,reload:!1}:{message:s instanceof Error&&s.message?s.message:"Something went wrong.",...i?{reason:i}:{},code:r,retrySame:!1,reload:d}}function Pk({capabilities:s,canRead:n,canWrite:i,summary:r,busy:c=!1,generation:u,online:d=!0,driveBlock:h}){const m=r?.conversation,g=(k=void 0)=>({shown:!1,...k?{reason:k}:{}}),x=m?.reason?Kd[m.reason]??`Not available here (${m.reason}).`:void 0,y=s.includes("session.history")&&!!u,w=k=>s.includes(`session.${k}`)?!m||m[k]!==!0?g(x):!i||k==="fork"&&!n?g("Your access token cannot change this conversation (it needs session.write)."):h?g(h):y?d?k==="rewind"&&c?{shown:!0,reason:"Wait until main and its agents are idle."}:{shown:!0}:{shown:!0,reason:"Reconnecting…"}:g("This host does not keep a history generation for this view."):g();return{fork:w("fork"),rewind:w("rewind")}}const Fk="Restart the agent's process on the same conversation and settings, for example after a new sign-in. Its messages, history and files stay.",Br=Object.freeze({session_busy:"The agent or one of its agents is still working. Wait until everything is idle, then reload.",session_closed:"The session is closed. Send it a message to open it again on its conversation.",no_history:"The agent has no conversation to keep yet. Send it a message first, or start a new session.",native_refused:"The agent could not be restarted on its conversation. The session was closed with its conversation kept; send it a message to open it again.",runtime_unsupported:"This session runs on a runtime the host cannot reload.",not_root:"Only the main agent of a session can be reloaded."});function Jk(s){const n=Aa(s),i=n.reason?Br[n.reason]:void 0;return i?{...n,message:i}:n}function e2({capabilities:s,canRead:n,canWrite:i,summary:r,root:c,closed:u=!1,busy:d=!1,generation:h,online:m=!0,driveBlock:g}){const x=k=>({shown:!0,enabled:!1,reason:k}),y=s.includes("session.resumeCommand")?n?m?{shown:!0,enabled:!0}:x("Reconnecting…"):x("Your access token cannot read this session."):{shown:!1,enabled:!1};return{reload:(()=>{if(!s.includes("session.reload"))return{shown:!1,enabled:!1};if(!c)return x(Br.not_root);const k=r?.conversation;return k?.reload!==!0?x(k?.reason==="not_persistent"?"This session keeps no native conversation to reload.":Br.runtime_unsupported):i?g?x(g):u?x(Br.session_closed):!s.includes("session.history")||!h?x("The conversation is still loading."):m?d?x("Wait until main and its agents are idle."):{shown:!0,enabled:!0}:x("Reconnecting…"):x("Your access token cannot reload agents (it needs session.write).")})(),resume:y}}function t2(s,n={}){const i=new Map,r=s.turnOrder??[];for(const c of s.entries){if(c.sessionId!==s.rootId)continue;const u=c.item;if(u.kind!=="user_message"||typeof u.clientMessageId!="string")continue;const d=s.prompts[u.clientMessageId];if(!d||d.state!=="accepted"||d.result!=="turn"||!d.turnId)continue;const h=r.indexOf(d.turnId);h<0||i.set(c.key,{turnId:d.turnId,index:h,later:r.length-h,rewindable:h>0||!!n.hasOlder,ended:s.turns[d.turnId]==="ended",text:typeof u.text=="string"?u.text:""})}return i}function Nf(s){return s?.kind!=="notice"||typeof s.id!="string"?null:s.id.startsWith("rewind:")&&s.id.length>7?{kind:"rewind",branchId:s.id.slice(7)}:s.id.startsWith("fork:")&&s.id.length>5?{kind:"fork",sessionId:s.id.slice(5)}:null}const n2=s=>`${s} later turn${s===1?"":"s"}`,s2=s=>`${s} turn${s===1?"":"s"}`;function i2(s,n,i){const r=n?.find(u=>u.branchId===i)?.turns;if(typeof r=="number")return r;const c=/(\d+) later turn/.exec(String(s?.text??""));return c?Number(c[1]):void 0}const Nl=Object.freeze({capability:"This host does not offer Git changes. Update ALP on the host.",registry:"This host does not list its workspaces, so Git changes cannot be shown. Update ALP on the host.",projectRead:"This access token cannot read Git status (needs project.read).",filesRead:"This access token cannot read file contents, so diffs are hidden (needs files.read).",workspace:"Choose a workspace to see its changes.",unregistered:"This workspace is not registered on the host, so its Git changes cannot be shown. The host owner can add it as a project.",loading:"Loading workspaces…"}),Tl=Object.freeze({not_repository:"Not a git repository",unknown_ref:"The base branch is not known in this repository.",invalid_compare:"The host refused this comparison. Pick Uncommitted or a branch name Git accepts.",stale_snapshot:"The checkout changed since this list was loaded. It was loaded again from the start.",invalid_cursor:"The rest of this list is no longer available. It was loaded again from the start.",git_unavailable:"Git is not available on the host.",git_failed:"Git failed on the host. Try again; the host's logs may say why.",blocked_path:"This file is never shown remotely: secrets, keys, .git and ALP configuration are blocked.",invalid_path:"That is not a valid path in this workspace."}),Xy=Object.freeze([{id:"uncommitted",label:"Uncommitted"},{id:"base",label:"Committed"},{id:"staged",label:"Staged"},{id:"unstaged",label:"Unstaged"}]),ox=Object.freeze({modified:"Modified",added:"New",deleted:"Deleted",renamed:"Renamed",copied:"Copied",typechange:"Type changed",untracked:"Untracked",conflicted:"Conflicted"}),a2=Object.freeze({modified:"M",added:"A",deleted:"D",renamed:"R",copied:"C",typechange:"T",untracked:"U",conflicted:"!"}),Qy=Object.freeze({binary:"Binary file",too_large:"Diff too large to display",withheld:"Content withheld: it looks like it holds a private key.",symlink:"Symbolic link: its target is not shown.",submodule:"Submodule: its content is not shown."});class us extends Error{constructor(n){super(n.message),this.name="GitAccessError",this.failure=n,this.reason=n.reason}}function vi(s){if(s instanceof us)return s.failure;const n=qe(s);if(n.code===1003&&n.reason==="grant"){const r=s?.data?.permission;return r==="files.read"?{...n,message:Nl.filesRead}:r==="project.read"?{...n,message:Nl.projectRead}:n}const i=n.reason?Tl[n.reason]:void 0;return i?{...n,message:i}:n}function r2(s){const n=vi(s);return n.code===1004&&n.reason==="stale_snapshot"||n.code===-32602&&n.reason==="invalid_cursor"}function Tf(s){const n=s.workspace;if(!n)return;const i=yl(s.principal??void 0,n),r=new Set([n,...i?[i.path,i.canonical]:[]]);return s.registry.workspaces.filter(c=>r.has(c.directory)&&!c.archivedAt).sort((c,u)=>+!!u.pinnedAt-+!!c.pinnedAt||String(c.createdAt).localeCompare(String(u.createdAt))||c.id.localeCompare(u.id))[0]}function vd(s){const n=c=>({status:!1,reason:c,message:Nl[c]});if(!s.workspace)return n("workspace");if(!s.connection.capabilities.includes("workspace.git"))return n("capability");if(!ze(s.principal??void 0,"project.read"))return n("projectRead");if(!s.connection.capabilities.includes("workspace.registry"))return n("registry");const i=Tf(s);if(!i)return n(s.registry.loading?"loading":"unregistered");const r=ze(s.principal??void 0,"files.read");return{status:!0,workspaceId:i.id,content:r,...r?{}:{contentMessage:Nl.filesRead}}}function o2(s){const n=typeof s=="string"&&s?Hs(s):void 0;return n&&!Ai(n)?n:void 0}function l2({mode:s,baseRef:n,ignoreWhitespace:i}){const r=Xy.some(c=>c.id===s)?s:"uncommitted";return{mode:r,...r==="base"&&n?{baseRef:n}:{},...i?{ignoreWhitespace:!0}:{}}}function lx(s,n){const i=Array.isArray(n?.files)?n.files:[],r=Number.isSafeInteger(n?.hiddenCount)&&n.hiddenCount>0?n.hiddenCount:0,c=s&&s.snapshot===n.snapshot?s:void 0;return{compare:n.compare,snapshot:n.snapshot,files:c?[...c.files,...i]:[...i],hiddenCount:(c?.hiddenCount??0)+r,truncated:n.truncated===!0,...typeof n.nextCursor=="string"&&n.nextCursor?{nextCursor:n.nextCursor}:{}}}function c2(s){const n=[];for(const i of Array.isArray(s?.hunks)?s.hunks:[]){n.push({type:"hunk",text:`@@ -${i.oldStart},${i.oldCount} +${i.newStart},${i.newCount} @@${i.context?` ${i.context}`:""}`});let r=i.oldStart,c=i.newStart;for(const u of Array.isArray(i.lines)?i.lines:[]){const d=u.noNewline===!0?{noNewline:!0}:{};u.type==="add"?n.push({type:"add",text:u.content,newLine:c++,...d}):u.type==="remove"?n.push({type:"remove",text:u.content,oldLine:r++,...d}):n.push({type:"context",text:u.content,oldLine:r++,newLine:c++,...d})}}return n}function u2(s){let n=0,i=0;for(const r of s)n+=r.additions||0,i+=r.deletions||0;return{additions:n,deletions:i}}function cx(s){if(!Number.isFinite(s)||s<1e3)return String(Math.max(0,Math.floor(s||0)));const n=s/1e3;return`${n>=10?Math.round(n):Math.round(n*10)/10}k`}function ux(s){const i=[s.branch??(s.detached&&s.head?`Detached at ${s.head.slice(0,7)}`:s.head?s.head.slice(0,7):"No commits yet")];if(s.upstream){const{ref:r,ahead:c,behind:u}=s.upstream;i.push(`${r}${c||u?` (${[c?`↑${c}`:"",u?`↓${u}`:""].filter(Boolean).join(" ")})`:""}`)}return i.join(" · ")}function d2(s){return s?s.replace(/^refs\/(heads|remotes)\//,"").trim():"base"}const Zy=Object.freeze(["image/png","image/jpeg","image/gif","image/webp"]),yi=Object.freeze({maxCount:4,maxBytes:2*1024*1024,maxTotalBytes:2.5*1024*1024});function f2(s,n=!0){const i={maxCount:0,maxBytes:0,maxTotalBytes:0};if(!n)return i;if(s===void 0)return{...yi};if(!s||typeof s!="object"||Array.isArray(s))return i;const r=s;if(!["maxCount","maxBytes","maxTotalBytes"].every(u=>Number.isSafeInteger(r[u])&&r[u]>=0))return i;const c=Math.min(yi.maxTotalBytes,r.maxTotalBytes);return{maxCount:Math.min(yi.maxCount,r.maxCount),maxBytes:Math.min(yi.maxBytes,c,r.maxBytes),maxTotalBytes:c}}const wi=s=>s>=1024*1024?`${(s/1024/1024).toFixed(1).replace(/\.0$/,"")} MB`:`${Math.max(1,Math.round(s/1024))} KB`;function Wy(s){const n=String(s?.type??"").split(";",1)[0].trim().toLowerCase(),i=n==="image/jpg"?"image/jpeg":n;return Zy.includes(i)?i:null}function dx(s){if(!s)return[];const n=Array.from(s.files??[]);return n.length?n:Array.from(s.items??[]).filter(i=>i?.kind==="file").map(i=>i.getAsFile?.()).filter(i=>!!i)}function h2(s){let n="";for(let i=0;i<s.length;i+=32768)n+=String.fromCharCode(...s.subarray(i,i+32768));return btoa(n)}let m2=0;function Py(s,n,i,r,c=yi){const u=s.reduce((d,h)=>d+h.size,0);return i?!c.maxCount||!c.maxBytes||!c.maxTotalBytes?"This connection takes no images.":s.length>=c.maxCount?`A message carries at most ${c.maxCount} images.`:r>c.maxBytes?`${n} is ${wi(r)}; an image is at most ${wi(c.maxBytes)}.`:u+r>c.maxTotalBytes?`The images of a message are at most ${wi(c.maxTotalBytes)} together.`:null:`${n} is not a PNG, JPEG, GIF or WebP image.`}async function p2(s,n,i=yi){const r=[];let c=null;for(const u of Array.from(n)){const d=String(u.name||"image"),h=Wy(u),m=Py([...s,...r],d,h,u.size,i);if(m||!h){c??=m;continue}const g=h2(new Uint8Array(await u.arrayBuffer()));r.push({id:`image-${++m2}`,type:"image",mimeType:h,data:g,name:d,size:u.size})}return{added:r,error:c}}function Ur(s,n,i=yi){const r=[...s];let c=null;for(const u of n){const d=Py(r,u.name,u.mimeType,u.size,i);if(d){c??=d;continue}r.push(u)}return{attachments:r,error:c}}function g2(s,n=[]){return[...s.trim()||!n.length?[{type:"text",text:s}]:[],...n.map(i=>({type:"image",mimeType:i.mimeType,data:i.data,...i.name?{name:i.name.slice(0,255)}:{}}))]}const Fy=s=>`data:${s.mimeType};base64,${s.data}`,Bs=Object.freeze({maxObjectBytes:0,maxPerPrompt:0,maxPromptBytes:0,maxChunkBytes:0}),fx=["maxObjectBytes","maxPerPrompt","maxPromptBytes","maxChunkBytes"];function x2(s,n){if(!n||!s||typeof s!="object"||Array.isArray(s))return{...Bs};const i=s;if(!fx.every(h=>Number.isSafeInteger(i[h])&&i[h]>=0))return{...Bs};const[r,c,u,d]=fx.map(h=>i[h]);return!c||!u||!d?{...Bs}:{maxObjectBytes:Math.min(r,u),maxPerPrompt:c,maxPromptBytes:u,maxChunkBytes:d}}const Jy=s=>s<1024?`${s} B`:wi(s),eb=s=>!!s&&s.maxPerPrompt>0&&s.maxPromptBytes>0&&s.maxChunkBytes>0;function y2({capable:s,permitted:n,writable:i,limits:r,session:c,known:u=!0}){if(!s)return"The host behind this gateway does not store files.";if(!i)return"Your access token cannot send messages.";if(!n)return"Your access token cannot upload files (it needs attachments.write).";if(!eb(r))return"This connection takes no files.";if(!u)return null;const d=c?.promptAttachments;if(!Array.isArray(d)||!d.length){const h=typeof c?.agent=="string"?c.agent:"This agent",m=typeof c?.runtime=="string"?c.runtime:"a runtime";return`${h} runs on ${m} here, which cannot read attached files.`}return null}function b2(s){const n=String(s??"").normalize("NFC").replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}/\\]/gu,"").trim();let i="",r=0;for(const c of n){const u=new TextEncoder().encode(c).length;if(r+u>255)break;i+=c,r+=u}return i.trim()||"file"}const v2=/^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/;function w2(s){const n=String(s?.type??"").split(";",1)[0].trim().toLowerCase();return v2.test(n)?n:"application/octet-stream"}function tb(s,n,i,r){const c=s.reduce((u,d)=>u+d.size,0);return eb(r)?s.length>=r.maxPerPrompt?`A message carries at most ${r.maxPerPrompt} files.`:i>r.maxObjectBytes?`${n} is ${wi(i)}; a file is at most ${wi(r.maxObjectBytes)}.`:c+i>r.maxPromptBytes?`The files of a message are at most ${wi(r.maxPromptBytes)} together.`:null:"This connection takes no files."}let k2=0;async function j2(s,n,i){const r=[];let c=null;for(const u of Array.from(n)){const d=b2(u.name),h=tb([...s,...r],d,u.size,i);if(h){c??=h;continue}let m;try{m=new Uint8Array(await u.arrayBuffer())}catch{c??=`Could not read ${d}.`;continue}r.push({id:`file-${++k2}`,type:"file",name:d,mimeType:w2(u),size:m.length,data:m})}return{added:r,error:c}}function vl(s,n,i){const r=[...s];let c=null;for(const u of n){const d=tb(r,u.name,u.size,i);if(d){c??=d;continue}r.push(u)}return{attachments:r,error:c}}const hx=(s,n,i=0)=>`${s}:file-${n}${i?`.${i}`:""}`;async function S2(s,{sessionId:n,file:i,requestId:r,digest:c}){try{const u=await s.begin({sessionId:n,name:i.name,size:i.data.length,mimeType:i.mimeType,sha256:await c(i.data),requestId:r});return u?.state!=="uploading"||typeof u.uploadId!="string"?!1:(await s.abort(u.uploadId),!0)}catch{return!1}}function N2(s,n=[],i=[]){const r=g2(s,n);if(!i.length)return r;if(i.some(c=>typeof c.attachmentId!="string"))throw new Error("A file of this message is not uploaded yet.");return[...s.trim()?[{type:"text",text:s}]:[],...n.map(c=>({type:"image",mimeType:c.mimeType,data:c.data,...c.name?{name:c.name.slice(0,255)}:{}})),...i.map(c=>({type:"attachment",attachmentId:c.attachmentId}))]}function T2(s){return Array.isArray(s)?s.filter(n=>n&&typeof n=="object"&&typeof n.attachmentId=="string"&&typeof n.name=="string"&&Number.isSafeInteger(n.size)&&n.size>=0).map(n=>({attachmentId:n.attachmentId,name:n.name,size:n.size})):[]}function ds(s){return{rootId:s,cursor:0,entries:[],positions:{},sessions:{},order:[],running:{},closed:{},questions:{},prompts:{},turns:{},turnOrder:[],historyUnavailable:!1,reset:0}}function wd(s,n){const i=s.positions[n.key];if(i!==void 0){const r=s.entries.slice();return r[i]=n,{...s,entries:r}}return{...s,entries:[...s.entries,n],positions:{...s.positions,[n.key]:s.entries.length}}}const ya=(s,n)=>{if(!(n in s))return s;const i={...s};return delete i[n],i};function mx(s,n){if(typeof n!="string"||!n)return s;const i=s.turnOrder??[];return i.includes(n)?s:{...s,turnOrder:[...i,n]}}function bi(s,n){if(!n||typeof n!="object"||!n.event||typeof n.sessionId!="string")return s;const i=typeof n.cursor=="number";if(i&&n.cursor<=s.cursor)return s;let r=i?{...s,cursor:n.cursor}:s;const c=n.sessionId,u=typeof n.ts=="string"?n.ts:"",d=n.event;d.type==="item"&&!r.sessions[c]&&(r={...r,sessions:{...r.sessions,[c]:{id:c}},order:r.order.includes(c)?r.order:[...r.order,c]});const h=()=>`${c}:${d.type}:${n.cursor??`${n.epoch}:${n.seq}`}`;switch(d.type){case"session.opened":case"session.updated":{const m=d.session&&typeof d.session=="object"?d.session:{},g=r.sessions[c];return r={...r,sessions:{...r.sessions,[c]:{...g,...m,id:c,...d.type==="session.opened"?{status:m.busy?"running":"idle"}:{}}},order:r.order.includes(c)?r.order:[...r.order,c]},d.type==="session.opened"&&(r={...r,closed:ya(r.closed,c)}),r}case"session.closed":{const m=r.sessions[c];return{...r,closed:{...r.closed,[c]:!0},running:ya(r.running,c),questions:Object.fromEntries(Object.entries(r.questions).filter(([,g])=>g.sessionId!==c)),sessions:m?{...r.sessions,[c]:{...m,status:"closed",busy:!1}}:r.sessions}}case"session.failed":return wd(r,{key:h(),sessionId:c,ts:u,item:{kind:"session_event",id:h(),level:"error",text:d.error?.message?`The session failed: ${d.error.message}`:"The session failed."}});case"prompt.accepted":{if(typeof d.clientMessageId!="string")return r;const m=d.result==="turn"||d.result==="steer"?d.result:void 0;return r={...r,prompts:{...r.prompts,[d.clientMessageId]:{state:"accepted",...typeof d.turnId=="string"?{turnId:d.turnId}:{},...m?{result:m}:{}}}},m==="turn"&&c===r.rootId?mx(r,d.turnId):r}case"prompt.failed":return typeof d.clientMessageId=="string"?{...r,prompts:{...r.prompts,[d.clientMessageId]:{state:"failed",...d.error?.code?{errorCode:d.error.code}:{},...d.error?.message?{error:d.error.message}:{}}}}:r;case"turn.started":{c===r.rootId&&(r=mx(r,d.turnId));const m=r.sessions[c],g=r.turns[d.turnId]==="ended"?r.turns:{...r.turns,[String(d.turnId)]:"running"};return{...r,turns:g,running:{...r.running,[c]:String(d.turnId)},...m?{sessions:{...r.sessions,[c]:{...m,status:"running",busy:!0}}}:{}}}case"turn.ended":{const m=r.sessions[c];return r={...r,running:ya(r.running,c),turns:{...r.turns,[String(d.turnId)]:"ended"},...m&&m.status!=="closed"?{sessions:{...r.sessions,[c]:{...m,status:"idle"}}}:{}},(d.state==="failed"||d.state==="canceled")&&(r=wd(r,{key:h(),sessionId:c,ts:u,item:{kind:"turn_end",id:h(),state:d.state,...d.error?.message?{error:d.error.message}:{}}})),r}case"item":{const m=d.item;return!m||typeof m!="object"||typeof m.id!="string"||typeof m.kind!="string"||!["user_message","assistant_message","notice","tool_call","todo","compaction"].includes(m.kind)?r:wd(r,{key:`${c}:${m.id}`,sessionId:c,ts:u,item:m})}case"usage":{const m=r.sessions[c];return!d.usage||typeof d.usage!="object"||Array.isArray(d.usage)?r:{...r,sessions:{...r.sessions,[c]:{...m,id:c,usage:d.usage}}}}case"question":{const m=d.question;return!m||typeof m.id!="string"?r:{...r,questions:{...r.questions,[m.id]:m}}}case"question.resolved":return typeof d.questionId=="string"?{...r,questions:ya(r.questions,d.questionId)}:r;default:return r}}function px(s,n,i){let r=n.reset?{...ds(s.rootId),reset:s.reset+1}:{...s,questions:{}};const c=i.filter(g=>typeof g?.cursor=="number").sort((g,x)=>g.cursor-x.cursor),u=i.filter(g=>typeof g?.cursor!="number"),d=r.cursor;for(const g of c)r=bi(r,g);for(const g of u)r=bi(r,g);const h=n.session,m=r.rootId;if(h&&(h.id===void 0||h.id===m)){const g=r.sessions[m];r={...r,sessions:{...r.sessions,[m]:{...g,...h,id:m}},order:r.order.includes(m)?r.order:[m,...r.order]},h.status==="closed"?r={...r,closed:{...r.closed,[m]:!0},running:ya(r.running,m)}:h.status==="idle"&&!h.busy&&(r={...r,running:ya(r.running,m)})}return n.reset&&(r={...r,historyUnavailable:r.cursor===d}),r}function nb(s){return(s.order.includes(s.rootId)?s.order:[s.rootId,...s.order]).map(i=>({id:i,session:s.sessions[i],running:i in s.running,closed:!!s.closed[i]}))}function A2(s,n){return s.entries.filter(i=>i.sessionId===n)}function gx(s,n){const i=s.prompts[n];if(!i)return!1;if(i.state==="failed")return i.errorCode!=="outcome_unknown";const r=Object.values(s.running);if(!i.turnId)return r.length===0;const c=s.turns[i.turnId];return c==="ended"||c==="running"&&!r.includes(i.turnId)}function xx(s){const n=new Set;for(const i of s.entries)i.item.kind==="user_message"&&typeof i.item.clientMessageId=="string"&&n.add(i.item.clientMessageId);return n}function Xd(s,n){return s.oversized?{sessionId:n,epoch:"history",seq:s.cursor,cursor:s.cursor,ts:"",event:{type:"item",item:{kind:"notice",id:`oversized:${s.cursor}`,level:"warning",text:`History event ${s.cursor} is too large to display (${s.oversized.bytes} bytes).`}}}:s}function E2(s,n){let i=ds(s.rootId);for(const d of n)i=bi(i,Xd(d,s.rootId));const r=i.entries.slice(),c={...i.positions};for(const d of s.entries){const h=c[d.key];h!==void 0?r[h]=d:(c[d.key]=r.length,r.push(d))}const u={...i.sessions};for(const[d,h]of Object.entries(s.sessions))u[d]={...u[d],...h};return{...s,entries:r,positions:c,sessions:u,order:[...new Set([...i.order,...s.order])],prompts:{...i.prompts,...s.prompts},turns:{...i.turns,...s.turns},turnOrder:[...new Set([...i.turnOrder,...s.turnOrder??[]])]}}const C2={codex:"Codex",claude:"Claude",acp:"ACP",antigravity:"Antigravity"},M2={"read-only":"Read only","workspace-write":"Workspace write","full-access":"Full access"},sb=s=>s==="custom"?"Custom":s,nn=s=>typeof s=="string"&&s.trim()?s:void 0;function yx(s){if(!Array.isArray(s))return[];const n=new Map;for(const i of s){const r=nn(i?.id);if(!r||n.has(r))continue;const c=Array.isArray(i.efforts)?[...new Set(i.efforts.filter(d=>!!nn(d)))]:[],u=nn(i.effort);n.set(r,{id:r,label:nn(i.label)??r,efforts:c,...u&&c.includes(u)?{effort:u}:{}})}return[...n.values()]}function Ds(s){if(s.replace(/[\s_-]+/g,"").toLowerCase()==="xhigh")return"Extra high";const i=s.replace(/[_-]+/g," ").replace(/\s+/g," ").trim();return i?i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():s}function ib(s,n,i){if(n)return s.find(c=>c.id===n);if(!i?.model)return;const r=i.runtime?`${i.runtime}:${i.model}`:i.model;return s.find(c=>c.id===r)??s.find(c=>c.id===i.model)}function ab(s){return(s?.efforts??[]).map(n=>({id:n,label:Ds(n)}))}function z2(s,n){return n&&s?.efforts.includes(n)?n:void 0}function bx(s,n){const i=n.team&&s.teams.some(d=>d.id===n.team)?n.team:void 0,r=n.mode&&s.modes.some(d=>d.id===n.mode)?n.mode:s.defaultMode??s.modes[0]?.id,c=n.model?s.models.find(d=>d.id===n.model):void 0,u=n.thinkingByModel?.[c?.id??"default"];return{...i?{team:i}:{},...r?{mode:r}:{},...c?{model:c.id}:{},...u&&(!c||c.efforts.includes(u))?{thinking:u}:{}}}function vx(s,n,{persist:i=!1}={}){return{cwd:s,...i?{persist:!0}:{},...n.team?{workflow:n.team}:{},...n.mode?{mode:n.mode}:{},...n.model?{model:n.model}:{},...n.thinking?{thinking:n.thinking}:{}}}function _2(s){const n=s?.preview;if(!n||typeof n!="object")return;const i=nn(n.team),r=nn(n.agent);return!i||!r?void 0:{teams:Array.isArray(n.teams)?n.teams.filter(u=>nn(u?.id)).map(u=>({id:u.id,label:nn(u.label)??u.id,...nn(u.description)?{description:u.description}:{}})):[],team:i,agent:r,...nn(n.teamLabel)?{teamLabel:n.teamLabel}:{},runtime:nn(n.runtime)??"",model:nn(n.model)??"",mode:nn(n.mode)??"",thinking:nn(n.thinking)??""}}function R2(s,n=[]){const i=ib(n,void 0,s),r=[{key:"team",label:"Team",value:s.teamLabel??s.teams.find(c=>c.id===s.team)?.label??sb(s.team)},{key:"agent",label:"Agent",value:s.agent}];return s.runtime&&r.push({key:"runtime",label:"Runtime",value:C2[s.runtime]??s.runtime}),s.model&&r.push({key:"model",label:"Model",value:i?.label??s.model}),s.thinking&&r.push({key:"thinking",label:"Thinking",value:Ds(s.thinking)}),s.mode&&r.push({key:"mode",label:"Permissions",value:M2[s.mode]??s.mode}),r}function rb(s){return JSON.stringify([typeof s?.workflow=="string"?s.workflow:"",typeof s?.model=="string"?s.model:""])}function wx(s,n){if(!(!n||s.some(i=>i.id===n.team)))return{id:n.team,label:n.teamLabel??sb(n.team)}}function L2(s,n){return n&&!s.some(i=>i.id===n.id)?[n,...s]:s}function O2({chosen:s,previewTeam:n,previewSettled:i,previewError:r,previewBlocked:c,previewNeedsRead:u,teams:d,teamsKnown:h,teamsUnavailable:m}){return s?{team:s}:n?{team:n}:i?d.length?{team:d[0].id}:h?{}:{wait:D2({previewError:r,previewBlocked:c,previewNeedsRead:u,teamsUnavailable:m}),stuck:!0}:{wait:"Checking what would run…"}}function D2({previewError:s,previewBlocked:n,previewNeedsRead:i,teamsUnavailable:r}){const c=r?.reason==="capability"?"this host does not list teams (no team capability)":r?.reason==="permission"?"your access token cannot list teams (it lacks project.read)":r?.reason==="failed"?`the team list failed${r.message?` (${kd(r.message)})`:""}`:"the team list is not available",u=n?`the preview is not available${s?` (${kd(s)})`:""}`:`the preview failed${s?` (${kd(s)})`:""}`,d=[];(r?.reason==="failed"||!n)&&d.push("use Retry in the preview to ask again");const h=[];r?.reason==="permission"&&h.push("project.read"),n&&i&&h.push("session.read"),h.length&&d.push(`reconnect with a token that has ${h.join(" or ")}`),d.length||d.push("connect to a host that lists teams or previews sessions");const m=d.join(", or ");return`Cannot tell which team would run: ${c}, and ${u}. To start, ${m}.`}function kd(s){return String(s).trim().replace(/[.。]+$/,"")}function q2(s,n,i){return String(n??"").trim()?`${s} Your first message was not sent; it is back in the New session box${i?` of ${i}`:""}.`:s}async function B2(s,n,i,{mounted:r,describe:c,nameOf:u}){const d=s.startOrigin();try{return await s.createSession(n)}catch(h){throw r()||(i.trim()&&s.keepUnsentDraft(i,d),s.notify("error",q2(c(h).message,i,d.workspace?u(d.workspace):void 0))),h}}const ob="session.configure.live",ba=Object.freeze({session_busy:"The session or one of its agents is working. Wait until everything is idle, then try again.",session_closed:"The session is closed. Send it a message to open it, then change its configuration.",not_root:"Only the main agent of a session can be changed; an agent keeps the team and model it started with.",not_persistent:"This session is not kept, so it cannot continue its conversation with a new configuration.",runtime_unsupported:"The host cannot change this session's model or team while it runs. Start a new session instead.",runtime_mismatch:"A session keeps its runtime. To use another runtime's model, start a new session with it.",agent_mismatch:"That team runs another main agent. Start a new session with that team.",permission_escalation:"The change would give the session more permissions or new commands than it has. Start a new session for it.",team_not_found:"The host defines no such team for this project.",invalid_params:"The host does not offer this model or thinking for this session.",native_refused:"The agent's runtime did not take the new configuration. The session keeps its own.",stale_generation:"The conversation changed since this view loaded. It was reloaded; try again.",key_conflict:"That request id was already used for something else. Try again.",outcome_unknown:"The host cannot tell whether the change happened. Check the session before trying again.",persistence_failed:"The host could not store the change. Check the session before trying again.",turn_in_progress:"A turn of this conversation has not ended. Try again when it has."}),lb=new Set(["runtime_mismatch","agent_mismatch","permission_escalation","runtime_unsupported"]);function kx(s){const n=Aa(s),r=s?.data?.action==="session.create",c=n.reason?ba[n.reason]:void 0,u=n.reason==="grant"?n.message:c??n.message;return{...n,message:u,newSession:r||!!n.reason&&lb.has(n.reason)}}const U2=s=>/^([a-z]+)[:/]/.exec(s)?.[1];function $2(s,n){const i=n.runtime,r=i?s.filter(u=>U2(u.id)===i):[],c=n.model?r.find(u=>u.id===`${i}:${n.model}`)??r.find(u=>u.id===n.model):void 0;return{same:r,current:c,others:s.length-r.length}}function H2({capabilities:s,canWrite:n,canTeam:i,summary:r,closed:c=!1,busy:u=!1,configuring:d=!1,generation:h,online:m=!0,driveBlock:g}){const x=E=>({enabled:!1,reason:E});if(!s.includes(ob)){const E="Set when the session started: this host cannot change it on a running session.";return{shown:!1,reason:E,model:x(E),thinking:x(E),team:x(E)}}const y=r?.conversation,k=(()=>{if(y?.configure!==!0)return y?.reason==="not_persistent"?ba.not_persistent:y?.reason==="not_root"?ba.not_root:ba.runtime_unsupported;if(!n)return"Your access token cannot change this session (it needs session.write).";if(g)return g;if(c)return ba.session_closed;if(!s.includes("session.history")||!h)return"The conversation is still loading.";if(!m)return"Reconnecting…";if(d)return"Applying the last change…";if(u)return"Wait until main and its agents are idle."})(),T=k?x(k):{enabled:!0},S=k?x(k):i?{enabled:!0}:x("Your access token cannot change the team (it needs session.team.write).");return{shown:!0,model:T,thinking:T,team:S}}function G2(s,n){if(!n)return s;const i=s?.workflow&&typeof s.workflow=="object"?s.workflow:{};return{...s,model:n.model,thinking:n.thinking,mode:n.mode,runtime:n.runtime,workflow:{...i,mode:n.team,supervisor:n.supervisor,...typeof n.maxPeers=="number"?{maxPeers:n.maxPeers}:{}},teamLabel:n.teamLabel??s?.teamLabel??(n.team==="custom"?void 0:n.team)}}function I2(s,n,i){const r=s.effective,u=`${r.teamLabel??r.team} · main runs ${i??r.model}${r.thinking?` · ${n(r.thinking)}`:""}`;return s.status==="unchanged"?`Nothing to change: ${u}.`:`Changed: ${u}.${s.restarted?" The agent restarted on the same conversation.":""}`}const Af="alp-web:preferences",Qd=1,Y2=["steer","queue"],V2=["system","light","dark"],Cr=Object.freeze({sendBehavior:"steer",theme:"system",newSession:Object.freeze({})}),K2=200,X2=64,Zd=s=>!!s&&typeof s=="object"&&!Array.isArray(s),jd=s=>typeof s=="string"&&s.trim()&&s.length<=K2?s:void 0;function cb(s){if(!Zd(s))return{};const n=s,i={};for(const r of["team","mode","model"]){const c=jd(n[r]);c&&(i[r]=c)}if(Zd(n.thinkingByModel)){const r={};for(const[c,u]of Object.entries(n.thinkingByModel).slice(0,X2)){const d=jd(u);jd(c)&&d&&(r[c]=d)}Object.keys(r).length&&(i.thinkingByModel=r)}return i}function ki(s){if(typeof s!="string"||!s)return{...Cr,newSession:{}};let n;try{n=JSON.parse(s)}catch{return{...Cr,newSession:{}}}return!Zd(n)||n.v!==Qd?{...Cr,newSession:{}}:{sendBehavior:Y2.includes(n.sendBehavior)?n.sendBehavior:Cr.sendBehavior,theme:V2.includes(n.theme)?n.theme:Cr.theme,newSession:cb(n.newSession)}}function Q2(s){const n=ki(JSON.stringify({...s,v:Qd}));return JSON.stringify({v:Qd,sendBehavior:n.sendBehavior,theme:n.theme,newSession:n.newSession})}function jx(s){if(!s)return ki(null);try{return ki(s.getItem(Af))}catch{return ki(null)}}function Z2(s,n){if(!s)return!1;try{return s.setItem(Af,Q2(n)),!0}catch{return!1}}function W2(s,n){const i={...s.thinkingByModel??{}},r=n.model||"default";return n.thinking?i[r]=n.thinking:delete i[r],cb({team:n.team,mode:n.mode,model:n.model,thinkingByModel:i})}const Ef=Object.freeze({capability:"The host has not allowed remote terminals (its owner runs: alp terminal allow --yes)",permission:"Your access token cannot open terminals (it needs terminal.exec)",workspace:"Open a workspace to use a terminal.",registry:"This host does not list its workspaces, so it cannot open a terminal here. Update ALP on the host.",loading:"Loading the host's workspaces…",unregistered:"This workspace is not in the host's workspace list, so a terminal cannot open here.",offline:"Not connected to the host."}),y5="This shell runs on the daemon host as the account that runs alpd. The workspace is not a sandbox: the shell can read and write anything that account can, and use the network.",b5="Runs on the daemon host as the account that runs alpd · the workspace is not a sandbox",Sx={terminal_disabled:Ef.capability,terminal_unsupported:"Terminals are not available on the daemon host (Windows, or its PTY module did not load).",terminal_limit:"Too many terminals are open on the host. Close one and try again.",input_too_large:"That input was too large for the terminal."},P2={closed:"closed",idle:"ended after being idle",lifetime:"reached its maximum lifetime",detached:"nobody reattached in time",revoked:"access was revoked",disabled:"the host turned terminals off",shutdown:"the host stopped"};function v5(s){const n=[];return Number.isSafeInteger(s.exitCode)&&n.push(`code ${s.exitCode}`),Number.isSafeInteger(s.signal)&&s.signal&&n.push(`signal ${s.signal}`),s.reason&&s.reason!=="exited"&&n.push(P2[s.reason]??s.reason),n.length?`Process exited (${n.join(" / ")})`:"Process exited"}const Nx=(s,n)=>{const i=n-s+1;return`\r
|
|
15
|
-
\x1B[2m[output lost: ${i} output ${i===1?"event":"events"} (#${s}${i>1?`–${n}`:""}) are no longer kept by the host]\x1B[0m\r
|
|
16
|
-
`};function Wd(s){const n=s&&typeof s=="object"?s:{},i=r=>{const c=n[r];return Number.isSafeInteger(c)&&c>=1?Math.min(c,gi[r]):gi[r]};return{maxPerPrincipal:i("maxPerPrincipal"),maxPerDaemon:i("maxPerDaemon"),maxInputBytes:i("maxInputBytes"),maxOutputFrameBytes:i("maxOutputFrameBytes"),replayBytes:i("replayBytes"),idleMs:i("idleMs"),maxLifetimeMs:i("maxLifetimeMs"),reconnectMs:i("reconnectMs")}}function F2(s){const n=[];if(!s.workspace)n.push("workspace");else if(s.connection.phase!=="open"&&!s.connection.capabilities.length)n.push("offline");else if(s.connection.capabilities.includes("terminal")||n.push("capability"),ze(s.principal??void 0,"terminal.exec")||n.push("permission"),!n.length)if(!s.connection.capabilities.includes("workspace.registry"))n.push("registry");else{const i=Tf(s);if(i)return{ok:!0,workspaceId:i.id};n.push(s.registry.loading?"loading":"unregistered")}return{ok:!1,reasons:n,messages:n.map(i=>Ef[i])}}function J2(s,n){let i=0,r=0;for(;r<s.length;){const c=s.codePointAt(r)??0,u=c<128?1:c<2048?2:c<65536?3:4;if(i+u>n)break;i+=u,r+=c>65535?2:1}return[s.slice(0,r),s.slice(r)]}function Tx(s,n){const i=(r,c,u)=>Math.min(u,Math.max(c,Number.isFinite(r)?Math.floor(r):c));return{cols:i(s,gi.minCols,gi.maxCols),rows:i(n,gi.minRows,gi.maxRows)}}class ej{#e={status:"idle"};#k=new Set;#m=new Set;#n=[];#i=0;#h=0;#r=null;#f=0;#a=null;#s="";#g=!1;#l;#y;#v={cols:80,rows:24};#w=null;#b=!0;#p;constructor(n){this.#p={limits:Wd(void 0),inputDelayMs:5,resizeDelayMs:120,maxHistoryChars:gi.replayBytes,newRequestId:()=>globalThis.crypto.randomUUID(),...n}}get workspaceId(){return this.#p.workspaceId}getState(){return this.#e}get lastSeq(){return this.#h}subscribe(n){return this.#k.add(n),()=>{this.#k.delete(n)}}onOutput(n){return this.#m.add(n),()=>{this.#m.delete(n)}}history(){return this.#n.join("")}get accepting(){return this.#e.status==="running"}#u(n){this.#e={...this.#e,...n};for(const i of[...this.#k])i()}#N(n){if(n){for(this.#n.push(n),this.#i+=n.length;this.#i>this.#p.maxHistoryChars&&this.#n.length>1;)this.#i-=this.#n.shift().length;for(const i of[...this.#m])i(n)}}#j(){const{storage:n,storageKey:i}=this.#p;try{const r=n&&i?n.getItem(i):null;return ex(r)?r:void 0}catch{return}}#T(n){const{storage:i,storageKey:r}=this.#p;if(!(!i||!r))try{n?i.setItem(r,n):i.removeItem(r)}catch{}}start(n,i){if(this.#e.status!=="idle")return;n!==void 0&&i!==void 0&&(this.#v=Tx(n,i));const r=this.#j();r?(this.#u({terminalId:r}),this.#S(0,!0)):this.#M()}restart(){const{status:n,terminalId:i}=this.#e;["exited","gone","failed","closed"].includes(n)&&(i&&n==="exited"&&this.#p.request("terminal.close",{terminalId:i}).catch(()=>{}),this.#T(void 0),this.#Y(),this.#N("\x1Bc"),this.#n=[],this.#i=0,this.#e={status:"idle"},this.#M())}#Y(){this.#f+=1,this.#h=0,this.#r=null,this.#s="",this.#w=null,this.#a=null}async#M(){const n=++this.#f;this.#a??=this.#p.newRequestId(),this.#u({status:"starting",error:void 0});let i;try{i=await this.#p.request("terminal.create",{workspaceId:this.#p.workspaceId,cols:this.#v.cols,rows:this.#v.rows,requestId:this.#a})}catch(c){if(n!==this.#f)return;if(qe(c).sent!=="yes"){this.#u({status:"reconnecting"}),this.#b&&this.#B();return}this.#a=null,this.#u({status:"failed",error:Sd(c)});return}if(n!==this.#f)return;const r=i?.terminal?.terminalId;if(!ex(r)){this.#a=null,this.#u({status:"failed",error:"The host sent something this app does not understand."});return}this.#a=null,this.#w={cols:i.terminal.cols,rows:i.terminal.rows},this.#T(r),this.#u({terminalId:r}),await this.#S(0,!1)}#B(){setTimeout(()=>{this.#b&&this.#e.status==="reconnecting"&&this.connected()},1e3)}async#S(n,i){const r=this.#e.terminalId,c=++this.#f;this.#r=[],this.#u({status:"attaching",error:void 0});let u;try{u=await this.#p.request("terminal.attach",{terminalId:r,...n>0?{after:n}:{}})}catch(g){if(c!==this.#f)return;this.#r=null;const x=qe(g);if(x.sent!=="yes"){this.#u({status:"reconnecting"}),this.#b&&this.#B();return}if(x.code===1001){if(this.#T(void 0),i&&!this.#h){this.#u({terminalId:void 0}),this.#M();return}this.#u({status:"gone",error:"This terminal has ended and the host no longer keeps it."});return}this.#u({status:"failed",error:Sd(g)});return}if(c!==this.#f)return;const d=this.#r??[];this.#r=null;const h=u?.gap;h&&Number.isSafeInteger(h.fromSeq)&&Number.isSafeInteger(h.toSeq)&&h.toSeq>=h.fromSeq&&h.toSeq>this.#h&&(this.#N(Nx(Math.max(h.fromSeq,this.#h+1),h.toSeq)),this.#h=h.toSeq);const m=u?.terminal;m&&Number.isSafeInteger(m.cols)&&(this.#w??={cols:m.cols,rows:m.rows}),this.#u({status:"running"});for(const g of d)this.#o(g);this.#e.status==="running"&&m?.state==="exited"&&this.#u({status:"exited",exit:{exitCode:m.exitCode??null,signal:m.signal??null,reason:m.endReason??"exited"}}),this.#e.status==="running"&&this.#O(0)}event(n){if(!(!n||n.terminalId!==this.#e.terminalId)){if(this.#r){this.#r.push(n);return}this.#o(n)}}#o(n){if(n.type==="detached"){if(n.reason==="slow_consumer"){this.#b?this.#S(this.#h,!1):this.#u({status:"reconnecting"});return}this.#f+=1,this.#s="",this.#u({status:"replaced"});return}!Number.isSafeInteger(n.seq)||n.seq<=this.#h||(n.seq>this.#h+1&&this.#N(Nx(this.#h+1,n.seq-1)),this.#h=n.seq,n.type==="output"&&typeof n.data=="string"?this.#N(n.data):n.type==="exit"&&(this.#s="",this.#u({status:"exited",exit:{exitCode:n.exitCode??null,signal:n.signal??null,reason:typeof n.reason=="string"?n.reason:"exited"}})))}input(n){return!this.accepting||typeof n!="string"||!n?!1:(this.#s+=n,!this.#g&&this.#l===void 0&&(this.#l=setTimeout(()=>{this.#l=void 0,this.#L()},this.#p.inputDelayMs)),!0)}async#L(){if(this.#g||!this.#s||!this.accepting)return;const[n,i]=J2(this.#s,this.#p.limits.maxInputBytes);if(!n){this.#s="";return}this.#s=i,this.#g=!0;const r=this.#e.terminalId;try{await this.#p.request("terminal.input",{terminalId:r,data:n})}catch(c){const u=qe(c);if(this.#s="",u.reason!=="terminal_exited"&&u.reason!=="not_attached"){const d=u.sent==="yes"?`Input was not delivered: ${Sd(c)}`:"The last input may not have reached the shell (the connection dropped). It is not sent again.";this.#u({lost:d}),this.#N(`\r
|
|
17
|
-
\x1B[2m[${d}]\x1B[0m\r
|
|
18
|
-
`)}}finally{this.#g=!1}this.#s&&this.#L()}resize(n,i){this.#v=Tx(n,i),this.#O(this.#p.resizeDelayMs)}#O(n){this.#y!==void 0&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=void 0,this.#U()},n)}async#U(){if(!this.accepting)return;const n=this.#v;if(!(this.#w&&this.#w.cols===n.cols&&this.#w.rows===n.rows))try{const i=await this.#p.request("terminal.resize",{terminalId:this.#e.terminalId,cols:n.cols,rows:n.rows});this.#w={cols:Number(i?.cols??n.cols),rows:Number(i?.rows??n.rows)}}catch{this.#w=null}}reattach(){this.#e.status!=="replaced"||!this.#e.terminalId||this.#S(this.#h,!1)}connected(){this.#b=!0;const{status:n,terminalId:i}=this.#e;n!=="reconnecting"&&n!=="attaching"&&n!=="starting"&&n!=="running"||(this.#w=null,i?this.#S(this.#h,!1):this.#a&&this.#M())}disconnected(){this.#b=!1,this.#f+=1,this.#r=null,this.#s&&(this.#s="",this.#u({lost:"Input typed while the connection dropped was not sent."})),["running","attaching","starting"].includes(this.#e.status)&&this.#u({status:"reconnecting"})}async close(){const{terminalId:n,status:i}=this.#e;if(this.dispose(),this.#T(void 0),this.#u({status:"closed"}),!(!n||i==="gone"||i==="closed"))try{await this.#p.request("terminal.close",{terminalId:n})}catch{}}dispose(){this.#f+=1,this.#l!==void 0&&clearTimeout(this.#l),this.#y!==void 0&&clearTimeout(this.#y),this.#l=this.#y=void 0,this.#s="",this.#m.clear()}dismissLost(){this.#e.lost&&this.#u({lost:void 0})}}function Sd(s){const n=qe(s);return n.reason&&Sx[n.reason]?Sx[n.reason]:n.code===1003&&n.reason==="grant"?Ef.permission:n.code===1003&&n.reason==="outside_workspace"?"This workspace is not granted to your access token.":n.message}const tj=["attach.after","prompt.receipts"],Ax={name:"alp-web",version:"0.10.0"},Ex="Stop is waiting for this message’s outcome.",nj=15e3,sj=200,Cx={"read-only":"Read only","workspace-write":"Workspace write","full-access":"Full access"};function Ul(s,n){const i=s.tree,r=i&&i.rootId===n?Object.keys(i.projection.questions).length>0:!1;return i&&i.rootId===n&&i.status==="attached"?r:r||(s.attention[n]??0)>0}function Kr(s,n){return s.turnAttention[n]?.reason}function Nd(s){if(!s||s.reason!=="finished"&&s.reason!=="error"||typeof s.at!="string")return;const n=Date.parse(s.at),i=s.reason==="error"&&typeof s.message=="string"&&s.message.trim()?s.message:void 0;return{reason:s.reason,at:Number.isFinite(n)?n:Date.now(),hostAt:s.at,...typeof s.turnId=="string"?{turnId:s.turnId}:{},...i?{message:i}:{}}}function ij(s){const n=Object.entries(s.turnAttention).filter(([i])=>s.tree?.rootId===i||s.sessions.list.some(r=>r.id===i&&!r.archived));return n.length===Object.keys(s.turnAttention).length?s.turnAttention:Object.fromEntries(n)}const Mx="This access token cannot list files (needs project.read).",Pd="This access token cannot read files (needs files.read).",ub="This host does not offer file reading. Update ALP on the host.",db=100;function aj(s){if(typeof s!="string")return;const n=s.trim();return n&&n.length<=253&&!/[\p{Cc}\p{Cf}]/u.test(n)?n:void 0}function zx(s,n){const i=(Array.isArray(s?.sessions)?s.sessions:[]).filter(r=>r&&typeof r.id=="string"&&!r.parentId);return n?i.sort((r,c)=>String(c.updatedAt??c.createdAt??"").localeCompare(String(r.updatedAt??r.createdAt??""))):i}function rj(){try{return globalThis.sessionStorage??void 0}catch{return}}function tn(s=""){return{connection:{phase:"idle",gateway:s,attempt:0,capabilities:[]},principal:null,workspace:null,catalog:{status:"idle",teams:[],modes:[],models:[]},sessions:{status:"idle",list:[]},registry:{workspaces:[],revision:0},history:{status:"idle",list:[],query:""},attention:{},turnAttention:{},selected:null,focus:null,tree:null,prompts:[],queued:[],busy:{},tasks:{status:"idle",visible:!1,rows:[],unreadable:0,creates:[],busy:{}},settings:{status:"idle",models:[]},notice:null,preferences:ki(null)}}class Mr extends Error{constructor(){super("The message was discarded."),this.name="DiscardedError"}}class _x extends Error{constructor(n,i,r){super(i.message),this.name="UploadError",this.fileName=n,this.failure=i,this.dropped=r}}class oj{#e;#k=new Set;#m=!1;#n;#i=null;#h="";#r=new Map;#f=new Map;#a=null;#s=null;#g=new Map;#l=new Map;#y=new Map;#v=new Map;#w=new Map;#b=new Map;#p=new WeakMap;#u(n,i){const r=(this.#p.get(n)??Promise.resolve()).then(i);return this.#p.set(n,r.catch(()=>{})),r}#N=new WeakSet;#j=!1;#T=null;#Y=new Set;#M=0;#B=!1;#S=null;#o={};#L={};#O=new Map;#U;#J;#ee;#A=null;#V=null;#K=null;#D=new Map;#Ee=0;#$=0;#fe={visible:!0,focused:!0};#Qe=0;#C=new Map;constructor(n={}){this.#n={open:Dk,reconnecting:sx,backoff:{initialMs:500,maxMs:15e3},stableMs:5e3,requestTimeoutMs:3e4,createTimeoutMs:12e4,taskPollMs:5e3,sessionPollMs:15e3,attentionPollMs:5e3,attentionWatchPollMs:6e4,historyPageSize:sj,releaseTimeoutMs:5e3,busyUnseenMs:nj,...n},this.#e={...tn(),preferences:jx(n.storage)}}getState(){return this.#e}subscribe(n){return this.#k.add(n),()=>{this.#k.delete(n)}}#t(n){const i=typeof n=="function"?n(this.#e):n;this.#e={...this.#e,...i},this.#Ze(),this.#e.queued.length&&this.#yt()}#Ze(){this.#m||(this.#m=!0,queueMicrotask(()=>{this.#m=!1;for(const n of[...this.#k])n()}))}#d(n,i,r){this.#t({notice:{id:++this.#Qe,level:n,text:i,...r?.action?{action:r.action}:{}}})}dismissNotice(){this.#t({notice:null})}notify(n,i){this.#d(n,i)}#c(){const n=this.#i?.alp;if(!n||n.state!=="open"||!n.client)throw new Xe(this.#e.connection.phase==="reconnecting"?"Reconnecting to the host. Try again in a moment.":"Not connected to a host.");return n.client}connect({url:n,token:i,link:r=!1}){this.#te(),r||bl(this.#n.linkStorage);let c;try{c=Gy(n)}catch(k){this.#t({connection:{...this.#e.connection,phase:"failed",gateway:String(n),error:qe(k)}});return}const u=String(i??"").trim();if(!u){this.#t({connection:{...this.#e.connection,phase:"failed",gateway:c,error:qe(new wa("Enter an access token."))}});return}this.#h=u,this.#e={...tn(c),preferences:this.#e.preferences},this.#t({connection:{phase:"connecting",gateway:c,attempt:1,capabilities:[],...r?{link:!0}:{}}});const d={opened:!1,...r?{link:!0}:{}};this.#i=d;const{open:h,reconnecting:m,backoff:g,stableMs:x,requestTimeoutMs:y}=this.#n,w=m({connect:async({signal:k})=>{const{transport:T,principal:S}=await h({url:c,token:this.#h,signal:k});if(this.#i!==d)throw T.close(),new Error("This connection was replaced.");return d.principal=S,T},onConnect:(k,T)=>this.#Pe(d,k,T.signal),onDisconnect:()=>{if(this.#i===d){for(const k of this.#C.values())k.disconnected();this.#s=null,this.#g.clear(),this.#a=null;for(const k of this.#r.values())k.attaching=null}},shouldRetry:k=>!qe(k).terminal,backoff:g,stableMs:x,client:{timeoutMs:y}});d.alp=w,w.onEvent(k=>{this.#i===d&&this.#st(k)&&this.#it(k)}),w.onNotification((k,T)=>{if(!(this.#i!==d||k!=="terminal.event"))for(const S of this.#C.values())S.event(T)}),w.onState((k,T)=>{this.#i===d&&this.#We(d,k,T)})}showError(n){this.#te(),this.#t({connection:{...tn(this.#e.connection.gateway).connection,phase:"failed",error:{message:n,sent:"no",terminal:!0}}})}disconnect({keepTerminals:n=!1,keepLink:i=!1}={}){i||bl(this.#n.linkStorage),this.#te({keepTerminals:n})}#te({keepTerminals:n=!1}={}){const i=this.#i;this.#i=null,this.#h="",this.#he(),this.#r.clear(),this.#l.clear(),this.#f.clear(),this.#G.clear(),this.#F.clear(),this.#I.clear(),this.#P.clear(),this.#g.clear();const r=[...this.#x.values()];this.#x.clear();for(const u of r)clearTimeout(u.retry),u.observer?.stop(),u.done();this.#R.clear(),this.#ue.clear(),this.#q!==void 0&&(clearTimeout(this.#q),this.#q=void 0),this.#a=null,this.#s=null,this.#T=null,this.#M+=1,this.#o={},this.#A=null;const c=this.#tt(n?null:i);if(i?.alp){const u=i.alp;c?c.then(()=>u.stop()):u.stop()}i&&this.#t({...tn(this.#e.connection.gateway),preferences:this.#e.preferences})}#We(n,i,r){const c=this.#e.connection;if(i==="open"){n.opened=!0,this.#t({connection:{...c,phase:"open",attempt:0,error:void 0}}),this.#Je();return}if(i==="connecting"){this.#t({connection:{...c,phase:n.opened?"reconnecting":"connecting",attempt:n.alp?.attempt??c.attempt}});return}if(i==="waiting"){if(!n.opened&&!n.link)return this.#Ce(r??new Error("Could not connect."));if(!n.opened){this.#t({connection:{...c,phase:"connecting",error:r?qe(r):void 0}});return}this.#he(),this.#t({connection:{...c,phase:"reconnecting",error:r?qe(r):void 0}});return}i==="stopped"&&r&&this.#Ce(r)}#Ce(n){const i=this.#e.connection.gateway;let r=qe(n);this.#i?.link&&n instanceof wa&&(bl(this.#n.linkStorage),r={...r,message:Bk}),this.#te(),this.#t({connection:{...tn(i).connection,phase:"failed",error:r}})}async#Pe(n,i,r){const c=await nx(i,Ax,{signal:r,timeoutMs:15e3});if(this.#i!==n)throw new Error("This connection was replaced.");const u=Array.isArray(c?.capabilities)?c.capabilities.filter(m=>typeof m=="string"):[],d=tj.filter(m=>!u.includes(m));if(d.length)throw new Xe(`The host behind this gateway is too old for this app (it lacks ${d.join(", ")}). Update ALP on the host.`);this.#Fe(n.principal,u,typeof c?.daemonVersion=="string"?c.daemonVersion:void 0,aj(c?.hostname),f2(c?.promptImageLimits,u.includes("prompt.images")),x2(c?.attachmentLimits,u.includes("attachments")),u.includes("terminal")?Wd(c?.terminalLimits):void 0),this.#s=null,this.#a=null;const h=this.#e.selected;if(h&&h!==this.#S&&!this.#r.get(h)?.gone){this.#z(h).failed=null;try{if(await this.#ie(i,h,r),this.#i!==n||r.aborted)throw new Error("This connection was replaced.");this.#s={client:i,root:h}}catch(m){if(this.#i!==n||r.aborted||!pd(m))throw m;this.#_e(h,m)}}}#Fe(n,i,r,c,u,d={...Bs},h=void 0){this.#L={};const m=this.#e.workspace,g=m&&yl(n,m)?m:n.workspaces[0]??null,x=JSON.stringify(n)!==JSON.stringify(this.#e.principal);g!==m&&(this.#o={},this.#A=null),this.#t(y=>({principal:n,registry:x?tn().registry:{...y.registry,loading:!1},connection:{...y.connection,capabilities:i,...r?{daemonVersion:r}:{},hostname:c,promptImageLimits:u,attachmentLimits:d,terminalLimits:h},...g!==y.workspace?{workspace:g,selected:null,focus:null,tree:null,sessions:tn().sessions,history:tn().history,attention:{},turnAttention:{},tasks:{...tn().tasks,visible:y.tasks.visible}}:{},...x||g!==y.workspace?{catalog:tn().catalog}:{}}))}#Je(){for(const n of this.#C.values())n.connected();this.#H(),this.#mt();for(const[n,i]of this.#x)i.attempts=0,i.exhausted=!1,this.#E(n);this.refreshRegistry(),this.#e.workspace&&(this.refreshSessions(),this.refreshAttention(),this.#e.history.status!=="idle"&&this.loadHistory({quiet:!0}),this.#e.catalog.status!=="ready"&&this.#qe(),this.#e.tasks.visible&&this.refreshTasks()),this.#et()}#et(){this.#he(),this.#J=setInterval(()=>{this.#e.workspace&&this.#e.connection.phase==="open"&&this.refreshSessions({quiet:!0})},this.#n.sessionPollMs);const n=this.hasCapability("question.watch")?this.#n.attentionWatchPollMs:this.#n.attentionPollMs;this.#ee=setInterval(()=>{this.#e.workspace&&this.#e.connection.phase==="open"&&this.refreshAttention()},n),this.#U=setInterval(()=>{this.#e.tasks.visible&&this.#e.workspace&&this.#e.connection.phase==="open"&&this.refreshTasks({quiet:!0})},this.#n.taskPollMs)}#he(){this.#J!==void 0&&clearInterval(this.#J),this.#U!==void 0&&clearInterval(this.#U),this.#ee!==void 0&&clearInterval(this.#ee),this.#J=this.#U=this.#ee=void 0}hasCapability(n){return this.#e.connection.capabilities.includes(n)}terminalGate(){return F2(this.#e)}terminal(n){let i=this.#C.get(n);if(i)return i;const r=this.terminalGate();if(!r.ok||r.workspaceId!==n)throw new Xe(r.ok?"That workspace is not the open one.":r.messages.join(" "));const c=this.#n.terminalStorage===void 0?rj():this.#n.terminalStorage??void 0;return i=new ej({workspaceId:n,request:(u,d)=>this.#c().request(u,d,{timeoutMs:this.#n.requestTimeoutMs}),limits:this.#e.connection.terminalLimits??Wd(void 0),...c?{storage:c,storageKey:`alp-web.terminal|${this.#e.connection.gateway}|${this.#e.principal?.id??""}|${n}`}:{},...this.#n.terminalOptions}),this.#C.set(n,i),i}closeTerminal(n=Tf(this.#e)?.id){const i=n?this.#C.get(n):void 0;return!n||!i?Promise.resolve():(this.#C.delete(n),i.close())}#tt(n){const i=n?.alp?.state==="open"?n.alp.client:void 0,r=[];for(const c of this.#C.values()){const{terminalId:u,status:d}=c.getState();c.dispose(),i&&u&&d!=="gone"&&d!=="closed"&&r.push(i.request("terminal.close",{terminalId:u},{timeoutMs:1e3}).catch(()=>{}))}return this.#C.clear(),r.length?Promise.allSettled(r):void 0}#z(n){let i=this.#r.get(n);return i||(i={projection:ds(n),attaching:null,gone:null,failed:null},this.#r.set(n,i),this.#f.set(n,n)),i}#X(n){for(const i of n.order)this.#f.set(i,n.rootId);return n}#nt(n){const i=n?.sessionId;if(typeof i!="string")return;let r=this.#f.get(i);if(!r){const c=n.event?.type==="session.opened"?n.event.session?.parentId:void 0;r=typeof c=="string"&&this.#f.get(c)||void 0,r&&this.#f.set(i,r)}return r===this.#a?r:void 0}#st(n){const i=n?.event;if(i?.type==="question"){const r=i.question?.id,c=i.question?.rootId;return typeof r=="string"&&typeof c=="string"&&this.#V?.events.push({id:r,root:c}),this.#A&&typeof r=="string"&&typeof c=="string"&&this.#A.get(r)!==c&&(this.#A.set(r,c),this.#me()),n.cursor!==void 0||!!this.#a&&c===this.#a}if(i?.type==="attention"&&n.cursor===void 0)return typeof n.sessionId=="string"&&(this.#K&&this.#K.push([n.sessionId,i.attention??null]),this.#at(n.sessionId,i.attention)),!1;if(i?.type==="turn.ended"&&n.cursor===void 0){if(typeof n.sessionId=="string"){const r=n.sessionId;this.#e.sessions.list.some(c=>c.id===r&&(c.status==="running"||c.busy))&&this.#t(c=>({sessions:{...c.sessions,list:c.sessions.list.map(u=>u.id===r?{...u,busy:!1,...u.status==="running"?{status:"idle"}:{}}:u)}})),this.#Me(r,i)}return!1}if(i?.type==="question.resolved"){if(typeof i.questionId=="string"&&this.#V?.events.push({id:i.questionId}),this.#A?.delete(i.questionId)&&this.#me(),n.cursor!==void 0)return!0;const r=this.#a?this.#r.get(this.#a):void 0;return r?Object.hasOwn(r.projection.questions,i.questionId)||!!r.attaching?.buffer.some(c=>c.event?.type==="question"&&c.event.question?.id===i.questionId):!1}return!0}#me(){if(!this.#A)return;const n={};for(const i of this.#A.values())n[i]=(n[i]??0)+1;JSON.stringify(n)!==JSON.stringify(this.#e.attention)&&this.#t({attention:n})}#it(n){const i=this.#nt(n);if(!i)return;const r=this.#r.get(i);if(!r)return;if(n.event?.type==="history.reset"&&n.sessionId===i){this.#ze(i,n.event.generation);return}if(r.attaching){r.attaching.buffer.push(n);return}r.projection=this.#X(bi(r.projection,n)),this.#_(i);const c=n.event?.type;n.sessionId===i&&c==="turn.ended"?this.#Me(i,n.event):n.sessionId===i&&c==="turn.started"&&(this.#D.delete(i),this.#Q(i))}get#ne(){return this.hasCapability("session.attention")&&this.hasCapability("question.watch")}#at(n,i){this.#D.delete(n);const r=Nd(i);if(!r){this.#Q(n);return}if(this.#se(n)){this.#Q(n),this.#pe(n,r);return}this.#e.history.list.some(c=>c.id===n&&c.archived)||this.#e.turnAttention[n]?.hostAt!==r.hostAt&&this.#t(c=>({turnAttention:{...c.turnAttention,[n]:r}}))}#pe(n,i){if(!this.#ne||this.#e.connection.phase!=="open")return;const r={},c=this.#o;this.#D.set(n,r);const u=()=>{this.#D.get(n)===r&&(this.#D.delete(n),!(c!==this.#o||this.#e.turnAttention[n])&&(this.#e.history.list.some(d=>d.id===n&&d.archived)||this.#t(d=>({turnAttention:{...d.turnAttention,[n]:i}}))))};try{this.#c().request("session.attention.clear",{sessionId:n,...i.hostAt?{at:i.hostAt}:{}}).then(()=>{this.#D.get(n)===r&&this.#D.delete(n)},u)}catch{u()}}#Q(n){this.#e.turnAttention[n]&&this.#t(i=>{const{[n]:r,...c}=i.turnAttention;return{turnAttention:c}})}#Me(n,i){if(this.#ne)return;const r=i?.state==="completed"?"finished":i?.state==="failed"?"error":void 0;if(!r){this.#Q(n);return}if(this.#se(n)||this.#e.history.list.some(d=>d.id===n&&d.archived))return;const c=typeof i?.error?.message=="string"&&i.error.message.trim()?i.error.message:void 0,u={reason:r,at:Date.now(),...typeof i?.turnId=="string"?{turnId:i.turnId}:{},...r==="error"&&c?{message:c}:{}};this.#t(d=>({turnAttention:{...d.turnAttention,[n]:u}}))}#se(n){const i=this.#e.focus??this.#e.selected;return this.#fe.visible&&this.#fe.focused&&(i===n||this.#e.selected===n)}setPresence({visible:n,focused:i}){this.#fe={visible:!!n,focused:!!i};const r=this.#e.focus??this.#e.selected;r&&this.#se(r)&&this.clearAttention(r)}clearAttention(n){const i=n?this.#e.turnAttention[n]:void 0;!n||!i||(this.#Q(n),this.#pe(n,i))}async#ie(n,i,r,c=0){const u=this.#z(i),d={buffer:[]};u.attaching=d,this.#a=i;const h=this.#y.get(i)??0;this.#e.selected===i&&this.#t(m=>({tree:{rootId:i,status:"attaching",projection:u.projection,...m.tree?.rootId===i&&m.tree.error?{}:{}}}));try{if(this.hasCapability("session.history")&&!this.#l.has(i)){const y=await n.request("session.history",{sessionId:i},{timeoutMs:this.#n.requestTimeoutMs,...r?{signal:r}:{}});if(u.attaching!==d)return;u.projection=ds(i);for(const w of y.items)u.projection=bi(u.projection,Xd(w,i));this.#X(u.projection),u.projection={...u.projection,cursor:y.tipCursor},this.#l.set(i,{generation:y.generation,olderCursor:y.olderCursor,hasOlder:y.hasOlder})}const m=u.projection.cursor,g=this.#l.get(i),x=await n.request("session.attach",{sessionId:i,...g?{after:m,generation:g.generation}:m>0?{after:m}:{}},{timeoutMs:this.#n.requestTimeoutMs,...r?{signal:r}:{}});if(u.attaching!==d)return;u.attaching=null,u.gone=null,u.failed=null,this.#ge(i,u,x,d.buffer),(this.#y.get(i)??0)!==h&&this.#l.get(i)?.generation!==this.#v.get(i)&&(this.#l.delete(i),queueMicrotask(()=>{this.#xe(n,i)}))}catch(m){if(u.attaching!==d)throw m;if(m?.data?.reason==="stale_cursor"&&c<1&&this.#l.has(i))return this.#l.delete(i),u.projection=ds(i),u.attaching===d&&(u.attaching=null),this.#ie(n,i,r,c+1);throw u.attaching===d&&(u.attaching=null),n===this.#i?.alp?.client&&this.#a===i&&(this.#a=null),m}}#ge(n,i,r,c){i.projection=this.#X(px(i.projection,r??{},c)),r?.reset&&!i.projection.historyUnavailable&&this.#d("info","The host restarted this conversation's history; it was loaded again from the beginning."),this.#_(n,"attached")}#ze(n,i){if(typeof i!="string"||!i||this.#l.get(n)?.generation===i||this.#v.get(n)===i)return;this.#v.set(n,i),this.#y.set(n,(this.#y.get(n)??0)+1),this.#l.delete(n);const r=this.#r.get(n);r&&this.#Ve(n,r.projection);const c=this.#s?.root===n?this.#s.client:void 0;r&&c&&!r.attaching&&this.#xe(c,n)}#xe(n,i){return this.#u(n,()=>this.#rt(n,i))}async#rt(n,i){if(!(n!==this.#i?.alp?.client||this.#e.selected!==i)&&!(this.#s?.client!==n||this.#s.root!==i)){this.#l.delete(i);try{await this.#ie(n,i)}catch(r){this.#be(n,i,r)}}}async loadOlder(){const n=this.#e.selected;if(!n)return;const i=this.#l.get(n),r=this.#r.get(n),c=this.#s?.root===n?this.#s.client:null;if(!i?.hasOlder||i.loading||!r||!c)return;const u={...i,loading:!0,error:void 0};this.#l.set(n,u),this.#_(n);try{const d=await c.request("session.history",{sessionId:n,before:i.olderCursor},{timeoutMs:this.#n.requestTimeoutMs});if(this.#l.get(n)!==u)return;if(d.generation!==i.generation)throw new Error("History changed; reconnect to refresh it.");r.projection=this.#X(E2(r.projection,d.items)),this.#l.set(n,{generation:d.generation,olderCursor:d.olderCursor,hasOlder:d.hasOlder})}catch(d){this.#l.get(n)===u&&this.#l.set(n,{...i,error:qe(d).message})}this.#_(n)}#_e(n,i){const r=this.#z(n);r.gone=qe(i),r.attaching=null,this.#a===n&&(this.#a=null),this.#e.selected===n&&this.#t({tree:{rootId:n,status:"gone",error:r.gone,projection:r.projection}})}#_(n,i){if(this.#e.selected!==n){this.#E(n);return}const r=this.#r.get(n);if(!r)return;const c=xx(r.projection),u=r.projection.prompts;for(const h of this.#R.get(n)??[]){const m=u[h];(m?.state==="failed"&&m.errorCode!=="outcome_unknown"||m?.turnId&&r.projection.turns[m.turnId]==="ended")&&this.#R.get(n)?.delete(h)}let d=this.#e.prompts.filter(h=>h.rootId!==n||!c.has(h.id));d=d.map(h=>{const m=u[h.id];if(h.rootId!==n||m?.state!=="failed")return h;const g=m.errorCode==="outcome_unknown",x=g?"unknown":"failed";if(h.status===x)return h;const y=g?"The host cannot tell whether the agent took the message":"The agent did not take the message";return{...h,status:x,error:m.error?`${y}: ${m.error}`:`${y}.`,retrySameId:!1}}),this.#t(h=>({tree:{rootId:n,status:i??(h.tree?.rootId===n?h.tree.status:"attached"),projection:r.projection,...this.#l.has(n)?{older:this.#l.get(n)}:{},...i==="attached"?{}:h.tree?.rootId===n&&h.tree.error?{error:h.tree.error}:{}},...d.length!==h.prompts.length||d.some((m,g)=>m!==h.prompts[g])?{prompts:d}:{},sessions:this.#Re(h.sessions,n,r.projection),busy:{...h.busy,interrupt:this.#x.has(n)&&!this.#x.get(n)?.exhausted}})),this.#E(n)}#Re(n,i,r){const c=n.list.findIndex(g=>g.id===i);if(c<0)return n;const u=n.list[c],d=r.sessions[i],h=r.closed[i]?"closed":i in r.running?"running":d?.status==="closed"||u.status==="closed"&&!d?"closed":"idle";if(u.status===h&&(!d?.title||d.title===u.title))return n;const m=n.list.slice();return m[c]={...u,status:h,...d?.title?{title:d.title}:{}},{...n,list:m}}async#H(){const n=this.#i?.alp?.client;if(n){if(this.#N.has(n)){this.#B=!0;return}this.#N.add(n);try{for(;;){this.#B=!1;const i=await this.#u(n,()=>this.#ot(n));if(n!==this.#i?.alp?.client||!i&&!this.#B)break}}finally{this.#N.delete(n)}}}async#ot(n){if(this.#i?.alp?.state!=="open"||n!==this.#i.alp.client)return!1;const i=this.#e.selected;this.#s&&this.#s.client!==n&&(this.#s=null);const r=this.#s;if(r&&r.root!==i)return this.#s=null,this.#a===r.root&&(this.#a=null),await this.#Z(r),!0;if(!i||i===this.#S||this.#s?.root===i)return!1;const c=this.#z(i);if(c.gone)return this.#t({tree:{rootId:i,status:"gone",error:c.gone,projection:c.projection}}),!1;if(c.failed)return this.#t({tree:{rootId:i,status:"error",error:c.failed,projection:c.projection}}),!1;const u=this.#g.get(i);try{return this.#g.delete(i),this.#s={client:n,root:i},await this.#ie(n,i),n!==this.#i?.alp?.client?!0:(this.#s={client:n,root:i},this.#e.selected!==i)}catch(d){return u&&n===this.#i?.alp?.client&&(this.#s?.client===n&&this.#s.root===i&&(this.#s=null),await this.#Z(u)),this.#be(n,i,d),!1}}async#Z(n){const i=this.#x.get(n.root)?.observer;i&&i.state!=="stopped"?(this.#g.set(n.root,n),i.ready().catch(()=>{}).then(()=>this.#ye(n.root,n))):(this.#g.delete(n.root),await n.client.request("session.release",{sessionId:n.root},{timeoutMs:this.#n.releaseTimeoutMs}).catch(()=>{}))}#ye(n,i){const r=this.#g.get(n);!r||i&&r!==i||this.#u(r.client,async()=>{this.#g.get(n)===r&&(this.#g.delete(n),this.#i?.alp?.client===r.client&&(this.#s?.client===r.client&&this.#s.root===n||await r.client.request("session.release",{sessionId:n},{timeoutMs:this.#n.releaseTimeoutMs}).catch(()=>{})))})}#be(n,i,r){if(n!==this.#i?.alp?.client)return;if(pd(r)){this.#_e(i,r);return}const c=this.#z(i);c.failed=qe(r),this.#e.selected===i&&this.#t({tree:{rootId:i,status:"error",error:c.failed,projection:c.projection}})}retryAttach(){const n=this.#e.selected;if(!n)return;const i=this.#r.get(n);i&&(i.gone=null,i.failed=null);const r=this.#i?.alp?.client;r&&this.#u(r,async()=>{const c=this.#s;c?.client===r&&c.root===n&&(this.#s=null,this.#a===n&&(this.#a=null),await this.#Z(c))}).finally(()=>this.#H())}selectWorkspace(n){const i=this.#e.principal,r=n&&(yl(i??void 0,n)||this.#e.registry.workspaces.some(c=>c.managedWorktree&&c.directory===n))?n:null;r!==this.#e.workspace&&(this.#o={},this.#A=null,this.#t(c=>({workspace:r,selected:null,focus:null,tree:null,sessions:tn().sessions,history:tn().history,attention:{},turnAttention:{},catalog:tn().catalog,tasks:{...tn().tasks,visible:c.tasks.visible}})),this.#H(),r&&this.#e.connection.phase==="open"&&(this.refreshSessions(),this.refreshAttention(),this.#qe(),this.#e.tasks.visible&&this.refreshTasks()))}async refreshRegistry(){if(!this.hasCapability("workspace.registry")||!ze(this.#e.principal??void 0,"project.read")||this.#e.registry.loading)return;const n=this.#L,i=this.#i;this.#t(r=>({registry:{...r.registry,loading:!0}}));try{const r=[];let c,u=0;do{const d=await this.#c().request("workspace.list",{limit:500,...c?{cursor:c}:{}});r.push(...d.workspaces),u=d.revision,c=d.nextCursor}while(c);n===this.#L&&i===this.#i&&this.#t({registry:{workspaces:r,revision:u}})}catch(r){n===this.#L&&i===this.#i&&this.#t(c=>({registry:{...c.registry,loading:!1,error:r instanceof Error?r.message:String(r)}}))}}async pinWorkspace(n,i){if(!ze(this.#e.principal??void 0,"workspace.write")){this.#d("error","Ask the host owner to add workspace.write to your credential to change shared pins.");return}try{await this.#c().request("workspace.update",{workspaceId:n,pinned:i,ifRevision:this.#e.registry.revision,requestId:globalThis.crypto.randomUUID()}),await this.refreshRegistry()}catch(r){this.#d("error",`Pin was not saved. ${r instanceof Error?r.message:String(r)} Refresh and try again.`),await this.refreshRegistry()}}async worktreeOptions(n){return(await this.#c().request("workspace.worktree.options",{workspaceId:n})).mappingIds}async mutateWorktree(n,i,r){if(!this.hasCapability("workspace.worktree")||!ze(this.#e.principal??void 0,"workspace.manage"))return!1;const c=n+":"+i+":"+(r??"");let u=this.#O.get(c);u||(u={workspaceId:i,...r?{mappingId:r}:{},ifRevision:this.#e.registry.revision,requestId:globalThis.crypto.randomUUID()},this.#O.set(c,u));try{return await this.#c().request("workspace.worktree."+n,u),this.#O.delete(c),await this.refreshRegistry(),!0}catch(d){return d?.data?.reason==="stale_revision"&&this.#O.delete(c),this.#d("error",`Worktree ${n} was not confirmed. ${d instanceof Error?d.message:String(d)} Retry the same operation to reconcile its outcome.`),await this.refreshRegistry(),!1}}async registerProject(n){if(!ze(this.#e.principal??void 0,"workspace.write")){this.#d("error","Ask the host owner to add workspace.write to your credential. To add another directory, the owner must grant it locally first.");return}try{await this.#c().request("project.register",{directory:n,ifRevision:this.#e.registry.revision,requestId:globalThis.crypto.randomUUID()}),await this.refreshRegistry()}catch(i){this.#d("error",`Project was not added. ${i instanceof Error?i.message:String(i)} Refresh and try again.`),await this.refreshRegistry()}}async refreshSessions({quiet:n=!1}={}){this.refreshRegistry();const i=this.#e.workspace;if(!i)return;const r=this.#o;n||this.#t(u=>({sessions:{...u.sessions,status:u.sessions.list.length?u.sessions.status:"loading",error:void 0}}));const c=Date.now();try{const d=await this.#c().request("session.list",{projectRoot:i,rootsOnly:!0,includeClosed:!0});if(r!==this.#o)return;const h=(Array.isArray(d?.sessions)?d.sessions:[]).filter(m=>m&&typeof m.id=="string"&&!m.parentId&&!m.archived).sort((m,g)=>String(g.updatedAt??g.createdAt??"").localeCompare(String(m.updatedAt??m.createdAt??"")));this.#t(m=>{let g={status:"ready",list:h};for(const[T,S]of this.#r)g=this.#Re(g,T,S.projection);const x=m.selected&&!h.some(T=>T.id===m.selected)?m.sessions.list.find(T=>T.id===m.selected):void 0,w=this.#ne?[]:Object.keys(m.turnAttention).filter(T=>m.turnAttention[T].at<c&&h.some(S=>S.id===T&&(S.status==="running"||S.busy))),k=w.length?Object.fromEntries(Object.entries(m.turnAttention).filter(([T])=>!w.includes(T))):m.turnAttention;return{sessions:x?{...g,list:[x,...g.list]}:g,turnAttention:k}})}catch(u){if(r!==this.#o)return;n||this.#t(d=>({sessions:{...d.sessions,status:"error",error:qe(u)}}))}}async refreshAttention(){const n=this.#e.workspace;if(!n||!ze(this.#e.principal??void 0,"session.read"))return;const i=this.#o,r=++this.#Ee,c=this.hasCapability("question.watch"),u=c?{read:r,events:[]}:null;this.#V=u;const d=this.#ne,h=d?[]:null;this.#K=h;try{const m=c&&this.hasCapability("question.watch.turns"),g=await this.#c().request(c?"question.watch":"question.list",{projectRoot:n,...m?{turns:!0}:{},...d?{attention:!0}:{}});if(i!==this.#o||r!==this.#Ee)return;d&&Array.isArray(g?.attention)&&this.#lt(g.attention,h??[]);const x=new Map;for(const y of Array.isArray(g?.questions)?g.questions:[])typeof y?.id=="string"&&typeof y.rootId=="string"&&x.set(y.id,y.rootId);for(const y of u?.events??[])y.root?x.set(y.id,y.root):x.delete(y.id);this.#A=x,this.#me(),c||(this.#A=null)}catch{}finally{this.#V===u&&(this.#V=null),this.#K===h&&(this.#K=null)}}#lt(n,i){const r=new Map;for(const u of n)typeof u?.sessionId=="string"&&Nd(u.attention)&&r.set(u.sessionId,u.attention);for(const[u,d]of i)r.set(u,d);const c={};for(const[u,d]of r){const h=Nd(d);if(!h||this.#e.history.list.some(g=>g.id===u&&g.archived))continue;if(this.#se(u)){this.#pe(u,h);continue}const m=this.#e.turnAttention[u];c[u]=m?.hostAt===h.hostAt?m:h}JSON.stringify(c)!==JSON.stringify(this.#e.turnAttention)&&this.#t({turnAttention:c})}get historyPaged(){return this.hasCapability("session.list.page")}async loadHistory({quiet:n=!1,query:i=this.#e.history.query}={}){const r=this.#e.workspace;if(!r)return;const c=this.#o,u=++this.#$,d=this.historyPaged,h=i.trim();n||this.#t(m=>({history:{...m.history,status:"loading",error:void 0,query:i}}));try{const m=await this.#c().request("session.list",{projectRoot:r,rootsOnly:!0,includeClosed:!0,includeArchived:!0,...d?{limit:this.#n.historyPageSize,...h?{query:h}:{}}:{}});if(c!==this.#o||u!==this.#$)return;const g=d&&typeof m?.nextCursor=="string"?m.nextCursor:void 0;this.#t({history:{status:"ready",list:zx(m,!d),query:i,...g?{nextCursor:g}:{}}})}catch(m){if(c!==this.#o||u!==this.#$)return;(!n||this.#e.history.status!=="ready")&&this.#t(g=>({history:{...g.history,status:"error",error:qe(m),query:i}}))}}async loadMoreHistory(){const n=this.#e.workspace,{status:i,nextCursor:r,query:c,more:u}=this.#e.history;if(!n||i!=="ready"||!r||u==="loading")return;const d=this.#o,h=this.#$,m=c.trim();this.#t(g=>({history:{...g.history,more:"loading"}}));try{const g=await this.#c().request("session.list",{projectRoot:n,rootsOnly:!0,includeClosed:!0,includeArchived:!0,limit:this.#n.historyPageSize,cursor:r,...m?{query:m}:{}});if(d!==this.#o)return;if(h!==this.#$){this.#Le();return}const x=typeof g?.nextCursor=="string"?g.nextCursor:void 0;this.#t(y=>{const w=new Set(y.history.list.map(E=>E.id)),{more:k,nextCursor:T,...S}=y.history;return{history:{...S,list:[...S.list,...zx(g,!1).filter(E=>!w.has(E.id))],...x?{nextCursor:x}:{}}}})}catch{if(d!==this.#o)return;if(h!==this.#$){this.#Le();return}this.#t(g=>({history:{...g.history,more:"error"}}))}}#Le(){if(this.#e.history.more!=="loading")return;const{more:n,...i}=this.#e.history;this.#t({history:i})}get filesSearchable(){return this.hasCapability("workspace.files")}async searchWorkspaceFiles({query:n="",limit:i=db}={}){const r=this.#e.workspace;if(!r)throw new Xe("Choose a workspace first.");if(!this.filesSearchable)throw new Xe("The host does not offer file search. Update ALP on the host.");if(!ze(this.#e.principal??void 0,"project.read"))throw new Xe(Mx);let c;try{c=await this.#c().request("workspace.files.search",{projectRoot:r,query:String(n).slice(0,200),limit:i})}catch(d){throw qe(d).code===1003?new Xe(Mx):d}return{files:(Array.isArray(c?.files)?c.files:[]).filter(d=>d&&typeof d.path=="string"&&d.path).map(d=>({path:String(d.path)})),truncated:c?.truncated===!0}}get filesReadable(){return this.hasCapability("workspace.files.read")}get canReadFiles(){return ze(this.#e.principal??void 0,"files.read")}#Oe(n,i){const r=(d,h,m=!1)=>new xi({message:d,reason:h,sent:"no",terminal:m}),c=this.#e.workspace;if(!c)throw r("Choose a workspace first.","workspace");if(!this.filesReadable)throw r(ub,"capability",!0);if(!this.canReadFiles)throw r(Pd,"grant",!0);if(n===void 0||n===""){if(i)throw r(Lr.invalid_path,"invalid_path");return{workspace:c,path:void 0}}const u=Hs(n);if(!u)throw r(Lr.invalid_path,"invalid_path");if(Ai(u))throw r(Lr.blocked_path,"blocked_path");return{workspace:c,path:u}}#De(n){const i=xk(n);return i.code===1003&&i.reason==="grant"?new xi({...i,message:Pd}):new xi(i)}async listWorkspaceFiles({path:n,includeIgnored:i=!1}={}){const r=this.#Oe(n,!1);let c;try{c=await this.#c().request("workspace.files.list",{projectRoot:r.workspace,...r.path?{path:r.path}:{},...i?{includeIgnored:!0}:{}})}catch(u){throw this.#De(u)}return yk(c,r.path??"")}async readWorkspaceFile({path:n,includeIgnored:i=!1}){const r=this.#Oe(n,!0);let c;try{c=await this.#c().request("workspace.files.read",{projectRoot:r.workspace,path:r.path,...i?{includeIgnored:!0}:{}})}catch(d){throw this.#De(d)}const u=typeof c?.content=="string"?c.content:void 0;if(u===void 0||u.length>Sl.maxReadBytes)throw new xi({message:u===void 0?"The host sent something this app does not understand.":Lr.too_large,...u===void 0?{}:{reason:"too_large"},sent:"yes",terminal:!1});return{path:r.path,content:u,size:typeof c?.size=="number"&&Number.isFinite(c.size)?c.size:u.length,...typeof c?.modifiedAt=="string"?{modifiedAt:c.modifiedAt}:{}}}get gitAccess(){return vd(this.#e)}async gitStatus(){const n=vd(this.#e);if(!n.status)throw new us({message:n.message,reason:n.reason,sent:"no",terminal:n.reason!=="loading"});let i;try{i=await this.#c().request("workspace.git.status",{workspaceId:n.workspaceId})}catch(r){throw new us(vi(r))}if(!i||typeof i!="object"||typeof i.state!="string"||!Array.isArray(i.files))throw new us({message:"The host sent something this app does not understand.",sent:"yes",terminal:!1});return i}async gitDiff({compare:n,path:i,cursor:r}){const c=vd(this.#e);if(!c.status)throw new us({message:c.message,reason:c.reason,sent:"no",terminal:c.reason!=="loading"});if(!c.content)throw new us({message:c.contentMessage,reason:"grant",sent:"no",terminal:!0});const u=i===void 0?void 0:o2(i);if(i!==void 0&&!u){const h=Hs(i)?"blocked_path":"invalid_path";throw new us({message:Tl[h],reason:h,sent:"no",terminal:!1})}let d;try{d=await this.#c().request("workspace.git.diff",{workspaceId:c.workspaceId,compare:l2(n),...u?{path:u}:{},...r?{cursor:r}:{}})}catch(h){throw new us(vi(h))}if(!d||typeof d!="object"||typeof d.snapshot!="string"||!Array.isArray(d.files))throw new us({message:"The host sent something this app does not understand.",sent:"yes",terminal:!1});return d}isArchived(n){return n?!!this.#e.history.list.find(i=>i.id===n)?.archived&&!this.#e.sessions.list.some(i=>i.id===n):!1}async#qe(){const n=this.#e.workspace,i=this.#e.principal;if(!n||!i)return;const r=this.#o;this.#t(c=>({catalog:{...c.catalog,status:"loading",error:void 0}}));try{const c=this.#c(),[u,d,h]=await Promise.all([this.#Be(c,i,n),ze(i,"session.read")?c.request("catalog.get",{}).catch(()=>{}):void 0,this.hasCapability("library")&&ze(i,"session.read")?c.request("library.models",{}).catch(()=>{}):void 0]);if(r!==this.#o)return;const m=i.modes,x=(Array.isArray(d?.modes)&&d.modes.length?d.modes:Object.keys(Cx).map(k=>({id:k}))).filter(k=>typeof k?.id=="string"&&(!m||m.includes(k.id))).map(k=>({id:k.id,label:typeof k.label=="string"?k.label:Cx[k.id]??k.id,...typeof k.description=="string"?{description:k.description}:{}})),y=yx(h?.models),w=x.some(k=>k.id==="full-access")?"full-access":x[0]?.id;this.#t({catalog:{status:"ready",...u,modes:x,models:y,...w?{defaultMode:w}:{}}})}catch(c){if(r!==this.#o)return;this.#t(u=>({catalog:{...u.catalog,status:"error",error:qe(c)}}))}}async#Be(n,i,r){if(!this.hasCapability("team"))return{teams:[],teamsKnown:!1,teamsUnavailable:{reason:"capability"}};if(!ze(i,"project.read"))return{teams:[],teamsKnown:!1,teamsUnavailable:{reason:"permission"}};try{const c=await n.request("team.list",{projectRoot:r});return Array.isArray(c?.teams)?{teams:c.teams.filter(d=>typeof d?.id=="string"&&!d.error).map(d=>({id:d.id,label:typeof d.label=="string"?d.label:d.id,...typeof d.description=="string"?{description:d.description}:{}})),teamsKnown:!0}:{teams:[],teamsKnown:!1,teamsUnavailable:{reason:"failed",message:"The host answered team.list in a form this app does not read."}}}catch(c){return{teams:[],teamsKnown:!1,teamsUnavailable:{reason:"failed",message:qe(c).message}}}}startOrigin(){return{workspace:this.#e.workspace,connection:this.#M}}keepUnsentDraft(n,i){if(!n||!i?.workspace||i.connection!==this.#M)return;const r={workspace:i.workspace,text:String(n)};for(const c of this.#Y)if(c(r)){this.#T=null;return}this.#T=r}takeUnsentDrafts(n){return this.#Y.add(n),()=>{this.#Y.delete(n)}}unsentDraft(){const n=this.#T;return n&&n.workspace===this.#e.workspace?n.text:""}clearUnsentDraft(n){(n===void 0||this.#T?.text===n)&&(this.#T=null)}async retryTeams(){const{workspace:n,principal:i,catalog:r}=this.#e;if(!n||!i||r.status!=="ready"||r.teamsUnavailable?.reason!=="failed"||this.#j)return;const c=this.#o;this.#j=!0;try{const u=await this.#Be(this.#c(),i,n);if(c!==this.#o||this.#e.workspace!==n||this.#e.catalog.status!=="ready")return;this.#t(d=>({catalog:{...d.catalog,teams:u.teams,teamsKnown:u.teamsKnown,teamsUnavailable:u.teamsUnavailable}}))}catch{}finally{this.#j=!1}}selectSession(n){if(this.clearAttention(n),n===this.#e.selected)return;const i=n?this.#z(n):void 0;i&&(i.failed=null),this.#t({selected:n,focus:n,tree:n&&i?{rootId:n,status:i.gone?"gone":"detached",...i.gone?{error:i.gone}:{},projection:i.projection}:null}),this.#H()}focusSession(n){const i=this.#e.tree?.projection;!i||n!==i.rootId&&!i.sessions[n]||(this.clearAttention(n),this.#t({focus:n}))}async createSession({team:n,mode:i,model:r,thinking:c,title:u,prompt:d,files:h=[]}={}){const m=this.#e.workspace;if(!m)throw new Xe("Choose a workspace first.");if(this.#S||this.#e.busy.create)throw new Xe("A new session is already starting.");const g=this.#c(),x=Kk(),y=this.#o;this.#S=x,this.#t(E=>({busy:{...E.busy,create:!0}}));const w=this.#z(x),k={id:x,projectRoot:m,status:"initializing",...u?{title:u}:{},createdAt:new Date().toISOString()};this.#t(E=>({selected:x,focus:x,tree:{rootId:x,status:"attaching",projection:w.projection},sessions:{...E.sessions,list:[k,...E.sessions.list.filter(q=>q.id!==x)]}}));const T=()=>y===this.#o&&g===this.#i?.alp?.client,S=()=>{if(!T())throw new Xe("The connection or workspace changed while starting the session.")};try{return await this.#u(g,async()=>{S();const E=this.#s;E&&E.client===g&&(this.#s=null,this.#a=null,await this.#Z(E)),S();const q={buffer:[]};w.attaching=q,this.#a=x;const L={cwd:m,persist:!0,...n?{workflow:n}:{},...i?{mode:i}:{},...r?{model:r}:{},...c?{thinking:c}:{}};this.#s={client:g,root:x};try{await g.request("session.create",{sessionId:x,spec:L,history:"skip"},{timeoutMs:this.#n.createTimeoutMs}),S(),this.#s={client:g,root:x}}catch(M){if(!T())throw M;w.attaching=null;const R=qe(M);throw R.sent!=="unknown"?(this.#s?.client===g&&this.#s.root===x&&(this.#s=null,await this.#Z({client:g,root:x})),T()&&(this.#r.delete(x),this.#l.delete(x),this.#f.delete(x),this.#a===x&&(this.#a=null),this.#t($=>({...$.selected===x?{selected:null,focus:null,tree:null}:{},sessions:{...$.sessions,list:$.sessions.list.filter(_=>_.id!==x)}}))),M):(this.refreshSessions(),new Uy(`${R.message} If the new session shows in the list, open it and send your message there; otherwise start again.`,x))}try{let M;if(this.hasCapability("session.history")){const $=await g.request("session.history",{sessionId:x,limit:1},{timeoutMs:this.#n.requestTimeoutMs});S(),M=$.generation,this.#l.set(x,{generation:M,hasOlder:!1})}const R=await g.request("session.attach",{sessionId:x,...M?{generation:M,after:0}:{}},{timeoutMs:this.#n.requestTimeoutMs});S(),w.attaching===q&&(w.attaching=null,w.failed=null,this.#ge(x,w,R,q.buffer))}catch(M){if(!T())throw M;w.attaching===q&&(w.attaching=null),this.#a===x&&(this.#a=null),this.#be(g,x,M)}return u?.trim()&&await this.renameSession(x,u.trim()).catch(()=>{}),S(),this.#wt({team:n,mode:i,model:r,thinking:c}),(d?.trim()||h.length)&&await this.sendPrompt(d??"",x,[],h,{keepRefused:!0}).catch(M=>this.#d("error",qe(M).message)),this.refreshSessions({quiet:!0}),x})}finally{this.#S===x&&(this.#S=null,this.#t(E=>({busy:{...E.busy,create:!1}}))),this.#H()}}async renameSession(n,i){const u=(await this.#c().request("session.rename",{sessionId:n,title:i}))?.session,d=m=>m.id===n?{...m,...u&&typeof u=="object"?u:{},title:i}:m;this.#t(m=>({sessions:{...m.sessions,list:m.sessions.list.map(d)},history:{...m.history,list:m.history.list.map(d)}}));const h=this.#r.get(n);h&&(h.projection={...h.projection,sessions:{...h.projection.sessions,[n]:{...h.projection.sessions[n],id:n,title:i}}},this.#_(n))}async archiveSession(n){const i=this.#c(),r=this.#o;if(await i.request("session.archive",{sessionId:n,archived:!0}),r!==this.#o)return;this.#e.selected===n&&this.selectSession(null);const{[n]:c,...u}=this.#e.attention,{[n]:d,...h}=this.#e.turnAttention;this.#t(m=>({turnAttention:h,sessions:{...m.sessions,list:m.sessions.list.filter(g=>g.id!==n)},history:{...m.history,list:m.history.list.map(g=>g.id===n?{...g,archived:!0}:g)},attention:u}))}async restoreSession(n){const i=this.#c(),r=this.#o,c=await i.request("session.archive",{sessionId:n,archived:!1});if(r!==this.#o)return;const u=c?.session&&typeof c.session=="object"?c.session:void 0;this.#t(d=>{const m={...d.history.list.find(g=>g.id===n)??{},...u??{},id:n,archived:!1};return{history:{...d.history,list:d.history.list.map(g=>g.id===n?m:g)},sessions:{...d.sessions,list:d.sessions.list.some(g=>g.id===n)?d.sessions.list:[m,...d.sessions.list]}}}),this.refreshSessions({quiet:!0})}#ae(n){const i=this.#e.sessions.list.find(c=>c.id===n)??this.#e.history.list.find(c=>c.id===n),r=this.#r.get(n)?.projection.sessions[n];return{...i??{},...r??{},...r?.conversation?{}:i?.conversation?{conversation:i.conversation}:{}}}conversationGate(n=this.#e.tree?.rootId){const{principal:i,connection:r}=this.#e,c=n?this.#r.get(n):void 0,u=!!n&&!!c&&(this.rootBusy(n)||Object.keys(c.projection.running).length>0||Object.keys(c.projection.questions).length>0);return Pk({capabilities:r.capabilities,canRead:ze(i??void 0,"session.read"),canWrite:ze(i??void 0,"session.write"),summary:n?this.#ae(n):null,busy:u,generation:n?this.#l.get(n)?.generation??null:null,online:r.phase==="open",driveBlock:n&&n===this.#e.tree?.rootId?this.driveBlock():void 0})}agentControls(n){const{principal:i,connection:r}=this.#e,c=this.#e.tree?.rootId,u=c?this.#r.get(c):void 0,d=!!c&&n===c,h=d&&!!u&&(this.rootBusy(c)||Object.keys(u.projection.running).length>0||Object.keys(u.projection.questions).length>0);return e2({capabilities:r.capabilities,canRead:ze(i??void 0,"session.read"),canWrite:ze(i??void 0,"session.write"),summary:d?this.#ae(c):null,root:d,closed:d&&!!u?.projection.closed[c],busy:h,generation:d?this.#l.get(c)?.generation??null:null,online:r.phase==="open",driveBlock:d?this.driveBlock():void 0})}async copyResumeCommand(n,i){try{const r=await this.#c().request("session.resumeCommand",{sessionId:n});if(typeof r?.display!="string"||!r.display)throw new Xe("The host answered no command.");return await i(r.display),this.#d("info",`Copied the resume command: ${r.display}`),r}catch(r){this.#d("error",`Could not copy the resume command: ${qe(r).message}`);return}}async reloadAgent({sessionId:n,requestId:i}){const{root:r,generation:c,client:u}=this.#re();if(n!==r)throw new Xe(Br.not_root);this.#d("info","Reloading the agent…");try{const d=await u.request("session.reload",{sessionId:r,requestId:i,ifGeneration:c},{timeoutMs:this.#n.createTimeoutMs});return this.#ve(d.session),this.refreshSessions({quiet:!0}),this.#d("info","Reloaded the agent: it restarted on the same conversation."),d}catch(d){throw this.#oe(r,d),this.#d("error",Jk(d).message),d}}rootSummary(n=this.#e.tree?.rootId){return n?this.#ae(n):{}}historyGeneration(n){return this.#l.get(n)?.generation}#ve(n){if(!n||typeof n.id!="string")return;const i=n.id,r=u=>u.id===i?{...u,...n}:u;this.#t(u=>({sessions:{...u.sessions,list:u.sessions.list.map(r)},history:{...u.history,list:u.history.list.map(r)}}));const c=this.#r.get(i);c&&(c.projection={...c.projection,sessions:{...c.projection.sessions,[i]:{...c.projection.sessions[i],...n,id:i}}},this.#_(i))}#re(){const n=this.#e.tree?.rootId??this.#e.selected;if(!n)throw new Xe("Open a session first.");const i=this.#l.get(n)?.generation;if(!i)throw new Xe("The conversation is still loading. Try again in a moment.");return{root:n,generation:i,client:this.#c()}}#oe(n,i){if(!Aa(i).reload)return;const r=this.#s?.root===n?this.#s.client:void 0;this.#l.delete(n),r&&this.#xe(r,n)}async rewindConversation({beforeTurnId:n,requestId:i}){const{root:r,generation:c,client:u}=this.#re();try{const d=await u.request("session.rewind",{sessionId:r,requestId:i,ifGeneration:c,beforeTurnId:n},{timeoutMs:this.#n.createTimeoutMs});return this.#ve(d.session),this.#ze(r,d.generation),this.refreshSessions({quiet:!0}),d}catch(d){throw this.#oe(r,d),d}}async forkConversation({requestId:n,boundary:i,branchId:r,workspaceId:c,directory:u,title:d}){const{root:h,generation:m,client:g}=this.#re();let x;try{x=await g.request("session.fork",{sessionId:h,requestId:n,ifGeneration:m,...i?{boundary:i}:{},...r?{branchId:r}:{},...c?{workspaceId:c}:{},...d?.trim()?{title:d.trim()}:{}},{timeoutMs:this.#n.createTimeoutMs})}catch(y){throw this.#oe(h,y),y}return this.#ct(x.session,u),x}#ct(n,i){const r=n?.id;typeof r=="string"&&(i&&i!==this.#e.workspace&&this.selectWorkspace(i),this.#t(c=>({sessions:{...c.sessions,list:[n,...c.sessions.list.filter(u=>u.id!==r)]}})),this.selectSession(r),this.refreshSessions({quiet:!0}))}worktreeForkSource(){const{workspace:n,principal:i,registry:r}=this.#e;if(!n||!this.hasCapability("workspace.worktree")||!this.hasCapability("workspace.registry")||!ze(i??void 0,"workspace.manage"))return null;const c=i?.workspaceRoots?.find(u=>u.path===n)?.canonical;return r.workspaces.find(u=>!u.managedWorktree&&!u.archivedAt&&(u.directory===n||u.directory===c))??null}async forkIntoWorktree({requestId:n,worktreeKey:i=n,mappingId:r,boundary:c,branchId:u,title:d}){const h=this.worktreeForkSource();if(!h)throw new Xe("Worktrees are not available for this workspace.");let m=this.#w.get(i);if(!m){let g=this.#b.get(i);g||(g={workspaceId:h.id,mappingId:r,ifRevision:this.#e.registry.revision,requestId:`${i}:worktree`},this.#b.set(i,g));let x;try{x=await this.#c().request("workspace.worktree.create",g,{timeoutMs:this.#n.createTimeoutMs})}catch(y){throw(y?.data?.reason==="stale_revision"||qe(y).sent==="yes")&&this.#b.delete(i),y}m={id:x.workspace.id,directory:x.workspace.directory},this.#w.set(i,m),this.#b.delete(i),await this.refreshRegistry()}return this.forkConversation({requestId:n,boundary:c,branchId:u,workspaceId:m.id,directory:m.directory,title:d})}async worktreeForkDestinations(){const n=this.worktreeForkSource();return n?this.worktreeOptions(n.id):[]}driveBlock(){const{principal:n,tree:i}=this.#e;if(!n)return"Not connected.";if(!ze(n,"session.write"))return"Your access token can view sessions but not send messages.";if(!i)return;const r=n.modes;if(r){const c=nb(i.projection).find(u=>u.session?.mode&&!r.includes(u.session.mode));if(c)return`Your access token can only drive sessions in ${r.join(", ")} mode; this conversation runs in ${c.session?.mode}.`}}#ut(n,i){return this.#u(n,async()=>{if(!(n!==this.#i?.alp?.client||this.#e.selected!==i))try{await this.#dt(n,i)}finally{this.#H()}})}async#dt(n,i){const r=this.#z(i),c=r.projection.sessions[i],u=this.#e.sessions.list.find(y=>y.id===i);if(!(r.projection.closed[i]||c?.status==="closed"||!c&&u?.status==="closed"))return;const h=c?.projectRoot??u?.projectRoot??this.#e.workspace??"",m=yl(this.#e.principal??void 0,h)?.path??this.#e.workspace??h,g=c?.mode??u?.mode,x={buffer:[]};r.attaching=x,this.#a=i;try{if(await n.request("session.create",{sessionId:i,spec:{cwd:m,...g?{mode:g}:{}},resume:!0,history:"skip"},{timeoutMs:this.#n.createTimeoutMs}),n!==this.#i?.alp?.client)return;if(this.#s={client:n,root:i},this.hasCapability("session.history")&&!this.#l.has(i)){const T=await n.request("session.history",{sessionId:i},{timeoutMs:this.#n.requestTimeoutMs});if(r.attaching!==x)return;r.projection=ds(i);for(const S of T.items)r.projection=bi(r.projection,Xd(S,i));this.#X(r.projection),r.projection={...r.projection,cursor:T.tipCursor},this.#l.set(i,{generation:T.generation,olderCursor:T.olderCursor,hasOlder:T.hasOlder})}const y=r.projection.cursor,w=this.#l.get(i),k=await n.request("session.attach",{sessionId:i,...w?{after:y,generation:w.generation}:y>0?{after:y}:{}},{timeoutMs:this.#n.requestTimeoutMs});r.attaching===x&&(r.attaching=null,this.#ge(i,r,k,x.buffer))}catch(y){throw r.attaching===x&&(r.attaching=null),y}}async sendPrompt(n,i=this.#e.selected,r=[],c=[],{keepRefused:u=!1}={}){const d=String(n??"");if(!i||!d.trim()&&!r.length&&!c.length)return;const h=this.driveBlock();if(h)throw new Xe(h);const m=Ur([],r,this.#e.connection.promptImageLimits);if(m.error)throw new Xe(m.error);const g=c.length?this.#Ue(i,c):null;if(g&&!u)throw new Xe(g);const x=yd(),y={id:x,rootId:i,text:d,...r.length?{images:r}:{},...c.length?{files:c.map(w=>({...w,received:0,error:void 0})),uploadKey:x}:{},delivery:this.rootBusy(i)?"steer":"auto",status:"sending",retrySameId:!0,at:Date.now()};if(this.clearAttention(i),g){this.#t(w=>({prompts:[...w.prompts,{...y,status:"failed",error:g}]})),this.#je(y);return}this.#t(w=>({prompts:[...w.prompts,y]})),this.#je(y),await this.#$e(y)}fileGate(n=this.#e.selected){const{connection:i,principal:r}=this.#e,c=n?this.#r.get(n)?.projection.sessions[n]??this.#e.sessions.list.find(u=>u.id===n):void 0;return y2({capable:i.capabilities.includes("attachments"),permitted:ze(r??void 0,"attachments.write"),writable:ze(r??void 0,"session.write"),limits:i.attachmentLimits,session:c,known:!!n})}#Ue(n,i){return this.fileGate(n)??vl([],i,this.#e.connection.attachmentLimits??Bs).error}#ft(n,i){const r=this.#ht(n,i);this.#le.set(i.id,r);const c=()=>{this.#le.get(i.id)===r&&this.#le.delete(i.id)};return r.then(c,c),r}#le=new Map;#W(n){return this.#e.prompts.some(i=>i.id===n)}async#ht(n,i){const r=i.files??[],c=i.uploadKey??i.id,u=this.#e.connection.attachmentLimits??Bs,d=(g,x)=>this.#t(y=>({prompts:y.prompts.map(w=>w.id===i.id&&w.files?{...w,files:w.files.map((k,T)=>T===g?{...k,...x}:k)}:w)})),h=md(n),m=[...r];for(const[g,x]of r.entries())if(!x.attachmentId){if(!this.#W(i.id))throw new Mr;d(g,{error:void 0,received:x.received??0,started:!0});try{const y=await h.upload({sessionId:i.rootId,name:x.name,mimeType:x.mimeType,data:x.data,requestId:hx(c,g,x.attempt),maxChunkBytes:u.maxChunkBytes,onProgress:w=>{if(!this.#W(i.id))throw new Mr;d(g,{received:w})}});if(typeof y?.attachmentId!="string")throw new Error(`The host did not answer an attachment for ${x.name}.`);m[g]={...x,attachmentId:y.attachmentId,received:x.size,error:void 0},d(g,{attachmentId:y.attachmentId,received:x.size,error:void 0})}catch(y){if(y instanceof Mr||!this.#W(i.id))throw new Mr;const w=qe(y);throw d(g,{error:w.message}),new _x(x.name,w,wf(y)&&["closed","disconnected","send_failed"].includes(y.reason))}}return m}#mt(){for(const n of this.#e.prompts)n.status!=="failed"||!n.resumeUpload||n.resumeUpload>3||this.retryPrompt(n.id,{resume:!0}).catch(()=>{})}async#$e(n){const i=n.rootId,r=this.#P.get(i),c=(async()=>{r&&await r.catch(()=>{});const u=this.#e.prompts.find(h=>h.id===n.id);if(!u||u.status!=="sending")return;const d=this.rootBusy(i,n.id)?"steer":"auto";d!==u.delivery&&this.#t(h=>({prompts:h.prompts.map(m=>m.id===n.id?{...m,delivery:d}:m)})),await this.#He({...u,delivery:d})})();this.#P.set(i,c);try{await c}finally{this.#P.get(i)===c&&this.#P.delete(i)}}#P=new Map;rootBusy(n=this.#e.selected,i){if(!n)return!1;const r=this.#r.get(n);if(r&&n in r.projection.running||this.#x.has(n))return!0;for(const u of this.#R.get(n)??[]){if(u===i)continue;const d=r?.projection.prompts[u];if(!this.#I.has(u)&&(!d||d.errorCode==="outcome_unknown"))return!0}if(this.#e.prompts.some(u=>u.rootId===n&&u.id!==i&&u.status==="unknown")||this.#e.prompts.some(u=>u.rootId===n&&u.id!==i&&u.status==="sending"&&!u.accepted&&this.#ue.has(u.id)))return!0;const c=this.#G.get(n);if(!c||!r)return!1;for(const[u]of c){if(u===i)continue;const d=r.projection.prompts[u];if(!(d?.state==="failed"||!d&&!this.#I.has(u)||(!d?.turnId||!r.projection.turns[d.turnId])&&Date.now()-(this.#F.get(u)??0)>this.#Ye)&&(!d||!gx(r.projection,u)))return!0}return!1}async configureMode(n){const i=this.#e.selected;if(!i||!n)return;const r=this.#e.principal?.modes,c=this.driveBlock()??(r&&!r.includes(n)?`Your access token can only use ${r.join(", ")} mode.`:void 0);if(c){this.#d("error",c);return}if(!this.#e.busy.mode){this.#t(u=>({busy:{...u.busy,mode:!0}}));try{const u=await this.#c().request("session.configure",{sessionId:i,mode:n},{timeoutMs:this.#n.requestTimeoutMs}),d=this.#r.get(i),h=typeof u?.session?.mode=="string"?u.session.mode:n;d&&(d.projection={...d.projection,sessions:{...d.projection.sessions,[i]:{...d.projection.sessions[i],id:i,mode:h}}},this.#_(i)),this.#t(m=>({sessions:{...m.sessions,list:m.sessions.list.map(g=>g.id===i?{...g,mode:h}:g)}}))}catch(u){this.#d("error",qe(u).message)}finally{this.#t(u=>({busy:{...u.busy,mode:!1}}))}}}liveConfigure(){const{principal:n,connection:i,busy:r}=this.#e,c=this.#e.tree?.rootId,u=c?this.#r.get(c):void 0,d=!!c&&!!u&&(this.rootBusy(c)||Object.keys(u.projection.running).length>0||Object.keys(u.projection.questions).length>0);return H2({capabilities:i.capabilities,canWrite:ze(n??void 0,"session.write"),canTeam:ze(n??void 0,"session.team.write"),summary:c?this.#ae(c):null,closed:!!c&&!!u?.projection.closed[c],busy:d,configuring:!!r.configure||!!r.mode,generation:c?this.#l.get(c)?.generation??null:null,online:i.phase==="open",driveBlock:c?this.driveBlock():void 0})}async previewConfigure(n={}){const i=this.#e.tree?.rootId;if(!i||!this.hasCapability(ob)||!ze(this.#e.principal??void 0,"session.read"))return;const r=await this.#c().request("session.configure.preview",{sessionId:i,...n},{timeoutMs:this.#n.requestTimeoutMs});return r?.preview&&typeof r.preview=="object"?r.preview:void 0}#ce;async configureLive(n){const i=this.#e.tree?.rootId,r=Object.fromEntries(Object.entries(n).filter(([h,m])=>["model","thinking","team"].includes(h)&&typeof m=="string"&&m));if(!i||!Object.keys(r).length||this.#e.busy.configure)return;const c=this.liveConfigure(),u=r.team?c.team:r.model?c.model:c.thinking;if(!c.shown||!u.enabled){this.#d("error",u.reason??c.reason??"This change is not available now.");return}this.#t(h=>({busy:{...h.busy,configure:!0}}));const d=JSON.stringify([i,r]);try{if(r.team){const w=await this.previewConfigure(r).catch(()=>{});if(w&&!w.allowed){const k=w.reason??"runtime_unsupported";this.#d("error",ba[k]??w.message??"The host would not take this change.",lb.has(k)?{action:"new-session"}:void 0);return}}const{generation:h,client:m}=this.#re(),g=this.#ce?.key===d?this.#ce.requestId:Sf();this.#ce=void 0;let x;try{x=await m.request("session.configure",{sessionId:i,...r,requestId:g,ifGeneration:h},{timeoutMs:this.#n.createTimeoutMs})}catch(w){const k=kx(w);k.retrySame&&(this.#ce={key:d,requestId:g}),this.#oe(i,w),this.#d("error",k.message,k.newSession?{action:"new-session"}:void 0);return}const y=x?.configured;if(this.#ve(G2(x.session,y?.effective)),this.refreshSessions({quiet:!0}),y){const w=this.#e.catalog.models.find(k=>k.id===`${y.effective.runtime}:${y.effective.model}`)?.label;this.#d("info",I2(y,Ds,w))}return x}catch(h){this.#d("error",kx(h).message);return}finally{this.#t(h=>({busy:{...h.busy,configure:!1}}))}}async#He(n){const i=r=>this.#t(c=>({prompts:c.prompts.map(u=>u.id===n.id?{...u,...r}:u)}));this.#ue.add(n.id);try{const r=this.#c();!(this.#S===n.rootId&&this.#s?.client===r&&this.#s.root===n.rootId)&&this.#e.selected===n.rootId&&await this.#ut(r,n.rootId);const u=Ur([],n.images??[],this.#e.connection.promptImageLimits);if(u.error)throw new Xe(u.error);let d=n.files??[];if(d.length){const g=this.#Ue(n.rootId,d);if(g)throw new Xe(g);if(d=await this.#ft(r,n),!this.#W(n.id))return}if(!this.#W(n.id))return;i({submitted:!0});let h=this.#R.get(n.rootId);h||this.#R.set(n.rootId,h=new Set),h.add(n.id);const m=await r.request("session.prompt",{sessionId:n.rootId,clientMessageId:n.id,delivery:n.delivery,content:N2(n.text,n.images,d)},{timeoutMs:this.#n.requestTimeoutMs});if(m?.outcome==="unknown"){i({status:"unknown",error:"The host cannot tell whether the agent took the message.",retrySameId:!1});return}if(m?.outcome==="failed"){this.#Te(n.rootId,n.id),i({status:"failed",error:m.error?.message?`The agent did not take the message: ${m.error.message}`:"The agent did not take the message.",retrySameId:!1});return}this.#I.add(n.id),this.#xt(),this.#Ge(n)?this.#we(n.id):i({accepted:!0})}catch(r){if(this.#Ge(n))return this.#we(n.id);if(r instanceof Mr)return;if(r instanceof _x){const u=r.dropped,d=this.#e.prompts.find(h=>h.id===n.id)?.resumeUpload??0;i({status:"failed",error:`Could not upload ${r.fileName}: ${r.failure.message}${u?" The upload continues when the connection is back.":""}`,retrySameId:!0,resumeUpload:u?d+1:0});return}const c=qe(r);n.files?.length&&(c.reason==="attachment_unavailable"||c.code===1001)&&await this.#pt(n,r),c.sent==="no"?i({status:"failed",error:c.message,retrySameId:!0}):c.sent==="yes"&&c.reason!=="outcome_unknown"?i({status:"failed",error:c.message,retrySameId:!1}):i({status:"unknown",error:c.message,retrySameId:c.reason!=="outcome_unknown"})}finally{this.#ue.delete(n.id),this.#e.prompts.find(c=>c.id===n.id)?.status==="failed"?this.#Te(n.rootId,n.id):this.#E(n.rootId)}}async#pt(n,i){const r=i?.data,u=(this.#e.prompts.find(h=>h.id===n.id)?.files??[]).filter(h=>typeof h.attachmentId=="string");let d;if(r?.reason==="attachment_unavailable"){const h=u.filter(m=>m.attachmentId===r?.attachmentId);d=new Set((h.length?h:u).map(m=>m.attachmentId))}else{let h;try{h=md(this.#c())}catch{return}const m=await Promise.all(u.map(g=>h.get(g.attachmentId).then(()=>!1,x=>qe(x).code===1001)));d=new Set(u.filter((g,x)=>m[x]).map(g=>g.attachmentId))}d.size&&this.#t(h=>({prompts:h.prompts.map(m=>m.id===n.id&&m.files?{...m,files:m.files.map(g=>g.attachmentId&&d.has(g.attachmentId)?{...g,attachmentId:void 0,received:0,started:!1,attempt:(g.attempt??0)+1}:g)}:m)}))}#ue=new Set;#Ge(n){const i=this.#r.get(n.rootId);return!!i&&xx(i.projection).has(n.id)}#we(n){this.#t(i=>({prompts:i.prompts.filter(r=>r.id!==n)}))}async retryPrompt(n,{resume:i=!1}={}){const r=this.#e.prompts.find(d=>d.id===n);if(!r||r.status==="sending")return;const c=i?r.resumeUpload:0,u=r.retrySameId?{...r,status:"sending",error:void 0,accepted:!1,resumeUpload:c}:{...r,id:yd(),delivery:this.rootBusy(r.rootId,r.id)?"steer":"auto",status:"sending",error:void 0,retrySameId:!0,accepted:!1,resumeUpload:c,...r.files?.length?{uploadKey:r.uploadKey??r.id}:{}};if(this.#t(d=>({prompts:d.prompts.map(h=>h.id===n?u:h)})),u.id===r.id)return this.#He(u);this.#Ie(r.rootId,r.id),this.#je(u),await this.#$e(u)}#Ie(n,i){this.#G.get(n)?.delete(i),this.#F.delete(i),this.#I.delete(i)}discardPrompt(n){const i=this.#e.prompts.find(r=>r.id===n);i&&this.#Ie(i.rootId,n),this.#we(n),i&&this.#gt(i)}#gt(n){const i=(n.files??[]).map((u,d)=>({file:u,slot:d})).filter(({file:u})=>u.started&&!u.attachmentId);if(!i.length)return;const r=n.uploadKey??n.id,c=this.#le.get(n.id)??Promise.resolve();this.#ke=this.#ke.then(()=>c.catch(()=>{})).then(async()=>{let u;try{u=this.#c()}catch{return}const d=md(u);for(const{file:h,slot:m}of i)await S2(d,{sessionId:n.rootId,file:h,requestId:hx(r,m,h.attempt),digest:By})})}#ke=Promise.resolve();abandonedUploads(){return this.#ke}#G=new Map;#je(n){let i=this.#G.get(n.rootId);i||this.#G.set(n.rootId,i=new Map),i.set(n.id,this.#r.get(n.rootId)?.projection.reset??0),this.#F.set(n.id,Date.now())}#F=new Map;#I=new Set;#q;get#Ye(){return this.#n.busyUnseenMs}#xt(){this.#q!==void 0&&clearTimeout(this.#q),this.#q=setTimeout(()=>{this.#q=void 0,this.#i&&this.#t(n=>({busy:{...n.busy}}))},this.#Ye+100)}#Ve(n,i){const r=this.#G.get(n);if(!r)return!0;for(const[c,u]of r){const d=i.historyUnavailable&&i.reset>u&&Object.keys(i.running).length===0;(gx(i,c)||d)&&(r.delete(c),this.#F.delete(c),this.#I.delete(c))}return r.size===0}queuePrompt(n){const i=this.#e.selected,r=String(n??"");if(!i||!r.trim())return;const c=this.driveBlock();if(c)throw new Xe(c);this.#t(u=>({queued:[...u.queued,{id:yd(),rootId:i,text:r}]}))}editQueued(n){const i=this.#e.queued.find(r=>r.id===n);return i?(this.#t(r=>({queued:r.queued.filter(c=>c.id!==n)})),i.text):null}async sendQueuedNow(n){const i=this.#e.queued.find(r=>r.id===n);!i||i.rootId!==this.#e.selected||(this.#t(r=>({queued:r.queued.filter(c=>c.id!==n)})),await this.sendPrompt(i.text))}#Se=!1;#yt(){this.#Se||(this.#Se=!0,queueMicrotask(()=>{this.#Se=!1,this.#bt()}))}#bt(){const{selected:n,tree:i,connection:r,prompts:c,queued:u}=this.#e;if(!n||r.phase!=="open"||!i||i.rootId!==n||i.status!=="attached"||n in i.projection.running||c.some(h=>h.rootId===n)||!this.#Ve(n,i.projection)||this.driveBlock())return;const d=u.find(h=>h.rootId===n);d&&this.sendQueuedNow(d.id).catch(()=>{})}#R=new Map;#x=new Map;async interrupt(){const n=this.#e.selected;if(!n)return;const i=this.#x.get(n);if(i)return i.attempts=0,i.exhausted=!1,i.observer?.state==="stopped"&&this.#Ke(n,i),this.#E(n),i.promise;if(!this.hasCapability("session.interrupt.turn")){this.#d("error","This host cannot safely stop a specific turn. Upgrade the host to use Stop.");return}const r=this.#r.get(n)?.projection,c=r?.running[n],u=c?void 0:[...new Set([...this.#R.get(n)??[],...this.#e.prompts.filter(x=>x.rootId===n&&x.status!=="failed").map(x=>x.id)])].find(x=>{const y=r?.prompts[x];return!y||y.state==="failed"&&y.errorCode==="outcome_unknown"||y.state==="accepted"&&(!y.turnId||r?.turns[y.turnId]!=="ended")});if(!c&&!u)return;const d=this.#e.prompts.find(x=>x.id===u);if(d&&!d.submitted){this.discardPrompt(d.id),this.#d("info","Message canceled before sending.");return}let h=()=>{};const m=new Promise(x=>{h=()=>x(void 0)}),g={...c?{turnId:c}:{messageId:u},done:h,promise:m};return this.#x.set(n,g),this.#Ke(n,g),this.#t(x=>({busy:{...x.busy,interrupt:!0}})),c||this.#d("info",Ex),this.#E(n),m}#Ke(n,i){const r=this.#i,c=this.#e.principal?.id,{open:u,backoff:d,stableMs:h,requestTimeoutMs:m}=this.#n,g=this.#e.connection.gateway,x=this.#h;let y=null,w=!1;i.observed??=this.#r.get(n)?.projection??ds(n);const k=()=>this.#i===r&&this.#x.get(n)===i,T=sx({connect:async({signal:S})=>{const E=await u({url:g,token:x,signal:S});if(!k())throw E.transport.close(),new Xe("This Stop is no longer waiting.");if(E.principal.id!==c||!ze(E.principal,"session.read")||!ze(E.principal,"session.write"))throw E.transport.close(),new wa("Stop access changed. Reconnect with the original access before trying again.");return E.transport},onConnect:async(S,{signal:E})=>{const q=await nx(S,Ax,{signal:E,timeoutMs:m}),L=Array.isArray(q.capabilities)?q.capabilities:[];if(!L.includes("session.interrupt.turn")||!L.includes("attach.after"))throw new Xe("This host cannot safely observe and stop a specific turn.");y=[];const M=await S.request("session.attach",{sessionId:n,after:i.observed?.cursor??0},{signal:E,timeoutMs:m});k()&&(i.observed=px(i.observed??ds(n),M,y),i.observed={...i.observed,cursor:Math.max(i.observed.cursor,M.cursor??0)},y=null,this.#E(n))},onDisconnect:()=>{y=null},shouldRetry:S=>!qe(S).terminal&&!pd(S),backoff:d,stableMs:h,client:{timeoutMs:m}});i.observer=T,T.onEvent(S=>{if(!(!k()||S.sessionId!==n)){if(y){y.push(S);return}i.observed=bi(i.observed??ds(n),S),this.#E(n)}}),T.onState((S,E)=>{k()&&(S==="open"?(w&&(i.attempts=0,i.exhausted=!1),w=!0,this.#E(n)):S==="stopped"&&(this.#ye(n),i.exhausted=!0,this.#e.selected===n&&this.#t(q=>({busy:{...q.busy,interrupt:!1}})),this.#d("error",`Stop is unresolved: ${qe(E).message}`)))})}#Ne(n){const i=this.#x.get(n);i&&(this.#x.delete(n),this.#ye(n),clearTimeout(i.retry),i.observer?.stop(),i.done(),this.#e.notice?.text===Ex&&this.#t({notice:null}),this.#e.selected===n&&this.#t(r=>({busy:{...r.busy,interrupt:!1}})))}#Te(n,i){this.#R.get(n)?.delete(i),this.#x.get(n)?.messageId===i&&(this.#d("info","The agent did not take that message. There is no turn to stop."),this.#Ne(n))}#E(n){const i=this.#x.get(n);if(!i)return;const r=this.#r.get(n)?.projection,c=[i.observed,r].filter(m=>!!m).sort((m,g)=>(g?.cursor??0)-(m?.cursor??0)),u=i.messageId?c.map(m=>m?.prompts[i.messageId]).find(Boolean):void 0;if(u?.state==="failed"&&u.errorCode!=="outcome_unknown"){this.#Te(n,i.messageId);return}if(!i.turnId&&u?.state==="accepted"&&u.turnId&&(i.turnId=u.turnId),i.turnId&&c.some(m=>m?.turns[i.turnId]==="ended")){this.#Ne(n);return}const d=i.observer?.state==="open"?i.observer.client:void 0,h=d??(this.#e.connection.phase==="open"?this.#i?.alp?.client:void 0);if(!(!i.turnId||i.sending||i.exhausted||i.observer?.state==="stopped"||!h)){if(!d&&!this.hasCapability("session.interrupt.turn")){i.warned||(i.warned=!0,this.#d("error","Stop is still waiting: this host cannot safely stop a specific turn."));return}clearTimeout(i.retry),i.sending=!0,i.attempts=(i.attempts??0)+1,this.#e.selected===n&&this.#t(m=>({busy:{...m.busy,interrupt:!0}})),h.request("session.interrupt",{sessionId:n,turnId:i.turnId},{timeoutMs:this.#n.requestTimeoutMs}).then(m=>{this.#x.get(n)===i&&typeof m?.interrupted=="boolean"&&this.#Ne(n)},m=>{this.#x.get(n)===i&&this.#d("error",`Stop is still waiting for this turn's outcome: ${qe(m).message}`)}).finally(()=>{i.sending=!1,this.#x.get(n)===i&&((i.attempts??0)<3?i.retry=setTimeout(()=>this.#E(n),250):(i.exhausted=!0,this.#e.selected===n&&this.#t(m=>({busy:{...m.busy,interrupt:!1}})),this.#d("error","Stop is unresolved. Try Stop again to check this same turn.")))})}}async answerQuestion(n,{text:i,dismiss:r=!1}){const c=`question:${n}`;this.#t(u=>({busy:{...u.busy,[c]:!0}}));try{await this.#c().request("question.answer",r?{questionId:n,dismiss:!0,reason:"Declined in ALP web"}:{questionId:n,text:String(i??"")});const u=this.#e.selected,d=u?this.#r.get(u):void 0;if(d&&u&&d.projection.questions[n]){const h={...d.projection.questions};delete h[n],d.projection={...d.projection,questions:h},this.#_(u)}this.refreshAttention()}catch(u){const d=qe(u);this.#d("error",d.code===1001?"That question is no longer waiting for an answer.":d.message)}finally{this.#t(u=>({busy:{...u.busy,[c]:!1}}))}}setTasksVisible(n){this.#Ae=Math.max(0,this.#Ae+(n?1:-1));const i=this.#Ae>0;this.#e.tasks.visible!==i&&(this.#t(r=>({tasks:{...r.tasks,visible:i}})),i&&this.refreshTasks())}#Ae=0;tasksBlock(){const{principal:n}=this.#e;if(!n)return"Not connected.";if(!this.hasCapability("task"))return"This host does not offer tasks.";if(!ze(n,"project.read"))return"Your access token cannot read this workspace's tasks."}async refreshTasks({quiet:n=!1}={}){const i=this.#e.workspace;if(!i||this.tasksBlock())return;const r=this.#o;n||this.#t(c=>({tasks:{...c.tasks,status:c.tasks.rows.length?c.tasks.status:"loading",error:void 0}}));try{const c=await this.#c().request("task.list",{projectRoot:i});if(r!==this.#o||n&&c?.revision&&c.revision===this.#e.tasks.revision)return;const u=Array.isArray(c?.tasks)?c.tasks:[];this.#t(d=>({tasks:{...d.tasks,status:"ready",rows:u,revision:c?.revision,unreadable:Array.isArray(c?.unreadable)?c.unreadable.length:0,error:void 0,creates:this.#vt(d.tasks.creates,u)}}))}catch(c){if(r!==this.#o)return;(!n||this.#e.tasks.status!=="ready")&&this.#t(u=>({tasks:{...u.tasks,status:"error",error:qe(c)}}))}}#vt(n,i){return n.map(r=>{if(r.status!=="unknown")return r;const c=i.find(u=>u.title===r.title&&u.status!=="closed");return c?{...r,match:c.id}:{...r,match:void 0}})}async createTask({title:n,priority:i=2}){const r=this.#e.workspace,c=String(n??"").trim();if(!r||!c)return;const u={requestId:Xk(),title:c,priority:i,status:"creating"};this.#t(d=>({tasks:{...d.tasks,creates:[...d.tasks.creates,u],message:void 0}})),await this.#Xe(u)}async#Xe(n){const i=this.#e.workspace,r=this.#o,c=u=>this.#t(d=>({tasks:{...d.tasks,creates:u?d.tasks.creates.map(h=>h.requestId===n.requestId?{...h,...u}:h):d.tasks.creates.filter(h=>h.requestId!==n.requestId)}}));try{const u=await this.#c().request("task.create",{projectRoot:i,title:n.title,priority:n.priority,requestId:n.requestId});if(r!==this.#o)return;c(null),this.#t(d=>({tasks:{...d.tasks,message:{level:"info",text:u?.duplicate?`Task ${u.id} already existed for this request.`:`Created task ${u?.id??""}.`}}})),await this.refreshTasks({quiet:!1})}catch(u){if(r!==this.#o)return;const d=qe(u);d.sent==="unknown"||d.code===1e3?(c({status:"unknown",error:`${d.message} The list was read again: check it before creating this task again.`}),await this.refreshTasks()):c({status:"failed",error:d.message})}}async retryTaskCreate(n){const i=this.#e.tasks.creates.find(c=>c.requestId===n);if(!i||i.status==="creating")return;const r={...i,status:"creating",error:void 0,match:void 0};this.#t(c=>({tasks:{...c.tasks,creates:c.tasks.creates.map(u=>u.requestId===n?r:u)}})),await this.#Xe(r)}dismissTaskCreate(n){this.#t(i=>({tasks:{...i.tasks,creates:i.tasks.creates.filter(r=>r.requestId!==n)}}))}async changeTask(n,i){const r=this.#e.workspace;if(!r||!n?.id)return;const c=this.#o;this.#t(u=>({tasks:{...u.tasks,busy:{...u.tasks.busy,[n.id]:!0},message:void 0}}));try{const u=this.#c();"gate"in i?await u.request("task.gate.resolve",{projectRoot:r,id:n.id,gate:i.gate,ifRev:n.rev}):await u.request("task.update",{projectRoot:r,id:n.id,action:i.action,...i.action==="close"?{note:"Closed in ALP web"}:{},ifRev:n.rev})}catch(u){if(c!==this.#o)return;const d=qe(u);this.#t(h=>({tasks:{...h.tasks,message:{level:"error",text:d.sent==="unknown"?`${d.message} The list was read again.`:d.message}}}))}finally{c===this.#o&&(this.#t(u=>({tasks:{...u.tasks,busy:{...u.tasks.busy,[n.id]:!1}}})),await this.refreshTasks())}}setSendBehavior(n){this.#de({sendBehavior:n})}setTheme(n){this.#de({theme:n})}#de(n){const i=ki(JSON.stringify({...this.#e.preferences,...n,v:1}));this.#t({preferences:i}),Z2(this.#n.storage,i)}#wt(n){this.#de({newSession:W2(this.#e.preferences.newSession,n)})}resetPreferences(){this.#de(ki(null))}reloadPreferences(){const n=jx(this.#n.storage);JSON.stringify(n)!==JSON.stringify(this.#e.preferences)&&this.#t({preferences:n})}previewBlock(){const{principal:n,workspace:i}=this.#e;if(!n)return"Not connected.";if(!ze(n,"session.read"))return"Your access token cannot read sessions, so the host cannot say what would run.";if(!i)return"Choose a workspace first."}async previewSession(n,{signal:i}={}){const r=this.previewBlock();if(r)throw new Xe(r);const c=await this.#c().request("session.preview",{spec:{...n,cwd:this.#e.workspace}},{timeoutMs:this.#n.requestTimeoutMs,...i?{signal:i}:{}}),u=_2(c);if(!u)throw new Xe("The host answered the preview in a form this app does not read.");return u}libraryBlock(){const{principal:n,workspace:i}=this.#e;if(!n)return"Not connected.";if(!this.hasCapability("library"))return"This host does not offer its library.";if(!ze(n,"project.read"))return"Your access token cannot read this workspace's configuration.";if(!i)return"Choose a workspace first."}async listLibrary(n){const i=this.libraryBlock();if(i)throw new Xe(i);const r=await this.#c().request("library.list",{kind:n,projectRoot:this.#e.workspace},{timeoutMs:this.#n.requestTimeoutMs});return(Array.isArray(r?.entries)?r.entries:[]).filter(c=>c&&typeof c.name=="string")}async getLibraryEntry(n,i){const r=this.libraryBlock();if(r)throw new Xe(r);const c=await this.#c().request("library.get",{kind:n,name:i,projectRoot:this.#e.workspace},{timeoutMs:this.#n.requestTimeoutMs});if(!c||typeof c!="object"||!c.content||typeof c.content!="object"||Array.isArray(c.content))throw new Xe("The host answered library.get in a form this app does not read.");const u=d=>Array.isArray(d)?d.filter(h=>typeof h=="string"):[];return{kind:typeof c.kind=="string"?c.kind:n,name:typeof c.name=="string"?c.name:i,source:typeof c.source=="string"?c.source:"unknown",...typeof c.overrides=="string"?{overrides:c.overrides}:{},content:c.content,...typeof c.revision=="string"||c.revision===null?{revision:c.revision}:{},usedBy:u(c.usedBy),...Array.isArray(c.librarySkills)?{librarySkills:u(c.librarySkills)}:{},secrets:u(c.secrets)}}libraryWriteBlock(n){const i=this.libraryBlock();return i||(ze(this.#e.principal??void 0,"library.write")?this.hasCapability("library.project.write")?["agents","skills"].includes(n)?null:"Executable and administrative configuration is edited on the host.":"Update the host to support safe project instruction editing.":"This token does not grant library.write.")}async writeLibrary(n,i,r){const c=this.libraryWriteBlock(i);if(c)throw new Xe(c);return this.#c().request(`library.${n}`,{...r,kind:i,scope:"project",projectRoot:this.#e.workspace},{timeoutMs:this.#n.requestTimeoutMs})}async loadSettings(){const n=this.#e.principal;if(!n)return;const i=this.#o;this.#t(r=>({settings:{...r.settings,status:"loading",error:void 0}}));try{const r=this.#c(),[c,u]=await Promise.all([this.hasCapability("settings.language")&&ze(n,"session.read")?r.request("settings.language.get",{}).catch(()=>{}):void 0,this.hasCapability("library")&&ze(n,"session.read")?r.request("library.models",{}).catch(()=>{}):void 0]);if(i!==this.#o)return;this.#t({settings:{status:"ready",...c&&typeof c.applies=="string"?{language:c}:{},models:yx(u?.models)}})}catch(r){if(i!==this.#o)return;this.#t(c=>({settings:{...c.settings,status:"error",error:qe(r)}}))}}}const lj=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fb=(...s)=>s.filter((n,i,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===i).join(" ").trim();var cj={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"};const uj=v.forwardRef(({color:s="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:c="",children:u,iconNode:d,...h},m)=>v.createElement("svg",{ref:m,...cj,width:n,height:n,stroke:s,strokeWidth:r?Number(i)*24/Number(n):i,className:fb("lucide",c),...h},[...d.map(([g,x])=>v.createElement(g,x)),...Array.isArray(u)?u:[u]]));const ae=(s,n)=>{const i=v.forwardRef(({className:r,...c},u)=>v.createElement(uj,{ref:u,iconNode:n,className:fb(`lucide-${lj(s)}`,r),...c}));return i.displayName=`${s}`,i};const $l=ae("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const dj=ae("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);const fj=ae("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);const hb=ae("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);const Cf=ae("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const mb=ae("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);const Td=ae("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const Mf=ae("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);const hj=ae("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);const mj=ae("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const Sa=ae("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);const pj=ae("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);const $r=ae("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"}]]);const gj=ae("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);const Hl=ae("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const An=ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const pb=ae("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const Vn=ae("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Is=ae("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const zf=ae("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const xj=ae("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);const gb=ae("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const xb=ae("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);const yj=ae("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const bj=ae("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const yb=ae("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);const vj=ae("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const bb=ae("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const qs=ae("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Fd=ae("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const wj=ae("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);const kj=ae("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);const vb=ae("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const jj=ae("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const Zr=ae("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Sj=ae("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);const wb=ae("FileDiff",[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);const _f=ae("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"}]]);const kb=ae("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const Rx=ae("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"}]]);const Nj=ae("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"}]]);const jb=ae("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);const Jd=ae("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const Tj=ae("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const Sb=ae("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"}]]);const Rf=ae("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);const Nb=ae("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);const Tb=ae("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);const Lf=ae("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const Aj=ae("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const Of=ae("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const Ej=ae("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"}]]);const Cj=ae("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const Mj=ae("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"}]]);const Si=ae("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"}]]);const zj=ae("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"}]]);const Gl=ae("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Na=ae("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"}]]);const _j=ae("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Rj=ae("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);const Lx=ae("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"}]]);const Lj=ae("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"}]]);const Oj=ae("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);const Dj=ae("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const qj=ae("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);const Wr=ae("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);const Ab=ae("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const Ea=ae("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"}]]);const Bj=ae("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);const Uj=ae("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);const $j=ae("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"}]]);const fs=ae("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Ca=ae("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);const Pr=ae("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const Hj=ae("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"}]]);const Eb=ae("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);const Gj=ae("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);const Ni=ae("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);const Cb=ae("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const Ij=ae("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);const Df=ae("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Mb=ae("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const Il=ae("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Yj=ae("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const Vj=ae("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const Kj=ae("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);const Xj=ae("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const Yl=ae("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const Vl=ae("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"}]]);const Qj=ae("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const Zj=ae("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);const qf=ae("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const Wj=ae("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const zb=ae("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const _b=ae("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"}]]);const Al=ae("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);const Pj=ae("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);const Fj=ae("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"}]]);const Jj=ae("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"}]]);const Zt=ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var eS=Object.defineProperty,Bf=(s,n)=>eS(s,"name",{value:n,configurable:!0});function ef(s,n){if(typeof s=="function")return s(n);s!=null&&(s.current=n)}Bf(ef,"setRef");function Rb(...s){return n=>{let i=!1;const r=s.map(c=>{const u=ef(c,n);return!i&&typeof u=="function"&&(i=!0),u});if(i)return()=>{for(let c=0;c<r.length;c++){const u=r[c];typeof u=="function"?u():ef(s[c],null)}}}}Bf(Rb,"composeRefs");function Lb(...s){return v.useCallback(Rb(...s),s)}Bf(Lb,"useComposedRefs");var tS=Object.defineProperty,mn=(s,n)=>tS(s,"name",{value:n,configurable:!0});function Ob(s){const n=v.forwardRef((i,r)=>{let{children:c,...u}=i,d=null,h=!1;const m=[];c=Hb(c),v.Children.forEach(c,w=>{if(Ub(w)){h=!0;const k=w;let T="child"in k.props?k.props.child:k.props.children;for(;Uf(T)&&typeof El=="function";)T=El(T._payload);d=iS(k,T),m.push(d?.props?.children)}else m.push(w)}),d?d=v.cloneElement(d,void 0,m):!h&&v.Children.count(c)===1&&v.isValidElement(c)&&(d=c);const g=d?Bb(d):void 0,x=Lb(r,g);if(!d){if(c||c===0)throw new Error(h?oS(s):rS(s));return c}const y=qb(u,d.props??{});return d.type!==v.Fragment&&(y.ref=r?x:g),v.cloneElement(d,y)});return n.displayName=`${s}.Slot`,n}mn(Ob,"createSlot");var nS=Ob("Slot"),Db=Symbol.for("radix.slottable");function sS(s){const n=mn(i=>"child"in i?i.children(i.child):i.children,"Slottable");return n.displayName=`${s}.Slottable`,n.__radixId=Db,n}mn(sS,"createSlottable");var iS=mn((s,n)=>"child"in s.props?v.isValidElement(n)?v.cloneElement(n,void 0,s.props.children(n.props.children)):null:v.isValidElement(n)?n:null,"getSlottableElementFromSlottable");function qb(s,n){const i={...n};for(const r in n){const c=s[r],u=n[r];/^on[A-Z]/.test(r)?c&&u?i[r]=(...h)=>{const m=u(...h);return c(...h),m}:c&&(i[r]=c):r==="style"?i[r]={...c,...u}:r==="className"?i[r]=[c,u].filter(Boolean).join(" "):r==="aria-describedby"&&(i[r]=Gb(u,c))}return{...s,...i}}mn(qb,"mergeProps");function Bb(s){let n=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,i=n&&"isReactWarning"in n&&n.isReactWarning;return i?s.ref:(n=Object.getOwnPropertyDescriptor(s,"ref")?.get,i=n&&"isReactWarning"in n&&n.isReactWarning,i?s.props.ref:s.props.ref||s.ref)}mn(Bb,"getElementRef");function Ub(s){return v.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===Db}mn(Ub,"isSlottable");var aS=Symbol.for("react.lazy");function Uf(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===aS&&"_payload"in s&&$b(s._payload)}mn(Uf,"isLazyComponent");function $b(s){return typeof s=="object"&&s!==null&&"then"in s}mn($b,"isPromiseLike");function Hb(s){let n=s;for(;Uf(n)&&typeof El=="function";)n=El(n._payload);return n}mn(Hb,"useUnwrappedLazy");function Gb(...s){const n=new Set;for(const i of s)if(typeof i=="string")for(const r of String(i).trim().split(/\s+/))r&&n.add(r);return n.size>0?Array.from(n).join(" "):void 0}mn(Gb,"concatAriaDescribedby");var rS=mn(s=>`${s} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),oS=mn(s=>`${s} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),El=Iw[" use ".trim().toString()];function Ib(s){var n,i,r="";if(typeof s=="string"||typeof s=="number")r+=s;else if(typeof s=="object")if(Array.isArray(s)){var c=s.length;for(n=0;n<c;n++)s[n]&&(i=Ib(s[n]))&&(r&&(r+=" "),r+=i)}else for(i in s)s[i]&&(r&&(r+=" "),r+=i);return r}function Yb(){for(var s,n,i=0,r="",c=arguments.length;i<c;i++)(s=arguments[i])&&(n=Ib(s))&&(r&&(r+=" "),r+=n);return r}const Ox=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,Dx=Yb,lS=(s,n)=>i=>{var r;if(n?.variants==null)return Dx(s,i?.class,i?.className);const{variants:c,defaultVariants:u}=n,d=Object.keys(c).map(g=>{const x=i?.[g],y=u?.[g];if(x===null)return null;const w=Ox(x)||Ox(y);return c[g][w]}),h=i&&Object.entries(i).reduce((g,x)=>{let[y,w]=x;return w===void 0||(g[y]=w),g},{}),m=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((g,x)=>{let{class:y,className:w,...k}=x;return Object.entries(k).every(T=>{let[S,E]=T;return Array.isArray(E)?E.includes({...u,...h}[S]):{...u,...h}[S]===E})?[...g,y,w]:g},[]);return Dx(s,d,m,i?.class,i?.className)},cS=(s,n)=>{const i=new Array(s.length+n.length);for(let r=0;r<s.length;r++)i[r]=s[r];for(let r=0;r<n.length;r++)i[s.length+r]=n[r];return i},uS=(s,n)=>({classGroupId:s,validator:n}),Vb=(s=new Map,n=null,i)=>({nextPart:s,validators:n,classGroupId:i}),Cl="-",qx=[],dS="arbitrary..",fS=s=>{const n=mS(s),{conflictingClassGroups:i,conflictingClassGroupModifiers:r}=s;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return hS(d);const h=d.split(Cl),m=h[0]===""&&h.length>1?1:0;return Kb(h,m,n)},getConflictingClassGroupIds:(d,h)=>{if(h){const m=r[d],g=i[d];return m?g?cS(g,m):m:g||qx}return i[d]||qx}}},Kb=(s,n,i)=>{if(s.length-n===0)return i.classGroupId;const c=s[n],u=i.nextPart.get(c);if(u){const g=Kb(s,n+1,u);if(g)return g}const d=i.validators;if(d===null)return;const h=n===0?s.join(Cl):s.slice(n).join(Cl),m=d.length;for(let g=0;g<m;g++){const x=d[g];if(x.validator(h))return x.classGroupId}},hS=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=s.slice(1,-1),i=n.indexOf(":"),r=n.slice(0,i);return r?dS+r:void 0})(),mS=s=>{const{theme:n,classGroups:i}=s;return pS(i,n)},pS=(s,n)=>{const i=Vb();for(const r in s){const c=s[r];$f(c,i,r,n)}return i},$f=(s,n,i,r)=>{const c=s.length;for(let u=0;u<c;u++){const d=s[u];gS(d,n,i,r)}},gS=(s,n,i,r)=>{if(typeof s=="string"){xS(s,n,i);return}if(typeof s=="function"){yS(s,n,i,r);return}bS(s,n,i,r)},xS=(s,n,i)=>{const r=s===""?n:Xb(n,s);r.classGroupId=i},yS=(s,n,i,r)=>{if(vS(s)){$f(s(r),n,i,r);return}n.validators===null&&(n.validators=[]),n.validators.push(uS(i,s))},bS=(s,n,i,r)=>{const c=Object.entries(s),u=c.length;for(let d=0;d<u;d++){const[h,m]=c[d];$f(m,Xb(n,h),i,r)}},Xb=(s,n)=>{let i=s;const r=n.split(Cl),c=r.length;for(let u=0;u<c;u++){const d=r[u];let h=i.nextPart.get(d);h||(h=Vb(),i.nextPart.set(d,h)),i=h}return i},vS=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,wS=s=>{if(s<1)return{get:()=>{},set:()=>{}};let n=0,i=Object.create(null),r=Object.create(null);const c=(u,d)=>{i[u]=d,n++,n>s&&(n=0,r=i,i=Object.create(null))};return{get(u){let d=i[u];if(d!==void 0)return d;if((d=r[u])!==void 0)return c(u,d),d},set(u,d){u in i?i[u]=d:c(u,d)}}},tf="!",Bx=":",kS=[],Ux=(s,n,i,r,c)=>({modifiers:s,hasImportantModifier:n,baseClassName:i,maybePostfixModifierPosition:r,isExternal:c}),jS=s=>{const{prefix:n,experimentalParseClassName:i}=s;let r=c=>{const u=[];let d=0,h=0,m=0,g;const x=c.length;for(let S=0;S<x;S++){const E=c[S];if(d===0&&h===0){if(E===Bx){u.push(c.slice(m,S)),m=S+1;continue}if(E==="/"){g=S;continue}}E==="["?d++:E==="]"?d--:E==="("?h++:E===")"&&h--}const y=u.length===0?c:c.slice(m);let w=y,k=!1;y.endsWith(tf)?(w=y.slice(0,-1),k=!0):y.startsWith(tf)&&(w=y.slice(1),k=!0);const T=g&&g>m?g-m:void 0;return Ux(u,k,w,T)};if(n){const c=n+Bx,u=r;r=d=>d.startsWith(c)?u(d.slice(c.length)):Ux(kS,!1,d,void 0,!0)}if(i){const c=r;r=u=>i({className:u,parseClassName:c})}return r},SS=s=>{const n=new Map;return s.orderSensitiveModifiers.forEach((i,r)=>{n.set(i,1e6+r)}),i=>{const r=[];let c=[];for(let u=0;u<i.length;u++){const d=i[u],h=d[0]==="[",m=n.has(d);h||m?(c.length>0&&(c.sort(),r.push(...c),c=[]),r.push(d)):c.push(d)}return c.length>0&&(c.sort(),r.push(...c)),r}},NS=s=>({cache:wS(s.cacheSize),parseClassName:jS(s),sortModifiers:SS(s),postfixLookupClassGroupIds:TS(s),...fS(s)}),TS=s=>{const n=Object.create(null),i=s.postfixLookupClassGroups;if(i)for(let r=0;r<i.length;r++)n[i[r]]=!0;return n},AS=/\s+/,ES=(s,n)=>{const{parseClassName:i,getClassGroupId:r,getConflictingClassGroupIds:c,sortModifiers:u,postfixLookupClassGroupIds:d}=n,h=[],m=s.trim().split(AS);let g="";for(let x=m.length-1;x>=0;x-=1){const y=m[x],{isExternal:w,modifiers:k,hasImportantModifier:T,baseClassName:S,maybePostfixModifierPosition:E}=i(y);if(w){g=y+(g.length>0?" "+g:g);continue}let q=!!E,L;if(q){const V=S.substring(0,E);L=r(V);const A=L&&d[L]?r(S):void 0;A&&A!==L&&(L=A,q=!1)}else L=r(S);if(!L){if(!q){g=y+(g.length>0?" "+g:g);continue}if(L=r(S),!L){g=y+(g.length>0?" "+g:g);continue}q=!1}const M=k.length===0?"":k.length===1?k[0]:u(k).join(":"),R=T?M+tf:M,$=R+L;if(h.indexOf($)>-1)continue;h.push($);const _=c(L,q);for(let V=0;V<_.length;++V){const A=_[V];h.push(R+A)}g=y+(g.length>0?" "+g:g)}return g},CS=(...s)=>{let n=0,i,r,c="";for(;n<s.length;)(i=s[n++])&&(r=Qb(i))&&(c&&(c+=" "),c+=r);return c},Qb=s=>{if(typeof s=="string")return s;let n,i="";for(let r=0;r<s.length;r++)s[r]&&(n=Qb(s[r]))&&(i&&(i+=" "),i+=n);return i},MS=(s,...n)=>{let i,r,c,u;const d=m=>{const g=n.reduce((x,y)=>y(x),s());return i=NS(g),r=i.cache.get,c=i.cache.set,u=h,h(m)},h=m=>{const g=r(m);if(g)return g;const x=ES(m,i);return c(m,x),x};return u=d,(...m)=>u(CS(...m))},zS=[],Mt=s=>{const n=i=>i[s]||zS;return n.isThemeGetter=!0,n.themeKey=s,n},Zb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Wb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_S=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,RS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,DS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Os=s=>_S.test(s),Ge=s=>!!s&&!Number.isNaN(Number(s)),Hn=s=>!!s&&Number.isInteger(Number(s)),Ad=s=>s.endsWith("%")&&Ge(s.slice(0,-1)),os=s=>RS.test(s),Pb=()=>!0,BS=s=>LS.test(s)&&!OS.test(s),Hf=()=>!1,US=s=>DS.test(s),$S=s=>qS.test(s),HS=s=>!be(s)&&!we(s),GS=s=>s.startsWith("@container")&&(s[10]==="/"&&s[11]!==void 0||s[11]==="s"&&s[16]!==void 0&&s.startsWith("-size/",10)||s[11]==="n"&&s[18]!==void 0&&s.startsWith("-normal/",10)),IS=s=>Ys(s,e0,Hf),be=s=>Zb.test(s),hi=s=>Ys(s,t0,BS),$x=s=>Ys(s,PS,Ge),YS=s=>Ys(s,s0,Pb),VS=s=>Ys(s,n0,Hf),Hx=s=>Ys(s,Fb,Hf),KS=s=>Ys(s,Jb,$S),hl=s=>Ys(s,i0,US),we=s=>Wb.test(s),zr=s=>Ei(s,t0),XS=s=>Ei(s,n0),Gx=s=>Ei(s,Fb),QS=s=>Ei(s,e0),ZS=s=>Ei(s,Jb),ml=s=>Ei(s,i0,!0),WS=s=>Ei(s,s0,!0),Ys=(s,n,i)=>{const r=Zb.exec(s);return r?r[1]?n(r[1]):i(r[2]):!1},Ei=(s,n,i=!1)=>{const r=Wb.exec(s);return r?r[1]?n(r[1]):i:!1},Fb=s=>s==="position"||s==="percentage",Jb=s=>s==="image"||s==="url",e0=s=>s==="length"||s==="size"||s==="bg-size",t0=s=>s==="length",PS=s=>s==="number",n0=s=>s==="family-name",s0=s=>s==="number"||s==="weight",i0=s=>s==="shadow",FS=()=>{const s=Mt("color"),n=Mt("font"),i=Mt("text"),r=Mt("font-weight"),c=Mt("tracking"),u=Mt("leading"),d=Mt("breakpoint"),h=Mt("container"),m=Mt("spacing"),g=Mt("radius"),x=Mt("shadow"),y=Mt("inset-shadow"),w=Mt("text-shadow"),k=Mt("drop-shadow"),T=Mt("blur"),S=Mt("perspective"),E=Mt("aspect"),q=Mt("ease"),L=Mt("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],$=()=>[...R(),we,be],_=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto","contain","none"],A=()=>[we,be,m],I=()=>[Os,"full","auto",...A()],O=()=>[Hn,"none","subgrid",we,be],ce=()=>["auto",{span:["full",Hn,we,be]},Hn,we,be],le=()=>[Hn,"auto",we,be],pe=()=>["auto","min","max","fr",we,be],ie=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...A()],W=()=>[Os,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],ne=()=>[h,Os,"screen","full","dvw","lvw","svw","min","max","fit",...A()],me=()=>[Os,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],N=()=>[s,we,be],X=()=>[...R(),Gx,Hx,{position:[we,be]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",QS,IS,{size:[we,be]}],oe=()=>[Ad,zr,hi],re=()=>["","none","full",g,we,be],Z=()=>["",Ge,zr,hi],fe=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[Ge,Ad,Gx,Hx],nt=()=>["","none",T,we,be],$e=()=>["none",Ge,we,be],ct=()=>["none",Ge,we,be],ht=()=>[Ge,we,be],ve=()=>[Os,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[os],breakpoint:[os],color:[Pb],container:[os],"drop-shadow":[os],ease:["in","out","in-out"],font:[HS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[os],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[os],shadow:[os],spacing:["px",Ge],text:[os],"text-shadow":[os],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Os,be,we,E]}],container:["container"],"container-type":[{"@container":["","normal","size",we,be]}],"container-named":[GS],columns:[{columns:[Ge,"auto",be,we,h]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:$()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Hn,"auto",we,be]}],basis:[{basis:[Os,"full","auto",h,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,Os,"auto","initial","none",be]}],grow:[{grow:["",Ge,we,be]}],shrink:[{shrink:["",Ge,we,be]}],order:[{order:[Hn,"first","last","none",we,be]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...ie(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...ie()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[h,"screen",...W()]}],"min-w":[{"min-w":[h,"screen","none",...W()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[d]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh","none",...W()]}],"font-size":[{text:["base",i,zr,hi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,WS,YS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ad,be]}],"font-family":[{font:[XS,VS,n]}],"font-features":[{"font-features":[be]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,we,be]}],"line-clamp":[{"line-clamp":[Ge,"none",we,$x]}],leading:[{leading:["none",u,...A()]}],"list-image":[{"list-image":["none",we,be]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,be]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",we,hi]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Ge,"auto",we,be]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"tab-size":[{tab:[Hn,we,be]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hn,we,be],radial:["",we,be],conic:["",Hn,we,be]},ZS,KS]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,we,be]}],"outline-w":[{outline:["",Ge,zr,hi]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","inner","none",x,ml,hl]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",y,ml,hl]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Ge,hi]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",w,ml,hl]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Ge,we,be]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[we,be]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,be]}],filter:[{filter:["","none",we,be]}],blur:[{blur:nt()}],brightness:[{brightness:[Ge,we,be]}],contrast:[{contrast:[Ge,we,be]}],"drop-shadow":[{"drop-shadow":["","none",k,ml,hl]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Ge,we,be]}],"hue-rotate":[{"hue-rotate":[Ge,we,be]}],invert:[{invert:["",Ge,we,be]}],saturate:[{saturate:[Ge,we,be]}],sepia:[{sepia:["",Ge,we,be]}],"backdrop-filter":[{"backdrop-filter":["","none",we,be]}],"backdrop-blur":[{"backdrop-blur":nt()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,we,be]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,we,be]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,we,be]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,we,be]}],"backdrop-invert":[{"backdrop-invert":["",Ge,we,be]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,we,be]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,we,be]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,we,be]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,be]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",we,be]}],ease:[{ease:["linear","initial",q,we,be]}],delay:[{delay:[Ge,we,be]}],animate:[{animate:["none",L,we,be]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,we,be]}],"perspective-origin":[{"perspective-origin":$()}],rotate:[{rotate:$e()}],"rotate-x":[{"rotate-x":$e()}],"rotate-y":[{"rotate-y":$e()}],"rotate-z":[{"rotate-z":$e()}],scale:[{scale:ct()}],"scale-x":[{"scale-x":ct()}],"scale-y":[{"scale-y":ct()}],"scale-z":[{"scale-z":ct()}],"scale-3d":["scale-3d"],skew:[{skew:ht()}],"skew-x":[{"skew-x":ht()}],"skew-y":[{"skew-y":ht()}],transform:[{transform:[we,be,"","none","gpu","cpu"]}],"transform-origin":[{origin:$()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Hn,we,be]}],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,be]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,be]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Ge,zr,hi,$x]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},JS=MS(FS);function Y(...s){return JS(Yb(s))}const eN=lS("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground border border-border hover:bg-accent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground",destructive:"bg-destructive/15 text-destructive border border-destructive/40 hover:bg-destructive/25",link:"text-highlight underline-offset-4 hover:underline"},size:{default:"h-9 px-4",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 px-5",icon:"size-9","icon-sm":"size-7 rounded-md"}},defaultVariants:{variant:"default",size:"default"}});function Le({className:s,variant:n,size:i,asChild:r=!1,type:c,...u}){const d=r?nS:"button";return o.jsx(d,{"data-slot":"button",type:r?void 0:c??"button",className:Y(eN({variant:n,size:i}),s),...u})}const a0="w-full min-w-0 rounded-md border border-input bg-background/60 px-3 text-sm text-foreground placeholder:text-muted-foreground/80 outline-none transition-colors focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive";function Ti({className:s,type:n="text",...i}){return o.jsx("input",{"data-slot":"input",type:n,className:Y(a0,"h-9",s),...i})}function r0({className:s,children:n,...i}){return o.jsx("select",{"data-slot":"select",className:Y(a0,"h-9 appearance-none pr-8",s),style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2395a39a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")`,backgroundPosition:"right 0.6rem center",backgroundSize:"16px",backgroundRepeat:"no-repeat"},...i,children:n})}function Xr({className:s,...n}){return o.jsx("label",{"data-slot":"label",className:Y("text-xs font-medium text-muted-foreground",s),...n})}function $t({className:s,label:n}){return o.jsxs("span",{role:"status",className:Y("inline-flex items-center gap-2 text-muted-foreground",s),children:[o.jsx(Gl,{"aria-hidden":!0,className:"size-4 animate-spin"}),n?o.jsx("span",{children:n}):o.jsx("span",{className:"sr-only",children:"Loading"})]})}const o0=v.createContext(null);function tN({controller:s,children:n}){return o.jsx(o0.Provider,{value:s,children:n})}function Be(){const s=v.useContext(o0);if(!s)throw new Error("useController outside ControllerProvider");return s}function De(){const s=Be();return v.useSyncExternalStore(v.useCallback(n=>s.subscribe(n),[s]),()=>s.getState())}function l0(s){const[n,i]=v.useState(!1),[r,c]=v.useState(null);return{run:v.useCallback(async(...d)=>{i(!0),c(null);try{return await s(...d),!0}catch(h){return c(h instanceof Error?h.message:String(h)),!1}finally{i(!1)}},[s]),pending:n,error:r,clearError:()=>c(null)}}const nN="M1196 972L1193 1004L1180 1053L1163 1087L1141 1117L1114 1143L1079 1166L1052 1178L1011 1189L970 1193L284 1193L217 1183L158 1156L113 1117L89 1084L68 1036L59 988L58 284L62 246L72 208L86 177L108 145L132 120L168 94L197 80L237 68L284 63L970 63L1030 71L1086 94L1123 121L1160 164L1182 208L1193 252L1196 285Z",sN="M717 377L693 495L641 803L566 803L566 801L644 371L717 371ZM594 443L531 803L462 803L469 764L447 780L424 792L402 800L371 806L345 807L309 803L278 794L256 784L238 773L216 755L202 740L184 714L170 684L163 659L160 637L160 607L164 582L171 559L180 539L196 514L231 479L250 466L280 451L313 441L345 437L377 438L405 443L431 452L463 469L483 484L509 511L522 439L589 438L594 439ZM1092 639L1086 671L1077 696L1067 715L1047 742L1031 758L1001 780L967 796L937 804L908 807L872 805L832 795L804 782L779 765L759 747L737 887L669 888L665 887L665 880L737 439L803 439L797 478L809 468L836 452L857 444L885 438L915 437L941 440L974 449L996 459L1031 483L1050 502L1071 533L1083 561L1089 584L1092 604ZM223 616L223 639L227 661L236 683L249 702L262 715L282 729L307 740L335 746L369 746L385 743L403 737L431 721L455 698L466 682L478 654L482 633L482 609L477 583L465 556L454 541L436 524L409 508L384 500L362 497L336 498L314 503L289 514L271 526L254 542L239 563L228 589ZM772 613L772 640L775 657L784 681L798 702L812 716L829 728L859 741L885 746L918 746L934 743L952 737L984 718L1004 698L1015 682L1027 654L1031 631L1031 610L1026 583L1015 558L1002 540L978 519L958 508L933 500L912 497L886 498L863 503L838 514L820 526L803 542L785 568L777 588Z";function c0({className:s}){return o.jsxs("svg",{viewBox:"0 0 1254 1254","aria-hidden":!0,className:Y("shrink-0",s),children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"alp-logo-tile",x1:"180",y1:"120",x2:"1080",y2:"1160",gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{stopColor:"#1d1e20"}),o.jsx("stop",{offset:"1",stopColor:"#111214"})]})}),o.jsx("path",{fill:"url(#alp-logo-tile)",d:nN}),o.jsx("path",{fill:"#fff",fillRule:"evenodd",d:sN})]})}const u0="alp-web:gateway",d0=!1;function iN(){let s=null;try{s=window.localStorage.getItem(u0)}catch{}return Vk({location:window.location,remembered:s,dev:d0})}function aN(){const s=Be(),{connection:n}=De();return o.jsx("main",{className:"flex min-h-full items-center justify-center bg-[radial-gradient(ellipse_at_top,_var(--glow)_0%,_var(--background)_55%)] px-4 py-10",children:o.jsxs("div",{className:"w-full max-w-md space-y-4","data-testid":"link-connecting",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(c0,{className:"size-10"}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"ALP"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Opening ALP on this machine"})]})]}),o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx($t,{label:"Connecting…"}),n.attempt>1?o.jsxs("span",{children:["Waiting for alp web (attempt ",n.attempt,")"]}):null]}),n.error?o.jsx("p",{className:"text-sm text-muted-foreground",children:n.error.message}):null,o.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>s.disconnect(),children:"Use another access token"})]})})}function rN(){const s=Be(),{connection:n}=De(),[i,r]=v.useState(()=>n.gateway||iN()),[c,u]=v.useState(""),d=n.phase==="connecting",h=n.phase==="failed"?n.error:void 0;if(d&&n.link)return o.jsx(aN,{});const m=g=>{g.preventDefault();try{window.localStorage.setItem(u0,i.trim())}catch{}s.connect({url:i,token:c})};return o.jsx("main",{className:"flex min-h-full items-center justify-center bg-[radial-gradient(ellipse_at_top,_var(--glow)_0%,_var(--background)_55%)] px-4 py-10",children:o.jsxs("div",{className:"w-full max-w-md",children:[o.jsxs("div",{className:"mb-8 flex items-center gap-3",children:[o.jsx(c0,{className:"size-10"}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"ALP"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect to your agents on an ALP host"})]})]}),o.jsxs("form",{onSubmit:m,className:"space-y-5 rounded-xl border border-border bg-card/80 p-6 shadow-xl shadow-[var(--shadow)] backdrop-blur","aria-describedby":h?"connect-error":void 0,children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Xr,{htmlFor:"gateway",children:"Gateway address"}),o.jsx(Ti,{id:"gateway",name:"gateway",inputMode:"url",autoComplete:"url",spellCheck:!1,value:i,onChange:g=>r(g.target.value),placeholder:"https://alp.example.com",required:!0,disabled:d})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Xr,{htmlFor:"token",children:"Access token"}),o.jsx(Ti,{id:"token",name:"token",type:"password",autoComplete:"off",spellCheck:!1,value:c,onChange:g=>u(g.target.value),placeholder:"alpgw1.…",required:!0,disabled:d}),o.jsxs("p",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[o.jsx(Il,{"aria-hidden":!0,className:"mt-0.5 size-3.5 shrink-0 text-highlight"}),"Kept in this tab's memory only. Reloading or disconnecting forgets it."]})]}),h?o.jsx("div",{id:"connect-error",role:"alert",className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:h.message}):null,o.jsx(Le,{type:"submit",className:"w-full",disabled:d||!i.trim()||!c.trim(),children:d?o.jsx($t,{className:"text-primary-foreground",label:"Connecting…"}):o.jsxs(o.Fragment,{children:[o.jsx(Uj,{"aria-hidden":!0})," Connect"]})})]}),o.jsxs("details",{className:"mt-5 rounded-lg border border-border/70 bg-card/40 px-4 py-3 text-sm text-muted-foreground",children:[o.jsxs("summary",{className:"flex cursor-pointer items-center gap-2 font-medium text-foreground/90",children:[o.jsx(Ej,{"aria-hidden":!0,className:"size-4"})," Getting a token"]}),o.jsxs("div",{className:"mt-3 space-y-2",children:[Ky({location:window.location,dev:d0})?o.jsxs(o.Fragment,{children:[o.jsxs("p",{children:["On this machine, run ",o.jsx("code",{className:"font-mono",children:"alp web"}),": it opens this page with a link that signs you in. ",o.jsx("code",{className:"font-mono",children:"alp web --print"})," prints the link instead, and ",o.jsx("code",{className:"font-mono",children:"alp web rotate"})," replaces its token, signing out every open page."]}),o.jsx("p",{children:"To use a standalone gateway instead, create a token for the workspaces you want to open, then start the gateway with this page's address as an allowed origin:"})]}):o.jsx("p",{children:"On the ALP host, create a token for the workspaces you want to open here, then start the gateway with this page's address as an allowed origin:"}),o.jsx("pre",{className:"overflow-x-auto rounded-md bg-background px-3 py-2 font-mono text-xs text-foreground/90",children:`alp-gateway credential create --label web \\
|
|
19
|
-
--workspace /path/to/project
|
|
20
|
-
alp-gateway serve --origin ${typeof window>"u"?"http://127.0.0.1:7435":window.location.origin}`}),o.jsx("p",{children:"From another machine, use the host's HTTPS address, or an SSH tunnel to the gateway's port (127.0.0.1:7434 by default)."})]})]})]})})}function Ma({open:s,onClose:n,title:i,description:r,children:c,className:u,footer:d}){const h=v.useRef(null),m=v.useId();return v.useEffect(()=>{const g=h.current;g&&(s&&!g.open&&g.showModal(),!s&&g.open&&g.close())},[s]),o.jsx("dialog",{ref:h,"aria-labelledby":m,onCancel:g=>{g.preventDefault(),n()},onClick:g=>{g.target===h.current&&n()},className:Y("m-auto w-[min(92vw,32rem)] max-h-[88dvh] overflow-hidden rounded-xl border border-border bg-popover p-0 text-popover-foreground shadow-2xl shadow-[var(--shadow)]",u),children:s?o.jsxs("div",{className:"flex max-h-[88dvh] flex-col",children:[o.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-border px-5 py-4",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{id:m,className:"text-base font-semibold",children:i}),r?o.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r}):null]}),o.jsx(Le,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:n,children:o.jsx(Zt,{})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:c}),d?o.jsx("footer",{className:"flex flex-wrap justify-end gap-2 border-t border-border px-5 py-3",children:d}):null]}):null})}function Vt(s){const n=s.replace(/[\\/]+$/,"");return n.split(/[\\/]/).pop()||n||s}function ja(s,n=Date.now()){if(!s)return"";const i=Date.parse(s);if(Number.isNaN(i))return"";const r=Math.max(0,Math.round((n-i)/1e3));if(r<45)return"just now";const c=Math.round(r/60);if(c<60)return`${c} min ago`;const u=Math.round(c/60);if(u<24)return`${u} h ago`;const d=Math.round(u/24);return d<7?`${d} d ago`:new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function f0(s){if(!s)return"";const n=Date.parse(s);return Number.isNaN(n)?"":new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}const oN={"read-only":"Read only","workspace-write":"Workspace write","full-access":"Full access"},Ml=s=>s?oN[s]??s:"";function In(s,n){return s?.title?s.title:`Session ${(s?.id??n??"").replace(/^(web_|ses_)/,"").slice(0,6)}`}function lN({session:s,onClose:n}){const i=Be(),[r,c]=v.useState(s?.title??""),[u,d]=v.useState(s);s!==u&&(d(s),c(s?.title??""));const h=l0(v.useCallback((m,g)=>i.renameSession(m,g),[i]));return v.useEffect(()=>{s&&h.clearError()},[s]),o.jsx(Ma,{open:!!s,onClose:n,title:"Rename session",footer:o.jsxs(o.Fragment,{children:[o.jsx(Le,{variant:"ghost",onClick:n,children:"Cancel"}),o.jsx(Le,{type:"submit",form:"rename-session",disabled:h.pending||!r.trim(),children:"Save"})]}),children:o.jsxs("form",{id:"rename-session",className:"space-y-1.5",onSubmit:async m=>{m.preventDefault(),s&&await h.run(s.id,r.trim())&&n()},children:[o.jsx(Xr,{htmlFor:"rename-title",children:"Title"}),o.jsx(Ti,{id:"rename-title",value:r,onChange:m=>c(m.target.value),maxLength:200,autoFocus:!0}),h.error?o.jsx("p",{role:"alert",className:"text-xs text-destructive",children:h.error}):null]})})}function cN({session:s,onClose:n}){const i=Be(),r=l0(v.useCallback(c=>i.archiveSession(c),[i]));return v.useEffect(()=>{s&&r.clearError()},[s]),o.jsx(Ma,{open:!!s,onClose:n,title:"Archive session?",description:o.jsxs(o.Fragment,{children:["“",In(s??void 0),"” stops and leaves the list. Its history stays on the host."]}),footer:o.jsxs(o.Fragment,{children:[o.jsx(Le,{variant:"ghost",onClick:n,children:"Cancel"}),o.jsx(Le,{variant:"destructive",disabled:r.pending,onClick:async()=>{s&&await r.run(s.id)&&n()},children:"Archive"})]}),children:r.error?o.jsx("p",{role:"alert",className:"text-xs text-destructive",children:r.error}):o.jsx("p",{className:"text-sm text-muted-foreground",children:"Running work in this session is stopped."})})}const zl="‹hidden on the host›",uN=new Set(["instructions","body","houseRules"]),dN={instructions:"AGENT.md",config:"agent.json",body:"SKILL.md",server:"Server",hook:"Hook",team:"team.json",houseRules:"HOUSE_RULES.md",provider:"Provider"},Ix=s=>s!==null&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length===1&&s.$secret==="keep";function fN(s){const n=[];for(const[i,r]of Object.entries(s??{})){const c=dN[i]??i;if(uN.has(i)&&typeof r=="string"){n.push({key:i,label:c,kind:"text",text:r});continue}if(r===void 0)continue;const u=Ix(r)?zl:JSON.stringify(r,(d,h)=>Ix(h)?zl:h,2);n.push({key:i,label:c,kind:"json",text:u})}return n}const pl={none:"/favicon.svg",running:"/favicon-running.svg",attention:"/favicon-attention.svg"},Yx=220;function hN({status:s,waiting:n=!1,reason:i}){return n?"needs_input":s==="error"||i==="error"?"failed":s==="running"||s==="initializing"?"running":i==="finished"?"attention":"done"}function mN(s,n=!1){return s.includes("running")?"running":n||s.includes("needs_input")||s.includes("attention")?"attention":"none"}function pN({root:s,name:n,reason:i,message:r}){const c=i==="error"?(r?h0(r):"")||"Encountered an error.":"Finished working.";return{title:i==="finished"?"Agent finished":"Agent needs attention",body:`${n}: ${c}`,tag:`alp-${i}-${s}`}}function gN(s,n){return Object.entries(n).filter(([i,r])=>r.at!==s[i]?.at).map(([i])=>i)}function h0(s){const n=s.replace(/```[\s\S]*?```/g," ").replace(/[`*_>#~[\]]/g,"").replace(/\s+/g," ").trim();return n.length>Yx?`${n.slice(0,Yx-3).trimEnd()}...`:n}function xN(s,n){return Object.entries(n).filter(([i,r])=>r>0&&r>(s[i]??0)).map(([i])=>i)}const Vx=(s,n)=>s.visible&&s.focused&&s.shown===n;function yN({workspaceId:s,managed:n,online:i}){const r=Be(),[c,u]=v.useState(!1),[d,h]=v.useState(!1),[m,g]=v.useState([]),[x,y]=v.useState(""),[w,k]=v.useState(""),T=async()=>{if(u(!0),k(""),!n){h(!0);try{const E=await r.worktreeOptions(s);g(E),y(E[0]??"")}catch(E){k(E instanceof Error?E.message:String(E))}finally{h(!1)}}},S=async()=>{h(!0);try{await r.mutateWorktree(n?"remove":"create",s,n?void 0:x)?(u(!1),k("")):k("The operation is not confirmed. Retry to reconcile.")}finally{h(!1)}};return o.jsxs("div",{className:"shrink-0",children:[o.jsx("button",{type:"button",disabled:!i||d,onClick:()=>{T()},className:"min-h-7 whitespace-nowrap rounded px-1 hover:bg-sidebar-hover",children:n?"Remove worktree":"Create worktree"}),o.jsxs(Ma,{open:c,onClose:()=>{d||u(!1)},title:n?"Remove managed worktree":"Create managed worktree",children:[o.jsx("p",{children:n?"Delete this checkout’s files. Its Git branch remains. Saved sessions, active work, claims, leases, results and dirty files prevent removal.":"Create a clean checkout from the current committed HEAD in a host-approved destination."}),n?null:m.length?o.jsxs("label",{className:"mt-2 block",children:["Destination",o.jsx("select",{"aria-label":"Worktree destination",className:"mt-1 w-full rounded border border-border bg-background p-1",value:x,onChange:E=>y(E.target.value),children:m.map(E=>o.jsx("option",{children:E},E))})]}):o.jsx("p",{className:"mt-2",children:d?"Loading destinations…":"Ask the host owner to configure a destination mapping and grant its ID to this credential."}),w?o.jsx("p",{role:"alert",className:"mt-2",children:w}):null,o.jsxs("div",{className:"mt-3 flex gap-3",children:[o.jsx("button",{type:"button",disabled:d||!i||!n&&!x,onClick:()=>{S()},children:d?"Working…":n?"Delete checkout files":"Create checkout"}),o.jsx("button",{type:"button",disabled:d,onClick:()=>u(!1),children:"Cancel"})]})]})]})}const m0="fixed z-50 max-h-[min(60vh,28rem)] min-w-40 max-w-[min(92vw,26rem)] overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-xl shadow-[var(--shadow)]";function p0({items:s,close:n}){return o.jsx(o.Fragment,{children:s.map(i=>o.jsxs(v.Fragment,{children:[i.group?o.jsx("div",{role:"separator",className:"-mx-1 my-1 h-px bg-border"}):null,o.jsxs("button",{type:"button",role:i.checked===void 0?"menuitem":"menuitemradio","aria-checked":i.checked,disabled:i.disabled,title:i.title,"data-testid":i.testId,onClick:r=>{r.stopPropagation(),n(),i.onSelect()},className:Y("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm outline-none hover:bg-accent focus-visible:bg-accent disabled:opacity-45 [&_svg]:size-3.5",i.destructive?"text-destructive":"text-foreground"),children:[i.icon,o.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.label}),i.hint?o.jsx("span",{className:"ml-3 font-mono text-xs text-muted-foreground",children:i.hint}):null,i.checked?o.jsx(Hl,{"aria-hidden":!0,className:"ml-2 text-foreground"}):null]})]},i.id??i.label))})}function g0(s,n){return i=>{const r=Array.from(s.current?.querySelectorAll('[role^="menuitem"]:not([disabled])')??[]),c=r.indexOf(document.activeElement);i.key==="Escape"?(i.preventDefault(),i.stopPropagation(),n()):i.key==="ArrowDown"?(i.preventDefault(),r[(c+1)%r.length]?.focus()):i.key==="ArrowUp"?(i.preventDefault(),r[(c-1+r.length)%r.length]?.focus()):i.key==="Home"?(i.preventDefault(),r[0]?.focus()):i.key==="End"?(i.preventDefault(),r.at(-1)?.focus()):i.key==="Tab"&&n(!1)}}function bN({label:s,at:n,items:i,onClose:r,testId:c,fallbackFocus:u}){const d=v.useRef(null),[h,m]=v.useState({visibility:"hidden"}),g=v.useRef(null),x=v.useCallback((y=!0)=>{if(r(),!y)return;const w=g.current;w?.focus(),setTimeout(()=>{w&&!w.isConnected&&u?.()?.focus()},0)},[r,u]);return v.useLayoutEffect(()=>{if(!n)return;g.current=document.activeElement;const y=d.current?.offsetWidth??0,w=d.current?.offsetHeight??0;m({left:Math.max(8,Math.min(n.x,window.innerWidth-y-8)),top:Math.max(8,Math.min(n.y,window.innerHeight-w-8))}),d.current?.querySelector('[role^="menuitem"]:not([disabled])')?.focus()},[n]),v.useEffect(()=>{if(!n)return;const y=()=>x(!1),w=k=>{d.current?.contains(k.target)||x(!1)};return window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),window.addEventListener("blur",y),document.addEventListener("pointerdown",w,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0),window.removeEventListener("blur",y),document.removeEventListener("pointerdown",w,!0)}},[n,x]),n?o.jsx("div",{ref:d,role:"menu","aria-label":s,"data-testid":c,onKeyDown:g0(d,x),onContextMenu:y=>y.preventDefault(),style:h,className:m0,children:o.jsx(p0,{items:i,close:()=>x()})}):null}function hn({label:s,title:n,trigger:i,triggerClassName:r,items:c,align:u="end",onOpenChange:d,disabled:h,openRequest:m,onOpenRequestHandled:g,testId:x}){const[y,w]=v.useState(!1),[k,T]=v.useState({}),S=v.useRef(null),E=v.useRef(null),q=v.useId(),L=v.useCallback(_=>{w(_),d?.(_)},[d]);v.useEffect(()=>{m&&(h||L(!0),g?.())},[m]);const M=()=>Array.from(E.current?.querySelectorAll('[role^="menuitem"]:not([disabled])')??[]);v.useLayoutEffect(()=>{if(!y||!S.current)return;const _=S.current.getBoundingClientRect(),V=E.current?.offsetHeight??0,A=_.bottom+4+V<=window.innerHeight-8;T({top:A?_.bottom+4:Math.max(8,_.top-4-V),...u==="end"?{right:Math.max(8,window.innerWidth-_.right)}:{left:Math.max(8,_.left)}})},[y,u]),v.useEffect(()=>{if(!y)return;M()[0]?.focus();const _=()=>L(!1),V=I=>{I.target instanceof Node&&I.target.contains(S.current)&&L(!1)};window.addEventListener("resize",_),window.addEventListener("scroll",V,!0);const A=I=>{!E.current?.contains(I.target)&&!S.current?.contains(I.target)&&L(!1)};return document.addEventListener("pointerdown",A),()=>{document.removeEventListener("pointerdown",A),window.removeEventListener("resize",_),window.removeEventListener("scroll",V,!0)}},[y,L]);const R=(_=!0)=>{L(!1),_&&S.current?.focus()},$=g0(E,R);return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:S,type:"button","aria-label":s,title:n??s,disabled:h,"aria-haspopup":"menu","aria-expanded":y,"aria-controls":y?q:void 0,"data-testid":x,onClick:_=>{_.stopPropagation(),L(!y)},onKeyDown:_=>{_.key==="ArrowDown"&&!y&&(_.preventDefault(),L(!0))},className:r,children:i}),y?o.jsx("div",{ref:E,id:q,role:"menu","aria-label":s,onKeyDown:$,style:k,className:m0,children:o.jsx(p0,{items:c,close:()=>R()})}):null]})}const vN=[{id:"general",title:"General"},{id:"workspaces",title:"Projects & Workspaces"},{id:"tabs-panes",title:"Tabs & Panes"},{id:"layout",title:"Layout"},{id:"agent-input",title:"Agent Input"}],Kl=[{action:"command-center.toggle",combo:"Mod+K",section:"general",label:"Toggle command center"},{action:"command-center.files",combo:"Mod+P",section:"general",label:"Search files"},{action:"shortcuts.toggle",combo:"Shift+?",section:"general",label:"Show keyboard shortcuts",scope:"other",note:"Available when focus is not in a text field."},{action:"settings.toggle",combo:"Mod+,",section:"general",label:"Toggle settings"},{action:"session.new",combo:"Mod+N",section:"workspaces",label:"New session"},{action:"session.archive",combo:"Mod+Shift+Backspace",section:"workspaces",label:"Archive session"},{action:"session.index",combo:"Alt+Digit",section:"workspaces",label:"Jump to session",display:["alt","1-9"]},{action:"session.relative",combo:"Alt+[",delta:-1,section:"workspaces",label:"Previous session"},{action:"session.relative",combo:"Alt+]",delta:1,section:"workspaces",label:"Next session"},{action:"tab.menu",combo:"Mod+T",section:"tabs-panes",label:"New tab"},{action:"tab.agent",combo:"Mod+Shift+A",section:"tabs-panes",label:"New agent"},{action:"tab.changes",combo:"Mod+Shift+G",section:"tabs-panes",label:"Changes"},{action:"tab.files",combo:"Mod+Shift+E",section:"tabs-panes",label:"Files"},{action:"tab.terminal",combo:"Mod+Shift+T",section:"tabs-panes",label:"New terminal"},{action:"tab.close",combo:"Alt+Shift+W",section:"tabs-panes",label:"Close current tab"},{action:"tab.index",combo:"Alt+Shift+Digit",section:"tabs-panes",label:"Jump to tab",display:["alt","shift","1-9"]},{action:"tab.relative",combo:"Alt+Shift+[",delta:-1,section:"tabs-panes",label:"Previous tab"},{action:"tab.relative",combo:"Alt+Shift+]",delta:1,section:"tabs-panes",label:"Next tab"},{action:"pane.split.right",combo:"Cmd+\\",section:"tabs-panes",label:"Split pane right",mac:!0},{action:"pane.split.down",combo:"Cmd+Shift+\\",section:"tabs-panes",label:"Split pane down",mac:!0},{action:"pane.focus.left",combo:"Cmd+Shift+ArrowLeft",section:"tabs-panes",label:"Focus pane left",mac:!0,scope:"other"},{action:"pane.focus.right",combo:"Cmd+Shift+ArrowRight",section:"tabs-panes",label:"Focus pane right",mac:!0,scope:"other"},{action:"pane.focus.up",combo:"Cmd+Shift+ArrowUp",section:"tabs-panes",label:"Focus pane up",mac:!0,scope:"other"},{action:"pane.focus.down",combo:"Cmd+Shift+ArrowDown",section:"tabs-panes",label:"Focus pane down",mac:!0,scope:"other"},{action:"pane.move.left",combo:"Cmd+Alt+Shift+ArrowLeft",section:"tabs-panes",label:"Move tab left",mac:!0},{action:"pane.move.right",combo:"Cmd+Alt+Shift+ArrowRight",section:"tabs-panes",label:"Move tab right",mac:!0},{action:"pane.move.up",combo:"Cmd+Alt+Shift+ArrowUp",section:"tabs-panes",label:"Move tab up",mac:!0},{action:"pane.move.down",combo:"Cmd+Alt+Shift+ArrowDown",section:"tabs-panes",label:"Move tab down",mac:!0},{action:"pane.close",combo:"Cmd+Shift+W",section:"tabs-panes",label:"Close pane",mac:!0,note:"Some browsers keep this key to close the window."},{action:"sidebar.left",combo:"Mod+B",section:"layout",label:"Toggle left sidebar"},{action:"sidebar.right",combo:"Mod+E",section:"layout",label:"Toggle Explorer sidebar"},{action:"sidebar.right",combo:"Ctrl+`"},{action:"sidebar.both",combo:"Mod+.",section:"layout",label:"Toggle both sidebars"},{action:"composer.focus",combo:"Mod+L",section:"agent-input",label:"Focus message input",handledElsewhere:!0},{action:"composer.mode",combo:"Shift+Tab",section:"agent-input",label:"Cycle agent mode",handledElsewhere:!0},{action:"agent.interrupt",combo:"Escape",section:"agent-input",label:"Interrupt agent",handledElsewhere:!0}],Kx={"[":"BracketLeft","]":"BracketRight",",":"Comma",".":"Period","`":"Backquote","?":"Slash","\\":"Backslash"};function x0(s,n){const i=s.split("+"),r=i.pop()??"",c={meta:!1,ctrl:!1,alt:!1,shift:!1};for(const u of i)u==="Mod"?c[n?"meta":"ctrl"]=!0:u==="Cmd"?c.meta=!0:u==="Ctrl"?c.ctrl=!0:u==="Alt"?c.alt=!0:u==="Shift"&&(c.shift=!0);return{key:r,mods:c}}function wN(s,{mac:n,editable:i=!1,bindings:r=Kl}){for(const c of r){if(c.handledElsewhere||c.mac&&!n||c.scope==="other"&&i)continue;const{key:u,mods:d}=x0(c.combo,n);if(!(s.metaKey!==d.meta||s.ctrlKey!==d.ctrl||s.altKey!==d.alt||s.shiftKey!==d.shift)){if(u==="Digit"){const h=/^Digit([1-9])$/.exec(s.code);if(h)return{binding:c,index:Number(h[1])};continue}if(u.length===1&&/[A-Za-z]/.test(u)?s.code===`Key${u.toUpperCase()}`:Kx[u]&&s.code===Kx[u]||s.key===u)return{binding:c}}}return null}function Gf(s,n){if(s.display)return s.display;const{key:i,mods:r}=x0(s.combo,n),c=[];return r.ctrl&&c.push("ctrl"),r.meta&&c.push("mod"),r.alt&&c.push("alt"),r.shift&&i!=="?"&&c.push("shift"),c.push(i),c}const kN={Backspace:"⌫",Enter:"⏎",Escape:"Esc",Space:"␣",ArrowLeft:"←",ArrowRight:"→",ArrowUp:"↑",ArrowDown:"↓"};function If(s,n){const i=c=>kN[c]??(c.length===1?c.toUpperCase():c);if(n){const c=["ctrl","alt","shift","mod"],u={ctrl:"⌃",alt:"⌥",shift:"⇧",mod:"⌘"};return c.filter(d=>s.includes(d)).map(d=>u[d]).join("")+s.filter(d=>!c.includes(d)).map(i).join("")}const r={mod:"Ctrl",ctrl:"Ctrl",alt:"Alt",shift:"Shift"};return s.map(c=>r[c]??i(c)).join("+")}function nf(s,n){const i=Kl.find(r=>r.action===s&&r.label&&(!r.mac||n));return i?If(Gf(i,n),n):""}function jN(s,n=""){const i=n.trim().toLowerCase();return vN.map(r=>({...r,rows:Kl.filter(c=>c.section===r.id&&c.label&&(!c.mac||s)).map(c=>({id:`${c.action}:${c.combo}`,label:c.label,keys:If(Gf(c,s),s),...c.note?{note:c.note}:{}})).filter(c=>!i||c.label.toLowerCase().includes(i)||c.keys.toLowerCase().includes(i))})).filter(r=>r.rows.length)}function y0(s){const n=s;if(!n||typeof n.closest!="function")return!1;if(n.isContentEditable)return!0;const i=String(n.tagName??"").toLowerCase();return i==="textarea"||i==="select"?!0:i!=="input"?!1:!["button","checkbox","radio","submit","reset","range","color","file"].includes(String(n.type??"").toLowerCase())}function Fr(){const s=globalThis.navigator;return/Mac|iPhone|iPad/.test(String(s?.platform||s?.userAgent||""))}function b0(){return o.jsxs("span",{"aria-hidden":!0,className:"relative flex size-[14px] items-center justify-center",children:[o.jsx("span",{className:"absolute inset-[1px] rounded-full border-[1.5px] border-dot-running opacity-30"}),o.jsx("span",{className:"absolute inset-[1px] animate-spin rounded-full border-[1.5px] border-transparent border-t-dot-running opacity-90 [animation-duration:900ms]"}),o.jsx("span",{className:"size-1.5 rounded-full bg-dot-running"})]})}function Yf({bucket:s}){const n=s==="running"?"Running":s==="needs_input"?"Waiting for your answer":s==="failed"?"Failed":s==="attention"?"Finished":"Idle";return o.jsxs("span",{className:"flex h-5 w-4 shrink-0 items-center justify-center",title:n,"data-status":s,children:[s==="running"?o.jsx(b0,{}):s==="needs_input"?o.jsx(Is,{"aria-hidden":!0,className:"size-3 fill-dot-warning text-sidebar"}):o.jsx("span",{"aria-hidden":!0,className:Y("size-1.5 rounded-full",s==="failed"?"bg-dot-danger":s==="attention"?"bg-dot-success":"bg-extra-muted opacity-30")}),o.jsx("span",{className:"sr-only",children:n})]})}const Xx=["#7a6aa8","#3d7ea6","#388068","#a4673a","#b05c80","#6a70b8","#368080","#b06260","#8f7838","#5179b0"];function SN(s){let n=0;for(const i of s)n=n*31+i.charCodeAt(0)>>>0;return Xx[n%Xx.length]}const Yn="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",Vf="hover:bg-sidebar-hover active:bg-secondary";function sf({icon:s,label:n,onClick:i,disabled:r,title:c,active:u,shortcut:d,testId:h}){return o.jsx("div",{className:"px-2",children:o.jsxs("button",{type:"button",onClick:i,disabled:r,title:c,"aria-current":u?"page":void 0,"data-testid":h,className:Y("group flex min-h-9 w-full items-center gap-2 rounded-lg px-2 py-1 md:min-h-7 text-left text-sm text-muted-foreground hover:text-foreground disabled:pointer-events-none disabled:opacity-45",Vf,u&&"bg-sidebar-hover text-foreground",Yn),children:[o.jsx(s,{"aria-hidden":!0,className:"size-[18px] shrink-0 md:size-3.5"}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:n}),d?o.jsx("kbd",{"aria-hidden":!0,className:"hidden rounded-md bg-secondary/50 px-1 py-px font-sans text-[11px] leading-4 text-muted-foreground md:group-hover:inline",children:d}):null]})})}function NN({query:s,onQuery:n,open:i,onOpen:r,onClose:c,focusRequest:u,shortcut:d}){const h=v.useRef(null);return v.useEffect(()=>{i&&h.current?.focus()},[i,u]),i?o.jsx("div",{className:"px-2",children:o.jsxs("div",{className:"flex min-h-9 w-full items-center gap-2 rounded-lg bg-sidebar-hover px-2 py-1 md:min-h-7 focus-within:ring-1 focus-within:ring-border",children:[o.jsx(Ni,{"aria-hidden":!0,className:"size-[18px] shrink-0 text-foreground md:size-3.5"}),o.jsx("input",{ref:h,type:"search",value:s,onChange:m=>n(m.target.value),"aria-label":"Search sessions",placeholder:"Search sessions…",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),c())},onBlur:()=>{s.trim()||c()},className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground [&::-webkit-search-cancel-button]:hidden"}),o.jsx("button",{type:"button","aria-label":"Clear search",title:"Clear search",onMouseDown:m=>m.preventDefault(),onClick:c,className:Y("-mr-1 flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-secondary hover:text-foreground",Yn),children:o.jsx(Zt,{"aria-hidden":!0,className:"size-3.5"})})]})}):o.jsx(sf,{icon:Ni,label:"Search",onClick:r,shortcut:d})}function Kf(s,n,i){return hN({status:s.status,waiting:n,reason:i})}function TN({session:s,bucket:n,selected:i,canWrite:r,onSelect:c,onRename:u,onArchive:d}){const[h,m]=v.useState(!1),g=In(s),x=s.status==="closed"?"Closed":`Updated ${ja(s.updatedAt??s.createdAt)}`;return o.jsxs("li",{className:Y("group relative mb-0.5 rounded-lg",i?"bg-sidebar-selected":"hover:bg-sidebar-hover active:bg-secondary",h&&!i&&"bg-sidebar-hover"),children:[o.jsxs("button",{type:"button",onClick:c,"aria-current":i?"true":void 0,"data-testid":"session-row",title:`${g} · ${x}`,className:Y("flex min-h-11 w-full min-w-0 items-center gap-2 rounded-lg py-2 pl-4 pr-3 text-left md:min-h-9",r&&"max-md:pr-8",Yn),children:[o.jsx(Yf,{bucket:n}),o.jsx("span",{className:Y("min-w-0 flex-1 truncate text-sm leading-5 text-foreground",i||h?"opacity-100":"opacity-[0.76] group-hover:opacity-100"),children:g})]}),r?o.jsxs("div",{className:Y("absolute right-[5px] top-[13px] flex opacity-100 md:top-[9px] md:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100",h&&"opacity-100"),children:[o.jsx("span",{"aria-hidden":!0,className:Y("pointer-events-none absolute inset-y-0 right-full hidden w-6 bg-linear-to-r md:block from-transparent",i?"to-sidebar-selected":"to-sidebar-hover")}),o.jsx(hn,{label:`Actions for ${g}`,onOpenChange:m,trigger:o.jsx(kj,{"aria-hidden":!0,className:"size-3.5"}),triggerClassName:Y("flex size-[18px] items-center justify-center rounded text-muted-foreground hover:bg-secondary hover:text-foreground",i?"bg-sidebar-selected":"bg-sidebar-hover",Yn),items:[{label:"Rename",icon:o.jsx(Ea,{"aria-hidden":!0}),onSelect:u},{label:"Archive",icon:o.jsx($l,{"aria-hidden":!0}),onSelect:d,destructive:!0}]})]}):null]})}function AN({path:s,expanded:n,canWrite:i,onToggle:r,onNewSession:c}){const u=Vt(s);return o.jsxs("div",{className:Y("group relative mb-1 flex min-h-11 items-center rounded-lg md:min-h-9",Vf),children:[o.jsxs("button",{type:"button",onClick:r,"aria-expanded":n,title:s,"data-testid":"project-row","data-workspace":s,className:Y("flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-lg p-2 text-left md:min-h-9",i&&"pr-9",Yn),children:[o.jsxs("span",{"aria-hidden":!0,className:"flex h-5 w-4 shrink-0 items-center justify-center",children:[o.jsx("span",{className:"flex size-4 items-center justify-center rounded-[4px] text-[9px] font-medium leading-none text-white group-hover:hidden group-focus-within:hidden",style:{backgroundColor:SN(s)},children:u.slice(0,1).toUpperCase()}),n?o.jsx(An,{className:"hidden size-3.5 text-muted-foreground group-hover:block group-focus-within:block"}):o.jsx(Vn,{className:"hidden size-3.5 text-muted-foreground group-hover:block group-focus-within:block"})]}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:u})]}),i?o.jsx("button",{type:"button",onClick:c,"aria-label":`Start a session in ${u}`,title:`New session in ${u}`,className:Y("absolute right-1.5 flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 md:opacity-0",Yn),children:o.jsx(fs,{"aria-hidden":!0,className:"size-[15px]"})}):null]})}function Ed({label:s,title:n,onClick:i,children:r}){return o.jsx("button",{type:"button","aria-label":s,title:n??s,onClick:i,className:Y("relative flex size-11 items-center justify-center rounded-md text-muted-foreground hover:text-foreground md:size-7 [&_svg]:size-5 md:[&_svg]:size-4",Yn),children:r})}function EN({onNewSession:s,onRename:n,onArchive:i,onSettings:r,onNavigate:c,onClose:u,onHistory:d,historyOpen:h,onOpenSession:m,searchRequest:g,onSearchRequestHandled:x}){const y=Be(),w=De(),{principal:k,workspace:T,sessions:S,selected:E,connection:q}=w,L=v.useMemo(()=>Fr(),[]),[M,R]=v.useState(!1),[$,_]=v.useState(!1),[V,A]=v.useState(""),I=ze(k??void 0,"session.write"),O=q.phase==="open",ce=w.registry,[le,pe]=v.useState(!1),[ie,de]=v.useState(""),B=Z=>ce.workspaces.filter(fe=>fe.directory===Z||k?.workspaceRoots?.some(ge=>ge.path===Z&&ge.canonical===fe.directory)).sort((fe,ge)=>+!!ge.pinnedAt-+!!fe.pinnedAt||fe.createdAt.localeCompare(ge.createdAt)||fe.id.localeCompare(ge.id)),W=[...new Set([...k?.workspaces??[],...ce.workspaces.filter(Z=>Z.managedWorktree).map(Z=>Z.directory)])].sort((Z,fe)=>Number(B(fe).some(ge=>!!ge.pinnedAt))-Number(B(Z).some(ge=>!!ge.pinnedAt))),ne=V.trim().toLowerCase(),me=ne?S.list.filter(Z=>In(Z).toLowerCase().includes(ne)):S.list,N=Z=>{if(Z===T){R(fe=>!fe);return}R(!1),y.selectWorkspace(Z)},X=Z=>{Z!==T&&(R(!1),y.selectWorkspace(Z)),s(),c()},P=()=>{A(""),_(!1)},[ee,oe]=v.useState(0);v.useEffect(()=>{g&&(_(!0),R(!1),oe(Z=>Z+1),x?.())},[g]);const re=`${k?.label??"Access token"} · ${q.hostname??q.gateway.replace(/^https?:\/\//,"")}${O?"":" · reconnecting"}`;return o.jsxs("nav",{"aria-label":"Workspaces and sessions",className:"relative flex h-full min-h-0 flex-col bg-sidebar",children:[o.jsxs("div",{className:"flex shrink-0 flex-col gap-0.5 border-b border-border pb-1.5 pt-2",children:[o.jsx(sf,{icon:fs,label:"New session",onClick:()=>{s(),c()},disabled:!T||!I||!O,title:I?void 0:"Your access token cannot start sessions.",shortcut:nf("session.new",L)}),o.jsx(sf,{icon:Lf,label:"History",onClick:()=>{d(),c()},active:h,disabled:!T,testId:"sidebar-history"}),o.jsx(NN,{query:V,onQuery:A,open:$,onOpen:()=>{_(!0),R(!1)},onClose:P,focusRequest:ee})]}),u?o.jsx("button",{type:"button","aria-label":"Close sessions",onClick:u,className:Y("absolute right-[9.5px] top-3 z-10 flex size-8 items-center justify-center rounded-lg bg-sidebar text-muted-foreground hover:text-foreground",Yn),children:o.jsx(Zt,{"aria-hidden":!0,className:"size-4"})}):null,o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-4 pt-0.5",children:[o.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-2 pl-2 pr-1 md:min-h-9",children:[o.jsx("h2",{className:"select-none text-xs text-muted-foreground",children:"Workspaces"}),o.jsx(hn,{label:"Display preferences",align:"end",trigger:o.jsx(Ij,{"aria-hidden":!0,className:Y("size-3.5",S.status==="loading"&&"animate-pulse")}),triggerClassName:Y("flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-hover hover:text-foreground",Yn),items:[{label:"Refresh sessions",icon:o.jsx(Ca,{"aria-hidden":!0}),onSelect:()=>{y.refreshSessions()},disabled:!T||!O},{label:M?"Expand workspace":"Collapse workspace",icon:M?o.jsx(Vn,{"aria-hidden":!0}):o.jsx(An,{"aria-hidden":!0}),onSelect:()=>R(Z=>!Z),disabled:!T}]})]}),q.capabilities.includes("workspace.registry")?o.jsxs("div",{className:"px-2 pb-2 text-xs",children:[o.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>pe(Z=>!Z),children:"Add project"}),le?ze(k??void 0,"workspace.write")?o.jsxs("form",{className:"mt-2 flex flex-col gap-2",onSubmit:Z=>{Z.preventDefault(),ie&&y.registerProject(ie)},children:[o.jsx("label",{htmlFor:"existing-project",children:"Existing granted directory"}),o.jsxs("select",{id:"existing-project",value:ie,onChange:Z=>de(Z.target.value),className:"w-full rounded border border-border bg-background p-2",children:[o.jsx("option",{value:"",children:"Choose a directory"}),W.map(Z=>o.jsx("option",{value:Z,children:Z},Z))]}),o.jsx("button",{type:"submit",disabled:!ie||!O||ce.loading,className:"rounded border border-border p-2",children:"Register project"}),o.jsx("p",{className:"text-muted-foreground",children:"For another directory, ask the host owner to grant it locally first."})]}):o.jsx("p",{role:"status",className:"mt-2 text-muted-foreground",children:"Ask the host owner to add workspace.write to your credential. Another directory must be granted locally first."}):null,ce.error?o.jsxs("p",{role:"alert",children:[ce.error," ",o.jsx("button",{type:"button",onClick:()=>{y.refreshRegistry()},children:"Retry"})]}):null]}):null,W.length?null:o.jsxs("div",{className:"mt-1 px-2 py-3 text-sm",children:[o.jsx("p",{className:"text-foreground",children:"No workspaces"}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This access token grants no workspace. The host owner adds one with alp-gateway credential create --workspace."})]}),W.map(Z=>{const fe=B(Z),ge=Z===T&&(!M||!!ne);return o.jsxs("div",{className:Y(ge&&"pb-3"),children:[o.jsx(AN,{path:Z,expanded:ge,canWrite:I&&O,onToggle:()=>N(Z),onNewSession:()=>X(Z)}),fe.map(he=>o.jsxs("div",{className:"flex items-center gap-2 px-3 pb-1 text-xs text-muted-foreground","data-testid":"shared-workspace-row","data-workspace-id":he.id,children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate",title:he.title||Vt(Z),children:he.title||Vt(Z)}),he.branch!==void 0?o.jsxs("span",{className:"block truncate",title:he.branch||"Detached HEAD","data-testid":"workspace-branch",children:[he.managedWorktree?"Worktree · ":"",he.branch||"Detached HEAD"]}):null]}),q.capabilities.includes("workspace.worktree")&&ze(k??void 0,"workspace.manage")?o.jsx(yN,{workspaceId:he.id,managed:!!he.managedWorktree,online:O}):null,o.jsxs("button",{type:"button","aria-label":`${he.pinnedAt?"Unpin":"Pin"} workspace ${he.title||Vt(Z)}`,"aria-pressed":!!he.pinnedAt,disabled:!O||ce.loading,title:ze(k??void 0,"workspace.write")?"Shared across clients":"Ask the host owner for workspace.write to change shared pins.",onClick:()=>{y.pinWorkspace(he.id,!he.pinnedAt)},className:"flex min-h-7 shrink-0 items-center gap-1 rounded px-1 hover:bg-sidebar-hover",children:[o.jsx(Bj,{"aria-hidden":!0,className:"size-3"}),he.pinnedAt?"Pinned":"Pin"]})]},he.id)),ge?o.jsxs("div",{children:[S.status==="loading"&&!S.list.length?o.jsx("div",{className:"py-2 pl-4",children:o.jsx($t,{label:"Loading sessions…",className:"text-xs"})}):null,S.status==="error"?o.jsxs("div",{className:"mx-1 mb-1 rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-xs text-destructive",role:"alert",children:[S.error?.message," ",o.jsx("button",{type:"button",className:"text-highlight underline-offset-4 hover:underline",onClick:()=>{y.refreshSessions()},children:"Try again"})]}):null,S.status==="ready"&&!S.list.length?I&&O?o.jsxs("button",{type:"button",onClick:()=>X(Z),"aria-label":`Start a session in ${Vt(Z)}`,className:Y("group mb-0.5 flex min-h-11 w-full items-center md:min-h-9 gap-2 rounded-lg py-2 pl-4 pr-3 text-left text-sm text-muted-foreground hover:text-foreground",Vf,Yn),children:[o.jsx("span",{className:"flex h-5 w-4 shrink-0 items-center justify-center",children:o.jsx(fs,{"aria-hidden":!0,className:"size-3.5"})}),o.jsx("span",{className:"truncate",children:"New session"})]}):o.jsx("p",{className:"flex min-h-9 items-center py-2 pl-10 pr-3 text-sm text-muted-foreground",children:"No sessions yet"}):null,ne&&S.list.length&&!me.length?o.jsxs("p",{className:"flex min-h-9 items-center py-2 pl-10 pr-3 text-sm text-muted-foreground",children:["No sessions match “",V.trim(),"”"]}):null,o.jsx("ul",{children:me.map(he=>o.jsx(TN,{session:he,selected:he.id===E&&!h,canWrite:I,bucket:Kf(he,Ul(w,he.id),Kr(w,he.id)),onSelect:()=>{y.selectSession(he.id),m(),c()},onRename:()=>n(he),onArchive:()=>i(he)},he.id))})]}):null]},Z)})]}),o.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-2 py-1.5",children:[o.jsxs(Ed,{label:"Host connection",title:re,onClick:r,children:[o.jsx(Cb,{"aria-hidden":!0,className:"!size-[19px] md:!size-[15px]"}),o.jsx("span",{"aria-hidden":!0,className:Y("absolute bottom-[11px] right-[11px] size-1.5 md:bottom-[5px] md:right-[5px] rounded-full ring-2 ring-sidebar",O?"bg-dot-success":"bg-dot-warning")})]}),o.jsx(Ed,{label:"Disconnect",title:"Disconnect and forget the token",onClick:()=>y.disconnect(),children:o.jsx(_j,{"aria-hidden":!0})}),o.jsx("span",{className:"flex-1"}),o.jsx(Ed,{label:"Settings",onClick:r,children:o.jsx(Df,{"aria-hidden":!0})})]})]})}const CN=6e3,Hr=()=>typeof window<"u"&&"Notification"in window;function MN(){const[s,n]=v.useState(()=>Hr()?Notification.permission:"unsupported");v.useEffect(()=>{if(!Hr())return;const r=()=>n(Notification.permission);return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[]);const i=v.useCallback(async()=>{if(Hr())try{n(await Notification.requestPermission())}catch{n(Notification.permission)}},[]);return{permission:s,request:i}}function zN({onOpenSession:s}){const n=De(),i=Be(),{workspace:r,sessions:c,tree:u,attention:d,selected:h,focus:m}=n,g=v.useMemo(()=>ij(n),[n.turnAttention,c,u]);v.useEffect(()=>{const M=()=>i.setPresence({visible:document.visibilityState==="visible",focused:document.hasFocus()});return M(),window.addEventListener("focus",M),window.addEventListener("blur",M),document.addEventListener("visibilitychange",M),()=>{window.removeEventListener("focus",M),window.removeEventListener("blur",M),document.removeEventListener("visibilitychange",M)}},[i]);const x=mN(c.list.map(M=>Kf(M,Ul(n,M.id),Kr(n,M.id))),Object.keys(g).length>0);v.useEffect(()=>{let M=document.querySelector('link[rel="icon"]');M||(M=document.createElement("link"),M.rel="icon",document.head.append(M)),M.type="image/svg+xml",M.href=pl[x],M.dataset.status=x},[x]),v.useEffect(()=>()=>{const M=document.querySelector('link[rel="icon"]');M&&(M.href=pl.none,M.dataset.status="none")},[]);const y=u?.rootId,w=y?c.list.find(M=>M.id===y):void 0,k=y?In({id:y,title:u?.projection.sessions[y]?.title??w?.title}):r?Vt(r):"ALP";v.useEffect(()=>(document.title=k,()=>{document.title="ALP"}),[k]);const T=v.useRef({attention:d,live:{}}),S=v.useMemo(()=>{const M=T.current;M.attention!==d&&(M.live={}),M.attention=d;const R={...d};for(const[$,_]of Object.entries(M.live))R[$]=Math.max(R[$]??0,_);if(u){const $=Object.keys(u.projection.questions).length;R[u.rootId]=u.status==="attached"?$:Math.max($,d[u.rootId]??0),u.status==="attached"&&(M.live[u.rootId]=$)}return R},[d,u]),E=v.useRef({workspace:null,since:Date.now(),counts:{}}),q=v.useRef(s);q.current=s,v.useEffect(()=>{const M=E.current;if(M.workspace!==r){E.current={workspace:r,since:Date.now(),counts:S};return}const R=xN(M.counts,S);if(M.counts=S,!R.length||!Hr()||Notification.permission!=="granted")return;const $=Date.now()-M.since<CN,_={visible:document.visibilityState==="visible",focused:document.hasFocus(),shown:m??h};for(const V of R){const I=(u?.rootId===V?Object.values(u.projection.questions):[]).sort((ce,le)=>(Date.parse(le.askedAt??"")||0)-(Date.parse(ce.askedAt??"")||0))[0];if($&&!(I&&(Date.parse(I.askedAt??"")||0)>=M.since)||Vx(_,V)||I?.sessionId&&Vx(_,I.sessionId))continue;const O=In(c.list.find(ce=>ce.id===V)??{id:V,title:u?.rootId===V?u.projection.sessions[V]?.title:void 0});try{const ce=new Notification("Agent needs attention",{body:`${O}: ${I?.body?h0(I.body):"Waiting for your answer."}`,tag:`alp-question-${V}`,icon:pl.attention});ce.onclick=()=>{window.focus(),q.current(V),ce.close()}}catch{}}},[S,r,u,c,h,m]);const L=v.useRef({workspace:r,entries:g});v.useEffect(()=>{const M=L.current,R=M.workspace===r?gN(M.entries,g):[];if(L.current={workspace:r,entries:g},!(!R.length||!Hr()||Notification.permission!=="granted"))for(const $ of R){const _=g[$];if(!_)continue;const V=In(c.list.find(ce=>ce.id===$)??{id:$,title:u?.rootId===$?u.projection.sessions[$]?.title:void 0}),{title:A,body:I,tag:O}=pN({root:$,name:V,reason:_.reason,message:_.message});try{const ce=new Notification(A,{body:I,tag:O,icon:pl.attention});ce.onclick=()=>{window.focus(),q.current($),ce.close()}}catch{}}},[g,r,c,u])}const v0=[{id:"general",label:"General",icon:Df},{id:"appearance",label:"Appearance",icon:qj},{id:"sidebar",label:"Sidebar",icon:Wr},{id:"chat",label:"Chat",icon:Lj},{id:"terminal",label:"Terminal",icon:Vl},{id:"editor",label:"Editor",icon:bj},{id:"diagnostics",label:"Diagnostics",icon:Zj},{id:"about",label:"About",icon:Of}],w0=[{id:"host",label:"Overview",icon:Cb},{id:"projects",label:"Projects",icon:Rx},{id:"connections",label:"Connections",icon:Dj},{id:"pair-device",label:"Pair device",icon:Vj},{id:"alp-templates",label:"Templates",icon:Al},{id:"alp-agents",label:"Agents",icon:Sa},{id:"alp-skills",label:"Skills",icon:mj},{id:"alp-hooks",label:"Hooks",icon:Pj},{id:"alp-mcp",label:"MCP servers",icon:$j},{id:"metadata",label:"Metadata",icon:Xj},{id:"workspaces",label:"Workspaces",icon:Rx},{id:"providers",label:"Providers",icon:pj},{id:"usage",label:"Usage",icon:Tj},{id:"terminals",label:"Terminals",icon:Vl},{id:"plugins",label:"Plugins",icon:hj}],_N=Object.fromEntries([...v0,...w0].map(s=>[s.id,s.label])),Xf="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset";function Qt({title:s,action:n,children:i}){return o.jsxs("section",{className:"mb-6",children:[s||n?o.jsxs("div",{className:"mb-3 ml-1 flex items-center justify-between gap-2",children:[s?o.jsx("h3",{className:"text-xs font-normal text-muted-foreground",children:s}):o.jsx("span",{}),n]}):null,o.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-card",children:i})]})}function ft({title:s,hint:n,children:i,first:r}){return o.jsxs("div",{className:Y("flex flex-wrap items-center justify-between gap-3 p-4",!r&&"border-t border-border"),children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-sm text-foreground",children:s}),n?o.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:n}):null]}),i!==void 0?o.jsx("div",{className:"min-w-0 max-w-full text-sm text-muted-foreground",children:i}):null]})}function Yt({what:s,why:n}){return o.jsx(Qt,{children:o.jsxs("div",{className:"flex items-start gap-3 p-4",role:"note",children:[o.jsx(Mf,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm",children:[s," is not available in this beta"]}),o.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n})]})]})})}function af({label:s,value:n,options:i,onChange:r}){return o.jsx(r0,{"aria-label":s,value:n,onChange:c=>r?.(c.target.value),disabled:!r,className:"h-8 w-auto rounded-lg border-border bg-transparent pl-3 text-sm text-foreground disabled:cursor-default disabled:opacity-100",children:i.map(c=>o.jsx("option",{value:c.value,children:c.label},c.value))})}function RN(){const{permission:s,request:n}=MN(),i=s==="unsupported"?"This browser cannot show notifications.":s==="denied"?"Blocked in this browser. Allow notifications for this site in the browser settings to get them.":s==="granted"?"On: a notification when a session waits for your answer while you are elsewhere. The tab icon shows it too.":"Get a notification when a session waits for your answer while you are elsewhere. The browser asks first.";return o.jsx(ft,{title:"Notifications",hint:i,children:s==="default"?o.jsx(Le,{size:"sm",variant:"secondary",onClick:()=>{n()},children:"Enable"}):o.jsx("span",{className:"text-sm text-muted-foreground","data-testid":"notification-permission",children:s==="granted"?"Allowed":s==="denied"?"Blocked":"Unavailable"})})}function LN(){const s=Be(),{preferences:n}=De();return o.jsxs(o.Fragment,{children:[o.jsx(Qt,{title:"General",children:o.jsx(ft,{first:!0,title:"Language",hint:"App language. This beta speaks English; the agents' language is a host setting (Host › Overview).",children:o.jsx(af,{label:"Language",value:"system",options:[{value:"system",label:"System"}]})})}),o.jsx(Qt,{title:"Sending",children:o.jsx(ft,{first:!0,title:"Default send",hint:`${n.sendBehavior==="steer"?"When the agent is running, Enter steers the active turn. Command/Ctrl+Enter queues.":"When the agent is running, Enter queues. Command/Ctrl+Enter steers the active turn."} Saved in this browser.`,children:o.jsx(af,{label:"Default send",value:n.sendBehavior,onChange:i=>s.setSendBehavior(i),options:[{value:"steer",label:"Steer"},{value:"queue",label:"Queue"}]})})}),o.jsxs(Qt,{title:"This browser",children:[o.jsx(ft,{first:!0,title:"Saved preferences",hint:"Default send, the theme and your last New session choices (team, model, thinking, permissions) stay in this browser. The access token never does.",children:o.jsx(Le,{size:"sm",variant:"secondary",onClick:()=>s.resetPreferences(),children:"Reset"})}),o.jsx(RN,{})]})]})}function ON(){const s=Be(),{preferences:n}=De();return o.jsxs(o.Fragment,{children:[o.jsx(Qt,{title:"Theme",children:o.jsx(ft,{first:!0,title:"Theme",hint:"Paseo's light and dark themes; System follows this device. Saved in this browser.",children:o.jsx(af,{label:"Theme",value:n.theme,onChange:i=>s.setTheme(i),options:[{value:"system",label:"System"},{value:"light",label:"Light"},{value:"dark",label:"Dark"}]})})}),o.jsx(Yt,{what:"Paseo's other themes, fonts, sizes, content width and code highlighting",why:"This beta keeps Paseo's defaults for them."})]})}function k0(s){return s.hostname??s.gateway.replace(/^https?:\/\//,"")}function DN(){const{connection:s}=De(),n=k0(s);return o.jsxs(o.Fragment,{children:[o.jsx(Qt,{title:"About",children:o.jsxs(ft,{first:!0,title:"App version",hint:"This device, ALP web beta",children:["v","0.0.1-beta.4"]})}),o.jsx(Qt,{title:"Connected hosts",children:o.jsx(ft,{first:!0,title:n,hint:"ALP on the host, through the gateway (ALP JSON-RPC v1)",children:s.daemonVersion?`v${s.daemonVersion.replace(/^v/,"")}`:"unknown"})})]})}function qN(){const s=Be(),{principal:n,connection:i,settings:r}=De();v.useEffect(()=>{s.loadSettings()},[s]);const c=["session.read","session.write","project.read","project.write"];return o.jsxs(o.Fragment,{children:[o.jsxs(Qt,{title:"Host",children:[o.jsx(ft,{first:!0,title:"Machine",hint:"The host's name, as it reports it.",children:i.hostname??"unknown"}),o.jsx(ft,{title:"ALP",children:i.daemonVersion??"unknown"}),o.jsx(ft,{title:"Gateway",children:o.jsx("span",{className:"break-all font-mono text-xs",children:i.gateway})}),o.jsx(ft,{title:"Agents' language",hint:"Set on the host with alp; read only here.",children:r.status==="loading"?o.jsx($t,{label:"Loading…",className:"text-xs"}):r.language?`${r.language.applies}${r.language.language?"":" (default)"}`:"Not available"}),r.status==="error"?o.jsx("p",{role:"alert",className:"border-t border-border px-4 py-3 text-xs text-destructive",children:r.error?.message}):null]}),o.jsx(Qt,{title:`Models new sessions can pick${r.models.length?` (${r.models.length})`:""}`,children:r.models.length?o.jsx("ul",{className:"max-h-72 divide-y divide-border overflow-y-auto",children:r.models.map(u=>o.jsxs("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-sm",children:[o.jsx("span",{className:"min-w-0 truncate",children:u.label}),o.jsx("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:u.id})]},u.id))}):o.jsx(ft,{first:!0,title:r.status==="ready"?"None listed":"Loading…"})}),o.jsxs(Qt,{title:"Access token",children:[o.jsxs(ft,{first:!0,title:"Name",children:[n?.label??"—"," ",o.jsxs("span",{className:"font-mono text-xs",children:["(",n?.id,")"]})]}),o.jsx(ft,{title:"Allows",children:o.jsx("span",{className:"flex flex-wrap justify-end gap-1",children:c.map(u=>{const d=ze(n??void 0,u);return o.jsxs("span",{className:Y("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs [&_svg]:size-3",d?"bg-primary/15 text-highlight":"bg-secondary text-muted-foreground"),children:[d?o.jsx(zf,{"aria-hidden":!0}):o.jsx(Mf,{"aria-hidden":!0}),u]},u)})})}),o.jsx(ft,{title:"Modes",hint:"Permissions a session may run with.",children:n?.modes?n.modes.map(Ml).join(", "):"Any"})]})]})}function BN(){const s=Be(),{principal:n,workspace:i}=De(),r=n?.workspaces??[];return o.jsxs(o.Fragment,{children:[o.jsx(Qt,{title:"Projects this token opens",children:r.length?r.map((c,u)=>o.jsx(ft,{first:u===0,title:Vt(c),hint:o.jsx("span",{className:"break-all font-mono",children:c}),children:c===i?o.jsx("span",{className:"text-highlight",children:"Open"}):o.jsx(Le,{size:"sm",variant:"secondary",onClick:()=>s.selectWorkspace(c),children:"Open"})},c)):o.jsx(ft,{first:!0,title:"No projects",hint:"This access token grants no workspace."})}),o.jsx(Yt,{what:"Adding or removing projects",why:"The access token decides which projects you can open. The host owner grants them with alp-gateway credential create --workspace."})]})}function UN(){const s=Be(),{connection:n}=De(),i=n.gateway.startsWith("https:");return o.jsxs(Qt,{title:"This connection",children:[o.jsx(ft,{first:!0,title:"Gateway",children:o.jsx("span",{className:"break-all font-mono text-xs",children:n.gateway})}),o.jsx(ft,{title:"State",children:n.phase==="open"?"Connected":n.phase==="reconnecting"?`Reconnecting (attempt ${n.attempt})`:n.phase}),o.jsx(ft,{title:"Transport",hint:i?"TLS to the gateway.":"Plain HTTP, allowed only on this machine (loopback or an SSH tunnel).",children:i?"HTTPS / WSS":"Loopback HTTP / WS"}),o.jsx(ft,{title:"Access token",hint:"Kept in this tab's memory only. Disconnecting forgets it.",children:o.jsx(Le,{size:"sm",variant:"destructive",onClick:()=>s.disconnect(),children:"Disconnect"})})]})}function $N({kind:s,name:n,onClose:i}){const r=Be(),[c,u]=v.useState({status:"loading"});v.useEffect(()=>{let h=!0;return u({status:"loading"}),r.getLibraryEntry(s,n).then(m=>{h&&u({status:"ready",entry:m})},m=>{h&&u({status:"error",error:qe(m).message})}),()=>{h=!1}},[r,s,n]);const d=c.entry;return o.jsx(Qt,{title:n,action:o.jsx(Le,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:i,children:"Close"}),children:o.jsxs("div",{"data-testid":"library-entry","aria-label":`${n} content`,role:"group",children:[c.status==="loading"?o.jsx("div",{className:"p-4",children:o.jsx($t,{label:"Loading…",className:"text-xs"})}):null,c.status==="error"?o.jsx("p",{role:"alert",className:"p-4 text-xs text-destructive",children:c.error}):null,d?o.jsxs(o.Fragment,{children:[o.jsx(ft,{first:!0,title:"Source",hint:d.usedBy.length?`Used by ${d.usedBy.join(", ")}`:void 0,children:o.jsxs("span",{className:"text-xs",children:[d.source,d.overrides?` · overrides ${d.overrides}`:""]})}),d.librarySkills?.length?o.jsx(ft,{title:"Skills the library gives it",children:d.librarySkills.join(", ")}):null,fN(d.content).map(h=>o.jsxs("div",{className:"border-t border-border p-4",children:[o.jsx("div",{className:"mb-2 font-mono text-xs text-muted-foreground",children:h.label}),o.jsx("pre",{className:"max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md bg-secondary p-3 font-mono text-xs text-foreground",children:h.text})]},h.key)),d.secrets.length?o.jsxs("p",{className:"border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[d.secrets.length===1?"One value that can hold a secret is":`${d.secrets.length} values that can hold secrets are`," shown as ",zl,": the gateway keeps them on the host."]}):null]}):null]})})}function HN({kind:s,selected:n,onChanged:i}){const r=Be(),[c,u]=v.useState(""),[d,h]=v.useState(""),[m,g]=v.useState(""),[x,y]=v.useState(null),[w,k]=v.useState(!1),[T,S]=v.useState(!1),[E,q]=v.useState(null);v.useEffect(()=>{let M=!0;return k(!1),q(null),h(""),n?r.getLibraryEntry(s,n).then(R=>{if(M){if(R.source!=="project"||R.overrides||R.secrets.length||R.revision===void 0){q("Only project-only instruction entries can be edited here.");return}u(n),y(R.revision),g(JSON.stringify(R.content,null,2)),k(!0)}},R=>{M&&q(qe(R).message)}):(u(""),y(null),g(JSON.stringify(s==="skills"?{body:""}:{instructions:"",config:{description:""}},null,2)),k(!0)),()=>{M=!1}},[r,s,n]);const L=async M=>{S(!0),q(null);try{const R=M==="save"?{name:c,content:JSON.parse(m),revision:x}:M==="delete"?{name:c,revision:x}:{from:c,to:d},$=await r.writeLibrary(M,s,R);M==="save"&&y($.revision),(M==="delete"||M==="rename")&&k(!1),i()}catch(R){q(qe(R).message)}finally{S(!1)}};return o.jsx(Qt,{title:n?"Edit project instructions":"New project instructions",children:o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Agents and skills only. Host entries, executable configuration, references and extra files cannot be changed here."}),E?o.jsx("p",{role:"alert",className:"text-xs text-destructive",children:E}):null,w?o.jsxs(o.Fragment,{children:[o.jsx(Ti,{"aria-label":"Entry name",value:c,onChange:M=>u(M.target.value),disabled:T||!!n,placeholder:"Entry name"}),o.jsx("textarea",{"aria-label":"Instruction entry JSON",className:"min-h-48 rounded border border-border bg-background p-2 font-mono text-xs",value:m,onChange:M=>g(M.target.value),disabled:T}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx(Le,{size:"sm",disabled:T||!c.trim(),onClick:()=>{L("save")},children:"Save project entry"}),n?o.jsx(Le,{size:"sm",variant:"secondary",disabled:T,onClick:()=>{L("delete")},children:"Delete project entry"}):null]}),n?o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx(Ti,{"aria-label":"New entry name",value:d,onChange:M=>h(M.target.value),placeholder:"New name",disabled:T}),o.jsx(Le,{size:"sm",variant:"secondary",disabled:T||!d.trim(),onClick:()=>{L("duplicate")},children:"Duplicate"}),o.jsx(Le,{size:"sm",variant:"secondary",disabled:T||!d.trim(),onClick:()=>{L("rename")},children:"Rename"})]}):null]}):null]})})}function pa({kind:s,noun:n}){const i=Be(),{workspace:r}=De(),[c,u]=v.useState({status:"loading",entries:[]}),[d,h]=v.useState(null),m=i.libraryBlock(),g=v.useCallback(()=>{let x=!0;return u(y=>({...y,status:"loading",error:void 0})),i.listLibrary(s).then(y=>{x&&u({status:"ready",entries:y})},y=>{x&&u({status:"error",entries:[],error:qe(y).message})}),()=>{x=!1}},[i,s]);return v.useEffect(()=>m?void 0:g(),[g,m,r]),v.useEffect(()=>{h(null)},[s,r]),m?o.jsx(Yt,{what:`Listing ${n}`,why:m}):o.jsxs(o.Fragment,{children:[o.jsxs(Qt,{title:r?`As ${Vt(r)} sees them`:void 0,action:o.jsx(Le,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>g(),children:"Refresh"}),children:[c.status==="loading"&&!c.entries.length?o.jsx("div",{className:"p-4",children:o.jsx($t,{label:"Loading…",className:"text-xs"})}):null,c.status==="error"?o.jsx("p",{role:"alert",className:"p-4 text-xs text-destructive",children:c.error}):null,c.status==="ready"&&!c.entries.length?o.jsx(ft,{first:!0,title:`No ${n}`}):null,c.entries.map((x,y)=>o.jsx("button",{type:"button",onClick:()=>h(w=>w===x.name?null:x.name),"aria-expanded":d===x.name,"data-testid":`library-row-${x.name}`,className:Y("block w-full text-left hover:bg-sidebar-hover",Xf,d===x.name&&"bg-sidebar-hover"),children:o.jsx(ft,{first:y===0,title:o.jsx("span",{className:"font-mono text-[13px]",children:x.name}),hint:[x.description,x.usedBy?.length?`Used by ${x.usedBy.join(", ")}`:""].filter(Boolean).join(" · ")||void 0,children:o.jsxs("span",{className:"text-xs",children:[x.source,x.overrides?` · overrides ${x.overrides}`:""]})})},`${x.source}:${x.name}`))]}),i.libraryWriteBlock(s)?null:o.jsx(HN,{kind:s,selected:d,onChanged:()=>g()},`${s}:${r}:${d??"new"}`),d?o.jsx($N,{kind:s,name:d,onClose:()=>h(null)}):null,i.libraryWriteBlock(s)?o.jsx(Yt,{what:`Editing ${n}`,why:`${i.libraryWriteBlock(s)} Open an entry to read it. Values that can hold secrets (environment, headers, MCP URLs and arguments, hook commands) show as ${zl}. Changes configure commands the host runs, so edit them on the host with alp.`}):null]})}function GN({page:s}){switch(s){case"general":return o.jsx(LN,{});case"appearance":return o.jsx(ON,{});case"sidebar":return o.jsx(Yt,{what:"Arranging the sidebar",why:"This beta's sidebar has a fixed layout: New session, then the workspaces and their sessions."});case"chat":return o.jsx(Yt,{what:"Chat display settings",why:"Reasoning, tool calls and the chat outline show as Paseo's defaults; tool calls expand on click."});case"terminal":return o.jsx(Yt,{what:"Terminal settings",why:"Terminals open from the + menu (Terminal) with a fixed font and colors. A terminal is a shell on the daemon host as the account that runs alpd; the workspace is not a sandbox."});case"editor":return o.jsx(Yt,{what:"Editor",why:"The gateway has no file access, so this app has no editor."});case"diagnostics":return o.jsx(Yt,{what:"App diagnostics",why:"Collecting host, provider and log details runs on the host: use alp doctor there. Connection details are under Host › Connections."});case"about":return o.jsx(DN,{});case"host":return o.jsx(qN,{});case"projects":return o.jsx(BN,{});case"connections":return o.jsx(UN,{});case"alp-templates":return o.jsx(pa,{kind:"teams",noun:"templates"});case"alp-agents":return o.jsx(pa,{kind:"agents",noun:"agents"});case"alp-skills":return o.jsx(pa,{kind:"skills",noun:"skills"});case"alp-hooks":return o.jsx(pa,{kind:"hooks",noun:"hooks"});case"alp-mcp":return o.jsx(pa,{kind:"mcp",noun:"MCP servers"});case"providers":return o.jsxs(o.Fragment,{children:[o.jsx(pa,{kind:"providers",noun:"providers"}),o.jsx(Yt,{what:"Adding, testing or diagnosing providers",why:"Tests run commands on the host; they are not offered remotely."})]});case"pair-device":return o.jsx(Yt,{what:"Pairing a device",why:"This app is the remote client: open it on the other device and connect with an access token."});case"metadata":return o.jsx(Yt,{what:"Metadata generation",why:"A host setting the gateway does not expose."});case"workspaces":return o.jsx(Yt,{what:"Workspace settings",why:"The gateway has no file or git access, so workspaces and worktrees are managed on the host."});case"usage":return o.jsx(Yt,{what:"Usage and limits",why:"Account-wide on the host; check with alp usage there."});case"terminals":return o.jsx(Yt,{what:"Changing the host's terminal switch",why:"Only the host's owner turns remote terminals on or off, on the host: alp terminal allow --yes, alp terminal deny, alp terminal status. An access token also needs terminal.exec."});case"plugins":return o.jsx(Yt,{what:"Plugins",why:"Installing plugins changes the host; not offered remotely."})}}function Qx({page:s,label:n,icon:i,selected:r,onSelect:c,mobile:u}){return o.jsxs("button",{type:"button",onClick:()=>c(s),"aria-current":r?"page":void 0,"data-testid":`settings-${s}`,className:Y("flex min-h-7 w-full items-center gap-2 rounded-lg px-2 py-1 text-left text-sm text-muted-foreground hover:bg-sidebar-hover hover:text-foreground",Xf,r&&"bg-sidebar-hover text-foreground",u&&"min-h-10"),children:[o.jsx(i,{"aria-hidden":!0,strokeWidth:1.75,className:"size-4 shrink-0"}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:n}),u?o.jsx(Vn,{"aria-hidden":!0,className:"size-4 text-extra-muted"}):null]})}function Zx({page:s,onSelect:n,mobile:i}){const{connection:r}=De(),c=k0(r);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col gap-0.5 px-2 py-2",children:[o.jsx("p",{className:"px-2 py-1 text-sm text-extra-muted",children:"App"}),v0.map(u=>o.jsx(Qx,{page:u.id,label:u.label,icon:u.icon,selected:s===u.id,onSelect:n,mobile:i},u.id))]}),o.jsxs("div",{className:"flex flex-col gap-0.5 px-2 py-2",children:[o.jsx("p",{className:"px-2 py-1 text-sm text-extra-muted",children:"Host"}),o.jsxs("div",{className:"flex min-h-7 items-center gap-2 px-2 py-1 text-sm",title:r.gateway,"data-testid":"settings-host-label",children:[o.jsx("span",{className:"flex size-4 items-center justify-center",children:o.jsx("span",{className:Y("size-2 rounded-full",r.phase==="open"?"bg-dot-success":"bg-dot-warning")})}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-foreground",children:c})]}),w0.map(u=>o.jsx(Qx,{page:u.id,label:u.label,icon:u.icon,selected:s===u.id,onSelect:n,mobile:i},u.id))]})]})}function IN({onClose:s,mobile:n}){const[i,r]=v.useState(n?null:"general");v.useEffect(()=>{const d=h=>{h.key==="Escape"&&!(h.target instanceof HTMLElement&&h.target.closest('[role="menu"],dialog'))&&s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s]);const c=(d,h)=>o.jsx("div",{className:"flex h-14 shrink-0 items-center gap-2 border-b border-border px-2 md:h-9",children:o.jsxs("button",{type:"button",onClick:h,className:Y("flex min-h-7 items-center gap-2 rounded-lg px-2 py-1 text-sm text-muted-foreground hover:bg-sidebar-hover hover:text-foreground",Xf),children:[o.jsx(Cf,{"aria-hidden":!0,className:"size-4"}),d]})}),u=i?o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o.jsxs("div",{className:"mx-auto w-full max-w-[720px] p-4 pt-14",children:[o.jsx("h2",{className:"mb-6 ml-1 text-[26px] font-semibold text-foreground","data-testid":"settings-detail-header-title",children:_N[i]}),o.jsx(GN,{page:i})]})}):null;return n?o.jsxs("div",{role:"region","aria-label":"Settings",className:"flex h-dvh flex-col bg-background",children:[i?c("Settings",()=>r(null)):c("Back",s),i?u:o.jsx("nav",{"aria-label":"Settings",className:"min-h-0 flex-1 overflow-y-auto",children:o.jsx(Zx,{page:null,onSelect:r,mobile:!0})})]}):o.jsxs("div",{role:"region","aria-label":"Settings",className:"flex h-dvh overflow-hidden bg-background",children:[o.jsxs("nav",{"aria-label":"Settings",className:"flex w-[320px] shrink-0 flex-col border-r border-border bg-sidebar","data-testid":"settings-sidebar",children:[c("Back",s),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o.jsx(Zx,{page:i,onSelect:r,mobile:!1})})]}),o.jsx("main",{className:"flex min-w-0 flex-1 flex-col","data-testid":"settings-detail-pane",children:u})]})}const YN="modulepreload",VN=function(s){return"/"+s},Wx={},KN=function(n,i,r){let c=Promise.resolve();if(i&&i.length>0){let m=function(g){return Promise.all(g.map(x=>Promise.resolve(x).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");c=m(i.map(g=>{if(g=VN(g),g in Wx)return;Wx[g]=!0;const x=g.endsWith(".css"),y=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${y}`))return;const w=document.createElement("link");if(w.rel=x?"stylesheet":YN,x||(w.as="script"),w.crossOrigin="",w.href=g,h&&w.setAttribute("nonce",h),document.head.appendChild(w),x)return new Promise((k,T)=>{w.addEventListener("load",k),w.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return n().catch(u)})},XN=[{key:"list",label:"List"},{key:"board",label:"Board"},{key:"epics",label:"Epics"}],QN=["open","ready","closed","all"],_l=(s,n)=>s.priority-n.priority||s.id.localeCompare(n.id),j0=(s,n)=>(n.closed?.at??n.updatedAt??"").localeCompare(s.closed?.at??s.updatedAt??"")||s.id.localeCompare(n.id);function Qf(s){return s.status==="closed"?"closed":s.approvals?.length?"approve":s.status==="review"?"review":s.status==="in_progress"?"progress":s.type==="epic"?s.progress?.done?"progress":"ready":s.ready?"ready":"blocked"}const Px={approve:"Needs approval",review:"In review",progress:"In progress",ready:"Ready",blocked:"Blocked",closed:"Closed"},S0=s=>!!s.ready&&s.status!=="closed";function ZN(s){const n=s.filter(i=>i.status==="closed").length;return{open:s.length-n,ready:s.filter(S0).length,closed:n,all:s.length}}function WN(s,n,i=""){const r=i.trim().toLowerCase().split(/\s+/).filter(Boolean);return s.filter(c=>{if(n==="open"&&c.status==="closed"||n==="ready"&&!S0(c)||n==="closed"&&c.status!=="closed")return!1;if(!r.length)return!0;const u=[c.id,c.title,c.type??"",c.assignee??"",...c.labels??[]].join(" ").toLowerCase();return r.every(d=>u.includes(d))})}const PN=[{key:"approve",title:"Waiting for your approval"},{key:"review",title:"In review"},{key:"progress",title:"In progress"},{key:"ready",title:"Ready"},{key:"waiting",title:"Blocked or waiting"},{key:"epics",title:"Epics"},{key:"closed",title:"Closed"}];function FN(s){return s.status==="closed"?"closed":s.approvals?.length?"approve":s.status==="review"?"review":s.status==="in_progress"?"progress":s.type==="epic"?"epics":s.ready?"ready":"waiting"}function JN(s){return PN.map(n=>{const i=s.filter(r=>FN(r)===n.key);return{...n,tasks:i.sort(n.key==="closed"?j0:_l)}}).filter(n=>n.tasks.length)}const e3=[{key:"approve",title:"Needs approval"},{key:"blocked",title:"Blocked"},{key:"ready",title:"Ready"},{key:"progress",title:"In progress"},{key:"review",title:"In review"},{key:"closed",title:"Closed"}];function t3(s){return e3.map(n=>({...n,tasks:s.filter(i=>i.type!=="epic"&&Qf(i)===n.key).sort(n.key==="closed"?j0:_l)})).filter(n=>n.tasks.length||n.key==="blocked"||n.key==="ready"||n.key==="progress")}function n3(s,n){return n.filter(i=>i.type==="epic"||i.progress).sort(_l).map(i=>{const r=s.filter(d=>d.parent===i.id).sort(_l),c=i.progress?.done??r.filter(d=>d.status==="closed").length,u=i.progress?.total??r.length;return{epic:i,children:r,done:c,total:u,percent:u?Math.round(c/u*100):0}})}function N0(s,n=Date.now()){const i=s?Date.parse(s):NaN;if(Number.isNaN(i))return"";const r=Math.max(0,Math.floor((n-i)/6e4));return r<60?`${r}m`:r<1440?`${Math.floor(r/60)}h`:r<1440*14?`${Math.floor(r/1440)}d`:`${Math.floor(r/10080)}w`}const Qr="main",T0=5,Or=.1,gl=.15,Fx=.4,s3=16,i3=1030,Jx=()=>({root:{kind:"pane",id:Qr},focused:Qr,assign:{},actives:{}});function Ut(s){return s.kind==="pane"?[s.id]:s.children.flatMap(Ut)}function A0(s){return s.kind==="pane"?1:1+Math.max(...s.children.map(A0))}const E0=s=>s.kind==="pane"?[s.id]:[s.id,...s.children.flatMap(E0)];function ey(s,n){const i=new Set(E0(s));let r=1;for(;i.has(`${n}-${r}`);)r+=1;return`${n}-${r}`}function mi(s,n){const i=Ut(s.root),r=s.assign[n];return r&&i.includes(r)?r:i.includes(s.focused)?s.focused:i[0]}function a3(s,n,i){const r=Object.fromEntries(Ut(s.root).map(c=>[c,[]]));for(const c of n)r[mi(s,i(c))].push(c);return r}function Xl(s,n){if(s.kind==="pane")return s.id===n?[]:null;for(let i=0;i<s.children.length;i+=1){const r=Xl(s.children[i],n);if(r)return[i,...r]}return null}const Zf=(s,n)=>n.reduce((i,r)=>i.children[r],s);function Rl(s,n,i){if(!n.length)return i(s);const r=s,[c,...u]=n;return{...r,children:r.children.map((d,h)=>h===c?Rl(d,u,i):d)}}function ty(s,{target:n,position:i,key:r}){const c=Xl(s.root,n);if(!c)return null;const u=i==="left"||i==="right"?"horizontal":"vertical",d=i==="right"||i==="bottom",h=ey(s.root,"pane"),m={kind:"pane",id:h},g=c.slice(0,-1),x=c.length?Zf(s.root,g):null,y=c[c.length-1]??0;let w;if(x&&x.direction===u){const k=x.sizes[y]??0,T=d?y+1:y,S=x.sizes.slice();S.splice(T,0,k/2),S[y+(d?0:1)]=k/2;const E=x.children.slice();E.splice(T,0,m),w=Rl(s.root,g,()=>({...x,children:E,sizes:S}))}else{const k=ey(s.root,"group");w=Rl(s.root,c,T=>({kind:"group",id:k,direction:u,children:d?[T,m]:[m,T],sizes:[.5,.5]}))}return A0(w)>T0?null:{...s,root:w,focused:h,assign:r?{...s.assign,[r]:h}:s.assign}}function C0(s,n){const i=Xl(s,n);if(!i||!i.length)return null;for(let r=i.length-1;r>=0;r-=1){const c=Zf(s,i.slice(0,r)),u=i[r];for(let d=u-1;d>=0;d-=1){const h=Ut(c.children[d]);if(h.length)return h[h.length-1]}for(let d=u+1;d<c.children.length;d+=1){const h=Ut(c.children[d]);if(h.length)return h[0]}}return null}function ny(s,n){const i=Xl(s.root,n);if(!i||!i.length)return null;const r=C0(s.root,n),c=i.slice(0,-1),u=Zf(s.root,c),d=i[i.length-1],h=u.children.filter((T,S)=>S!==d),m=u.sizes.filter((T,S)=>S!==d),g=m.reduce((T,S)=>T+S,0)||1,x=Rl(s.root,c,()=>h.length===1?h[0]:{...u,children:h,sizes:m.map(T=>T/g)}),y=Object.fromEntries(Object.entries(s.assign).filter(([,T])=>T!==n)),w=Object.fromEntries(Object.entries(s.actives).filter(([T])=>T!==n)),k=s.focused===n?r??Ut(x)[0]:s.focused;return{root:x,focused:k,assign:y,actives:w}}function r3(s,n,i){return Ut(s.root).includes(i)?{...s,focused:i,assign:{...s.assign,[n]:i},actives:{...s.actives,[i]:n}}:s}function M0(s){const n=s.length;if(!n)return[];if(n===1)return[1];if(n*Or>1)return s.map(()=>1/n);const i=s.map(m=>Number.isFinite(m)&&m>0?m:0),r=i.reduce((m,g)=>m+g,0),c=r>0?i.map(m=>m/r):i.map(()=>1/n),u=c.map(()=>0),d=new Set(c.map((m,g)=>g));let h=1;for(;d.size;){let m=0;for(const x of d)m+=c[x];if(m<=0){for(const x of d)u[x]=h/d.size;break}const g=[...d].filter(x=>c[x]/m*h<Or);if(!g.length){for(const x of d)u[x]=c[x]/m*h;break}for(const x of g)u[x]=Or,d.delete(x),h-=Or}return u}function o3(s,n,i){const r=c=>c.kind==="pane"?c:c.id===n&&i.length===c.children.length?{...c,sizes:M0(i)}:{...c,children:c.children.map(r)};return{...s,root:r(s.root)}}function rf(s,n={left:0,top:0,right:1,bottom:1}){if(s.kind==="pane")return[{id:s.id,...n}];const i=[];let r=0;for(let c=0;c<s.children.length;c+=1){const u=s.sizes[c]??0;if(s.direction==="horizontal"){const d=n.right-n.left;i.push(...rf(s.children[c],{...n,left:n.left+d*r,right:n.left+d*(r+u)}))}else{const d=n.bottom-n.top;i.push(...rf(s.children[c],{...n,top:n.top+d*r,bottom:n.top+d*(r+u)}))}r+=u}return i}function sy(s,n,i){const r=rf(s),c=r.find(g=>g.id===n);if(!c)return null;const u=i==="left"||i==="right",d=(g,x,y,w)=>x<y?y-x:w<g?g-w:0,h=(g,x,y,w)=>Math.max(0,Math.min(x,w)-Math.max(g,y)),m=r.filter(g=>g.id!==n).map(g=>{const x=i==="left"?c.left-g.right:i==="right"?g.left-c.right:i==="up"?c.top-g.bottom:g.top-c.bottom;if(x<-1e-6)return null;const[y,w,k,T]=u?[g.top,g.bottom,c.top,c.bottom]:[g.left,g.right,c.left,c.right],S=Math.abs(u?(g.top+g.bottom)/2-(c.top+c.bottom)/2:(g.left+g.right)/2-(c.left+c.right)/2);return{id:g.id,primary:x,secondary:d(y,w,k,T),overlap:h(y,w,k,T),center:S}}).filter(g=>!!g);return m.sort((g,x)=>g.primary-x.primary||g.secondary-x.secondary||x.overlap-g.overlap||g.center-x.center||String(g?.id).localeCompare(String(x?.id))),m[0]?.id??null}function l3({width:s,height:n,x:i,y:r}){const c=s*((1-Fx)/2),u=n*((1-Fx)/2);if(i>=c&&i<=s-c&&r>=u&&r<=n-u)return"center";if(i<=s*gl)return"left";if(i>=s-s*gl)return"right";if(r<=n*gl)return"top";if(r>=n-n*gl)return"bottom";const d=[["left",i],["right",s-i],["top",r],["bottom",n-r]];return d.sort((h,m)=>h[1]-m[1]),d[0][0]}const of=s=>!!s&&typeof s=="object"&&!Array.isArray(s),wl=s=>typeof s=="string"&&!!s.trim()&&s.length<=i3;function z0(s,n,i){if(!of(s)||i>T0)return null;const r=s;if(!wl(r.id)||n.has(r.id))return null;if(n.add(r.id),r.kind==="pane")return{kind:"pane",id:r.id};if(r.kind!=="group"||r.direction!=="horizontal"&&r.direction!=="vertical"||!Array.isArray(r.children)||!Array.isArray(r.sizes)||r.children.length!==r.sizes.length||r.children.length<2)return null;const c=[];for(const d of r.children){const h=z0(d,n,i+1);if(!h)return null;c.push(h)}const u=r.sizes.map(d=>typeof d=="number"&&Number.isFinite(d)&&d>0?d:0);return{kind:"group",id:r.id,direction:r.direction,children:c,sizes:M0(u)}}function c3(s){if(!of(s))return;const n=s,i=z0(n.root,new Set,1);if(!i||i.kind==="pane")return;const r=Ut(i);if(r.length>s3)return;const c=(m,g)=>{const x={};if(!of(m))return x;for(const[y,w]of Object.entries(m).slice(0,100))wl(y)&&wl(w)&&g(y,w)&&(x[y]=w);return x},u=c(n.assign,(m,g)=>r.includes(g)),d=c(n.actives,m=>r.includes(m)),h=wl(n.focused)&&r.includes(n.focused)?n.focused:r[0];return{root:i,focused:h,assign:u,actives:d}}const _0="alp-web:layout",lf=1,u3=["changes","terminal","diff","files","agents","tasks"],R0=Object.freeze({initial:320,min:200,max:600}),L0=Object.freeze({initial:320,min:240,max:720}),d3=20,f3=50,O0=300,D0=1024,h3=D0+5,cf=s=>!!s&&typeof s=="object"&&!Array.isArray(s),q0=s=>typeof s=="string"&&s.trim()&&s.length<=O0?s:void 0,m3=s=>typeof s=="string"&&s.trim()&&s.length<=D0?s:void 0,iy=s=>typeof s=="string"&&s.trim()&&s.length<=h3?s:void 0,_r=(s,n=()=>!0,i=q0)=>Array.isArray(s)?[...new Set(s.map(i).filter(r=>!!r&&n(r)))].slice(0,f3):[];function Ll(s,n){if(!(typeof s!="number"||!Number.isFinite(s)))return Math.round(Math.min(n.max,Math.max(n.min,s)))}const p3=(s,n)=>`${s}
|
|
21
|
-
${n}`;function g3(s){if(!cf(s))return;const n=s,i=q0(n.session),r=iy(n.active),c=c3(n.panes),u=_r(n.files,d=>Hs(d)===d&&!Ai(d),m3);return{...i?{session:i}:{},agents:i?_r(n.agents,d=>d!==i):[],tasks:_r(n.tasks),panels:_r(n.panels,d=>u3.includes(d)),order:_r(n.order,void 0,iy),...u.length?{files:u}:{},...r?{active:r}:{},...c?{panes:c}:{},at:typeof n.at=="number"&&Number.isFinite(n.at)?n.at:0}}function B0(s){const n={workspaces:{}};if(typeof s!="string"||!s)return n;let i;try{i=JSON.parse(s)}catch{return n}if(!cf(i)||i.v!==lf)return n;const r={};if(cf(i.workspaces)){const d=Object.entries(i.workspaces).map(([h,m])=>[h,g3(m)]).filter(([h,m])=>h.length<=2*O0&&m).sort((h,m)=>(m[1]?.at??0)-(h[1]?.at??0)).slice(0,d3);for(const[h,m]of d)m&&(r[h]=m)}const c=Ll(i.sidebarWidth,R0),u=Ll(i.dockWidth,L0);return{...c?{sidebarWidth:c}:{},...u?{dockWidth:u}:{},workspaces:r}}function x3(s){const n=B0(JSON.stringify({...s,v:lf}));return JSON.stringify({v:lf,...n})}function Wf(s){if(!s)return{workspaces:{}};try{return B0(s.getItem(_0))}catch{return{workspaces:{}}}}function U0(s,n){if(!s)return!1;try{return s.setItem(_0,x3(n(Wf(s)))),!0}catch{return!1}}const y3=(s,n)=>s.workspaces[n];function $0(s,n,i){const r=new Map(i.map((c,u)=>[c,u]));return s.map((c,u)=>({tab:c,index:u,rank:r.get(n(c))??i.length+u})).sort((c,u)=>c.rank-u.rank).map(c=>c.tab)}function uf(s,n,i){if(s.indexOf(n)<0)return s;const c=s.filter(d=>d!==n),u=Math.max(0,Math.min(c.length,i));return[...c.slice(0,u),n,...c.slice(u)]}function Ol(){try{return window.localStorage}catch{return}}const fn=s=>`${s.kind}:${s.id}`;function Pf(s,n,i,r){const c=s.findIndex(d=>fn(d)===fn(n));if(c<0)return[];let u=i==="left"?s.slice(0,c):i==="right"?s.slice(c+1):s.filter((d,h)=>h!==c);return n.kind==="agent"&&n.id!==r&&(u=u.filter(d=>!(d.kind==="agent"&&d.id===r))),u}function ay({tabs:s,active:n,selected:i,closing:r,keep:c}){const u=new Set(r.map(fn)),d=r.some(x=>x.kind==="agent"&&x.id===i),h=new Set(s.filter(x=>!u.has(fn(x))&&!(d&&x.kind==="agent")).map(fn)),m=!!n&&u.has(fn(n));let g=n&&!m?n:null;if(n&&m)if(c&&h.has(fn(c)))g=c;else{const x=s.findIndex(y=>fn(y)===fn(n));g=s.slice(x+1).find(y=>h.has(fn(y)))??s.slice(0,x).reverse().find(y=>h.has(fn(y)))??null}else g&&!h.has(fn(g))&&(g=s.find(x=>h.has(fn(x)))??null);return{closingRoot:d,next:g}}const Cd=s=>s.kind==="draft"||s.kind==="launcher",Md={kind:"draft",id:"new"},Oe=s=>`${s.kind}:${s.id}`,H0=v.createContext(null);function vt(){const s=v.useContext(H0);if(!s)throw new Error("useTabs outside TabsProvider");return s}const zd=s=>{if(!s)return null;const n=s.indexOf(":"),i=s.slice(0,n),r=s.slice(n+1);return r?i==="agent"||i==="task"?{kind:i,id:r}:i==="file"?Hs(r)===r&&!Ai(r)?{kind:i,id:r}:null:i==="panel"?{kind:i,id:r}:null:null};function b3({children:s}){const n=Be(),{selected:i,focus:r,workspace:c,connection:u,sessions:d,tree:h}=De(),[m,g]=v.useState([]),[x,y]=v.useState([]),[w,k]=v.useState([]),[T,S]=v.useState({}),[E,q]=v.useState([]),[L,M]=v.useState(!1),[R,$]=v.useState([]),[_,V]=v.useState(null),[A,I]=v.useState([]),[O,ce]=v.useState(Jx),[le,pe]=v.useState(null),ie=c?p3(u.gateway,c):null,[de,B]=v.useState(null),W=v.useRef(null),[ne,me]=v.useState(!1),N=v.useCallback(()=>{W.current=null,me(!1)},[]),X=()=>{const U=W.current;return new Set(U?[U.session,...U.agents].map(se=>`agent:${se}`):[])},P=v.useRef(null),ee=v.useCallback(U=>{const se=n.getState().focus;n.focusSession(U);const ye=n.getState().focus;ye!==se&&(P.current=ye)},[n]);v.useEffect(()=>{const U=W.current;U&&(i?U.session!==i:U.attempted)&&N(),g(i?[i]:[]),V(se=>{if(se?.kind==="draft"&&n.getState().busy.create)return se;if(i&&U?.session===i&&U.active){const ye=zd(U.active);if(ye&&ye.kind!=="agent")return ye}return i&&U?.session===i&&!U.active&&se?.kind==="launcher"?se:i?{kind:"agent",id:i}:se&&se.kind!=="agent"?se:null})},[i,n,N]),v.useEffect(()=>{const U=ie?y3(Wf(Ol()),ie):void 0;y(U?.tasks??[]),k(U?.files??[]),S({}),q(U?.panels??[]),I(U?.order??[]);const se=U?.panes??Jx(),ye=new Set(Object.values(se.assign)),Ne=Ut(se.root).length>1?Ut(se.root).filter(Je=>!ye.has(Je)).map((Je,kt)=>({pane:Je,id:`n${kt+1}`})):[];ce(Ne.length?{...se,assign:{...se.assign,...Object.fromEntries(Ne.map(Je=>[`launcher:${Je.id}`,Je.pane]))}}:se),pe(null),M(!1),$(Ne.map(Je=>Je.id));const Te=zd(U?.active);W.current=U?.session?{session:U.session,agents:U.agents,active:U.active}:null,me(!!U?.session);const Ze=Ne.find(Je=>Je.pane===se.focused);V(Je=>Te&&Te.kind!=="agent"&&(Te.kind==="task"?U?.tasks.includes(Te.id):Te.kind==="file"?U?.files?.includes(Te.id):U?.panels.includes(Te.id))?Te:(Je&&Je.kind!=="agent"?null:Je)??(Ze?{kind:"launcher",id:Ze.id}:null)),B(ie)},[ie]),v.useEffect(()=>{const U=W.current;!U||U.attempted||i||d.status!=="ready"||(_?.kind!=="draft"&&d.list.some(se=>se.id===U.session)?(U.attempted=!0,n.selectSession(U.session)):N())},[d,i,_,n,N]),v.useEffect(()=>{const U=W.current;if(!U||!h||h.rootId!==i||U.session!==i)return;if(h.status==="gone"||h.status==="error"){N();return}if(h.status!=="attached")return;N();const se=U.agents.filter(Ne=>h.projection.sessions[Ne]);if(!se.length)return;g(Ne=>[...Ne,...se.filter(Te=>!Ne.includes(Te))]);const ye=zd(U.active);ye?.kind==="agent"&&se.includes(ye.id)&&(n.focusSession(ye.id),V(ye))},[h,i,n,N]),v.useEffect(()=>{if(!(!r||!i)){if(g(U=>U.includes(r)?U:[...U,r]),P.current===r){P.current=null;return}V(U=>U?.kind==="draft"&&n.getState().busy.create||U&&W.current?.session===i&&r===i&&U.kind!=="agent"?U:{kind:"agent",id:r})}},[r,i,n]);const oe=v.useMemo(()=>$0([...m.map(U=>({kind:"agent",id:U})),...x.map(U=>({kind:"task",id:U})),...w.map(U=>({kind:"file",id:U})),...E.map(U=>({kind:"panel",id:U})),...L?[Md]:[],...R.map(U=>({kind:"launcher",id:U}))],Oe,A),[m,x,w,E,L,R,A]),re=v.useMemo(()=>Ut(O.root),[O.root]),Z=v.useMemo(()=>a3(O,oe,Oe),[O,oe]),fe=_?mi(O,Oe(_)):re.includes(O.focused)?O.focused:re[0],ge=Z[fe]??[],he=v.useCallback(U=>{if(U===fe)return _;const se=Z[U]??[],ye=O.actives[U];return se.find(Ne=>Oe(Ne)===ye)??se[0]??null},[fe,_,Z,O.actives]);v.useEffect(()=>{de===ie&&ce(U=>{const se=new Set(oe.map(Oe)),ye=X(),Ne=Ut(U.root);let Te=!1;const Ze={};for(const[Ye,at]of Object.entries(U.assign))(se.has(Ye)||ye.has(Ye))&&Ne.includes(at)?Ze[Ye]=at:Te=!0;for(const Ye of se)Ze[Ye]||(Ze[Ye]=fe,Te=!0);let Je=U.actives;const kt=_?Oe(_):null;return kt&&se.has(kt)&&Je[fe]!==kt&&(Je={...Je,[fe]:kt},Te=!0),U.focused!==fe&&(Te=!0),Te?{...U,focused:fe,assign:Ze,actives:Je}:U})},[de,ie,oe,_,fe]),v.useEffect(()=>{if(de!==ie||ne||re.length<2)return;const U=re.filter(se=>!(Z[se]??[]).length);U.length&&ce(se=>{let ye=se;for(const Ne of U)ye=ny(ye,Ne)??ye;return ye})},[de,ie,ne,re,Z]),v.useEffect(()=>{le&&(!re.includes(le)||re.length<2)&&pe(null)},[le,re]),v.useEffect(()=>{if(!ie||de!==ie)return;const U=i??W.current?.session,se=oe.filter(Te=>!Cd(Te)).map(Oe),ye=new Set([...se,...X()]),Ne=re.length>1?{root:O.root,focused:fe,assign:Object.fromEntries(Object.entries(O.assign).filter(([Te])=>ye.has(Te))),actives:Object.fromEntries(Object.entries(O.actives).filter(([,Te])=>ye.has(Te)))}:void 0;U0(Ol(),Te=>({...Te,workspaces:{...Te.workspaces,[ie]:{...U?{session:U}:{},agents:U?[...m.filter(Ze=>Ze!==U),...W.current?.agents??[]]:[],tasks:x,files:w,panels:E,order:se,..._&&!Cd(_)?{active:Oe(_)}:W.current?.active?{active:W.current.active}:{},...Ne?{panes:Ne}:{},at:Date.now()}}}))},[ie,de,i,m,x,w,E,oe,_,re,O,fe]);const nt=U=>{const se=W.current;se&&!Cd(U)&&(se.active=Oe(U))},$e=v.useCallback(U=>{U.kind==="agent"&&n.focusSession(U.id),nt(U),V(U)},[n]),ct=v.useCallback((U,se)=>{const ye=!!n.getState().busy.create;let Ne=U;if(ye&&Ne.some(Ye=>Ye.kind==="draft")&&(n.notify("info","The new session is still starting. Its tab opens once it is ready."),Ne=Ne.filter(Ye=>Ye.kind!=="draft")),!Ne.length)return;const Te=new Set(Ne.map(Oe));let Ze=!1;const Je={};for(const Ye of re){const at=Z[Ye]??[],Xs=Ye===fe?_:he(Ye),Qs=ay({tabs:at,active:Xs,selected:i,closing:Ne,keep:se&&at.some(sn=>Oe(sn)===Oe(se))?se:void 0});Ze||=Qs.closingRoot,Je[Ye]=Qs.next}let kt=Je[fe]??null;if(!kt&&re.length>1){const Ye=C0(O.root,fe);kt=(Ye?Je[Ye]:null)??re.map(at=>Je[at]).find(Boolean)??null}N(),g(Ye=>Ze?[]:Ye.filter(at=>!Te.has(`agent:${at}`))),y(Ye=>Ye.filter(at=>!Te.has(`task:${at}`))),k(Ye=>Ye.filter(at=>!Te.has(`file:${at}`))),q(Ye=>Ye.filter(at=>!Te.has(`panel:${at}`))),Te.has("panel:terminal")&&n.closeTerminal(),Te.has(Oe(Md))&&M(!1),$(Ye=>Ye.filter(at=>!Te.has(`launcher:${at}`))),ce(Ye=>({...Ye,actives:Object.fromEntries(re.flatMap(at=>Je[at]?[[at,Oe(Je[at])]]:[]))})),Ze?n.selectSession(null):kt?.kind==="agent"?n.focusSession(kt.id):r&&Te.has(`agent:${r}`)&&i&&ee(i),V(kt)},[re,Z,fe,_,he,O.root,i,r,n,ee,N]),ht=v.useCallback(U=>ct([U]),[ct]),ve=v.useCallback((U,se,ye)=>{const Ne=Pf(ye??Z[mi(O,Oe(U))]??[],U,se,i);Ne.length&&ct(Ne,U)},[Z,O,i,ct]),xe=v.useCallback((U,se,ye)=>{const Ne=Oe(U),Te=oe.map(Oe),Ze=new Set((Z[se]??[]).map(Oe));Ze.delete(Ne);const Je=uf([...Te.filter(sn=>Ze.has(sn)),Ne],Ne,ye),kt=Te.filter(sn=>sn!==Ne),Ye=kt.flatMap((sn,On)=>Ze.has(sn)?[On]:[]),at=Ye.length?Ye[Ye.length-1]+1:kt.length,Xs=[...kt.slice(0,at),Ne,...kt.slice(at)];let Qs=0;return Xs.map(sn=>sn===Ne||Ze.has(sn)?Je[Qs++]:sn)},[oe,Z]),Ee=v.useCallback((U,se,ye)=>{I(ye?uf(oe.map(Oe),Oe(U),se):xe(U,mi(O,Oe(U)),se))},[oe,xe,O]),je=v.useCallback(U=>{if(U===fe||!re.includes(U))return;const se=he(U);se?$e(se):(ce(ye=>({...ye,focused:U})),V(null))},[fe,re,he,$e]),Ot=v.useCallback((U,se)=>{const ye=mi(U,Oe(se)),Ne=he(ye);if(!Ne||Oe(Ne)!==Oe(se))return U;const Te=ay({tabs:Z[ye]??[],active:se,selected:null,closing:[se]}).next,Ze={...U.actives};return Te?Ze[ye]=Oe(Te):delete Ze[ye],{...U,actives:Ze}},[he,Z]),pn=v.useCallback((U,se,ye)=>{if(!re.includes(se))return;const Ne=(Z[se]??[]).filter(Te=>Oe(Te)!==Oe(U));I(xe(U,se,ye??Ne.length)),ce(Te=>r3(Ot(Te,U),Oe(U),se)),$e(U)},[re,Z,xe,Ot,$e]),Ce=v.useCallback((U,se,ye)=>{const Ne=mi(O,Oe(U));if(Ne===se&&(Z[Ne]??[]).length<2)return;const Te=ty(Ot(O,U),{target:se,position:ye,key:Oe(U)});Te&&(ce(Te),$e(U))},[O,Z,Ot,$e]),st=!!c,ue=v.useCallback(U=>{if(!st)return;const se=new Set(R);let ye=1;for(;se.has(`n${ye}`);)ye+=1;const Ne={kind:"launcher",id:`n${ye}`},Te=ty(O,{target:fe,position:U,key:Oe(Ne)});Te&&(ce(Te),$(Ze=>[...Ze,Ne.id]),V(Ne))},[st,R,O,fe]),Se=v.useCallback((U,se)=>{const ye=`launcher:${U}`,Ne=mi(O,ye);ce(Te=>({...Te,focused:Ne})),$(Te=>Te.filter(Ze=>Ze!==U)),se()},[O]),pt=v.useCallback(U=>{if(re.length<2||!re.includes(U))return;const se=Z[U]??[];se.length?ct(se):ce(ye=>ny(ye,U)??ye)},[re,Z,ct]),gn=v.useCallback(U=>{const se=sy(O.root,fe,U);return se?(je(se),!0):!1},[O.root,fe,je]),wt=v.useCallback(U=>{const se=sy(O.root,fe,U);return!se||!_?!1:(pn(_,se),!0)},[O.root,fe,_,pn]),it=v.useCallback((U,se)=>ce(ye=>o3(ye,U,se)),[]),Nt=v.useCallback(U=>pe(se=>se===U?null:U),[]),xt=v.useCallback(U=>{y(se=>se.includes(U)?se:[...se,U]),nt({kind:"task",id:U}),V({kind:"task",id:U})},[]),Rn=v.useCallback((U,se)=>{const ye=Hs(U);!ye||Ai(ye)||(k(Ne=>Ne.includes(ye)?Ne:[...Ne,ye]),S(Ne=>({...Ne,[ye]:{...se?{line:se}:{},nonce:(Ne[ye]?.nonce??0)+1}})),nt({kind:"file",id:ye}),V({kind:"file",id:ye}))},[]),Jr=v.useCallback(U=>T[U],[T]),eo=v.useCallback(U=>{n.focusSession(U),g(se=>se.includes(U)?se:[...se,U]),nt({kind:"agent",id:U}),V({kind:"agent",id:U})},[n]),Vs=v.useCallback(U=>{q(se=>se.includes(U)?se:[...se,U]),nt({kind:"panel",id:U}),V({kind:"panel",id:U})},[]),Ks=v.useCallback(()=>{M(!0),V(Md)},[]),Ln=v.useCallback(U=>{M(!1),V(se=>se?.kind!=="draft"?se:n.getState().selected===U?{kind:"agent",id:U}:null)},[n]),Ci=v.useMemo(()=>({tabs:oe,row:ge,active:_,panes:O,byPane:Z,focusedPane:fe,activeOf:he,focusPane:je,splitEmpty:ue,canSplitEmpty:st,launch:Se,splitWith:Ce,moveTabToPane:pn,closePane:pt,focusAdjacent:gn,moveTabAdjacent:wt,resize:it,maximized:le,toggleMaximized:Nt,activate:$e,close:ht,closeOthers:ve,move:Ee,openTask:xt,openFile:Rn,fileTarget:Jr,openAgent:eo,openPanel:Vs,openDraft:Ks,finishDraft:Ln}),[oe,ge,_,O,Z,fe,he,je,ue,st,Se,Ce,pn,pt,gn,wt,it,le,Nt,$e,ht,ve,Ee,xt,Rn,Jr,eo,Vs,Ks,Ln]);return o.jsx(H0.Provider,{value:Ci,children:s})}const Us="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",v3=Y("flex w-full min-w-0 items-start gap-2 rounded-lg py-2 pl-2 pr-3 text-left",Us),w3=[0,1,2,3,4],k3={list:zj,board:vj,epics:qf},j3={approve:Tb,review:Zr,progress:Gl,ready:zf,waiting:xb,epics:qf,closed:xj},S3={approve:"bg-dot-warning",review:"bg-dot-running",progress:"border-2 border-dot-warning",ready:"bg-dot-success",blocked:"bg-dot-danger",closed:"border-2 border-border"},N3={blocked:"border-l-dot-danger",ready:"border-l-dot-success",approve:"border-l-dot-warning"};function Ff({state:s}){return o.jsx("span",{role:"img","aria-label":Px[s],title:Px[s],className:Y("inline-block size-[9px] shrink-0 rounded-full",S3[s])})}function G0({value:s}){return o.jsxs("span",{className:Y("shrink-0 rounded border px-1 text-[10.5px] font-semibold tabular-nums leading-4",s===0?"border-destructive text-destructive":s===1?"border-warning text-warning":"border-border text-muted-foreground"),children:["P",s]})}function I0({onPicked:s,onOpen:n,current:i}){const r=Be(),{openTask:c,active:u}=vt(),d=A=>{(n??c)(A),s?.()},{tasks:h,principal:m,workspace:g}=De(),[x,y]=v.useState(""),[w,k]=v.useState(2),[T,S]=v.useState({view:"list",filter:"open",query:""}),E=r.tasksBlock(),q=ze(m??void 0,"project.write");v.useEffect(()=>(r.setTasksVisible(!0),()=>r.setTasksVisible(!1)),[r]);const L=h.rows,M=v.useMemo(()=>ZN(L),[L]),R=v.useMemo(()=>WN(L,T.filter,T.query),[L,T.filter,T.query]);if(!g)return o.jsx("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:"Choose a workspace to see its tasks."});if(E)return o.jsxs("p",{className:"flex items-start gap-2 px-4 py-6 text-sm text-muted-foreground",children:[o.jsx(Na,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0"}),E]});const $=A=>n?i===A:u?.kind==="task"&&u.id===A,_=A=>S(I=>({...I,view:A})),V=h.status==="ready"||L.length>0;return o.jsxs("div",{className:"@container flex min-h-0 flex-col gap-2 p-2","data-testid":"task-board","data-view":T.view,children:[o.jsxs("div",{className:"flex items-center gap-1.5 px-1 pt-1",children:[o.jsx("h2",{className:"text-sm font-semibold",children:"Tasks"}),V?o.jsxs("span",{className:"text-xs text-muted-foreground","data-testid":"tasks-open-count",children:[M.open," open"]}):null,o.jsx("span",{className:"flex-1"}),o.jsx("div",{role:"group","aria-label":"Task view",className:"flex rounded-lg border border-border bg-card p-0.5",children:XN.map(A=>{const I=k3[A.key],O=T.view===A.key;return o.jsxs("button",{type:"button","aria-pressed":O,title:A.label,onClick:()=>_(A.key),className:Y("flex h-6 items-center gap-1 rounded-md px-1.5 text-xs",O?"bg-secondary font-semibold text-foreground":"text-muted-foreground hover:text-foreground",Us),children:[o.jsx(I,{"aria-hidden":!0,className:"size-3.5"}),o.jsx("span",{className:"sr-only @[340px]:not-sr-only",children:A.label})]},A.key)})}),o.jsx("button",{type:"button","aria-label":"Refresh tasks",title:"Refresh tasks",onClick:()=>{r.refreshTasks()},className:Y("flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-sidebar-hover hover:text-foreground",Us),children:o.jsx(Ca,{"aria-hidden":!0,className:Y("size-3.5",h.status==="loading"&&"animate-spin")})})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-1",children:[o.jsx("div",{role:"group","aria-label":"Task filter",className:"flex flex-wrap gap-1",children:QN.map(A=>{const I=T.filter===A;return o.jsxs("button",{type:"button","aria-pressed":I,onClick:()=>S(O=>({...O,filter:A})),"data-testid":`tasks-filter-${A}`,className:Y("h-6 rounded-full border px-2.5 text-xs",I?"border-foreground bg-foreground font-semibold text-background":"border-border text-foreground hover:bg-secondary",Us),children:[A[0].toUpperCase()+A.slice(1)," ",o.jsx("span",{className:"text-[11px] opacity-60",children:M[A]})]},A)})}),o.jsxs("label",{className:"flex h-7 min-w-[160px] flex-1 items-center gap-1.5 rounded-lg border border-border bg-card px-2 focus-within:border-ring",children:[o.jsx(Ni,{"aria-hidden":!0,className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("input",{type:"text",role:"searchbox",value:T.query,onChange:A=>S(I=>({...I,query:A.target.value})),"aria-label":"Filter tasks",placeholder:"Filter by id, title, label, agent",className:"min-w-0 flex-1 bg-transparent text-xs text-foreground outline-none placeholder:text-muted-foreground"})]})]}),q?o.jsxs("form",{className:"flex gap-1.5 px-1",onSubmit:A=>{A.preventDefault(),x.trim()&&(r.createTask({title:x,priority:w}),y(""))},children:[o.jsx(Xr,{htmlFor:"task-title",className:"sr-only",children:"New task"}),o.jsx(Ti,{id:"task-title",value:x,onChange:A=>y(A.target.value),placeholder:"New task…",maxLength:200,className:"h-8 min-w-0 flex-1"}),o.jsx(Xr,{htmlFor:"task-priority",className:"sr-only",children:"Priority"}),o.jsx(r0,{id:"task-priority",value:w,onChange:A=>k(Number(A.target.value)),className:"h-8 w-16 text-xs",children:w3.map(A=>o.jsxs("option",{value:A,children:["P",A]},A))}),o.jsx(Le,{type:"submit",size:"icon-sm",className:"size-8","aria-label":"Add task",title:"Add task",disabled:!x.trim(),children:o.jsx(fs,{"aria-hidden":!0})})]}):o.jsx("p",{className:"px-2 text-xs text-muted-foreground",children:"Your access token can read tasks but not change them."}),h.creates.map(A=>o.jsx("div",{role:A.status==="creating"?"status":"alert",className:Y("mx-1 rounded-lg border px-3 py-2 text-xs",A.status==="creating"?"border-border text-muted-foreground":A.status==="unknown"?"border-warning/40 bg-warning/5 text-warning":"border-destructive/40 bg-destructive/5 text-destructive"),children:A.status==="creating"?o.jsx($t,{label:`Creating “${A.title}”…`}):o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"mb-1.5 font-medium text-foreground",children:["“",A.title,"”"]}),o.jsx("p",{children:A.error}),A.match?o.jsxs("p",{className:"mt-1 text-foreground/90",children:["A task with this title is in the list (",A.match,"); it was probably created."]}):null,o.jsxs("div",{className:"mt-2 flex gap-2",children:[o.jsxs(Le,{size:"sm",variant:"secondary",onClick:()=>{r.retryTaskCreate(A.requestId)},children:[o.jsx(Pr,{"aria-hidden":!0})," Create again"]}),o.jsx(Le,{size:"sm",variant:"ghost",onClick:()=>r.dismissTaskCreate(A.requestId),children:"Dismiss"})]})]})},A.requestId)),h.message?o.jsx("p",{role:h.message.level==="error"?"alert":"status",className:Y("mx-1 rounded-md px-3 py-1.5 text-xs",h.message.level==="error"?"bg-destructive/10 text-destructive":"bg-primary/10 text-highlight"),children:h.message.text}):null,h.status==="loading"&&!L.length?o.jsx($t,{label:"Loading tasks…",className:"px-2 text-xs"}):null,h.status==="error"?o.jsx("p",{role:"alert",className:"mx-1 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h.error?.message}):null,h.unreadable?o.jsxs("p",{className:"px-2 text-xs text-warning",children:[h.unreadable," task file(s) on the host could not be read."]}):null,h.status==="ready"&&!L.length?o.jsx(df,{text:"No tasks yet. Add one here, with alp task add, or ask main to plan the work."}):null,L.length&&!R.length?o.jsx(df,{text:T.query.trim()?"No tasks match.":T.filter==="open"?"All tasks are closed.":T.filter==="ready"?"No task is ready.":"No closed tasks."}):null,R.length&&T.view==="list"?o.jsx(T3,{tasks:R,isCurrent:$,onOpen:d,canWrite:q}):null,R.length&&T.view==="board"?o.jsx(A3,{tasks:R,isCurrent:$,onOpen:d}):null,R.length&&T.view==="epics"?o.jsx(E3,{all:L,shown:R,isCurrent:$,onOpen:d}):null]})}function df({text:s}){return o.jsx("p",{role:"status",className:"mx-1 rounded-lg border border-dashed border-border px-4 py-5 text-center text-xs text-muted-foreground",children:s})}function Y0({task:s,isCurrent:n,onOpen:i,testId:r="task-row"}){const c=n(s.id),u=Qf(s),d=s.blockedBy?.length?`after ${s.blockedBy.join(", ")}`:"",h=s.waits?.length&&!s.approvals?.length?`waits on ${s.waits.join("; ")}`:"";return o.jsx("div",{className:Y("rounded-lg",c?"bg-sidebar-selected":"hover:bg-sidebar-hover"),"data-testid":r,children:o.jsxs("button",{type:"button",className:v3,onClick:()=>i(s.id),"aria-current":c?"true":void 0,title:s.title,children:[o.jsx("span",{className:"flex h-5 w-4 shrink-0 items-center justify-center",children:o.jsx(Ff,{state:u})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:Y("line-clamp-2 text-sm leading-5",s.status==="closed"?"text-muted-foreground line-through":"text-foreground/90"),children:s.title}),o.jsxs("span",{className:"mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground",children:[o.jsx("span",{className:"font-mono",children:s.id}),o.jsxs("span",{children:["P",s.priority]}),s.type&&s.type!=="task"?o.jsx("span",{children:s.type}):null,o.jsx("span",{children:String(s.status).replace("_"," ")}),s.assignee?o.jsxs("span",{children:["· @",s.assignee]}):null,s.progress?o.jsxs("span",{children:["· ",s.progress.done,"/",s.progress.total]}):null,s.approvals?.length?o.jsx("span",{className:"text-dot-warning",children:"· needs approval"}):null,d?o.jsxs("span",{className:"text-dot-danger",children:["· ",d]}):null,h?o.jsxs("span",{children:["· ",h]}):null,s.parent?o.jsxs("span",{children:["· in ",s.parent]}):null,(s.labels??[]).map(m=>o.jsxs("span",{className:"text-info",children:["#",m]},m)),o.jsx("span",{className:"ml-auto tabular-nums",children:N0(s.status==="closed"?s.closed?.at:s.updatedAt)})]})]})]})})}function T3({tasks:s,isCurrent:n,onOpen:i,canWrite:r}){const c=Be(),{tasks:u}=De(),d=v.useMemo(()=>JN(s),[s]),[h,m]=v.useState({});return o.jsx("div",{className:"space-y-1","data-testid":"tasks-list-view",children:d.map(g=>{const x=h[g.key]??!1,y=j3[g.key]??yj;return o.jsxs("section",{"aria-label":g.title,"data-testid":`tasks-section-${g.key}`,children:[o.jsxs("button",{type:"button","aria-expanded":!x,onClick:()=>m(w=>({...w,[g.key]:!x})),className:Y("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground hover:text-foreground",Us),children:[x?o.jsx(Vn,{"aria-hidden":!0,className:"size-3.5"}):o.jsx(An,{"aria-hidden":!0,className:"size-3.5"}),o.jsx(y,{"aria-hidden":!0,className:"size-3.5"}),o.jsx("span",{className:"font-semibold",children:g.title}),o.jsx("span",{className:"tabular-nums opacity-70",children:g.tasks.length})]}),x?null:o.jsx("ul",{"aria-label":g.title,children:g.tasks.map(w=>o.jsxs("li",{className:"mb-0.5",children:[o.jsx(Y0,{task:w,isCurrent:n,onOpen:i}),g.key==="approve"&&r?w.approvals.map(k=>o.jsxs("div",{className:"ml-8 mr-2 mb-1 flex items-center gap-2 rounded-md bg-warning/[0.06] px-2 py-1 text-xs",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:k.note||"Waiting for your approval"}),o.jsx(Le,{size:"sm",className:"h-6 px-2 text-xs",disabled:!!u.busy[w.id],"aria-label":`Approve ${w.id}`,onClick:()=>{c.changeTask(w,{gate:k.gate})},children:"Approve"})]},k.gate)):null]},w.id))})]},g.key)})})}function A3({tasks:s,isCurrent:n,onOpen:i}){const r=v.useMemo(()=>t3(s),[s]);return o.jsx("div",{className:"flex items-start gap-2.5 overflow-x-auto px-1 pb-2","data-testid":"tasks-board-view",children:r.map(c=>o.jsxs("section",{"aria-label":c.title,"data-testid":`tasks-column-${c.key}`,className:"flex max-h-[640px] w-[248px] shrink-0 flex-col rounded-[10px] border border-border bg-card",children:[o.jsxs("h3",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs font-semibold",children:[o.jsx(Ff,{state:c.key}),o.jsx("span",{className:"flex-1",children:c.title}),o.jsx("span",{className:"font-normal tabular-nums text-muted-foreground",children:c.tasks.length})]}),o.jsxs("ul",{className:"min-h-0 space-y-2 overflow-y-auto p-2",children:[c.tasks.map(u=>{const d=n(u.id);return o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>i(u.id),"aria-current":d?"true":void 0,title:u.title,"data-testid":"task-card",className:Y("flex w-full flex-col gap-1 rounded-lg border border-l-[3px] border-border bg-background p-2.5 text-left hover:border-muted-foreground",N3[c.key],d&&"bg-sidebar-selected",Us),children:[o.jsxs("span",{className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground",children:[o.jsx(G0,{value:u.priority}),o.jsx("span",{className:"font-mono",children:u.id}),o.jsx("span",{className:"flex-1"}),o.jsx("span",{className:"tabular-nums",children:N0(c.key==="closed"?u.closed?.at:u.updatedAt)})]}),o.jsx("span",{className:Y("line-clamp-3 text-[13px] leading-[18px]",c.key==="closed"&&"text-muted-foreground"),children:u.title}),u.assignee?o.jsxs("span",{className:"truncate text-xs text-muted-foreground",children:["@",u.assignee]}):null,u.blockedBy?.length?o.jsxs("span",{className:"truncate text-xs text-dot-danger",children:["after ",u.blockedBy.join(", ")]}):null,u.labels?.length?o.jsx("span",{className:"flex flex-wrap gap-1.5 text-xs text-info",children:u.labels.map(h=>o.jsxs("span",{children:["#",h]},h))}):null]})},u.id)}),c.tasks.length?null:o.jsx("li",{className:"px-1 py-2 text-xs text-muted-foreground",children:"Nothing here"})]})]},c.key))})}function E3({all:s,shown:n,isCurrent:i,onOpen:r}){const c=v.useMemo(()=>n3(s,n),[s,n]),[u,d]=v.useState({});return c.length?o.jsx("ul",{className:"space-y-2 px-1","data-testid":"tasks-epics-view",children:c.map(({epic:h,children:m,done:g,total:x,percent:y})=>{const w=u[h.id]??h.status!=="closed",k=i(h.id);return o.jsxs("li",{className:"rounded-[10px] border border-border bg-card p-3","data-testid":"epic",children:[o.jsxs("button",{type:"button",onClick:()=>r(h.id),"aria-current":k?"true":void 0,title:h.title,className:Y("flex w-full min-w-0 items-center gap-2 rounded-md text-left",k&&"text-highlight",Us),children:[o.jsx(Ff,{state:Qf(h)}),o.jsx(qf,{"aria-hidden":!0,className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx(G0,{value:h.priority}),o.jsx("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:h.id}),o.jsx("span",{className:Y("min-w-0 flex-1 truncate text-sm",h.status==="closed"&&"text-muted-foreground line-through"),children:h.title}),o.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground","data-testid":"epic-progress",children:[g,"/",x]})]}),o.jsx("div",{role:"progressbar","aria-label":`${h.id} progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":y,className:"mt-2 h-1.5 overflow-hidden rounded-full bg-secondary",children:o.jsx("div",{className:"h-full rounded-full bg-dot-success",style:{width:`${y}%`}})}),m.length?o.jsxs("button",{type:"button","aria-expanded":w,onClick:()=>d(T=>({...T,[h.id]:!w})),className:Y("mt-2 flex items-center gap-1 rounded-md text-xs text-muted-foreground hover:text-foreground",Us),children:[w?o.jsx(An,{"aria-hidden":!0,className:"size-3"}):o.jsx(Vn,{"aria-hidden":!0,className:"size-3"}),m.length," ",m.length===1?"task":"tasks"]}):null,w&&m.length?o.jsx("ul",{className:"mt-1 border-l border-border pl-2","aria-label":`Tasks of ${h.id}`,children:m.map(T=>o.jsx("li",{children:o.jsx(Y0,{task:T,isCurrent:i,onOpen:r,testId:"epic-task"})},T.id))}):null]},h.id)})}):o.jsx(df,{text:"No epics here. An epic is a task other tasks name as their parent."})}const V0="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",_d=Y("flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground [&_svg]:size-4",V0);function Rd({testId:s,children:n}){return o.jsxs("div",{className:"flex min-h-full flex-col items-center justify-center gap-2 p-6 text-center",role:"note","data-testid":s,children:[o.jsx(jb,{"aria-hidden":!0,strokeWidth:1.5,className:"size-6 text-extra-muted"}),n]})}function C3({onPicked:s}){const n=Be(),{workspace:i,connection:r,principal:c}=De(),{openFile:u,active:d}=vt(),h=r.capabilities.includes("workspace.files.read"),m=ze(c??void 0,"files.read"),[g,x]=v.useState({}),[y,w]=v.useState([]),[k,T]=v.useState("name"),[S,E]=v.useState(!1),q=v.useRef(0),L=v.useCallback((O,ce)=>{const le=q.current;x(pe=>({...pe,[O]:pe[O]?.status==="ready"?pe[O]:{status:"loading"}})),n.listWorkspaceFiles({...O?{path:O}:{},includeIgnored:ce}).then(pe=>{q.current===le&&x(ie=>({...ie,[O]:{status:"ready",entries:pe.entries,truncated:pe.truncated}}))},pe=>{q.current===le&&x(ie=>({...ie,[O]:{status:"error",error:pe instanceof xi||pe instanceof Error?pe.message:"Could not list this folder."}}))})},[n]),M=`${r.gateway}
|
|
22
|
-
${i??""}`,R=v.useRef(M),$=v.useRef(y);if($.current=y,v.useEffect(()=>{if(!h||!m||!i||r.phase!=="open")return;q.current+=1;const O=R.current===M;if(R.current=M,x({}),O||w([]),L("",S),O)for(const ce of $.current)L(ce,S)},[h,m,i,M,r.phase,S,L]),!h)return o.jsx(Rd,{testId:"files-unavailable",children:o.jsx("p",{className:"max-w-[300px] text-sm text-muted-foreground",children:ub})});if(!m)return o.jsxs(Rd,{testId:"files-forbidden",children:[o.jsxs("p",{className:"flex max-w-[300px] items-start gap-2 text-sm text-foreground",children:[o.jsx(Na,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),Pd]}),o.jsxs("p",{className:"max-w-[300px] text-xs leading-5 text-muted-foreground",children:["File reading is never granted by default. The host owner can create a token that allows it: ",o.jsx("code",{className:"font-mono",children:"alp-gateway credential create --permission files.read"})," (with the other permissions it needs)."]})]});if(!i)return o.jsx(Rd,{testId:"files-no-workspace",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a workspace to browse its files."})});const _=kk(g,y,{sort:k,showHidden:S}),V=O=>{const ce=!y.includes(O);w(le=>wk(le,O)),ce&&g[O]?.status!=="ready"&&L(O,S)},A=()=>{q.current+=1,x({}),L("",S);for(const O of y)L(O,S)},I=d?.kind==="file"?d.id:void 0;return o.jsxs("div",{className:"flex min-h-full flex-col","data-testid":"files-panel",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-2 py-1",children:[o.jsxs("span",{className:"min-w-0 flex-1 truncate px-1 text-xs text-muted-foreground",children:["Sorted by ",xd[k].toLowerCase()]}),o.jsx("button",{type:"button",className:_d,onClick:()=>T(ix),"aria-label":`Sort by ${xd[ix(k)].toLowerCase()}`,title:`Sort: ${xd[k]}`,"data-testid":"files-sort","data-sort":k,children:o.jsx(dj,{"aria-hidden":!0})}),o.jsx("button",{type:"button",className:_d,onClick:()=>E(O=>!O),"aria-pressed":S,"aria-label":"Show hidden files",title:S?"Hide hidden files":"Show hidden files","data-testid":"files-show-hidden",children:S?o.jsx(Zr,{"aria-hidden":!0}):o.jsx(jj,{"aria-hidden":!0})}),o.jsx("button",{type:"button",className:_d,onClick:A,"aria-label":"Refresh files",title:"Refresh","data-testid":"files-refresh",children:o.jsx(Ca,{"aria-hidden":!0})})]}),o.jsx("ul",{className:"py-1",role:"tree","aria-label":"Workspace files",children:_.map(O=>{const ce={paddingLeft:8+O.depth*14};if(O.kind==="status"){const B=O.status==="loading"?"Loading…":O.status==="empty"?O.path?"Empty folder":"No files to show":O.status==="truncated"?"Only the first 1000 entries are shown.":O.message??"Could not list this folder.";return o.jsxs("li",{role:"none",style:ce,className:Y("py-1 pr-3 text-xs",O.status==="error"?"text-destructive":"text-muted-foreground"),"data-testid":`files-${O.status}`,children:[B,O.status==="error"?o.jsx("button",{type:"button",className:"ml-2 text-highlight hover:underline",onClick:()=>L(O.path,S),children:"Retry"}):null]},`status:${O.path}`)}const{entry:le}=O,pe=le.kind==="directory",ie=!pe&&I===le.path,de=pe?O.open?Nj:Jd:kb;return o.jsx("li",{role:"treeitem","aria-expanded":pe?O.open:void 0,"aria-selected":ie||void 0,children:o.jsxs("button",{type:"button",style:ce,title:le.path,onClick:()=>{pe?V(le.path):(u(le.path),s?.())},className:Y("flex w-full min-w-0 items-center gap-1.5 py-1 pr-3 text-left text-[13px]",ie?"bg-sidebar-selected text-foreground":"text-foreground/85 hover:bg-sidebar-hover",V0),"data-testid":"files-entry","data-path":le.path,"data-kind":le.kind,children:[o.jsx(Vn,{"aria-hidden":!0,className:Y("size-3.5 shrink-0 text-extra-muted transition-transform",!pe&&"invisible",O.open&&"rotate-90")}),o.jsx(de,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:le.name})]})},le.path)})})]})}const M3=Object.freeze(["shell","read","edit","write","search","fetch","sub_agent","plan","plain_text","unknown"]),_n=400,z3=1e6,Jf=s=>typeof s=="object"&&s!==null&&!Array.isArray(s),Tn=s=>typeof s=="string"?s:"",va=s=>s.split(`
|
|
23
|
-
`).find(n=>n.trim())?.trim()??"";function K0(s){const n=Jf(s)?s.type:void 0;return typeof n=="string"&&M3.includes(n)?n:"unknown"}function kl(s,n=[]){if(!s)return s;const i=s.replace(/\\/g,"/");for(const r of n){if(!r)continue;const c=r.replace(/\\/g,"/").replace(/\/+$/,"");if(c){if(i===c)return".";if(i.startsWith(`${c}/`))return i.slice(c.length+1)}}return s}function ry(s){const n=String(s??"").trim();return n?/[:./]/.test(n)||n.includes("__")?n:n.replace(/[._-]+/g," ").split(" ").filter(Boolean).join(" ").toLowerCase().replace(/^./,i=>i.toUpperCase()):"Tool"}function _3(s){if(typeof s=="string")return va(s);if(Jf(s)){const n=Object.values(s).find(i=>typeof i=="string"&&i.trim());if(typeof n=="string")return va(n)}return""}const R3={shell:"terminal",read:"eye",edit:"pencil",write:"pencil",search:"search",fetch:"search",sub_agent:"bot",plan:"brain",plain_text:"wrench",unknown:"wrench"};function L3(s,n=[]){const i=typeof s?.name=="string"?s.name:"",r=K0(s?.detail),c=Jf(s?.detail)?s.detail:{},d=i.trim().toLowerCase()==="task"||i==="alp_delegate"?"bot":R3[r];switch(r){case"shell":return{kind:r,label:"Shell",secondary:va(Tn(c.command)),icon:d};case"read":return{kind:r,label:"Read",secondary:kl(Tn(c.filePath),n),icon:d};case"edit":return{kind:r,label:"Edit",secondary:kl(Tn(c.filePath),n),icon:d};case"write":return{kind:r,label:"Write",secondary:kl(Tn(c.filePath),n),icon:d};case"search":return{kind:r,label:"Search",secondary:va(Tn(c.query)),icon:d};case"fetch":return{kind:r,label:"Fetch",secondary:Tn(c.url),icon:d};case"sub_agent":return{kind:r,label:Tn(c.subAgentType).trim()||"Task",secondary:va(Tn(c.description)),icon:d};case"plan":return{kind:r,label:"Plan",secondary:"",icon:d};case"plain_text":return{kind:r,label:ry(i),secondary:va(Tn(c.label)),icon:d};default:{if(i==="alp_delegate")return{kind:r,label:"Delegate",secondary:`to ${c.input?.agent??"an agent"}`,icon:d};const h=i.startsWith("alp_")?i.replace(/^alp_/,"").replace(/^\w/,m=>m.toUpperCase()):ry(i);return{kind:r,label:h,secondary:_3(c.input),icon:d}}}}function Dl(s){if(!s)return[];const n=s.replace(/\r\n?/g,`
|
|
24
|
-
`).split(`
|
|
25
|
-
`);return n.length>1&&n.at(-1)===""&&n.pop(),n}function X0(s,n=_n){const i=Math.max(0,Math.floor(n));return s.length>i?{shown:s.slice(0,i),hidden:s.length-i}:{shown:s,hidden:0}}function O3(s){const n=Dl(s),i=[],r=[],c=[];let u=0,d=0,h=0,m=0,g="";for(const x of n){if(h>0||m>0){if(x.startsWith("+")){i.push({type:"add",text:x.slice(1),newLine:d++}),m--;continue}if(x.startsWith("-")){i.push({type:"remove",text:x.slice(1),oldLine:u++}),h--;continue}if(x.startsWith("\\")){i.push({type:"meta",text:x});continue}if(x.startsWith(" ")||x===""){i.push({type:"context",text:x.slice(1),oldLine:u++,newLine:d++}),h--,m--;continue}h=0,m=0}const w=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/.exec(x);if(w){u=Number(w[1]),d=Number(w[3]),h=w[2]===void 0?1:Number(w[2]),m=w[4]===void 0?1:Number(w[4]),g&&(r.push(g),c.push(i.length),g=""),i.push({type:"hunk",text:x});continue}if(x.startsWith("diff --git ")){g=x.replace(/^diff --git a\/(.*?) b\/.*$/,"$1");continue}if(x.startsWith("+++ ")){const k=x.slice(4).replace(/^b\//,"").replace(/\t.*$/,"");k!=="/dev/null"&&(g=k);continue}if(x.startsWith("--- ")){const k=x.slice(4).replace(/^a\//,"").replace(/\t.*$/,"");k!=="/dev/null"&&!g&&(g=k);continue}if(!(x.startsWith("index ")||/^(new|deleted) file mode /.test(x)||/^(similarity|rename|old mode|new mode)/.test(x))){if(x.startsWith("@@")){i.push({type:"hunk",text:x});continue}x.startsWith("+")?i.push({type:"add",text:x.slice(1)}):x.startsWith("-")?i.push({type:"remove",text:x.slice(1)}):x.startsWith("\\")?i.push({type:"meta",text:x}):i.push({type:"context",text:x.startsWith(" ")?x.slice(1):x})}}if(r.length>1)for(let x=r.length-1;x>=0;x--)i.splice(c[x],0,{type:"file",text:r[x]});return i}function D3(s,n,{cellLimit:i=z3}={}){const r=Dl(s),c=Dl(n);let u=0;for(;u<r.length&&u<c.length&&r[u]===c[u];)u++;let d=0;for(;d<r.length-u&&d<c.length-u&&r[r.length-1-d]===c[c.length-1-d];)d++;const h=[];for(let y=0;y<u;y++)h.push({type:"context",text:r[y],oldLine:y+1,newLine:y+1});const m=r.length-u-d,g=c.length-u-d;let x=!0;if(m&&g&&m*g<=i){const y=g+1,w=new Uint32Array((m+1)*y);for(let S=m-1;S>=0;S--)for(let E=g-1;E>=0;E--)w[S*y+E]=r[u+S]===c[u+E]?w[(S+1)*y+E+1]+1:Math.max(w[(S+1)*y+E],w[S*y+E+1]);let k=0,T=0;for(;k<m&&T<g;)r[u+k]===c[u+T]?(h.push({type:"context",text:r[u+k],oldLine:u+k+1,newLine:u+T+1}),k++,T++):w[(k+1)*y+T]>=w[k*y+T+1]?(h.push({type:"remove",text:r[u+k],oldLine:u+k+1}),k++):(h.push({type:"add",text:c[u+T],newLine:u+T+1}),T++);for(;k<m;k++)h.push({type:"remove",text:r[u+k],oldLine:u+k+1});for(;T<g;T++)h.push({type:"add",text:c[u+T],newLine:u+T+1})}else{x=!(m&&g);for(let y=0;y<m;y++)h.push({type:"remove",text:r[u+y],oldLine:u+y+1});for(let y=0;y<g;y++)h.push({type:"add",text:c[u+y],newLine:u+y+1})}for(let y=d;y>0;y--)h.push({type:"context",text:r[r.length-y],oldLine:r.length-y+1,newLine:c.length-y+1});return{lines:h,exact:x}}function Q0(s,n){const i=Tn(s?.unifiedDiff);if(i){const u=O3(i);return{lines:u,numbered:u.some(d=>d.type==="hunk"&&/^@@ -\d/.test(d.text)),exact:!0}}const{lines:r,exact:c}=D3(Tn(s?.oldString),Tn(s?.newString),n);return{lines:r,numbered:!1,exact:c}}function q3(s){let n=0,i=0;for(const r of s)r.type==="add"?n++:r.type==="remove"&&i++;return{added:n,removed:i}}function B3(s){if(!(typeof s!="string"||!s.trim()))try{const n=new URL(s.trim());return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}function ql(s){if(s==null)return"";if(typeof s=="string")return s;try{return JSON.stringify(s,null,2)??String(s)}catch{return String(s)}}const ji=(()=>{let s={mode:"uncommitted",ignoreWhitespace:!1,focus:null,focusScope:""};const n=new Set;return{get:()=>s,set(i){s={...s,...i};for(const r of[...n])r()},subscribe(i){return n.add(i),()=>{n.delete(i)}}}})(),U3=()=>v.useSyncExternalStore(ji.subscribe,ji.get,ji.get);function oy(s,n=""){ji.set({focus:s,focusScope:n})}const $3=15e3,Ql="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",ff=Y("flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-secondary hover:text-foreground disabled:opacity-50 [&_svg]:size-4",Ql);function ly({testId:s,reason:n,kind:i,children:r}){const c=i==="diff"?Rf:wb;return o.jsxs("div",{className:"flex min-h-full flex-col items-center justify-center gap-2 p-6 text-center",role:"note","data-testid":s,"data-reason":n,children:[o.jsx(c,{"aria-hidden":!0,strokeWidth:1.5,className:"size-6 text-extra-muted"}),r]})}function H3(s,n){const i=Be(),[r,c]=v.useState({loading:!1,at:0}),u=v.useRef(0),d=v.useCallback(()=>{const h=++u.current;c(m=>({...m,loading:!0})),i.gitStatus().then(m=>{u.current===h&&c({status:m,loading:!1,at:Date.now()})},m=>{if(u.current===h){const g=vi(m);c({error:g.message,reason:g.reason,loading:!1,at:Date.now()})}})},[i]);return v.useEffect(()=>{s?d():(u.current++,c({loading:!1,at:0}))},[s,n,d]),{...r,load:d}}function G3(s,n,i){const r=Be(),[c,u]=v.useState({loading:!1,more:!1}),d=v.useRef(0),h=v.useRef(i);h.current=i;const m=v.useCallback(x=>{const y=++d.current,{path:w,...k}=h.current;u(T=>({...T,loading:!0,error:void 0,notice:x})),r.gitDiff({compare:k,...w?{path:w}:{}}).then(T=>{d.current===y&&u({diff:lx(void 0,T),loading:!1,more:!1,notice:x})},T=>{d.current===y&&u({error:vi(T).message,loading:!1,more:!1,notice:x})})},[r]),g=v.useCallback(()=>{const x=c.diff?.nextCursor;if(!x||c.more)return;const y=d.current,{path:w,...k}=h.current;u(T=>({...T,more:!0})),r.gitDiff({compare:k,...w?{path:w}:{},cursor:x}).then(T=>{d.current===y&&u(S=>({...S,diff:lx(S.diff,T),more:!1}))},T=>{if(d.current===y){if(r2(T)){m(vi(T).reason==="stale_snapshot"?Tl.stale_snapshot:Tl.invalid_cursor);return}u(S=>({...S,more:!1,error:vi(T).message}))}})},[r,c.diff?.nextCursor,c.more,m]);return v.useEffect(()=>{s?m():(d.current++,u({loading:!1,more:!1}))},[s,n,m]),{...c,load:m,loadMore:g}}function I3(s,n,i){const r=v.useRef({refresh:s,lastAt:n,enabled:i});r.current={refresh:s,lastAt:n,enabled:i},v.useEffect(()=>{const c=()=>{const{refresh:u,lastAt:d,enabled:h}=r.current;h&&document.visibilityState!=="hidden"&&Date.now()-d>$3&&u()};return window.addEventListener("focus",c),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",c)}},[])}function Z0({additions:s,deletions:n,testId:i}){return o.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs tabular-nums","data-testid":i,children:[o.jsxs("span",{className:"text-dot-success",children:["+",cx(s)]}),o.jsxs("span",{className:"text-destructive",children:["-",cx(n)]})]})}const cy={add:"bg-[rgba(46,160,67,0.15)]",remove:"bg-[rgba(248,81,73,0.15)]",context:"",hunk:"bg-muted/60 text-muted-foreground"},Y3={add:"+",remove:"-",context:" "};function V3({file:s}){const n=v.useMemo(()=>c2(s),[s]),[i,r]=v.useState(_n),{shown:c,hidden:u}=X0(n,i);if(s.kind!=="text")return o.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground","data-testid":"git-file-kind","data-kind":s.kind,children:Qy[s.kind]});if(!n.length)return o.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground","data-testid":"git-file-empty",children:"No changes to display"});const d=String(Math.max(0,...n.map(m=>"oldLine"in m?Math.max(m.oldLine??0,m.newLine??0):0))).length,h=m=>o.jsx("span",{"aria-hidden":!0,className:"shrink-0 select-none pr-2 text-right text-muted-foreground tabular-nums",style:{minWidth:`${d+1}ch`},children:m??""});return o.jsxs("div",{className:"overflow-auto bg-card font-mono text-[12px] leading-[18px] text-foreground","data-testid":"git-hunks",children:[o.jsx("div",{className:"min-w-max py-1",children:c.map((m,g)=>m.type==="hunk"?o.jsx("div",{className:Y("whitespace-pre px-3",cy.hunk),"data-diff":"hunk",children:m.text},g):o.jsxs("div",{className:Y("flex whitespace-pre px-3",cy[m.type]),"data-diff":m.type,children:[h(m.oldLine),h(m.newLine),o.jsx("span",{"aria-hidden":!0,className:Y("w-[2ch] shrink-0 select-none",m.type==="add"?"text-dot-success":m.type==="remove"?"text-destructive":"text-muted-foreground"),children:Y3[m.type]}),o.jsx("span",{children:m.text||" "}),m.noNewline?o.jsx("span",{className:"ml-2 select-none text-muted-foreground",title:"No newline at end of file",children:"⏎̸"}):null]},g))}),u?o.jsxs("button",{type:"button","data-testid":"git-hunks-more",onClick:()=>r(m=>m+_n),className:"sticky left-0 block px-3 py-1.5 font-sans text-xs text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[`Show ${Math.min(u,_n)} more line${Math.min(u,_n)===1?"":"s"}`,u>_n?` (${u} hidden)`:""]}):null]})}function W0({change:s}){const n=s==="deleted"?"text-destructive":s==="added"||s==="untracked"?"text-dot-success":s==="conflicted"?"text-destructive":"text-highlight";return o.jsx("span",{"aria-label":ox[s],title:ox[s],className:Y("w-3 shrink-0 text-center font-mono text-[11px] font-semibold",n),children:a2[s]})}function P0({path:s,oldPath:n}){const i=s.lastIndexOf("/");return o.jsxs("span",{className:"min-w-0 flex-1 truncate text-[13px]",title:n?`${n} → ${s}`:s,children:[n?o.jsxs("span",{className:"text-muted-foreground",children:[n," → "]}):null,o.jsx("span",{className:"text-foreground",children:i>=0?s.slice(i+1):s}),i>=0?o.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground",children:s.slice(0,i)}):null]})}function K3({file:s,open:n,onToggle:i,onOpenDiff:r}){return o.jsxs("li",{className:"border-b border-border/60","data-testid":"git-file","data-path":s.path,"data-kind":s.kind,"data-change":s.change,children:[o.jsxs("div",{className:"flex items-center",children:[o.jsxs("button",{type:"button",onClick:i,"aria-expanded":n,className:Y("flex min-w-0 flex-1 items-center gap-1.5 py-1.5 pl-2 pr-1 text-left hover:bg-sidebar-hover",Ql),"data-testid":"git-file-toggle",children:[o.jsx(Vn,{"aria-hidden":!0,className:Y("size-3.5 shrink-0 text-extra-muted transition-transform",n&&"rotate-90")}),o.jsx(W0,{change:s.change}),o.jsx(P0,{path:s.path,oldPath:s.oldPath}),s.kind==="text"?o.jsx(Z0,{additions:s.additions,deletions:s.deletions}):o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Qy[s.kind].split(":")[0]})]}),r?o.jsx("button",{type:"button",className:Y(ff,"mr-1"),onClick:r,"aria-label":`Open ${s.path} in Diff`,title:"Open in Diff","data-testid":"git-file-open-diff",children:o.jsx(Rf,{"aria-hidden":!0})}):null]}),n?o.jsx(V3,{file:s}):null]})}function X3({file:s}){return o.jsxs("li",{className:"flex items-center gap-1.5 border-b border-border/60 py-1.5 pl-7 pr-2","data-testid":"git-status-file","data-path":s.path,"data-change":s.change,children:[o.jsx(W0,{change:s.change}),o.jsx(P0,{path:s.path,oldPath:s.oldPath}),o.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:[s.staged?"staged":"",s.unstaged?"unstaged":""].filter(Boolean).join(" · ")})]})}function uy({count:s}){return s?o.jsxs("p",{className:"flex items-center gap-1.5 px-3 py-2 text-xs text-muted-foreground","data-testid":"git-hidden",children:[o.jsx(Na,{"aria-hidden":!0,className:"size-3.5"}),`${s} changed file${s===1?" is":"s are"} not shown remotely (secrets, keys, .git or ALP configuration).`]}):null}function dy({status:s,mode:n}){return o.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 border-b border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"git-branch",children:[o.jsx(Sb,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),o.jsxs("span",{className:"min-w-0 flex-1 truncate",title:ux(s),children:[o.jsx("span",{className:"text-foreground","data-testid":"git-branch-name",children:ux(s)}),n==="base"?o.jsxs("span",{children:[` → ${d2(s.baseRef)}`,s.aheadBehind?` (${s.aheadBehind.ahead} ahead, ${s.aheadBehind.behind} behind)`:""]}):null]}),o.jsx("span",{className:"shrink-0",title:"Commit, push, pull, merge and branch switching are not available remotely; use Git on the host.","data-testid":"git-read-only",children:"Read only"})]})}function Q3({mode:s,setMode:n,content:i,ignoreWhitespace:r,totals:c,refreshing:u,onRefresh:d,testId:h}){return o.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-2 py-1","data-testid":h,children:[i?o.jsx("select",{"aria-label":"Diff mode",value:s,onChange:m=>n(m.target.value),"data-testid":"git-mode",className:Y("h-7 rounded-md bg-transparent px-1 text-xs text-foreground hover:bg-secondary",Ql),children:Xy.map(m=>o.jsx("option",{value:m.id,children:m.label},m.id))}):o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Uncommitted"}),o.jsx("span",{className:"min-w-0 flex-1"}),c?o.jsx(Z0,{additions:c.additions,deletions:c.deletions,testId:"git-totals"}):null,i?o.jsx("button",{type:"button",className:Y(ff,r&&"bg-secondary text-foreground"),onClick:()=>ji.set({ignoreWhitespace:!r}),"aria-pressed":r,"aria-label":r?"Show whitespace":"Hide whitespace",title:r?"Show whitespace":"Hide whitespace","data-testid":"git-whitespace",children:o.jsx(Kj,{"aria-hidden":!0})}):null,o.jsx("button",{type:"button",className:ff,onClick:d,disabled:u,"aria-label":u?"Refreshing":"Refresh",title:u?"Refreshing":"Refresh","data-testid":"git-refresh",children:o.jsx(Ca,{"aria-hidden":!0,className:Y(u&&"animate-spin")})})]})}function F0({variant:s,onOpenDiff:n}){const i=Be(),r=De(),c=i.gitAccess,u=U3(),d=r.connection.phase==="open",h=`${r.connection.gateway}
|
|
26
|
-
${r.workspace??""}
|
|
27
|
-
${c.status?c.workspaceId:""}`,m=s==="diff"&&u.focusScope===h?u.focus:null,g=H3(d&&c.status,h),x=g.status?.state==="repository",y=c.status&&c.content,w={mode:u.mode,baseRef:u.mode==="base"?g.status?.baseRef??null:null,ignoreWhitespace:u.ignoreWhitespace,...m?{path:m}:{}},k=`${h}
|
|
28
|
-
${w.mode}
|
|
29
|
-
${w.baseRef??""}
|
|
30
|
-
${w.ignoreWhitespace}
|
|
31
|
-
${m??""}
|
|
32
|
-
${g.at}`,T=G3(d&&!!y&&x,k,w),[S,E]=v.useState([]);v.useEffect(()=>E([]),[h,u.mode]);const q=v.useCallback(()=>{g.load()},[g.load]);I3(q,g.at,d&&c.status);const L=`${s}-panel`;if(!c.status)return o.jsx(ly,{testId:`panel-unavailable-${s}`,reason:c.reason,kind:s,children:c.reason==="projectRead"?o.jsxs("p",{className:"flex max-w-[300px] items-start gap-2 text-sm text-foreground",children:[o.jsx(Na,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),c.message]}):o.jsx("p",{className:"max-w-[300px] text-sm text-muted-foreground",children:c.message})});const M=A=>o.jsx(Q3,{mode:u.mode,setMode:I=>ji.set({mode:I}),content:!!y,ignoreWhitespace:u.ignoreWhitespace,totals:A,refreshing:g.loading||T.loading,onRefresh:q,testId:`${s}-toolbar`});if(!g.status)return o.jsxs("div",{className:"flex min-h-full flex-col","data-testid":L,children:[M(),g.error?o.jsxs("p",{className:"px-3 py-4 text-sm text-destructive",role:"alert","data-testid":"git-error",children:[g.error," ",o.jsx("button",{type:"button",className:"ml-1 text-highlight hover:underline",onClick:q,children:"Retry"})]}):o.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground","data-testid":"git-loading",children:"Checking repository..."})]});if(g.status.state!=="repository")return o.jsxs(ly,{testId:"changes-not-git",reason:g.status.state,kind:s,children:[o.jsx("p",{className:"max-w-[300px] text-sm text-muted-foreground",children:g.status.state==="unsupported"?"This workspace is inside a Git repository but is not its top level, so its changes are not shown.":"Not a git repository"}),o.jsx("button",{type:"button",className:"text-xs text-highlight hover:underline",onClick:q,children:"Refresh"})]});if(!y){const A=g.status.files;return o.jsxs("div",{className:"flex min-h-full flex-col","data-testid":L,"data-content":"none",children:[M(),o.jsx(dy,{status:g.status,mode:"uncommitted"}),o.jsxs("p",{className:"flex items-start gap-1.5 px-3 py-2 text-xs text-muted-foreground","data-testid":"git-content-forbidden",children:[o.jsx(Na,{"aria-hidden":!0,className:"mt-0.5 size-3.5 shrink-0"}),c.contentMessage]}),A.length?o.jsx("ul",{"aria-label":"Changed files",children:A.map(I=>o.jsx(X3,{file:I},`${I.oldPath??""}
|
|
33
|
-
${I.path}`))}):o.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground","data-testid":"git-empty",children:"No changes to display"}),o.jsx(uy,{count:g.status.hiddenCount}),g.status.truncated?o.jsxs("p",{className:"px-3 py-2 text-xs text-muted-foreground","data-testid":"git-truncated",children:["Only the first ",A.length," changed files are shown."]}):null]})}const R=T.diff?.files??[],$=A=>s==="diff"||S.includes(A),_=A=>E(I=>I.includes(A)?I.filter(O=>O!==A):[...I,A]),V=u.mode==="uncommitted"?"base":"uncommitted";return o.jsxs("div",{className:"flex min-h-full flex-col","data-testid":L,"data-content":"diff",children:[M(T.diff?u2(R):void 0),o.jsx(dy,{status:g.status,mode:u.mode}),m?o.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-1 text-xs text-muted-foreground","data-testid":"git-focus",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:m}),o.jsx("button",{type:"button",className:"text-highlight hover:underline",onClick:()=>oy(null),"data-testid":"git-focus-clear",children:"All files"})]}):null,T.notice?o.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",role:"status","data-testid":"git-notice",children:T.notice}):null,T.error?o.jsxs("p",{className:"px-3 py-2 text-sm text-destructive",role:"alert","data-testid":"git-error",children:[T.error," ",o.jsx("button",{type:"button",className:"ml-1 text-highlight hover:underline",onClick:()=>T.load(),children:"Retry"})]}):null,T.loading&&!T.diff?o.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground","data-testid":"git-loading",children:"Loading changes…"}):null,T.diff&&!R.length&&!T.error?o.jsxs("div",{className:"flex flex-col items-center gap-2 px-3 py-6 text-center","data-testid":"git-empty",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"No changes to display"}),!m&&!u.ignoreWhitespace?o.jsx("button",{type:"button",className:"text-xs text-highlight hover:underline",onClick:()=>ji.set({mode:V}),"data-testid":"changes-empty-switch-mode",children:V==="base"?"See committed changes":"See uncommitted changes"}):null]}):null,R.length?o.jsx("ul",{"aria-label":s==="diff"?"Diff":"Changed files",children:R.map(A=>o.jsx(K3,{file:A,open:$(A.path),onToggle:()=>_(A.path),onOpenDiff:s==="changes"&&n?()=>{oy(A.path,h),n()}:void 0},`${A.oldPath??""}
|
|
34
|
-
${A.path}`))}):null,o.jsx(uy,{count:T.diff?.hiddenCount??0}),T.diff?.nextCursor?o.jsx("button",{type:"button",onClick:T.loadMore,disabled:T.more,className:Y("mx-3 my-2 self-start rounded-md px-2 py-1 text-xs text-highlight hover:bg-secondary disabled:opacity-60",Ql),"data-testid":"git-load-more",children:T.more?"Loading…":"Load more"}):T.diff?.truncated?o.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground","data-testid":"git-truncated",children:"Only some untracked files are shown: the host limits how many it reads."}):null]})}function Z3({onOpenDiff:s}){return o.jsx(F0,{variant:"changes",onOpenDiff:s})}function W3(){return o.jsx(F0,{variant:"diff"})}const P3=v.lazy(()=>KN(()=>import("./TerminalPanel-PrU2l3u5.js"),__vite__mapDeps([0,1])).then(s=>({default:s.TerminalPanel}))),Gs={changes:{label:"Changes",icon:wb},terminal:{label:"Terminal",icon:Vl},diff:{label:"Diff",icon:Rf},files:{label:"Files",icon:jb},agents:{label:"Agents",icon:Sa},tasks:{label:"Tasks",icon:Si}},F3="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",J3=Y("flex w-full min-w-0 items-start gap-2 rounded-lg py-2 pl-2 pr-3 text-left",F3);function e4({onPicked:s}){const{openAgent:n,active:i}=vt(),{tree:r}=De();if(!r)return o.jsx("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:"Open a session to see its agents."});const c=nb(r.projection),u=new Set(Object.values(r.projection.questions).map(d=>d.sessionId));return o.jsx("ul",{className:"p-2","aria-label":"Agents in this session",children:c.map(d=>{const h=d.session,m=d.id===r.rootId,g=i?.kind==="agent"&&i.id===d.id,x=u.has(d.id)?"needs_input":d.running?"running":"done";return o.jsx("li",{className:Y("mb-0.5 rounded-lg",g?"bg-sidebar-selected":"hover:bg-sidebar-hover",!m&&"ml-4"),children:o.jsxs("button",{type:"button",onClick:()=>{n(d.id),s?.()},"aria-current":g?"true":void 0,className:J3,"data-testid":"agent-row",children:[o.jsx(Yf,{bucket:x}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Y("truncate text-sm leading-5",g?"text-foreground":"text-foreground/80"),children:h?.agent??(m?"main":"agent")}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:d.closed?"closed":d.running?"working":"idle"})]}),o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:[m?"main conversation":"assignment",Ml(h?.mode),h?.model].filter(Boolean).join(" · ")})]})]})},d.id)})})}function t4({kind:s}){const n=Gs[s];return o.jsxs("div",{className:"flex min-h-full flex-col items-center justify-center gap-2 p-6 text-center",role:"note","data-testid":`panel-unavailable-${s}`,children:[o.jsx(n.icon,{"aria-hidden":!0,strokeWidth:1.5,className:"size-6 text-extra-muted"}),o.jsxs("p",{className:"text-sm text-foreground",children:[n.label," is not available in this beta"]}),o.jsx("p",{className:"max-w-[300px] text-xs leading-5 text-muted-foreground",children:n.unavailable})]})}function J0({kind:s,onPicked:n}){const{openPanel:i}=vt();return s==="agents"?o.jsx(e4,{onPicked:n}):s==="tasks"?o.jsx(I0,{onPicked:n}):s==="files"?o.jsx(C3,{onPicked:n}):s==="changes"?o.jsx(Z3,{onOpenDiff:()=>{i("diff"),n?.()}}):s==="diff"?o.jsx(W3,{}):s==="terminal"?o.jsx(v.Suspense,{fallback:o.jsx("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:"Loading the terminal…"}),children:o.jsx(P3,{})}):o.jsx(t4,{kind:s})}const fy="outline-none focus-visible:ring-2 focus-visible:ring-ring";function e1({label:s,icon:n,title:i,badge:r,active:c,onSelect:u,onClose:d,testId:h,tabRef:m,onMenu:g,dragging:x,wrapper:y,...w}){return o.jsxs("div",{role:"presentation",...y,onContextMenu:g?k=>{k.preventDefault(),g({x:k.clientX,y:k.clientY})}:void 0,className:Y("group relative mx-0.5 flex h-7 max-w-[220px] shrink-0 items-center rounded-md",c?"bg-secondary":"hover:bg-card",x&&"z-10 opacity-80 ring-1 ring-border"),children:[o.jsxs("button",{ref:m,type:"button",role:"tab","aria-selected":c,onClick:u,title:i,"data-testid":h,...w,onKeyDown:k=>{if((k.key==="Delete"||k.key==="Backspace")&&!k.repeat)k.preventDefault(),d();else if(g&&(k.key==="ContextMenu"||k.key==="F10"&&k.shiftKey)){k.preventDefault();const T=k.currentTarget.getBoundingClientRect();g({x:T.left,y:T.bottom+4})}},className:Y("flex h-7 min-w-0 items-center gap-1 rounded-md pl-2 pr-7 text-sm",fy,c?"text-foreground":"text-muted-foreground"),children:[o.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center text-muted-foreground",children:n}),o.jsx("span",{className:"truncate",children:s}),r?o.jsx("span",{className:"ml-0.5 rounded-full bg-background/60 px-1.5 text-[11px] leading-4 text-muted-foreground",children:r}):null]}),o.jsx("button",{type:"button","aria-label":`Close ${s}`,title:"Close tab",onClick:d,className:Y("absolute right-1 flex size-[18px] items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100",fy,c?"opacity-100":"opacity-0 group-hover:opacity-100"),children:o.jsx(Zt,{"aria-hidden":!0,className:"size-3"})})]})}const n4="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",s4=["changes","diff","files","agents","tasks"];function i4(s=["changes","files"]){const[n,i]=v.useState(()=>({tabs:s.map(h=>({id:h,kind:h})),active:s[0]??null})),r=v.useCallback(h=>i(m=>({...m,active:h})),[]),c=v.useCallback(h=>i(m=>{const g=m.tabs.findIndex(w=>w.id===h),x=m.tabs.filter(w=>w.id!==h),y=m.active!==h?m.active:x[Math.min(g,x.length-1)]?.id??null;return{tabs:x,active:y}}),[]),u=v.useCallback(()=>i(h=>h.tabs.some(m=>m.kind==="new")?{...h,active:"new"}:{tabs:[...h.tabs,{id:"new",kind:"new"}],active:"new"}),[]),d=v.useCallback((h,m)=>i(g=>{if(g.tabs.some(w=>w.id===h))return{tabs:g.tabs.filter(w=>w.id!==m),active:h};const x=g.tabs.findIndex(w=>w.id===m);return{tabs:x<0?[...g.tabs,{id:h,kind:h}]:g.tabs.map((w,k)=>k===x?{id:h,kind:h}:w),active:h}}),[]);return v.useMemo(()=>({...n,select:r,close:c,openNew:u,launch:d}),[n,r,c,u,d])}function a4({onLaunch:s,autoFocus:n}){const i=v.useRef(null);v.useEffect(()=>{n&&i.current?.focus({preventScroll:!0})},[n]);const r=c=>{const u=c.key==="ArrowDown"?1:c.key==="ArrowUp"?-1:0;if(!u)return;c.preventDefault();const d=Array.from(c.currentTarget.querySelectorAll("button:not(:disabled)")),h=d.indexOf(document.activeElement);d[(h+u+d.length)%d.length]?.focus()};return o.jsx("div",{className:"flex min-h-full items-center justify-center p-6","data-testid":"workspace-new-tab-panel",children:o.jsx("div",{className:"flex w-full max-w-[320px] flex-col gap-1",onKeyDown:r,children:s4.map((c,u)=>{const d=Gs[c];return o.jsxs("button",{ref:u===0?i:void 0,type:"button",onClick:()=>s(c),"data-testid":`workspace-new-tab-${c}`,className:"flex min-h-11 items-center gap-2 rounded-lg border border-transparent bg-card px-3 text-left text-sm text-foreground outline-none hover:bg-secondary focus-visible:border-ring",children:[o.jsx(d.icon,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:d.label})]},c)})})})}function r4({dock:s,onClose:n}){const{tree:i,tasks:r}=De(),c=i?Object.keys(i.projection.running).length:0,u=r.rows.filter(y=>y.status!=="closed").length,d={agents:c,tasks:u},h=v.useRef({}),m=s.tabs.find(y=>y.id===s.active)??null,g=y=>{const w=y.key==="ArrowRight"?1:y.key==="ArrowLeft"?-1:0;if(!w||!s.tabs.length||!(y.target instanceof HTMLElement)||y.target.getAttribute("role")!=="tab")return;y.preventDefault();const k=s.tabs.findIndex(S=>S.id===s.active),T=s.tabs[(k+w+s.tabs.length)%s.tabs.length].id;s.select(T),h.current[T]?.focus()},x=Y("flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-card hover:text-foreground",n4);return o.jsxs("aside",{"aria-label":"Explorer",className:"flex h-full min-h-0 flex-col bg-sidebar","data-testid":"workspace-explorer-sidebar",children:[o.jsxs("div",{className:"relative flex h-14 shrink-0 items-center border-b border-border md:h-9",children:[o.jsxs("div",{role:"tablist","aria-label":"Explorer tabs",onKeyDown:g,className:"flex min-w-0 flex-1 items-center overflow-x-auto px-1 [scrollbar-width:none]",children:[s.tabs.map(y=>{const w=y.kind==="new"?null:Gs[y.kind];return o.jsx(e1,{tabRef:k=>{h.current[y.id]=k},id:`dock-tab-${y.id}`,"aria-controls":"dock-panel",tabIndex:y.id===s.active?0:-1,testId:"explorer-tab","data-tab":y.id,label:w?.label??"New tab",icon:w?o.jsx(w.icon,{"aria-hidden":!0,className:"size-3.5"}):o.jsx(fs,{"aria-hidden":!0,className:"size-3.5"}),badge:y.kind==="new"?void 0:d[y.kind],active:y.id===s.active,onSelect:()=>s.select(y.id),onClose:()=>s.close(y.id)},y.id)}),o.jsx("button",{type:"button","aria-label":"New explorer tab",title:"New tab",onClick:s.openNew,className:Y(x,"mx-1"),children:o.jsx(fs,{"aria-hidden":!0,className:"size-4"})})]}),n?o.jsx("button",{type:"button","aria-label":"Close panel",onClick:n,className:Y(x,"mr-1.5 size-8 rounded-lg"),children:o.jsx(Zt,{"aria-hidden":!0,className:"size-4"})}):null]}),o.jsx("div",{...m?{role:"tabpanel","aria-labelledby":`dock-tab-${m.id}`}:{},id:"dock-panel",className:"min-h-0 flex-1 overflow-y-auto",children:!m||m.kind==="new"?o.jsx(a4,{autoFocus:!!m,onLaunch:y=>s.launch(y,m?.id)},m?.id??"empty"):o.jsx(J0,{kind:m.kind,onPicked:n})})]})}const o4=[{id:"today",label:"Today"},{id:"yesterday",label:"Yesterday"},{id:"thisWeek",label:"This week"},{id:"thisMonth",label:"This month"},{id:"older",label:"Older"}],l4=1440*60*1e3;function c4(s,n=new Date){const i=s?Date.parse(s):NaN;if(Number.isNaN(i))return"older";const r=new Date(i),c=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),u=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime();if(u>=c)return"today";if(u>=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1).getTime())return"yesterday";const d=Math.round((c-u)/l4);return d<=7?"thisWeek":d<=30?"thisMonth":"older"}function u4(s,n="",i=new Date){const r=n.toLowerCase().split(/\s+/).filter(Boolean),c=r.length?s.filter(d=>r.every(h=>`${d.title??""}
|
|
35
|
-
${d.id}`.toLowerCase().includes(h))):s,u=new Map;for(const d of c){const h=c4(d.updatedAt??d.createdAt,i);u.set(h,[...u.get(h)??[],d])}return o4.filter(d=>u.has(d.id)).map(d=>({...d,sessions:u.get(d.id)}))}const eh="outline-none focus-visible:ring-2 focus-visible:ring-ring",hy=Y("flex size-8 shrink-0 items-center justify-center rounded-lg text-extra-muted hover:bg-secondary hover:text-foreground [&_svg]:size-[18px]",eh),my={initializing:"Starting",idle:"Idle",running:"Running",error:"Error",closed:"Closed"};function d4(s,n){return s.tree?.rootId===n&&s.tree.status==="attached"?Object.keys(s.tree.projection.questions).length:Math.max(s.attention[n]??0,s.tree?.rootId===n?Object.keys(s.tree.projection.questions).length:0,1)}function Ld({children:s,tone:n="muted",icon:i,testId:r}){return o.jsxs("span",{"data-testid":r,className:Y("inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-px text-xs leading-5",n==="warning"?"bg-dot-warning/15 text-dot-warning":n==="success"?"bg-dot-success/15 text-dot-success":n==="danger"?"bg-dot-danger/15 text-dot-danger":"bg-secondary text-muted-foreground"),children:[i,s]})}function f4({session:s,project:n,selected:i,waiting:r,reason:c,onOpen:u}){const d=In(s),h=ja(s.updatedAt??s.createdAt);return o.jsxs("button",{type:"button",onClick:u,"data-testid":"history-row","data-session":s.id,"aria-current":i?"true":void 0,className:Y("flex w-full min-w-0 items-center gap-3 rounded-lg px-3 py-2 text-left text-sm md:rounded-none",i?"bg-secondary":"hover:bg-card active:bg-secondary",eh),children:[o.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5 md:flex-row md:items-center md:gap-2",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"shrink-0 truncate text-foreground max-md:hidden md:max-w-[320px]",children:n}),o.jsx(Vn,{"aria-hidden":!0,className:"size-3 shrink-0 text-muted-foreground max-md:hidden"}),o.jsx(Sa,{"aria-hidden":!0,className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 truncate text-muted-foreground max-md:text-foreground","data-testid":"history-row-title",children:d}),s.archived?o.jsx(Ld,{icon:o.jsx($l,{"aria-hidden":!0,className:"size-3"}),children:"Archived"}):null,r?o.jsxs(Ld,{tone:"warning",children:[r," pending"]}):null,!r&&c?o.jsx(Ld,{tone:c==="error"?"danger":"success",testId:"history-row-attention",children:c==="error"?"Needs attention":"Finished"}):null]}),o.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground md:hidden",children:[o.jsx("span",{className:"truncate",children:n}),o.jsx("span",{className:"opacity-70",children:"·"}),o.jsx("span",{className:"truncate",children:my[s.status]??s.status}),o.jsx("span",{className:"opacity-70",children:"·"}),o.jsx("span",{className:"shrink-0",children:h})]})]}),o.jsxs("span",{className:"hidden shrink-0 items-center gap-3 text-muted-foreground md:flex",children:[o.jsx("span",{className:"w-[132px] truncate",children:s.teamLabel??""}),o.jsx("span",{className:"w-[72px] truncate",children:my[s.status]??s.status}),o.jsx("span",{className:"w-[72px] truncate text-right",children:h})]})]})}function h4({navOpen:s,onToggleNav:n,onOpen:i,onBack:r}){const c=Be(),u=De(),{history:d,workspace:h,selected:m,connection:g}=u,[x,y]=v.useState(""),[w,k]=v.useState(""),T=g.phase==="open",S=g.capabilities.includes("session.list.page");v.useEffect(()=>{const R=setTimeout(()=>k(x),200);return()=>clearTimeout(R)},[x]);const E=S?w.trim():"";v.useEffect(()=>{h&&T&&c.loadHistory({quiet:d.status==="ready"&&d.query===E,query:E})},[h,T,c,E]);const q=v.useMemo(()=>u4(d.list,S?"":w),[d.list,w,S]),L=h?Vt(h):"",M=!!w.trim();return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"history-screen",children:[o.jsxs("header",{className:"flex h-14 shrink-0 items-center gap-1 border-b border-border bg-background px-2 md:h-9 md:gap-2 md:px-3",children:[o.jsx("button",{type:"button","aria-label":s?"Close sessions":"Open sessions","aria-expanded":s,title:"Toggle sidebar",onClick:n,className:Y(hy,"md:-ml-1.5"),children:o.jsx(Wr,{"aria-hidden":!0,strokeWidth:1.5})}),o.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-normal text-foreground md:font-light",children:"History"}),o.jsx("button",{type:"button","aria-label":"Refresh history",title:"Refresh",onClick:()=>{c.loadHistory()},disabled:!T,className:Y(hy,"md:-mr-1.5 disabled:opacity-45"),children:o.jsx(Ca,{"aria-hidden":!0,strokeWidth:1.5,className:Y(d.status==="loading"&&"animate-spin")})})]}),o.jsx("div",{className:"px-3 pt-4 md:px-6",children:o.jsxs("div",{className:"flex h-9 w-full max-w-md items-center gap-2 rounded-lg border border-border bg-card px-2.5 focus-within:ring-1 focus-within:ring-ring",children:[o.jsx(Ni,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("input",{type:"search",value:x,onChange:R=>y(R.target.value),placeholder:"Search history","aria-label":"Search history","data-testid":"history-search",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground [&::-webkit-search-cancel-button]:hidden"}),x?o.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>y(""),className:Y("flex size-5 items-center justify-center rounded text-muted-foreground hover:text-foreground",eh),children:o.jsx(Zt,{"aria-hidden":!0,className:"size-3.5"})}):null]})}),o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-6 pt-4 md:px-6",children:[d.status==="loading"&&!d.list.length?o.jsx("div",{className:"flex justify-center py-16",children:o.jsx($t,{label:"Loading history…"})}):null,d.status==="error"&&!d.list.length?o.jsxs("div",{role:"alert",className:"flex flex-col items-center gap-4 py-16 text-sm text-muted-foreground",children:[o.jsxs("span",{children:["Unable to load sessions",d.error?.message?`: ${d.error.message}`:""]}),o.jsx(Le,{variant:"ghost",onClick:()=>{c.loadHistory()},children:"Try again"})]}):null,d.status!=="loading"&&d.status!=="error"&&!q.length?o.jsxs("div",{className:"flex flex-col items-center gap-6 py-16 text-sm text-muted-foreground","data-testid":"history-empty",children:[o.jsx("span",{children:M?"No sessions match":"No sessions yet"}),M?o.jsx(Le,{variant:"ghost",onClick:()=>y(""),children:"Clear search"}):o.jsxs(Le,{variant:"ghost",onClick:r,children:[o.jsx(pb,{"aria-hidden":!0})," Back"]})]}):null,q.map(R=>o.jsxs("section",{"aria-label":R.label,className:"mb-2",children:[o.jsx("h2",{className:"mb-2 mt-2 px-3 text-sm font-medium text-muted-foreground",children:R.label}),o.jsx("div",{className:"flex flex-col gap-1 md:gap-0",children:R.sessions.map($=>o.jsx(f4,{session:$,project:L,selected:$.id===m,waiting:$.archived||!Ul(u,$.id)?0:d4(u,$.id),reason:$.archived?void 0:Kr(u,$.id),onOpen:()=>{c.selectSession($.id),i()}},$.id))})]},R.id)),S&&d.nextCursor&&d.status==="ready"?o.jsxs("div",{className:"flex items-center justify-center gap-3 py-4","data-testid":"history-more",children:[o.jsx(Le,{variant:"ghost",onClick:()=>{c.loadMoreHistory()},disabled:d.more==="loading"||!T,children:d.more==="loading"?"Loading...":"Load more"}),d.more==="error"?o.jsx("span",{role:"alert",className:"text-sm text-destructive",children:"Unable to load more sessions"}):null]}):null]})]})}function m4({sessionId:s}){const n=Be(),{connection:i}=De(),[r,c]=v.useState(!1),[u,d]=v.useState(null),h=async()=>{c(!0),d(null);try{await n.restoreSession(s)}catch(m){d(m instanceof Error?m.message:String(m))}finally{c(!1)}};return o.jsx("div",{className:"px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] md:px-4 md:pb-4",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[820px] flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center justify-center gap-3 rounded-2xl border border-border bg-card px-4 py-3 md:px-6 md:py-4","data-testid":"archived-callout",children:[o.jsx("span",{className:"text-[15px] text-muted-foreground",children:"This session is archived"}),o.jsx(Le,{size:"sm",variant:"secondary",disabled:r||i.phase!=="open",onClick:()=>{h()},children:"Unarchive"})]}),u?o.jsx("p",{role:"alert",className:"text-center text-sm text-destructive",children:u}):null]})})}function p4(s,{enabled:n=!0,allowInModal:i=[]}={}){const r=v.useRef(s);r.current=s;const c=v.useMemo(()=>Fr(),[]);v.useEffect(()=>{if(!n)return;const u=d=>{if(d.defaultPrevented||d.isComposing||d.repeat)return;const h=wN(d,{mac:c,editable:y0(d.target)});!h||(document.querySelector("dialog[open]")||document.querySelector("[data-modal-overlay]"))&&!i.includes(h.binding.action)||r.current(h.binding,h.index)!==!1&&(d.preventDefault(),d.stopPropagation())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n,c,i.join(",")])}function g4({open:s,onClose:n}){const[i,r]=v.useState(""),c=v.useMemo(()=>Fr(),[]);v.useEffect(()=>{s||r("")},[s]);const u=jN(c,i);return o.jsx(Ma,{open:s,onClose:n,title:"Shortcuts",className:"w-[min(92vw,36rem)]",children:o.jsxs("div",{className:"space-y-4","data-testid":"keyboard-shortcuts-dialog",children:[o.jsxs("div",{className:"flex h-9 items-center gap-2 rounded-lg border border-border bg-card px-2.5 focus-within:ring-1 focus-within:ring-ring",children:[o.jsx(Ni,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("input",{type:"search",autoFocus:!0,value:i,onChange:d=>r(d.target.value),placeholder:"Search shortcuts",onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),n())},"aria-label":"Search shortcuts",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground [&::-webkit-search-cancel-button]:hidden"})]}),u.map(d=>o.jsxs("section",{"aria-label":d.title,className:"space-y-2",children:[o.jsx("h3",{className:"text-xs font-medium text-muted-foreground",children:d.title}),o.jsx("div",{className:"overflow-hidden rounded-lg border border-secondary",children:d.rows.map(h=>o.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-secondary px-4 py-2.5 last:border-b-0","data-testid":"shortcut-row",children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block text-sm text-foreground",children:h.label}),"note"in h&&h.note?o.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:h.note}):null]}),o.jsx("kbd",{className:"shrink-0 rounded-md bg-secondary/60 px-1.5 py-0.5 font-sans text-xs text-muted-foreground",children:h.keys})]},h.id))})]},d.id)),u.length?null:o.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No results"})]})})}function x4(s){const n=document.documentElement,i=typeof window.matchMedia=="function"?window.matchMedia("(prefers-color-scheme: light)"):null,r=()=>{const c=s==="system"?i?.matches?"light":"dark":s;n.dataset.theme=c,n.classList.toggle("dark",c==="dark"),n.style.colorScheme=c,document.querySelector('meta[name="color-scheme"]')?.setAttribute("content",c),document.querySelector('meta[name="theme-color"]')?.setAttribute("content",c==="light"?"#ffffff":"#181b1a")};return r(),s!=="system"||!i?()=>{}:(i.addEventListener("change",r),()=>i.removeEventListener("change",r))}const y4=5,b4=5,py=10,v4=s=>s.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);function w4(s,n){let i=0;for(const r of n)r===s[i]&&(i+=1);return i===s.length}function gy(s,n){const i=n.toLowerCase();if(!i)return;if(i===s)return 0;const r=v4(i);if(r.includes(s))return 1;if(i.startsWith(s))return 2;if(r.some(c=>c.startsWith(s)))return 3;if(i.includes(s))return 4;if(w4(s,i))return 6}function hf(s,n,i=[]){const r=s.toLowerCase().split(/\s+/).filter(Boolean);let c=0;for(const u of r){let d;for(const h of n){const m=gy(u,h);m!==void 0&&(d===void 0||m<d)&&(d=m)}if(d===void 0)for(const h of i){const m=gy(u,h);m!==void 0&&(d===void 0||m+py<d)&&(d=m+py)}if(d===void 0)return;c+=d}return c}const xy=s=>s.bucket==="needs_input"?0:s.attention?1:s.bucket==="running"?2:3;function k4(s){return s.map((n,i)=>({session:n,index:i})).sort((n,i)=>xy(n.session)-xy(i.session)||(Date.parse(i.session.updatedAt??"")||0)-(Date.parse(n.session.updatedAt??"")||0)||n.index-i.index).map(n=>n.session)}function j4(s){const n=String(s).replace(/\\/g,"/"),i=n.lastIndexOf("/");return{path:n,title:i>=0?n.slice(i+1):n,subtitle:i>=0?n.slice(0,i):""}}function S4(s,n=null){return s.map(i=>{const c=i.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||i;return{path:i,title:c,subtitle:i,...i===n?{current:!0}:{}}})}const N4=(s,n)=>s.title.localeCompare(n.title,void 0,{numeric:!0,sensitivity:"base"})||s.subtitle.localeCompare(n.subtitle);function T4(s,n){const i=[...s].sort(N4),r=n.trim();return r?i.map((c,u)=>({workspace:c,index:u,score:hf(r,[c.title,c.subtitle])})).filter(c=>c.score!==void 0).sort((c,u)=>c.score-u.score||c.index-u.index).map(c=>c.workspace):i.slice(0,b4)}function A4({actions:s,sessions:n,query:i,workspaces:r=[],files:c,scope:u=null}){const d=i.trim(),h={id:"files",title:"Files",rows:(c??[]).map(S=>({kind:"file",item:S}))};if(u==="files")return c?.length?[h]:[];const m=[{id:"workspace",title:"Workspace actions",rank:-1,rows:[]},{id:"actions",title:"Actions",rank:0,rows:[]},{id:"alp",title:"ALP",rank:1,rows:[]}];for(const S of s){const E=m.find(L=>L.id===S.group);if(!E)continue;if(!d){S.always&&E.rows.push({row:{kind:"action",item:S},score:0});continue}const q=hf(d,[S.label],S.keywords);q!==void 0&&E.rows.push({row:{kind:"action",item:S},score:q})}const g=S=>S.reduce((E,q)=>Math.min(E,q.score),1/0),y=m.filter(S=>S.rows.length).map(S=>({...S,rows:[...S.rows].sort((E,q)=>E.score-q.score)})).sort((S,E)=>d&&g(S.rows)-g(E.rows)||S.rank-E.rank).map(S=>({id:S.id,title:S.title,rows:S.rows.map(E=>E.row)})),w=k4(n),k=d?w.map((S,E)=>({session:S,index:E,score:hf(d,[S.title],[S.id,S.subtitle??""])})).filter(S=>S.score!==void 0).sort((S,E)=>S.score-E.score||S.index-E.index).map(S=>S.session):w.slice(0,y4),T=T4(r,d);return T.length&&y.push({id:"workspaces",title:"Workspaces",rows:T.map(S=>({kind:"workspace",item:S}))}),k.length&&y.push({id:"sessions",title:"Sessions",rows:k.map(S=>({kind:"session",item:S}))}),d&&c?.length&&y.push(h),y}const E4=100,Gr=Object.freeze({entries:[],loading:!1,error:null,truncated:!1});class C4{state=Gr;#e=null;#k=null;#m=0;#n;#i;#h;#r;constructor({search:n,onChange:i=()=>{},debounceMs:r=E4}){this.#i=n,this.#h=i,this.#r=r}#f(n){this.state=n,this.#h(n)}update({enabled:n,source:i,query:r}){const c=n&&i?`${i}\0${r}`:null;if(c===this.#k)return;if(this.#k=c,this.#a(),!c){this.#e=null,this.state!==Gr&&this.#f(Gr);return}const u=this.#e===i;this.#e=i;const d=++this.#m;this.#f({entries:u?this.state.entries:[],loading:!0,error:null,truncated:u?this.state.truncated:!1});const h=async()=>{this.#n=void 0;try{const m=await this.#i(r);if(d!==this.#m)return;this.#f({entries:(m?.files??[]).map(g=>j4(g.path)),loading:!1,error:null,truncated:m?.truncated===!0})}catch(m){if(d!==this.#m)return;this.#f({entries:[],loading:!1,error:qe(m).message,truncated:!1})}};this.#n=setTimeout(()=>{h()},r.trim()?this.#r:0)}#a(){this.#n!==void 0&&clearTimeout(this.#n),this.#n=void 0,this.#m+=1}dispose(){this.#a(),this.#k=null}}function M4({enabled:s,source:n,query:i,search:r}){const[c,u]=v.useState(Gr),d=v.useRef(r);d.current=r;const h=v.useRef(null);return h.current||(h.current=new C4({search:m=>d.current(m),onChange:u})),v.useEffect(()=>{h.current?.update({enabled:s,source:n,query:i})},[s,n,i]),v.useEffect(()=>()=>{h.current?.dispose()},[]),s&&n?c:Gr}function z4({open:s,scope:n=null,onClose:i,actions:r,sessions:c,workspaces:u=[],files:d,onOpenSession:h,onSelectWorkspace:m,onPickFile:g,mac:x}){const y=v.useRef(null),w=v.useRef(null),k=v.useRef(null),T=v.useRef(null),[S,E]=v.useState(""),[q,L]=v.useState(n),[M,R]=v.useState(0),$=v.useId(),_=!!d?.available,V=M4({enabled:s&&_&&(q==="files"||!!S.trim()),source:d?.source??null,query:S,search:d?.search??(()=>Promise.resolve({files:[]}))});v.useEffect(()=>{const N=y.current;if(N&&(s&&!N.open&&(T.current=document.activeElement,E(""),L(n),R(0),N.showModal(),w.current?.focus()),!s&&N.open)){N.close(),E("");const X=T.current;T.current=null,X?.isConnected&&X.focus()}},[s]),v.useEffect(()=>{s&&n&&L(n)},[s,n]);const A=v.useMemo(()=>s?A4({actions:r.filter(N=>!N.disabled),sessions:c,query:S,workspaces:u,scope:q,..._?{files:V.entries}:{}}):[],[s,r,c,S,u,q,_,V.entries]),I=A.flatMap(N=>N.rows),O=Math.min(M,Math.max(0,I.length-1)),ce=new Map(r.map(N=>[N.id,N]));v.useEffect(()=>{k.current?.querySelector(`[data-index="${O}"]`)?.scrollIntoView({block:"nearest"})},[O]);const le=N=>{const X=I[N];X&&(i(),X.kind==="session"?h(X.item.id):X.kind==="workspace"?m?.(X.item.path):X.kind==="file"?g?.(X.item.path):setTimeout(()=>ce.get(X.item.id)?.run(),0))},pe=N=>{if(N.key==="ArrowDown"||N.key==="ArrowUp"){if(N.preventDefault(),!I.length)return;const X=N.key==="ArrowDown"?1:-1;R((O+X+I.length)%I.length)}else N.key==="Enter"&&!N.nativeEvent.isComposing?(N.preventDefault(),le(O)):N.key==="Backspace"&&!S.trim()&&q?(N.preventDefault(),L(null),R(0)):N.key.toLowerCase()==="k"&&(x?N.metaKey:N.ctrlKey)&&!N.shiftKey&&!N.altKey?(N.preventDefault(),i()):N.code==="KeyP"&&(x?N.metaKey:N.ctrlKey)&&!N.shiftKey&&!N.altKey&&(N.preventDefault(),L("files"),R(0))},ie=q==="files",de=ie?"Search files...":_?"Search commands, files, workspaces, and agents...":"Search commands, workspaces, sessions and agents...",B=_&&V.loading,W=ie&&!_?"This host does not offer file search. Update ALP on the host to search the workspace's files.":(ie||S.trim())&&V.error?V.error:null,ne=ie?B?"":_&&!V.error?"No files":"":"No matches";let me=-1;return o.jsx("dialog",{ref:y,"aria-label":"Command center","data-testid":"command-center-panel",onCancel:N=>{N.preventDefault(),i()},onClick:N=>{N.target===y.current&&i()},className:"mx-auto mt-12 mb-auto w-[min(92vw,640px)] max-h-[min(80dvh,560px)] overflow-hidden rounded-lg border border-border bg-popover p-0 text-popover-foreground shadow-2xl shadow-[var(--shadow)] backdrop:bg-black/50",children:s?o.jsxs("div",{className:"flex max-h-[min(80dvh,560px)] flex-col",onKeyDown:pe,children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-4 py-3","data-testid":"command-center-header",children:[ie?o.jsxs("button",{type:"button","aria-label":"Files",title:"Remove the Files scope","data-testid":"command-center-files-scope",onClick:()=>{L(null),R(0),w.current?.focus()},className:"flex h-7 shrink-0 items-center gap-1 rounded-md bg-secondary px-2 text-sm text-foreground hover:bg-secondary/80 outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[o.jsx(Jd,{"aria-hidden":!0,className:"size-3.5"}),o.jsx("span",{children:"Files"}),o.jsx(Zt,{"aria-hidden":!0,className:"size-3"})]}):null,o.jsx("input",{ref:w,type:"text",role:"combobox","aria-expanded":!0,"aria-controls":$,"aria-activedescendant":I.length?`${$}-${O}`:void 0,"aria-label":ie?"Search files":"Search commands and sessions",placeholder:de,value:S,autoComplete:"off",spellCheck:!1,onChange:N=>{E(N.target.value),R(0)},"data-testid":"command-center-input",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground"}),o.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center","data-testid":"command-center-file-search-status",children:B?o.jsx("span",{role:"progressbar","aria-label":"Searching files...",title:"Searching files...","data-testid":"command-center-file-search-loading",children:o.jsx(Gl,{"aria-hidden":!0,className:"size-3.5 animate-spin text-muted-foreground"})}):null})]}),W?o.jsx("p",{role:V.error?"alert":"note",className:"shrink-0 border-b border-border px-4 py-2 text-xs text-muted-foreground","data-testid":"command-center-file-search-error",children:W}):null,o.jsx("div",{ref:k,id:$,role:"listbox","aria-label":"Results",className:"min-h-0 flex-1 overflow-y-auto py-1","data-testid":"command-center-results",children:I.length===0?ne?o.jsx("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:ne}):null:A.map((N,X)=>o.jsxs("div",{role:"group","aria-label":N.title,className:Y(X>0&&"mt-1 border-t border-border pt-1"),children:[o.jsx("div",{className:"px-4 pb-1 pt-2 text-xs text-muted-foreground","aria-hidden":!0,children:N.title}),N.rows.map(P=>{me+=1;const ee=me,oe=ee===O;if(P.kind==="session")return o.jsxs("div",{id:`${$}-${ee}`,role:"option","aria-selected":oe,"data-index":ee,"data-testid":`command-center-session-${P.item.id}`,onMouseMove:()=>{oe||R(ee)},onClick:()=>le(ee),className:Y("flex min-h-14 cursor-pointer items-center gap-3 px-4 py-2",oe&&"bg-secondary"),children:[o.jsx(Yf,{bucket:P.item.bucket}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-sm leading-[18px] text-foreground",children:P.item.title}),P.item.subtitle?o.jsx("div",{className:"truncate text-xs leading-4 text-muted-foreground","data-testid":"command-center-session-subtitle",children:P.item.subtitle}):null]})]},`session:${P.item.id}`);if(P.kind==="workspace"||P.kind==="file"){const fe=P.item,ge=P.kind==="workspace"?Jd:kb,he=P.kind==="workspace"&&P.item.current;return o.jsxs("div",{id:`${$}-${ee}`,role:"option","aria-selected":oe,"data-index":ee,"data-testid":`command-center-${P.kind}`,"data-path":fe.path,"aria-current":he?"true":void 0,onMouseMove:()=>{oe||R(ee)},onClick:()=>le(ee),className:Y("flex min-h-11 cursor-pointer items-center gap-3 px-4 py-2",oe&&"bg-secondary"),children:[o.jsx("span",{className:"flex w-4 shrink-0 justify-center text-muted-foreground",children:o.jsx(ge,{"aria-hidden":!0,className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate text-sm leading-[18px] text-foreground",children:fe.title}),fe.subtitle?o.jsx("div",{className:"truncate text-xs leading-4 text-muted-foreground",children:fe.subtitle}):null]}),he?o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"Current"}):null]},`${P.kind}:${fe.path}`)}const Z=ce.get(P.item.id)?.icon;return o.jsxs("div",{id:`${$}-${ee}`,role:"option","aria-selected":oe,"data-index":ee,"data-testid":`command-center-action-${P.item.id}`,onMouseMove:()=>{oe||R(ee)},onClick:()=>le(ee),className:Y("flex min-h-9 cursor-pointer items-center gap-3 px-4 py-2",oe&&"bg-secondary"),children:[o.jsx("span",{className:"flex w-4 shrink-0 justify-center text-muted-foreground",children:Z?o.jsx(Z,{"aria-hidden":!0,className:"size-4"}):null}),o.jsx("span",{className:"min-w-0 flex-1 truncate text-sm leading-[18px] text-foreground",children:P.item.label}),P.item.shortcut?o.jsx("kbd",{className:"shrink-0 rounded bg-secondary px-1.5 py-px font-sans text-xs text-muted-foreground",children:P.item.shortcut}):null]},`action:${P.item.id}`)})]},N.id))})]}):null})}const th=v.createContext({id:Qr,focused:!0}),_4=()=>v.useContext(th).focused,Od=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent);function t1({meter:s,imageLimits:n,images:i=!1,imagesUnavailable:r,files:c=!1,fileLimits:u,filesUnavailable:d,onSend:h,onQueue:m,onStop:g,queued:x,onEditQueued:y,onSendQueued:w,running:k,stopping:T,blocked:S,disabledReason:E,placeholder:q,controls:L,tracks:M,onCycleMode:R,sendBehavior:$="steer",startLabel:_,startHold:V,initialText:A,addText:I,autoFocus:O,inputId:ce}){const[le,pe]=v.useState(A??"");v.useEffect(()=>{I&&pe(ue=>ue.trim()?`${ue.replace(/\s+$/,"")}
|
|
36
|
-
|
|
37
|
-
${I.text}`:I.text)},[I]);const[ie,de]=v.useState(null),[B,W]=v.useState([]),[ne,me]=v.useState([]),N=v.useRef(null),X=v.useRef(null),P=S??E,ee=!!le.trim()||B.length>0||ne.length>0,oe=k&&$==="queue"&&!B.length&&!ne.length,re=v.useRef(B),Z=v.useRef(n);Z.current=n;const fe=ue=>{re.current=ue,W(ue)},ge=v.useRef(ne),he=v.useRef(u??Bs);he.current=u??Bs;const nt=ue=>{ge.current=ue,me(ue)},$e=async ue=>{if(!ue.length||P)return;const Se=[],pt=[];let gn=null;for(const it of ue)i&&(Wy(it)||!c&&it.type.startsWith("image/"))?Se.push(it):c?pt.push(it):gn??=!i&&it.type.startsWith("image/")?r??"This session takes no images.":d??r??"This session takes no files.";let wt=null;if(Se.length){const{added:it,error:Nt}=await p2(re.current,Se,Z.current),{attachments:xt,error:Rn}=Ur(re.current,it,Z.current);fe(xt),wt??=Nt??Rn}if(pt.length){const{added:it,error:Nt}=await j2(ge.current,pt,he.current),{attachments:xt,error:Rn}=vl(ge.current,it,he.current);nt(xt),wt??=Nt??Rn}de(gn??wt)},[ct,ht]=v.useState(!1),ve=_4(),xe=v.useId(),Ee=ce??`composer-${xe}`,je=v.useRef({running:k,stopping:T,blocked:S,onStop:g,paneFocused:ve});je.current={running:k,stopping:T,blocked:S,onStop:g,paneFocused:ve},v.useEffect(()=>{const ue=Se=>{if(Se.defaultPrevented||Se.isComposing||!je.current.paneFocused)return;if(Se.key.toLowerCase()==="l"&&(Od?Se.metaKey&&!Se.ctrlKey:Se.ctrlKey&&!Se.metaKey)&&!Se.altKey&&!Se.shiftKey){if(!X.current||X.current.disabled)return;Se.preventDefault(),X.current.focus();return}if(Se.key!=="Escape")return;const{running:pt,stopping:gn,blocked:wt,onStop:it}=je.current,Nt=Se.target,xt=Nt===X.current,Rn=Nt===document.body||Nt===document.documentElement||Nt===null;!pt||gn||wt||!(xt||Rn)||document.querySelector('[role="dialog"], [role="menu"]')||it()};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[]),v.useLayoutEffect(()=>{const ue=X.current;ue&&(ue.style.height="auto",ue.style.height=`${Math.min(ue.scrollHeight,280)}px`)},[le]);const Ot=async()=>{const ue=le.trim(),Se=re.current,pt=ge.current;if(!ue&&!Se.length&&!pt.length&&!_||P||_&&V)return;const gn=Ur([],Se,Z.current);if(gn.error){de(gn.error);return}if(pt.length){if(!c){de(d??"This session takes no files.");return}const wt=vl([],pt,he.current);if(wt.error){de(wt.error);return}}pe(""),fe([]),nt([]),de(null);try{await h(ue,Se,pt)}catch(wt){pe(ue),fe(Ur(Se,re.current,Z.current).attachments),nt(vl(pt,ge.current,he.current).attachments),de(wt instanceof Error?wt.message:String(wt))}},pn=()=>{const ue=le.trim();if(re.current.length||ge.current.length)return void Ot();if(!(!ue||P))try{m(ue),pe(""),de(null)}catch(Se){de(Se instanceof Error?Se.message:String(Se))}},Ce=ue=>{const Se=y(ue);Se!=null&&(pe(pt=>pt.trim()?`${pt}
|
|
38
|
-
${Se}`:Se),X.current?.focus())},st="inline-flex size-7 shrink-0 items-center justify-center rounded-full transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4";return o.jsx("div",{className:"px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] md:px-4 md:pb-4",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[820px] flex-col gap-3",children:[M?o.jsx("div",{className:"-mb-1 flex min-w-0 flex-wrap items-center gap-2","data-testid":"composer-tracks",children:M}):null,x.length?o.jsx("ul",{"aria-label":"Queued messages",className:"flex flex-col gap-2",children:x.map(ue=>o.jsxs("li",{"data-testid":"queued-message",className:"flex items-center justify-between gap-2 rounded-lg border border-border bg-card px-3 py-2",children:[o.jsx("span",{className:"line-clamp-2 min-w-0 flex-1 whitespace-pre-wrap text-sm text-foreground [overflow-wrap:anywhere]",children:ue.text}),o.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[o.jsx("button",{type:"button","aria-label":"Edit queued message",title:"Edit",onClick:()=>Ce(ue.id),className:"flex size-8 items-center justify-center rounded-full bg-muted text-foreground outline-none hover:bg-bubble focus-visible:ring-2 focus-visible:ring-ring [&_svg]:size-3.5",children:o.jsx(Ea,{"aria-hidden":!0})}),o.jsx("button",{type:"button","aria-label":"Send queued message now",title:"Send now",disabled:!!P,onClick:()=>w(ue.id),className:"flex size-8 items-center justify-center rounded-full bg-primary text-primary-foreground outline-none hover:bg-primary/85 focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-3.5",children:o.jsx(Td,{"aria-hidden":!0})})]})]},ue.id))}):null,S?o.jsx("p",{className:"px-1 text-sm text-warning",role:"note",children:S}):null,ie?o.jsx("p",{className:"px-1 text-sm text-destructive",role:"alert",children:ie}):null,o.jsxs("div",{className:Y("relative flex flex-col gap-3 rounded-2xl border border-input bg-card px-3 py-2 transition-colors duration-200 focus-within:border-[var(--input-focus)] md:px-4 md:pb-3 md:pt-4",P&&"border-dotted"),"data-testid":"composer-box",onDragOver:ue=>{Array.from(ue.dataTransfer?.types??[]).includes("Files")&&ue.preventDefault()},onDrop:ue=>{const Se=dx(ue.dataTransfer);Se.length&&(ue.preventDefault(),$e(Se))},children:[B.length?o.jsx("ul",{"aria-label":"Attached images",className:"flex flex-wrap gap-2",children:B.map(ue=>o.jsxs("li",{"data-testid":"composer-attachment",className:"relative size-16 overflow-hidden rounded-lg border border-border bg-muted",children:[o.jsx("img",{src:Fy(ue),alt:ue.name,title:ue.name,className:"size-full object-cover"}),o.jsx("button",{type:"button","aria-label":`Remove ${ue.name}`,title:"Remove",onClick:()=>fe(re.current.filter(Se=>Se.id!==ue.id)),className:"absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-background/90 text-foreground outline-none hover:bg-background focus-visible:ring-2 focus-visible:ring-ring [&_svg]:size-3",children:o.jsx(Zt,{"aria-hidden":!0})})]},ue.id))}):null,ne.length?o.jsx("ul",{"aria-label":"Attached files",className:"flex flex-wrap gap-2",children:ne.map(ue=>o.jsxs("li",{"data-testid":"composer-file",className:"flex h-9 max-w-[16rem] items-center gap-2 rounded-lg border border-border bg-muted pl-2 pr-1 text-[13px] text-foreground",children:[o.jsx(_f,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"min-w-0 truncate",title:ue.name,children:ue.name}),o.jsx("span",{className:"shrink-0 text-muted-foreground",children:Jy(ue.size)}),o.jsx("button",{type:"button","aria-label":`Remove ${ue.name}`,title:"Remove",onClick:()=>nt(ge.current.filter(Se=>Se.id!==ue.id)),className:"flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring [&_svg]:size-3",children:o.jsx(Zt,{"aria-hidden":!0})})]},ue.id))}):null,!ct&&!le&&!P?o.jsxs("span",{"aria-hidden":!0,className:"pointer-events-none absolute right-4 top-3 hidden text-xs text-muted-foreground/80 [@media(pointer:fine)]:md:block","data-testid":"composer-focus-hint",children:[Od?"⌘L":"Ctrl+L"," to focus"]}):null,o.jsx("label",{htmlFor:Ee,className:"sr-only",children:"Message"}),o.jsx("textarea",{id:Ee,ref:X,rows:1,value:le,disabled:!!P,placeholder:P&&!S?P:q,onChange:ue=>pe(ue.target.value),onPaste:ue=>{const Se=dx(ue.clipboardData).filter(pt=>c||pt.type.startsWith("image/"));Se.length&&(ue.preventDefault(),$e(Se))},onFocus:()=>ht(!0),onBlur:()=>ht(!1),autoFocus:O,"aria-keyshortcuts":Od?"Meta+L":"Control+L",onKeyDown:ue=>{if(ue.key==="Tab"&&ue.shiftKey&&R&&!ue.nativeEvent.isComposing){ue.preventDefault(),ue.repeat||R();return}if(ue.key!=="Enter"||ue.shiftKey||ue.nativeEvent.isComposing)return;ue.preventDefault();const Se=ue.metaKey||ue.ctrlKey;k&&$==="queue"!==Se?pn():Ot()},className:"max-h-[280px] min-h-[21px] w-full resize-none bg-transparent text-[15px] leading-[21px] text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"}),o.jsxs("div",{className:"-mx-1.5 flex min-h-7 shrink-0 items-end justify-between",children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-end",children:[c||i&&!_?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button","aria-label":c?"Attach files":"Attach images",title:c?"Attach files":"Attach images",disabled:!!P,onClick:()=>N.current?.click(),className:Y(st,"mr-1 text-muted-foreground hover:bg-muted hover:text-foreground"),"data-testid":"composer-attach",children:o.jsx(fs,{"aria-hidden":!0})}),o.jsx("input",{ref:N,type:"file",accept:c?void 0:Zy.join(","),multiple:!0,hidden:!0,"data-testid":"composer-attach-input",onChange:ue=>{const Se=Array.from(ue.target.files??[]);ue.target.value="",$e(Se)}})]}):null,L]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s,_?o.jsx("button",{type:"button","aria-label":_,title:V??_,onClick:()=>{Ot()},disabled:!!P||!!V,className:Y(st,"ml-1 bg-primary text-primary-foreground hover:bg-primary/85"),"data-testid":"composer-start",children:o.jsx(Td,{"aria-hidden":!0})}):ee?o.jsx("button",{type:"button","aria-label":k?oe?"Queue message":"Send and steer":"Send",title:k?oe?"Queue (⌘/Ctrl+Enter sends and steers)":"Send and steer (⌘/Ctrl+Enter queues)":"Send",onClick:()=>oe?pn():void Ot(),disabled:!!P,className:Y(st,"ml-1 bg-primary text-primary-foreground hover:bg-primary/85"),children:o.jsx(Td,{"aria-hidden":!0})}):k?o.jsx("button",{type:"button","aria-label":"Interrupt agent",title:"Interrupt agent",onClick:g,disabled:T||!!S,className:Y(st,"ml-1 bg-[#dc2626] text-white hover:bg-[#dc2626]/85"),children:o.jsx(Qj,{"aria-hidden":!0,className:"fill-current"})}):null]})]})]})]})})}const yy=["approve","review","progress","ready","blocked"];function by(s){return s.status==="closed"?"closed":s.approvals?.length?"approve":s.status==="review"?"review":s.status==="in_progress"?"progress":s.type==="epic"?s.progress?.done?"progress":"ready":s.ready?"ready":"blocked"}function R4(s,n){const i=new Map(n.map(g=>[g.id,g])),r=s.map(g=>{const x=i.get(g.id),y=x?by(x):g.status==="completed"?"closed":g.status==="in_progress"?"progress":"ready";return{id:g.id,title:x?.title??g.text,state:y}}),c=new Set(r.map(g=>g.id)),u=n.filter(g=>g.status!=="closed"&&g.type!=="epic").map(g=>({id:String(g.id),title:String(g.title??g.id),state:by(g),priority:typeof g.priority=="number"?g.priority:9})).sort((g,x)=>yy.indexOf(g.state)-yy.indexOf(x.state)||g.priority-x.priority||g.id.localeCompare(x.id)).map(({id:g,title:x,state:y})=>({id:g,title:x,state:y})),d=r.filter(g=>g.state==="closed").length,h=r.length?`Tasks · ${d}/${r.length}`:u.length?`Tasks · ${u.length}`:"Tasks",m=r.length?`ALP tasks: ${d} of ${r.length} done in this session, ${u.length} open`:u.length?`ALP tasks: ${u.length} open`:"ALP tasks";return{label:h,title:m,mine:r.length,lines:[...r,...u.filter(g=>!c.has(g.id))]}}const vy={approve:{label:"Approve",icon:Tb},review:{label:"Review",icon:Zr},progress:{label:"In progress",icon:Gl},ready:{label:"Ready",icon:zf},blocked:{label:"Blocked",icon:xb},closed:{label:"Done",icon:gj}},wy=8,L4=2e4,O4="inline-flex h-7 max-w-full items-center gap-1.5 rounded-full border border-border bg-card px-3 text-[13px] text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-muted aria-expanded:text-foreground [&_svg]:size-3.5 [&_svg]:shrink-0";function D4({worked:s}){const n=Be(),{tasks:i}=De(),{openTask:r,openPanel:c}=vt(),u=n.tasksBlock();if(v.useEffect(()=>{if(u)return;n.refreshTasks({quiet:!0});const g=window.setInterval(()=>{n.getState().connection.phase==="open"&&n.refreshTasks({quiet:!0})},L4);return()=>window.clearInterval(g)},[n,u]),u)return null;const d=R4(s,i.rows),h=d.lines.slice(0,wy),m=d.lines.length-wy;return o.jsx(hn,{label:"Tasks",title:d.title,align:"start",triggerClassName:Y(O4),onOpenChange:g=>{g&&n.refreshTasks({quiet:!0})},trigger:o.jsxs(o.Fragment,{children:[o.jsx(Si,{"aria-hidden":!0}),o.jsx("span",{className:"truncate","data-testid":"tasks-pill-label",children:d.label})]}),items:[...h.map((g,x)=>{const y=vy[g.state].icon;return{id:`task:${g.id}`,label:`${vy[g.state].label} · ${g.title}`,icon:o.jsx(y,{"aria-hidden":!0}),onSelect:()=>r(g.id),group:x===d.mine&&x>0}}),{id:"all-tasks",label:m>0?`All tasks (${m} more)`:"All tasks",icon:o.jsx(Si,{"aria-hidden":!0}),onSelect:()=>c("tasks"),group:h.length>0}]})}const Ir=s=>typeof s=="number"&&Number.isFinite(s)&&s>=0?s:null;function n1(s){const n=Ir(s?.contextWindowUsedTokens),i=Ir(s?.contextWindowMaxTokens);if(n===null||i===null||i<=0)return null;const r=n/i*100;return{percentage:Math.round(r),share:r,usedTokens:n,maxTokens:i}}const q4=s=>Math.max(0,Math.min(100,s));function ky(s){return s>90?"danger":s>=70?"warning":"normal"}function Yr(s){return s>=1e6?`${Math.round(s/1e6)}m`:s>=1e3?`${Math.round(s/1e3)}k`:Math.round(s).toString()}function B4(s){return typeof s!="number"||!Number.isFinite(s)||s<=0?null:s<.01?`$${s.toFixed(4)}`:`$${s.toFixed(2)}`}function U4(s){const n=Ir(s?.inputTokens),i=Ir(s?.cachedInputTokens),r=Ir(s?.outputTokens),c=[];return n!==null&&c.push(`${Yr(n)} input${i?` (${Yr(i)} cached)`:""}`),r!==null&&c.push(`${Yr(r)} output`),c.length?c.join(" · "):null}function $4(s){const n=n1(s);return n?`Context window ${n.percentage}% used`:"Context window: No context data"}const xa=14,mf=2,pf=(xa-mf)/2,Dd=2*Math.PI*pf,H4={normal:"text-muted-foreground",warning:"text-warning",danger:"text-destructive"};function jy({usage:s,className:n}){const[i,r]=v.useState(!1),c=v.useId(),u=n1(s),d=B4(s?.totalCostUsd),h=U4(s),m=u?q4(u.share):0,g=xa/2;return o.jsxs("div",{className:Y("relative flex",n),onPointerEnter:x=>{x.pointerType==="mouse"&&r(!0)},onPointerLeave:x=>{x.pointerType==="mouse"&&r(!1)},children:[o.jsx("button",{type:"button","aria-label":$4(s),"aria-describedby":i?c:void 0,"data-testid":"context-window-meter","data-level":u?ky(u.share):"none",onFocus:()=>r(!0),onBlur:()=>r(!1),onClick:()=>r(!0),onKeyDown:x=>{x.key==="Escape"&&i&&(x.preventDefault(),r(!1))},className:"inline-flex size-7 shrink-0 items-center justify-center rounded-full outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",children:o.jsxs("svg",{width:xa,height:xa,viewBox:`0 0 ${xa} ${xa}`,"aria-hidden":!0,children:[o.jsx("circle",{cx:g,cy:g,r:pf,fill:"none",stroke:"currentColor",strokeWidth:mf,className:"text-muted"}),u?o.jsx("circle",{cx:g,cy:g,r:pf,fill:"none",stroke:"currentColor",strokeWidth:mf,strokeLinecap:"round",strokeDasharray:Dd,strokeDashoffset:Dd-m/100*Dd,transform:`rotate(-90 ${g} ${g})`,className:H4[ky(u.share)],"data-testid":"context-window-ring"}):null]})}),i?o.jsxs("div",{role:"tooltip",id:c,"data-testid":"context-window-details",className:"absolute bottom-full right-0 z-50 mb-2 flex w-max min-w-[200px] max-w-[300px] flex-col gap-1.5 rounded-lg border border-border bg-popover px-2 py-1 text-popover-foreground shadow-md",children:[o.jsx("span",{className:"text-sm text-foreground",children:"Context window"}),u?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-sm text-foreground",children:[u.percentage,"% used"]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[Yr(u.usedTokens)," / ",Yr(u.maxTokens)," tokens"]})]}):o.jsx("span",{className:"text-xs text-muted-foreground",children:"No context data"}),h?o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last reported ",h]}):null,d?o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Session cost ",d]}):null]}):null]})}function G4({question:s,onAnswer:n,onDecline:i,busy:r,blocked:c}){const[u,d]=v.useState(null),[h,m]=v.useState(""),[g,x]=v.useState(null);v.useEffect(()=>{r||x(null)},[r]);const y=r||!!c,w=v.useId(),k=s.options??[],T=h.trim()||(u!=null?k[u]:""),S=()=>{T&&!y&&(x("submit"),n(T))},E=()=>{y||(x("dismiss"),i())},q=s.agent&&s.agent!=="main"?s.agent:null;return o.jsxs("section",{"aria-label":`Question from ${s.agent}`,className:"flex flex-col gap-3 rounded-lg border border-border bg-card p-3","data-testid":"question",children:[o.jsxs("div",{className:"flex flex-col gap-1 px-3 pt-1",children:[q?o.jsxs("p",{className:"text-[13px] text-muted-foreground",children:[q," asks"]}):null,o.jsx("p",{className:"whitespace-pre-wrap text-[15px] leading-[22px] text-foreground [overflow-wrap:anywhere]","data-testid":"question-text",children:s.body})]}),o.jsxs("div",{className:"flex flex-col gap-1",children:[k.length?o.jsx("div",{className:"flex flex-col gap-1",role:"radiogroup","aria-label":s.body,onKeyDown:L=>{if(!["ArrowDown","ArrowUp","ArrowRight","ArrowLeft"].includes(L.key))return;L.preventDefault();const M=L.key==="ArrowDown"||L.key==="ArrowRight"?1:-1,R=((u??(M>0?-1:0))+M+k.length)%k.length;d(R),m(""),L.currentTarget.querySelectorAll('[role="radio"]')[R]?.focus()},children:k.map((L,M)=>{const R=u===M;return o.jsxs("button",{type:"button",role:"radio","aria-checked":R,disabled:y,tabIndex:R||u==null&&M===0?0:-1,onClick:()=>{d(R?null:M),m("")},className:Y("flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-[15px] leading-[22px] outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring active:opacity-90 disabled:pointer-events-none disabled:opacity-50",R?"bg-muted text-foreground":"text-muted-foreground"),children:[o.jsx("span",{"aria-hidden":!0,className:Y("flex size-[18px] shrink-0 items-center justify-center rounded-full border",R?"border-primary":"border-input"),children:R?o.jsx("span",{className:"size-2.5 rounded-full bg-primary"}):null}),o.jsx("span",{className:"min-w-0 flex-1 [overflow-wrap:anywhere]",children:L})]},`${M}:${L}`)})}):null,o.jsx("label",{htmlFor:w,className:"sr-only",children:k.length?"Other answer":"Your answer"}),o.jsx("input",{id:w,value:h,disabled:y,autoComplete:"off",onChange:L=>{m(L.target.value),L.target.value&&d(null)},onKeyDown:L=>{L.key==="Enter"&&!L.nativeEvent.isComposing&&(L.preventDefault(),S())},placeholder:k.length?"Other...":"Type your answer...",className:"w-full rounded-lg border border-transparent bg-muted p-3 text-[15px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-input disabled:cursor-not-allowed disabled:opacity-50"})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[o.jsx("button",{type:"button",disabled:y,onClick:E,className:"flex min-h-9 items-center justify-center gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm text-muted-foreground outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",children:g==="dismiss"&&r?o.jsx($t,{label:""}):o.jsxs(o.Fragment,{children:[o.jsx(Zt,{"aria-hidden":!0,className:"size-3.5"}),"Dismiss"]})}),o.jsx("button",{type:"button",disabled:y||!T,onClick:S,className:Y("flex min-h-9 items-center justify-center gap-2 rounded-md border border-primary bg-primary px-3 py-2 text-sm text-primary-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring active:opacity-90",(y||!T)&&"pointer-events-none opacity-50"),children:g==="submit"&&r?o.jsx($t,{label:"",className:"text-primary-foreground"}):o.jsxs(o.Fragment,{children:[o.jsx(Hl,{"aria-hidden":!0,className:"size-3.5"}),"Submit"]})})]}),c?o.jsx("p",{className:"px-1 text-xs text-muted-foreground",children:c}):null]})}const gf=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,s1=s=>s.replace(/\t/g," ").match(/^ */)[0].length,Sy=s=>s.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(n=>n.trim());function i1(s,n,i){const r=gf.exec(s[n]),c=/\d/.test(r[2]),u=[];let d=n;for(;d<s.length;){const h=s[d],m=gf.exec(h),g=s1(h);if(m&&g===i&&/\d/.test(m[2])===c){u.push({text:m[3],children:[]}),d++;continue}if(m&&g>i&&u.length){const x=i1(s,d,g);u.at(-1).children.push(x.block),d=x.next;continue}if(!m&&h.trim()&&g>i&&u.length){const x=u.at(-1);if(x.children.length)break;x.text+=` ${h.trim()}`,d++;continue}break}return{block:{kind:"list",ordered:c,start:c&&Number.parseInt(r[2],10)||1,items:u},next:d}}function I4(s){const n=s.replace(/\r\n?/g,`
|
|
39
|
-
`).split(`
|
|
40
|
-
`),i=[];let r=[];const c=()=>{r.length&&i.push({kind:"paragraph",text:r.join(`
|
|
41
|
-
`)}),r=[]};for(let u=0;u<n.length;u++){const d=n[u],h=/^\s*(```+|~~~+)\s*([\w+-]*)\s*$/.exec(d);if(h){c();const x=[];let y=u+1;for(;y<n.length&&!n[y].trim().startsWith(h[1]);)x.push(n[y++]);i.push({kind:"code",lang:h[2],text:x.join(`
|
|
42
|
-
`)}),u=y;continue}const m=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(d);if(m){c(),i.push({kind:"heading",level:m[1].length,text:m[2]});continue}if(/^\s{0,3}([-*_])(\s*\1){2,}\s*$/.test(d)){c(),i.push({kind:"rule"});continue}if(d.trim().startsWith("|")&&u+1<n.length&&/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/.test(n[u+1])){c();const x=Sy(d),y=[];let w=u+2;for(;w<n.length&&n[w].trim().startsWith("|");)y.push(Sy(n[w++]));i.push({kind:"table",head:x,rows:y}),u=w-1;continue}if(gf.test(d)){c();const{block:x,next:y}=i1(n,u,s1(d));i.push(x),u=y-1;continue}const g=/^\s*>\s?(.*)$/.exec(d);if(g){c();const x=i.at(-1);x?.kind==="quote"?x.text+=`
|
|
43
|
-
${g[1]}`:i.push({kind:"quote",text:g[1]});continue}if(!d.trim()){c();continue}r.push(d)}return c(),i}const a1=String.raw`(?!\))[^()\s]{0,2048}(?:\([^()\s]{0,2048}\)[^()\s]{0,2048})?`,r1=String.raw`[^[\]\n]{1,1000}`,Y4=new RegExp(["(`[^`\\n]{1,1000}`)",String.raw`(\*\*[^*\n]{1,1000}?\*\*|__[^_\n]{1,1000}?__)`,String.raw`(~~[^~\n]{1,1000}?~~)`,String.raw`(\[${r1}\]\(${a1}\))`,String.raw`((?:https?:\/\/|mailto:)[^\s<>()]{0,2048}[^\s<>().,;:!?'"`+"`"+String.raw`*])`,String.raw`(\*[^*\s][^*\n]{0,1000}?\*|(?<![\w])_[^_\s][^_\n]{0,1000}?_(?![\w]))`].join("|")),V4=new RegExp(String.raw`^\[(${r1})\]\((${a1})\)$`);function K4(s){const n=V4.exec(s);return n?{text:n[1],href:n[2]}:void 0}const Zl=v.createContext(null),X4="cursor-pointer text-highlight underline-offset-2 hover:underline focus-visible:underline outline-none";function Ny({target:s,links:n,children:i,title:r}){return o.jsx("button",{type:"button",className:Y("inline break-words text-left [overflow-wrap:anywhere]",X4),title:r,"data-testid":"chat-file-link","data-path":s.path,onClick:()=>n.open(s),children:o.jsx(Zl.Provider,{value:null,children:i})})}const o1=s=>/^(https?:\/\/|mailto:)/i.test(s)?s:void 0;function Ty({href:s,children:n}){const i=o1(s);return i?o.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"break-words text-highlight [overflow-wrap:anywhere] hover:underline",children:o.jsx(Zl.Provider,{value:null,children:n})}):o.jsx(o.Fragment,{children:n})}function zn({text:s}){const n=v.useContext(Zl),i=[];let r=s,c=0;for(;r;){const u=Y4.exec(r);if(!u){i.push(r);break}u.index&&i.push(r.slice(0,u.index));const[d,h,m,g,x,y,w]=u;if(h){const k=h.slice(1,-1),T=n?.resolve(k,"code"),S=o.jsx("code",{className:Y("rounded-md bg-muted px-1 py-0.5 font-mono text-[12px]",T?"text-highlight":"text-foreground"),children:k});i.push(T&&n?o.jsx(Ny,{target:T,links:n,title:`Open ${T.path}${T.line?`:${T.line}`:""}`,children:S},c++):o.jsx(v.Fragment,{children:S},c++))}else if(m)i.push(o.jsx("strong",{className:"font-semibold text-foreground",children:o.jsx(zn,{text:m.slice(2,-2)})},c++));else if(g)i.push(o.jsx("s",{className:"text-muted-foreground",children:o.jsx(zn,{text:g.slice(2,-2)})},c++));else if(x){const k=K4(x),T=!k||o1(k.href)?void 0:n?.resolve(k.href,"href");k?i.push(T&&n?o.jsx(Ny,{target:T,links:n,title:`Open ${T.path}${T.line?`:${T.line}`:""}`,children:o.jsx(zn,{text:k.text})},c++):o.jsx(Ty,{href:k.href,children:o.jsx(zn,{text:k.text})},c++)):i.push(x)}else y?i.push(o.jsx(Ty,{href:y,children:y},c++)):w&&i.push(o.jsx("em",{className:"italic",children:o.jsx(zn,{text:w.slice(1,-1)})},c++));r=r.slice(u.index+d.length)}return o.jsx(o.Fragment,{children:i})}const Q4=["","mt-6 mb-3 border-b border-border pb-2 text-[28px] leading-[36px] font-bold","mt-6 mb-3 border-b border-border pb-2 text-[24px] leading-[31px] font-bold","mt-4 mb-2 text-[21px] leading-[28px] font-semibold","mt-4 mb-2 text-[19px] leading-[25px] font-semibold","mt-3 mb-1 text-[17px] leading-[22px] font-semibold","mt-3 mb-1 text-[17px] leading-[22px] font-semibold uppercase tracking-[0.5px] text-muted-foreground"];function l1({blocks:s,nested:n}){return o.jsx(o.Fragment,{children:s.map((i,r)=>{const c=s[r+1];switch(i.kind){case"code":return o.jsx("pre",{className:"my-3 overflow-x-auto rounded-md border border-border bg-muted p-3 font-mono text-[12px] leading-[18px] text-foreground",children:o.jsx("code",{children:i.text})},r);case"heading":{const u=`h${Math.min(i.level+1,6)}`;return o.jsx(u,{className:Y("text-foreground first:mt-0",Q4[i.level]),children:o.jsx(zn,{text:i.text})},r)}case"list":{const u=i.ordered?"ol":"ul",d=n?"mb-0":c?c.kind==="list"?"mb-2":"mb-4":"mb-0";return o.jsx(u,{className:Y("mt-1 pl-2.5",d),...i.ordered&&i.start!==1?{start:i.start}:{},children:i.items.map((h,m)=>o.jsxs("li",{className:"mb-1 flex items-start",children:[o.jsx("span",{"aria-hidden":!0,className:Y("mr-1 shrink-0 select-none text-muted-foreground",i.ordered&&"min-w-3"),children:i.ordered?`${i.start+m}.`:"•"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx(zn,{text:h.text}),h.children.length?o.jsx(l1,{blocks:h.children,nested:!0}):null]})]},m))},r)}case"quote":return o.jsx("blockquote",{className:"my-3 whitespace-pre-wrap rounded-r-md border-l-4 border-muted bg-card px-4 py-3 text-foreground/80",children:o.jsx(zn,{text:i.text})},r);case"table":return o.jsx("div",{className:"my-3 overflow-x-auto rounded-md border border-border",children:o.jsxs("table",{className:"w-full border-collapse text-left",children:[o.jsx("thead",{className:"bg-muted",children:o.jsx("tr",{children:i.head.map((u,d)=>o.jsx("th",{className:"border-b border-r border-border p-2 font-semibold last:border-r-0",children:o.jsx(zn,{text:u})},d))})}),o.jsx("tbody",{children:i.rows.map((u,d)=>o.jsx("tr",{className:"border-b border-border last:border-b-0",children:i.head.map((h,m)=>o.jsx("td",{className:"border-r border-border p-2 align-top last:border-r-0",children:o.jsx(zn,{text:u[m]??""})},m))},d))})]})},r);case"rule":return o.jsx("hr",{className:"my-2.5 border-0 border-t border-border"},r);default:return o.jsx("p",{className:Y("whitespace-pre-wrap",n?"mb-0":"mb-3"),children:o.jsx(zn,{text:i.text})},r)}})})}function Wl({text:s,className:n}){const i=v.useMemo(()=>I4(s),[s]);return o.jsx("div",{className:Y("min-w-0 break-words text-[15px] leading-[21px] text-foreground [overflow-wrap:anywhere]",n),children:o.jsx(l1,{blocks:i})})}const Z4=/^(.+?):(\d+)(?::\d+)?(?:-(\d+)(?::\d+)?)?$/,W4=/^L(\d+)(?:C\d+)?(?:-L?(\d+)(?:C\d+)?)?$/i,P4=/^[a-z][a-z0-9+-]*:/i,F4=/\.[a-z0-9_+-]{1,12}$/i;function J4(s){try{return decodeURIComponent(s)}catch{return s}}function Ay(s,n){const i=s?Number(s):void 0,r=n?Number(n):void 0;return i!==void 0&&(!Number.isSafeInteger(i)||i<=0)||r!==void 0&&(!Number.isSafeInteger(r)||i===void 0||r<i)?null:{...i?{line:i}:{},...r&&r!==i?{lineEnd:r}:{}}}const eT=s=>s.replace(/\/+$/,"");function tT(s,{roots:n,kind:i}){let r=String(s??"").trim().replace(/^['"`]+|['"`]+$/g,"");if(!r||r.length>4096||/\s/.test(r))return;if(i==="href"){if(/^file:\/\//i.test(r))r=r.replace(/^file:\/\/(localhost)?/i,"");else if(P4.test(r)&&!/^[a-zA-Z]:[\\/]/.test(r))return;r=J4(r)}else if(r.includes("://"))return;if(r.startsWith("~")||r.startsWith("#"))return;let c={};const u=r.indexOf("#");if(u>=0){const m=W4.exec(r.slice(u+1)),g=m?Ay(m[1],m[2]):null;if(!g)return;c=g,r=r.slice(0,u)}else{const m=Z4.exec(r);if(m){const g=Ay(m[2],m[3]);if(!g)return;c=g,r=m[1]}}let d=r;if(d.startsWith("/")){const m=n.map(eT).filter(Boolean).find(g=>d.startsWith(`${g}/`));if(!m)return;d=d.slice(m.length+1)}const h=Hs(d);if(!(!h||Ai(h))&&!(i==="code"&&(!h.includes("/")&&!r.startsWith("./")||!F4.test(h.split("/").pop()??"")&&!("line"in c))))return{path:h,...c}}function c1(s){if(!Number.isFinite(s)||s<0)return"0s";const n=Math.floor(s/1e3);if(n<60)return`${n}s`;const i=Math.floor(n/60);if(i<60)return n%60?`${i}m ${n%60}s`:`${i}m`;const r=Math.floor(i/60);return i%60?`${r}h ${i%60}m`:`${r}h`}const xf=950,nT=[[1,0,.78,0,.56,.34],[.78,1,.56,0,.34,0],[.56,.78,.34,1,0,0],[.34,.56,0,.78,0,1],[0,.34,0,.56,1,.78],[0,0,1,.34,.78,.56]],Ey=()=>Math.floor(Date.now()%xf*6/xf);function nh({size:s=14,className:n}){const[i,r]=v.useState(Ey);v.useEffect(()=>{if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;const d=window.setInterval(()=>r(Ey()),xf/6);return()=>window.clearInterval(d)},[]);const c=Math.max(1,Math.round(s*.12)),u=Math.max(2,(s-c*2)/3);return o.jsx("span",{"aria-hidden":!0,className:Y("relative inline-flex shrink-0 items-center justify-center",n),style:{width:s,height:s},children:o.jsx("span",{className:"relative",style:{width:u*2+c,height:u*3+c*2},children:nT[i].map((d,h)=>o.jsx("span",{className:"absolute rounded-full bg-current transition-opacity duration-100",style:{width:u,height:u,left:h%2*(u+c),top:Math.floor(h/2)*(u+c),opacity:d}},h))})})}function sT({since:s,className:n}){const[i,r]=v.useState(Date.now);return v.useEffect(()=>{const c=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(c)},[]),o.jsx("span",{className:Y("tabular-nums",n),children:c1(i-s)})}function u1({text:s,label:n,className:i}){const[r,c]=v.useState(!1),u=v.useRef(void 0);return v.useEffect(()=>()=>window.clearTimeout(u.current),[]),o.jsx("button",{type:"button","aria-label":r?"Copied":n,title:r?"Copied":n,onClick:()=>{const d=s();d&&navigator.clipboard?.writeText(d).then(()=>{c(!0),window.clearTimeout(u.current),u.current=window.setTimeout(()=>c(!1),1500)}).catch(()=>{})},className:Y("flex shrink-0 items-center justify-center rounded p-1 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring [&_svg]:size-3.5",i),children:r?o.jsx(Hl,{"aria-hidden":!0}):o.jsx(qs,{"aria-hidden":!0})})}function Cy({children:s,tone:n}){return o.jsx("pre",{className:Y("max-h-[360px] overflow-auto bg-card p-3 font-mono text-[12px] leading-[18px] whitespace-pre",n==="error"?"text-destructive":"text-foreground"),children:s})}function d1(s){const[n,i]=v.useState(_n),{shown:r,hidden:c}=X0(s,n),u=c?o.jsxs("button",{type:"button","data-testid":"tool-detail-more",onClick:()=>i(d=>d+_n),className:"sticky left-0 block px-3 py-1.5 font-sans text-xs text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[`Show ${Math.min(c,_n)} more line${Math.min(c,_n)===1?"":"s"}`,c>_n?` (${c} hidden)`:""]}):null;return{shown:r,more:u}}const f1="max-h-[360px] overflow-auto bg-card font-mono text-[12px] leading-[18px] text-foreground";function $s({text:s,startLine:n,testId:i}){const r=v.useMemo(()=>Dl(s),[s]),{shown:c,more:u}=d1(r),d=n!=null?String(n+r.length-1).length:0;return o.jsxs("div",{className:f1,"data-testid":i,children:[o.jsx("div",{className:"min-w-max py-2",children:c.map((h,m)=>o.jsxs("div",{className:"flex whitespace-pre px-3",children:[n!=null?o.jsx("span",{"aria-hidden":!0,className:"mr-3 shrink-0 select-none text-right text-muted-foreground tabular-nums",style:{minWidth:`${d}ch`},children:n+m}):null,o.jsx("span",{children:h||" "})]},m))}),u]})}const My={add:"bg-[rgba(46,160,67,0.15)]",remove:"bg-[rgba(248,81,73,0.15)]",context:"",hunk:"bg-muted/60 text-muted-foreground",file:"bg-muted font-sans font-medium",meta:"text-muted-foreground italic"},iT={add:"+",remove:"-",context:" ",hunk:"",file:"",meta:""};function aT({detail:s}){const{lines:n,numbered:i}=v.useMemo(()=>Q0(s),[s]),{shown:r,more:c}=d1(n);if(!n.length)return o.jsx(h1,{children:"No changes to show."});const u=i?String(Math.max(0,...n.map(h=>Math.max(h.oldLine??0,h.newLine??0)))).length:0,d=h=>i?o.jsx("span",{"aria-hidden":!0,className:"shrink-0 select-none pr-2 text-right text-muted-foreground tabular-nums",style:{minWidth:`${u+1}ch`},children:h??""}):null;return o.jsxs("div",{className:f1,"data-testid":"tool-diff",children:[o.jsx("div",{className:"min-w-max py-2",children:r.map((h,m)=>h.type==="hunk"||h.type==="file"||h.type==="meta"?o.jsx("div",{className:Y("whitespace-pre px-3",My[h.type],h.type==="file"&&m>0&&"mt-2"),"data-diff":h.type,children:h.text},m):o.jsxs("div",{className:Y("flex whitespace-pre px-3",My[h.type]),"data-diff":h.type,children:[d(h.oldLine),d(h.newLine),o.jsx("span",{"aria-hidden":!0,className:Y("w-[2ch] shrink-0 select-none",h.type==="add"?"text-dot-success":h.type==="remove"?"text-destructive":"text-muted-foreground"),children:iT[h.type]}),o.jsx("span",{children:h.text||" "})]},m))}),c]})}function h1({children:s}){return o.jsx("p",{className:"bg-card px-3 py-2.5 text-sm text-muted-foreground",children:s})}function rT({title:s,children:n}){return o.jsxs("div",{children:[o.jsx("p",{className:"bg-card px-3 pt-2 text-xs font-medium text-muted-foreground",children:s}),n]})}function m1({url:s,children:n}){const i=B3(s);return i?o.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"break-all text-foreground underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground",children:n??s}):o.jsx("span",{className:"break-all",children:n??s})}function oT({detail:s,roots:n}){const i=Array.isArray(s.filePaths)?s.filePaths.filter(d=>typeof d=="string"):[],r=Array.isArray(s.webResults)?s.webResults.filter(d=>d&&typeof d.url=="string"):[],c=[typeof s.numMatches=="number"?`${s.numMatches} match${s.numMatches===1?"":"es"}`:"",typeof s.numFiles=="number"?`${s.numFiles} file${s.numFiles===1?"":"s"}`:"",s.truncated?"truncated":""].filter(Boolean).join(" · "),u=typeof s.content=="string"?s.content:"";return o.jsxs(o.Fragment,{children:[c?o.jsx("p",{className:"bg-card px-3 pt-2 text-xs text-muted-foreground",children:c}):null,u?o.jsx($s,{text:u,testId:"tool-search-content"}):null,i.length?o.jsx($s,{text:i.map(d=>kl(d,n)).join(`
|
|
44
|
-
`),testId:"tool-search-files"}):null,r.length?o.jsx("ul",{className:"max-h-[360px] space-y-2 overflow-auto bg-card px-3 py-2.5 text-sm","data-testid":"tool-search-web",children:r.map((d,h)=>o.jsxs("li",{className:"min-w-0",children:[o.jsx(m1,{url:String(d.url),children:d.title?.trim()||d.url}),d.title?.trim()?o.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:d.url}):null]},h))}):null]})}function lT({detail:s}){const n=typeof s.result=="string"?s.result:"";return o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"bg-card px-3 py-2.5 font-mono text-[12px] leading-[18px]",children:[o.jsx(m1,{url:String(s.url??"")}),typeof s.code=="number"?o.jsx("span",{className:"ml-2 text-muted-foreground",children:s.code}):null]}),typeof s.prompt=="string"&&s.prompt.trim()?o.jsx(rT,{title:"Prompt",children:o.jsx("p",{className:"bg-card px-3 pb-2.5 pt-1 text-sm whitespace-pre-wrap [overflow-wrap:anywhere]",children:s.prompt})}):null,n?o.jsx($s,{text:n,testId:"tool-fetch-result"}):null]})}function cT({detail:s}){const n=ql(s?.input),i=ql(s?.output);return o.jsxs(o.Fragment,{children:[n?o.jsx($s,{text:n,testId:"tool-unknown-input"}):null,i?o.jsx($s,{text:i,testId:"tool-unknown-output"}):null]})}function ls(s,n){const i=r=>typeof r=="string"&&r.length>0;switch(s){case"shell":return!0;case"read":case"write":return i(n.content);case"edit":return i(n.unifiedDiff)||i(n.oldString)||i(n.newString);case"search":return i(n.content)||n.filePaths?.length>0||n.webResults?.length>0||typeof n.numFiles=="number"||typeof n.numMatches=="number";case"fetch":return i(n.url)||i(n.result);case"sub_agent":return i(n.description)||i(n.log);case"plan":return i(n.text)&&n.text.trim().length>0;case"plain_text":return i(n.text);default:return!!ql(n?.input)||!!ql(n?.output)}}function uT({item:s,roots:n}){const i=s.detail??{},r=K0(i),c=s.status;let u=null;switch(r){case"shell":{const d=String(i.output??"").replace(/^\n+/,"");u=o.jsxs(Cy,{children:[o.jsx("span",{className:"text-muted-foreground",children:"$ "}),String(i.command??"").replace(/\n+$/,""),d?`
|
|
45
|
-
|
|
46
|
-
${d}`:c==="running"?`
|
|
47
|
-
|
|
48
|
-
Running…`:""]});break}case"read":ls(r,i)&&(u=o.jsx($s,{text:i.content,startLine:Number.isInteger(i.offset)&&i.offset>0?i.offset:1,testId:"tool-file-content"}));break;case"write":ls(r,i)&&(u=o.jsx($s,{text:i.content,startLine:1,testId:"tool-file-content"}));break;case"edit":ls(r,i)&&(u=o.jsx(aT,{detail:i}));break;case"search":ls(r,i)&&(u=o.jsx(oT,{detail:i,roots:n}));break;case"fetch":ls(r,i)&&(u=o.jsx(lT,{detail:i}));break;case"sub_agent":ls(r,i)&&(u=o.jsxs(o.Fragment,{children:[typeof i.description=="string"&&i.description.trim()?o.jsx("p",{className:"bg-card px-3 py-2.5 text-sm whitespace-pre-wrap [overflow-wrap:anywhere]","data-testid":"tool-sub-agent-description",children:i.description}):null,typeof i.log=="string"&&i.log.trim()?o.jsx($s,{text:i.log.replace(/^\n+/,""),testId:"tool-sub-agent-log"}):null]}));break;case"plan":ls(r,i)&&(u=o.jsx("div",{className:"max-h-[480px] overflow-auto bg-card px-4 py-3","data-testid":"tool-plan",children:o.jsx(Wl,{text:i.text,className:"text-sm leading-5"})}));break;case"plain_text":ls(r,i)&&(u=o.jsx("p",{className:"max-h-[360px] overflow-auto bg-card px-3 py-2.5 text-sm whitespace-pre-wrap [overflow-wrap:anywhere]",children:i.text}));break;default:ls(r,i)&&(u=o.jsx(cT,{detail:i}))}return o.jsxs("div",{className:"divide-y divide-border",children:[u,s.error?o.jsx(Cy,{tone:"error",children:s.error}):null,!u&&!s.error?o.jsx(h1,{children:c==="running"?"Running…":"No output."}):null]})}const p1=v.createContext(null),Pl=()=>v.useContext(p1);function sh(){const s=v.useRef(null);return{take:()=>s.current??=Sf(),settle:n=>{n||(s.current=null)},reset:()=>{s.current=null}}}function dT({entryKey:s}){const n=Pl(),i=n?.turns.get(s);return!n||!n.rewind.shown||!i?.rewindable?null:o.jsxs("button",{type:"button","data-testid":"rewind-action","aria-label":"Rewind to here…",title:n.rewind.reason??"Rewind to here… (the conversation only; files are not changed)",disabled:!!n.rewind.reason,onClick:()=>n.askRewind(s),className:"flex shrink-0 items-center gap-1 rounded p-1 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-45 [&_svg]:size-3.5",children:[o.jsx(_b,{"aria-hidden":!0}),o.jsx("span",{children:"Rewind to here…"})]})}function fT({userKeys:s}){const n=Pl();if(!n||!n.fork.shown)return null;const i=[...s].reverse().map(r=>n.turns.get(r)).find(Boolean);return i?.ended?o.jsxs("button",{type:"button","data-testid":"fork-action","aria-label":"Fork from here…",title:n.fork.reason??"Fork from here… (a new session with this conversation; files are not copied)",disabled:!!n.fork.reason,onClick:()=>n.askFork(i.turnId),className:"flex shrink-0 items-center gap-1 rounded p-1 text-[13px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-45 [&_svg]:size-3.5",children:[o.jsx(Nb,{"aria-hidden":!0}),o.jsx("span",{children:"Fork from here…"})]}):null}function hT({turn:s,onClose:n,onDone:i}){const r=Be(),c=sh(),[u,d]=v.useState(!1),[h,m]=v.useState(null);v.useEffect(()=>{m(null),c.reset()},[s?.turnId]);const g=()=>{u||n()},x=async()=>{if(s){d(!0),m(null);try{await r.rewindConversation({beforeTurnId:s.turnId,requestId:c.take()}),c.reset(),i(s.text)}catch(y){const w=Aa(y);c.settle(w.retrySame),m(w.message)}finally{d(!1)}}};return o.jsx(Ma,{open:!!s,onClose:g,title:"Rewind conversation",className:"w-[min(92vw,34rem)]",footer:o.jsxs(o.Fragment,{children:[o.jsx(Le,{variant:"ghost",onClick:g,disabled:u,children:"Cancel"}),o.jsxs(Le,{variant:"destructive",onClick:()=>{x()},disabled:u,"data-testid":"rewind-confirm",children:[o.jsx(_b,{"aria-hidden":!0}),u?"Rewinding…":h?"Try again":"Rewind"]})]}),children:s?o.jsxs("div",{className:"space-y-3 text-sm","data-testid":"rewind-dialog",children:[o.jsxs("p",{children:["The conversation goes back to ",o.jsx("strong",{children:"before this message"}),", under the same session. The agent continues from there and no longer sees what came after."]}),o.jsx("blockquote",{className:"max-h-28 overflow-y-auto whitespace-pre-wrap rounded-md border-l-2 border-border bg-muted/50 px-3 py-2 text-muted-foreground [overflow-wrap:anywhere]",children:s.text||"(no text)"}),o.jsxs("p",{children:["This message and what came after it (",s2(s.later),") move to a branch. The branch is kept: you can restore it as a new session from the timeline."]}),o.jsxs("p",{className:"rounded-md bg-[rgba(245,158,11,0.1)] px-3 py-2 font-medium","data-testid":"rewind-files-note",children:[Qk," Undo file changes yourself if you need to."]}),o.jsx("p",{className:"text-muted-foreground",children:"The message is put back in the composer so you can edit and send it again."}),h?o.jsx("p",{role:"alert",className:"text-destructive",children:h}):null]}):null})}function mT({turnId:s,title:n,onClose:i}){const r=Be(),{registry:c,connection:u}=De(),d=sh(),[h,m]=v.useState(!1),[g,x]=v.useState(null),[y,w]=v.useState("tab"),[k,T]=v.useState(null),[S,E]=v.useState(""),q=r.worktreeForkSource(),L=v.useRef(null),M=!!q&&u.phase==="open";v.useEffect(()=>{if(x(null),w("tab"),d.reset(),L.current=null,!s||!M)return;let V=!0;return r.worktreeForkDestinations().then(A=>{V&&(T(A),E(A[0]??""))},()=>{V&&T([])}),()=>{V=!1}},[s,M]);const R=()=>{h||i()},$=async()=>{if(s){m(!0),x(null);try{if(y==="worktree"){const V=d.take();L.current??=V,await r.forkIntoWorktree({requestId:V,worktreeKey:`${L.current}:${S}`,mappingId:S,boundary:{throughTurnId:s}})}else await r.forkConversation({requestId:d.take(),boundary:{throughTurnId:s}});d.reset(),i()}catch(V){const A=Aa(V);d.settle(A.retrySame),x(A.message)}finally{m(!1)}}},_=(V,A,I,O=!1)=>o.jsxs("label",{className:Y("flex cursor-pointer items-start gap-2 rounded-md border border-border p-2",y===V&&"border-ring bg-accent/40",O&&"cursor-not-allowed opacity-50"),children:[o.jsx("input",{type:"radio",name:"fork-target",className:"mt-1",checked:y===V,disabled:O||h,onChange:()=>w(V),"aria-label":A}),o.jsxs("span",{children:[o.jsx("span",{className:"block font-medium",children:A}),o.jsx("span",{className:"block text-muted-foreground",children:I})]})]});return o.jsx(Ma,{open:!!s,onClose:R,title:"Fork conversation",className:"w-[min(92vw,34rem)]",footer:o.jsxs(o.Fragment,{children:[o.jsx(Le,{variant:"ghost",onClick:R,disabled:h,children:"Cancel"}),o.jsxs(Le,{onClick:()=>{$()},disabled:h||y==="worktree"&&!S,"data-testid":"fork-confirm",children:[o.jsx(Nb,{"aria-hidden":!0}),h?"Forking…":g?"Try again":"Fork"]})]}),children:s?o.jsxs("div",{className:"space-y-3 text-sm","data-testid":"fork-dialog",children:[o.jsx("p",{children:"A new session continues this conversation from the end of this turn. This session stays as it is."}),o.jsxs("div",{className:"space-y-2",role:"radiogroup","aria-label":"Where the fork runs",children:[_("tab","In a new tab","Same workspace: the new session opens in its own tab."),M?_("worktree","In a new worktree","A clean checkout of the last commit, made first; uncommitted changes here are not in it."):null]}),y==="worktree"?k===null?o.jsx("p",{className:"text-muted-foreground",children:"Loading destinations…"}):k.length?o.jsxs("label",{className:"block",children:["Destination",o.jsx("select",{"aria-label":"Worktree destination",className:"mt-1 w-full rounded border border-border bg-background p-1",value:S,onChange:V=>E(V.target.value),disabled:h,children:k.map(V=>o.jsx("option",{children:V},V))})]}):o.jsx("p",{className:"text-muted-foreground",children:"Ask the host owner to configure a worktree destination and grant it to this credential."}):null,o.jsxs("p",{className:"rounded-md bg-[rgba(147,197,253,0.1)] px-3 py-2 font-medium","data-testid":"fork-files-note",children:[Zk," Only the conversation is forked."]}),g?o.jsx("p",{role:"alert",className:"text-destructive",children:g}):null]}):null})}function g1({children:s,testId:n}){return o.jsxs("div",{className:"flex items-center gap-2 px-1 py-3 text-[13px] text-muted-foreground","data-testid":n,role:"note",children:[o.jsx("span",{"aria-hidden":!0,className:"h-px min-w-6 flex-1 bg-border"}),o.jsx("span",{className:"flex min-w-0 flex-wrap items-center justify-center gap-x-2 gap-y-1 text-center [&_svg]:size-3.5",children:s}),o.jsx("span",{"aria-hidden":!0,className:"h-px min-w-6 flex-1 bg-border"})]})}function pT({item:s,branchId:n}){const i=Be(),r=Pl(),c=i.rootSummary(r?.root),u=i2(s,c.branches,n),d=sh(),[h,m]=v.useState(!1),[g,x]=v.useState(null),y=async()=>{m(!0),x(null);try{await i.forkConversation({requestId:d.take(),branchId:n,title:`${c.title||"Session"} (restored)`}),d.reset()}catch(w){const k=Aa(w);d.settle(k.retrySame),x(k.message)}finally{m(!1)}};return o.jsxs("div",{className:"flex flex-col items-stretch pb-4","data-branch-id":n,children:[o.jsxs(g1,{testId:"rewind-marker",children:[o.jsx(Lf,{"aria-hidden":!0}),o.jsxs("span",{children:["Conversation rewound here",typeof u=="number"?` — ${n2(u)} kept in a branch`:" — the later turns are kept in a branch",". Files were not changed."]}),r?.fork.shown?o.jsxs(Le,{size:"sm",variant:"secondary",className:"h-7",disabled:h||!!r.fork.reason,title:r.fork.reason,onClick:()=>{y()},"data-testid":"restore-branch",children:[o.jsx(Pr,{"aria-hidden":!0}),h?"Restoring…":"Restore as new session"]}):null]}),g?o.jsx("p",{role:"alert",className:"self-center pb-2 text-xs text-destructive",children:g}):null]})}function gT({item:s}){const n=Be(),{sessions:i}=De(),r=Pl(),c=n.rootSummary(r?.root).forkedFrom,u=c?i.list.find(h=>h.id===c.sessionId):void 0,d=c?.branchId?"a restored branch of":c?.boundary==="before"?"before a message of":c?.boundary==="through"?"a turn of":"the conversation of";return o.jsxs(g1,{testId:"fork-marker",children:[o.jsx(Sb,{"aria-hidden":!0}),c?o.jsxs("span",{children:["Forked from ",d," ",u?o.jsx("button",{type:"button",className:"text-highlight underline-offset-4 hover:underline",onClick:()=>n.selectSession(u.id),"data-testid":"fork-source",children:u.title||u.id}):o.jsx("span",{children:"another session"}),". Files were not copied."]}):o.jsx("span",{children:s.text||"Forked from another session. Files were not copied."})]})}function xT({item:s}){const n=Nf(s);return n?n.kind==="rewind"?o.jsx(pT,{item:s,branchId:n.branchId}):o.jsx(gT,{item:s}):null}function x1({icon:s,label:n,secondary:i,status:r,trailing:c,detail:u,testId:d,kind:h}){const[m,g]=v.useState(!1),x=v.useId(),y=r==="failed",w=r==="running";return o.jsxs("div",{className:"-mx-[13px]","data-testid":d,"data-tool-kind":h,children:[o.jsxs("button",{type:"button",onClick:()=>g(k=>!k),"aria-expanded":m,"aria-controls":m?x:void 0,className:Y("group/badge flex w-full min-w-0 items-center rounded-lg border border-transparent px-2 py-1 text-left text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring active:opacity-90",m&&"rounded-b-none border-border bg-card"),children:[o.jsxs("span",{"aria-hidden":!0,className:"relative mr-1 flex size-[22px] shrink-0 items-center justify-center",children:[o.jsx("span",{className:Y("-ml-px flex",m?"hidden":"group-hover/badge:hidden"),children:y?o.jsx(zb,{className:"size-3 text-destructive opacity-80"}):o.jsx(s,{className:Y("size-3",m?"text-foreground":"text-muted-foreground group-hover/badge:text-foreground")})}),o.jsx(Vn,{className:Y("-ml-1 size-3 scale-[1.3] text-foreground",m?"block rotate-90":"hidden group-hover/badge:block")})]}),o.jsx("span",{className:Y("shrink-0 text-muted-foreground",(m||w)&&"text-foreground",w&&"animate-pulse opacity-70","group-hover/badge:text-foreground"),children:n}),i?o.jsx("span",{className:Y("ml-2 min-w-0 flex-1 truncate text-muted-foreground group-hover/badge:text-foreground",m&&"text-foreground"),children:i}):o.jsx("span",{className:"flex-1"}),c]}),m?o.jsx("div",{id:x,className:"min-w-0 overflow-hidden rounded-b-lg border border-t-0 border-border",children:u()}):null]})}const yT={terminal:Vl,eye:Zr,pencil:Ea,search:Ni,bot:Sa,brain:$r,wrench:Jj};function bT(){const{workspace:s,principal:n}=De();return v.useMemo(()=>s?[s,...(n?.workspaceRoots??[]).filter(i=>i.path===s).map(i=>i.canonical)]:[],[s,n])}function vT({detail:s}){const{added:n,removed:i}=v.useMemo(()=>q3(Q0(s).lines),[s]);return!n&&!i?null:o.jsxs("span",{className:"ml-2 shrink-0 text-xs tabular-nums","data-testid":"tool-diff-stat",children:[o.jsxs("span",{className:"text-dot-success",children:["+",n]})," ",o.jsxs("span",{className:"text-destructive",children:["−",i]})]})}function wT({item:s}){const n=bT(),i=s.status,r=L3(s,n),c=r.kind==="shell"&&i!=="running"?s.detail.exitCode:null;return o.jsx(x1,{testId:"tool-call",kind:r.kind,icon:yT[r.icon],label:r.label,secondary:r.secondary,status:i,trailing:c!=null?o.jsxs("span",{className:Y("ml-2 shrink-0 text-xs tabular-nums",c===0?"text-muted-foreground opacity-0 group-hover/badge:opacity-100 group-aria-expanded/badge:opacity-100":"text-destructive"),children:["exit ",c]}):r.kind==="edit"?o.jsx(vT,{detail:s.detail}):null,detail:()=>o.jsx(uT,{item:s,roots:n})})}function kT({item:s}){const n=s.items??[],i=n.filter(c=>c.status==="completed").length,r=n.find(c=>c.status==="in_progress");return o.jsx(x1,{icon:Mj,label:"Tasks",secondary:r?r.text:`${i} of ${n.length} done`,detail:()=>o.jsx("ul",{className:"space-y-1 bg-card p-2 text-sm",children:n.length?n.map(c=>o.jsxs("li",{className:"flex items-start gap-2 px-1",children:[o.jsx("span",{"aria-hidden":!0,className:Y("mt-[5px] size-2 shrink-0 rounded-full",c.status==="completed"?"bg-dot-success":c.status==="in_progress"?"bg-dot-warning":"border border-muted-foreground/60")}),o.jsx("span",{className:Y("min-w-0",c.status==="completed"&&"text-muted-foreground line-through"),children:c.text})]},c.id)):o.jsx("li",{className:"px-1 text-muted-foreground",children:"No tasks."})})})}function jl({level:s,children:n}){const i=s==="error"?Is:s==="warning"?zb:Of;return o.jsxs("div",{className:Y("flex items-start gap-2 rounded-md px-3 py-2.5 text-sm leading-5 text-foreground",s==="error"?"bg-[rgba(239,68,68,0.1)]":s==="warning"?"bg-[rgba(245,158,11,0.1)]":"bg-[rgba(147,197,253,0.1)]"),children:[o.jsx("span",{"aria-hidden":!0,className:"flex h-5 shrink-0 items-center",children:o.jsx(i,{className:Y("size-4",s==="error"?"text-destructive":s==="warning"?"text-warning":"text-info")})}),o.jsx("span",{className:"min-w-0 flex-1 break-words",children:n})]})}function jT({icon:s,children:n}){return o.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-[13px] text-muted-foreground",children:[o.jsx("span",{"aria-hidden":!0,className:"h-px flex-1 bg-border"}),o.jsxs("span",{className:"flex items-center gap-2 [&_svg]:size-3",children:[s,n]}),o.jsx("span",{"aria-hidden":!0,className:"h-px flex-1 bg-border"})]})}function ST({count:s}){return o.jsxs("span",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 text-[13px] text-muted-foreground","data-testid":"user-message-images",children:[o.jsx(Aj,{"aria-hidden":!0,className:"size-3.5"}),s===1?"1 image":`${s} images`]})}function y1({files:s,testId:n}){return o.jsx("ul",{"aria-label":"Attached files",className:"mb-2 flex max-w-full flex-wrap justify-end gap-2",children:s.map(i=>o.jsxs("li",{"data-testid":n,className:Y("flex h-8 max-w-[18rem] items-center gap-1.5 rounded-full bg-muted px-2.5 text-[13px] text-muted-foreground",i.failed&&"text-destructive"),children:[o.jsx(_f,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),o.jsx("span",{className:"min-w-0 truncate text-foreground",title:i.name,children:i.name}),o.jsx("span",{className:"shrink-0",children:Jy(i.size)}),i.progress?o.jsx("span",{className:"shrink-0","data-testid":"file-progress",children:i.progress}):null]},i.key))})}function NT({text:s,ts:n,images:i,files:r=[],entryKey:c}){const u=!i&&!r.length;return o.jsxs("div",{className:"group/user flex flex-col items-end",children:[i?o.jsx(ST,{count:i}):null,r.length?o.jsx(y1,{testId:"user-message-file",files:r.map(d=>({key:d.attachmentId,name:d.name,size:d.size}))}):null,s||u?o.jsx("div",{className:"min-w-0 max-w-full rounded-2xl rounded-tr-sm bg-bubble p-4 text-[15px] leading-[21px] text-foreground whitespace-pre-wrap [overflow-wrap:anywhere]","data-testid":"user-message",children:s}):null,o.jsxs("div",{className:"mt-2 flex h-6 items-center gap-2 opacity-0 transition-opacity group-hover/user:opacity-100 focus-within:opacity-100",children:[o.jsx("span",{className:"text-[13px] text-muted-foreground",children:f0(n)}),o.jsx(dT,{entryKey:c}),o.jsx(u1,{text:()=>s,label:"Copy message",className:"-mr-1"})]})]})}function TT(){const{workspace:s,principal:n,connection:i}=De(),{openFile:r}=vt(),c=i.capabilities.includes("workspace.files.read")&&ze(n??void 0,"files.read");return v.useMemo(()=>{if(!c||!s)return null;const u=[s,...(n?.workspaceRoots??[]).filter(d=>d.path===s).map(d=>d.canonical)];return{resolve:(d,h)=>tT(d,{roots:u,kind:h}),open:d=>r(d.path,d.line)}},[c,s,n,r])}function AT({text:s}){const n=TT();return o.jsx(Zl.Provider,{value:n,children:o.jsx(Wl,{text:s})})}function ET({entry:s,compactBottom:n}){const i=s.item;switch(i.kind){case"user_message":return o.jsx(NT,{entryKey:s.key,text:i.text,ts:s.ts,images:typeof i.images=="number"&&i.images>0?i.images:void 0,files:T2(i.attachments)});case"assistant_message":return o.jsx("div",{className:Y("pt-3",n?"pb-0":"pb-3"),"data-testid":"assistant-message",children:o.jsx(AT,{text:i.text})});case"tool_call":return o.jsx(wT,{item:i});case"todo":return o.jsx(kT,{item:i});case"notice":return Nf(i)?o.jsx(xT,{item:i}):o.jsx(jl,{level:i.level==="error"||i.level==="warning"?i.level:"info",children:i.text});case"compaction":return o.jsx(jT,{icon:i.status==="running"?o.jsx(nh,{size:12}):i.status==="failed"?o.jsx(Is,{className:"text-destructive"}):o.jsx(Gj,{}),children:i.status==="running"?"Compacting context…":i.status==="failed"?"Compacting the context failed":"Context compacted"});case"turn_end":return i.state==="canceled"?o.jsxs("p",{className:"flex items-center gap-2 py-1 text-[13px] text-muted-foreground",children:[o.jsx(Mf,{"aria-hidden":!0,className:"size-3.5"}),"Stopped."]}):o.jsx(jl,{level:"error",children:`The turn failed${i.error?`: ${i.error}`:"."}`});case"session_event":return o.jsx(jl,{level:i.level==="error"?"error":i.level==="warning"?"warning":"info",children:i.text});default:return null}}function CT({prompt:s,gap:n,onRetry:i,onDiscard:r}){return o.jsxs("div",{className:"flex flex-col items-end gap-2",style:n?{marginTop:n}:void 0,"data-testid":"pending-message","aria-busy":s.status==="sending",children:[s.images?.length?o.jsx("div",{className:"flex flex-wrap justify-end gap-2",children:s.images.map(c=>o.jsx("img",{src:Fy(c),alt:c.name,title:c.name,className:"size-16 rounded-lg border border-border object-cover"},c.id))}):null,s.files?.length?o.jsx(y1,{testId:"pending-file",files:s.files.map((c,u)=>({key:`${u}`,name:c.name,size:c.size,failed:!!c.error,progress:c.attachmentId?"Uploaded":c.error?"Not uploaded":s.status==="sending"?`${c.size?Math.floor((c.received??0)/c.size*100):0}%`:void 0}))}):null,s.text||!s.images?.length&&!s.files?.length?o.jsx("div",{className:Y("min-w-0 max-w-full rounded-2xl rounded-tr-sm p-4 text-[15px] leading-[21px] whitespace-pre-wrap [overflow-wrap:anywhere]",s.status==="sending"?"bg-bubble opacity-70":s.status==="failed"?"border border-destructive/40 bg-destructive/5":"border border-warning/40 bg-warning/5"),children:s.text}):null,s.status==="sending"?o.jsxs("span",{role:"status",className:"flex h-6 items-center gap-2 text-[13px] text-muted-foreground",children:[o.jsx(nh,{size:12}),s.accepted?"Delivered":"Sending…"]}):o.jsxs("div",{className:"flex max-w-full flex-wrap items-center justify-end gap-2 text-[13px]",role:"alert",children:[o.jsx("span",{className:s.status==="failed"?"text-destructive":"text-warning",children:s.status==="failed"?s.error??"Not sent.":`${s.error??"Not confirmed."}${s.retrySameId?" Sending it again is safe: the host ignores a repeat.":""}`}),o.jsxs(Le,{size:"sm",variant:"secondary",onClick:i,children:[o.jsx(Pr,{"aria-hidden":!0})," ",s.status==="failed"?"Retry":"Send again"]}),o.jsxs(Le,{size:"sm",variant:"ghost",onClick:r,children:[o.jsx(Wj,{"aria-hidden":!0})," Discard"]})]})]})}function MT({entries:s,startTs:n,userKeys:i}){const r=s.at(-1)?.ts,c=Date.parse(n??""),u=Date.parse(r??""),d=Number.isFinite(c)&&Number.isFinite(u)&&u>=c?`Worked for ${c1(u-c)}`:"",h=f0(r),m=d||h,g=()=>s.map(x=>x.item.kind==="assistant_message"?x.item.text:"").filter(Boolean).join(`
|
|
49
|
-
|
|
50
|
-
`);return o.jsx("div",{className:"mt-[13px] flex min-h-6 items-center self-start pb-8",children:o.jsxs("div",{className:"flex h-6 items-center gap-2",children:[o.jsx(u1,{text:g,label:"Copy turn",className:"-ml-1"}),o.jsx(fT,{userKeys:i}),m?o.jsxs("span",{className:"group/time relative text-[13px] text-muted-foreground",title:d&&h?`Ended ${h}`:void 0,children:[o.jsx("span",{className:Y(d&&h&&"group-hover/time:invisible"),children:m}),d&&h?o.jsx("span",{className:"invisible absolute left-0 top-0 whitespace-nowrap group-hover/time:visible",children:h}):null]}):null]})})}const Gn=s=>{const n=s?.item?.kind;return n?n==="user_message"?"user":n==="assistant_message"?"assistant":n==="tool_call"||n==="todo"?"tool":"other":null};function b1(s,n){return!s||!n?0:s==="user"&&n==="user"?4:s==="user"&&n==="assistant"||s==="tool"&&n==="tool"?0:s==="user"&&n==="tool"?16:s==="assistant"&&n==="tool"||s==="tool"&&n==="assistant"?4:16}function zT(s,n){const i=[];let r=[],c,u;const d=m=>{r.some(g=>Gn(g)!=="user")&&i.push({type:"footer",key:m,entries:r.filter(g=>Gn(g)!=="user"),startTs:c,userKeys:r.filter(g=>Gn(g)==="user").map(g=>g.key)}),r=[]},h=m=>!!m&&!!Nf(m.item);return s.forEach((m,g)=>{const x=Gn(m);if(h(m)){d(`footer:${m.key}`),i.push({type:"entry",entry:m,gap:0,compactBottom:!1}),u=void 0;return}x==="user"&&r.some(k=>Gn(k)!=="user")&&(d(`footer:${m.key}`),u=void 0),x==="user"&&Gn(u)!=="user"&&(c=m.ts);const y=s[g+1],w=y?Gn(y)==="user"||h(y):!n;i.push({type:"entry",entry:m,gap:b1(Gn(u),x),compactBottom:x==="assistant"&&w}),r.push(m),u=m}),n||d("footer:end"),i}function _T({entries:s,prompts:n,agentOf:i,running:r,runningAgent:c,historyUnavailable:u,older:d,onLoadOlder:h,onRetry:m,onDiscard:g,emptyText:x,tail:y}){const w=v.useRef(null),k=v.useRef(null),T=async()=>{const A=w.current;if(!A||!h)return;const I=[...A.querySelectorAll("[data-entry-key]")].find(O=>O.getBoundingClientRect().bottom>A.getBoundingClientRect().top);k.current=I?{key:I.dataset.entryKey,top:I.getBoundingClientRect().top}:null,S.current=!1,await h()},S=v.useRef(!0),[E,q]=v.useState(!1),L=v.useRef(0),M=()=>{const A=w.current;A&&(S.current=!0,L.current=Date.now()+700,q(!1),A.scrollTo({top:A.scrollHeight,behavior:window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}))},R=s.at(-1),$=`${s.length}:${R?.key}:${R?.item?.text?.length??0}:${R?.item?.status??""}:${n.length}:${r}:${v.Children.count(y)}`;v.useLayoutEffect(()=>{const A=w.current;if(A&&k.current&&!d?.loading){const I=k.current,O=[...A.querySelectorAll("[data-entry-key]")].find(ce=>ce.dataset.entryKey===I.key);O&&(A.scrollTop+=O.getBoundingClientRect().top-I.top),k.current=null}A&&S.current&&(A.scrollTop=A.scrollHeight),A&&A.scrollHeight-A.scrollTop-A.clientHeight<80&&(S.current=!0,q(!1))},[$,d?.loading]),v.useEffect(()=>{const A=w.current;if(!A||typeof ResizeObserver>"u")return;const I=new ResizeObserver(()=>{S.current&&(A.scrollTop=A.scrollHeight)});return I.observe(A),()=>I.disconnect()},[]);const _=v.useRef(null);if(!r)_.current=null;else if(_.current==null){const A=[...s].reverse().find(O=>Gn(O)==="user"),I=Date.parse(A?.ts??"");_.current=Number.isFinite(I)&&Date.now()-I<6*36e5?Math.min(I,Date.now()):Date.now()}const V=v.useMemo(()=>zT(s,r),[s,r]);return o.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[o.jsx("div",{ref:w,onScroll:A=>{const I=A.currentTarget,O=I.scrollHeight-I.scrollTop-I.clientHeight<80;!O&&Date.now()<L.current||(S.current=O,q(!O))},onWheel:()=>{L.current=0},onTouchStart:()=>{L.current=0},onKeyDown:()=>{L.current=0},className:"min-h-0 flex-1 overflow-y-auto overscroll-contain [overflow-anchor:none] px-3 md:px-4",role:"log","aria-label":"Conversation","aria-live":"off",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[820px] flex-col px-2 py-4",children:[d?.hasOlder?o.jsxs("div",{className:"mb-4 flex flex-col items-center gap-2",children:[o.jsx(Le,{variant:"ghost",disabled:d.loading,onClick:()=>{T()},children:d.loading?"Loading…":"Load older messages"}),d.error?o.jsx("p",{role:"alert",className:"text-xs text-destructive",children:d.error}):null]}):null,u?o.jsx("div",{className:"mb-4",children:o.jsx(jl,{level:"warning",children:"Earlier history of this conversation is no longer available on the host."})}):null,!s.length&&!n.length?o.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:x}):null,V.map(A=>A.type==="footer"?o.jsx(MT,{entries:A.entries,startTs:A.startTs,userKeys:A.userKeys},A.key):o.jsx("div",{"data-entry-key":A.entry.key,className:"flex flex-col",style:A.gap?{marginTop:A.gap}:void 0,children:o.jsx(ET,{entry:A.entry,compactBottom:A.compactBottom})},A.entry.key)),n.map((A,I)=>o.jsx(CT,{prompt:A,gap:I>0?4:b1(V.at(-1)?.type==="entry"?Gn(V.at(-1).entry):null,"user"),onRetry:()=>m(A.id),onDiscard:()=>g(A.id)},A.id)),r?o.jsx("div",{className:"mt-[13px] flex min-h-6 items-center self-start pb-8","data-testid":"working",role:"status","aria-label":`${c} is working`,children:o.jsxs("div",{className:"flex h-6 items-center gap-3 text-foreground",children:[o.jsx(nh,{size:14,className:"-ml-0.5"}),o.jsx(sT,{since:_.current??Date.now(),className:"text-[13px] text-muted-foreground"})]})}):null,y?o.jsx("div",{className:"flex flex-col gap-2 pb-4",children:y}):null]})}),E?o.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:o.jsx("button",{type:"button",onClick:M,"aria-label":"Scroll to bottom",title:"Scroll to bottom","data-testid":"scroll-to-bottom",className:"pointer-events-auto flex size-12 items-center justify-center rounded-full bg-secondary text-foreground shadow-md shadow-black/30 outline-none hover:bg-bubble focus-visible:ring-2 focus-visible:ring-ring",children:o.jsx(An,{"aria-hidden":!0,className:"size-6"})})}):null]})}function RT({onNewSession:s}){const{principal:n,workspace:i,sessions:r}=De(),c=ze(n??void 0,"session.write");return o.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-16",children:o.jsxs("div",{className:"max-w-sm text-center",children:[o.jsx("span",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-xl bg-primary/10 text-highlight",children:o.jsx(Lx,{"aria-hidden":!0,className:"size-6"})}),o.jsx("h2",{className:"text-base font-medium",children:i?"Pick a session or start a new one":"Choose a workspace"}),o.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:i?r.list.length?"Your sessions run on the host and keep their history between visits.":"This workspace has no sessions yet.":"Your access token decides which workspaces you can open."}),i&&c?o.jsxs(Le,{className:"mt-5",onClick:s,children:[o.jsx(Lx,{"aria-hidden":!0})," New session"]}):null]})})}const Fl="inline-flex h-7 min-w-0 shrink items-center gap-1 rounded-2xl px-2 text-sm text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0";function Dr({icon:s,label:n,title:i}){return o.jsxs("span",{title:i,className:Fl,children:[s,o.jsx("span",{className:"truncate",children:n})]})}const LT={"read-only":Yj,"workspace-write":Il,"full-access":Mb},zy=s=>s&<[s]||Il;function v1({mode:s,modes:n,disabled:i,locked:r,onSelect:c}){const u=zy(s),d=n.find(h=>h.id===s)?.label??Ml(s);return n.length<2&&n[0]?.id===s?o.jsx(Dr,{icon:o.jsx(u,{"aria-hidden":!0}),label:d,title:"Permissions"}):o.jsx(hn,{label:"Permissions",title:r?`Permissions: ${d}. They change once the agent and its team are idle.`:`Permissions: ${d}`,align:"start",disabled:i,triggerClassName:Y(Fl,"outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-muted aria-expanded:text-foreground disabled:pointer-events-none disabled:opacity-60"),trigger:o.jsxs(o.Fragment,{children:[o.jsx(u,{"aria-hidden":!0}),o.jsx("span",{className:"truncate","data-testid":"mode-control-label",children:d}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:n.map(h=>{const m=zy(h.id);return{id:h.id,label:h.label??Ml(h.id),icon:o.jsx(m,{"aria-hidden":!0}),checked:h.id===s,onSelect:()=>{h.id!==s&&c(h.id)}}})})}const qd=Y(Fl,"outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-muted aria-expanded:text-foreground disabled:pointer-events-none disabled:opacity-60");function OT({team:s,teamId:n,model:i,thinking:r,runtime:c}){const u=Be(),{catalog:d,busy:h}=De(),m=u.liveConfigure(),{same:g,current:x,others:y}=$2(d.models,{runtime:c,model:i}),w=x?.label??i,k=r?Ds(r):void 0,T=ab(x),S=!!h.configure,E=(R,$)=>R.enabled?$:`${$}. ${R.reason??m.reason??""}`.trim(),q=(R,$,_)=>o.jsx("span",{className:"inline-flex min-w-0",title:R.enabled&&!S?void 0:S?`${$}. Applying the last change…`:E(R,$),children:_});if(!m.shown)return o.jsxs(o.Fragment,{children:[s?o.jsx(Dr,{icon:o.jsx(Al,{"aria-hidden":!0}),label:s,title:`Team: ${s}. ${m.reason}`}):null,w?o.jsx(Dr,{icon:o.jsx(Fd,{"aria-hidden":!0}),label:w,title:`Main agent's model: ${w}. ${m.reason}`}):null,k?o.jsx(Dr,{icon:o.jsx($r,{"aria-hidden":!0}),label:k,title:`Thinking: ${k}. ${m.reason}`}):null]});const L=d.teams.length?d.teams:n?[{id:n,label:s??n}]:[],M=!n||L.some(R=>R.id===n);return o.jsxs(o.Fragment,{children:[s||n?q(m.team,`Team: ${s??n}`,o.jsx(hn,{label:"Team",title:E(m.team,`Team: ${s??n}`),align:"start",disabled:!m.team.enabled||S,testId:"session-team",triggerClassName:qd,trigger:o.jsxs(o.Fragment,{children:[o.jsx(Al,{"aria-hidden":!0}),o.jsx("span",{className:"truncate","data-testid":"team-label",children:s??n}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:[...M?[]:[{id:n,label:s??n,checked:!0,onSelect:()=>{}}],...L.map(R=>({id:R.id,label:R.label,checked:R.id===n,...R.id===n?{}:{title:"Restarts main on the same conversation with this team"},onSelect:()=>{R.id!==n&&u.configureLive({team:R.id})}}))]})):null,w?q(g.length?m.model:{enabled:!1},`Main agent's model: ${w}`,o.jsx(hn,{label:"Model",title:E(m.model,`Main agent's model: ${w}`),align:"start",disabled:!m.model.enabled||S||!g.length,testId:"session-model",triggerClassName:qd,trigger:o.jsxs(o.Fragment,{children:[o.jsx(Fd,{"aria-hidden":!0}),o.jsx("span",{className:"truncate","data-testid":"model-label",children:w}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:[...g.map(R=>({id:R.id,label:R.label,checked:R.id===x?.id,onSelect:()=>{R.id!==x?.id&&u.configureLive({model:R.id})}})),...y?[{id:"other-runtimes",label:"Other runtimes: start a new session",disabled:!0,group:!0,title:"A session keeps its runtime. To use another runtime's model, start a new session with it.",onSelect:()=>{}}]:[]]})):null,k?T.length?q(m.thinking,`Thinking: ${k}`,o.jsx(hn,{label:"Thinking",title:E(m.thinking,`Thinking: ${k}`),align:"start",disabled:!m.thinking.enabled||S,testId:"session-thinking",triggerClassName:qd,trigger:o.jsxs(o.Fragment,{children:[o.jsx($r,{"aria-hidden":!0}),o.jsx("span",{className:"truncate","data-testid":"session-thinking-label",children:k}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:T.map(R=>({id:R.id,label:R.label,checked:R.id===r,onSelect:()=>{R.id!==r&&u.configureLive({thinking:R.id})}}))})):o.jsx(Dr,{icon:o.jsx($r,{"aria-hidden":!0}),label:k,title:`Thinking: ${k}`}):null]})}function DT({sessionId:s}){const n=Be(),{openAgent:i}=vt(),{tree:r,prompts:c,queued:u,busy:d,sessions:h,connection:m,preferences:g,catalog:x,principal:y}=De(),[w,k]=v.useState(null),[T,S]=v.useState(null),[E,q]=v.useState(void 0),L=r?.projection,M=!!r?.older?.hasOlder,R=v.useMemo(()=>L?t2(L,{hasOlder:M}):new Map,[L,M]);if(!r)return null;const $=r.projection,_=r.rootId,V=s,A=h.list.find(xe=>xe.id===_),I=$.sessions[_],O=xe=>$.sessions[xe]?.agent??(xe===_?"main":"agent"),ce=_ in $.running,le=ce||n.rootBusy(_),pe=V in $.running,ie=!!$.closed[_]||!I&&A?.status==="closed",de=Object.values($.questions),B=n.driveBlock(),W=c.filter(xe=>xe.rootId===_),ne=n.fileGate(_);if(r.status==="gone")return o.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:o.jsxs("div",{className:"max-w-sm text-center",role:"alert",children:[o.jsx(Is,{"aria-hidden":!0,className:"mx-auto mb-3 size-8 text-destructive"}),o.jsx("h2",{className:"font-medium",children:"This session is no longer available"}),o.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:r.error?.message??"The host no longer has it, or your access token cannot see it."}),o.jsx(Le,{className:"mt-4",variant:"secondary",onClick:()=>{n.selectSession(null),n.refreshSessions()},children:"Back to sessions"})]})});const me=r.status==="attaching"||r.status==="detached",N=A2($,V),X=I?.teamLabel??A?.teamLabel,P=I?.mode??A?.mode,ee=I?.model??A?.model,oe=ze(y??void 0,"session.write"),re=x.modes.length?x.modes:P?[{id:P}]:[],Z=le||Object.keys($.running).length>0,fe=!!P&&re.length>1&&!d.mode&&!B&&oe&&!Z&&m.phase==="open",ge=()=>{if(!fe)return;const xe=re.findIndex(Ee=>Ee.id===P);n.configureMode(re[(xe+1)%re.length].id)},nt=(V===_?[...N].reverse().find(xe=>xe.item.kind==="todo"):void 0)?.item?.items??[],$e=n.conversationGate(_),ct=V===_&&($e.fork.shown||$e.rewind.shown)?{root:_,fork:$e.fork,rewind:$e.rewind,turns:R,askRewind:xe=>{const Ee=R.get(xe);Ee&&k(Ee)},askFork:xe=>S(xe)}:null,ht=I?.title??A?.title??"Session",ve=de.length?de.map(xe=>o.jsx(G4,{question:xe,busy:!!d[`question:${xe.id}`],blocked:B,onAnswer:Ee=>{n.answerQuestion(xe.id,{text:Ee})},onDecline:()=>{n.answerQuestion(xe.id,{dismiss:!0})}},xe.id)):null;return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.status==="error"?o.jsxs("div",{role:"alert",className:"flex items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:[o.jsx("span",{className:"min-w-0 flex-1",children:r.error?.message??"Could not load this session."}),o.jsxs(Le,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>n.retryAttach(),children:[o.jsx(Pr,{"aria-hidden":!0})," Try again"]})]}):null,me&&!N.length?o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsx($t,{label:m.phase==="open"?"Loading conversation…":"Waiting for the connection…"})}):o.jsx(p1.Provider,{value:ct,children:o.jsx(_T,{entries:N,prompts:V===_?W:[],agentOf:O,running:pe,runningAgent:O(V),historyUnavailable:$.historyUnavailable,older:r.older,onLoadOlder:()=>n.loadOlder(),onRetry:xe=>{n.retryPrompt(xe)},onDiscard:xe=>n.discardPrompt(xe),emptyText:V===_?ie?"Nothing here yet.":"Send a message to start.":"This agent has not written anything yet.",tail:ve})}),o.jsx(hT,{turn:w,onClose:()=>k(null),onDone:xe=>{k(null),xe&&q({id:Date.now(),text:xe})}}),o.jsx(mT,{turnId:T,title:ht,onClose:()=>S(null)}),me&&!N.length&&ve?o.jsx("div",{className:"px-3 pb-3 md:px-4",children:o.jsx("div",{className:"mx-auto flex w-full max-w-[820px] flex-col gap-2 px-2",children:ve})}):null,V===_&&n.isArchived(_)?o.jsx(m4,{sessionId:_}):V===_?o.jsxs(o.Fragment,{children:[ie&&!ce?o.jsx("p",{className:"mx-auto w-full max-w-[820px] px-4 pb-2 text-center text-xs text-muted-foreground",children:"This session is closed on the host. Sending a message reopens it."}):null,o.jsx(t1,{meter:o.jsx(jy,{usage:I?.usage}),images:I?.promptImages===!0&&m.capabilities.includes("prompt.images")&&!!m.promptImageLimits?.maxBytes,imageLimits:m.promptImageLimits,imagesUnavailable:`${O(_)} runs on ${I?.runtime??"a runtime"} here, which takes no images.`,files:!ne,fileLimits:m.attachmentLimits,filesUnavailable:ne??void 0,addText:E,onSend:(xe,Ee,je)=>n.sendPrompt(xe,void 0,Ee,je),onQueue:xe=>n.queuePrompt(xe),onStop:()=>{n.interrupt()},queued:u.filter(xe=>xe.rootId===_),onEditQueued:xe=>n.editQueued(xe),onSendQueued:xe=>{n.sendQueuedNow(xe)},running:le,stopping:!!d.interrupt,blocked:B,disabledReason:m.phase!=="open"?"Reconnecting…":me?"Loading…":void 0,placeholder:`Message ${O(_)}…`,sendBehavior:g.sendBehavior,onCycleMode:fe?ge:void 0,tracks:o.jsx(D4,{worked:nt}),controls:o.jsxs(o.Fragment,{children:[o.jsx(OT,{team:X,teamId:I?.workflow?.mode??A?.workflow?.mode,model:ee,thinking:I?.thinking??A?.thinking,runtime:I?.runtime??A?.runtime}),P?o.jsx(v1,{mode:P,modes:re,locked:Z,disabled:!!d.mode||!!d.configure||!!B||!oe||m.phase!=="open"||Z,onSelect:xe=>{n.configureMode(xe)}}):null]})})]}):o.jsx("div",{className:"px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] md:px-4 md:pb-4",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[820px] items-center gap-3 rounded-2xl border border-dotted border-input bg-card px-3 py-2 text-[15px] leading-[21px] text-muted-foreground md:px-4 md:py-3",children:[o.jsxs("span",{className:"min-w-0 flex-1",children:[O(V)," works on an assignment from main. Talk to main to steer it."]}),o.jsx(jy,{usage:$.sessions[V]?.usage}),o.jsxs(Le,{size:"sm",variant:"secondary",onClick:()=>i(_),children:[o.jsx(Cf,{"aria-hidden":!0})," Main"]})]})})]})}const qT=250,Bd=Y(Fl,"outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-muted aria-expanded:text-foreground disabled:pointer-events-none disabled:opacity-60");function BT(s){const n=Be(),{connection:i}=De(),[r,c]=v.useState({status:"idle"}),[u,d]=v.useState(0),h=s?JSON.stringify(s):"",m=i.phase==="open";v.useEffect(()=>{if(!s)return;const x=n.previewBlock();if(x){c(T=>({...T,status:"blocked",error:x}));return}if(!m)return;const y=new AbortController,w=rb(s);c(T=>({status:"loading",preview:T.preview,base:T.base}));const k=setTimeout(()=>{n.previewSession(s,{signal:y.signal}).then(T=>{y.signal.aborted||c({status:"ready",preview:T,base:w})},T=>{y.signal.aborted||c(S=>({...S,status:"error",error:qe(T).message}))})},qT);return()=>{clearTimeout(k),y.abort()}},[h,m,n,u]);const g=v.useCallback(()=>d(x=>x+1),[]);return{...r,retry:g}}function UT(){const s=Be(),{finishDraft:n}=vt(),{catalog:i,workspace:r,preferences:c,busy:u,connection:d,principal:h}=De(),m=s.fileGate(null),g=c.newSession,[x,y]=v.useState(()=>bx(i,g)),[w,k]=v.useState("");v.useEffect(()=>{i.status==="ready"&&y(bx(i,s.getState().preferences.newSession))},[i,s]);const[T,S]=v.useState(),E=rb({workflow:x.team,model:x.model}),q=T?.base===E?T.preview:void 0,L=ib(i.models,x.model,q),M=L?z2(L,x.thinking):void 0,R={...x,...M?{thinking:M}:{thinking:void 0}},$=r&&i.status!=="loading"?vx(r,R):null,_=BT($);v.useEffect(()=>{_.status==="ready"&&_.preview&&_.base&&S({preview:_.preview,base:_.base})},[_.status,_.preview,_.base]);const V=_.status==="ready"&&_.base===E,A=_.status==="blocked"||_.status==="error",I=!!u.create,ce=ze(h??void 0,"session.write")?void 0:"Your access token can view sessions but not start them.",le=i.teams.length?i.teams:q?.teams??[],pe=wx(le,q),[ie,de]=v.useState(),B=ie?.workspace===r?ie:void 0;v.useEffect(()=>{pe&&de(Ce=>Ce?.workspace===r&&Ce.team?.id===pe.id&&Ce.team.label===pe.label?Ce:{team:pe,workspace:r})},[pe?.id,pe?.label,r]);const W=!!r&&d.phase==="open"&&!!x.team&&!B&&i.status==="ready";v.useEffect(()=>{if(!W||!r||s.previewBlock())return;const Ce=new AbortController;return s.previewSession(vx(r,{}),{signal:Ce.signal}).then(st=>{if(Ce.signal.aborted)return;const ue=wx(i.teams.length?i.teams:st.teams,st);de(Se=>Se?.workspace===r?Se:{workspace:r,...ue?{team:ue}:{}})},()=>{}),()=>Ce.abort()},[W,r,s]);const ne=L2(le,pe??B?.team),me=O2({chosen:x.team,previewTeam:q?.team,previewSettled:A,previewError:_.error,previewBlocked:_.status==="blocked",previewNeedsRead:!ze(h??void 0,"session.read"),teams:le,teamsKnown:i.teamsKnown,teamsUnavailable:i.teamsUnavailable}),N="stuck"in me&&me.stuck?me.wait:void 0,X=()=>{_.retry(),s.retryTeams()},P=i.teamsUnavailable?.reason==="failed",ee=me.team,oe=ee?ee===q?.team&&q.teamLabel||ne.find(Ce=>Ce.id===ee)?.label||ee:"Team",re=me.wait??(!A&&!V?"Checking what would run…":void 0),Z=x.model?i.models.find(Ce=>Ce.id===x.model)?.label??x.model:L?L.label:q?.model||"Default model",fe=ab(L),ge=M?Ds(M):q?.thinking?Ds(q.thinking):L?.effort?Ds(L.effort):"Default",he=`composer-${v.useId()}`,nt=()=>setTimeout(()=>document.getElementById(he)?.focus(),0),$e=Ce=>{y(st=>({...st,...Ce})),nt()},ct=Ce=>{y(st=>({...st,model:Ce||void 0,thinking:g.thinkingByModel?.[Ce||"default"]})),nt()},[ht]=v.useState(()=>s.unsentDraft()),[ve,xe]=v.useState();v.useEffect(()=>{ht&&s.clearUnsentDraft(ht);const Ce=Se=>xe(pt=>({id:(pt?.id??0)+1,text:Se})),st=s.takeUnsentDrafts(Se=>Se.workspace!==s.getState().workspace?!1:(Ce(Se.text),!0)),ue=s.unsentDraft();return ue&&(s.clearUnsentDraft(ue),Ce(ue)),st},[ht,s]);const Ee=v.useRef(!1),je=v.useRef(!0);v.useEffect(()=>(je.current=!0,()=>{je.current=!1}),[]);const Ot=async(Ce,st=[],ue=[])=>{if(!(Ee.current||s.getState().busy.create||re)){Ee.current=!0;try{const Se=await B2(s,{...ee?{team:ee}:{},...R.mode?{mode:R.mode}:{},...R.model?{model:R.model}:{},...R.thinking?{thinking:R.thinking}:{},...w.trim()?{title:w.trim()}:{},...Ce.trim()?{prompt:Ce}:{},...ue.length?{files:ue}:{}},Ce,{mounted:()=>je.current,describe:qe,nameOf:Vt});n(Se)}finally{Ee.current=!1}}},pn=o.jsxs(o.Fragment,{children:[o.jsx(hn,{label:"Team",title:`Team: ${oe}`,align:"start",disabled:I,testId:"new-session-team",triggerClassName:Bd,trigger:o.jsxs(o.Fragment,{children:[o.jsx(Al,{"aria-hidden":!0}),o.jsx("span",{className:"truncate",children:oe}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:[...ne.map(Ce=>({id:Ce.id,label:Ce.label,checked:ee===Ce.id,onSelect:()=>$e({team:Ce.id})}))]}),i.models.length?o.jsx(hn,{label:"Model",title:`Main agent's model: ${Z}`,align:"start",disabled:I,testId:"new-session-model",triggerClassName:Bd,trigger:o.jsxs(o.Fragment,{children:[o.jsx(Fd,{"aria-hidden":!0}),o.jsx("span",{className:"truncate",children:Z}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:[{id:"",label:"Team default",checked:!x.model,onSelect:()=>ct("")},...i.models.map((Ce,st)=>({id:Ce.id,label:Ce.label,checked:x.model===Ce.id,group:st===0,onSelect:()=>ct(Ce.id)}))]}):null,fe.length?o.jsx(hn,{label:"Thinking",title:`Thinking: ${ge}`,align:"start",disabled:I,testId:"new-session-thinking",triggerClassName:Bd,trigger:o.jsxs(o.Fragment,{children:[o.jsx($r,{"aria-hidden":!0}),o.jsx("span",{className:"truncate","data-testid":"thinking-label",children:ge}),o.jsx(An,{"aria-hidden":!0,className:"!size-3 opacity-70"})]}),items:[{id:"",label:L?.effort?`Default (${Ds(L.effort)})`:"Default",checked:!M,onSelect:()=>$e({thinking:void 0})},...fe.map((Ce,st)=>({id:Ce.id,label:Ce.label,checked:M===Ce.id,group:st===0,onSelect:()=>$e({thinking:Ce.id})}))]}):null,x.mode?o.jsx(v1,{mode:x.mode,modes:i.modes,locked:!1,disabled:I,onSelect:Ce=>$e({mode:Ce})}):null]});return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"new-session-screen",children:[o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o.jsxs("div",{className:"mx-auto flex w-full max-w-[820px] flex-col gap-5 px-4 pb-6 pt-10 md:pt-16",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-foreground",children:"New session"}),r?o.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Runs on the host in ",o.jsx("span",{className:"font-mono text-foreground/90",children:Vt(r)}),". Your first message starts it."]}):null]}),i.status==="loading"?o.jsx($t,{label:"Loading teams and models…",className:"text-xs"}):null,i.status==="error"?o.jsx("p",{role:"alert",className:"text-xs text-destructive",children:i.error?.message}):null,o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("label",{htmlFor:"new-title",className:"text-xs font-medium text-muted-foreground",children:"Title (optional)"}),o.jsx(Ti,{id:"new-title",value:w,onChange:Ce=>k(Ce.target.value),maxLength:200,disabled:I,placeholder:"Named after your first message when empty",className:"bg-transparent"})]}),o.jsx($T,{state:_,models:i.models,onRetry:X,retryWhenBlocked:P}),N?o.jsxs("p",{role:"alert","data-testid":"new-session-stuck",className:"flex items-start gap-2 text-xs text-destructive",children:[o.jsx(Is,{"aria-hidden":!0,className:"mt-0.5 size-3.5 shrink-0"}),N]}):null]})}),o.jsx(t1,{onSend:Ot,onQueue:()=>{},onStop:()=>{},queued:[],onEditQueued:()=>null,onSendQueued:()=>{},running:!1,stopping:!1,blocked:ce,disabledReason:d.phase!=="open"?"Reconnecting…":I?"Starting…":r?i.status==="loading"?"Loading…":void 0:"Choose a workspace first.",startHold:re,placeholder:"What should main work on?",startLabel:"Start session",initialText:ht,addText:ve,autoFocus:!0,inputId:he,controls:pn,files:!m,fileLimits:d.attachmentLimits,filesUnavailable:m??void 0})]})}function $T({state:s,models:n,onRetry:i,retryWhenBlocked:r}){const c=s.preview?R2(s.preview,n):[];return o.jsxs("section",{"aria-label":"Session preview","data-testid":"session-preview","aria-busy":s.status==="loading",className:"overflow-hidden rounded-lg border border-border bg-card",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-2.5",children:[o.jsx("h3",{className:"text-xs font-normal text-muted-foreground",children:"This session will run"}),s.status==="loading"?o.jsx($t,{label:"Checking…",className:"text-xs"}):null]}),s.status==="blocked"?o.jsxs("div",{className:"flex items-start justify-between gap-3 px-4 py-3",children:[o.jsxs("p",{role:"note",className:"text-xs text-muted-foreground",children:["Preview not available: ",s.error]}),r?o.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-md px-2 py-0.5 text-xs text-foreground outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",children:"Retry"}):null]}):null,s.status==="error"?o.jsxs("div",{className:"flex items-start justify-between gap-3 px-4 py-3",children:[o.jsxs("p",{role:"alert",className:"flex items-start gap-2 text-xs text-destructive",children:[o.jsx(Is,{"aria-hidden":!0,className:"mt-0.5 size-3.5 shrink-0"}),s.error]}),o.jsx("button",{type:"button",onClick:i,className:"shrink-0 rounded-md px-2 py-0.5 text-xs text-foreground outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring",children:"Retry"})]}):null,c.length?o.jsx("dl",{className:Y("grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 px-4 py-3 text-sm",s.status!=="ready"&&"opacity-60"),children:c.map(u=>o.jsxs(v.Fragment,{children:[o.jsx("dt",{className:"text-muted-foreground",children:u.label}),o.jsx("dd",{className:"min-w-0 truncate text-foreground","data-testid":`preview-${u.key}`,children:u.value})]},u.key))}):s.status==="idle"||s.status==="loading"&&!s.preview?o.jsx("p",{className:"px-4 py-3 text-xs text-muted-foreground",children:"Asking the host…"}):null]})}const HT={open:"Open",in_progress:"In progress",review:"In review",closed:"Closed"},GT={open:"text-muted-foreground",in_progress:"text-dot-running",review:"text-dot-warning",closed:"text-highlight"};function cs({label:s,children:n}){return o.jsxs(o.Fragment,{children:[o.jsx("dt",{className:"text-muted-foreground",children:s}),o.jsx("dd",{className:"min-w-0 break-words",children:n})]})}function w1({id:s,onOpenTask:n}){const i=Be(),{openTask:r}=vt(),c=n??r,{tasks:u,principal:d}=De(),h=u.rows.find(y=>y.id===s),m=ze(d??void 0,"project.write"),g=i.tasksBlock();if(v.useEffect(()=>(i.setTasksVisible(!0),()=>i.setTasksVisible(!1)),[i]),g)return o.jsxs("p",{className:"m-auto flex max-w-sm items-start gap-2 px-6 text-sm text-muted-foreground",children:[o.jsx(Na,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0"}),g]});if(!h)return o.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:u.status==="loading"||u.status==="idle"?o.jsx($t,{label:"Loading the task…"}):o.jsxs("p",{className:"max-w-sm text-center text-sm text-muted-foreground",role:"status",children:["Task ",s," is no longer in this workspace's list."]})});const x=!!u.busy[h.id];return o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"task-detail",children:o.jsxs("article",{className:"mx-auto w-full max-w-[820px] px-4 py-6 sm:px-6",children:[o.jsxs("p",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[o.jsx("span",{className:"font-mono",children:h.id}),h.type?o.jsxs("span",{children:["· ",h.type]}):null,o.jsxs("span",{children:["· P",h.priority]}),o.jsxs("span",{className:Y("inline-flex items-center gap-1",GT[h.status]),children:[o.jsx(gb,{"aria-hidden":!0,className:"size-3"}),HT[h.status]??h.status]}),h.status!=="closed"&&h.ready?o.jsx("span",{className:"text-info",children:"· ready"}):null]}),o.jsx("h2",{className:Y("text-xl font-normal leading-snug",h.status==="closed"&&"text-muted-foreground"),children:h.title}),u.message?.level==="error"?o.jsx("p",{role:u.message.level==="error"?"alert":"status",className:Y("mt-4 rounded-md px-3 py-2 text-xs",u.message.level==="error"?"bg-destructive/10 text-destructive":"bg-primary/10 text-highlight"),children:u.message.text}):null,h.approvals?.map(y=>o.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-xl border border-warning/40 bg-warning/[0.06] px-4 py-3 text-sm",children:[o.jsx(Il,{"aria-hidden":!0,className:"size-4 shrink-0 text-warning"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"text-warning",children:"Needs your approval"}),y.note?o.jsxs("span",{className:"text-muted-foreground",children:[": ",y.note]}):null]}),m?o.jsx(Le,{size:"sm",disabled:x,onClick:()=>{i.changeTask(h,{gate:y.gate})},children:"Approve"}):null]},y.gate)),o.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[m?h.status==="closed"?o.jsxs(Le,{size:"sm",variant:"secondary",disabled:x,onClick:()=>{i.changeTask(h,{action:"reopen"})},children:[o.jsx(Pr,{"aria-hidden":!0})," Reopen"]}):o.jsxs(Le,{size:"sm",variant:"secondary",disabled:x,onClick:()=>{i.changeTask(h,{action:"close"})},children:[o.jsx(Hl,{"aria-hidden":!0})," Close task"]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Your access token can read tasks but not change them."}),x?o.jsx($t,{label:"Saving…",className:"text-xs"}):null]}),h.description?o.jsx("section",{"aria-label":"Description",className:"mt-6 text-[15px] leading-[1.5]",children:o.jsx(Wl,{text:h.description})}):o.jsx("p",{className:"mt-6 text-sm text-muted-foreground",children:"No description."}),h.handoff?o.jsxs("section",{"aria-label":"Handoff",className:"mt-6 rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("p",{className:"mb-1 text-xs text-muted-foreground",children:["Handoff · ",h.handoff.outcome,h.handoff.agent?` · ${h.handoff.agent}`:""]}),o.jsx("p",{className:"whitespace-pre-wrap text-sm",children:h.handoff.summary})]}):null,h.closed?o.jsxs("section",{"aria-label":"Closed",className:"mt-4 rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("p",{className:"mb-1 text-xs text-muted-foreground",children:["Closed ",ja(h.closed.at)," · ",h.closed.reason]}),h.closed.summary?o.jsx("p",{className:"whitespace-pre-wrap text-sm",children:h.closed.summary}):null]}):null,o.jsxs("dl",{className:"mt-6 grid grid-cols-[8rem_1fr] gap-x-4 gap-y-2 border-t border-border pt-4 text-sm",children:[h.assignee?o.jsx(cs,{label:"Assignee",children:h.assignee}):null,h.progress?o.jsxs(cs,{label:"Progress",children:[h.progress.done," of ",h.progress.total," done"]}):null,h.parent?o.jsx(cs,{label:"Parent",children:o.jsx("button",{type:"button",className:"font-mono text-highlight hover:underline",onClick:()=>c(h.parent),children:h.parent})}):null,h.blockedBy?.length?o.jsx(cs,{label:"Blocked by",children:h.blockedBy.map((y,w)=>o.jsxs(v.Fragment,{children:[w?", ":"",o.jsx("button",{type:"button",className:"font-mono text-highlight hover:underline",onClick:()=>c(y),children:y})]},y))}):null,h.waits?.length?o.jsx(cs,{label:"Waits on",children:h.waits.join("; ")}):null,h.labels?.length?o.jsx(cs,{label:"Labels",children:o.jsx("span",{className:"flex flex-wrap gap-1",children:h.labels.map(y=>o.jsx("span",{className:"rounded-full bg-secondary px-2 py-0.5 text-xs",children:y},y))})}):null,h.paths?.length?o.jsx(cs,{label:"Paths",children:o.jsx("span",{className:"space-y-0.5",children:h.paths.map(y=>o.jsx("span",{className:"block font-mono text-xs",children:y},y))})}):null,h.createdAt?o.jsx(cs,{label:"Created",children:ja(h.createdAt)}):null,o.jsx(cs,{label:"Updated",children:ja(h.updatedAt)})]})]})})}const Rr=20,IT=200*1024,YT=s=>s instanceof xi?s.failure:{message:s instanceof Error?s.message:"Something went wrong.",sent:"unknown",terminal:!1};function VT({path:s}){const n=Be(),{fileTarget:i}=vt(),r=i(s),[c,u]=v.useState({status:"loading"}),[d,h]=v.useState(!1),[m,g]=v.useState(()=>r?.line?"source":"preview"),[x,y]=v.useState(!1),[w,k]=v.useState(0),T=v.useRef(null);v.useEffect(()=>{let $=!0;return u(_=>_.status==="ready"?_:{status:"loading"}),n.readWorkspaceFile({path:s,includeIgnored:d}).then(_=>{$&&u({status:"ready",content:_.content,size:_.size,..._.modifiedAt?{modifiedAt:_.modifiedAt}:{}})},_=>{$&&u({status:"error",failure:YT(_)})}),()=>{$=!1}},[n,s,d,w]),v.useEffect(()=>{r?.line&&g("source")},[r?.nonce,r?.line]);const S=Nk(s)&&(c.status!=="ready"||c.size<=IT),E=!S||m==="source",q=c.status==="ready";v.useEffect(()=>{!q||!E||!r?.line||!T.current||(T.current.scrollTop=Math.max(0,(r.line-1)*Rr-3*Rr))},[q,E,r?.line,r?.nonce]);const L=()=>{navigator.clipboard?.writeText(s).then(()=>{y(!0),setTimeout(()=>y(!1),1500)},()=>n.notify("error",`Could not copy ${s}.`))},M=()=>k($=>$+1),R=c.status==="ready"?Sk(c.content):0;return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"file-view","data-path":s,children:[o.jsxs("div",{className:"flex min-h-11 shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border px-4 py-1.5 text-xs text-muted-foreground",children:[o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-foreground",title:s,"data-testid":"file-view-path",children:s}),c.status==="ready"?o.jsxs("span",{"data-testid":"file-view-meta",children:[jk(c.size)," · ",R," ",R===1?"line":"lines"]}):null,S&&c.status==="ready"?o.jsxs("span",{className:"flex rounded-md border border-border p-0.5",role:"group","aria-label":"View",children:[o.jsxs("button",{type:"button","aria-pressed":m==="preview",onClick:()=>g("preview"),className:Y("flex items-center gap-1 rounded px-2 py-0.5",m==="preview"?"bg-secondary text-foreground":"hover:text-foreground"),children:[o.jsx(Zr,{"aria-hidden":!0,className:"size-3.5"}),"Preview"]}),o.jsxs("button",{type:"button","aria-pressed":m==="source",onClick:()=>g("source"),className:Y("flex items-center gap-1 rounded px-2 py-0.5",m==="source"?"bg-secondary text-foreground":"hover:text-foreground"),children:[o.jsx(Sj,{"aria-hidden":!0,className:"size-3.5"}),"Source"]})]}):null,o.jsx(Le,{size:"icon-sm",variant:"ghost",onClick:L,"aria-label":"Copy path",title:x?"Copied":"Copy path","data-testid":"file-view-copy-path",children:o.jsx(qs,{"aria-hidden":!0})}),o.jsx(Le,{size:"icon-sm",variant:"ghost",onClick:M,"aria-label":"Refresh",title:"Refresh","data-testid":"file-view-refresh",children:o.jsx(Ca,{"aria-hidden":!0})})]}),c.status==="loading"?o.jsx("div",{className:"flex flex-1 items-center justify-center","data-testid":"file-view-loading",children:o.jsx($t,{label:"Reading the file…"})}):c.status==="error"?o.jsx(KT,{failure:c.failure,onRetry:M,onShowIgnored:()=>h(!0)}):E?o.jsx("div",{ref:T,className:"relative min-h-0 flex-1 overflow-auto","data-testid":"file-view-source",children:o.jsxs("div",{className:"relative flex min-w-max font-mono text-[12px]",style:{lineHeight:`${Rr}px`},children:[r?.line&&r.line<=R?o.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bg-highlight/10",style:{top:8+(r.line-1)*Rr,height:Rr},"data-testid":"file-view-target-line"}):null,o.jsx("pre",{"aria-hidden":!0,className:"sticky left-0 z-[1] select-none border-r border-border bg-background py-2 pl-3 pr-3 text-right text-extra-muted","data-testid":"file-view-gutter",children:Array.from({length:Math.max(R,1)},($,_)=>_+1).join(`
|
|
51
|
-
`)}),o.jsx("pre",{className:"relative py-2 pl-4 pr-6 text-foreground","data-testid":"file-view-content",children:c.content})]})}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"file-view-preview",children:o.jsx("article",{className:"mx-auto w-full max-w-[820px] px-4 py-6 sm:px-6",children:o.jsx(Wl,{text:c.content})})})]})}function KT({failure:s,onRetry:n,onShowIgnored:i}){const r=s.reason==="binary"||s.reason==="too_large"||s.reason==="blocked_path"||s.reason==="grant"||s.reason==="capability";return o.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center","data-testid":"file-view-error","data-reason":s.reason??"",children:[o.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",role:r?"note":"alert",children:s.message}),s.reason==="too_large"?o.jsx("p",{className:"text-xs text-extra-muted",children:"Files over 1 MB are not read remotely."}):null,s.reason==="ignored"?o.jsx(Le,{size:"sm",variant:"secondary",onClick:i,"data-testid":"file-view-show-ignored",children:"Show anyway"}):r?null:o.jsx(Le,{size:"sm",variant:"outline",onClick:n,"data-testid":"file-view-retry",children:"Retry"})]})}const ih="outline-none focus-visible:ring-2 focus-visible:ring-ring",Ud=Y("flex size-8 shrink-0 items-center justify-center rounded-lg text-extra-muted hover:bg-secondary hover:text-foreground [&_svg]:size-[18px]",ih);function XT({navOpen:s,onToggleNav:n,explorerOpen:i,onToggleExplorer:r,onRename:c,onArchive:u}){const{tree:d,sessions:h,workspace:m,connection:g,principal:x}=De(),y=d?.rootId,w=y?d.projection.sessions[y]:void 0,k=y?h.list.find(M=>M.id===y):void 0,T=y?In({id:y,title:w?.title??k?.title}):m?Vt(m):"ALP",S=!!y&&y in d.projection.running,E=!!y&&!!d.projection.closed[y],q=ze(x??void 0,"session.write"),L=k??(y?{id:y,title:w?.title}:void 0);return o.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between gap-2 border-b border-border bg-background px-2 md:h-9 md:px-3",children:[o.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 md:gap-2",children:[o.jsx("button",{type:"button","aria-label":s?"Close sessions":"Open sessions","aria-expanded":s,title:"Toggle sidebar",onClick:n,className:Y(Ud,"md:-ml-1.5"),children:o.jsx(Wr,{"aria-hidden":!0,strokeWidth:1.5})}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col md:flex-none md:flex-row md:items-center md:gap-2",children:[o.jsx("h1",{className:"min-w-0 truncate text-sm font-normal text-foreground md:font-light",title:T,"data-testid":"workspace-header-title",children:T}),y&&m?o.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground md:text-sm",title:m,children:Vt(m)}):null]}),y&&L?o.jsx(hn,{label:"Session actions",align:"start",trigger:o.jsx(vb,{"aria-hidden":!0,className:"size-[18px]"}),triggerClassName:Ud,items:[{label:"Rename",icon:o.jsx(Ea,{"aria-hidden":!0}),onSelect:()=>c(L),disabled:!q},{label:"Copy session ID",icon:o.jsx(qs,{"aria-hidden":!0}),onSelect:()=>{navigator.clipboard?.writeText(y)}},{label:"Archive",icon:o.jsx($l,{"aria-hidden":!0}),onSelect:()=>u(L),disabled:!q,destructive:!0}]}):null,o.jsx("span",{className:"sr-only","aria-live":"polite",children:g.phase!=="open"?"Reconnecting":y?S?"Agent is working":E?"Session closed":"Agent is idle":""})]}),o.jsx("div",{className:"flex shrink-0 items-center gap-1 md:gap-2",children:o.jsx("button",{type:"button","aria-label":"Agents and tasks","aria-expanded":i,title:"Toggle explorer",onClick:r,className:Y(Ud,"md:-mr-1.5"),"data-testid":"workspace-explorer-toggle",children:o.jsx(Ab,{"aria-hidden":!0,strokeWidth:1.5})})})]})}function QT(s){const{tree:n,tasks:i,sessions:r}=De();if(s.kind==="agent"){const u=n?.projection,d=u?.sessions[s.id],h=s.id===n?.rootId,m=!!u&&Object.values(u.questions).some(k=>k.sessionId===s.id),g=!!u&&s.id in u.running,x=h?r.list.find(k=>k.id===s.id):void 0,y=d?.agent??(h?"main":"agent"),w=h?In({id:s.id,title:d?.title??x?.title}):d?.title??y;return{label:w,icon:m?o.jsxs("span",{className:"relative flex size-3.5","data-status":"needs_input",children:[o.jsx(Sa,{"aria-hidden":!0,className:"size-3.5"}),o.jsx(Is,{"aria-hidden":!0,className:"absolute -bottom-0.5 -right-0.5 size-2 fill-dot-warning text-background"})]}):g?o.jsx(b0,{}):o.jsx(Sa,{"aria-hidden":!0,className:"size-3.5"}),title:h?`${w} · ${y}`:`${y} · assignment from main`}}if(s.kind==="draft")return{label:"New session",icon:o.jsx(Yl,{"aria-hidden":!0,className:"size-3.5"}),title:"New session"};if(s.kind==="launcher")return{label:"New tab",icon:o.jsx(fs,{"aria-hidden":!0,className:"size-3.5"}),title:"New tab"};if(s.kind==="file")return{label:Vt(s.id),icon:o.jsx(_f,{"aria-hidden":!0,className:"size-3.5"}),title:s.id};if(s.kind==="panel"){const u=Gs[s.id];return{label:u.label,icon:o.jsx(u.icon,{"aria-hidden":!0,className:"size-3.5"}),title:u.label}}const c=i.rows.find(u=>u.id===s.id);return{label:c?.title??s.id,icon:c?.approvals?.length?o.jsx(Mb,{"aria-hidden":!0,className:"size-3.5 text-dot-warning"}):c?.status==="closed"?o.jsx(gb,{"aria-hidden":!0,className:"size-3.5 text-highlight"}):o.jsx(Si,{"aria-hidden":!0,className:"size-3.5"}),title:`Task ${s.id}`}}function ZT({tab:s,active:n,onSelect:i,onClose:r,onMenu:c,dragging:u,wrapper:d}){const h=QT(s);return o.jsx(e1,{label:h.label,icon:h.icon,title:h.title,active:n,onSelect:i,onClose:r,onMenu:c,dragging:u,wrapper:d,testId:"workspace-tab","data-tab":Oe(s)})}function WT(s,n,i=!1){const{tabs:r,byPane:c,close:u,closeOthers:d}=vt(),{selected:h,sessions:m,tree:g,principal:x}=De(),y=Be(),w=ze(x??void 0,"session.write"),k=i?r:c[s]??[],T=i?r:void 0;return S=>{const E=`workspace-tab-context-${Oe(S)}`,q=_=>Pf(k,S,_,h).length===0,L=[],M=_=>{navigator.clipboard?.writeText(_).catch(()=>{})},R=S.kind==="agent"?y.agentControls(S.id):void 0;if(S.kind==="agent"&&R?.resume.shown&&L.push({id:"copy-resume-command",label:"Copy resume command",icon:o.jsx(qs,{"aria-hidden":!0}),disabled:!R.resume.enabled,title:R.resume.reason,testId:`${E}-copy-resume-command`,onSelect:()=>{y.copyResumeCommand(S.id,_=>navigator.clipboard?navigator.clipboard.writeText(_):Promise.reject(new Error("The browser gives no clipboard here.")))}}),S.kind==="agent"){if(L.push({id:"copy-agent-id",label:"Copy agent id",icon:o.jsx(qs,{"aria-hidden":!0}),hint:S.id.slice(0,7),testId:`${E}-copy-agent-id`,onSelect:()=>M(S.id)}),S.id===h){const V=m.list.find(A=>A.id===S.id)??{id:S.id,title:g?.projection.sessions[S.id]?.title};L.push({id:"rename",label:"Rename",icon:o.jsx(Ea,{"aria-hidden":!0}),disabled:!w,testId:`${E}-rename`,onSelect:()=>n(V)})}}else S.kind==="file"?L.push({id:"copy-path",label:"Copy path",icon:o.jsx(qs,{"aria-hidden":!0}),testId:`${E}-copy-path`,onSelect:()=>M(S.id)}):S.kind==="task"&&L.push({id:"copy-task-id",label:"Copy task id",icon:o.jsx(qs,{"aria-hidden":!0}),hint:S.id,testId:`${E}-copy-task-id`,onSelect:()=>M(S.id)});const $=[{id:"close-left",label:"Close to the left",icon:o.jsx(hb,{"aria-hidden":!0}),disabled:q("left"),testId:`${E}-close-left`,onSelect:()=>d(S,"left",T)},{id:"close-right",label:"Close to the right",icon:o.jsx(mb,{"aria-hidden":!0}),disabled:q("right"),testId:`${E}-close-right`,onSelect:()=>d(S,"right",T)},{id:"close-others",label:"Close other tabs",icon:o.jsx(bb,{"aria-hidden":!0}),disabled:q("others"),testId:`${E}-close-others`,onSelect:()=>d(S,"others",T)},...R?.reload.shown?[{id:"reload-agent",label:"Reload agent",icon:o.jsx(Hj,{"aria-hidden":!0}),disabled:!R.reload.enabled,title:R.reload.reason??Fk,testId:`${E}-reload-agent`,onSelect:()=>{y.reloadAgent({sessionId:S.id,requestId:Sf()}).catch(()=>{})}}]:[],{id:"close",label:"Close",icon:o.jsx(Zt,{"aria-hidden":!0}),testId:`${E}-close`,onSelect:()=>u(S)}];return L.some(_=>_.id==="rename")&&($[0]={...$[0],group:!0}),[...L,...$]}}const PT=5,Jl=v.createContext({target:null,setTarget:()=>{},splits:!1}),_y=(s,n,i)=>Array.from(s?.querySelectorAll("[data-drag-tab]")??[]).filter(r=>r.dataset.dragTab!==n).filter(r=>{const c=r.getBoundingClientRect();return c.left+c.width/2<i}).length;function FT(s,n=!1){const{tabs:i,byPane:r,move:c,moveTabToPane:u,splitWith:d}=vt(),h=v.useContext(Jl),m=n?i:r[s]??[],g=v.useRef(null),[x,y]=v.useState(null),w=v.useRef(!1),k=E=>q=>{if(q.button!==0||q.target.closest('[aria-label^="Close "]'))return;const L=Oe(E),M=q.clientX,R=q.clientY,$=m.map(Oe);let _=!1,V=$.indexOf(L),A=null;w.current=!1;const I=(ie,de)=>ie===de||!!ie&&!!de&&ie.pane===de.pane&&ie.kind===de.kind&&(ie.kind==="row"?ie.index===de.index:ie.position===de.position),O=ie=>{if(!_&&Math.hypot(ie.clientX-M,ie.clientY-R)<PT)return;_=!0;const de=A;A=null;const B=h.splits?document.elementFromPoint(ie.clientX,ie.clientY):null,W=B?.closest("[data-pane-row]"),ne=B?.closest("[data-pane-body]");if(W&&W.dataset.paneRow!==s)A={pane:W.dataset.paneRow,kind:"row",index:_y(W,L,ie.clientX)};else if(ne&&!W){const me=ne.getBoundingClientRect(),N=l3({width:me.width,height:me.height,x:ie.clientX-me.left,y:ie.clientY-me.top}),X=ne.dataset.paneBody;(X!==s||N!=="center"&&$.length>1)&&(A={pane:X,kind:"zone",position:N})}if(I(de,A)||h.setTarget(A),A){y(null);return}if(ne&&!W){V=-1,y(me=>me&&null);return}V=_y(g.current,L,ie.clientX),y({key:L,order:uf($,L,V)})},ce=ie=>()=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",pe),_){w.current=!0,setTimeout(()=>{w.current=!1},0);const de=A;ie&&de?.kind==="row"?u(E,de.pane,de.index):ie&&de?.kind==="zone"?de.position==="center"?u(E,de.pane):d(E,de.pane,de.position):ie&&V>=0&&c(E,V,n)}h.setTarget(null),y(null)},le=ce(!0),pe=ce(!1);window.addEventListener("pointermove",O),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",pe)},T=E=>{w.current&&(w.current=!1,E.stopPropagation(),E.preventDefault())},S=x?$0(m,Oe,x.order):m;return{row:g,shown:S,dragging:x?.key??null,wrapper:E=>({onPointerDown:k(E),onClickCapture:T,"data-drag-tab":Oe(E)})}}const k1=["terminal","diff"],j1=["tasks","agents"],Ry=Y("flex size-7 shrink-0 items-center justify-center rounded-md text-extra-muted hover:bg-card hover:text-foreground [&_svg]:size-3.5",ih);function JT({paneId:s=Qr,whole:n=!1,onNewSession:i,onRename:r,menuRequest:c,onMenuRequestHandled:u}){const{activeOf:d,activate:h,close:m,openPanel:g,focusedPane:x,panes:y,splitEmpty:w,canSplitEmpty:k,maximized:T,toggleMaximized:S}=vt(),E=FT(s,n),q=v.useContext(Jl),L=WT(s,r,n),[M,R]=v.useState(null),$=v.useCallback(()=>R(null),[]),_=v.useCallback(()=>E.row.current?.querySelector('[role="tab"][aria-selected="true"]'),[E.row]),{workspace:V,principal:A,connection:I}=De(),O=ze(A??void 0,"session.write");if(!V)return null;const ce=d(s),le=s===x,pe=Ut(y.root).length>1,ie=Fr(),de=(W,ne=!1)=>{const me=Gs[W];return{label:me.label,icon:o.jsx(me.icon,{"aria-hidden":!0}),onSelect:()=>g(W),group:ne}},B=q.target?.kind==="row"&&q.target.pane===s;return o.jsxs("div",{className:Y("flex h-9 shrink-0 items-center border-b border-border bg-background",B&&"bg-secondary/60"),"data-pane-row":s,children:[o.jsxs("div",{ref:E.row,role:"tablist","aria-label":"Open tabs",className:"flex min-w-0 flex-1 items-center overflow-x-auto px-1 [scrollbar-width:none]",children:[E.shown.map(W=>o.jsx(ZT,{tab:W,active:!!ce&&Oe(ce)===Oe(W),onSelect:()=>h(W),onClose:()=>m(W),onMenu:ne=>R({tab:W,at:ne}),dragging:E.dragging===Oe(W),wrapper:E.wrapper(W)},Oe(W))),o.jsx(hn,{label:"New tab",align:"start",openRequest:le?c:void 0,onOpenRequestHandled:u,testId:"workspace-new-tab",trigger:o.jsx(fs,{"aria-hidden":!0,className:"size-4"}),triggerClassName:Y("mx-1 flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-card hover:text-foreground",ih),items:[{label:"Agent",icon:o.jsx(Yl,{"aria-hidden":!0}),onSelect:i,disabled:!O||I.phase!=="open"},...k1.map(W=>de(W)),...j1.map((W,ne)=>de(W,ne===0))]})]}),q.splits?o.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 pr-1",children:[pe?o.jsx("button",{type:"button",className:Ry,"aria-pressed":T===s,onClick:()=>S(s),"aria-label":T===s?"Restore pane":"Maximize pane",title:T===s?"Restore pane":"Maximize pane","data-testid":T===s?"workspace-restore-pane":"workspace-maximize-pane",children:T===s?o.jsx(Oj,{"aria-hidden":!0}):o.jsx(Rj,{"aria-hidden":!0})}):null,o.jsx(hn,{label:"More actions",testId:"workspace-split-pane-menu",trigger:o.jsx(vb,{"aria-hidden":!0,className:"size-3.5"}),triggerClassName:Ry,items:[{id:"split-right",label:"Split pane right",icon:o.jsx(yb,{"aria-hidden":!0}),hint:nf("pane.split.right",ie)||void 0,disabled:!k,testId:"workspace-split-pane-right",onSelect:()=>w("right")},{id:"split-down",label:"Split pane down",icon:o.jsx(Eb,{"aria-hidden":!0}),hint:nf("pane.split.down",ie)||void 0,disabled:!k,testId:"workspace-split-pane-down",onSelect:()=>w("bottom")}]})]}):null,o.jsx(bN,{label:"Tab actions",at:M?.at??null,items:M?L(M.tab):[],onClose:$,fallbackFocus:_,testId:M?`workspace-tab-context-${Oe(M.tab)}`:void 0})]})}function e5({paneId:s=Qr,onNewSession:n}){const{activeOf:i}=vt(),{tree:r,workspace:c}=De(),u=i(s);return u?.kind==="draft"?o.jsx(UT,{}):u?.kind==="launcher"?o.jsx(t5,{launcher:u.id},u.id):u?.kind==="task"?o.jsx(w1,{id:u.id}):u?.kind==="file"?o.jsx(VT,{path:u.id},`${c??""}
|
|
52
|
-
${u.id}`):u?.kind==="panel"?o.jsx("div",{className:Y("min-h-0 flex-1",u.id==="terminal"?"overflow-hidden":"overflow-y-auto"),children:o.jsx(J0,{kind:u.id})}):u?.kind==="agent"&&r?o.jsx(DT,{sessionId:u.id},u.id):o.jsx(RT,{onNewSession:n})}function t5({launcher:s}){const{launch:n,openPanel:i,openDraft:r}=vt(),{principal:c,connection:u}=De(),d=ze(c??void 0,"session.write"),h=v.useRef(null),m=v.useContext(th).focused;v.useEffect(()=>{m&&h.current?.focus({preventScroll:!0})},[]);const g=k=>{const T=k.key==="ArrowDown"?1:k.key==="ArrowUp"?-1:0;if(!T)return;k.preventDefault();const S=Array.from(k.currentTarget.querySelectorAll("button:not(:disabled)")),E=S.indexOf(document.activeElement);S[(E+T+S.length)%S.length]?.focus()},x="flex min-h-11 items-center gap-2 rounded-lg border border-transparent bg-card px-3 text-left text-sm text-foreground outline-none hover:bg-secondary focus-visible:border-ring disabled:pointer-events-none disabled:opacity-50",y=[[{id:"agent",label:"Agent",icon:o.jsx(Yl,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),disabled:!d||u.phase!=="open",run:r},...k1.map(k=>{const T=Gs[k];return{id:k,label:T.label,icon:o.jsx(T.icon,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),run:()=>i(k)}})],j1.map(k=>{const T=Gs[k];return{id:k,label:T.label,icon:o.jsx(T.icon,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),run:()=>i(k)}})];let w=-1;return o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto p-6","data-testid":"workspace-pane-new-tab-panel",children:o.jsx("div",{className:"flex w-full max-w-[380px] flex-col gap-12",onKeyDown:g,children:y.map((k,T)=>o.jsx("div",{className:"flex flex-col gap-1",children:k.map(S=>(w+=1,o.jsxs("button",{ref:w===0?h:void 0,type:"button",disabled:S.disabled,className:x,"data-testid":`workspace-pane-new-tab-${S.id}`,onClick:()=>n(s,S.run),children:[S.icon,o.jsx("span",{className:"min-w-0 flex-1 truncate",children:S.label})]},S.id)))},T))})})}function n5({position:s}){const n={center:"inset-2",left:"inset-y-0 left-0 w-1/2",right:"inset-y-0 right-0 w-1/2",top:"inset-x-0 top-0 h-1/2",bottom:"inset-x-0 bottom-0 h-1/2"}[s];return o.jsx("div",{"aria-hidden":!0,"data-testid":"workspace-drop-zone","data-position":s,className:Y("pointer-events-none absolute z-40 rounded-md border-2 border-highlight bg-highlight/20",n)})}function S1({id:s,props:n,whole:i=!1}){const{focusedPane:r,focusPane:c,panes:u}=vt(),d=v.useContext(Jl),h=s===r,m=Ut(u.root).length>1,g=v.useMemo(()=>({id:s,focused:h}),[s,h]),x=d.target?.kind==="zone"&&d.target.pane===s?d.target.position:null,y=w=>{!h&&!w.target.closest?.('[role="menu"]')&&c(s)};return o.jsx(th.Provider,{value:g,children:o.jsxs("section",{"aria-label":m?`Pane${h?" (focused)":""}`:void 0,"data-testid":`workspace-pane-${s}`,"data-focused":h?"true":"false",onPointerDownCapture:y,onFocusCapture:y,className:Y("relative flex min-h-0 min-w-0 flex-1 flex-col bg-background",m&&!h&&"[&_[role=tab][aria-selected=true]]:text-muted-foreground"),children:[o.jsx(JT,{paneId:s,whole:i,...n}),o.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col","data-pane-body":s,children:[o.jsx(e5,{paneId:s,onNewSession:n.onNewSession}),x?o.jsx(n5,{position:x}):null]})]})})}function s5({group:s,index:n,container:i,onPreview:r}){const{resize:c}=vt(),[u,d]=v.useState(!1),h=s.direction==="horizontal",m=(s.sizes[n]??0)+(s.sizes[n+1]??0),g=s.sizes.slice(0,n).reduce((T,S)=>T+S,0),x=T=>{const S=Or,E=Math.min(m-S,Math.max(S,T)),q=s.sizes.slice();return q[n]=E,q[n+1]=m-E,q},y=T=>c(s.id,x(T)),w=T=>{if(T.button!==0||!i.current)return;T.preventDefault();const S=T.currentTarget,E=i.current.getBoundingClientRect();S.setPointerCapture(T.pointerId),d(!0);let q=null;const L=R=>{const $=h?(R.clientX-E.left)/E.width:(R.clientY-E.top)/E.height;q=x($-g),r(q)},M=()=>{S.removeEventListener("pointermove",L),S.removeEventListener("pointerup",M),S.removeEventListener("pointercancel",M),S.removeEventListener("lostpointercapture",M),d(!1),q&&c(s.id,q),r(null)};S.addEventListener("pointermove",L),S.addEventListener("pointerup",M),S.addEventListener("pointercancel",M),S.addEventListener("lostpointercapture",M)},k=T=>{const S=T.shiftKey?.1:.02,E=h?"ArrowLeft":"ArrowUp",q=h?"ArrowRight":"ArrowDown",L=s.sizes[n]??0;if(T.key===E)y(L-S);else if(T.key===q)y(L+S);else if(T.key==="Home")y(0);else if(T.key==="End")y(m);else return;T.preventDefault()};return o.jsx("div",{role:"separator","aria-orientation":h?"vertical":"horizontal","aria-label":"Resize panes",tabIndex:0,"aria-valuenow":Math.round((s.sizes[n]??0)*100),"aria-valuemin":0,"aria-valuemax":100,"data-testid":"workspace-split-resize-handle",onPointerDown:w,onKeyDown:k,className:Y("group relative z-10 shrink-0 touch-none bg-border outline-none",h?"w-px cursor-col-resize":"h-px cursor-row-resize"),children:o.jsx("span",{"aria-hidden":!0,className:Y("absolute bg-ring opacity-0 transition-opacity delay-100 group-hover:opacity-100 group-focus-visible:opacity-100",h?"inset-y-0 -left-[4px] w-[9px]":"inset-x-0 -top-[4px] h-[9px]",u&&"opacity-100")})})}function N1({node:s,props:n}){const i=v.useRef(null),[r,c]=v.useState(null);if(s.kind==="pane")return o.jsx(S1,{id:s.id,props:n});const u={...s,sizes:r&&r.length===s.sizes.length?r:s.sizes};return o.jsx("div",{ref:i,className:Y("flex min-h-0 min-w-0 flex-1",s.direction==="horizontal"?"flex-row":"flex-col"),"data-testid":"workspace-split-group","data-direction":s.direction,children:s.children.map((d,h)=>o.jsxs(v.Fragment,{children:[o.jsx("div",{className:"flex min-h-0 min-w-0",style:{flexGrow:u.sizes[h]??0,flexShrink:1,flexBasis:0},"data-testid":"split-group-child",children:o.jsx(N1,{node:d,props:n})}),h<s.children.length-1?o.jsx(s5,{group:u,index:h,container:i,onPreview:c}):null]},d.id))})}function i5(s){const{panes:n,focusedPane:i,maximized:r}=vt(),[c,u]=v.useState(null),d=v.useMemo(()=>({target:c,setTarget:u,splits:s.splits}),[c,s.splits]),h=Ut(n.root),m=!s.splits||h.length<2?i:r&&h.includes(r)?r:null;return o.jsx(Jl.Provider,{value:d,children:o.jsx("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"workspace-panes","data-panes":h.length,children:m?o.jsx(S1,{id:m,props:s,whole:!s.splits&&h.length>1}):o.jsx(N1,{node:n.root,props:s})})})}const a5="outline-none focus-visible:ring-2 focus-visible:ring-ring",$d=Y("flex size-8 shrink-0 items-center justify-center rounded-lg text-extra-muted hover:bg-secondary hover:text-foreground [&_svg]:size-[18px]",a5);function r5({navOpen:s,onToggleNav:n,onClose:i}){const{workspace:r}=De(),[c,u]=v.useState(null),d=v.useRef(null),h=v.useRef(null);v.useEffect(()=>(d.current?.focus(),()=>{setTimeout(()=>document.querySelector('[data-focused="true"] [role="tab"][aria-selected="true"]')?.focus(),0)}),[]);const m=v.useRef({task:c,onClose:i});return m.current={task:c,onClose:i},v.useEffect(()=>{const g=x=>{if(x.key!=="Escape"||x.defaultPrevented||x.isComposing)return;const y=x.target;y0(y)&&y.value||document.querySelector('dialog[open], [role="menu"], [data-modal-overlay]')||(x.preventDefault(),m.current.task&&!o5(h.current)?u(null):m.current.onClose())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[]),o.jsxs("section",{"aria-label":"ALP tasks","data-testid":"alp-tasks-screen",ref:h,className:"flex min-h-0 flex-1 flex-col bg-background text-foreground",children:[o.jsxs("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b border-border px-2 md:h-9 md:px-3",children:[o.jsx("button",{type:"button","aria-label":s?"Close sessions":"Open sessions","aria-expanded":s,title:"Toggle sidebar",onClick:n,className:Y($d,"md:-ml-1.5"),children:o.jsx(Wr,{"aria-hidden":!0,strokeWidth:1.5})}),o.jsx(Si,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),o.jsx("h1",{className:"min-w-0 truncate text-sm",children:"ALP tasks"}),r?o.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground md:text-sm",title:r,children:Vt(r)}):null,o.jsx("span",{className:"flex-1"}),o.jsx("button",{ref:d,type:"button",className:$d,"aria-label":"Close tasks",title:"Close",onClick:i,"data-testid":"alp-tasks-screen-close",children:o.jsx(Zt,{"aria-hidden":!0,strokeWidth:1.5})})]}),o.jsxs("div",{className:"@container flex min-h-0 flex-1",children:[o.jsx("div",{className:Y("min-h-0 min-w-0 overflow-y-auto",c?"hidden @[820px]:block @[820px]:w-2/5 @[820px]:shrink-0 @[820px]:border-r @[820px]:border-border":"flex-1"),children:o.jsx(I0,{onOpen:u,current:c})}),c?o.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[o.jsx("div",{className:"flex h-10 shrink-0 items-center border-b border-border px-2 @[820px]:hidden",children:o.jsxs("button",{type:"button",className:Y($d,"w-auto gap-1.5 px-2 text-sm text-muted-foreground"),onClick:()=>u(null),"aria-label":"Back to tasks",children:[o.jsx(Cf,{"aria-hidden":!0})," Tasks"]})}),o.jsx(w1,{id:c,onOpenTask:u},c)]}):null]})]})}const o5=s=>(s?.getBoundingClientRect().width??0)>=820,yf={sidebar:R0,dock:L0},l5=400,T1=(s,n=0)=>{const{min:i,max:r}=yf[s];return{min:i,max:Math.max(i,Math.min(r,(typeof window>"u"?1/0:window.innerWidth)-n-l5))}};function Ly(s,n=0){const i=s==="sidebar"?"sidebarWidth":"dockWidth",[r,c]=v.useState(()=>Wf(Ol())[i]??yf[s].initial),u=v.useCallback(h=>{U0(Ol(),m=>({...m,[i]:h}))},[i]),[,d]=v.useReducer(h=>h+1,0);return v.useEffect(()=>(window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)),[]),{width:Ll(r,T1(s,n))??yf[s].initial,setWidth:c,save:u,reserved:n}}function Oy({which:s,side:n,width:i,reserved:r=0,onWidth:c,onCommit:u,testId:d}){const[h,m]=v.useState(!1),{min:g,max:x}=T1(s,r),y=v.useRef(null);v.useEffect(()=>()=>y.current?.(),[]);const w=S=>Ll(S,{min:g,max:x})??i,k=S=>{if(S.button!==0)return;S.preventDefault();const E=S.clientX,q=i;let L=i;const M=S.currentTarget;M.setPointerCapture(S.pointerId),m(!0);const R=document.body.style.cursor;document.body.style.cursor="col-resize";const $=V=>{const A=V.clientX-E;L=w(q+(n==="right"?A:-A)),c(L)},_=()=>{y.current=null,M.removeEventListener("pointermove",$),M.removeEventListener("pointerup",_),M.removeEventListener("pointercancel",_),M.removeEventListener("lostpointercapture",_),document.body.style.cursor=R,m(!1),u(L)};y.current=_,M.addEventListener("pointermove",$),M.addEventListener("pointerup",_),M.addEventListener("pointercancel",_),M.addEventListener("lostpointercapture",_)},T=S=>{const E=S.shiftKey?48:16,q=n==="right"?1:-1;let L=null;if(S.key==="ArrowRight"?L=i+E*q:S.key==="ArrowLeft"?L=i-E*q:S.key==="Home"?L=g:S.key==="End"&&(L=x),L===null)return;S.preventDefault();const M=w(L);c(M),u(M)};return o.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":s==="sidebar"?"Resize sidebar":"Resize explorer",tabIndex:0,"aria-valuenow":i,"aria-valuemin":g,"aria-valuemax":x,"data-testid":d,onPointerDown:k,onKeyDown:T,className:Y("group absolute inset-y-0 z-10 w-2.5 cursor-col-resize touch-none outline-none",n==="right"?"-right-[5px]":"-left-[5px]"),children:o.jsx("span",{"aria-hidden":!0,className:Y("absolute inset-y-0 left-1/2 w-[3px] -translate-x-1/2 bg-ring opacity-0 transition-opacity delay-100 group-hover:opacity-100 group-focus-visible:opacity-100",h&&"opacity-100")})})}function Dy(s){const n=v.useCallback(i=>{const r=window.matchMedia(s);return r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[s]);return v.useSyncExternalStore(n,()=>window.matchMedia(s).matches,()=>!1)}function c5(){const s=Be(),{openDraft:n}=vt(),{notice:i}=De();return v.useEffect(()=>{if(!i)return;const r=setTimeout(()=>s.dismissNotice(),8e3);return()=>clearTimeout(r)},[i,s]),i?o.jsxs("div",{role:i.level==="error"?"alert":"status",className:Y("fixed bottom-4 left-1/2 z-50 flex w-[min(92vw,28rem)] -translate-x-1/2 items-start gap-2 rounded-lg border px-3 py-2.5 text-sm shadow-xl shadow-[var(--shadow)]",i.level==="error"?"border-destructive/40 bg-[var(--notice-error)] text-destructive":"border-border bg-popover text-foreground"),children:[i.level==="error"?o.jsx(Is,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0"}):o.jsx(Of,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-info"}),o.jsx("span",{className:"min-w-0 flex-1",children:i.text}),i.action==="new-session"?o.jsx(Le,{size:"sm",variant:"secondary",className:"h-7 shrink-0 text-xs",onClick:()=>{s.dismissNotice(),n()},children:"New session"}):null,o.jsx(Le,{size:"icon-sm",variant:"ghost","aria-label":"Dismiss",onClick:()=>s.dismissNotice(),children:o.jsx(Zt,{"aria-hidden":!0})})]}):null}function Hd(){const s=Be(),{connection:n}=De();return n.phase!=="reconnecting"?null:o.jsxs("div",{role:"status",className:"flex items-center gap-2 border-b border-warning/30 bg-warning/10 px-4 py-2 text-xs text-warning",children:[o.jsx(Fj,{"aria-hidden":!0,className:"size-4 shrink-0"}),o.jsxs("span",{className:"min-w-0 flex-1",children:["Connection to the host lost. Reconnecting",n.attempt>1?` (attempt ${n.attempt})`:"","… Work on the host keeps running."]}),o.jsx(Le,{size:"sm",variant:"ghost",className:"h-7 text-xs text-warning",onClick:()=>s.disconnect(),children:"Disconnect"})]})}function u5({settings:s,history:n,splits:i,onAction:r}){const c=Be(),{tabs:u,row:d,active:h,activate:m,close:g,openPanel:x,panes:y,focusedPane:w,splitEmpty:k,canSplitEmpty:T,closePane:S,focusAdjacent:E,moveTabAdjacent:q}=vt(),L=i?d:u,{workspace:M}=De(),R=Ut(y.root).length>1,{sessions:$,selected:_}=De();return p4((V,A)=>{if(s&&V.action!=="settings.toggle")return!1;const I=(O,ce,le)=>O.length?ce<0?le>0?0:O.length-1:(ce+le+O.length)%O.length:-1;switch(V.action){case"session.index":{const O=$.list[(A??1)-1];return O?(c.selectSession(O.id),r("session.opened",V)):!1}case"session.relative":{const O=I($.list,$.list.findIndex(ce=>ce.id===_),V.delta??1);return O<0?!1:(c.selectSession($.list[O].id),r("session.opened",V))}case"tab.index":{const O=L[(A??1)-1];return O?(m(O),r("tab.shown",V)):!1}case"tab.relative":{const O=I(L,h?L.findIndex(ce=>Oe(ce)===Oe(h)):-1,V.delta??1);return O<0?!1:(m(L[O]),r("tab.shown",V))}case"tab.close":return!h||n?!1:(g(h),!0);case"tab.changes":case"tab.files":case"tab.terminal":{const O=V.action.slice(4);return x(O),r("tab.shown",V)}case"pane.split.right":case"pane.split.down":if(!i||n||!M||!T)return!1;k(V.action==="pane.split.right"?"right":"bottom");return;case"pane.focus.left":case"pane.focus.right":case"pane.focus.up":case"pane.focus.down":if(!i||n||!R)return!1;E(V.action.slice(11));return;case"pane.move.left":case"pane.move.right":case"pane.move.up":case"pane.move.down":if(!i||n||!R)return!1;q(V.action.slice(10));return;case"pane.close":if(!i||n||!R)return!1;S(w);return;default:return r(V.action,V,A)}},{allowInModal:["settings.toggle"]}),null}function Xt(s,n,i){const r=Kl.find(c=>c.action===s&&c.label&&(!c.mac||n)&&(i===void 0||c.delta===i));return r?If(Gf(r,n),n):void 0}function d5({open:s,scope:n,onClose:i,history:r,splits:c,onAction:u,onOpenSession:d}){const h=De(),m=Be(),{workspace:g,principal:x,connection:y,sessions:w,tree:k,selected:T}=h,{tabs:S,row:E,active:q,activate:L,close:M,closeOthers:R,openPanel:$,openFile:_,panes:V,focusedPane:A,splitEmpty:I,canSplitEmpty:O,closePane:ce,focusAdjacent:le,moveTabAdjacent:pe}=vt(),ie=c?E:S,de=(ve,xe)=>R(ve,xe,c?void 0:S),B=Ut(V.root).length>1,W=ve=>!q||Pf(ie,q,ve,T).length===0,ne=v.useMemo(()=>Fr(),[]),me=ze(x??void 0,"session.write"),N=y.phase==="open",X=k?.rootId,P=!r&&!!g,ee=q?ie.findIndex(ve=>Oe(ve)===Oe(q)):-1,oe=ve=>{if(!ie.length)return;const xe=ee<0?ve>0?0:ie.length-1:(ee+ve+ie.length)%ie.length;L(ie[xe]),u("tab.shown")},re=(ve,xe,Ee,je)=>({id:ve,label:Ee,group:"workspace",icon:Gs[xe].icon,shortcut:je,disabled:!g,keywords:["tab","panel"],run:()=>{$(xe),u("tab.shown")}}),Z=[{id:"new-session",label:"New session",group:"workspace",always:!0,icon:Yl,shortcut:Xt("session.new",ne),keywords:["new agent","start"],disabled:!g||!me||!N,run:()=>u("session.new")},re("new-terminal","terminal","New terminal",Xt("tab.terminal",ne)),re("open-changes","changes","Open Changes",Xt("tab.changes",ne)),re("open-files","files","Open Files",Xt("tab.files",ne)),re("open-diff","diff","Open Diff"),re("open-agents","agents","Open Agents"),{id:"tab-previous",label:"Previous tab",group:"workspace",icon:pb,shortcut:Xt("tab.relative",ne,-1),disabled:!P||ie.length<2,run:()=>oe(-1)},{id:"tab-next",label:"Next tab",group:"workspace",icon:Vn,shortcut:Xt("tab.relative",ne,1),disabled:!P||ie.length<2,run:()=>oe(1)},{id:"tab-close",label:"Close current tab",group:"workspace",icon:Zt,shortcut:Xt("tab.close",ne),disabled:!P||!q,run:()=>{q&&M(q)}},{id:"tab-close-left",label:"Close to the left",group:"workspace",icon:hb,keywords:["tabs"],disabled:!P||W("left"),run:()=>{q&&de(q,"left")}},{id:"tab-close-right",label:"Close to the right",group:"workspace",icon:mb,keywords:["tabs"],disabled:!P||W("right"),run:()=>{q&&de(q,"right")}},{id:"tab-close-others",label:"Close other tabs",group:"workspace",icon:bb,disabled:!P||W("others"),run:()=>{q&&de(q,"others")}},{id:"session-rename",label:"Rename session",group:"workspace",icon:Ea,disabled:!X||!me,run:()=>u("session.rename")},{id:"session-copy-id",label:"Copy session ID",group:"workspace",icon:qs,keywords:["agent id"],disabled:!X,run:()=>{X&&navigator.clipboard?.writeText(X).catch(()=>{})}},{id:"session-archive",label:"Archive session",group:"workspace",icon:$l,shortcut:Xt("session.archive",ne),disabled:!X||!me,run:()=>u("session.archive")},...c?fe():[],{id:"toggle-explorer",label:"Toggle explorer",group:"workspace",icon:Ab,shortcut:Xt("sidebar.right",ne),disabled:r,run:()=>u("sidebar.right")},{id:"history",label:"History",group:"actions",always:!0,icon:Lf,keywords:["archived","sessions"],disabled:!g,run:()=>u("history")},{id:"settings",label:"Settings",group:"actions",always:!0,icon:Df,shortcut:Xt("settings.toggle",ne),keywords:["preferences","theme"],run:()=>u("settings.toggle")},{id:"shortcuts",label:"Keyboard shortcuts",group:"actions",always:!0,icon:Cj,shortcut:Xt("shortcuts.toggle",ne),keywords:["keys","help"],run:()=>u("shortcuts.toggle")},{id:"toggle-sidebar",label:"Toggle left sidebar",group:"actions",icon:Wr,shortcut:Xt("sidebar.left",ne),run:()=>u("sidebar.left")},{id:"search-sessions",label:"Search sessions in the sidebar",group:"actions",icon:Ni,keywords:["filter","find"],disabled:!g,run:()=>u("search")},{id:"alp-open-tasks",label:"Open ALP tasks",group:"alp",always:!0,icon:Si,keywords:["tasks","todo","alp","panel"],disabled:!g,run:()=>{$("tasks"),u("tab.shown")}},{id:"alp-open-tasks-screen",label:"Open ALP tasks full screen",group:"alp",always:!0,icon:Si,keywords:["tasks","todo","alp","phone"],disabled:!g,run:()=>u("tasks.screen")}];function fe(){const ve=P,xe=(je,Ot)=>({id:`pane-focus-${je}`,label:Ot,group:"workspace",icon:wj,keywords:["pane","focus",je],disabled:!ve||!B,run:()=>{le(je)}}),Ee=(je,Ot)=>({id:`pane-move-tab-${je}`,label:Ot,group:"workspace",icon:fj,keywords:["pane","tab","move",je],disabled:!ve||!B||!q,run:()=>{pe(je)}});return[{id:"pane-split-right",label:"Split pane right",group:"workspace",icon:yb,shortcut:Xt("pane.split.right",ne),keywords:["split","pane","vertical"],disabled:!ve||!O,run:()=>I("right")},{id:"pane-split-down",label:"Split pane down",group:"workspace",icon:Eb,shortcut:Xt("pane.split.down",ne),keywords:["split","pane","horizontal"],disabled:!ve||!O,run:()=>I("bottom")},xe("left","Focus pane left"),xe("right","Focus pane right"),xe("up","Focus pane up"),xe("down","Focus pane down"),Ee("left","Move tab left"),Ee("right","Move tab right"),Ee("up","Move tab up"),Ee("down","Move tab down"),{id:"pane-close",label:"Close pane",group:"workspace",icon:Zt,shortcut:Xt("pane.close",ne),keywords:["pane","close"],disabled:!ve||!B,run:()=>ce(A)}]}const ge=w.list.map(ve=>({id:ve.id,title:In(ve),subtitle:[g?Vt(g):"",ve.status==="closed"?"Closed":ja(ve.updatedAt??ve.createdAt)].filter(Boolean).join(" · "),bucket:Kf(ve,Ul(h,ve.id),Kr(h,ve.id)),attention:!!Kr(h,ve.id),updatedAt:ve.updatedAt??ve.createdAt})),he=ve=>{ve===h.selected?(L({kind:"agent",id:ve}),u("session.opened")):d(ve)},nt=v.useMemo(()=>S4(x?.workspaces??[],g),[x,g]),$e=v.useMemo(()=>({available:y.capabilities.includes("workspace.files"),source:g,search:ve=>m.searchWorkspaceFiles({query:ve,limit:db})}),[y.capabilities,g,m]),ct=ve=>{if(m.filesReadable&&m.canReadFiles){_(ve),u("tab.shown");return}const xe=m.filesReadable?"this access token cannot read files":"this host does not offer file reading",Ee=navigator.clipboard?.writeText(ve);if(!Ee){m.notify("error",`Could not copy ${ve}.`);return}Ee.then(()=>m.notify("info",`Copied ${ve} (${xe})`),()=>m.notify("error",`Could not copy ${ve}.`))},ht=ve=>{m.selectWorkspace(ve),u("tab.shown")};return o.jsx(z4,{open:s,scope:n,onClose:i,actions:Z,sessions:ge,workspaces:nt,files:$e,onOpenSession:he,onSelectWorkspace:ht,onPickFile:ct,mac:ne})}function f5({onOpenSession:s}){return zN({onOpenSession:s}),null}function h5({request:s}){const{openDraft:n}=vt();return v.useEffect(()=>{s&&n()},[s,n]),null}function m5(){const s=Dy("(min-width: 1024px)"),n=Dy("(min-width: 768px)"),[i,r]=v.useState(!1),[c,u]=v.useState(!1),d=i4(),h=Ly("sidebar"),[m,g]=v.useState(0),[x,y]=v.useState(!1),[w,k]=v.useState(null),[T,S]=v.useState(null),[E,q]=v.useState(!1),[L,M]=v.useState(!1),[R,$]=v.useState(0),[_,V]=v.useState(!1),[A,I]=v.useState(0),[O,ce]=v.useState(!1),le=()=>{q(!1),ce(!1)},pe=()=>{ce(!1),q(!0)},ie=E||O,de=Be(),{selected:B,workspace:W,principal:ne,connection:me,sessions:N,tree:X}=De(),P=ze(ne??void 0,"session.write");v.useEffect(()=>{B&&(q(!1),ce(!1))},[B]);const[ee,oe]=v.useState(!1),[re,Z]=v.useState(!1),fe=n?!ee:i,ge=Ly("dock",n&&fe?h.width:0),he=s?!re:c;v.useEffect(()=>{if(!i&&!c)return;const Ee=je=>{je.key==="Escape"&&(r(!1),u(!1))};return window.addEventListener("keydown",Ee),()=>window.removeEventListener("keydown",Ee)},[i,c]);const nt=()=>g(Ee=>Ee+1),$e=()=>n?oe(Ee=>!Ee):r(Ee=>!Ee),ct=()=>s?Z(Ee=>!Ee):u(Ee=>!Ee),ht=()=>{n?oe(!1):r(!0)},ve=()=>{const Ee=X?.rootId;return Ee?N.list.find(je=>je.id===Ee)??{id:Ee,title:X.projection.sessions[Ee]?.title}:null},xe=Ee=>{switch(Ee){case"session.new":case"tab.agent":if(!W||!P||me.phase!=="open")return!1;le(),nt();return;case"session.archive":{const je=ve();if(!je||!P||de.isArchived(je.id))return!1;S(je);return}case"session.opened":case"tab.shown":le();return;case"search":ht(),$(je=>je+1);return;case"command-center.toggle":V(je=>je?!1:{scope:null});return;case"command-center.files":V({scope:"files"});return;case"history":if(!W)return!1;pe();return;case"session.rename":{const je=ve();if(!je||!P)return!1;k(je);return}case"shortcuts.toggle":M(je=>!je);return;case"tasks.screen":if(!W)return!1;q(!1),ce(!0);return;case"settings.toggle":V(!1),y(je=>!je);return;case"tab.menu":if(!W||ie)return!1;I(je=>je+1);return;case"sidebar.left":$e();return;case"sidebar.right":ct();return;case"sidebar.both":{const je=!fe&&!he;n?oe(!je):r(je),s?Z(!je):u(je);return}default:return!1}};return o.jsxs(b3,{children:[o.jsxs("div",{className:"flex h-dvh overflow-hidden",...x?{inert:!0,"aria-hidden":!0}:{},children:[!n&&i?o.jsx("div",{className:"fixed inset-0 z-30 bg-black/60","aria-hidden":!0,onClick:()=>r(!1)}):null,n&&ee?null:o.jsxs("div",{className:Y("z-40 shrink-0 border-r border-border bg-sidebar",n?"relative":"fixed inset-y-0 left-0 w-[min(100vw,22rem)] transition-transform duration-200",!n&&!i&&"-translate-x-full"),style:n?{width:h.width}:void 0,"data-testid":"sidebar-column",...!n&&!i?{inert:!0}:{},children:[n?o.jsx(Oy,{which:"sidebar",side:"right",width:h.width,onWidth:h.setWidth,onCommit:h.save,testId:"left-sidebar-resize-handle"}):null,o.jsx(EN,{onNewSession:()=>{le(),nt()},onRename:k,onArchive:S,onSettings:()=>y(!0),onNavigate:()=>r(!1),onClose:n?void 0:()=>r(!1),onHistory:()=>pe(),historyOpen:E,onOpenSession:()=>le(),searchRequest:R,onSearchRequestHandled:()=>$(0)})]}),o.jsx("main",{className:"flex min-w-0 flex-1 flex-col bg-background",children:O?o.jsxs(o.Fragment,{children:[o.jsx(Hd,{}),o.jsx(r5,{navOpen:fe,onToggleNav:$e,onClose:le})]}):E?o.jsxs(o.Fragment,{children:[o.jsx(Hd,{}),o.jsx(h4,{navOpen:fe,onToggleNav:$e,onOpen:()=>le(),onBack:()=>le()})]}):o.jsxs(o.Fragment,{children:[o.jsx(XT,{navOpen:fe,onToggleNav:$e,explorerOpen:he,onToggleExplorer:ct,onRename:k,onArchive:S}),o.jsx(Hd,{}),o.jsx(i5,{splits:n,onNewSession:nt,onRename:k,menuRequest:A,onMenuRequestHandled:()=>I(0)})]})}),he&&!ie?o.jsxs(o.Fragment,{children:[s?null:o.jsx("div",{className:"fixed inset-0 z-30 bg-black/60","aria-hidden":!0,onClick:()=>u(!1)}),o.jsxs("div",{className:Y("shrink-0 border-l border-border bg-sidebar",s?"relative":"fixed inset-y-0 right-0 z-40 w-[min(100vw,24rem)] shadow-2xl"),style:s?{width:ge.width}:void 0,"data-testid":"explorer-column",children:[s?o.jsx(Oy,{which:"dock",side:"left",width:ge.width,reserved:ge.reserved,onWidth:ge.setWidth,onCommit:ge.save,testId:"workspace-explorer-sidebar-resize-handle"}):null,o.jsx(r4,{dock:d,onClose:s?void 0:()=>u(!1)})]})]}):null,o.jsx(h5,{request:m}),o.jsx(f5,{onOpenSession:Ee=>{de.selectSession(Ee),le(),y(!1)}}),o.jsx(lN,{session:w,onClose:()=>k(null)}),o.jsx(cN,{session:T,onClose:()=>S(null)}),o.jsx(g4,{open:L,onClose:()=>M(!1)}),o.jsx(d5,{open:!!_,scope:_?_.scope:null,onClose:()=>V(!1),history:ie,splits:n,onAction:xe,onOpenSession:Ee=>{de.selectSession(Ee),le(),r(!1)}}),o.jsx(u5,{settings:x,history:ie,splits:n,onAction:xe}),o.jsx(c5,{})]}),x?o.jsx("div",{className:"fixed inset-0 z-50","data-modal-overlay":!0,children:o.jsx(IN,{mobile:!n,onClose:()=>y(!1)})}):null]})}function p5(){const{principal:s,connection:n,preferences:i}=De();return v.useLayoutEffect(()=>x4(i.theme),[i.theme]),!!s&&(n.phase==="open"||n.phase==="reconnecting")?o.jsx(m5,{}):o.jsx(rN,{})}function g5(){try{return window.localStorage}catch{return}}function x5(){try{return window.sessionStorage}catch{return}}const ah=x5(),ga=Vy({location:window.location,history:window.history,storage:ah}),Ta=new oj({storage:g5(),linkStorage:ah});ga&&"token"in ga?Ta.connect({url:ga.url,token:ga.token,link:!0}):ga&&Ta.showError(ga.error);window.addEventListener("pagehide",()=>Ta.disconnect({keepTerminals:!0,keepLink:!0}));window.addEventListener("pageshow",s=>{if(!s.persisted)return;const n=Vy({location:window.location,history:window.history,storage:ah});n&&"token"in n&&Ta.connect({url:n.url,token:n.token,link:!0})});window.addEventListener("storage",s=>{(s.key===Af||s.key===null)&&Ta.reloadPreferences()});Ww.createRoot(document.getElementById("root")).render(o.jsx(v.StrictMode,{children:o.jsx(tN,{controller:Ta,children:o.jsx(p5,{})})}));export{Le as B,Pr as R,Vl as S,b5 as T,De as a,Mb as b,y5 as c,v5 as e,o as j,v as r,Be as u};
|