@sapiom/harness 0.1.6 → 0.2.1

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/dist/cli/args.d.ts +16 -0
  3. package/dist/cli/args.d.ts.map +1 -0
  4. package/dist/cli/args.js +80 -0
  5. package/dist/cli/args.js.map +1 -0
  6. package/dist/cli/bin.js +12 -65
  7. package/dist/cli/bin.js.map +1 -1
  8. package/dist/cli/settings.d.ts.map +1 -1
  9. package/dist/cli/settings.js +33 -1
  10. package/dist/cli/settings.js.map +1 -1
  11. package/dist/core/adapters/claude-code.d.ts +60 -2
  12. package/dist/core/adapters/claude-code.d.ts.map +1 -1
  13. package/dist/core/adapters/claude-code.js +119 -32
  14. package/dist/core/adapters/claude-code.js.map +1 -1
  15. package/dist/core/adapters/codex.d.ts +21 -2
  16. package/dist/core/adapters/codex.d.ts.map +1 -1
  17. package/dist/core/adapters/codex.js +53 -2
  18. package/dist/core/adapters/codex.js.map +1 -1
  19. package/dist/core/adapters/detect.d.ts +9 -0
  20. package/dist/core/adapters/detect.d.ts.map +1 -1
  21. package/dist/core/adapters/detect.js +9 -0
  22. package/dist/core/adapters/detect.js.map +1 -1
  23. package/dist/core/canvas-body.d.ts +28 -28
  24. package/dist/core/canvas-body.d.ts.map +1 -1
  25. package/dist/core/canvas-body.js +117 -55
  26. package/dist/core/canvas-body.js.map +1 -1
  27. package/dist/core/canvas-derive.d.ts +43 -0
  28. package/dist/core/canvas-derive.d.ts.map +1 -0
  29. package/dist/core/canvas-derive.js +95 -0
  30. package/dist/core/canvas-derive.js.map +1 -0
  31. package/dist/core/canvas-enrichment.d.ts +52 -127
  32. package/dist/core/canvas-enrichment.d.ts.map +1 -1
  33. package/dist/core/canvas-enrichment.js +17 -178
  34. package/dist/core/canvas-enrichment.js.map +1 -1
  35. package/dist/core/canvas-graph.d.ts +40 -1
  36. package/dist/core/canvas-graph.d.ts.map +1 -1
  37. package/dist/core/canvas-graph.js +71 -9
  38. package/dist/core/canvas-graph.js.map +1 -1
  39. package/dist/core/canvas-interconnections.d.ts +26 -8
  40. package/dist/core/canvas-interconnections.d.ts.map +1 -1
  41. package/dist/core/canvas-interconnections.js +132 -24
  42. package/dist/core/canvas-interconnections.js.map +1 -1
  43. package/dist/core/canvas-manifest-check.d.ts.map +1 -1
  44. package/dist/core/canvas-manifest-check.js +15 -2
  45. package/dist/core/canvas-manifest-check.js.map +1 -1
  46. package/dist/core/canvas-render.d.ts +8 -15
  47. package/dist/core/canvas-render.d.ts.map +1 -1
  48. package/dist/core/canvas-render.js +29 -41
  49. package/dist/core/canvas-render.js.map +1 -1
  50. package/dist/core/canvas-run-state.d.ts +41 -0
  51. package/dist/core/canvas-run-state.d.ts.map +1 -1
  52. package/dist/core/canvas-run-state.js +136 -0
  53. package/dist/core/canvas-run-state.js.map +1 -1
  54. package/dist/core/canvas-svg.d.ts +9 -4
  55. package/dist/core/canvas-svg.d.ts.map +1 -1
  56. package/dist/core/canvas-svg.js +84 -13
  57. package/dist/core/canvas-svg.js.map +1 -1
  58. package/dist/core/canvas-template.d.ts +9 -10
  59. package/dist/core/canvas-template.d.ts.map +1 -1
  60. package/dist/core/canvas-template.js +57 -20
  61. package/dist/core/canvas-template.js.map +1 -1
  62. package/dist/core/canvas-watcher.d.ts +22 -1
  63. package/dist/core/canvas-watcher.d.ts.map +1 -1
  64. package/dist/core/canvas-watcher.js +111 -30
  65. package/dist/core/canvas-watcher.js.map +1 -1
  66. package/dist/core/collector/normalizer.d.ts +8 -0
  67. package/dist/core/collector/normalizer.d.ts.map +1 -1
  68. package/dist/core/collector/normalizer.js +8 -0
  69. package/dist/core/collector/normalizer.js.map +1 -1
  70. package/dist/core/collector/store.d.ts +75 -1
  71. package/dist/core/collector/store.d.ts.map +1 -1
  72. package/dist/core/collector/store.js +334 -2
  73. package/dist/core/collector/store.js.map +1 -1
  74. package/dist/core/errors.d.ts +10 -4
  75. package/dist/core/errors.d.ts.map +1 -1
  76. package/dist/core/errors.js +11 -5
  77. package/dist/core/errors.js.map +1 -1
  78. package/dist/core/example-seed.d.ts +8 -0
  79. package/dist/core/example-seed.d.ts.map +1 -1
  80. package/dist/core/example-seed.js +47 -10
  81. package/dist/core/example-seed.js.map +1 -1
  82. package/dist/core/inject/system-prompt.d.ts +8 -0
  83. package/dist/core/inject/system-prompt.d.ts.map +1 -1
  84. package/dist/core/inject/system-prompt.js +3 -1
  85. package/dist/core/inject/system-prompt.js.map +1 -1
  86. package/dist/core/macros.d.ts.map +1 -1
  87. package/dist/core/macros.js +5 -6
  88. package/dist/core/macros.js.map +1 -1
  89. package/dist/core/paths.d.ts +1 -0
  90. package/dist/core/paths.d.ts.map +1 -1
  91. package/dist/core/paths.js +1 -0
  92. package/dist/core/paths.js.map +1 -1
  93. package/dist/core/record-archive.d.ts +187 -0
  94. package/dist/core/record-archive.d.ts.map +1 -0
  95. package/dist/core/record-archive.js +465 -0
  96. package/dist/core/record-archive.js.map +1 -0
  97. package/dist/core/rehydration.d.ts +72 -0
  98. package/dist/core/rehydration.d.ts.map +1 -0
  99. package/dist/core/rehydration.js +72 -0
  100. package/dist/core/rehydration.js.map +1 -0
  101. package/dist/core/resume-brief.d.ts +130 -0
  102. package/dist/core/resume-brief.d.ts.map +1 -0
  103. package/dist/core/resume-brief.js +404 -0
  104. package/dist/core/resume-brief.js.map +1 -0
  105. package/dist/core/rolling-summary.d.ts +130 -0
  106. package/dist/core/rolling-summary.d.ts.map +1 -0
  107. package/dist/core/rolling-summary.js +227 -0
  108. package/dist/core/rolling-summary.js.map +1 -0
  109. package/dist/core/session-manager.d.ts +11 -3
  110. package/dist/core/session-manager.d.ts.map +1 -1
  111. package/dist/core/session-manager.js +56 -7
  112. package/dist/core/session-manager.js.map +1 -1
  113. package/dist/core/session-record.d.ts +165 -0
  114. package/dist/core/session-record.d.ts.map +1 -0
  115. package/dist/core/session-record.js +470 -0
  116. package/dist/core/session-record.js.map +1 -0
  117. package/dist/core/spawn-target.d.ts +12 -0
  118. package/dist/core/spawn-target.d.ts.map +1 -0
  119. package/dist/core/spawn-target.js +187 -0
  120. package/dist/core/spawn-target.js.map +1 -0
  121. package/dist/core/task-manager.d.ts.map +1 -1
  122. package/dist/core/task-manager.js +9 -1
  123. package/dist/core/task-manager.js.map +1 -1
  124. package/dist/core/template-catalog.d.ts +48 -0
  125. package/dist/core/template-catalog.d.ts.map +1 -0
  126. package/dist/core/template-catalog.js +338 -0
  127. package/dist/core/template-catalog.js.map +1 -0
  128. package/dist/core/workflow-registry.d.ts.map +1 -1
  129. package/dist/core/workflow-registry.js +2 -2
  130. package/dist/core/workflow-registry.js.map +1 -1
  131. package/dist/core/workspace-watcher.d.ts.map +1 -1
  132. package/dist/core/workspace-watcher.js +4 -3
  133. package/dist/core/workspace-watcher.js.map +1 -1
  134. package/dist/index.d.ts +12 -0
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +21 -0
  137. package/dist/index.js.map +1 -1
  138. package/dist/profiles/default.d.ts.map +1 -1
  139. package/dist/profiles/default.js +9 -14
  140. package/dist/profiles/default.js.map +1 -1
  141. package/dist/server/canvas.d.ts.map +1 -1
  142. package/dist/server/canvas.js +7 -7
  143. package/dist/server/canvas.js.map +1 -1
  144. package/dist/server/fs.d.ts.map +1 -1
  145. package/dist/server/fs.js +17 -1
  146. package/dist/server/fs.js.map +1 -1
  147. package/dist/server/index.d.ts +12 -3
  148. package/dist/server/index.d.ts.map +1 -1
  149. package/dist/server/index.js +321 -50
  150. package/dist/server/index.js.map +1 -1
  151. package/dist/server/ingest.d.ts +11 -0
  152. package/dist/server/ingest.d.ts.map +1 -1
  153. package/dist/server/ingest.js +1 -0
  154. package/dist/server/ingest.js.map +1 -1
  155. package/dist/server/macros.d.ts +4 -6
  156. package/dist/server/macros.d.ts.map +1 -1
  157. package/dist/server/macros.js.map +1 -1
  158. package/dist/server/rest.d.ts +18 -6
  159. package/dist/server/rest.d.ts.map +1 -1
  160. package/dist/server/rest.js +185 -48
  161. package/dist/server/rest.js.map +1 -1
  162. package/dist/server/templates.d.ts +24 -0
  163. package/dist/server/templates.d.ts.map +1 -0
  164. package/dist/server/templates.js +54 -0
  165. package/dist/server/templates.js.map +1 -0
  166. package/dist/shared/types.d.ts +477 -29
  167. package/dist/shared/types.d.ts.map +1 -1
  168. package/dist/shared/types.js +19 -11
  169. package/dist/shared/types.js.map +1 -1
  170. package/dist/web/assets/index-SYpugKQ1.css +32 -0
  171. package/dist/web/assets/index-vYYd44hZ.js +446 -0
  172. package/dist/web/index.html +2 -2
  173. package/package.json +5 -4
  174. package/dist/core/canvas-enrich.d.ts +0 -115
  175. package/dist/core/canvas-enrich.d.ts.map +0 -1
  176. package/dist/core/canvas-enrich.js +0 -186
  177. package/dist/core/canvas-enrich.js.map +0 -1
  178. package/dist/profiles/canvas-guidelines.d.ts +0 -20
  179. package/dist/profiles/canvas-guidelines.d.ts.map +0 -1
  180. package/dist/profiles/canvas-guidelines.js +0 -48
  181. package/dist/profiles/canvas-guidelines.js.map +0 -1
  182. package/dist/web/assets/index-DCtyI4VW.css +0 -32
  183. package/dist/web/assets/index-WSw5RvYR.js +0 -445
  184. package/dist/web/welcome-hero-dark.png +0 -0
  185. package/dist/web/welcome-hero-light.png +0 -0
@@ -0,0 +1,446 @@
1
+ var uv=Object.defineProperty;var hv=(a,_,E)=>_ in a?uv(a,_,{enumerable:!0,configurable:!0,writable:!0,value:E}):a[_]=E;var uc=(a,_,E)=>hv(a,typeof _!="symbol"?_+"":_,E);(function(){const _=document.createElement("link").relList;if(_&&_.supports&&_.supports("modulepreload"))return;for(const N of document.querySelectorAll('link[rel="modulepreload"]'))S(N);new MutationObserver(N=>{for(const q of N)if(q.type==="childList")for(const L of q.addedNodes)L.tagName==="LINK"&&L.rel==="modulepreload"&&S(L)}).observe(document,{childList:!0,subtree:!0});function E(N){const q={};return N.integrity&&(q.integrity=N.integrity),N.referrerPolicy&&(q.referrerPolicy=N.referrerPolicy),N.crossOrigin==="use-credentials"?q.credentials="include":N.crossOrigin==="anonymous"?q.credentials="omit":q.credentials="same-origin",q}function S(N){if(N.ep)return;N.ep=!0;const q=E(N);fetch(N.href,q)}})();var hc={exports:{}},ja={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var jf;function dv(){if(jf)return ja;jf=1;var a=Symbol.for("react.transitional.element"),_=Symbol.for("react.fragment");function E(S,N,q){var L=null;if(q!==void 0&&(L=""+q),N.key!==void 0&&(L=""+N.key),"key"in N){q={};for(var h in N)h!=="key"&&(q[h]=N[h])}else q=N;return N=q.ref,{$$typeof:a,type:S,key:L,ref:N!==void 0?N:null,props:q}}return ja.Fragment=_,ja.jsx=E,ja.jsxs=E,ja}var Rf;function fv(){return Rf||(Rf=1,hc.exports=dv()),hc.exports}var n=fv(),dc={exports:{}},Ue={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Tf;function pv(){if(Tf)return Ue;Tf=1;var a=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),L=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),u=Symbol.for("react.activity"),v=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,d={};function f(D,z,Q){this.props=D,this.context=z,this.refs=d,this.updater=Q||x}f.prototype.isReactComponent={},f.prototype.setState=function(D,z){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,z,"setState")},f.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function l(){}l.prototype=f.prototype;function o(D,z,Q){this.props=D,this.context=z,this.refs=d,this.updater=Q||x}var y=o.prototype=new l;y.constructor=o,b(y,f.prototype),y.isPureReactComponent=!0;var A=Array.isArray;function k(){}var R={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function T(D,z,Q){var ne=Q.ref;return{$$typeof:a,type:D,key:z,ref:ne!==void 0?ne:null,props:Q}}function H(D,z){return T(D.type,z,D.props)}function I(D){return typeof D=="object"&&D!==null&&D.$$typeof===a}function W(D){var z={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(Q){return z[Q]})}var P=/\/+/g;function Z(D,z){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):z.toString(36)}function te(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(k,k):(D.status="pending",D.then(function(z){D.status==="pending"&&(D.status="fulfilled",D.value=z)},function(z){D.status==="pending"&&(D.status="rejected",D.reason=z)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function F(D,z,Q,ne,ve){var Ce=typeof D;(Ce==="undefined"||Ce==="boolean")&&(D=null);var X=!1;if(D===null)X=!0;else switch(Ce){case"bigint":case"string":case"number":X=!0;break;case"object":switch(D.$$typeof){case a:case _:X=!0;break;case g:return X=D._init,F(X(D._payload),z,Q,ne,ve)}}if(X)return ve=ve(D),X=ne===""?"."+Z(D,0):ne,A(ve)?(Q="",X!=null&&(Q=X.replace(P,"$&/")+"/"),F(ve,z,Q,"",function(oe){return oe})):ve!=null&&(I(ve)&&(ve=H(ve,Q+(ve.key==null||D&&D.key===ve.key?"":(""+ve.key).replace(P,"$&/")+"/")+X)),z.push(ve)),1;X=0;var O=ne===""?".":ne+":";if(A(D))for(var ee=0;ee<D.length;ee++)ne=D[ee],Ce=O+Z(ne,ee),X+=F(ne,z,Q,Ce,ve);else if(ee=w(D),typeof ee=="function")for(D=ee.call(D),ee=0;!(ne=D.next()).done;)ne=ne.value,Ce=O+Z(ne,ee++),X+=F(ne,z,Q,Ce,ve);else if(Ce==="object"){if(typeof D.then=="function")return F(te(D),z,Q,ne,ve);throw z=String(D),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return X}function Y(D,z,Q){if(D==null)return D;var ne=[],ve=0;return F(D,ne,"","",function(Ce){return z.call(Q,Ce,ve++)}),ne}function V(D){if(D._status===-1){var z=D._result;z=z(),z.then(function(Q){(D._status===0||D._status===-1)&&(D._status=1,D._result=Q)},function(Q){(D._status===0||D._status===-1)&&(D._status=2,D._result=Q)}),D._status===-1&&(D._status=0,D._result=z)}if(D._status===1)return D._result.default;throw D._result}var M=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},$={map:Y,forEach:function(D,z,Q){Y(D,function(){z.apply(this,arguments)},Q)},count:function(D){var z=0;return Y(D,function(){z++}),z},toArray:function(D){return Y(D,function(z){return z})||[]},only:function(D){if(!I(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ue.Activity=u,Ue.Children=$,Ue.Component=f,Ue.Fragment=E,Ue.Profiler=N,Ue.PureComponent=o,Ue.StrictMode=S,Ue.Suspense=p,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(D){return R.H.useMemoCache(D)}},Ue.cache=function(D){return function(){return D.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(D,z,Q){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ne=b({},D.props),ve=D.key;if(z!=null)for(Ce in z.key!==void 0&&(ve=""+z.key),z)!C.call(z,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&z.ref===void 0||(ne[Ce]=z[Ce]);var Ce=arguments.length-2;if(Ce===1)ne.children=Q;else if(1<Ce){for(var X=Array(Ce),O=0;O<Ce;O++)X[O]=arguments[O+2];ne.children=X}return T(D.type,ve,ne)},Ue.createContext=function(D){return D={$$typeof:L,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:q,_context:D},D},Ue.createElement=function(D,z,Q){var ne,ve={},Ce=null;if(z!=null)for(ne in z.key!==void 0&&(Ce=""+z.key),z)C.call(z,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ve[ne]=z[ne]);var X=arguments.length-2;if(X===1)ve.children=Q;else if(1<X){for(var O=Array(X),ee=0;ee<X;ee++)O[ee]=arguments[ee+2];ve.children=O}if(D&&D.defaultProps)for(ne in X=D.defaultProps,X)ve[ne]===void 0&&(ve[ne]=X[ne]);return T(D,Ce,ve)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(D){return{$$typeof:h,render:D}},Ue.isValidElement=I,Ue.lazy=function(D){return{$$typeof:g,_payload:{_status:-1,_result:D},_init:V}},Ue.memo=function(D,z){return{$$typeof:m,type:D,compare:z===void 0?null:z}},Ue.startTransition=function(D){var z=R.T,Q={};R.T=Q;try{var ne=D(),ve=R.S;ve!==null&&ve(Q,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(k,M)}catch(Ce){M(Ce)}finally{z!==null&&Q.types!==null&&(z.types=Q.types),R.T=z}},Ue.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Ue.use=function(D){return R.H.use(D)},Ue.useActionState=function(D,z,Q){return R.H.useActionState(D,z,Q)},Ue.useCallback=function(D,z){return R.H.useCallback(D,z)},Ue.useContext=function(D){return R.H.useContext(D)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(D,z){return R.H.useDeferredValue(D,z)},Ue.useEffect=function(D,z){return R.H.useEffect(D,z)},Ue.useEffectEvent=function(D){return R.H.useEffectEvent(D)},Ue.useId=function(){return R.H.useId()},Ue.useImperativeHandle=function(D,z,Q){return R.H.useImperativeHandle(D,z,Q)},Ue.useInsertionEffect=function(D,z){return R.H.useInsertionEffect(D,z)},Ue.useLayoutEffect=function(D,z){return R.H.useLayoutEffect(D,z)},Ue.useMemo=function(D,z){return R.H.useMemo(D,z)},Ue.useOptimistic=function(D,z){return R.H.useOptimistic(D,z)},Ue.useReducer=function(D,z,Q){return R.H.useReducer(D,z,Q)},Ue.useRef=function(D){return R.H.useRef(D)},Ue.useState=function(D){return R.H.useState(D)},Ue.useSyncExternalStore=function(D,z,Q){return R.H.useSyncExternalStore(D,z,Q)},Ue.useTransition=function(){return R.H.useTransition()},Ue.version="19.2.7",Ue}var Df;function Rc(){return Df||(Df=1,dc.exports=pv()),dc.exports}var U=Rc(),fc={exports:{}},Ra={},pc={exports:{}},mc={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Nf;function mv(){return Nf||(Nf=1,(function(a){function _(F,Y){var V=F.length;F.push(Y);e:for(;0<V;){var M=V-1>>>1,$=F[M];if(0<N($,Y))F[M]=Y,F[V]=$,V=M;else break e}}function E(F){return F.length===0?null:F[0]}function S(F){if(F.length===0)return null;var Y=F[0],V=F.pop();if(V!==Y){F[0]=V;e:for(var M=0,$=F.length,D=$>>>1;M<D;){var z=2*(M+1)-1,Q=F[z],ne=z+1,ve=F[ne];if(0>N(Q,V))ne<$&&0>N(ve,Q)?(F[M]=ve,F[ne]=V,M=ne):(F[M]=Q,F[z]=V,M=z);else if(ne<$&&0>N(ve,V))F[M]=ve,F[ne]=V,M=ne;else break e}}return Y}function N(F,Y){var V=F.sortIndex-Y.sortIndex;return V!==0?V:F.id-Y.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var q=performance;a.unstable_now=function(){return q.now()}}else{var L=Date,h=L.now();a.unstable_now=function(){return L.now()-h}}var p=[],m=[],g=1,u=null,v=3,w=!1,x=!1,b=!1,d=!1,f=typeof setTimeout=="function"?setTimeout:null,l=typeof clearTimeout=="function"?clearTimeout:null,o=typeof setImmediate<"u"?setImmediate:null;function y(F){for(var Y=E(m);Y!==null;){if(Y.callback===null)S(m);else if(Y.startTime<=F)S(m),Y.sortIndex=Y.expirationTime,_(p,Y);else break;Y=E(m)}}function A(F){if(b=!1,y(F),!x)if(E(p)!==null)x=!0,k||(k=!0,W());else{var Y=E(m);Y!==null&&te(A,Y.startTime-F)}}var k=!1,R=-1,C=5,T=-1;function H(){return d?!0:!(a.unstable_now()-T<C)}function I(){if(d=!1,k){var F=a.unstable_now();T=F;var Y=!0;try{e:{x=!1,b&&(b=!1,l(R),R=-1),w=!0;var V=v;try{t:{for(y(F),u=E(p);u!==null&&!(u.expirationTime>F&&H());){var M=u.callback;if(typeof M=="function"){u.callback=null,v=u.priorityLevel;var $=M(u.expirationTime<=F);if(F=a.unstable_now(),typeof $=="function"){u.callback=$,y(F),Y=!0;break t}u===E(p)&&S(p),y(F)}else S(p);u=E(p)}if(u!==null)Y=!0;else{var D=E(m);D!==null&&te(A,D.startTime-F),Y=!1}}break e}finally{u=null,v=V,w=!1}Y=void 0}}finally{Y?W():k=!1}}}var W;if(typeof o=="function")W=function(){o(I)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,Z=P.port2;P.port1.onmessage=I,W=function(){Z.postMessage(null)}}else W=function(){f(I,0)};function te(F,Y){R=f(function(){F(a.unstable_now())},Y)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(F){F.callback=null},a.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<F?Math.floor(1e3/F):5},a.unstable_getCurrentPriorityLevel=function(){return v},a.unstable_next=function(F){switch(v){case 1:case 2:case 3:var Y=3;break;default:Y=v}var V=v;v=Y;try{return F()}finally{v=V}},a.unstable_requestPaint=function(){d=!0},a.unstable_runWithPriority=function(F,Y){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var V=v;v=F;try{return Y()}finally{v=V}},a.unstable_scheduleCallback=function(F,Y,V){var M=a.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?M+V:M):V=M,F){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=V+$,F={id:g++,callback:Y,priorityLevel:F,startTime:V,expirationTime:$,sortIndex:-1},V>M?(F.sortIndex=V,_(m,F),E(p)===null&&F===E(m)&&(b?(l(R),R=-1):b=!0,te(A,V-M))):(F.sortIndex=$,_(p,F),x||w||(x=!0,k||(k=!0,W()))),F},a.unstable_shouldYield=H,a.unstable_wrapCallback=function(F){var Y=v;return function(){var V=v;v=Y;try{return F.apply(this,arguments)}finally{v=V}}}})(mc)),mc}var Mf;function _v(){return Mf||(Mf=1,pc.exports=mv()),pc.exports}var _c={exports:{}},Qt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Lf;function vv(){if(Lf)return Qt;Lf=1;var a=Rc();function _(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function E(){}var S={d:{f:E,r:function(){throw Error(_(522))},D:E,C:E,L:E,m:E,X:E,S:E,M:E},p:0,findDOMNode:null},N=Symbol.for("react.portal");function q(p,m,g){var u=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:N,key:u==null?null:""+u,children:p,containerInfo:m,implementation:g}}var L=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,Qt.createPortal=function(p,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(_(299));return q(p,m,null,g)},Qt.flushSync=function(p){var m=L.T,g=S.p;try{if(L.T=null,S.p=2,p)return p()}finally{L.T=m,S.p=g,S.d.f()}},Qt.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,S.d.C(p,m))},Qt.prefetchDNS=function(p){typeof p=="string"&&S.d.D(p)},Qt.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var g=m.as,u=h(g,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?S.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:u,integrity:v,fetchPriority:w}):g==="script"&&S.d.X(p,{crossOrigin:u,integrity:v,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Qt.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=h(m.as,m.crossOrigin);S.d.M(p,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&S.d.M(p)},Qt.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,u=h(g,m.crossOrigin);S.d.L(p,g,{crossOrigin:u,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Qt.preloadModule=function(p,m){if(typeof p=="string")if(m){var g=h(m.as,m.crossOrigin);S.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else S.d.m(p)},Qt.requestFormReset=function(p){S.d.r(p)},Qt.unstable_batchedUpdates=function(p,m){return p(m)},Qt.useFormState=function(p,m,g){return L.H.useFormState(p,m,g)},Qt.useFormStatus=function(){return L.H.useHostTransitionStatus()},Qt.version="19.2.7",Qt}var Of;function yp(){if(Of)return _c.exports;Of=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(_){console.error(_)}}return a(),_c.exports=vv(),_c.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var Bf;function gv(){if(Bf)return Ra;Bf=1;var a=_v(),_=Rc(),E=yp();function S(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}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 N(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function q(e){var t=e,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s:null}function L(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(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(q(e)!==e)throw Error(S(188))}function m(e){var t=e.alternate;if(!t){if(t=q(e),t===null)throw Error(S(188));return t!==e?null:e}for(var s=e,i=t;;){var r=s.return;if(r===null)break;var c=r.alternate;if(c===null){if(i=r.return,i!==null){s=i;continue}break}if(r.child===c.child){for(c=r.child;c;){if(c===s)return p(r),e;if(c===i)return p(r),t;c=c.sibling}throw Error(S(188))}if(s.return!==i.return)s=r,i=c;else{for(var j=!1,B=r.child;B;){if(B===s){j=!0,s=r,i=c;break}if(B===i){j=!0,i=r,s=c;break}B=B.sibling}if(!j){for(B=c.child;B;){if(B===s){j=!0,s=c,i=r;break}if(B===i){j=!0,i=c,s=r;break}B=B.sibling}if(!j)throw Error(S(189))}}if(s.alternate!==i)throw Error(S(190))}if(s.tag!==3)throw Error(S(188));return s.stateNode.current===s?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 u=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),o=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var P=Symbol.for("react.client.reference");function Z(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===P?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case f:return"Profiler";case d:return"StrictMode";case A:return"Suspense";case k:return"SuspenseList";case T:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case x:return"Portal";case o:return e.displayName||"Context";case l:return(e._context.displayName||"Context")+".Consumer";case y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case R:return t=e.displayName||null,t!==null?t:Z(e.type)||"Memo";case C:t=e._payload,e=e._init;try{return Z(e(t))}catch{}}return null}var te=Array.isArray,F=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=E.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},M=[],$=-1;function D(e){return{current:e}}function z(e){0>$||(e.current=M[$],M[$]=null,$--)}function Q(e,t){$++,M[$]=e.current,e.current=t}var ne=D(null),ve=D(null),Ce=D(null),X=D(null);function O(e,t){switch(Q(Ce,t),Q(ve,e),Q(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Zd(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(ne),Q(ne,e)}function ee(){z(ne),z(ve),z(Ce)}function oe(e){e.memoizedState!==null&&Q(X,e);var t=ne.current,s=Zd(t,e.type);t!==s&&(Q(ve,e),Q(ne,s))}function Se(e){ve.current===e&&(z(ne),z(ve)),X.current===e&&(z(X),xa._currentValue=V)}var ge,Oe;function Me(e){if(ge===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||"",Oe=-1<s.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ge+e+Oe}var Pe=!1;function Ke(e,t){if(!e||Pe)return"";Pe=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(ce){var ae=ce}Reflect.construct(e,[],me)}else{try{me.call()}catch(ce){ae=ce}e.call(me.prototype)}}else{try{throw Error()}catch(ce){ae=ce}(me=e())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ce){if(ce&&ae&&typeof ce.stack=="string")return[ce.stack,ae.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=i.DetermineComponentFrameRoot(),j=c[0],B=c[1];if(j&&B){var K=j.split(`
44
+ `),ie=B.split(`
45
+ `);for(r=i=0;i<K.length&&!K[i].includes("DetermineComponentFrameRoot");)i++;for(;r<ie.length&&!ie[r].includes("DetermineComponentFrameRoot");)r++;if(i===K.length||r===ie.length)for(i=K.length-1,r=ie.length-1;1<=i&&0<=r&&K[i]!==ie[r];)r--;for(;1<=i&&0<=r;i--,r--)if(K[i]!==ie[r]){if(i!==1||r!==1)do if(i--,r--,0>r||K[i]!==ie[r]){var he=`
46
+ `+K[i].replace(" at new "," at ");return e.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",e.displayName)),he}while(1<=i&&0<=r);break}}}finally{Pe=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?Me(s):""}function Re(e,t){switch(e.tag){case 26:case 27:case 5:return Me(e.type);case 16:return Me("Lazy");case 13:return e.child!==t&&t!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return Ke(e.type,!1);case 11:return Ke(e.type.render,!1);case 1:return Ke(e.type,!0);case 31:return Me("Activity");default:return""}}function ft(e){try{var t="",s=null;do t+=Re(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
47
+ Error generating stack: `+i.message+`
48
+ `+i.stack}}var vt=Object.prototype.hasOwnProperty,Lt=a.unstable_scheduleCallback,wt=a.unstable_cancelCallback,bt=a.unstable_shouldYield,st=a.unstable_requestPaint,it=a.unstable_now,pt=a.unstable_getCurrentPriorityLevel,xt=a.unstable_ImmediatePriority,Ot=a.unstable_UserBlockingPriority,Je=a.unstable_NormalPriority,jt=a.unstable_LowPriority,Ct=a.unstable_IdlePriority,Pt=a.log,_e=a.unstable_setDisableYieldValue,ze=null,nt=null;function Rt(e){if(typeof Pt=="function"&&_e(e),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(ze,e)}catch{}}var gt=Math.clz32?Math.clz32:Ps,$s=Math.log,Tt=Math.LN2;function Ps(e){return e>>>=0,e===0?32:31-($s(e)/Tt|0)|0}var is=256,ns=262144,Ds=4194304;function Jt(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:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Zt(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var r=0,c=e.suspendedLanes,j=e.pingedLanes;e=e.warmLanes;var B=i&134217727;return B!==0?(i=B&~c,i!==0?r=Jt(i):(j&=B,j!==0?r=Jt(j):s||(s=B&~e,s!==0&&(r=Jt(s))))):(B=i&~c,B!==0?r=Jt(B):j!==0?r=Jt(j):s||(s=i&~e,s!==0&&(r=Jt(s)))),r===0?0:t!==0&&t!==r&&(t&c)===0&&(c=r&-r,s=t&-t,c>=s||c===32&&(s&4194048)!==0)?t:r}function re(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function de(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 be(){var e=Ds;return Ds<<=1,(Ds&62914560)===0&&(Ds=4194304),e}function ye(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function ke(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ht(e,t,s,i,r,c){var j=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var B=e.entanglements,K=e.expirationTimes,ie=e.hiddenUpdates;for(s=j&~s;0<s;){var he=31-gt(s),me=1<<he;B[he]=0,K[he]=-1;var ae=ie[he];if(ae!==null)for(ie[he]=null,he=0;he<ae.length;he++){var ce=ae[he];ce!==null&&(ce.lane&=-536870913)}s&=~me}i!==0&&yt(e,i,0),c!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=c&~(j&~t))}function yt(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-gt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function et(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-gt(s),r=1<<i;r&t|e[i]&t&&(e[i]|=t),s&=~r}}function Et(e,t){var s=t&-t;return s=(s&42)!==0?1:qt(s),(s&(e.suspendedLanes|t))!==0?0:s}function qt(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 le(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function xe(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:bf(e.type))}function Ee(e,t){var s=Y.p;try{return Y.p=e,t()}finally{Y.p=s}}var Be=Math.random().toString(36).slice(2),We="__reactFiber$"+Be,ue="__reactProps$"+Be,we="__reactContainer$"+Be,Ne="__reactEvents$"+Be,Dt="__reactListeners$"+Be,He="__reactHandles$"+Be,es="__reactResources$"+Be,hs="__reactMarker$"+Be;function ys(e){delete e[We],delete e[ue],delete e[Ne],delete e[Dt],delete e[He]}function Ws(e){var t=e[We];if(t)return t;for(var s=e.parentNode;s;){if(t=s[we]||s[We]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=af(e);e!==null;){if(s=e[We])return s;e=af(e)}return t}e=s,s=e.parentNode}return null}function Ns(e){if(e=e[We]||e[we]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(S(33))}function ui(e){var t=e[es];return t||(t=e[es]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Bt(e){e[hs]=!0}var In=new Set,Uc={};function Oi(e,t){Ji(e,t),Ji(e+"Capture",t)}function Ji(e,t){for(Uc[e]=t,e=0;e<t.length;e++)In.add(t[e])}var tm=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]*$"),Ic={},qc={};function sm(e){return vt.call(qc,e)?!0:vt.call(Ic,e)?!1:tm.test(e)?qc[e]=!0:(Ic[e]=!0,!1)}function La(e,t,s){if(sm(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function Oa(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Fs(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+i)}}function Ss(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $c(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function im(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var r=i.get,c=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(j){s=""+j,c.call(this,j)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(j){s=""+j},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function sl(e){if(!e._valueTracker){var t=$c(e)?"checked":"value";e._valueTracker=im(e,t,""+e[t])}}function Pc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=$c(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function Ba(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 nm=/[\n"\\]/g;function bs(e){return e.replace(nm,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function il(e,t,s,i,r,c,j,B){e.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.type=j:e.removeAttribute("type"),t!=null?j==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ss(t)):e.value!==""+Ss(t)&&(e.value=""+Ss(t)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),t!=null?nl(e,j,Ss(t)):s!=null?nl(e,j,Ss(s)):i!=null&&e.removeAttribute("value"),r==null&&c!=null&&(e.defaultChecked=!!c),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?e.name=""+Ss(B):e.removeAttribute("name")}function Wc(e,t,s,i,r,c,j,B){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||s!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){sl(e);return}s=s!=null?""+Ss(s):"",t=t!=null?""+Ss(t):s,B||t===e.value||(e.value=t),e.defaultValue=t}i=i??r,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=B?e.checked:!!i,e.defaultChecked=!!i,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(e.name=j),sl(e)}function nl(e,t,s){t==="number"&&Ba(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function en(e,t,s,i){if(e=e.options,t){t={};for(var r=0;r<s.length;r++)t["$"+s[r]]=!0;for(s=0;s<e.length;s++)r=t.hasOwnProperty("$"+e[s].value),e[s].selected!==r&&(e[s].selected=r),r&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Ss(s),t=null,r=0;r<e.length;r++){if(e[r].value===s){e[r].selected=!0,i&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Fc(e,t,s){if(t!=null&&(t=""+Ss(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Ss(s):""}function Yc(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(S(92));if(te(i)){if(1<i.length)throw Error(S(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Ss(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),sl(e)}function tn(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var am=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 Kc(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||am.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function Xc(e,t,s){if(t!=null&&typeof t!="object")throw Error(S(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var r in t)i=t[r],t.hasOwnProperty(r)&&s[r]!==i&&Kc(e,r,i)}else for(var c in t)t.hasOwnProperty(c)&&Kc(e,c,t[c])}function al(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 rm=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"]]),lm=/^[\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 Ha(e){return lm.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ys(){}var rl=null;function ll(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var sn=null,nn=null;function Gc(e){var t=Ns(e);if(t&&(e=t.stateNode)){var s=e[ue]||null;e:switch(e=t.stateNode,t.type){case"input":if(il(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+bs(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var r=i[ue]||null;if(!r)throw Error(S(90));il(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&Pc(i)}break e;case"textarea":Fc(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&en(e,!!s.multiple,t,!1)}}}var ol=!1;function Vc(e,t,s){if(ol)return e(t,s);ol=!0;try{var i=e(t);return i}finally{if(ol=!1,(sn!==null||nn!==null)&&(xr(),sn&&(t=sn,e=nn,nn=sn=null,Gc(t),e)))for(t=0;t<e.length;t++)Gc(e[t])}}function qn(e,t){var s=e.stateNode;if(s===null)return null;var i=s[ue]||null;if(i===null)return null;s=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(S(231,t,typeof s));return s}var Ks=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cl=!1;if(Ks)try{var $n={};Object.defineProperty($n,"passive",{get:function(){cl=!0}}),window.addEventListener("test",$n,$n),window.removeEventListener("test",$n,$n)}catch{cl=!1}var hi=null,ul=null,za=null;function Zc(){if(za)return za;var e,t=ul,s=t.length,i,r="value"in hi?hi.value:hi.textContent,c=r.length;for(e=0;e<s&&t[e]===r[e];e++);var j=s-e;for(i=1;i<=j&&t[s-i]===r[c-i];i++);return za=r.slice(e,1<i?1-i:void 0)}function Ua(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 Ia(){return!0}function Qc(){return!1}function as(e){function t(s,i,r,c,j){this._reactName=s,this._targetInst=r,this.type=i,this.nativeEvent=c,this.target=j,this.currentTarget=null;for(var B in e)e.hasOwnProperty(B)&&(s=e[B],this[B]=s?s(c):c[B]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?Ia:Qc,this.isPropagationStopped=Qc,this}return u(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ia)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ia)},persist:function(){},isPersistent:Ia}),t}var Bi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qa=as(Bi),Pn=u({},Bi,{view:0,detail:0}),om=as(Pn),hl,dl,Wn,$a=u({},Pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pl,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!==Wn&&(Wn&&e.type==="mousemove"?(hl=e.screenX-Wn.screenX,dl=e.screenY-Wn.screenY):dl=hl=0,Wn=e),hl)},movementY:function(e){return"movementY"in e?e.movementY:dl}}),Jc=as($a),cm=u({},$a,{dataTransfer:0}),um=as(cm),hm=u({},Pn,{relatedTarget:0}),fl=as(hm),dm=u({},Bi,{animationName:0,elapsedTime:0,pseudoElement:0}),fm=as(dm),pm=u({},Bi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),mm=as(pm),_m=u({},Bi,{data:0}),eu=as(_m),vm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gm={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"},ym={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ym[e])?!!t[e]:!1}function pl(){return Sm}var bm=u({},Pn,{key:function(e){if(e.key){var t=vm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ua(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gm[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pl,charCode:function(e){return e.type==="keypress"?Ua(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ua(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Cm=as(bm),wm=u({},$a,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tu=as(wm),xm=u({},Pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pl}),Em=as(xm),km=u({},Bi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Am=as(km),jm=u({},$a,{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}),Rm=as(jm),Tm=u({},Bi,{newState:0,oldState:0}),Dm=as(Tm),Nm=[9,13,27,32],ml=Ks&&"CompositionEvent"in window,Fn=null;Ks&&"documentMode"in document&&(Fn=document.documentMode);var Mm=Ks&&"TextEvent"in window&&!Fn,su=Ks&&(!ml||Fn&&8<Fn&&11>=Fn),iu=" ",nu=!1;function au(e,t){switch(e){case"keyup":return Nm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ru(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var an=!1;function Lm(e,t){switch(e){case"compositionend":return ru(t);case"keypress":return t.which!==32?null:(nu=!0,iu);case"textInput":return e=t.data,e===iu&&nu?null:e;default:return null}}function Om(e,t){if(an)return e==="compositionend"||!ml&&au(e,t)?(e=Zc(),za=ul=hi=null,an=!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 su&&t.locale!=="ko"?null:t.data;default:return null}}var Bm={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 lu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Bm[e.type]:t==="textarea"}function ou(e,t,s,i){sn?nn?nn.push(i):nn=[i]:sn=i,t=Dr(t,"onChange"),0<t.length&&(s=new qa("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Yn=null,Kn=null;function Hm(e){Wd(e,0)}function Pa(e){var t=Ft(e);if(Pc(t))return e}function cu(e,t){if(e==="change")return t}var uu=!1;if(Ks){var _l;if(Ks){var vl="oninput"in document;if(!vl){var hu=document.createElement("div");hu.setAttribute("oninput","return;"),vl=typeof hu.oninput=="function"}_l=vl}else _l=!1;uu=_l&&(!document.documentMode||9<document.documentMode)}function du(){Yn&&(Yn.detachEvent("onpropertychange",fu),Kn=Yn=null)}function fu(e){if(e.propertyName==="value"&&Pa(Kn)){var t=[];ou(t,Kn,e,ll(e)),Vc(Hm,t)}}function zm(e,t,s){e==="focusin"?(du(),Yn=t,Kn=s,Yn.attachEvent("onpropertychange",fu)):e==="focusout"&&du()}function Um(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Pa(Kn)}function Im(e,t){if(e==="click")return Pa(t)}function qm(e,t){if(e==="input"||e==="change")return Pa(t)}function $m(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ds=typeof Object.is=="function"?Object.is:$m;function Xn(e,t){if(ds(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var r=s[i];if(!vt.call(t,r)||!ds(e[r],t[r]))return!1}return!0}function pu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mu(e,t){var s=pu(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=pu(s)}}function _u(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_u(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vu(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ba(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=Ba(e.document)}return t}function gl(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 Pm=Ks&&"documentMode"in document&&11>=document.documentMode,rn=null,yl=null,Gn=null,Sl=!1;function gu(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Sl||rn==null||rn!==Ba(i)||(i=rn,"selectionStart"in i&&gl(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Gn&&Xn(Gn,i)||(Gn=i,i=Dr(yl,"onSelect"),0<i.length&&(t=new qa("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=rn)))}function Hi(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var ln={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},bl={},yu={};Ks&&(yu=document.createElement("div").style,"AnimationEvent"in window||(delete ln.animationend.animation,delete ln.animationiteration.animation,delete ln.animationstart.animation),"TransitionEvent"in window||delete ln.transitionend.transition);function zi(e){if(bl[e])return bl[e];if(!ln[e])return e;var t=ln[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in yu)return bl[e]=t[s];return e}var Su=zi("animationend"),bu=zi("animationiteration"),Cu=zi("animationstart"),Wm=zi("transitionrun"),Fm=zi("transitionstart"),Ym=zi("transitioncancel"),wu=zi("transitionend"),xu=new Map,Cl="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(" ");Cl.push("scrollEnd");function Ms(e,t){xu.set(e,t),Oi(t,[e])}var Wa=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)},Cs=[],on=0,wl=0;function Fa(){for(var e=on,t=wl=on=0;t<e;){var s=Cs[t];Cs[t++]=null;var i=Cs[t];Cs[t++]=null;var r=Cs[t];Cs[t++]=null;var c=Cs[t];if(Cs[t++]=null,i!==null&&r!==null){var j=i.pending;j===null?r.next=r:(r.next=j.next,j.next=r),i.pending=r}c!==0&&Eu(s,r,c)}}function Ya(e,t,s,i){Cs[on++]=e,Cs[on++]=t,Cs[on++]=s,Cs[on++]=i,wl|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function xl(e,t,s,i){return Ya(e,t,s,i),Ka(e)}function Ui(e,t){return Ya(e,null,null,t),Ka(e)}function Eu(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var r=!1,c=e.return;c!==null;)c.childLanes|=s,i=c.alternate,i!==null&&(i.childLanes|=s),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(r=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,r&&t!==null&&(r=31-gt(s),e=c.hiddenUpdates,i=e[r],i===null?e[r]=[t]:i.push(t),t.lane=s|536870912),c):null}function Ka(e){if(50<va)throw va=0,Lo=null,Error(S(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var cn={};function Km(e,t,s,i){this.tag=e,this.key=s,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fs(e,t,s,i){return new Km(e,t,s,i)}function El(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xs(e,t){var s=e.alternate;return s===null?(s=fs(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function ku(e,t){e.flags&=65011714;var s=e.alternate;return s===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=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Xa(e,t,s,i,r,c){var j=0;if(i=e,typeof e=="function")El(e)&&(j=1);else if(typeof e=="string")j=Q_(e,s,ne.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case T:return e=fs(31,s,t,r),e.elementType=T,e.lanes=c,e;case b:return Ii(s.children,r,c,t);case d:j=8,r|=24;break;case f:return e=fs(12,s,t,r|2),e.elementType=f,e.lanes=c,e;case A:return e=fs(13,s,t,r),e.elementType=A,e.lanes=c,e;case k:return e=fs(19,s,t,r),e.elementType=k,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case o:j=10;break e;case l:j=9;break e;case y:j=11;break e;case R:j=14;break e;case C:j=16,i=null;break e}j=29,s=Error(S(130,e===null?"null":typeof e,"")),i=null}return t=fs(j,s,t,r),t.elementType=e,t.type=i,t.lanes=c,t}function Ii(e,t,s,i){return e=fs(7,e,i,t),e.lanes=s,e}function kl(e,t,s){return e=fs(6,e,null,t),e.lanes=s,e}function Au(e){var t=fs(18,null,null,0);return t.stateNode=e,t}function Al(e,t,s){return t=fs(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ju=new WeakMap;function ws(e,t){if(typeof e=="object"&&e!==null){var s=ju.get(e);return s!==void 0?s:(t={value:e,source:t,stack:ft(t)},ju.set(e,t),t)}return{value:e,source:t,stack:ft(t)}}var un=[],hn=0,Ga=null,Vn=0,xs=[],Es=0,di=null,Hs=1,zs="";function Gs(e,t){un[hn++]=Vn,un[hn++]=Ga,Ga=e,Vn=t}function Ru(e,t,s){xs[Es++]=Hs,xs[Es++]=zs,xs[Es++]=di,di=e;var i=Hs;e=zs;var r=32-gt(i)-1;i&=~(1<<r),s+=1;var c=32-gt(t)+r;if(30<c){var j=r-r%5;c=(i&(1<<j)-1).toString(32),i>>=j,r-=j,Hs=1<<32-gt(t)+r|s<<r|i,zs=c+e}else Hs=1<<c|s<<r|i,zs=e}function jl(e){e.return!==null&&(Gs(e,1),Ru(e,1,0))}function Rl(e){for(;e===Ga;)Ga=un[--hn],un[hn]=null,Vn=un[--hn],un[hn]=null;for(;e===di;)di=xs[--Es],xs[Es]=null,zs=xs[--Es],xs[Es]=null,Hs=xs[--Es],xs[Es]=null}function Tu(e,t){xs[Es++]=Hs,xs[Es++]=zs,xs[Es++]=di,Hs=t.id,zs=t.overflow,di=e}var Yt=null,mt=null,Ve=!1,fi=null,ks=!1,Tl=Error(S(519));function pi(e){var t=Error(S(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zn(ws(t,e)),Tl}function Du(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[We]=e,t[ue]=i,s){case"dialog":Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":case"embed":Ye("load",t);break;case"video":case"audio":for(s=0;s<ya.length;s++)Ye(ya[s],t);break;case"source":Ye("error",t);break;case"img":case"image":case"link":Ye("error",t),Ye("load",t);break;case"details":Ye("toggle",t);break;case"input":Ye("invalid",t),Wc(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ye("invalid",t);break;case"textarea":Ye("invalid",t),Yc(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||Xd(t.textContent,s)?(i.popover!=null&&(Ye("beforetoggle",t),Ye("toggle",t)),i.onScroll!=null&&Ye("scroll",t),i.onScrollEnd!=null&&Ye("scrollend",t),i.onClick!=null&&(t.onclick=Ys),t=!0):t=!1,t||pi(e,!0)}function Nu(e){for(Yt=e.return;Yt;)switch(Yt.tag){case 5:case 31:case 13:ks=!1;return;case 27:case 3:ks=!0;return;default:Yt=Yt.return}}function dn(e){if(e!==Yt)return!1;if(!Ve)return Nu(e),Ve=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Go(e.type,e.memoizedProps)),s=!s),s&&mt&&pi(e),Nu(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(317));mt=nf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(317));mt=nf(e)}else t===27?(t=mt,ji(e.type)?(e=ec,ec=null,mt=e):mt=t):mt=Yt?js(e.stateNode.nextSibling):null;return!0}function qi(){mt=Yt=null,Ve=!1}function Dl(){var e=fi;return e!==null&&(cs===null?cs=e:cs.push.apply(cs,e),fi=null),e}function Zn(e){fi===null?fi=[e]:fi.push(e)}var Nl=D(null),$i=null,Vs=null;function mi(e,t,s){Q(Nl,t._currentValue),t._currentValue=s}function Zs(e){e._currentValue=Nl.current,z(Nl)}function Ml(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function Ll(e,t,s,i){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var c=r.dependencies;if(c!==null){var j=r.child;c=c.firstContext;e:for(;c!==null;){var B=c;c=r;for(var K=0;K<t.length;K++)if(B.context===t[K]){c.lanes|=s,B=c.alternate,B!==null&&(B.lanes|=s),Ml(c.return,s,e),i||(j=null);break e}c=B.next}}else if(r.tag===18){if(j=r.return,j===null)throw Error(S(341));j.lanes|=s,c=j.alternate,c!==null&&(c.lanes|=s),Ml(j,s,e),j=null}else j=r.child;if(j!==null)j.return=r;else for(j=r;j!==null;){if(j===e){j=null;break}if(r=j.sibling,r!==null){r.return=j.return,j=r;break}j=j.return}r=j}}function fn(e,t,s,i){e=null;for(var r=t,c=!1;r!==null;){if(!c){if((r.flags&524288)!==0)c=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var j=r.alternate;if(j===null)throw Error(S(387));if(j=j.memoizedProps,j!==null){var B=r.type;ds(r.pendingProps.value,j.value)||(e!==null?e.push(B):e=[B])}}else if(r===X.current){if(j=r.alternate,j===null)throw Error(S(387));j.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(xa):e=[xa])}r=r.return}e!==null&&Ll(t,e,s,i),t.flags|=262144}function Va(e){for(e=e.firstContext;e!==null;){if(!ds(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Pi(e){$i=e,Vs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kt(e){return Mu($i,e)}function Za(e,t){return $i===null&&Pi(e),Mu(e,t)}function Mu(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Vs===null){if(e===null)throw Error(S(308));Vs=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vs=Vs.next=t;return s}var Xm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},Gm=a.unstable_scheduleCallback,Vm=a.unstable_NormalPriority,Ht={$$typeof:o,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ol(){return{controller:new Xm,data:new Map,refCount:0}}function Qn(e){e.refCount--,e.refCount===0&&Gm(Vm,function(){e.controller.abort()})}var Jn=null,Bl=0,pn=0,mn=null;function Zm(e,t){if(Jn===null){var s=Jn=[];Bl=0,pn=Io(),mn={status:"pending",value:void 0,then:function(i){s.push(i)}}}return Bl++,t.then(Lu,Lu),t}function Lu(){if(--Bl===0&&Jn!==null){mn!==null&&(mn.status="fulfilled");var e=Jn;Jn=null,pn=0,mn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Qm(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(r){s.push(r)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var r=0;r<s.length;r++)(0,s[r])(t)},function(r){for(i.status="rejected",i.reason=r,r=0;r<s.length;r++)(0,s[r])(void 0)}),i}var Ou=F.S;F.S=function(e,t){gd=it(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Zm(e,t),Ou!==null&&Ou(e,t)};var Wi=D(null);function Hl(){var e=Wi.current;return e!==null?e:dt.pooledCache}function Qa(e,t){t===null?Q(Wi,Wi.current):Q(Wi,t.pool)}function Bu(){var e=Hl();return e===null?null:{parent:Ht._currentValue,pool:e}}var _n=Error(S(460)),zl=Error(S(474)),Ja=Error(S(542)),er={then:function(){}};function Hu(e){return e=e.status,e==="fulfilled"||e==="rejected"}function zu(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Ys,Ys),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Iu(e),e;default:if(typeof t.status=="string")t.then(Ys,Ys);else{if(e=dt,e!==null&&100<e.shellSuspendCounter)throw Error(S(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=i}},function(i){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Iu(e),e}throw Yi=t,_n}}function Fi(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Yi=s,_n):s}}var Yi=null;function Uu(){if(Yi===null)throw Error(S(459));var e=Yi;return Yi=null,e}function Iu(e){if(e===_n||e===Ja)throw Error(S(483))}var vn=null,ea=0;function tr(e){var t=ea;return ea+=1,vn===null&&(vn=[]),zu(vn,e,t)}function ta(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function sr(e,t){throw t.$$typeof===v?Error(S(525)):(e=Object.prototype.toString.call(t),Error(S(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function qu(e){function t(J,G){if(e){var se=J.deletions;se===null?(J.deletions=[G],J.flags|=16):se.push(G)}}function s(J,G){if(!e)return null;for(;G!==null;)t(J,G),G=G.sibling;return null}function i(J){for(var G=new Map;J!==null;)J.key!==null?G.set(J.key,J):G.set(J.index,J),J=J.sibling;return G}function r(J,G){return J=Xs(J,G),J.index=0,J.sibling=null,J}function c(J,G,se){return J.index=se,e?(se=J.alternate,se!==null?(se=se.index,se<G?(J.flags|=67108866,G):se):(J.flags|=67108866,G)):(J.flags|=1048576,G)}function j(J){return e&&J.alternate===null&&(J.flags|=67108866),J}function B(J,G,se,pe){return G===null||G.tag!==6?(G=kl(se,J.mode,pe),G.return=J,G):(G=r(G,se),G.return=J,G)}function K(J,G,se,pe){var De=se.type;return De===b?he(J,G,se.props.children,pe,se.key):G!==null&&(G.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===C&&Fi(De)===G.type)?(G=r(G,se.props),ta(G,se),G.return=J,G):(G=Xa(se.type,se.key,se.props,null,J.mode,pe),ta(G,se),G.return=J,G)}function ie(J,G,se,pe){return G===null||G.tag!==4||G.stateNode.containerInfo!==se.containerInfo||G.stateNode.implementation!==se.implementation?(G=Al(se,J.mode,pe),G.return=J,G):(G=r(G,se.children||[]),G.return=J,G)}function he(J,G,se,pe,De){return G===null||G.tag!==7?(G=Ii(se,J.mode,pe,De),G.return=J,G):(G=r(G,se),G.return=J,G)}function me(J,G,se){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=kl(""+G,J.mode,se),G.return=J,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return se=Xa(G.type,G.key,G.props,null,J.mode,se),ta(se,G),se.return=J,se;case x:return G=Al(G,J.mode,se),G.return=J,G;case C:return G=Fi(G),me(J,G,se)}if(te(G)||W(G))return G=Ii(G,J.mode,se,null),G.return=J,G;if(typeof G.then=="function")return me(J,tr(G),se);if(G.$$typeof===o)return me(J,Za(J,G),se);sr(J,G)}return null}function ae(J,G,se,pe){var De=G!==null?G.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return De!==null?null:B(J,G,""+se,pe);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case w:return se.key===De?K(J,G,se,pe):null;case x:return se.key===De?ie(J,G,se,pe):null;case C:return se=Fi(se),ae(J,G,se,pe)}if(te(se)||W(se))return De!==null?null:he(J,G,se,pe,null);if(typeof se.then=="function")return ae(J,G,tr(se),pe);if(se.$$typeof===o)return ae(J,G,Za(J,se),pe);sr(J,se)}return null}function ce(J,G,se,pe,De){if(typeof pe=="string"&&pe!==""||typeof pe=="number"||typeof pe=="bigint")return J=J.get(se)||null,B(G,J,""+pe,De);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case w:return J=J.get(pe.key===null?se:pe.key)||null,K(G,J,pe,De);case x:return J=J.get(pe.key===null?se:pe.key)||null,ie(G,J,pe,De);case C:return pe=Fi(pe),ce(J,G,se,pe,De)}if(te(pe)||W(pe))return J=J.get(se)||null,he(G,J,pe,De,null);if(typeof pe.then=="function")return ce(J,G,se,tr(pe),De);if(pe.$$typeof===o)return ce(J,G,se,Za(G,pe),De);sr(G,pe)}return null}function Ae(J,G,se,pe){for(var De=null,Ze=null,Te=G,qe=G=0,Ge=null;Te!==null&&qe<se.length;qe++){Te.index>qe?(Ge=Te,Te=null):Ge=Te.sibling;var Qe=ae(J,Te,se[qe],pe);if(Qe===null){Te===null&&(Te=Ge);break}e&&Te&&Qe.alternate===null&&t(J,Te),G=c(Qe,G,qe),Ze===null?De=Qe:Ze.sibling=Qe,Ze=Qe,Te=Ge}if(qe===se.length)return s(J,Te),Ve&&Gs(J,qe),De;if(Te===null){for(;qe<se.length;qe++)Te=me(J,se[qe],pe),Te!==null&&(G=c(Te,G,qe),Ze===null?De=Te:Ze.sibling=Te,Ze=Te);return Ve&&Gs(J,qe),De}for(Te=i(Te);qe<se.length;qe++)Ge=ce(Te,J,qe,se[qe],pe),Ge!==null&&(e&&Ge.alternate!==null&&Te.delete(Ge.key===null?qe:Ge.key),G=c(Ge,G,qe),Ze===null?De=Ge:Ze.sibling=Ge,Ze=Ge);return e&&Te.forEach(function(Mi){return t(J,Mi)}),Ve&&Gs(J,qe),De}function Le(J,G,se,pe){if(se==null)throw Error(S(151));for(var De=null,Ze=null,Te=G,qe=G=0,Ge=null,Qe=se.next();Te!==null&&!Qe.done;qe++,Qe=se.next()){Te.index>qe?(Ge=Te,Te=null):Ge=Te.sibling;var Mi=ae(J,Te,Qe.value,pe);if(Mi===null){Te===null&&(Te=Ge);break}e&&Te&&Mi.alternate===null&&t(J,Te),G=c(Mi,G,qe),Ze===null?De=Mi:Ze.sibling=Mi,Ze=Mi,Te=Ge}if(Qe.done)return s(J,Te),Ve&&Gs(J,qe),De;if(Te===null){for(;!Qe.done;qe++,Qe=se.next())Qe=me(J,Qe.value,pe),Qe!==null&&(G=c(Qe,G,qe),Ze===null?De=Qe:Ze.sibling=Qe,Ze=Qe);return Ve&&Gs(J,qe),De}for(Te=i(Te);!Qe.done;qe++,Qe=se.next())Qe=ce(Te,J,qe,Qe.value,pe),Qe!==null&&(e&&Qe.alternate!==null&&Te.delete(Qe.key===null?qe:Qe.key),G=c(Qe,G,qe),Ze===null?De=Qe:Ze.sibling=Qe,Ze=Qe);return e&&Te.forEach(function(cv){return t(J,cv)}),Ve&&Gs(J,qe),De}function ct(J,G,se,pe){if(typeof se=="object"&&se!==null&&se.type===b&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case w:e:{for(var De=se.key;G!==null;){if(G.key===De){if(De=se.type,De===b){if(G.tag===7){s(J,G.sibling),pe=r(G,se.props.children),pe.return=J,J=pe;break e}}else if(G.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===C&&Fi(De)===G.type){s(J,G.sibling),pe=r(G,se.props),ta(pe,se),pe.return=J,J=pe;break e}s(J,G);break}else t(J,G);G=G.sibling}se.type===b?(pe=Ii(se.props.children,J.mode,pe,se.key),pe.return=J,J=pe):(pe=Xa(se.type,se.key,se.props,null,J.mode,pe),ta(pe,se),pe.return=J,J=pe)}return j(J);case x:e:{for(De=se.key;G!==null;){if(G.key===De)if(G.tag===4&&G.stateNode.containerInfo===se.containerInfo&&G.stateNode.implementation===se.implementation){s(J,G.sibling),pe=r(G,se.children||[]),pe.return=J,J=pe;break e}else{s(J,G);break}else t(J,G);G=G.sibling}pe=Al(se,J.mode,pe),pe.return=J,J=pe}return j(J);case C:return se=Fi(se),ct(J,G,se,pe)}if(te(se))return Ae(J,G,se,pe);if(W(se)){if(De=W(se),typeof De!="function")throw Error(S(150));return se=De.call(se),Le(J,G,se,pe)}if(typeof se.then=="function")return ct(J,G,tr(se),pe);if(se.$$typeof===o)return ct(J,G,Za(J,se),pe);sr(J,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,G!==null&&G.tag===6?(s(J,G.sibling),pe=r(G,se),pe.return=J,J=pe):(s(J,G),pe=kl(se,J.mode,pe),pe.return=J,J=pe),j(J)):s(J,G)}return function(J,G,se,pe){try{ea=0;var De=ct(J,G,se,pe);return vn=null,De}catch(Te){if(Te===_n||Te===Ja)throw Te;var Ze=fs(29,Te,null,J.mode);return Ze.lanes=pe,Ze.return=J,Ze}finally{}}}var Ki=qu(!0),$u=qu(!1),_i=!1;function Ul(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Il(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 vi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function gi(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(tt&2)!==0){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=Ka(e),Eu(e,null,s),t}return Ya(e,i,t,s),Ka(e)}function sa(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,et(e,s)}}function ql(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var r=null,c=null;if(s=s.firstBaseUpdate,s!==null){do{var j={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};c===null?r=c=j:c=c.next=j,s=s.next}while(s!==null);c===null?r=c=t:c=c.next=t}else r=c=t;s={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:c,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var $l=!1;function ia(){if($l){var e=mn;if(e!==null)throw e}}function na(e,t,s,i){$l=!1;var r=e.updateQueue;_i=!1;var c=r.firstBaseUpdate,j=r.lastBaseUpdate,B=r.shared.pending;if(B!==null){r.shared.pending=null;var K=B,ie=K.next;K.next=null,j===null?c=ie:j.next=ie,j=K;var he=e.alternate;he!==null&&(he=he.updateQueue,B=he.lastBaseUpdate,B!==j&&(B===null?he.firstBaseUpdate=ie:B.next=ie,he.lastBaseUpdate=K))}if(c!==null){var me=r.baseState;j=0,he=ie=K=null,B=c;do{var ae=B.lane&-536870913,ce=ae!==B.lane;if(ce?(Xe&ae)===ae:(i&ae)===ae){ae!==0&&ae===pn&&($l=!0),he!==null&&(he=he.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var Ae=e,Le=B;ae=t;var ct=s;switch(Le.tag){case 1:if(Ae=Le.payload,typeof Ae=="function"){me=Ae.call(ct,me,ae);break e}me=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Le.payload,ae=typeof Ae=="function"?Ae.call(ct,me,ae):Ae,ae==null)break e;me=u({},me,ae);break e;case 2:_i=!0}}ae=B.callback,ae!==null&&(e.flags|=64,ce&&(e.flags|=8192),ce=r.callbacks,ce===null?r.callbacks=[ae]:ce.push(ae))}else ce={lane:ae,tag:B.tag,payload:B.payload,callback:B.callback,next:null},he===null?(ie=he=ce,K=me):he=he.next=ce,j|=ae;if(B=B.next,B===null){if(B=r.shared.pending,B===null)break;ce=B,B=ce.next,ce.next=null,r.lastBaseUpdate=ce,r.shared.pending=null}}while(!0);he===null&&(K=me),r.baseState=K,r.firstBaseUpdate=ie,r.lastBaseUpdate=he,c===null&&(r.shared.lanes=0),wi|=j,e.lanes=j,e.memoizedState=me}}function Pu(e,t){if(typeof e!="function")throw Error(S(191,e));e.call(t)}function Wu(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Pu(s[e],t)}var gn=D(null),ir=D(0);function Fu(e,t){e=ri,Q(ir,e),Q(gn,t),ri=e|t.baseLanes}function Pl(){Q(ir,ri),Q(gn,gn.current)}function Wl(){ri=ir.current,z(gn),z(ir)}var ps=D(null),As=null;function yi(e){var t=e.alternate;Q(Nt,Nt.current&1),Q(ps,e),As===null&&(t===null||gn.current!==null||t.memoizedState!==null)&&(As=e)}function Fl(e){Q(Nt,Nt.current),Q(ps,e),As===null&&(As=e)}function Yu(e){e.tag===22?(Q(Nt,Nt.current),Q(ps,e),As===null&&(As=e)):Si()}function Si(){Q(Nt,Nt.current),Q(ps,ps.current)}function ms(e){z(ps),As===e&&(As=null),z(Nt)}var Nt=D(0);function nr(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Qo(s)||Jo(s)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){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}var Qs=0,Ie=null,lt=null,zt=null,ar=!1,yn=!1,Xi=!1,rr=0,aa=0,Sn=null,Jm=0;function kt(){throw Error(S(321))}function Yl(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!ds(e[s],t[s]))return!1;return!0}function Kl(e,t,s,i,r,c){return Qs=c,Ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Rh:oo,Xi=!1,c=s(i,r),Xi=!1,yn&&(c=Xu(t,s,i,r)),Ku(e),c}function Ku(e){F.H=oa;var t=lt!==null&&lt.next!==null;if(Qs=0,zt=lt=Ie=null,ar=!1,aa=0,Sn=null,t)throw Error(S(300));e===null||Ut||(e=e.dependencies,e!==null&&Va(e)&&(Ut=!0))}function Xu(e,t,s,i){Ie=e;var r=0;do{if(yn&&(Sn=null),aa=0,yn=!1,25<=r)throw Error(S(301));if(r+=1,zt=lt=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}F.H=Th,c=t(s,i)}while(yn);return c}function e_(){var e=F.H,t=e.useState()[0];return t=typeof t.then=="function"?ra(t):t,e=e.useState()[0],(lt!==null?lt.memoizedState:null)!==e&&(Ie.flags|=1024),t}function Xl(){var e=rr!==0;return rr=0,e}function Gl(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Vl(e){if(ar){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ar=!1}Qs=0,zt=lt=Ie=null,yn=!1,aa=rr=0,Sn=null}function ts(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?Ie.memoizedState=zt=e:zt=zt.next=e,zt}function Mt(){if(lt===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=lt.next;var t=zt===null?Ie.memoizedState:zt.next;if(t!==null)zt=t,lt=e;else{if(e===null)throw Ie.alternate===null?Error(S(467)):Error(S(310));lt=e,e={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},zt===null?Ie.memoizedState=zt=e:zt=zt.next=e}return zt}function lr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ra(e){var t=aa;return aa+=1,Sn===null&&(Sn=[]),e=zu(Sn,e,t),t=Ie,(zt===null?t.memoizedState:zt.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Rh:oo),e}function or(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ra(e);if(e.$$typeof===o)return Kt(e)}throw Error(S(438,String(e)))}function Zl(e){var t=null,s=Ie.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=Ie.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=lr(),Ie.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=H;return t.index++,s}function Js(e,t){return typeof t=="function"?t(e):t}function cr(e){var t=Mt();return Ql(t,lt,e)}function Ql(e,t,s){var i=e.queue;if(i===null)throw Error(S(311));i.lastRenderedReducer=s;var r=e.baseQueue,c=i.pending;if(c!==null){if(r!==null){var j=r.next;r.next=c.next,c.next=j}t.baseQueue=r=c,i.pending=null}if(c=e.baseState,r===null)e.memoizedState=c;else{t=r.next;var B=j=null,K=null,ie=t,he=!1;do{var me=ie.lane&-536870913;if(me!==ie.lane?(Xe&me)===me:(Qs&me)===me){var ae=ie.revertLane;if(ae===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),me===pn&&(he=!0);else if((Qs&ae)===ae){ie=ie.next,ae===pn&&(he=!0);continue}else me={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(B=K=me,j=c):K=K.next=me,Ie.lanes|=ae,wi|=ae;me=ie.action,Xi&&s(c,me),c=ie.hasEagerState?ie.eagerState:s(c,me)}else ae={lane:me,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},K===null?(B=K=ae,j=c):K=K.next=ae,Ie.lanes|=me,wi|=me;ie=ie.next}while(ie!==null&&ie!==t);if(K===null?j=c:K.next=B,!ds(c,e.memoizedState)&&(Ut=!0,he&&(s=mn,s!==null)))throw s;e.memoizedState=c,e.baseState=j,e.baseQueue=K,i.lastRenderedState=c}return r===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Jl(e){var t=Mt(),s=t.queue;if(s===null)throw Error(S(311));s.lastRenderedReducer=e;var i=s.dispatch,r=s.pending,c=t.memoizedState;if(r!==null){s.pending=null;var j=r=r.next;do c=e(c,j.action),j=j.next;while(j!==r);ds(c,t.memoizedState)||(Ut=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),s.lastRenderedState=c}return[c,i]}function Gu(e,t,s){var i=Ie,r=Mt(),c=Ve;if(c){if(s===void 0)throw Error(S(407));s=s()}else s=t();var j=!ds((lt||r).memoizedState,s);if(j&&(r.memoizedState=s,Ut=!0),r=r.queue,so(Qu.bind(null,i,r,e),[e]),r.getSnapshot!==t||j||zt!==null&&zt.memoizedState.tag&1){if(i.flags|=2048,bn(9,{destroy:void 0},Zu.bind(null,i,r,s,t),null),dt===null)throw Error(S(349));c||(Qs&127)!==0||Vu(i,t,s)}return s}function Vu(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=Ie.updateQueue,t===null?(t=lr(),Ie.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Zu(e,t,s,i){t.value=s,t.getSnapshot=i,Ju(t)&&eh(e)}function Qu(e,t,s){return s(function(){Ju(t)&&eh(e)})}function Ju(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!ds(e,s)}catch{return!0}}function eh(e){var t=Ui(e,2);t!==null&&us(t,e,2)}function eo(e){var t=ts();if(typeof e=="function"){var s=e;if(e=s(),Xi){Rt(!0);try{s()}finally{Rt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Js,lastRenderedState:e},t}function th(e,t,s,i){return e.baseState=s,Ql(e,lt,typeof i=="function"?i:Js)}function t_(e,t,s,i,r){if(dr(e))throw Error(S(485));if(e=t.action,e!==null){var c={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){c.listeners.push(j)}};F.T!==null?s(!0):c.isTransition=!1,i(c),s=t.pending,s===null?(c.next=t.pending=c,sh(t,c)):(c.next=s.next,t.pending=s.next=c)}}function sh(e,t){var s=t.action,i=t.payload,r=e.state;if(t.isTransition){var c=F.T,j={};F.T=j;try{var B=s(r,i),K=F.S;K!==null&&K(j,B),ih(e,t,B)}catch(ie){to(e,t,ie)}finally{c!==null&&j.types!==null&&(c.types=j.types),F.T=c}}else try{c=s(r,i),ih(e,t,c)}catch(ie){to(e,t,ie)}}function ih(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){nh(e,t,i)},function(i){return to(e,t,i)}):nh(e,t,s)}function nh(e,t,s){t.status="fulfilled",t.value=s,ah(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,sh(e,s)))}function to(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,ah(t),t=t.next;while(t!==i)}e.action=null}function ah(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function rh(e,t){return t}function lh(e,t){if(Ve){var s=dt.formState;if(s!==null){e:{var i=Ie;if(Ve){if(mt){t:{for(var r=mt,c=ks;r.nodeType!==8;){if(!c){r=null;break t}if(r=js(r.nextSibling),r===null){r=null;break t}}c=r.data,r=c==="F!"||c==="F"?r:null}if(r){mt=js(r.nextSibling),i=r.data==="F!";break e}}pi(i)}i=!1}i&&(t=s[0])}}return s=ts(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rh,lastRenderedState:t},s.queue=i,s=kh.bind(null,Ie,i),i.dispatch=s,i=eo(!1),c=lo.bind(null,Ie,!1,i.queue),i=ts(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,s=t_.bind(null,Ie,r,c,s),r.dispatch=s,i.memoizedState=e,[t,s,!1]}function oh(e){var t=Mt();return ch(t,lt,e)}function ch(e,t,s){if(t=Ql(e,t,rh)[0],e=cr(Js)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ra(t)}catch(j){throw j===_n?Ja:j}else i=t;t=Mt();var r=t.queue,c=r.dispatch;return s!==t.memoizedState&&(Ie.flags|=2048,bn(9,{destroy:void 0},s_.bind(null,r,s),null)),[i,c,e]}function s_(e,t){e.action=t}function uh(e){var t=Mt(),s=lt;if(s!==null)return ch(t,s,e);Mt(),t=t.memoizedState,s=Mt();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function bn(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=Ie.updateQueue,t===null&&(t=lr(),Ie.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function hh(){return Mt().memoizedState}function ur(e,t,s,i){var r=ts();Ie.flags|=e,r.memoizedState=bn(1|t,{destroy:void 0},s,i===void 0?null:i)}function hr(e,t,s,i){var r=Mt();i=i===void 0?null:i;var c=r.memoizedState.inst;lt!==null&&i!==null&&Yl(i,lt.memoizedState.deps)?r.memoizedState=bn(t,c,s,i):(Ie.flags|=e,r.memoizedState=bn(1|t,c,s,i))}function dh(e,t){ur(8390656,8,e,t)}function so(e,t){hr(2048,8,e,t)}function i_(e){Ie.flags|=4;var t=Ie.updateQueue;if(t===null)t=lr(),Ie.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function fh(e){var t=Mt().memoizedState;return i_({ref:t,nextImpl:e}),function(){if((tt&2)!==0)throw Error(S(440));return t.impl.apply(void 0,arguments)}}function ph(e,t){return hr(4,2,e,t)}function mh(e,t){return hr(4,4,e,t)}function _h(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function vh(e,t,s){s=s!=null?s.concat([e]):null,hr(4,4,_h.bind(null,t,e),s)}function io(){}function gh(e,t){var s=Mt();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Yl(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function yh(e,t){var s=Mt();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Yl(t,i[1]))return i[0];if(i=e(),Xi){Rt(!0);try{e()}finally{Rt(!1)}}return s.memoizedState=[i,t],i}function no(e,t,s){return s===void 0||(Qs&1073741824)!==0&&(Xe&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=Sd(),Ie.lanes|=e,wi|=e,s)}function Sh(e,t,s,i){return ds(s,t)?s:gn.current!==null?(e=no(e,s,i),ds(e,t)||(Ut=!0),e):(Qs&42)===0||(Qs&1073741824)!==0&&(Xe&261930)===0?(Ut=!0,e.memoizedState=s):(e=Sd(),Ie.lanes|=e,wi|=e,t)}function bh(e,t,s,i,r){var c=Y.p;Y.p=c!==0&&8>c?c:8;var j=F.T,B={};F.T=B,lo(e,!1,t,s);try{var K=r(),ie=F.S;if(ie!==null&&ie(B,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var he=Qm(K,i);la(e,t,he,gs(e))}else la(e,t,i,gs(e))}catch(me){la(e,t,{then:function(){},status:"rejected",reason:me},gs())}finally{Y.p=c,j!==null&&B.types!==null&&(j.types=B.types),F.T=j}}function n_(){}function ao(e,t,s,i){if(e.tag!==5)throw Error(S(476));var r=Ch(e).queue;bh(e,r,t,V,s===null?n_:function(){return wh(e),s(i)})}function Ch(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Js,lastRenderedState:V},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Js,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function wh(e){var t=Ch(e);t.next===null&&(t=e.alternate.memoizedState),la(e,t.next.queue,{},gs())}function ro(){return Kt(xa)}function xh(){return Mt().memoizedState}function Eh(){return Mt().memoizedState}function a_(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=gs();e=vi(s);var i=gi(t,e,s);i!==null&&(us(i,t,s),sa(i,t,s)),t={cache:Ol()},e.payload=t;return}t=t.return}}function r_(e,t,s){var i=gs();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},dr(e)?Ah(t,s):(s=xl(e,t,s,i),s!==null&&(us(s,e,i),jh(s,t,i)))}function kh(e,t,s){var i=gs();la(e,t,s,i)}function la(e,t,s,i){var r={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(dr(e))Ah(t,r);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var j=t.lastRenderedState,B=c(j,s);if(r.hasEagerState=!0,r.eagerState=B,ds(B,j))return Ya(e,t,r,0),dt===null&&Fa(),!1}catch{}finally{}if(s=xl(e,t,r,i),s!==null)return us(s,e,i),jh(s,t,i),!0}return!1}function lo(e,t,s,i){if(i={lane:2,revertLane:Io(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},dr(e)){if(t)throw Error(S(479))}else t=xl(e,s,i,2),t!==null&&us(t,e,2)}function dr(e){var t=e.alternate;return e===Ie||t!==null&&t===Ie}function Ah(e,t){yn=ar=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function jh(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,et(e,s)}}var oa={readContext:Kt,use:or,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};oa.useEffectEvent=kt;var Rh={readContext:Kt,use:or,useCallback:function(e,t){return ts().memoizedState=[e,t===void 0?null:t],e},useContext:Kt,useEffect:dh,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,ur(4194308,4,_h.bind(null,t,e),s)},useLayoutEffect:function(e,t){return ur(4194308,4,e,t)},useInsertionEffect:function(e,t){ur(4,2,e,t)},useMemo:function(e,t){var s=ts();t=t===void 0?null:t;var i=e();if(Xi){Rt(!0);try{e()}finally{Rt(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=ts();if(s!==void 0){var r=s(t);if(Xi){Rt(!0);try{s(t)}finally{Rt(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=r_.bind(null,Ie,e),[i.memoizedState,e]},useRef:function(e){var t=ts();return e={current:e},t.memoizedState=e},useState:function(e){e=eo(e);var t=e.queue,s=kh.bind(null,Ie,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:io,useDeferredValue:function(e,t){var s=ts();return no(s,e,t)},useTransition:function(){var e=eo(!1);return e=bh.bind(null,Ie,e.queue,!0,!1),ts().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=Ie,r=ts();if(Ve){if(s===void 0)throw Error(S(407));s=s()}else{if(s=t(),dt===null)throw Error(S(349));(Xe&127)!==0||Vu(i,t,s)}r.memoizedState=s;var c={value:s,getSnapshot:t};return r.queue=c,dh(Qu.bind(null,i,c,e),[e]),i.flags|=2048,bn(9,{destroy:void 0},Zu.bind(null,i,c,s,t),null),s},useId:function(){var e=ts(),t=dt.identifierPrefix;if(Ve){var s=zs,i=Hs;s=(i&~(1<<32-gt(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=rr++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=Jm++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ro,useFormState:lh,useActionState:lh,useOptimistic:function(e){var t=ts();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=lo.bind(null,Ie,!0,s),s.dispatch=t,[e,t]},useMemoCache:Zl,useCacheRefresh:function(){return ts().memoizedState=a_.bind(null,Ie)},useEffectEvent:function(e){var t=ts(),s={impl:e};return t.memoizedState=s,function(){if((tt&2)!==0)throw Error(S(440));return s.impl.apply(void 0,arguments)}}},oo={readContext:Kt,use:or,useCallback:gh,useContext:Kt,useEffect:so,useImperativeHandle:vh,useInsertionEffect:ph,useLayoutEffect:mh,useMemo:yh,useReducer:cr,useRef:hh,useState:function(){return cr(Js)},useDebugValue:io,useDeferredValue:function(e,t){var s=Mt();return Sh(s,lt.memoizedState,e,t)},useTransition:function(){var e=cr(Js)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:ra(e),t]},useSyncExternalStore:Gu,useId:xh,useHostTransitionStatus:ro,useFormState:oh,useActionState:oh,useOptimistic:function(e,t){var s=Mt();return th(s,lt,e,t)},useMemoCache:Zl,useCacheRefresh:Eh};oo.useEffectEvent=fh;var Th={readContext:Kt,use:or,useCallback:gh,useContext:Kt,useEffect:so,useImperativeHandle:vh,useInsertionEffect:ph,useLayoutEffect:mh,useMemo:yh,useReducer:Jl,useRef:hh,useState:function(){return Jl(Js)},useDebugValue:io,useDeferredValue:function(e,t){var s=Mt();return lt===null?no(s,e,t):Sh(s,lt.memoizedState,e,t)},useTransition:function(){var e=Jl(Js)[0],t=Mt().memoizedState;return[typeof e=="boolean"?e:ra(e),t]},useSyncExternalStore:Gu,useId:xh,useHostTransitionStatus:ro,useFormState:uh,useActionState:uh,useOptimistic:function(e,t){var s=Mt();return lt!==null?th(s,lt,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Zl,useCacheRefresh:Eh};Th.useEffectEvent=fh;function co(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:u({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var uo={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=gs(),r=vi(i);r.payload=t,s!=null&&(r.callback=s),t=gi(e,r,i),t!==null&&(us(t,e,i),sa(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=gs(),r=vi(i);r.tag=1,r.payload=t,s!=null&&(r.callback=s),t=gi(e,r,i),t!==null&&(us(t,e,i),sa(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=gs(),i=vi(s);i.tag=2,t!=null&&(i.callback=t),t=gi(e,i,s),t!==null&&(us(t,e,s),sa(t,e,s))}};function Dh(e,t,s,i,r,c,j){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,c,j):t.prototype&&t.prototype.isPureReactComponent?!Xn(s,i)||!Xn(r,c):!0}function Nh(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&uo.enqueueReplaceState(t,t.state,null)}function Gi(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=u({},s));for(var r in e)s[r]===void 0&&(s[r]=e[r])}return s}function Mh(e){Wa(e)}function Lh(e){console.error(e)}function Oh(e){Wa(e)}function fr(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Bh(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function ho(e,t,s){return s=vi(s),s.tag=3,s.payload={element:null},s.callback=function(){fr(e,t)},s}function Hh(e){return e=vi(e),e.tag=3,e}function zh(e,t,s,i){var r=s.type.getDerivedStateFromError;if(typeof r=="function"){var c=i.value;e.payload=function(){return r(c)},e.callback=function(){Bh(t,s,i)}}var j=s.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(e.callback=function(){Bh(t,s,i),typeof r!="function"&&(xi===null?xi=new Set([this]):xi.add(this));var B=i.stack;this.componentDidCatch(i.value,{componentStack:B!==null?B:""})})}function l_(e,t,s,i,r){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&fn(t,s,r,!0),s=ps.current,s!==null){switch(s.tag){case 31:case 13:return As===null?Er():s.alternate===null&&At===0&&(At=3),s.flags&=-257,s.flags|=65536,s.lanes=r,i===er?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),Ho(e,i,r)),!1;case 22:return s.flags|=65536,i===er?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),Ho(e,i,r)),!1}throw Error(S(435,s.tag))}return Ho(e,i,r),Er(),!1}if(Ve)return t=ps.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,i!==Tl&&(e=Error(S(422),{cause:i}),Zn(ws(e,s)))):(i!==Tl&&(t=Error(S(423),{cause:i}),Zn(ws(t,s))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,i=ws(i,s),r=ho(e.stateNode,i,r),ql(e,r),At!==4&&(At=2)),!1;var c=Error(S(520),{cause:i});if(c=ws(c,s),_a===null?_a=[c]:_a.push(c),At!==4&&(At=2),t===null)return!0;i=ws(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=r&-r,s.lanes|=e,e=ho(s.stateNode,i,e),ql(s,e),!1;case 1:if(t=s.type,c=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(xi===null||!xi.has(c))))return s.flags|=65536,r&=-r,s.lanes|=r,r=Hh(r),zh(r,e,s,i),ql(s,r),!1}s=s.return}while(s!==null);return!1}var fo=Error(S(461)),Ut=!1;function Xt(e,t,s,i){t.child=e===null?$u(t,null,s,i):Ki(t,e.child,s,i)}function Uh(e,t,s,i,r){s=s.render;var c=t.ref;if("ref"in i){var j={};for(var B in i)B!=="ref"&&(j[B]=i[B])}else j=i;return Pi(t),i=Kl(e,t,s,j,c,r),B=Xl(),e!==null&&!Ut?(Gl(e,t,r),ei(e,t,r)):(Ve&&B&&jl(t),t.flags|=1,Xt(e,t,i,r),t.child)}function Ih(e,t,s,i,r){if(e===null){var c=s.type;return typeof c=="function"&&!El(c)&&c.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=c,qh(e,t,c,i,r)):(e=Xa(s.type,null,i,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!bo(e,r)){var j=c.memoizedProps;if(s=s.compare,s=s!==null?s:Xn,s(j,i)&&e.ref===t.ref)return ei(e,t,r)}return t.flags|=1,e=Xs(c,i),e.ref=t.ref,e.return=t,t.child=e}function qh(e,t,s,i,r){if(e!==null){var c=e.memoizedProps;if(Xn(c,i)&&e.ref===t.ref)if(Ut=!1,t.pendingProps=i=c,bo(e,r))(e.flags&131072)!==0&&(Ut=!0);else return t.lanes=e.lanes,ei(e,t,r)}return po(e,t,s,i,r)}function $h(e,t,s,i){var r=i.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|s:s,e!==null){for(i=t.child=e.child,r=0;i!==null;)r=r|i.lanes|i.childLanes,i=i.sibling;i=r&~c}else i=0,t.child=null;return Ph(e,t,c,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Qa(t,c!==null?c.cachePool:null),c!==null?Fu(t,c):Pl(),Yu(t);else return i=t.lanes=536870912,Ph(e,t,c!==null?c.baseLanes|s:s,s,i)}else c!==null?(Qa(t,c.cachePool),Fu(t,c),Si(),t.memoizedState=null):(e!==null&&Qa(t,null),Pl(),Si());return Xt(e,t,r,s),t.child}function ca(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ph(e,t,s,i,r){var c=Hl();return c=c===null?null:{parent:Ht._currentValue,pool:c},t.memoizedState={baseLanes:s,cachePool:c},e!==null&&Qa(t,null),Pl(),Yu(t),e!==null&&fn(e,t,i,!0),t.childLanes=r,null}function pr(e,t){return t=_r({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Wh(e,t,s){return Ki(t,e.child,null,s),e=pr(t,t.pendingProps),e.flags|=2,ms(t),t.memoizedState=null,e}function o_(e,t,s){var i=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ve){if(i.mode==="hidden")return e=pr(t,i),t.lanes=536870912,ca(null,e);if(Fl(t),(e=mt)?(e=sf(e,ks),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:di!==null?{id:Hs,overflow:zs}:null,retryLane:536870912,hydrationErrors:null},s=Au(e),s.return=t,t.child=s,Yt=t,mt=null)):e=null,e===null)throw pi(t);return t.lanes=536870912,null}return pr(t,i)}var c=e.memoizedState;if(c!==null){var j=c.dehydrated;if(Fl(t),r)if(t.flags&256)t.flags&=-257,t=Wh(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(S(558));else if(Ut||fn(e,t,s,!1),r=(s&e.childLanes)!==0,Ut||r){if(i=dt,i!==null&&(j=Et(i,s),j!==0&&j!==c.retryLane))throw c.retryLane=j,Ui(e,j),us(i,e,j),fo;Er(),t=Wh(e,t,s)}else e=c.treeContext,mt=js(j.nextSibling),Yt=t,Ve=!0,fi=null,ks=!1,e!==null&&Tu(t,e),t=pr(t,i),t.flags|=4096;return t}return e=Xs(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mr(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(S(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function po(e,t,s,i,r){return Pi(t),s=Kl(e,t,s,i,void 0,r),i=Xl(),e!==null&&!Ut?(Gl(e,t,r),ei(e,t,r)):(Ve&&i&&jl(t),t.flags|=1,Xt(e,t,s,r),t.child)}function Fh(e,t,s,i,r,c){return Pi(t),t.updateQueue=null,s=Xu(t,i,s,r),Ku(e),i=Xl(),e!==null&&!Ut?(Gl(e,t,c),ei(e,t,c)):(Ve&&i&&jl(t),t.flags|=1,Xt(e,t,s,c),t.child)}function Yh(e,t,s,i,r){if(Pi(t),t.stateNode===null){var c=cn,j=s.contextType;typeof j=="object"&&j!==null&&(c=Kt(j)),c=new s(i,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=uo,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=i,c.state=t.memoizedState,c.refs={},Ul(t),j=s.contextType,c.context=typeof j=="object"&&j!==null?Kt(j):cn,c.state=t.memoizedState,j=s.getDerivedStateFromProps,typeof j=="function"&&(co(t,s,j,i),c.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(j=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),j!==c.state&&uo.enqueueReplaceState(c,c.state,null),na(t,i,c,r),ia(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){c=t.stateNode;var B=t.memoizedProps,K=Gi(s,B);c.props=K;var ie=c.context,he=s.contextType;j=cn,typeof he=="object"&&he!==null&&(j=Kt(he));var me=s.getDerivedStateFromProps;he=typeof me=="function"||typeof c.getSnapshotBeforeUpdate=="function",B=t.pendingProps!==B,he||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(B||ie!==j)&&Nh(t,c,i,j),_i=!1;var ae=t.memoizedState;c.state=ae,na(t,i,c,r),ia(),ie=t.memoizedState,B||ae!==ie||_i?(typeof me=="function"&&(co(t,s,me,i),ie=t.memoizedState),(K=_i||Dh(t,s,K,i,ae,ie,j))?(he||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=ie),c.props=i,c.state=ie,c.context=j,i=K):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{c=t.stateNode,Il(e,t),j=t.memoizedProps,he=Gi(s,j),c.props=he,me=t.pendingProps,ae=c.context,ie=s.contextType,K=cn,typeof ie=="object"&&ie!==null&&(K=Kt(ie)),B=s.getDerivedStateFromProps,(ie=typeof B=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(j!==me||ae!==K)&&Nh(t,c,i,K),_i=!1,ae=t.memoizedState,c.state=ae,na(t,i,c,r),ia();var ce=t.memoizedState;j!==me||ae!==ce||_i||e!==null&&e.dependencies!==null&&Va(e.dependencies)?(typeof B=="function"&&(co(t,s,B,i),ce=t.memoizedState),(he=_i||Dh(t,s,he,i,ae,ce,K)||e!==null&&e.dependencies!==null&&Va(e.dependencies))?(ie||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(i,ce,K),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(i,ce,K)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||j===e.memoizedProps&&ae===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&ae===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=ce),c.props=i,c.state=ce,c.context=K,i=he):(typeof c.componentDidUpdate!="function"||j===e.memoizedProps&&ae===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&ae===e.memoizedState||(t.flags|=1024),i=!1)}return c=i,mr(e,t),i=(t.flags&128)!==0,c||i?(c=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&i?(t.child=Ki(t,e.child,null,r),t.child=Ki(t,null,s,r)):Xt(e,t,s,r),t.memoizedState=c.state,e=t.child):e=ei(e,t,r),e}function Kh(e,t,s,i){return qi(),t.flags|=256,Xt(e,t,s,i),t.child}var mo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _o(e){return{baseLanes:e,cachePool:Bu()}}function vo(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=vs),e}function Xh(e,t,s){var i=t.pendingProps,r=!1,c=(t.flags&128)!==0,j;if((j=c)||(j=e!==null&&e.memoizedState===null?!1:(Nt.current&2)!==0),j&&(r=!0,t.flags&=-129),j=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ve){if(r?yi(t):Si(),(e=mt)?(e=sf(e,ks),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:di!==null?{id:Hs,overflow:zs}:null,retryLane:536870912,hydrationErrors:null},s=Au(e),s.return=t,t.child=s,Yt=t,mt=null)):e=null,e===null)throw pi(t);return Jo(e)?t.lanes=32:t.lanes=536870912,null}var B=i.children;return i=i.fallback,r?(Si(),r=t.mode,B=_r({mode:"hidden",children:B},r),i=Ii(i,r,s,null),B.return=t,i.return=t,B.sibling=i,t.child=B,i=t.child,i.memoizedState=_o(s),i.childLanes=vo(e,j,s),t.memoizedState=mo,ca(null,i)):(yi(t),go(t,B))}var K=e.memoizedState;if(K!==null&&(B=K.dehydrated,B!==null)){if(c)t.flags&256?(yi(t),t.flags&=-257,t=yo(e,t,s)):t.memoizedState!==null?(Si(),t.child=e.child,t.flags|=128,t=null):(Si(),B=i.fallback,r=t.mode,i=_r({mode:"visible",children:i.children},r),B=Ii(B,r,s,null),B.flags|=2,i.return=t,B.return=t,i.sibling=B,t.child=i,Ki(t,e.child,null,s),i=t.child,i.memoizedState=_o(s),i.childLanes=vo(e,j,s),t.memoizedState=mo,t=ca(null,i));else if(yi(t),Jo(B)){if(j=B.nextSibling&&B.nextSibling.dataset,j)var ie=j.dgst;j=ie,i=Error(S(419)),i.stack="",i.digest=j,Zn({value:i,source:null,stack:null}),t=yo(e,t,s)}else if(Ut||fn(e,t,s,!1),j=(s&e.childLanes)!==0,Ut||j){if(j=dt,j!==null&&(i=Et(j,s),i!==0&&i!==K.retryLane))throw K.retryLane=i,Ui(e,i),us(j,e,i),fo;Qo(B)||Er(),t=yo(e,t,s)}else Qo(B)?(t.flags|=192,t.child=e.child,t=null):(e=K.treeContext,mt=js(B.nextSibling),Yt=t,Ve=!0,fi=null,ks=!1,e!==null&&Tu(t,e),t=go(t,i.children),t.flags|=4096);return t}return r?(Si(),B=i.fallback,r=t.mode,K=e.child,ie=K.sibling,i=Xs(K,{mode:"hidden",children:i.children}),i.subtreeFlags=K.subtreeFlags&65011712,ie!==null?B=Xs(ie,B):(B=Ii(B,r,s,null),B.flags|=2),B.return=t,i.return=t,i.sibling=B,t.child=i,ca(null,i),i=t.child,B=e.child.memoizedState,B===null?B=_o(s):(r=B.cachePool,r!==null?(K=Ht._currentValue,r=r.parent!==K?{parent:K,pool:K}:r):r=Bu(),B={baseLanes:B.baseLanes|s,cachePool:r}),i.memoizedState=B,i.childLanes=vo(e,j,s),t.memoizedState=mo,ca(e.child,i)):(yi(t),s=e.child,e=s.sibling,s=Xs(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(j=t.deletions,j===null?(t.deletions=[e],t.flags|=16):j.push(e)),t.child=s,t.memoizedState=null,s)}function go(e,t){return t=_r({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function _r(e,t){return e=fs(22,e,null,t),e.lanes=0,e}function yo(e,t,s){return Ki(t,e.child,null,s),e=go(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gh(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ml(e.return,t,s)}function So(e,t,s,i,r,c){var j=e.memoizedState;j===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:r,treeForkCount:c}:(j.isBackwards=t,j.rendering=null,j.renderingStartTime=0,j.last=i,j.tail=s,j.tailMode=r,j.treeForkCount=c)}function Vh(e,t,s){var i=t.pendingProps,r=i.revealOrder,c=i.tail;i=i.children;var j=Nt.current,B=(j&2)!==0;if(B?(j=j&1|2,t.flags|=128):j&=1,Q(Nt,j),Xt(e,t,i,s),i=Ve?Vn:0,!B&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gh(e,s,t);else if(e.tag===19)Gh(e,s,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}switch(r){case"forwards":for(s=t.child,r=null;s!==null;)e=s.alternate,e!==null&&nr(e)===null&&(r=s),s=s.sibling;s=r,s===null?(r=t.child,t.child=null):(r=s.sibling,s.sibling=null),So(t,!1,r,s,c,i);break;case"backwards":case"unstable_legacy-backwards":for(s=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&nr(e)===null){t.child=r;break}e=r.sibling,r.sibling=s,s=r,r=e}So(t,!0,s,null,c,i);break;case"together":So(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function ei(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),wi|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(fn(e,t,s,!1),(s&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(S(153));if(t.child!==null){for(e=t.child,s=Xs(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Xs(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function bo(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Va(e)))}function c_(e,t,s){switch(t.tag){case 3:O(t,t.stateNode.containerInfo),mi(t,Ht,e.memoizedState.cache),qi();break;case 27:case 5:oe(t);break;case 4:O(t,t.stateNode.containerInfo);break;case 10:mi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Fl(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(yi(t),t.flags|=128,null):(s&t.child.childLanes)!==0?Xh(e,t,s):(yi(t),e=ei(e,t,s),e!==null?e.sibling:null);yi(t);break;case 19:var r=(e.flags&128)!==0;if(i=(s&t.childLanes)!==0,i||(fn(e,t,s,!1),i=(s&t.childLanes)!==0),r){if(i)return Vh(e,t,s);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Q(Nt,Nt.current),i)break;return null;case 22:return t.lanes=0,$h(e,t,s,t.pendingProps);case 24:mi(t,Ht,e.memoizedState.cache)}return ei(e,t,s)}function Zh(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ut=!0;else{if(!bo(e,s)&&(t.flags&128)===0)return Ut=!1,c_(e,t,s);Ut=(e.flags&131072)!==0}else Ut=!1,Ve&&(t.flags&1048576)!==0&&Ru(t,Vn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Fi(t.elementType),t.type=e,typeof e=="function")El(e)?(i=Gi(e,i),t.tag=1,t=Yh(null,t,e,i,s)):(t.tag=0,t=po(null,t,e,i,s));else{if(e!=null){var r=e.$$typeof;if(r===y){t.tag=11,t=Uh(null,t,e,i,s);break e}else if(r===R){t.tag=14,t=Ih(null,t,e,i,s);break e}}throw t=Z(e)||e,Error(S(306,t,""))}}return t;case 0:return po(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,r=Gi(i,t.pendingProps),Yh(e,t,i,r,s);case 3:e:{if(O(t,t.stateNode.containerInfo),e===null)throw Error(S(387));i=t.pendingProps;var c=t.memoizedState;r=c.element,Il(e,t),na(t,i,null,s);var j=t.memoizedState;if(i=j.cache,mi(t,Ht,i),i!==c.cache&&Ll(t,[Ht],s,!0),ia(),i=j.element,c.isDehydrated)if(c={element:i,isDehydrated:!1,cache:j.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Kh(e,t,i,s);break e}else if(i!==r){r=ws(Error(S(424)),t),Zn(r),t=Kh(e,t,i,s);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(mt=js(e.firstChild),Yt=t,Ve=!0,fi=null,ks=!0,s=$u(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(qi(),i===r){t=ei(e,t,s);break e}Xt(e,t,i,s)}t=t.child}return t;case 26:return mr(e,t),e===null?(s=cf(t.type,null,t.pendingProps,null))?t.memoizedState=s:Ve||(s=t.type,e=t.pendingProps,i=Nr(Ce.current).createElement(s),i[We]=t,i[ue]=e,Gt(i,s,e),Bt(i),t.stateNode=i):t.memoizedState=cf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return oe(t),e===null&&Ve&&(i=t.stateNode=rf(t.type,t.pendingProps,Ce.current),Yt=t,ks=!0,r=mt,ji(t.type)?(ec=r,mt=js(i.firstChild)):mt=r),Xt(e,t,t.pendingProps.children,s),mr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ve&&((r=i=mt)&&(i=U_(i,t.type,t.pendingProps,ks),i!==null?(t.stateNode=i,Yt=t,mt=js(i.firstChild),ks=!1,r=!0):r=!1),r||pi(t)),oe(t),r=t.type,c=t.pendingProps,j=e!==null?e.memoizedProps:null,i=c.children,Go(r,c)?i=null:j!==null&&Go(r,j)&&(t.flags|=32),t.memoizedState!==null&&(r=Kl(e,t,e_,null,null,s),xa._currentValue=r),mr(e,t),Xt(e,t,i,s),t.child;case 6:return e===null&&Ve&&((e=s=mt)&&(s=I_(s,t.pendingProps,ks),s!==null?(t.stateNode=s,Yt=t,mt=null,e=!0):e=!1),e||pi(t)),null;case 13:return Xh(e,t,s);case 4:return O(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ki(t,null,i,s):Xt(e,t,i,s),t.child;case 11:return Uh(e,t,t.type,t.pendingProps,s);case 7:return Xt(e,t,t.pendingProps,s),t.child;case 8:return Xt(e,t,t.pendingProps.children,s),t.child;case 12:return Xt(e,t,t.pendingProps.children,s),t.child;case 10:return i=t.pendingProps,mi(t,t.type,i.value),Xt(e,t,i.children,s),t.child;case 9:return r=t.type._context,i=t.pendingProps.children,Pi(t),r=Kt(r),i=i(r),t.flags|=1,Xt(e,t,i,s),t.child;case 14:return Ih(e,t,t.type,t.pendingProps,s);case 15:return qh(e,t,t.type,t.pendingProps,s);case 19:return Vh(e,t,s);case 31:return o_(e,t,s);case 22:return $h(e,t,s,t.pendingProps);case 24:return Pi(t),i=Kt(Ht),e===null?(r=Hl(),r===null&&(r=dt,c=Ol(),r.pooledCache=c,c.refCount++,c!==null&&(r.pooledCacheLanes|=s),r=c),t.memoizedState={parent:i,cache:r},Ul(t),mi(t,Ht,r)):((e.lanes&s)!==0&&(Il(e,t),na(t,null,null,s),ia()),r=e.memoizedState,c=t.memoizedState,r.parent!==i?(r={parent:i,cache:i},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),mi(t,Ht,i)):(i=c.cache,mi(t,Ht,i),i!==r.cache&&Ll(t,[Ht],s,!0))),Xt(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(S(156,t.tag))}function ti(e){e.flags|=4}function Co(e,t,s,i,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(xd())e.flags|=8192;else throw Yi=er,zl}else e.flags&=-16777217}function Qh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!pf(t))if(xd())e.flags|=8192;else throw Yi=er,zl}function vr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?be():536870912,e.lanes|=t,En|=t)}function ua(e,t){if(!Ve)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function _t(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var r=e.child;r!==null;)s|=r.lanes|r.childLanes,i|=r.subtreeFlags&65011712,i|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)s|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function u_(e,t,s){var i=t.pendingProps;switch(Rl(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(t),null;case 1:return _t(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Zs(Ht),ee(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(dn(t)?ti(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Dl())),_t(t),null;case 26:var r=t.type,c=t.memoizedState;return e===null?(ti(t),c!==null?(_t(t),Qh(t,c)):(_t(t),Co(t,r,null,i,s))):c?c!==e.memoizedState?(ti(t),_t(t),Qh(t,c)):(_t(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ti(t),_t(t),Co(t,r,e,i,s)),null;case 27:if(Se(t),s=Ce.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ti(t);else{if(!i){if(t.stateNode===null)throw Error(S(166));return _t(t),null}e=ne.current,dn(t)?Du(t):(e=rf(r,i,s),t.stateNode=e,ti(t))}return _t(t),null;case 5:if(Se(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ti(t);else{if(!i){if(t.stateNode===null)throw Error(S(166));return _t(t),null}if(c=ne.current,dn(t))Du(t);else{var j=Nr(Ce.current);switch(c){case 1:c=j.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:c=j.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":c=j.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":c=j.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":c=j.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof i.is=="string"?j.createElement("select",{is:i.is}):j.createElement("select"),i.multiple?c.multiple=!0:i.size&&(c.size=i.size);break;default:c=typeof i.is=="string"?j.createElement(r,{is:i.is}):j.createElement(r)}}c[We]=t,c[ue]=i;e:for(j=t.child;j!==null;){if(j.tag===5||j.tag===6)c.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===t)break e;for(;j.sibling===null;){if(j.return===null||j.return===t)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}t.stateNode=c;e:switch(Gt(c,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ti(t)}}return _t(t),Co(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ti(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(S(166));if(e=Ce.current,dn(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,r=Yt,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[We]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||Xd(e.nodeValue,s)),e||pi(t,!0)}else e=Nr(e).createTextNode(i),e[We]=t,t.stateNode=e}return _t(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=dn(t),s!==null){if(e===null){if(!i)throw Error(S(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(S(557));e[We]=t}else qi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_t(t),e=!1}else s=Dl(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(ms(t),t):(ms(t),null);if((t.flags&128)!==0)throw Error(S(558))}return _t(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=dn(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(S(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(S(317));r[We]=t}else qi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;_t(t),r=!1}else r=Dl(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ms(t),t):(ms(t),null)}return ms(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),c=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),c!==r&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),vr(t,t.updateQueue),_t(t),null);case 4:return ee(),e===null&&Wo(t.stateNode.containerInfo),_t(t),null;case 10:return Zs(t.type),_t(t),null;case 19:if(z(Nt),i=t.memoizedState,i===null)return _t(t),null;if(r=(t.flags&128)!==0,c=i.rendering,c===null)if(r)ua(i,!1);else{if(At!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=nr(e),c!==null){for(t.flags|=128,ua(i,!1),e=c.updateQueue,t.updateQueue=e,vr(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)ku(s,e),s=s.sibling;return Q(Nt,Nt.current&1|2),Ve&&Gs(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&it()>Cr&&(t.flags|=128,r=!0,ua(i,!1),t.lanes=4194304)}else{if(!r)if(e=nr(c),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,vr(t,e),ua(i,!0),i.tail===null&&i.tailMode==="hidden"&&!c.alternate&&!Ve)return _t(t),null}else 2*it()-i.renderingStartTime>Cr&&s!==536870912&&(t.flags|=128,r=!0,ua(i,!1),t.lanes=4194304);i.isBackwards?(c.sibling=t.child,t.child=c):(e=i.last,e!==null?e.sibling=c:t.child=c,i.last=c)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=it(),e.sibling=null,s=Nt.current,Q(Nt,r?s&1|2:s&1),Ve&&Gs(t,i.treeForkCount),e):(_t(t),null);case 22:case 23:return ms(t),Wl(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(_t(t),t.subtreeFlags&6&&(t.flags|=8192)):_t(t),s=t.updateQueue,s!==null&&vr(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&z(Wi),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Zs(Ht),_t(t),null;case 25:return null;case 30:return null}throw Error(S(156,t.tag))}function h_(e,t){switch(Rl(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zs(Ht),ee(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Se(t),null;case 31:if(t.memoizedState!==null){if(ms(t),t.alternate===null)throw Error(S(340));qi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ms(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));qi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(Nt),null;case 4:return ee(),null;case 10:return Zs(t.type),null;case 22:case 23:return ms(t),Wl(),e!==null&&z(Wi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zs(Ht),null;case 25:return null;default:return null}}function Jh(e,t){switch(Rl(t),t.tag){case 3:Zs(Ht),ee();break;case 26:case 27:case 5:Se(t);break;case 4:ee();break;case 31:t.memoizedState!==null&&ms(t);break;case 13:ms(t);break;case 19:z(Nt);break;case 10:Zs(t.type);break;case 22:case 23:ms(t),Wl(),e!==null&&z(Wi);break;case 24:Zs(Ht)}}function ha(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var r=i.next;s=r;do{if((s.tag&e)===e){i=void 0;var c=s.create,j=s.inst;i=c(),j.destroy=i}s=s.next}while(s!==r)}}catch(B){rt(t,t.return,B)}}function bi(e,t,s){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var c=r.next;i=c;do{if((i.tag&e)===e){var j=i.inst,B=j.destroy;if(B!==void 0){j.destroy=void 0,r=t;var K=s,ie=B;try{ie()}catch(he){rt(r,K,he)}}}i=i.next}while(i!==c)}}catch(he){rt(t,t.return,he)}}function ed(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Wu(t,s)}catch(i){rt(e,e.return,i)}}}function td(e,t,s){s.props=Gi(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){rt(e,t,i)}}function da(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(r){rt(e,t,r)}}function Us(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(r){rt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(r){rt(e,t,r)}else s.current=null}function sd(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(r){rt(e,e.return,r)}}function wo(e,t,s){try{var i=e.stateNode;M_(i,e.type,s,t),i[ue]=t}catch(r){rt(e,e.return,r)}}function id(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ji(e.type)||e.tag===4}function xo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||id(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&&ji(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 Eo(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Ys));else if(i!==4&&(i===27&&ji(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(Eo(e,t,s),e=e.sibling;e!==null;)Eo(e,t,s),e=e.sibling}function gr(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(i!==4&&(i===27&&ji(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(gr(e,t,s),e=e.sibling;e!==null;)gr(e,t,s),e=e.sibling}function nd(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Gt(t,i,s),t[We]=e,t[ue]=s}catch(c){rt(e,e.return,c)}}var si=!1,It=!1,ko=!1,ad=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function d_(e,t){if(e=e.containerInfo,Ko=Ur,e=vu(e),gl(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var r=i.anchorOffset,c=i.focusNode;i=i.focusOffset;try{s.nodeType,c.nodeType}catch{s=null;break e}var j=0,B=-1,K=-1,ie=0,he=0,me=e,ae=null;t:for(;;){for(var ce;me!==s||r!==0&&me.nodeType!==3||(B=j+r),me!==c||i!==0&&me.nodeType!==3||(K=j+i),me.nodeType===3&&(j+=me.nodeValue.length),(ce=me.firstChild)!==null;)ae=me,me=ce;for(;;){if(me===e)break t;if(ae===s&&++ie===r&&(B=j),ae===c&&++he===i&&(K=j),(ce=me.nextSibling)!==null)break;me=ae,ae=me.parentNode}me=ce}s=B===-1||K===-1?null:{start:B,end:K}}else s=null}s=s||{start:0,end:0}}else s=null;for(Xo={focusedElem:e,selectionRange:s},Ur=!1,Wt=t;Wt!==null;)if(t=Wt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Wt=e;else for(;Wt!==null;){switch(t=Wt,c=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)r=e[s],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,s=t,r=c.memoizedProps,c=c.memoizedState,i=s.stateNode;try{var Ae=Gi(s.type,r);e=i.getSnapshotBeforeUpdate(Ae,c),i.__reactInternalSnapshotBeforeUpdate=e}catch(Le){rt(s,s.return,Le)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Zo(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Zo(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(S(163))}if(e=t.sibling,e!==null){e.return=t.return,Wt=e;break}Wt=t.return}}function rd(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:ni(e,s),i&4&&ha(5,s);break;case 1:if(ni(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(j){rt(s,s.return,j)}else{var r=Gi(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(j){rt(s,s.return,j)}}i&64&&ed(s),i&512&&da(s,s.return);break;case 3:if(ni(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Wu(e,t)}catch(j){rt(s,s.return,j)}}break;case 27:t===null&&i&4&&nd(s);case 26:case 5:ni(e,s),t===null&&i&4&&sd(s),i&512&&da(s,s.return);break;case 12:ni(e,s);break;case 31:ni(e,s),i&4&&cd(e,s);break;case 13:ni(e,s),i&4&&ud(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=b_.bind(null,s),q_(e,s))));break;case 22:if(i=s.memoizedState!==null||si,!i){t=t!==null&&t.memoizedState!==null||It,r=si;var c=It;si=i,(It=t)&&!c?ai(e,s,(s.subtreeFlags&8772)!==0):ni(e,s),si=r,It=c}break;case 30:break;default:ni(e,s)}}function ld(e){var t=e.alternate;t!==null&&(e.alternate=null,ld(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ys(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 St=null,rs=!1;function ii(e,t,s){for(s=s.child;s!==null;)od(e,t,s),s=s.sibling}function od(e,t,s){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(ze,s)}catch{}switch(s.tag){case 26:It||Us(s,t),ii(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:It||Us(s,t);var i=St,r=rs;ji(s.type)&&(St=s.stateNode,rs=!1),ii(e,t,s),ba(s.stateNode),St=i,rs=r;break;case 5:It||Us(s,t);case 6:if(i=St,r=rs,St=null,ii(e,t,s),St=i,rs=r,St!==null)if(rs)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(s.stateNode)}catch(c){rt(s,t,c)}else try{St.removeChild(s.stateNode)}catch(c){rt(s,t,c)}break;case 18:St!==null&&(rs?(e=St,ef(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Mn(e)):ef(St,s.stateNode));break;case 4:i=St,r=rs,St=s.stateNode.containerInfo,rs=!0,ii(e,t,s),St=i,rs=r;break;case 0:case 11:case 14:case 15:bi(2,s,t),It||bi(4,s,t),ii(e,t,s);break;case 1:It||(Us(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&td(s,t,i)),ii(e,t,s);break;case 21:ii(e,t,s);break;case 22:It=(i=It)||s.memoizedState!==null,ii(e,t,s),It=i;break;default:ii(e,t,s)}}function cd(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Mn(e)}catch(s){rt(t,t.return,s)}}}function ud(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Mn(e)}catch(s){rt(t,t.return,s)}}function f_(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ad),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ad),t;default:throw Error(S(435,e.tag))}}function yr(e,t){var s=f_(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var r=C_.bind(null,e,i);i.then(r,r)}})}function ls(e,t){var s=t.deletions;if(s!==null)for(var i=0;i<s.length;i++){var r=s[i],c=e,j=t,B=j;e:for(;B!==null;){switch(B.tag){case 27:if(ji(B.type)){St=B.stateNode,rs=!1;break e}break;case 5:St=B.stateNode,rs=!1;break e;case 3:case 4:St=B.stateNode.containerInfo,rs=!0;break e}B=B.return}if(St===null)throw Error(S(160));od(c,j,r),St=null,rs=!1,c=r.alternate,c!==null&&(c.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hd(t,e),t=t.sibling}var Ls=null;function hd(e,t){var s=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ls(t,e),os(e),i&4&&(bi(3,e,e.return),ha(3,e),bi(5,e,e.return));break;case 1:ls(t,e),os(e),i&512&&(It||s===null||Us(s,s.return)),i&64&&si&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?i:s.concat(i))));break;case 26:var r=Ls;if(ls(t,e),os(e),i&512&&(It||s===null||Us(s,s.return)),i&4){var c=s!==null?s.memoizedState:null;if(i=e.memoizedState,s===null)if(i===null)if(e.stateNode===null){e:{i=e.type,s=e.memoizedProps,r=r.ownerDocument||r;t:switch(i){case"title":c=r.getElementsByTagName("title")[0],(!c||c[hs]||c[We]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=r.createElement(i),r.head.insertBefore(c,r.querySelector("head > title"))),Gt(c,i,s),c[We]=e,Bt(c),i=c;break e;case"link":var j=df("link","href",r).get(i+(s.href||""));if(j){for(var B=0;B<j.length;B++)if(c=j[B],c.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&c.getAttribute("rel")===(s.rel==null?null:s.rel)&&c.getAttribute("title")===(s.title==null?null:s.title)&&c.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){j.splice(B,1);break t}}c=r.createElement(i),Gt(c,i,s),r.head.appendChild(c);break;case"meta":if(j=df("meta","content",r).get(i+(s.content||""))){for(B=0;B<j.length;B++)if(c=j[B],c.getAttribute("content")===(s.content==null?null:""+s.content)&&c.getAttribute("name")===(s.name==null?null:s.name)&&c.getAttribute("property")===(s.property==null?null:s.property)&&c.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&c.getAttribute("charset")===(s.charSet==null?null:s.charSet)){j.splice(B,1);break t}}c=r.createElement(i),Gt(c,i,s),r.head.appendChild(c);break;default:throw Error(S(468,i))}c[We]=e,Bt(c),i=c}e.stateNode=i}else ff(r,e.type,e.stateNode);else e.stateNode=hf(r,i,e.memoizedProps);else c!==i?(c===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):c.count--,i===null?ff(r,e.type,e.stateNode):hf(r,i,e.memoizedProps)):i===null&&e.stateNode!==null&&wo(e,e.memoizedProps,s.memoizedProps)}break;case 27:ls(t,e),os(e),i&512&&(It||s===null||Us(s,s.return)),s!==null&&i&4&&wo(e,e.memoizedProps,s.memoizedProps);break;case 5:if(ls(t,e),os(e),i&512&&(It||s===null||Us(s,s.return)),e.flags&32){r=e.stateNode;try{tn(r,"")}catch(Ae){rt(e,e.return,Ae)}}i&4&&e.stateNode!=null&&(r=e.memoizedProps,wo(e,r,s!==null?s.memoizedProps:r)),i&1024&&(ko=!0);break;case 6:if(ls(t,e),os(e),i&4){if(e.stateNode===null)throw Error(S(162));i=e.memoizedProps,s=e.stateNode;try{s.nodeValue=i}catch(Ae){rt(e,e.return,Ae)}}break;case 3:if(Or=null,r=Ls,Ls=Mr(t.containerInfo),ls(t,e),Ls=r,os(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{Mn(t.containerInfo)}catch(Ae){rt(e,e.return,Ae)}ko&&(ko=!1,dd(e));break;case 4:i=Ls,Ls=Mr(e.stateNode.containerInfo),ls(t,e),os(e),Ls=i;break;case 12:ls(t,e),os(e);break;case 31:ls(t,e),os(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,yr(e,i)));break;case 13:ls(t,e),os(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(br=it()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,yr(e,i)));break;case 22:r=e.memoizedState!==null;var K=s!==null&&s.memoizedState!==null,ie=si,he=It;if(si=ie||r,It=he||K,ls(t,e),It=he,si=ie,os(e),i&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(s===null||K||si||It||Vi(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){K=s=t;try{if(c=K.stateNode,r)j=c.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{B=K.stateNode;var me=K.memoizedProps.style,ae=me!=null&&me.hasOwnProperty("display")?me.display:null;B.style.display=ae==null||typeof ae=="boolean"?"":(""+ae).trim()}}catch(Ae){rt(K,K.return,Ae)}}}else if(t.tag===6){if(s===null){K=t;try{K.stateNode.nodeValue=r?"":K.memoizedProps}catch(Ae){rt(K,K.return,Ae)}}}else if(t.tag===18){if(s===null){K=t;try{var ce=K.stateNode;r?tf(ce,!0):tf(K.stateNode,!1)}catch(Ae){rt(K,K.return,Ae)}}}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;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(s=i.retryQueue,s!==null&&(i.retryQueue=null,yr(e,s))));break;case 19:ls(t,e),os(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,yr(e,i)));break;case 30:break;case 21:break;default:ls(t,e),os(e)}}function os(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(id(i)){s=i;break}i=i.return}if(s==null)throw Error(S(160));switch(s.tag){case 27:var r=s.stateNode,c=xo(e);gr(e,c,r);break;case 5:var j=s.stateNode;s.flags&32&&(tn(j,""),s.flags&=-33);var B=xo(e);gr(e,B,j);break;case 3:case 4:var K=s.stateNode.containerInfo,ie=xo(e);Eo(e,ie,K);break;default:throw Error(S(161))}}catch(he){rt(e,e.return,he)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dd(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;dd(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ni(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)rd(e,t.alternate,t),t=t.sibling}function Vi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:bi(4,t,t.return),Vi(t);break;case 1:Us(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&td(t,t.return,s),Vi(t);break;case 27:ba(t.stateNode);case 26:case 5:Us(t,t.return),Vi(t);break;case 22:t.memoizedState===null&&Vi(t);break;case 30:Vi(t);break;default:Vi(t)}e=e.sibling}}function ai(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,r=e,c=t,j=c.flags;switch(c.tag){case 0:case 11:case 15:ai(r,c,s),ha(4,c);break;case 1:if(ai(r,c,s),i=c,r=i.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(ie){rt(i,i.return,ie)}if(i=c,r=i.updateQueue,r!==null){var B=i.stateNode;try{var K=r.shared.hiddenCallbacks;if(K!==null)for(r.shared.hiddenCallbacks=null,r=0;r<K.length;r++)Pu(K[r],B)}catch(ie){rt(i,i.return,ie)}}s&&j&64&&ed(c),da(c,c.return);break;case 27:nd(c);case 26:case 5:ai(r,c,s),s&&i===null&&j&4&&sd(c),da(c,c.return);break;case 12:ai(r,c,s);break;case 31:ai(r,c,s),s&&j&4&&cd(r,c);break;case 13:ai(r,c,s),s&&j&4&&ud(r,c);break;case 22:c.memoizedState===null&&ai(r,c,s),da(c,c.return);break;case 30:break;default:ai(r,c,s)}t=t.sibling}}function Ao(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Qn(s))}function jo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qn(e))}function Os(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)fd(e,t,s,i),t=t.sibling}function fd(e,t,s,i){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Os(e,t,s,i),r&2048&&ha(9,t);break;case 1:Os(e,t,s,i);break;case 3:Os(e,t,s,i),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qn(e)));break;case 12:if(r&2048){Os(e,t,s,i),e=t.stateNode;try{var c=t.memoizedProps,j=c.id,B=c.onPostCommit;typeof B=="function"&&B(j,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(K){rt(t,t.return,K)}}else Os(e,t,s,i);break;case 31:Os(e,t,s,i);break;case 13:Os(e,t,s,i);break;case 23:break;case 22:c=t.stateNode,j=t.alternate,t.memoizedState!==null?c._visibility&2?Os(e,t,s,i):fa(e,t):c._visibility&2?Os(e,t,s,i):(c._visibility|=2,Cn(e,t,s,i,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Ao(j,t);break;case 24:Os(e,t,s,i),r&2048&&jo(t.alternate,t);break;default:Os(e,t,s,i)}}function Cn(e,t,s,i,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,j=t,B=s,K=i,ie=j.flags;switch(j.tag){case 0:case 11:case 15:Cn(c,j,B,K,r),ha(8,j);break;case 23:break;case 22:var he=j.stateNode;j.memoizedState!==null?he._visibility&2?Cn(c,j,B,K,r):fa(c,j):(he._visibility|=2,Cn(c,j,B,K,r)),r&&ie&2048&&Ao(j.alternate,j);break;case 24:Cn(c,j,B,K,r),r&&ie&2048&&jo(j.alternate,j);break;default:Cn(c,j,B,K,r)}t=t.sibling}}function fa(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,r=i.flags;switch(i.tag){case 22:fa(s,i),r&2048&&Ao(i.alternate,i);break;case 24:fa(s,i),r&2048&&jo(i.alternate,i);break;default:fa(s,i)}t=t.sibling}}var pa=8192;function wn(e,t,s){if(e.subtreeFlags&pa)for(e=e.child;e!==null;)pd(e,t,s),e=e.sibling}function pd(e,t,s){switch(e.tag){case 26:wn(e,t,s),e.flags&pa&&e.memoizedState!==null&&J_(s,Ls,e.memoizedState,e.memoizedProps);break;case 5:wn(e,t,s);break;case 3:case 4:var i=Ls;Ls=Mr(e.stateNode.containerInfo),wn(e,t,s),Ls=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=pa,pa=16777216,wn(e,t,s),pa=i):wn(e,t,s));break;default:wn(e,t,s)}}function md(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 ma(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];Wt=i,vd(i,e)}md(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)_d(e),e=e.sibling}function _d(e){switch(e.tag){case 0:case 11:case 15:ma(e),e.flags&2048&&bi(9,e,e.return);break;case 3:ma(e);break;case 12:ma(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Sr(e)):ma(e);break;default:ma(e)}}function Sr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];Wt=i,vd(i,e)}md(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:bi(8,t,t.return),Sr(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Sr(t));break;default:Sr(t)}e=e.sibling}}function vd(e,t){for(;Wt!==null;){var s=Wt;switch(s.tag){case 0:case 11:case 15:bi(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Qn(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,Wt=i;else e:for(s=e;Wt!==null;){i=Wt;var r=i.sibling,c=i.return;if(ld(i),i===s){Wt=null;break e}if(r!==null){r.return=c,Wt=r;break e}Wt=c}}}var p_={getCacheForType:function(e){var t=Kt(Ht),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return Kt(Ht).controller.signal}},m_=typeof WeakMap=="function"?WeakMap:Map,tt=0,dt=null,Fe=null,Xe=0,at=0,_s=null,Ci=!1,xn=!1,Ro=!1,ri=0,At=0,wi=0,Zi=0,To=0,vs=0,En=0,_a=null,cs=null,Do=!1,br=0,gd=0,Cr=1/0,wr=null,xi=null,$t=0,Ei=null,kn=null,li=0,No=0,Mo=null,yd=null,va=0,Lo=null;function gs(){return(tt&2)!==0&&Xe!==0?Xe&-Xe:F.T!==null?Io():xe()}function Sd(){if(vs===0)if((Xe&536870912)===0||Ve){var e=ns;ns<<=1,(ns&3932160)===0&&(ns=262144),vs=e}else vs=536870912;return e=ps.current,e!==null&&(e.flags|=32),vs}function us(e,t,s){(e===dt&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(An(e,0),ki(e,Xe,vs,!1)),ke(e,s),((tt&2)===0||e!==dt)&&(e===dt&&((tt&2)===0&&(Zi|=s),At===4&&ki(e,Xe,vs,!1)),Is(e))}function bd(e,t,s){if((tt&6)!==0)throw Error(S(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||re(e,t),r=i?g_(e,t):Bo(e,t,!0),c=i;do{if(r===0){xn&&!i&&ki(e,t,0,!1);break}else{if(s=e.current.alternate,c&&!__(s)){r=Bo(e,t,!1),c=!1;continue}if(r===2){if(c=t,e.errorRecoveryDisabledLanes&c)var j=0;else j=e.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){t=j;e:{var B=e;r=_a;var K=B.current.memoizedState.isDehydrated;if(K&&(An(B,j).flags|=256),j=Bo(B,j,!1),j!==2){if(Ro&&!K){B.errorRecoveryDisabledLanes|=c,Zi|=c,r=4;break e}c=cs,cs=r,c!==null&&(cs===null?cs=c:cs.push.apply(cs,c))}r=j}if(c=!1,r!==2)continue}}if(r===1){An(e,0),ki(e,t,0,!0);break}e:{switch(i=e,c=r,c){case 0:case 1:throw Error(S(345));case 4:if((t&4194048)!==t)break;case 6:ki(i,t,vs,!Ci);break e;case 2:cs=null;break;case 3:case 5:break;default:throw Error(S(329))}if((t&62914560)===t&&(r=br+300-it(),10<r)){if(ki(i,t,vs,!Ci),Zt(i,0,!0)!==0)break e;li=t,i.timeoutHandle=Qd(Cd.bind(null,i,s,cs,wr,Do,t,vs,Zi,En,Ci,c,"Throttled",-0,0),r);break e}Cd(i,s,cs,wr,Do,t,vs,Zi,En,Ci,c,null,-0,0)}}break}while(!0);Is(e)}function Cd(e,t,s,i,r,c,j,B,K,ie,he,me,ae,ce){if(e.timeoutHandle=-1,me=t.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ys},pd(t,c,me);var Ae=(c&62914560)===c?br-it():(c&4194048)===c?gd-it():0;if(Ae=ev(me,Ae),Ae!==null){li=c,e.cancelPendingCommit=Ae(Td.bind(null,e,t,c,s,i,r,j,B,K,he,me,null,ae,ce)),ki(e,c,j,!ie);return}}Td(e,t,c,s,i,r,j,B,K)}function __(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var r=s[i],c=r.getSnapshot;r=r.value;try{if(!ds(c(),r))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;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 ki(e,t,s,i){t&=~To,t&=~Zi,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var c=31-gt(r),j=1<<c;i[c]=-1,r&=~j}s!==0&&yt(e,s,t)}function xr(){return(tt&6)===0?(ga(0),!1):!0}function Oo(){if(Fe!==null){if(at===0)var e=Fe.return;else e=Fe,Vs=$i=null,Vl(e),vn=null,ea=0,e=Fe;for(;e!==null;)Jh(e.alternate,e),e=e.return;Fe=null}}function An(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,B_(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),li=0,Oo(),dt=e,Fe=s=Xs(e.current,null),Xe=t,at=0,_s=null,Ci=!1,xn=re(e,t),Ro=!1,En=vs=To=Zi=wi=At=0,cs=_a=null,Do=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var r=31-gt(i),c=1<<r;t|=e[r],i&=~c}return ri=t,Fa(),s}function wd(e,t){Ie=null,F.H=oa,t===_n||t===Ja?(t=Uu(),at=3):t===zl?(t=Uu(),at=4):at=t===fo?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,_s=t,Fe===null&&(At=1,fr(e,ws(t,e.current)))}function xd(){var e=ps.current;return e===null?!0:(Xe&4194048)===Xe?As===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?e===As:!1}function Ed(){var e=F.H;return F.H=oa,e===null?oa:e}function kd(){var e=F.A;return F.A=p_,e}function Er(){At=4,Ci||(Xe&4194048)!==Xe&&ps.current!==null||(xn=!0),(wi&134217727)===0&&(Zi&134217727)===0||dt===null||ki(dt,Xe,vs,!1)}function Bo(e,t,s){var i=tt;tt|=2;var r=Ed(),c=kd();(dt!==e||Xe!==t)&&(wr=null,An(e,t)),t=!1;var j=At;e:do try{if(at!==0&&Fe!==null){var B=Fe,K=_s;switch(at){case 8:Oo(),j=6;break e;case 3:case 2:case 9:case 6:ps.current===null&&(t=!0);var ie=at;if(at=0,_s=null,jn(e,B,K,ie),s&&xn){j=0;break e}break;default:ie=at,at=0,_s=null,jn(e,B,K,ie)}}v_(),j=At;break}catch(he){wd(e,he)}while(!0);return t&&e.shellSuspendCounter++,Vs=$i=null,tt=i,F.H=r,F.A=c,Fe===null&&(dt=null,Xe=0,Fa()),j}function v_(){for(;Fe!==null;)Ad(Fe)}function g_(e,t){var s=tt;tt|=2;var i=Ed(),r=kd();dt!==e||Xe!==t?(wr=null,Cr=it()+500,An(e,t)):xn=re(e,t);e:do try{if(at!==0&&Fe!==null){t=Fe;var c=_s;t:switch(at){case 1:at=0,_s=null,jn(e,t,c,1);break;case 2:case 9:if(Hu(c)){at=0,_s=null,jd(t);break}t=function(){at!==2&&at!==9||dt!==e||(at=7),Is(e)},c.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Hu(c)?(at=0,_s=null,jd(t)):(at=0,_s=null,jn(e,t,c,7));break;case 5:var j=null;switch(Fe.tag){case 26:j=Fe.memoizedState;case 5:case 27:var B=Fe;if(j?pf(j):B.stateNode.complete){at=0,_s=null;var K=B.sibling;if(K!==null)Fe=K;else{var ie=B.return;ie!==null?(Fe=ie,kr(ie)):Fe=null}break t}}at=0,_s=null,jn(e,t,c,5);break;case 6:at=0,_s=null,jn(e,t,c,6);break;case 8:Oo(),At=6;break e;default:throw Error(S(462))}}y_();break}catch(he){wd(e,he)}while(!0);return Vs=$i=null,F.H=i,F.A=r,tt=s,Fe!==null?0:(dt=null,Xe=0,Fa(),At)}function y_(){for(;Fe!==null&&!bt();)Ad(Fe)}function Ad(e){var t=Zh(e.alternate,e,ri);e.memoizedProps=e.pendingProps,t===null?kr(e):Fe=t}function jd(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Fh(s,t,t.pendingProps,t.type,void 0,Xe);break;case 11:t=Fh(s,t,t.pendingProps,t.type.render,t.ref,Xe);break;case 5:Vl(t);default:Jh(s,t),t=Fe=ku(t,ri),t=Zh(s,t,ri)}e.memoizedProps=e.pendingProps,t===null?kr(e):Fe=t}function jn(e,t,s,i){Vs=$i=null,Vl(t),vn=null,ea=0;var r=t.return;try{if(l_(e,r,t,s,Xe)){At=1,fr(e,ws(s,e.current)),Fe=null;return}}catch(c){if(r!==null)throw Fe=r,c;At=1,fr(e,ws(s,e.current)),Fe=null;return}t.flags&32768?(Ve||i===1?e=!0:xn||(Xe&536870912)!==0?e=!1:(Ci=e=!0,(i===2||i===9||i===3||i===6)&&(i=ps.current,i!==null&&i.tag===13&&(i.flags|=16384))),Rd(t,e)):kr(t)}function kr(e){var t=e;do{if((t.flags&32768)!==0){Rd(t,Ci);return}e=t.return;var s=u_(t.alternate,t,ri);if(s!==null){Fe=s;return}if(t=t.sibling,t!==null){Fe=t;return}Fe=t=e}while(t!==null);At===0&&(At=5)}function Rd(e,t){do{var s=h_(e.alternate,e);if(s!==null){s.flags&=32767,Fe=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Fe=e;return}Fe=e=s}while(e!==null);At=6,Fe=null}function Td(e,t,s,i,r,c,j,B,K){e.cancelPendingCommit=null;do Ar();while($t!==0);if((tt&6)!==0)throw Error(S(327));if(t!==null){if(t===e.current)throw Error(S(177));if(c=t.lanes|t.childLanes,c|=wl,ht(e,s,c,j,B,K),e===dt&&(Fe=dt=null,Xe=0),kn=t,Ei=e,li=s,No=c,Mo=r,yd=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,w_(Je,function(){return Od(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=F.T,F.T=null,r=Y.p,Y.p=2,j=tt,tt|=4;try{d_(e,t,s)}finally{tt=j,Y.p=r,F.T=i}}$t=1,Dd(),Nd(),Md()}}function Dd(){if($t===1){$t=0;var e=Ei,t=kn,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=F.T,F.T=null;var i=Y.p;Y.p=2;var r=tt;tt|=4;try{hd(t,e);var c=Xo,j=vu(e.containerInfo),B=c.focusedElem,K=c.selectionRange;if(j!==B&&B&&B.ownerDocument&&_u(B.ownerDocument.documentElement,B)){if(K!==null&&gl(B)){var ie=K.start,he=K.end;if(he===void 0&&(he=ie),"selectionStart"in B)B.selectionStart=ie,B.selectionEnd=Math.min(he,B.value.length);else{var me=B.ownerDocument||document,ae=me&&me.defaultView||window;if(ae.getSelection){var ce=ae.getSelection(),Ae=B.textContent.length,Le=Math.min(K.start,Ae),ct=K.end===void 0?Le:Math.min(K.end,Ae);!ce.extend&&Le>ct&&(j=ct,ct=Le,Le=j);var J=mu(B,Le),G=mu(B,ct);if(J&&G&&(ce.rangeCount!==1||ce.anchorNode!==J.node||ce.anchorOffset!==J.offset||ce.focusNode!==G.node||ce.focusOffset!==G.offset)){var se=me.createRange();se.setStart(J.node,J.offset),ce.removeAllRanges(),Le>ct?(ce.addRange(se),ce.extend(G.node,G.offset)):(se.setEnd(G.node,G.offset),ce.addRange(se))}}}}for(me=[],ce=B;ce=ce.parentNode;)ce.nodeType===1&&me.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<me.length;B++){var pe=me[B];pe.element.scrollLeft=pe.left,pe.element.scrollTop=pe.top}}Ur=!!Ko,Xo=Ko=null}finally{tt=r,Y.p=i,F.T=s}}e.current=t,$t=2}}function Nd(){if($t===2){$t=0;var e=Ei,t=kn,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=F.T,F.T=null;var i=Y.p;Y.p=2;var r=tt;tt|=4;try{rd(e,t.alternate,t)}finally{tt=r,Y.p=i,F.T=s}}$t=3}}function Md(){if($t===4||$t===3){$t=0,st();var e=Ei,t=kn,s=li,i=yd;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?$t=5:($t=0,kn=Ei=null,Ld(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(xi=null),le(s),t=t.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(ze,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=F.T,r=Y.p,Y.p=2,F.T=null;try{for(var c=e.onRecoverableError,j=0;j<i.length;j++){var B=i[j];c(B.value,{componentStack:B.stack})}}finally{F.T=t,Y.p=r}}(li&3)!==0&&Ar(),Is(e),r=e.pendingLanes,(s&261930)!==0&&(r&42)!==0?e===Lo?va++:(va=0,Lo=e):va=0,ga(0)}}function Ld(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Qn(t)))}function Ar(){return Dd(),Nd(),Md(),Od()}function Od(){if($t!==5)return!1;var e=Ei,t=No;No=0;var s=le(li),i=F.T,r=Y.p;try{Y.p=32>s?32:s,F.T=null,s=Mo,Mo=null;var c=Ei,j=li;if($t=0,kn=Ei=null,li=0,(tt&6)!==0)throw Error(S(331));var B=tt;if(tt|=4,_d(c.current),fd(c,c.current,j,s),tt=B,ga(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(ze,c)}catch{}return!0}finally{Y.p=r,F.T=i,Ld(e,t)}}function Bd(e,t,s){t=ws(s,t),t=ho(e.stateNode,t,2),e=gi(e,t,2),e!==null&&(ke(e,2),Is(e))}function rt(e,t,s){if(e.tag===3)Bd(e,e,s);else for(;t!==null;){if(t.tag===3){Bd(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(xi===null||!xi.has(i))){e=ws(s,e),s=Hh(2),i=gi(t,s,2),i!==null&&(zh(s,i,t,e),ke(i,2),Is(i));break}}t=t.return}}function Ho(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new m_;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(s)||(Ro=!0,r.add(s),e=S_.bind(null,e,t,s),t.then(e,e))}function S_(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,dt===e&&(Xe&s)===s&&(At===4||At===3&&(Xe&62914560)===Xe&&300>it()-br?(tt&2)===0&&An(e,0):To|=s,En===Xe&&(En=0)),Is(e)}function Hd(e,t){t===0&&(t=be()),e=Ui(e,t),e!==null&&(ke(e,t),Is(e))}function b_(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),Hd(e,s)}function C_(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,r=e.memoizedState;r!==null&&(s=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(S(314))}i!==null&&i.delete(t),Hd(e,s)}function w_(e,t){return Lt(e,t)}var jr=null,Rn=null,zo=!1,Rr=!1,Uo=!1,Ai=0;function Is(e){e!==Rn&&e.next===null&&(Rn===null?jr=Rn=e:Rn=Rn.next=e),Rr=!0,zo||(zo=!0,E_())}function ga(e,t){if(!Uo&&Rr){Uo=!0;do for(var s=!1,i=jr;i!==null;){if(e!==0){var r=i.pendingLanes;if(r===0)var c=0;else{var j=i.suspendedLanes,B=i.pingedLanes;c=(1<<31-gt(42|e)+1)-1,c&=r&~(j&~B),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(s=!0,qd(i,c))}else c=Xe,c=Zt(i,i===dt?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(c&3)===0||re(i,c)||(s=!0,qd(i,c));i=i.next}while(s);Uo=!1}}function x_(){zd()}function zd(){Rr=zo=!1;var e=0;Ai!==0&&O_()&&(e=Ai);for(var t=it(),s=null,i=jr;i!==null;){var r=i.next,c=Ud(i,t);c===0?(i.next=null,s===null?jr=r:s.next=r,r===null&&(Rn=s)):(s=i,(e!==0||(c&3)!==0)&&(Rr=!0)),i=r}$t!==0&&$t!==5||ga(e),Ai!==0&&(Ai=0)}function Ud(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var j=31-gt(c),B=1<<j,K=r[j];K===-1?((B&s)===0||(B&i)!==0)&&(r[j]=de(B,t)):K<=t&&(e.expiredLanes|=B),c&=~B}if(t=dt,s=Xe,s=Zt(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&wt(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||re(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&wt(i),le(s)){case 2:case 8:s=Ot;break;case 32:s=Je;break;case 268435456:s=Ct;break;default:s=Je}return i=Id.bind(null,e),s=Lt(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&wt(i),e.callbackPriority=2,e.callbackNode=null,2}function Id(e,t){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Ar()&&e.callbackNode!==s)return null;var i=Xe;return i=Zt(e,e===dt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(bd(e,i,t),Ud(e,it()),e.callbackNode!=null&&e.callbackNode===s?Id.bind(null,e):null)}function qd(e,t){if(Ar())return null;bd(e,t,!0)}function E_(){H_(function(){(tt&6)!==0?Lt(xt,x_):zd()})}function Io(){if(Ai===0){var e=pn;e===0&&(e=is,is<<=1,(is&261888)===0&&(is=256)),Ai=e}return Ai}function $d(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ha(""+e)}function Pd(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function k_(e,t,s,i,r){if(t==="submit"&&s&&s.stateNode===r){var c=$d((r[ue]||null).action),j=i.submitter;j&&(t=(t=j[ue]||null)?$d(t.formAction):j.getAttribute("formAction"),t!==null&&(c=t,j=null));var B=new qa("action","action",null,i,r);e.push({event:B,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Ai!==0){var K=j?Pd(r,j):new FormData(r);ao(s,{pending:!0,data:K,method:r.method,action:c},null,K)}}else typeof c=="function"&&(B.preventDefault(),K=j?Pd(r,j):new FormData(r),ao(s,{pending:!0,data:K,method:r.method,action:c},c,K))},currentTarget:r}]})}}for(var qo=0;qo<Cl.length;qo++){var $o=Cl[qo],A_=$o.toLowerCase(),j_=$o[0].toUpperCase()+$o.slice(1);Ms(A_,"on"+j_)}Ms(Su,"onAnimationEnd"),Ms(bu,"onAnimationIteration"),Ms(Cu,"onAnimationStart"),Ms("dblclick","onDoubleClick"),Ms("focusin","onFocus"),Ms("focusout","onBlur"),Ms(Wm,"onTransitionRun"),Ms(Fm,"onTransitionStart"),Ms(Ym,"onTransitionCancel"),Ms(wu,"onTransitionEnd"),Ji("onMouseEnter",["mouseout","mouseover"]),Ji("onMouseLeave",["mouseout","mouseover"]),Ji("onPointerEnter",["pointerout","pointerover"]),Ji("onPointerLeave",["pointerout","pointerover"]),Oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ya="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(" "),R_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ya));function Wd(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],r=i.event;i=i.listeners;e:{var c=void 0;if(t)for(var j=i.length-1;0<=j;j--){var B=i[j],K=B.instance,ie=B.currentTarget;if(B=B.listener,K!==c&&r.isPropagationStopped())break e;c=B,r.currentTarget=ie;try{c(r)}catch(he){Wa(he)}r.currentTarget=null,c=K}else for(j=0;j<i.length;j++){if(B=i[j],K=B.instance,ie=B.currentTarget,B=B.listener,K!==c&&r.isPropagationStopped())break e;c=B,r.currentTarget=ie;try{c(r)}catch(he){Wa(he)}r.currentTarget=null,c=K}}}}function Ye(e,t){var s=t[Ne];s===void 0&&(s=t[Ne]=new Set);var i=e+"__bubble";s.has(i)||(Fd(t,e,2,!1),s.add(i))}function Po(e,t,s){var i=0;t&&(i|=4),Fd(s,e,i,t)}var Tr="_reactListening"+Math.random().toString(36).slice(2);function Wo(e){if(!e[Tr]){e[Tr]=!0,In.forEach(function(s){s!=="selectionchange"&&(R_.has(s)||Po(s,!1,e),Po(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Tr]||(t[Tr]=!0,Po("selectionchange",!1,t))}}function Fd(e,t,s,i){switch(bf(t)){case 2:var r=iv;break;case 8:r=nv;break;default:r=ac}s=r.bind(null,t,s,e),r=void 0,!cl||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),i?r!==void 0?e.addEventListener(t,s,{capture:!0,passive:r}):e.addEventListener(t,s,!0):r!==void 0?e.addEventListener(t,s,{passive:r}):e.addEventListener(t,s,!1)}function Fo(e,t,s,i,r){var c=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var j=i.tag;if(j===3||j===4){var B=i.stateNode.containerInfo;if(B===r)break;if(j===4)for(j=i.return;j!==null;){var K=j.tag;if((K===3||K===4)&&j.stateNode.containerInfo===r)return;j=j.return}for(;B!==null;){if(j=Ws(B),j===null)return;if(K=j.tag,K===5||K===6||K===26||K===27){i=c=j;continue e}B=B.parentNode}}i=i.return}Vc(function(){var ie=c,he=ll(s),me=[];e:{var ae=xu.get(e);if(ae!==void 0){var ce=qa,Ae=e;switch(e){case"keypress":if(Ua(s)===0)break e;case"keydown":case"keyup":ce=Cm;break;case"focusin":Ae="focus",ce=fl;break;case"focusout":Ae="blur",ce=fl;break;case"beforeblur":case"afterblur":ce=fl;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=Jc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=um;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=Em;break;case Su:case bu:case Cu:ce=fm;break;case wu:ce=Am;break;case"scroll":case"scrollend":ce=om;break;case"wheel":ce=Rm;break;case"copy":case"cut":case"paste":ce=mm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=tu;break;case"toggle":case"beforetoggle":ce=Dm}var Le=(t&4)!==0,ct=!Le&&(e==="scroll"||e==="scrollend"),J=Le?ae!==null?ae+"Capture":null:ae;Le=[];for(var G=ie,se;G!==null;){var pe=G;if(se=pe.stateNode,pe=pe.tag,pe!==5&&pe!==26&&pe!==27||se===null||J===null||(pe=qn(G,J),pe!=null&&Le.push(Sa(G,pe,se))),ct)break;G=G.return}0<Le.length&&(ae=new ce(ae,Ae,null,s,he),me.push({event:ae,listeners:Le}))}}if((t&7)===0){e:{if(ae=e==="mouseover"||e==="pointerover",ce=e==="mouseout"||e==="pointerout",ae&&s!==rl&&(Ae=s.relatedTarget||s.fromElement)&&(Ws(Ae)||Ae[we]))break e;if((ce||ae)&&(ae=he.window===he?he:(ae=he.ownerDocument)?ae.defaultView||ae.parentWindow:window,ce?(Ae=s.relatedTarget||s.toElement,ce=ie,Ae=Ae?Ws(Ae):null,Ae!==null&&(ct=q(Ae),Le=Ae.tag,Ae!==ct||Le!==5&&Le!==27&&Le!==6)&&(Ae=null)):(ce=null,Ae=ie),ce!==Ae)){if(Le=Jc,pe="onMouseLeave",J="onMouseEnter",G="mouse",(e==="pointerout"||e==="pointerover")&&(Le=tu,pe="onPointerLeave",J="onPointerEnter",G="pointer"),ct=ce==null?ae:Ft(ce),se=Ae==null?ae:Ft(Ae),ae=new Le(pe,G+"leave",ce,s,he),ae.target=ct,ae.relatedTarget=se,pe=null,Ws(he)===ie&&(Le=new Le(J,G+"enter",Ae,s,he),Le.target=se,Le.relatedTarget=ct,pe=Le),ct=pe,ce&&Ae)t:{for(Le=T_,J=ce,G=Ae,se=0,pe=J;pe;pe=Le(pe))se++;pe=0;for(var De=G;De;De=Le(De))pe++;for(;0<se-pe;)J=Le(J),se--;for(;0<pe-se;)G=Le(G),pe--;for(;se--;){if(J===G||G!==null&&J===G.alternate){Le=J;break t}J=Le(J),G=Le(G)}Le=null}else Le=null;ce!==null&&Yd(me,ae,ce,Le,!1),Ae!==null&&ct!==null&&Yd(me,ct,Ae,Le,!0)}}e:{if(ae=ie?Ft(ie):window,ce=ae.nodeName&&ae.nodeName.toLowerCase(),ce==="select"||ce==="input"&&ae.type==="file")var Ze=cu;else if(lu(ae))if(uu)Ze=qm;else{Ze=Um;var Te=zm}else ce=ae.nodeName,!ce||ce.toLowerCase()!=="input"||ae.type!=="checkbox"&&ae.type!=="radio"?ie&&al(ie.elementType)&&(Ze=cu):Ze=Im;if(Ze&&(Ze=Ze(e,ie))){ou(me,Ze,s,he);break e}Te&&Te(e,ae,ie),e==="focusout"&&ie&&ae.type==="number"&&ie.memoizedProps.value!=null&&nl(ae,"number",ae.value)}switch(Te=ie?Ft(ie):window,e){case"focusin":(lu(Te)||Te.contentEditable==="true")&&(rn=Te,yl=ie,Gn=null);break;case"focusout":Gn=yl=rn=null;break;case"mousedown":Sl=!0;break;case"contextmenu":case"mouseup":case"dragend":Sl=!1,gu(me,s,he);break;case"selectionchange":if(Pm)break;case"keydown":case"keyup":gu(me,s,he)}var qe;if(ml)e:{switch(e){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else an?au(e,s)&&(Ge="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ge="onCompositionStart");Ge&&(su&&s.locale!=="ko"&&(an||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&an&&(qe=Zc()):(hi=he,ul="value"in hi?hi.value:hi.textContent,an=!0)),Te=Dr(ie,Ge),0<Te.length&&(Ge=new eu(Ge,e,null,s,he),me.push({event:Ge,listeners:Te}),qe?Ge.data=qe:(qe=ru(s),qe!==null&&(Ge.data=qe)))),(qe=Mm?Lm(e,s):Om(e,s))&&(Ge=Dr(ie,"onBeforeInput"),0<Ge.length&&(Te=new eu("onBeforeInput","beforeinput",null,s,he),me.push({event:Te,listeners:Ge}),Te.data=qe)),k_(me,e,ie,s,he)}Wd(me,t)})}function Sa(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Dr(e,t){for(var s=t+"Capture",i=[];e!==null;){var r=e,c=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||c===null||(r=qn(e,s),r!=null&&i.unshift(Sa(e,r,c)),r=qn(e,t),r!=null&&i.push(Sa(e,r,c))),e.tag===3)return i;e=e.return}return[]}function T_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yd(e,t,s,i,r){for(var c=t._reactName,j=[];s!==null&&s!==i;){var B=s,K=B.alternate,ie=B.stateNode;if(B=B.tag,K!==null&&K===i)break;B!==5&&B!==26&&B!==27||ie===null||(K=ie,r?(ie=qn(s,c),ie!=null&&j.unshift(Sa(s,ie,K))):r||(ie=qn(s,c),ie!=null&&j.push(Sa(s,ie,K)))),s=s.return}j.length!==0&&e.push({event:t,listeners:j})}var D_=/\r\n?/g,N_=/\u0000|\uFFFD/g;function Kd(e){return(typeof e=="string"?e:""+e).replace(D_,`
49
+ `).replace(N_,"")}function Xd(e,t){return t=Kd(t),Kd(e)===t}function ot(e,t,s,i,r,c){switch(s){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||tn(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&tn(e,""+i);break;case"className":Oa(e,"class",i);break;case"tabIndex":Oa(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Oa(e,s,i);break;case"style":Xc(e,i,c);break;case"data":if(t!=="object"){Oa(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=Ha(""+i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"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 c=="function"&&(s==="formAction"?(t!=="input"&&ot(e,t,"name",r.name,r,null),ot(e,t,"formEncType",r.formEncType,r,null),ot(e,t,"formMethod",r.formMethod,r,null),ot(e,t,"formTarget",r.formTarget,r,null)):(ot(e,t,"encType",r.encType,r,null),ot(e,t,"method",r.method,r,null),ot(e,t,"target",r.target,r,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=Ha(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=Ys);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(S(61));if(s=i.__html,s!=null){if(r.children!=null)throw Error(S(60));e.innerHTML=s}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=Ha(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""+i):e.removeAttribute(s);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),La(e,"popover",i);break;case"xlinkActuate":Fs(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Fs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Fs(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Fs(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Fs(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Fs(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Fs(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Fs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Fs(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":La(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=rm.get(s)||s,La(e,s,i))}}function Yo(e,t,s,i,r,c){switch(s){case"style":Xc(e,i,c);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(S(61));if(s=i.__html,s!=null){if(r.children!=null)throw Error(S(60));e.innerHTML=s}}break;case"children":typeof i=="string"?tn(e,i):(typeof i=="number"||typeof i=="bigint")&&tn(e,""+i);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"onClick":i!=null&&(e.onclick=Ys);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Uc.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(r=s.endsWith("Capture"),t=s.slice(2,r?s.length-7:void 0),c=e[ue]||null,c=c!=null?c[s]:null,typeof c=="function"&&e.removeEventListener(t,c,r),typeof i=="function")){typeof c!="function"&&c!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,i,r);break e}s in e?e[s]=i:i===!0?e.setAttribute(s,""):La(e,s,i)}}}function Gt(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var i=!1,r=!1,c;for(c in s)if(s.hasOwnProperty(c)){var j=s[c];if(j!=null)switch(c){case"src":i=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(S(137,t));default:ot(e,t,c,j,s,null)}}r&&ot(e,t,"srcSet",s.srcSet,s,null),i&&ot(e,t,"src",s.src,s,null);return;case"input":Ye("invalid",e);var B=c=j=r=null,K=null,ie=null;for(i in s)if(s.hasOwnProperty(i)){var he=s[i];if(he!=null)switch(i){case"name":r=he;break;case"type":j=he;break;case"checked":K=he;break;case"defaultChecked":ie=he;break;case"value":c=he;break;case"defaultValue":B=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(S(137,t));break;default:ot(e,t,i,he,s,null)}}Wc(e,c,B,K,ie,j,r,!1);return;case"select":Ye("invalid",e),i=j=c=null;for(r in s)if(s.hasOwnProperty(r)&&(B=s[r],B!=null))switch(r){case"value":c=B;break;case"defaultValue":j=B;break;case"multiple":i=B;default:ot(e,t,r,B,s,null)}t=c,s=j,e.multiple=!!i,t!=null?en(e,!!i,t,!1):s!=null&&en(e,!!i,s,!0);return;case"textarea":Ye("invalid",e),c=r=i=null;for(j in s)if(s.hasOwnProperty(j)&&(B=s[j],B!=null))switch(j){case"value":i=B;break;case"defaultValue":r=B;break;case"children":c=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(S(91));break;default:ot(e,t,j,B,s,null)}Yc(e,i,r,c);return;case"option":for(K in s)if(s.hasOwnProperty(K)&&(i=s[K],i!=null))switch(K){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:ot(e,t,K,i,s,null)}return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(i=0;i<ya.length;i++)Ye(ya[i],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("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(ie in s)if(s.hasOwnProperty(ie)&&(i=s[ie],i!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(S(137,t));default:ot(e,t,ie,i,s,null)}return;default:if(al(t)){for(he in s)s.hasOwnProperty(he)&&(i=s[he],i!==void 0&&Yo(e,t,he,i,s,void 0));return}}for(B in s)s.hasOwnProperty(B)&&(i=s[B],i!=null&&ot(e,t,B,i,s,null))}function M_(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,c=null,j=null,B=null,K=null,ie=null,he=null;for(ce in s){var me=s[ce];if(s.hasOwnProperty(ce)&&me!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":K=me;default:i.hasOwnProperty(ce)||ot(e,t,ce,null,i,me)}}for(var ae in i){var ce=i[ae];if(me=s[ae],i.hasOwnProperty(ae)&&(ce!=null||me!=null))switch(ae){case"type":c=ce;break;case"name":r=ce;break;case"checked":ie=ce;break;case"defaultChecked":he=ce;break;case"value":j=ce;break;case"defaultValue":B=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(S(137,t));break;default:ce!==me&&ot(e,t,ae,ce,i,me)}}il(e,j,B,K,ie,he,c,r);return;case"select":ce=j=B=ae=null;for(c in s)if(K=s[c],s.hasOwnProperty(c)&&K!=null)switch(c){case"value":break;case"multiple":ce=K;default:i.hasOwnProperty(c)||ot(e,t,c,null,i,K)}for(r in i)if(c=i[r],K=s[r],i.hasOwnProperty(r)&&(c!=null||K!=null))switch(r){case"value":ae=c;break;case"defaultValue":B=c;break;case"multiple":j=c;default:c!==K&&ot(e,t,r,c,i,K)}t=B,s=j,i=ce,ae!=null?en(e,!!s,ae,!1):!!i!=!!s&&(t!=null?en(e,!!s,t,!0):en(e,!!s,s?[]:"",!1));return;case"textarea":ce=ae=null;for(B in s)if(r=s[B],s.hasOwnProperty(B)&&r!=null&&!i.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:ot(e,t,B,null,i,r)}for(j in i)if(r=i[j],c=s[j],i.hasOwnProperty(j)&&(r!=null||c!=null))switch(j){case"value":ae=r;break;case"defaultValue":ce=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(S(91));break;default:r!==c&&ot(e,t,j,r,i,c)}Fc(e,ae,ce);return;case"option":for(var Ae in s)if(ae=s[Ae],s.hasOwnProperty(Ae)&&ae!=null&&!i.hasOwnProperty(Ae))switch(Ae){case"selected":e.selected=!1;break;default:ot(e,t,Ae,null,i,ae)}for(K in i)if(ae=i[K],ce=s[K],i.hasOwnProperty(K)&&ae!==ce&&(ae!=null||ce!=null))switch(K){case"selected":e.selected=ae&&typeof ae!="function"&&typeof ae!="symbol";break;default:ot(e,t,K,ae,i,ce)}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 Le in s)ae=s[Le],s.hasOwnProperty(Le)&&ae!=null&&!i.hasOwnProperty(Le)&&ot(e,t,Le,null,i,ae);for(ie in i)if(ae=i[ie],ce=s[ie],i.hasOwnProperty(ie)&&ae!==ce&&(ae!=null||ce!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(S(137,t));break;default:ot(e,t,ie,ae,i,ce)}return;default:if(al(t)){for(var ct in s)ae=s[ct],s.hasOwnProperty(ct)&&ae!==void 0&&!i.hasOwnProperty(ct)&&Yo(e,t,ct,void 0,i,ae);for(he in i)ae=i[he],ce=s[he],!i.hasOwnProperty(he)||ae===ce||ae===void 0&&ce===void 0||Yo(e,t,he,ae,i,ce);return}}for(var J in s)ae=s[J],s.hasOwnProperty(J)&&ae!=null&&!i.hasOwnProperty(J)&&ot(e,t,J,null,i,ae);for(me in i)ae=i[me],ce=s[me],!i.hasOwnProperty(me)||ae===ce||ae==null&&ce==null||ot(e,t,me,ae,i,ce)}function Gd(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function L_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var r=s[i],c=r.transferSize,j=r.initiatorType,B=r.duration;if(c&&B&&Gd(j)){for(j=0,B=r.responseEnd,i+=1;i<s.length;i++){var K=s[i],ie=K.startTime;if(ie>B)break;var he=K.transferSize,me=K.initiatorType;he&&Gd(me)&&(K=K.responseEnd,j+=he*(K<B?1:(B-ie)/(K-ie)))}if(--i,t+=8*(c+j)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ko=null,Xo=null;function Nr(e){return e.nodeType===9?e:e.ownerDocument}function Vd(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 Zd(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 Go(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 Vo=null;function O_(){var e=window.event;return e&&e.type==="popstate"?e===Vo?!1:(Vo=e,!0):(Vo=null,!1)}var Qd=typeof setTimeout=="function"?setTimeout:void 0,B_=typeof clearTimeout=="function"?clearTimeout:void 0,Jd=typeof Promise=="function"?Promise:void 0,H_=typeof queueMicrotask=="function"?queueMicrotask:typeof Jd<"u"?function(e){return Jd.resolve(null).then(e).catch(z_)}:Qd;function z_(e){setTimeout(function(){throw e})}function ji(e){return e==="head"}function ef(e,t){var s=t,i=0;do{var r=s.nextSibling;if(e.removeChild(s),r&&r.nodeType===8)if(s=r.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(r),Mn(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")ba(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,ba(s);for(var c=s.firstChild;c;){var j=c.nextSibling,B=c.nodeName;c[hs]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&c.rel.toLowerCase()==="stylesheet"||s.removeChild(c),c=j}}else s==="body"&&ba(e.ownerDocument.body);s=r}while(s);Mn(t)}function tf(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function Zo(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Zo(s),ys(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function U_(e,t,s,i){for(;e.nodeType===1;){var r=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[hs])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=js(e.nextSibling),e===null)break}return null}function I_(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=js(e.nextSibling),e===null))return null;return e}function sf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=js(e.nextSibling),e===null))return null;return e}function Qo(e){return e.data==="$?"||e.data==="$~"}function Jo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function q_(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function js(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==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var ec=null;function nf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return js(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function af(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function rf(e,t,s){switch(t=Nr(s),e){case"html":if(e=t.documentElement,!e)throw Error(S(452));return e;case"head":if(e=t.head,!e)throw Error(S(453));return e;case"body":if(e=t.body,!e)throw Error(S(454));return e;default:throw Error(S(451))}}function ba(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ys(e)}var Rs=new Map,lf=new Set;function Mr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var oi=Y.d;Y.d={f:$_,r:P_,D:W_,C:F_,L:Y_,m:K_,X:G_,S:X_,M:V_};function $_(){var e=oi.f(),t=xr();return e||t}function P_(e){var t=Ns(e);t!==null&&t.tag===5&&t.type==="form"?wh(t):oi.r(e)}var Tn=typeof document>"u"?null:document;function of(e,t,s){var i=Tn;if(i&&typeof t=="string"&&t){var r=bs(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof s=="string"&&(r+='[crossorigin="'+s+'"]'),lf.has(r)||(lf.add(r),e={rel:e,crossOrigin:s,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),Gt(t,"link",e),Bt(t),i.head.appendChild(t)))}}function W_(e){oi.D(e),of("dns-prefetch",e,null)}function F_(e,t){oi.C(e,t),of("preconnect",e,t)}function Y_(e,t,s){oi.L(e,t,s);var i=Tn;if(i&&e&&t){var r='link[rel="preload"][as="'+bs(t)+'"]';t==="image"&&s&&s.imageSrcSet?(r+='[imagesrcset="'+bs(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(r+='[imagesizes="'+bs(s.imageSizes)+'"]')):r+='[href="'+bs(e)+'"]';var c=r;switch(t){case"style":c=Dn(e);break;case"script":c=Nn(e)}Rs.has(c)||(e=u({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),Rs.set(c,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(Ca(c))||t==="script"&&i.querySelector(wa(c))||(t=i.createElement("link"),Gt(t,"link",e),Bt(t),i.head.appendChild(t)))}}function K_(e,t){oi.m(e,t);var s=Tn;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+bs(i)+'"][href="'+bs(e)+'"]',c=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Nn(e)}if(!Rs.has(c)&&(e=u({rel:"modulepreload",href:e},t),Rs.set(c,e),s.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(wa(c)))return}i=s.createElement("link"),Gt(i,"link",e),Bt(i),s.head.appendChild(i)}}}function X_(e,t,s){oi.S(e,t,s);var i=Tn;if(i&&e){var r=ui(i).hoistableStyles,c=Dn(e);t=t||"default";var j=r.get(c);if(!j){var B={loading:0,preload:null};if(j=i.querySelector(Ca(c)))B.loading=5;else{e=u({rel:"stylesheet",href:e,"data-precedence":t},s),(s=Rs.get(c))&&tc(e,s);var K=j=i.createElement("link");Bt(K),Gt(K,"link",e),K._p=new Promise(function(ie,he){K.onload=ie,K.onerror=he}),K.addEventListener("load",function(){B.loading|=1}),K.addEventListener("error",function(){B.loading|=2}),B.loading|=4,Lr(j,t,i)}j={type:"stylesheet",instance:j,count:1,state:B},r.set(c,j)}}}function G_(e,t){oi.X(e,t);var s=Tn;if(s&&e){var i=ui(s).hoistableScripts,r=Nn(e),c=i.get(r);c||(c=s.querySelector(wa(r)),c||(e=u({src:e,async:!0},t),(t=Rs.get(r))&&sc(e,t),c=s.createElement("script"),Bt(c),Gt(c,"link",e),s.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},i.set(r,c))}}function V_(e,t){oi.M(e,t);var s=Tn;if(s&&e){var i=ui(s).hoistableScripts,r=Nn(e),c=i.get(r);c||(c=s.querySelector(wa(r)),c||(e=u({src:e,async:!0,type:"module"},t),(t=Rs.get(r))&&sc(e,t),c=s.createElement("script"),Bt(c),Gt(c,"link",e),s.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},i.set(r,c))}}function cf(e,t,s,i){var r=(r=Ce.current)?Mr(r):null;if(!r)throw Error(S(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=Dn(s.href),s=ui(r).hoistableStyles,i=s.get(t),i||(i={type:"style",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Dn(s.href);var c=ui(r).hoistableStyles,j=c.get(e);if(j||(r=r.ownerDocument||r,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,j),(c=r.querySelector(Ca(e)))&&!c._p&&(j.instance=c,j.state.loading=5),Rs.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Rs.set(e,s),c||Z_(r,e,s,j.state))),t&&i===null)throw Error(S(528,""));return j}if(t&&i!==null)throw Error(S(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Nn(s),s=ui(r).hoistableScripts,i=s.get(t),i||(i={type:"script",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(S(444,e))}}function Dn(e){return'href="'+bs(e)+'"'}function Ca(e){return'link[rel="stylesheet"]['+e+"]"}function uf(e){return u({},e,{"data-precedence":e.precedence,precedence:null})}function Z_(e,t,s,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Gt(t,"link",s),Bt(t),e.head.appendChild(t))}function Nn(e){return'[src="'+bs(e)+'"]'}function wa(e){return"script[async]"+e}function hf(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+bs(s.href)+'"]');if(i)return t.instance=i,Bt(i),i;var r=u({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Bt(i),Gt(i,"style",r),Lr(i,s.precedence,e),t.instance=i;case"stylesheet":r=Dn(s.href);var c=e.querySelector(Ca(r));if(c)return t.state.loading|=4,t.instance=c,Bt(c),c;i=uf(s),(r=Rs.get(r))&&tc(i,r),c=(e.ownerDocument||e).createElement("link"),Bt(c);var j=c;return j._p=new Promise(function(B,K){j.onload=B,j.onerror=K}),Gt(c,"link",i),t.state.loading|=4,Lr(c,s.precedence,e),t.instance=c;case"script":return c=Nn(s.src),(r=e.querySelector(wa(c)))?(t.instance=r,Bt(r),r):(i=s,(r=Rs.get(c))&&(i=u({},s),sc(i,r)),e=e.ownerDocument||e,r=e.createElement("script"),Bt(r),Gt(r,"link",i),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(S(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Lr(i,s.precedence,e));return t.instance}function Lr(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,c=r,j=0;j<i.length;j++){var B=i[j];if(B.dataset.precedence===t)c=B;else if(c!==r)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function tc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function sc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Or=null;function df(e,t,s){if(Or===null){var i=new Map,r=Or=new Map;r.set(s,i)}else r=Or,i=r.get(s),i||(i=new Map,r.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),r=0;r<s.length;r++){var c=s[r];if(!(c[hs]||c[We]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var j=c.getAttribute(t)||"";j=e+j;var B=i.get(j);B?B.push(c):i.set(j,[c])}}return i}function ff(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Q_(e,t,s){if(s===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;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!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 pf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function J_(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var r=Dn(i.href),c=t.querySelector(Ca(r));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Br.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=c,Bt(c);return}c=t.ownerDocument||t,i=uf(i),(r=Rs.get(r))&&tc(i,r),c=c.createElement("link"),Bt(c);var j=c;j._p=new Promise(function(B,K){j.onload=B,j.onerror=K}),Gt(c,"link",i),s.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=Br.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var ic=0;function ev(e,t){return e.stylesheets&&e.count===0&&zr(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&zr(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&ic===0&&(ic=62500*L_());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&zr(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>ic?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function Br(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Hr=null;function zr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Hr=new Map,t.forEach(tv,e),Hr=null,Br.call(e))}function tv(e,t){if(!(t.state.loading&4)){var s=Hr.get(e);if(s)var i=s.get(null);else{s=new Map,Hr.set(e,s);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<r.length;c++){var j=r[c];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(s.set(j.dataset.precedence,j),i=j)}i&&s.set(null,i)}r=t.instance,j=r.getAttribute("data-precedence"),c=s.get(j)||i,c===i&&s.set(null,r),s.set(j,r),this.count++,i=Br.bind(this),r.addEventListener("load",i),r.addEventListener("error",i),c?c.parentNode.insertBefore(r,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var xa={$$typeof:o,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function sv(e,t,s,i,r,c,j,B,K){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=ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ye(0),this.hiddenUpdates=ye(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=c,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function mf(e,t,s,i,r,c,j,B,K,ie,he,me){return e=new sv(e,t,s,j,K,ie,he,me,B),t=1,c===!0&&(t|=24),c=fs(3,null,null,t),e.current=c,c.stateNode=e,t=Ol(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:i,isDehydrated:s,cache:t},Ul(c),e}function _f(e){return e?(e=cn,e):cn}function vf(e,t,s,i,r,c){r=_f(r),i.context===null?i.context=r:i.pendingContext=r,i=vi(t),i.payload={element:s},c=c===void 0?null:c,c!==null&&(i.callback=c),s=gi(e,i,t),s!==null&&(us(s,e,t),sa(s,e,t))}function gf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function nc(e,t){gf(e,t),(e=e.alternate)&&gf(e,t)}function yf(e){if(e.tag===13||e.tag===31){var t=Ui(e,67108864);t!==null&&us(t,e,67108864),nc(e,67108864)}}function Sf(e){if(e.tag===13||e.tag===31){var t=gs();t=qt(t);var s=Ui(e,t);s!==null&&us(s,e,t),nc(e,t)}}var Ur=!0;function iv(e,t,s,i){var r=F.T;F.T=null;var c=Y.p;try{Y.p=2,ac(e,t,s,i)}finally{Y.p=c,F.T=r}}function nv(e,t,s,i){var r=F.T;F.T=null;var c=Y.p;try{Y.p=8,ac(e,t,s,i)}finally{Y.p=c,F.T=r}}function ac(e,t,s,i){if(Ur){var r=rc(i);if(r===null)Fo(e,t,i,Ir,s),Cf(e,i);else if(rv(r,e,t,s,i))i.stopPropagation();else if(Cf(e,i),t&4&&-1<av.indexOf(e)){for(;r!==null;){var c=Ns(r);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var j=Jt(c.pendingLanes);if(j!==0){var B=c;for(B.pendingLanes|=2,B.entangledLanes|=2;j;){var K=1<<31-gt(j);B.entanglements[1]|=K,j&=~K}Is(c),(tt&6)===0&&(Cr=it()+500,ga(0))}}break;case 31:case 13:B=Ui(c,2),B!==null&&us(B,c,2),xr(),nc(c,2)}if(c=rc(i),c===null&&Fo(e,t,i,Ir,s),c===r)break;r=c}r!==null&&i.stopPropagation()}else Fo(e,t,i,null,s)}}function rc(e){return e=ll(e),lc(e)}var Ir=null;function lc(e){if(Ir=null,e=Ws(e),e!==null){var t=q(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=L(t),e!==null)return e;e=null}else if(s===31){if(e=h(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ir=e,null}function bf(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(pt()){case xt:return 2;case Ot:return 8;case Je:case jt:return 32;case Ct:return 268435456;default:return 32}default:return 32}}var oc=!1,Ri=null,Ti=null,Di=null,Ea=new Map,ka=new Map,Ni=[],av="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 Cf(e,t){switch(e){case"focusin":case"focusout":Ri=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":Di=null;break;case"pointerover":case"pointerout":Ea.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ka.delete(t.pointerId)}}function Aa(e,t,s,i,r,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:c,targetContainers:[r]},t!==null&&(t=Ns(t),t!==null&&yf(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function rv(e,t,s,i,r){switch(t){case"focusin":return Ri=Aa(Ri,e,t,s,i,r),!0;case"dragenter":return Ti=Aa(Ti,e,t,s,i,r),!0;case"mouseover":return Di=Aa(Di,e,t,s,i,r),!0;case"pointerover":var c=r.pointerId;return Ea.set(c,Aa(Ea.get(c)||null,e,t,s,i,r)),!0;case"gotpointercapture":return c=r.pointerId,ka.set(c,Aa(ka.get(c)||null,e,t,s,i,r)),!0}return!1}function wf(e){var t=Ws(e.target);if(t!==null){var s=q(t);if(s!==null){if(t=s.tag,t===13){if(t=L(s),t!==null){e.blockedOn=t,Ee(e.priority,function(){Sf(s)});return}}else if(t===31){if(t=h(s),t!==null){e.blockedOn=t,Ee(e.priority,function(){Sf(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function qr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=rc(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);rl=i,s.target.dispatchEvent(i),rl=null}else return t=Ns(s),t!==null&&yf(t),e.blockedOn=s,!1;t.shift()}return!0}function xf(e,t,s){qr(e)&&s.delete(t)}function lv(){oc=!1,Ri!==null&&qr(Ri)&&(Ri=null),Ti!==null&&qr(Ti)&&(Ti=null),Di!==null&&qr(Di)&&(Di=null),Ea.forEach(xf),ka.forEach(xf)}function $r(e,t){e.blockedOn===t&&(e.blockedOn=null,oc||(oc=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,lv)))}var Pr=null;function Ef(e){Pr!==e&&(Pr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Pr===e&&(Pr=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],r=e[t+2];if(typeof i!="function"){if(lc(i||s)===null)continue;break}var c=Ns(s);c!==null&&(e.splice(t,3),t-=3,ao(c,{pending:!0,data:r,method:s.method,action:i},i,r))}}))}function Mn(e){function t(K){return $r(K,e)}Ri!==null&&$r(Ri,e),Ti!==null&&$r(Ti,e),Di!==null&&$r(Di,e),Ea.forEach(t),ka.forEach(t);for(var s=0;s<Ni.length;s++){var i=Ni[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Ni.length&&(s=Ni[0],s.blockedOn===null);)wf(s),s.blockedOn===null&&Ni.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var r=s[i],c=s[i+1],j=r[ue]||null;if(typeof c=="function")j||Ef(s);else if(j){var B=null;if(c&&c.hasAttribute("formAction")){if(r=c,j=c[ue]||null)B=j.formAction;else if(lc(r)!==null)continue}else B=j.action;typeof B=="function"?s[i+1]=B:(s.splice(i,3),i-=3),Ef(s)}}}function kf(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(j){return r=j})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function cc(e){this._internalRoot=e}Wr.prototype.render=cc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(S(409));var s=t.current,i=gs();vf(s,i,e,t,null,null)},Wr.prototype.unmount=cc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vf(e.current,2,null,e,null,null),xr(),t[we]=null}};function Wr(e){this._internalRoot=e}Wr.prototype.unstable_scheduleHydration=function(e){if(e){var t=xe();e={blockedOn:null,target:e,priority:t};for(var s=0;s<Ni.length&&t!==0&&t<Ni[s].priority;s++);Ni.splice(s,0,e),s===0&&wf(e)}};var Af=_.version;if(Af!=="19.2.7")throw Error(S(527,Af,"19.2.7"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(S(188)):(e=Object.keys(e).join(","),Error(S(268,e)));return e=m(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var ov={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fr.isDisabled&&Fr.supportsFiber)try{ze=Fr.inject(ov),nt=Fr}catch{}}return Ra.createRoot=function(e,t){if(!N(e))throw Error(S(299));var s=!1,i="",r=Mh,c=Lh,j=Oh;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(j=t.onRecoverableError)),t=mf(e,1,!1,null,null,s,i,null,r,c,j,kf),e[we]=t.current,Wo(e),new cc(t)},Ra.hydrateRoot=function(e,t,s){if(!N(e))throw Error(S(299));var i=!1,r="",c=Mh,j=Lh,B=Oh,K=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(r=s.identifierPrefix),s.onUncaughtError!==void 0&&(c=s.onUncaughtError),s.onCaughtError!==void 0&&(j=s.onCaughtError),s.onRecoverableError!==void 0&&(B=s.onRecoverableError),s.formState!==void 0&&(K=s.formState)),t=mf(e,1,!0,t,s??null,i,r,K,c,j,B,kf),t.context=_f(null),s=t.current,i=gs(),i=qt(i),r=vi(i),r.callback=null,gi(s,r,i),s=i,t.current.lanes=s,ke(t,s),Is(t),e[we]=t.current,Wo(e),new Wr(t)},Ra.version="19.2.7",Ra}var Hf;function yv(){if(Hf)return fc.exports;Hf=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(_){console.error(_)}}return a(),fc.exports=gv(),fc.exports}var Sv=yv();const Sp=Date.now(),Vt=a=>new Date(Sp-a*6e4).toISOString(),$e=a=>new Date(Sp-a*24*60*6e4).toISOString(),zf="/Users/demo/acme-app";Vt(1),Vt(1),Vt(42),Vt(20),$e(2),$e(1),$e(1),$e(1),$e(3),$e(3),Vt(0),Vt(0),Vt(3),Vt(3);Vt(1),$e(1),$e(1),$e(3),$e(6),$e(45),$e(1);Vt(48),Vt(1),Vt(48),Vt(47),Vt(46),Vt(45),Vt(3),Vt(2),$e(1),$e(1),$e(1),$e(1),$e(1),$e(1),$e(1),$e(1),$e(1),$e(3),$e(3),$e(3),$e(3),$e(3),$e(3),$e(3),$e(3),$e(1),$e(1),$e(1),$e(1),$e(45),$e(45),$e(45),$e(45),$e(45),$e(45),$e(45),$e(45);function bp(){return!1}function Ln(a){return(a==null?void 0:a.boundWorkflowPath)??null}class ss extends Error{constructor(E,S,N){super(S);uc(this,"status");uc(this,"reason");this.name="ApiError",this.status=E,this.reason=N}}function On(){const a=window.__HARNESS__;return a!=null&&a.token?a.token:new URLSearchParams(window.location.search).get("token")??""}class bv{startAuth(){return this.request("/api/auth/start",{method:"POST"})}disconnect(){return this.request("/api/auth/disconnect",{method:"POST"})}authStatus(){return this.request("/api/auth/status")}async request(_,E){const S=await fetch(_,{...E,headers:{"Content-Type":"application/json","X-Harness-Token":On(),...E==null?void 0:E.headers}});if(!S.ok){const N=await S.text().catch(()=>"");let q;try{const L=N?JSON.parse(N):void 0;L&&typeof L=="object"&&typeof L.error=="string"&&(q=L.error)}catch{}throw new ss(S.status,`${(E==null?void 0:E.method)??"GET"} ${_} → ${S.status}${N?`: ${N}`:""}`,q)}if(S.status!==204)return await S.json()}getState(){return this.request("/api/state")}createSession(_){return this.request("/api/sessions",{method:"POST",body:JSON.stringify(_)})}listSessions(){return this.request("/api/sessions")}sessionHistory(_){return this.request(`/api/sessions/history?cwd=${encodeURIComponent(_)}`)}async sessionRecord(_){try{return await this.request(`/api/sessions/${encodeURIComponent(_)}/record`)}catch(E){if(E instanceof ss&&(E.status===404||E.status===501))return null;throw E}}resumeSession(_){return this.request(`/api/sessions/${encodeURIComponent(_)}/resume`,{method:"POST"})}adoptSession(_){return this.request("/api/sessions/adopt",{method:"POST",body:JSON.stringify(_)})}async killSession(_){await this.request(`/api/sessions/${encodeURIComponent(_)}`,{method:"DELETE"})}async injectInput(_,E){await this.request(`/api/sessions/${encodeURIComponent(_)}/input`,{method:"POST",body:JSON.stringify(E)})}attachImage(_,E){return this.request(`/api/sessions/${encodeURIComponent(_)}/image`,{method:"POST",body:JSON.stringify(E)})}listWorkflows(){return this.request("/api/workflows")}connectWorkflow(_){return this.request("/api/workflows/connect",{method:"POST",body:JSON.stringify({path:_})})}scanWorkflows(_){return this.request("/api/workflows/scan",{method:"POST",body:JSON.stringify({root:_})})}listHarnesses(){return this.request("/api/harnesses")}listMacros(){return this.request("/api/macros")}async runMacro(_,E){await this.request(`/api/macros/${encodeURIComponent(_)}/run`,{method:"POST",body:JSON.stringify(E)})}getSettings(){return this.request("/api/settings")}updateSettings(_){return this.request("/api/settings",{method:"PATCH",body:JSON.stringify(_)})}listDir(_){const E=_?`?path=${encodeURIComponent(_)}`:"";return this.request(`/api/fs/list${E}`)}bindWorkflow(_,E){const S={workflowPath:E};return this.request(`/api/sessions/${encodeURIComponent(_)}/workflow`,{method:"PATCH",body:JSON.stringify(S)})}listTemplates(){return this.request("/api/templates")}getTemplate(_){return this.request(`/api/templates/${encodeURIComponent(_)}`)}getRunState(_){return this.request(`/api/runs/${encodeURIComponent(_)}/state`)}async runLocal(_,E){const S=await fetch("/api/runs/local",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":On()},body:JSON.stringify(_)});if(!S.ok||!S.body){const p=await S.text().catch(()=>"");throw new ss(S.status,`POST /api/runs/local → ${S.status}${p?`: ${p}`:""}`,void 0)}const N=S.body.getReader(),q=new TextDecoder;let L="";const h=(p,m)=>{L+=p;const{lines:g,rest:u}=wv(L,m);L=u;for(const v of g){const w=xv(v);w&&E(w)}};for(;;){const{done:p,value:m}=await N.read();if(p)break;h(q.decode(m,{stream:!0}),!1)}h(q.decode(),!0)}async deploy(_,E){const S=await this.streamNdjson(`/api/workflows/${encodeURIComponent(_)}/deploy`,{method:"POST"},E);return Ev(S)}async run(_){return this.request("/api/runs",{method:"POST",body:JSON.stringify(_)})}async streamNdjson(_,E,S){const N=await fetch(_,{...E,headers:{"Content-Type":"application/json","X-Harness-Token":On(),...E.headers}});if(!N.ok||!N.body){const g=await N.text().catch(()=>"");let u;try{const v=g?JSON.parse(g):void 0;v&&typeof v=="object"&&typeof v.error=="string"&&(u=v.error)}catch{}throw new ss(N.status,`${E.method??"GET"} ${_} → ${N.status}${g?`: ${g}`:""}`,u)}const q=[],L=N.body.getReader(),h=new TextDecoder;let p="";const m=g=>{p+=g;let u=p.indexOf(`
50
+ `);for(;u!==-1;){const v=p.slice(0,u);p=p.slice(u+1);const w=Cv(v);w!==void 0&&(q.push(w),S==null||S(w)),u=p.indexOf(`
51
+ `)}};for(;;){const{done:g,value:u}=await L.read();if(g)break;m(h.decode(u,{stream:!0}))}return m(h.decode()+`
52
+ `),q}}function Cv(a){const _=a.trim();if(_==="")return;let E;try{E=JSON.parse(_)}catch{return}return E===null?void 0:E}function wv(a,_){const E=a.split(`
53
+ `);if(_)return{lines:E.filter(N=>N.trim()!==""),rest:""};const S=E.pop()??"";return{lines:E.filter(N=>N.trim()!==""),rest:S}}function xv(a){const _=a.trim();if(_==="")return null;let E;try{E=JSON.parse(_)}catch{return null}return typeof E!="object"||E===null||Array.isArray(E)?null:E}function Ev(a){for(let _=a.length-1;_>=0;_--){const E=a[_];if(E.phase==="ready"||E.phase==="error")return E}return{phase:"error",code:"NO_OUTPUT",message:"deploy produced no terminal status"}}function kv(){return new bv}const Cp="sapiom-harness-theme",xc=new Set;function Av(){const a=typeof window<"u"?window.localStorage.getItem(Cp):null;return a==="light"||a==="dark"?a:"dark"}let Tc=Av();function Dc(){return Tc}function jv(a){Tc=a,document.documentElement.dataset.theme=a,window.localStorage.setItem(Cp,a),xc.forEach(_=>_(a))}function Rv(){jv(Tc==="dark"?"light":"dark")}function Nc(a){return xc.add(a),()=>xc.delete(a)}function Da(a){var S,N;const _=(S=a.inputSchema)==null?void 0:S.properties;if(!_)return[];const E=new Set(((N=a.inputSchema)==null?void 0:N.required)??[]);return Object.entries(_).map(([q,L])=>({name:q,type:(L==null?void 0:L.type)??"unknown",required:E.has(q)})).sort((q,L)=>Number(L.required)-Number(q.required))}function Qi(a){return a<1e3?`${a}ms`:`${Math.round(a/100)/10}s`}function Tv(a,_){const E=[],S=Da(a).length;S>0&&E.push(S===1?"1 input":`${S} inputs`);const N=_.filter(q=>q.from===a.id&&q.kind==="branching").length;return N>1&&E.push(`${N} branches`),a.timeoutMs&&a.timeoutMs>0&&E.push(`${Qi(a.timeoutMs)} limit`),E}function Dv(a){const _=a.nodes.filter(E=>E.kind==="terminal-success"||E.kind==="terminal-warn").length;return{steps:a.nodes.length-_,exits:_}}function Nv(a){const{steps:_,exits:E}=Dv(a),S=[`${_} ${_===1?"step":"steps"}`];return E>0&&S.push(`${E} ${E===1?"exit":"exits"}`),S.join(" · ")}function wp(a){switch(a){case"entry":return"Entry step";case"pause":return"Pause";case"terminal-success":return"Terminal · success";case"terminal-warn":return"Terminal · needs attention";case"launched-workflow":return"Launched workflow";default:return"Step"}}function Mv(a){if(!a||typeof a!="object")return null;const _=a;if(!_.properties||typeof _.properties!="object")return null;const E={};for(const[S,N]of Object.entries(_.properties)){const q=N&&typeof N=="object"?N.type:void 0;E[S]=typeof q=="string"?{type:q}:{}}return Object.keys(E).length===0?null:{properties:E,required:Array.isArray(_.required)?_.required.filter(S=>typeof S=="string"):[]}}function Lv(a){if(!a||typeof a!="object")return null;const _=a;if(!Array.isArray(_.nodes)||!Array.isArray(_.edges))return null;const E=S=>typeof S=="string"?S:"";return{name:E(_.name),entry:E(_.entry),nodes:_.nodes.map(S=>({id:E(S.id),kind:E(S.kind),label:E(S.label),role:E(S.role),description:E(S.description),timeoutMs:typeof S.timeoutMs=="number"&&S.timeoutMs>0?S.timeoutMs:null,inputSchema:Mv(S.inputSchema),capabilities:Array.isArray(S.capabilities)?S.capabilities.filter(N=>typeof N=="string"):[]})),edges:_.edges.map(S=>({from:E(S.from),to:E(S.to),kind:E(S.kind),label:E(S.label)})),groups:Array.isArray(_.groups)?_.groups.map(S=>({label:E(S.label),nodeIds:Array.isArray(S.nodeIds)?S.nodeIds.filter(N=>typeof N=="string"):[]})):[],warnings:Array.isArray(_.warnings)?_.warnings.filter(S=>typeof S=="string"):[]}}const xp="sapiom-harness-ui-prefs";function qs(){if(typeof window>"u")return{};try{const a=window.localStorage.getItem(xp);return a?JSON.parse(a):{}}catch{return{}}}function Bn(a){if(!(typeof window>"u"))try{window.localStorage.setItem(xp,JSON.stringify({...qs(),...a}))}catch{}}function Vr(a,_){return!a||a.stubbed!==!0?!1:a.steps.some(E=>E.name===_)}function Ov(a){if(!a)return null;const _={};return a.unusedStubs&&a.unusedStubs.length>0&&(_.unusedStubs=a.unusedStubs),a.stubWarnings&&a.stubWarnings.length>0&&(_.stubWarnings=a.stubWarnings),_.unusedStubs||_.stubWarnings?_:null}function Na(a){if(typeof a=="string")return a;try{return JSON.stringify(a,null,2)??String(a)}catch{return String(a)}}const Uf=3e3,If=2e3;function Bv(a){return a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`}function qf(a){let _;if(typeof a=="string")_=a;else try{_=JSON.stringify(a,null,2)??String(a)}catch{_=String(a)}return _.length>If?`${_.slice(0,If)}
54
+ … (truncated, ${_.length} chars total)`:_}function Hv(a,_,E){const S=[];S.push(`Step: ${a.name}`),S.push(`Status: ${a.status}`),a.latencyMs!=null&&S.push(`Latency: ${Bv(a.latencyMs)}`),a.status==="failed"&&a.error&&S.push(`Error: ${a.error}`),(_==null?void 0:_.input)!==void 0&&S.push(`
55
+ Input:
56
+ ${qf(_.input)}`),(_==null?void 0:_.output)!==void 0&&S.push(`
57
+ Output:
58
+ ${qf(_.output)}`);const N=_==null?void 0:_.calls;if(N!==void 0)if(N.length>0){S.push(`
59
+ Capabilities called:`);for(const q of N){const L=q.stubUsed?" (stubbed)":"";S.push(` - ${q.capability}${L}`)}}else S.push(`
60
+ Capabilities called: none (the step made zero capability calls).`);else if(E!=null&&E.capabilities&&E.capabilities.length>0){S.push(`
61
+ Capabilities declared (no call trace):`);for(const q of E.capabilities)S.push(` - ${q}`)}if(_!=null&&_.unusedStubs&&_.unusedStubs.length>0){S.push(`
62
+ Unused stubs (supplied but matched no call):`);for(const q of _.unusedStubs)S.push(` - ${q}`)}if(_!=null&&_.stubWarnings&&_.stubWarnings.length>0){S.push(`
63
+ Stub warnings:`);for(const q of _.stubWarnings)S.push(` - ${q}`)}if(a.logSlice){const q=a.logSlice.trimEnd(),L=q.length>Uf?q.slice(q.length-Uf):q;S.push(`
64
+ Logs:
65
+ ${L}`)}return S.join(`
66
+ `)}const zv=/\.(png|jpg|jpeg|webp|gif|svg)($|\?)/i,Uv=/https?:\/\/[^\s"'<>`\])\]]+/gi,Iv=/[.,;:)\]}\s]+$/;function $f(a){if(typeof a=="string")return a;try{return JSON.stringify(a)??String(a)}catch{return String(a)}}function qv(a){const _=new Set,E=[],S=N=>{const q=N.matchAll(Uv);for(const[L]of q){const h=L.replace(Iv,"");if(!h||_.has(h))continue;_.add(h);const p=zv.test(h)?"image":"other";E.push({url:h,kind:p})}};if(a.output!==void 0&&S($f(a.output)),a.logSlice&&S(a.logSlice),a.calls)for(const N of a.calls)N.result!==void 0&&S($f(N.result));return E}/**
67
+ * @license lucide-react v1.23.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const Ep=(...a)=>a.filter((_,E,S)=>!!_&&_.trim()!==""&&S.indexOf(_)===E).join(" ").trim();/**
72
+ * @license lucide-react v1.23.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const $v=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
77
+ * @license lucide-react v1.23.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const Pv=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(_,E,S)=>S?S.toUpperCase():E.toLowerCase());/**
82
+ * @license lucide-react v1.23.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const Pf=a=>{const _=Pv(a);return _.charAt(0).toUpperCase()+_.slice(1)};/**
87
+ * @license lucide-react v1.23.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */var vc={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"};/**
92
+ * @license lucide-react v1.23.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const Wv=a=>{for(const _ in a)if(_.startsWith("aria-")||_==="role"||_==="title")return!0;return!1},Fv=U.createContext({}),Yv=()=>U.useContext(Fv),Kv=U.forwardRef(({color:a,size:_,strokeWidth:E,absoluteStrokeWidth:S,className:N="",children:q,iconNode:L,...h},p)=>{const{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:u=!1,color:v="currentColor",className:w=""}=Yv()??{},x=S??u?Number(E??g)*24/Number(_??m):E??g;return U.createElement("svg",{ref:p,...vc,width:_??m??vc.width,height:_??m??vc.height,stroke:a??v,strokeWidth:x,className:Ep("lucide",w,N),...!q&&!Wv(h)&&{"aria-hidden":"true"},...h},[...L.map(([b,d])=>U.createElement(b,d)),...Array.isArray(q)?q:[q]])});/**
97
+ * @license lucide-react v1.23.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const je=(a,_)=>{const E=U.forwardRef(({className:S,...N},q)=>U.createElement(Kv,{ref:q,iconNode:_,className:Ep(`lucide-${$v(Pf(a))}`,`lucide-${a}`,S),...N}));return E.displayName=Pf(a),E};/**
102
+ * @license lucide-react v1.23.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const Xv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gv=je("arrow-down",Xv);/**
107
+ * @license lucide-react v1.23.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const Vv=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Zv=je("arrow-left",Vv);/**
112
+ * @license lucide-react v1.23.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const Qv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Jv=je("arrow-right",Qv);/**
117
+ * @license lucide-react v1.23.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const eg=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],tg=je("arrow-up-right",eg);/**
122
+ * @license lucide-react v1.23.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const sg=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ig=je("arrow-up",sg);/**
127
+ * @license lucide-react v1.23.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const ng=[["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"}]],ag=je("book-open",ng);/**
132
+ * @license lucide-react v1.23.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const rg=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],lg=je("brain",rg);/**
137
+ * @license lucide-react v1.23.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const og=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cg=je("check",og);/**
142
+ * @license lucide-react v1.23.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const ug=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],hg=je("chevron-down",ug);/**
147
+ * @license lucide-react v1.23.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const dg=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fg=je("chevron-right",dg);/**
152
+ * @license lucide-react v1.23.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const pg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],mg=je("circle-question-mark",pg);/**
157
+ * @license lucide-react v1.23.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const _g=[["path",{d:"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057",key:"1uxyv8"}],["path",{d:"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78",key:"99tcn7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],vg=je("cloud-off",_g);/**
162
+ * @license lucide-react v1.23.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const gg=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],yg=je("cloud-upload",gg);/**
167
+ * @license lucide-react v1.23.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Sg=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],bg=je("cloud",Sg);/**
172
+ * @license lucide-react v1.23.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const Cg=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],wg=je("code",Cg);/**
177
+ * @license lucide-react v1.23.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const xg=[["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"}]],Eg=je("copy",xg);/**
182
+ * @license lucide-react v1.23.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const kg=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Ag=je("corner-down-right",kg);/**
187
+ * @license lucide-react v1.23.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const jg=[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]],Rg=je("corner-left-up",jg);/**
192
+ * @license lucide-react v1.23.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const Tg=[["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"}]],Dg=je("ellipsis",Tg);/**
197
+ * @license lucide-react v1.23.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const Ng=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Mg=je("external-link",Ng);/**
202
+ * @license lucide-react v1.23.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const Lg=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Og=je("flask-conical",Lg);/**
207
+ * @license lucide-react v1.23.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const Bg=[["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"}]],Hg=je("folder",Bg);/**
212
+ * @license lucide-react v1.23.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const zg=[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]],Ug=je("frame",zg);/**
217
+ * @license lucide-react v1.23.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const Ig=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],qg=je("hammer",Ig);/**
222
+ * @license lucide-react v1.23.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const $g=[["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"}]],Pg=je("history",$g);/**
227
+ * @license lucide-react v1.23.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const Wg=[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],Fg=je("image-up",Wg);/**
232
+ * @license lucide-react v1.23.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const Yg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Kg=je("info",Yg);/**
237
+ * @license lucide-react v1.23.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const Xg=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],Gg=je("layout-template",Xg);/**
242
+ * @license lucide-react v1.23.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const Vg=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Zg=je("list-checks",Vg);/**
247
+ * @license lucide-react v1.23.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const Qg=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Jg=je("list",Qg);/**
252
+ * @license lucide-react v1.23.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const e0=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],t0=je("loader",e0);/**
257
+ * @license lucide-react v1.23.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const s0=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],i0=je("log-out",s0);/**
262
+ * @license lucide-react v1.23.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const n0=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],a0=je("maximize-2",n0);/**
267
+ * @license lucide-react v1.23.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const r0=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],l0=je("menu",r0);/**
272
+ * @license lucide-react v1.23.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const o0=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],c0=je("message-square",o0);/**
277
+ * @license lucide-react v1.23.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const u0=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],h0=je("minimize-2",u0);/**
282
+ * @license lucide-react v1.23.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const d0=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],f0=je("moon",d0);/**
287
+ * @license lucide-react v1.23.0 - ISC
288
+ *
289
+ * This source code is licensed under the ISC license.
290
+ * See the LICENSE file in the root directory of this source tree.
291
+ */const p0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],m0=je("panel-left-close",p0);/**
292
+ * @license lucide-react v1.23.0 - ISC
293
+ *
294
+ * This source code is licensed under the ISC license.
295
+ * See the LICENSE file in the root directory of this source tree.
296
+ */const _0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],v0=je("panel-left-open",_0);/**
297
+ * @license lucide-react v1.23.0 - ISC
298
+ *
299
+ * This source code is licensed under the ISC license.
300
+ * See the LICENSE file in the root directory of this source tree.
301
+ */const g0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],y0=je("panel-right-close",g0);/**
302
+ * @license lucide-react v1.23.0 - ISC
303
+ *
304
+ * This source code is licensed under the ISC license.
305
+ * See the LICENSE file in the root directory of this source tree.
306
+ */const S0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],b0=je("panel-right-open",S0);/**
307
+ * @license lucide-react v1.23.0 - ISC
308
+ *
309
+ * This source code is licensed under the ISC license.
310
+ * See the LICENSE file in the root directory of this source tree.
311
+ */const C0=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],w0=je("paperclip",C0);/**
312
+ * @license lucide-react v1.23.0 - ISC
313
+ *
314
+ * This source code is licensed under the ISC license.
315
+ * See the LICENSE file in the root directory of this source tree.
316
+ */const x0=[["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"}]],E0=je("pencil",x0);/**
317
+ * @license lucide-react v1.23.0 - ISC
318
+ *
319
+ * This source code is licensed under the ISC license.
320
+ * See the LICENSE file in the root directory of this source tree.
321
+ */const k0=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],A0=je("play",k0);/**
322
+ * @license lucide-react v1.23.0 - ISC
323
+ *
324
+ * This source code is licensed under the ISC license.
325
+ * See the LICENSE file in the root directory of this source tree.
326
+ */const j0=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],R0=je("plug",j0);/**
327
+ * @license lucide-react v1.23.0 - ISC
328
+ *
329
+ * This source code is licensed under the ISC license.
330
+ * See the LICENSE file in the root directory of this source tree.
331
+ */const T0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],D0=je("plus",T0);/**
332
+ * @license lucide-react v1.23.0 - ISC
333
+ *
334
+ * This source code is licensed under the ISC license.
335
+ * See the LICENSE file in the root directory of this source tree.
336
+ */const N0=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],M0=je("radio",N0);/**
337
+ * @license lucide-react v1.23.0 - ISC
338
+ *
339
+ * This source code is licensed under the ISC license.
340
+ * See the LICENSE file in the root directory of this source tree.
341
+ */const L0=[["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"}]],O0=je("refresh-cw",L0);/**
342
+ * @license lucide-react v1.23.0 - ISC
343
+ *
344
+ * This source code is licensed under the ISC license.
345
+ * See the LICENSE file in the root directory of this source tree.
346
+ */const B0=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],H0=je("search",B0);/**
347
+ * @license lucide-react v1.23.0 - ISC
348
+ *
349
+ * This source code is licensed under the ISC license.
350
+ * See the LICENSE file in the root directory of this source tree.
351
+ */const z0=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],U0=je("settings",z0);/**
352
+ * @license lucide-react v1.23.0 - ISC
353
+ *
354
+ * This source code is licensed under the ISC license.
355
+ * See the LICENSE file in the root directory of this source tree.
356
+ */const I0=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],q0=je("sparkles",I0);/**
357
+ * @license lucide-react v1.23.0 - ISC
358
+ *
359
+ * This source code is licensed under the ISC license.
360
+ * See the LICENSE file in the root directory of this source tree.
361
+ */const $0=[["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"}]],P0=je("square-terminal",$0);/**
362
+ * @license lucide-react v1.23.0 - ISC
363
+ *
364
+ * This source code is licensed under the ISC license.
365
+ * See the LICENSE file in the root directory of this source tree.
366
+ */const W0=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],F0=je("square",W0);/**
367
+ * @license lucide-react v1.23.0 - ISC
368
+ *
369
+ * This source code is licensed under the ISC license.
370
+ * See the LICENSE file in the root directory of this source tree.
371
+ */const Y0=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],K0=je("sun",Y0);/**
372
+ * @license lucide-react v1.23.0 - ISC
373
+ *
374
+ * This source code is licensed under the ISC license.
375
+ * See the LICENSE file in the root directory of this source tree.
376
+ */const X0=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],G0=je("tags",X0);/**
377
+ * @license lucide-react v1.23.0 - ISC
378
+ *
379
+ * This source code is licensed under the ISC license.
380
+ * See the LICENSE file in the root directory of this source tree.
381
+ */const V0=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Z0=je("trash-2",V0);/**
382
+ * @license lucide-react v1.23.0 - ISC
383
+ *
384
+ * This source code is licensed under the ISC license.
385
+ * See the LICENSE file in the root directory of this source tree.
386
+ */const Q0=[["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"}]],J0=je("triangle-alert",Q0);/**
387
+ * @license lucide-react v1.23.0 - ISC
388
+ *
389
+ * This source code is licensed under the ISC license.
390
+ * See the LICENSE file in the root directory of this source tree.
391
+ */const e1=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],t1=je("wand-sparkles",e1);/**
392
+ * @license lucide-react v1.23.0 - ISC
393
+ *
394
+ * This source code is licensed under the ISC license.
395
+ * See the LICENSE file in the root directory of this source tree.
396
+ */const s1=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],i1=je("workflow",s1);/**
397
+ * @license lucide-react v1.23.0 - ISC
398
+ *
399
+ * This source code is licensed under the ISC license.
400
+ * See the LICENSE file in the root directory of this source tree.
401
+ */const n1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],a1=je("x",n1);/**
402
+ * @license lucide-react v1.23.0 - ISC
403
+ *
404
+ * This source code is licensed under the ISC license.
405
+ * See the LICENSE file in the root directory of this source tree.
406
+ */const r1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],l1=je("zap",r1);/**
407
+ * @license lucide-react v1.23.0 - ISC
408
+ *
409
+ * This source code is licensed under the ISC license.
410
+ * See the LICENSE file in the root directory of this source tree.
411
+ */const o1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],c1=je("zoom-in",o1);/**
412
+ * @license lucide-react v1.23.0 - ISC
413
+ *
414
+ * This source code is licensed under the ISC license.
415
+ * See the LICENSE file in the root directory of this source tree.
416
+ */const u1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],h1=je("zoom-out",u1),d1={ArrowDown:Gv,ArrowLeft:Zv,ArrowRight:Jv,ArrowUp:ig,ArrowUpRight:tg,BookOpen:ag,Brain:lg,Check:cg,ChevronDown:hg,ChevronRight:fg,Cloud:bg,CloudOff:vg,CloudUpload:yg,Code:wg,Copy:Eg,CornerDownRight:Ag,CornerLeftUp:Rg,ExternalLink:Mg,FlaskConical:Og,Folder:Hg,Frame:Ug,Hammer:qg,History:Pg,ImageUp:Fg,Info:Kg,LayoutTemplate:Gg,List:Jg,ListChecks:Zg,Loader:t0,LogOut:i0,Maximize2:a0,Menu:l0,MessageSquare:c0,Minimize2:h0,MoreHorizontal:Dg,Moon:f0,PanelLeftClose:m0,PanelLeftOpen:v0,PanelRightClose:y0,PanelRightOpen:b0,Paperclip:w0,Pencil:E0,Play:A0,Plug:R0,Plus:D0,Radio:M0,RefreshCw:O0,Search:H0,Settings:U0,Sparkles:q0,Square:F0,SquareTerminal:P0,Sun:K0,Tags:G0,Trash2:Z0,TriangleAlert:J0,Wand2:t1,Workflow:i1,X:a1,Zap:l1,ZoomIn:c1,ZoomOut:h1};function fe({name:a,size:_=16}){const E=d1[a]??mg;return n.jsx(E,{size:_,strokeWidth:1.75,"aria-hidden":"true"})}function Zr(){return n.jsx("span",{className:"canvas-run-stub-chip","data-testid":"canvas-run-stub-chip","data-tooltip":"Capability calls in this step were served by stubs (offline run) — not real calls",children:"stubbed"})}function kp({step:a}){const _=qv(a);return _.length===0?null:n.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-links",children:[n.jsx("h4",{children:"Links"}),n.jsx("div",{className:"canvas-links-list",children:_.map(({url:E,kind:S})=>S==="image"?n.jsx("a",{href:E,target:"_blank",rel:"noreferrer",className:"canvas-link-thumb-wrap","data-testid":"canvas-link-image",children:n.jsx("img",{src:E,alt:"",className:"canvas-link-thumb",loading:"lazy"})},E):n.jsxs("a",{href:E,target:"_blank",rel:"noreferrer",className:"canvas-link-item","data-testid":"canvas-link-other",children:[n.jsx(fe,{name:"ExternalLink",size:12}),n.jsx("span",{className:"canvas-link-url",children:"Open"})]},E))})]})}function Ap({step:a}){return!a.calls||a.calls.length===0?null:n.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-capability-calls",children:[n.jsx("h4",{children:"Capability calls"}),n.jsx("div",{className:"canvas-capability-calls",children:a.calls.map((_,E)=>n.jsxs("div",{className:"canvas-capability-call",children:[n.jsxs("div",{className:"canvas-capability-call-head",children:[n.jsx("code",{className:"canvas-input-field",children:_.capability}),_.stubUsed&&n.jsx("span",{className:"canvas-run-stub-chip","data-testid":`canvas-call-stub-chip-${_.capability}`,children:"stubbed"})]}),_.result!==void 0&&n.jsxs("details",{className:"canvas-run-logs canvas-capability-call-result","data-testid":`canvas-call-result-${_.capability}`,children:[n.jsx("summary",{children:"Result"}),n.jsx("pre",{children:Na(_.result)})]})]},`${_.capability}-${E}`))})]})}function Mc({run:a}){const _=Ov(a);return _?n.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-stub-notice",children:[n.jsx("h4",{children:"Stub notices"}),_.unusedStubs&&n.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-unused",children:[n.jsx("span",{className:"canvas-input-label",children:"Unused stubs"}),n.jsx("p",{className:"canvas-stub-notice-hint",children:"Supplied but matched no capability call — likely a typo or wrong path."}),n.jsx("ul",{className:"canvas-detail-warnings",children:_.unusedStubs.map(E=>n.jsxs("li",{children:[n.jsx("code",{className:"canvas-input-field",children:E.key})," in ",E.step]},`${E.step} ${E.key}`))})]}),_.stubWarnings&&n.jsxs("div",{className:"canvas-stub-notice","data-testid":"canvas-stub-warnings",children:[n.jsx("span",{className:"canvas-input-label",children:"Stub warnings"}),n.jsx("p",{className:"canvas-stub-notice-hint",children:"Matched a call but had the wrong shape."}),n.jsx("ul",{className:"canvas-detail-warnings",children:_.stubWarnings.map(E=>n.jsx("li",{children:E},E))})]})]}):null}function Qr(a,_){return(a==null?void 0:a.steps.find(E=>E.name===_))??null}function jp(a){return a?`${a} run`:"run"}function Jr({status:a}){return a==="passed"?n.jsx("span",{className:"canvas-run-status is-passed","data-status":"passed","aria-label":"passed",children:n.jsx(fe,{name:"Check",size:11})}):a==="failed"?n.jsx("span",{className:"canvas-run-status is-failed","data-status":"failed","aria-label":"failed",children:n.jsx(fe,{name:"X",size:11})}):a==="running"?n.jsx("span",{className:"canvas-run-status is-running","data-status":"running","aria-label":"running"}):n.jsx("span",{className:"canvas-run-status is-pending","data-status":"pending","aria-label":"pending"})}function Yr(a){return a.kind==="branching"?"branch":a.kind==="cross"?"pause resume":a.kind==="launch"?"launch":null}function Rp({node:a}){const _=Da(a);return _.length===0?null:n.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-input-${a.id}`,children:[n.jsx("span",{className:"canvas-input-label",children:"Input"}),n.jsx("span",{className:"canvas-input-fields",children:_.map(E=>n.jsxs("code",{className:"canvas-input-field"+(E.required?" is-required":""),"aria-label":`${E.name}, ${E.type}${E.required?", required":""}`,children:[E.name,E.required&&n.jsx("span",{"aria-hidden":"true",children:"*"}),n.jsx("span",{className:"canvas-input-type",children:E.type})]},E.name))})]})}function Tp({node:a}){return a.capabilities.length===0?null:n.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-step-capabilities-${a.id}`,children:[n.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),n.jsx("span",{className:"canvas-input-fields",children:a.capabilities.map(_=>n.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:_},_))})]})}function f1({graph:a,node:_}){const E=a.edges.filter(L=>L.from===_.id),S=a.edges.filter(L=>L.to===_.id);if(E.length===0&&S.length===0)return null;const N=L=>{var h;return((h=a.nodes.find(p=>p.id===L))==null?void 0:h.label)??L},q=(L,h,p)=>{const m=`${p}${L.from}->${L.to}`;return n.jsxs("div",{className:"canvas-step-transition",children:[n.jsx(fe,{name:p,size:12}),n.jsx("span",{className:"canvas-step-transition-target",children:N(h)}),L.label&&n.jsx("span",{className:"canvas-step-transition-cond",children:L.label})]},m)};return n.jsxs(n.Fragment,{children:[E.map(L=>q(L,L.to,"CornerDownRight")),S.map(L=>q(L,L.from,"CornerLeftUp"))]})}function p1(a,_){return a.kind!=="launched-workflow"?null:_.find(E=>E.path===a.label)??_.find(E=>E.name===a.label)??_.find(E=>E.path.endsWith(`/${a.label}`))??null}function Lc({node:a,workflows:_,onOpenWorkflow:E}){const S=p1(a,_);return S?n.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-open-workflow-${a.id}`,"data-tooltip":`Switch to ${S.name}`,onClick:()=>E(S.path),children:["Open workflow ",n.jsx(fe,{name:"ArrowRight",size:12})]}):null}function Wf({run:a,target:_}){return n.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-run-fallback",children:[n.jsxs("div",{className:"canvas-steps-label",children:["Run steps",n.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:jp(_)})]}),a.steps.map((E,S)=>{const N=[E.latencyMs!==void 0?Qi(E.latencyMs):null].filter(q=>q!==null);return n.jsxs("div",{className:"canvas-step-item",children:[n.jsxs("div",{className:"canvas-step-row is-static","data-testid":`canvas-run-step-${E.name}`,children:[n.jsx("span",{className:"canvas-step-index",children:String(S+1).padStart(2,"0")}),n.jsx(Jr,{status:E.status}),n.jsxs("span",{className:"canvas-step-copy",children:[n.jsx("span",{className:"canvas-step-name",children:E.name}),n.jsx("span",{className:"canvas-step-role",children:E.status})]}),Vr(a,E.name)&&n.jsx(Zr,{}),n.jsx("span",{className:"canvas-step-meta",children:N.join(" · ")}),n.jsx("span",{"aria-hidden":"true"})]}),(E.error||E.logSlice)&&n.jsxs("div",{className:"canvas-step-expand",children:[E.error&&n.jsx("pre",{className:"canvas-run-error",children:E.error}),E.logSlice&&n.jsxs("details",{className:"canvas-run-logs",children:[n.jsx("summary",{children:"Logs"}),n.jsx("pre",{children:E.logSlice})]})]})]},E.id)}),n.jsx(Mc,{run:a}),n.jsx("p",{className:"canvas-empty-hint",children:"Run data only. Open the Canvas tab for the diagram — transitions and contracts come from the workflow."})]})}function m1({graph:a,run:_,runTarget:E,workflows:S,onOpenWorkflow:N,expandedId:q,onToggle:L,onOpenDetail:h}){const p=new Set(a.nodes.map(v=>v.id)),m=a.groups.filter(v=>v.nodeIds.length>0&&v.nodeIds.every(w=>p.has(w))),g=v=>{var w;return((w=m.find(x=>x.nodeIds.includes(v)))==null?void 0:w.label)??null},u=[];return a.nodes.forEach((v,w)=>{const x=g(v.id),b=u[u.length-1];b&&b.group===x?b.nodes.push({node:v,index:w}):u.push({group:x,nodes:[{node:v,index:w}]})}),n.jsxs("div",{className:"canvas-steps-list","data-testid":"canvas-steps-list",children:[n.jsxs("div",{className:"canvas-steps-label",children:["Steps",_&&n.jsx("span",{className:"canvas-steps-run-note","data-testid":"canvas-steps-run-note",children:jp(E)})]}),u.map((v,w)=>n.jsxs("div",{className:v.group?"canvas-step-band":void 0,children:[v.group&&n.jsx("div",{className:"canvas-step-group",children:v.group}),v.nodes.map(({node:x,index:b})=>{const d=q===x.id,f=Tv(x,a.edges),l=Qr(_,x.id),o=l?[l.latencyMs!==void 0?Qi(l.latencyMs):null].filter(y=>y!==null):[];return n.jsxs("div",{className:"canvas-step-item"+(d?" is-open":""),children:[n.jsxs("button",{className:"canvas-step-row","data-testid":`canvas-step-row-${x.id}`,"aria-expanded":d,onClick:()=>L(x.id),children:[n.jsx("span",{className:"canvas-step-index",children:String(b+1).padStart(2,"0")}),l?n.jsx(Jr,{status:l.status}):n.jsx("span",{className:"canvas-step-dot dot--"+x.kind,"aria-hidden":"true"}),n.jsxs("span",{className:"canvas-step-copy",children:[n.jsx("span",{className:"canvas-step-name",children:x.label}),n.jsx("span",{className:"canvas-step-role",children:x.role})]}),l&&Vr(_,x.id)&&n.jsx(Zr,{}),n.jsx("span",{className:"canvas-step-meta",children:(o.length>0?o:f).join(" · ")}),n.jsx("span",{className:"canvas-step-caret"+(d?" is-open":""),"aria-hidden":"true",children:n.jsx(fe,{name:"ChevronDown",size:13})})]}),d&&n.jsxs("div",{className:"canvas-step-expand","data-testid":`canvas-step-expand-${x.id}`,children:[x.description&&n.jsx("p",{className:"canvas-step-desc",children:x.description}),n.jsx(Rp,{node:x}),n.jsx(Tp,{node:x}),n.jsx(f1,{graph:a,node:x}),n.jsx(Lc,{node:x,workflows:S,onOpenWorkflow:N}),n.jsxs("button",{className:"canvas-step-open","data-testid":`canvas-step-open-${x.id}`,onClick:()=>h(x.id),children:["Full details ",n.jsx(fe,{name:"ArrowRight",size:12})]})]})]},x.id)})]},`${v.group??"ungrouped"}-${w}`))]})}function _1({graph:a,node:_,run:E,workflows:S,onOpenWorkflow:N}){const q=Qr(E,_.id),L=a.edges.filter(g=>g.from===_.id),h=a.edges.filter(g=>g.to===_.id),p=g=>{var u;return((u=a.nodes.find(v=>v.id===g))==null?void 0:u.label)??g},m=a.groups.filter(g=>g.nodeIds.includes(_.id));return n.jsx("div",{className:"canvas-detail","data-testid":"canvas-step-detail",children:n.jsxs("div",{className:"canvas-detail-body",children:[_.role&&n.jsx("p",{className:"canvas-detail-role",children:_.role}),_.description&&n.jsx("p",{className:"canvas-detail-desc",children:_.description}),m.length>0&&n.jsxs("p",{className:"canvas-detail-groups",children:["Part of ",m.map(g=>g.label).join(", ")]}),n.jsx(Lc,{node:_,workflows:S,onOpenWorkflow:N}),q&&n.jsxs("section",{className:"canvas-detail-section","data-testid":"canvas-detail-run",children:[n.jsx("h4",{children:"Last run"}),n.jsxs("div",{className:"canvas-detail-contract",children:[n.jsx("span",{className:"canvas-input-label",children:"Status"}),n.jsxs("span",{className:"canvas-run-text is-"+q.status,children:[n.jsx(Jr,{status:q.status}),q.status,Vr(E,_.id)&&n.jsx(Zr,{})]})]}),q.latencyMs!==void 0&&n.jsxs("div",{className:"canvas-detail-contract",children:[n.jsx("span",{className:"canvas-input-label",children:"Duration"}),n.jsx("span",{className:"canvas-detail-timeout",children:Qi(q.latencyMs)})]}),q.input!==void 0&&n.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-detail-run-input-${_.id}`,children:[n.jsx("summary",{children:"Input"}),n.jsx("pre",{children:Na(q.input)})]}),q.output!==void 0&&n.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-detail-run-output-${_.id}`,children:[n.jsx("summary",{children:"Output"}),n.jsx("pre",{children:Na(q.output)})]}),q.error&&n.jsx("pre",{className:"canvas-run-error",children:q.error}),q.logSlice&&n.jsxs("details",{className:"canvas-run-logs",children:[n.jsx("summary",{children:"Logs"}),n.jsx("pre",{children:q.logSlice})]})]}),q&&n.jsx(Ap,{step:q}),q&&n.jsx(kp,{step:q}),n.jsx(Mc,{run:E}),(Da(_).length>0||_.timeoutMs!==null||_.capabilities.length>0)&&n.jsxs("section",{className:"canvas-detail-section",children:[n.jsx("h4",{children:"Contract"}),_.capabilities.length>0&&n.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-capabilities",children:[n.jsx("span",{className:"canvas-input-label",children:"Capabilities"}),n.jsx("span",{className:"canvas-input-fields",children:_.capabilities.map(g=>n.jsx("code",{className:"canvas-input-field","data-tooltip":"Sapiom capability this step calls",children:g},g))})]}),Da(_).length>0&&n.jsxs("div",{className:"canvas-detail-contract","data-testid":"canvas-detail-input",children:[n.jsx("span",{className:"canvas-input-label",children:"Input"}),n.jsx("span",{className:"canvas-input-fields",children:Da(_).map(g=>n.jsxs("code",{className:"canvas-input-field"+(g.required?" is-required":""),"aria-label":`${g.name}, ${g.type}${g.required?", required":""}`,"data-tooltip":g.required?"Required field":"Optional field",children:[g.name,g.required&&n.jsx("span",{"aria-hidden":"true",children:"*"}),n.jsx("span",{className:"canvas-input-type",children:g.type})]},g.name))})]}),_.timeoutMs!==null&&n.jsxs("div",{className:"canvas-detail-contract",children:[n.jsx("span",{className:"canvas-input-label",children:"Timeout"}),n.jsx("span",{className:"canvas-detail-timeout",children:Qi(_.timeoutMs)})]})]}),n.jsxs("section",{className:"canvas-detail-section",children:[n.jsxs("h4",{children:["Leads to ",n.jsx("span",{className:"canvas-detail-count",children:L.length})]}),L.length===0?n.jsx("p",{className:"canvas-detail-empty",children:"Terminal step: nothing follows."}):n.jsx("ul",{className:"canvas-detail-edges",children:L.map(g=>n.jsx("li",{children:n.jsxs("div",{className:"canvas-detail-edge",children:[n.jsx(fe,{name:"CornerDownRight",size:13}),n.jsx("span",{className:"canvas-detail-edge-target",children:p(g.to)}),Yr(g)&&n.jsx("span",{className:"canvas-detail-edge-kind",children:Yr(g)}),g.label&&n.jsx("span",{className:"canvas-detail-edge-cond",children:g.label})]})},`${g.from}->${g.to}`))})]}),n.jsxs("section",{className:"canvas-detail-section",children:[n.jsxs("h4",{children:["Reached from ",n.jsx("span",{className:"canvas-detail-count",children:h.length})]}),h.length===0?n.jsx("p",{className:"canvas-detail-empty",children:_.kind==="entry"?"Entry point: the workflow starts here.":"No step routes here."}):n.jsx("ul",{className:"canvas-detail-edges",children:h.map(g=>n.jsx("li",{children:n.jsxs("div",{className:"canvas-detail-edge",children:[n.jsx(fe,{name:"CornerLeftUp",size:13}),n.jsx("span",{className:"canvas-detail-edge-target",children:p(g.from)}),Yr(g)&&n.jsx("span",{className:"canvas-detail-edge-kind",children:Yr(g)}),g.label&&n.jsx("span",{className:"canvas-detail-edge-cond",children:g.label})]})},`${g.from}->${g.to}`))})]}),a.warnings.length>0&&n.jsxs("section",{className:"canvas-detail-section",children:[n.jsxs("h4",{children:["Graph warnings ",n.jsx("span",{className:"canvas-detail-count",children:a.warnings.length})]}),n.jsx("ul",{className:"canvas-detail-warnings",children:a.warnings.map(g=>n.jsx("li",{children:g},g))})]})]})})}function v1({node:a,run:_,workflows:E,onOpenWorkflow:S}){const N=Qr(_,a.id);return n.jsxs("div",{className:"canvas-inspector","data-testid":"canvas-step-inspector",children:[a.role&&n.jsx("p",{className:"canvas-detail-role",children:a.role}),a.description&&n.jsx("p",{className:"canvas-step-desc",children:a.description}),n.jsx(Rp,{node:a}),n.jsx(Tp,{node:a}),a.timeoutMs!==null&&n.jsxs("div",{className:"canvas-input-card","data-testid":`canvas-inspector-timeout-${a.id}`,children:[n.jsx("span",{className:"canvas-input-label",children:"Timeout"}),n.jsx("span",{className:"canvas-detail-timeout",children:Qi(a.timeoutMs)})]}),n.jsx(Lc,{node:a,workflows:E,onOpenWorkflow:S}),N&&n.jsxs("div",{className:"canvas-inspector-run","data-testid":"canvas-inspector-run",children:[n.jsx("span",{className:"canvas-input-label",children:"Last run"}),n.jsxs("span",{className:"canvas-run-text is-"+N.status,children:[n.jsx(Jr,{status:N.status}),N.status,Vr(_,a.id)&&n.jsx(Zr,{})]}),N.latencyMs!==void 0&&n.jsx("span",{className:"canvas-inspector-run-meta",children:Qi(N.latencyMs)})]}),(N==null?void 0:N.input)!==void 0&&n.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-inspector-run-input-${a.id}`,children:[n.jsx("summary",{children:"Input"}),n.jsx("pre",{children:Na(N.input)})]}),(N==null?void 0:N.output)!==void 0&&n.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-inspector-run-output-${a.id}`,children:[n.jsx("summary",{children:"Output"}),n.jsx("pre",{children:Na(N.output)})]}),(N==null?void 0:N.error)&&n.jsx("pre",{className:"canvas-run-error",children:N.error}),(N==null?void 0:N.logSlice)&&n.jsxs("details",{className:"canvas-run-logs","data-testid":`canvas-inspector-run-logs-${a.id}`,children:[n.jsx("summary",{children:"Logs"}),n.jsx("pre",{children:N.logSlice})]}),N&&n.jsx(Ap,{step:N}),N&&n.jsx(kp,{step:N}),n.jsx(Mc,{run:_})]})}function g1({node:a,run:_,onInjectPrompt:E,onClose:S}){const N=a?Qr(_,a.id):null,[q,L]=U.useState("");function h(m){var w;if(!a){E(m);return}const g=N?{input:N.input,output:N.output,calls:N.calls,unusedStubs:(w=_==null?void 0:_.unusedStubs)==null?void 0:w.map(x=>x.key),stubWarnings:_==null?void 0:_.stubWarnings}:void 0,u=a.capabilities.length>0?{capabilities:a.capabilities}:void 0,v=Hv(N??{id:a.id,name:a.id,status:"pending"},g,u);E(`${v}
417
+
418
+ ${m}`)}function p(){const m=q.trim();m&&(h(m),L(""))}return n.jsxs("div",{className:"canvas-chat-panel","data-testid":"canvas-chat-panel",children:[n.jsxs("div",{className:"canvas-chat-head",children:[n.jsx("span",{className:"canvas-chat-title","data-testid":"canvas-chat-title",children:a?`Chat · ${a.label}`:"Chat"}),n.jsx("button",{className:"theme-toggle canvas-chat-close","data-testid":"canvas-chat-close","aria-label":"Close chat","data-tooltip":"Close chat",onClick:S,children:n.jsx(fe,{name:"X",size:13})})]}),n.jsxs("div",{className:"canvas-inspector-macros","data-testid":"canvas-inspector-macros",children:[a&&n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-slow",onClick:()=>h("Why is this step slow / stuck?"),children:"Why slow / stuck?"}),n.jsx("button",{className:"canvas-inspector-macro-btn "+((N==null?void 0:N.status)==="failed"?"btn-primary":"btn-ghost"),"data-testid":"canvas-macro-debug",onClick:()=>h("Debug this step"),children:"Debug this step"}),n.jsx("button",{className:"canvas-inspector-macro-btn btn-ghost","data-testid":"canvas-macro-explain",onClick:()=>h("Explain this step"),children:"Explain this step"})]}),n.jsxs("div",{className:"canvas-inspector-freeform",children:[n.jsx("textarea",{className:"canvas-inspector-freeform-input","data-testid":"canvas-freeform-input",placeholder:a?"Ask about this step…":"Ask about this workflow…",rows:2,value:q,onChange:m=>L(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&(m.preventDefault(),p())}}),n.jsx("button",{className:"btn-primary canvas-inspector-freeform-ask","data-testid":"canvas-freeform-ask",disabled:!q.trim(),onClick:p,children:"Ask"})]})]})]})}const Ff=24;function y1({overview:a,selectedNode:_,graph:E,run:S,workflows:N,onOpenWorkflow:q,onOpenSteps:L,onDeselect:h,onCollapse:p}){const m=U.useRef(null),g=U.useRef(null),u=U.useRef(null),v=U.useRef(null),w=U.useRef(qs().canvasInspectorHeight??null),[x,b]=U.useState(null),[d,f]=U.useState(!1),l=()=>{var I;const H=(I=m.current)==null?void 0:I.parentElement;return H?Math.round(H.getBoundingClientRect().height*.5):Number.MAX_SAFE_INTEGER},o=()=>{var H;return(((H=g.current)==null?void 0:H.offsetHeight)??40)+1},y=U.useCallback(()=>{const H=g.current,I=u.current,W=v.current;if(!H||!I||!W)return;const P=l(),Z=w.current,te=window.getComputedStyle(I),F=(parseFloat(te.paddingTop)||0)+(parseFloat(te.paddingBottom)||0),Y=H.offsetHeight+W.offsetHeight+F+1,V=Z!=null?Math.min(Math.max(Z,o()),P):Math.min(Y,P);b(V)},[]);U.useLayoutEffect(y),U.useEffect(()=>{var W;if(typeof ResizeObserver>"u")return;const H=new ResizeObserver(y),I=(W=m.current)==null?void 0:W.parentElement;return I&&H.observe(I),v.current&&H.observe(v.current),()=>H.disconnect()},[y]);const A=H=>{w.current=Math.round(Math.min(Math.max(H,o()),l())),y()},k=()=>{Bn({canvasInspectorHeight:w.current})},R=()=>{w.current=null,Bn({canvasInspectorHeight:null}),y()},C=H=>{if(H.button!==0)return;const I=H.currentTarget,W=m.current;if(!W)return;try{I.setPointerCapture(H.pointerId)}catch{}f(!0);const P=H.clientY,Z=W.getBoundingClientRect().height,te=Y=>{A(Z+(P-Y.clientY))},F=()=>{f(!1),k(),window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",F)};window.addEventListener("pointermove",te),window.addEventListener("pointerup",F),window.addEventListener("pointercancel",F)},T=H=>{var W;const I=((W=m.current)==null?void 0:W.getBoundingClientRect().height)??0;H.key==="ArrowUp"?(H.preventDefault(),A(I+Ff),k()):H.key==="ArrowDown"?(H.preventDefault(),A(I-Ff),k()):H.key==="Home"&&(H.preventDefault(),R())};return n.jsxs("div",{ref:m,className:"canvas-overview"+(d?" is-resizing":"")+(_?" is-inspecting":""),"data-testid":"canvas-overview",style:x!=null?{height:x}:void 0,children:[n.jsx("div",{className:"canvas-overview-resize","data-testid":"canvas-overview-resize",role:"separator","aria-orientation":"horizontal","aria-label":"Resize the overview panel",tabIndex:0,onPointerDown:C,onDoubleClick:R,onKeyDown:T}),n.jsx("div",{ref:g,className:"canvas-overview-head",children:_?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"canvas-step-dot dot--"+_.kind,"aria-hidden":"true"}),n.jsx("span",{className:"canvas-overview-title","data-testid":"canvas-inspector-title",children:_.label}),n.jsx("span",{className:"canvas-detail-kind node--"+_.kind,children:wp(_.kind)}),n.jsxs("button",{className:"status-tag status-tag-action canvas-inspector-open-steps","data-testid":"canvas-inspector-open-steps","data-tooltip":"Full details in the Steps tab",onClick:L,children:["Open step ",n.jsx(fe,{name:"ArrowRight",size:12})]}),n.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-inspector-close","aria-label":"Back to the workflow overview","data-tooltip":"Back to the workflow overview (Esc)",onClick:h,children:n.jsx(fe,{name:"X",size:13})})]}):n.jsxs(n.Fragment,{children:[n.jsx(fe,{name:"Radio",size:13}),"Overview",n.jsx("span",{className:"canvas-overview-stats",children:((a==null?void 0:a.stats)??"").split("·").map(H=>{const I=H.trim();if(!I)return null;const W=I.indexOf(" "),P=W===-1?I:I.slice(0,W),Z=W===-1?"":I.slice(W+1);return n.jsxs("span",{className:"canvas-overview-stat",children:[n.jsx("strong",{children:P})," ",Z]},I)})}),n.jsx("button",{className:"theme-toggle canvas-overview-close","data-testid":"canvas-overview-toggle","aria-label":"Collapse workflow overview","data-tooltip":"Collapse workflow overview",onClick:p,children:n.jsx(fe,{name:"X",size:13})})]})}),n.jsx("div",{ref:u,className:"canvas-overview-body",children:n.jsx("div",{ref:v,className:"canvas-overview-content",children:_&&E?n.jsx(v1,{graph:E,node:_,run:S,workflows:N,onOpenWorkflow:q}):a&&n.jsxs(n.Fragment,{children:[a.description&&n.jsx("p",{className:"canvas-overview-desc",children:a.description}),a.notes.length>0&&n.jsx("ul",{className:"canvas-overview-notes",children:a.notes.map(H=>n.jsx("li",{children:H},H))}),n.jsxs("div",{className:"canvas-legend-row","aria-hidden":"true",children:[n.jsxs("span",{children:[n.jsx("span",{className:"dot dot--entry"}),"entry / active step"]}),n.jsxs("span",{children:[n.jsx("span",{className:"dot dot--step"}),"step"]}),n.jsxs("span",{children:[n.jsx("span",{className:"dot dot--terminal"}),"terminal"]})]})]})})})]})}function Ts({eyebrow:a,icon:_,title:E,body:S,cta:N,className:q,testId:L,children:h}){return n.jsxs("div",{className:"empty-state"+(q?` ${q}`:""),"data-empty-state":!0,"data-testid":L,children:[_&&n.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:n.jsx(fe,{name:_,size:18})}),a&&n.jsx("span",{className:"empty-state-eyebrow",children:a}),n.jsx("span",{className:"empty-state-title",children:E}),S&&n.jsx("span",{className:"empty-state-body",children:S}),N&&n.jsx("span",{className:"empty-state-cta",children:N}),h]})}function Dp(a,_=Date.now()){const E=Math.max(0,Math.round((_-a)/1e3));if(E<45)return"just now";const S=Math.round(E/60);if(S<60)return`${S}m ago`;const N=Math.round(S/60);return N<24?`${N}h ago`:`${Math.round(N/24)}d ago`}var S1=yp();function zn(a,{onDismiss:_,containerRef:E,triggerRef:S}){U.useEffect(()=>{if(!a)return;const N=L=>{var p;const h=E.current;!h||!(L.target instanceof Node)||h.contains(L.target)||(p=S==null?void 0:S.current)!=null&&p.contains(L.target)||_()},q=L=>{var h;L.key==="Escape"&&(_(),(h=S==null?void 0:S.current)==null||h.focus())};return document.addEventListener("mousedown",N),document.addEventListener("keydown",q),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",q)}},[a,_,E,S])}const Ta=4,Bs=8;function b1(a,_,E){const S=a.getBoundingClientRect(),N={position:"fixed",top:"auto",right:"auto",bottom:"auto",left:"auto",overflowY:"auto"};return E&&(N.width=S.width),N.maxWidth=window.innerWidth-2*Bs,_.startsWith("right")?(N.left=S.right+Ta,_.endsWith("start")?(N.top=S.top,N.maxHeight=window.innerHeight-S.top-Bs):(N.bottom=window.innerHeight-S.bottom,N.maxHeight=S.bottom-Bs),N):(_.startsWith("down")?(N.top=S.bottom+Ta,N.maxHeight=window.innerHeight-S.bottom-Ta-Bs):(N.bottom=window.innerHeight-S.top+Ta,N.maxHeight=S.top-Ta-Bs),_.endsWith("start")?N.left=Math.max(Bs,S.left):N.right=Math.max(Bs,window.innerWidth-S.right),N)}function ci({open:a,anchorRef:_,onDismiss:E,placement:S,matchWidth:N=!1,className:q,role:L,testid:h,children:p}){const m=U.useRef(null),[g,u]=U.useState(null);zn(a,{onDismiss:E,containerRef:m,triggerRef:_});const v=U.useCallback(()=>{const w=_.current;w&&u(b1(w,S,N))},[_,S,N]);return U.useLayoutEffect(()=>{a?v():u(null)},[a,v]),U.useLayoutEffect(()=>{if(!a||g==null)return;const w=m.current;if(!w)return;const x=w.getBoundingClientRect();let b=0;x.left<Bs?b=Bs-x.left:x.right>window.innerWidth-Bs&&(b=window.innerWidth-Bs-x.right),!(Math.abs(b)<.5)&&u(d=>d==null?d:{...d,left:typeof d.left=="number"?d.left+b:d.left,right:typeof d.right=="number"?d.right-b:d.right})},[a,g]),U.useEffect(()=>{if(a)return window.addEventListener("resize",v),window.addEventListener("scroll",v,!0),()=>{window.removeEventListener("resize",v),window.removeEventListener("scroll",v,!0)}},[a,v]),!a||g==null?null:S1.createPortal(n.jsx("div",{ref:m,className:q,role:L,"data-testid":h,style:g,children:p}),document.body)}function C1(a,_){return`${_?`${_} run`:"run"} ${a.status}`}function w1({workflow:a,detailStep:_,onBack:E,onAskAgent:S,surface:N,stepsSummary:q,run:L,runTarget:h,runs:p,onSelectRun:m}){const[g,u]=U.useState(!1),v=U.useRef(null),w=U.useCallback(()=>u(!1),[]),[x,b]=U.useState(!1),d=U.useRef(null),f=U.useCallback(()=>b(!1),[]);if(_)return n.jsxs("div",{className:"workflow-actions-header","data-testid":"workflow-actions-header",children:[n.jsx("button",{className:"theme-toggle","data-testid":"canvas-detail-back",onClick:E,"aria-label":"Back to the steps list","data-tooltip":"Back to the steps list",children:n.jsx(fe,{name:"ArrowLeft",size:14})}),n.jsx("span",{className:"workflow-actions-name","data-testid":"canvas-detail-title",children:_.label}),n.jsx("span",{className:"canvas-detail-kind node--"+_.kind,children:wp(_.kind)}),n.jsxs("button",{className:"btn-ghost canvas-detail-ask","data-testid":"canvas-detail-ask","aria-label":"Ask agent","data-tooltip":"Sends the request to the agent in the terminal",onClick:()=>S(`Walk me through the "${_.label}" step of this workflow: what it does, its inputs and outputs, and its transitions.`),children:[n.jsx(fe,{name:"MessageSquare",size:13}),n.jsx("span",{className:"canvas-detail-ask-label",children:"Ask agent"})]}),n.jsxs("div",{className:"canvas-detail-menu-wrap",children:[n.jsx("button",{ref:v,className:"theme-toggle","data-testid":"canvas-detail-menu","aria-label":`More actions for ${_.label}`,"data-tooltip":"More actions","aria-haspopup":"menu","aria-expanded":g,onClick:()=>u(l=>!l),children:n.jsx(fe,{name:"MoreHorizontal",size:14})}),n.jsxs(ci,{open:g,anchorRef:v,onDismiss:w,placement:"down-end",className:"canvas-detail-menu",role:"menu",testid:"canvas-detail-menu-popover",children:[n.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{S(`Modify the "${_.label}" step of this workflow. Show me the step's code first, then propose the change.`),w()},children:[n.jsx(fe,{name:"Wand2",size:13}),"Ask agent to modify"]}),n.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var l;(l=navigator.clipboard)==null||l.writeText(_.label).catch(()=>{}),w()},children:[n.jsx(fe,{name:"Copy",size:13}),"Copy step name"]})]})]})]});if(N==="steps"){const l=L&&n.jsxs(n.Fragment,{children:[L.status==="running"&&n.jsx("span",{className:"canvas-run-status is-running","aria-hidden":"true"}),C1(L,h)]});return n.jsxs("div",{className:"workflow-actions-header"+(L?" has-run":""),"data-testid":"workflow-actions-header",children:[n.jsx("span",{className:"workflow-actions-name",children:a.name}),n.jsx("span",{className:"workflow-actions-count","data-testid":"canvas-steps-count",children:q??"no steps"}),L&&p.length<=1&&n.jsx("span",{className:"status-tag canvas-run-chip is-"+L.status,"data-testid":"canvas-run-chip",children:l}),L&&p.length>1&&n.jsxs("div",{className:"canvas-run-picker-wrap",children:[n.jsxs("button",{ref:d,className:"status-tag status-tag-action canvas-run-chip canvas-run-chip--picker is-"+L.status,"data-testid":"canvas-run-chip","aria-haspopup":"menu","aria-expanded":x,"aria-label":`Pick a run to inspect (${p.length} observed)`,"data-tooltip":"Pick a run to inspect",onClick:()=>b(o=>!o),children:[l,n.jsx(fe,{name:"ChevronDown",size:12})]}),n.jsx(ci,{open:x,anchorRef:d,onDismiss:f,placement:"down-end",className:"canvas-run-menu",role:"menu",testid:"canvas-run-menu",children:[...p].reverse().map((o,y)=>{const A=p.length-y,k=o.run.executionId===L.executionId,R=Dp(o.observedAt);return n.jsxs("button",{role:"menuitemradio","aria-checked":k,className:"profile-menu-item"+(k?" is-selected":""),"data-testid":`canvas-run-option-${o.run.executionId}`,title:o.run.executionId,onClick:()=>{m(o.run.executionId),f()},children:[n.jsx(fe,{name:k?"Check":"Play",size:13}),n.jsx("span",{children:`run ${A} · ${o.run.status} · ${o.target}`}),n.jsx("span",{className:"canvas-run-option-meta",children:R})]},o.run.executionId)})})]})]})}return null}function x1({sessionId:a,lastMessage:_,boundWorkflow:E,noSessionAgent:S=null,overviewActive:N,sessionExited:q,expanded:L,onToggleExpanded:h,macros:p,tasks:m,onRunMacro:g,onInjectPrompt:u,surface:v,onOpenSteps:w,run:x,runTarget:b,runs:d,onSelectRun:f,workflows:l,onOpenWorkflow:o}){const[y,A]=U.useState(!1),[k,R]=U.useState(0),[C,T]=U.useState(Dc()),[H,I]=U.useState(!1),[W,P]=U.useState(!0),[Z,te]=U.useState(!1),F=U.useRef(null),Y=U.useRef(null),V=U.useRef(0),M=()=>{P(!1),te(!0),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>te(!1),360)},$=()=>{const ue=V.current-Date.now();Y.current&&clearTimeout(Y.current),ue>0?Y.current=setTimeout(M,ue):M()};U.useEffect(()=>()=>{F.current&&clearTimeout(F.current),Y.current&&clearTimeout(Y.current)},[]);const[D,z]=U.useState(1),[Q,ne]=U.useState({x:0,y:0}),[ve,Ce]=U.useState(!1),X=U.useRef(null),O=U.useRef(null),[ee,oe]=U.useState(.25),Se=ue=>Math.min(3,Math.max(ee,Math.round(ue*100)/100)),[ge,Oe]=U.useState(null),Me=U.useRef(!1),[Pe,Ke]=U.useState({zoom:1,x:0,y:0}),Re=U.useCallback(()=>{const ue=X.current;if(!ge||!ue)return null;const we=ue.getBoundingClientRect();if(we.width<80||we.height<80)return null;const Ne=we.width-ge.insetX*2,Dt=we.height-ge.insetTop-ge.insetBottom;if(Ne<=0||Dt<=0)return null;const He=Math.min(1,Ne/ge.width,Dt/ge.height);return{zoom:Math.max(.1,Math.round(He*100)/100),x:0,y:0}},[ge]),ft=U.useCallback(()=>{let ue=12;const we=()=>{const Ne=Re();if(!Ne){ue-- >0&&requestAnimationFrame(we);return}oe(Math.min(.25,Ne.zoom)),Me.current=!1,z(Ne.zoom),ne({x:Ne.x,y:Ne.y}),Ke(Ne)};we()},[Re]);U.useEffect(()=>{!ge||Me.current||ft()},[ge,ft]),U.useEffect(()=>{const ue=X.current;if(!ue||typeof ResizeObserver>"u")return;const we=new ResizeObserver(()=>{Me.current||ft()});return we.observe(ue),()=>we.disconnect()},[ft]),U.useEffect(()=>{var Ne,Dt,He;(Dt=(Ne=O.current)==null?void 0:Ne.contentWindow)==null||Dt.postMessage({type:"sapiom-canvas:view",zoom:D,x:Q.x,y:Q.y},"*");const ue=it.current,we=O.current;if(ue&&we){const es=we.getBoundingClientRect();(He=we.contentWindow)==null||He.postMessage({type:"sapiom-canvas:hover",x:ue.x-es.left,y:ue.y-es.top},"*")}},[D,Q]),U.useEffect(()=>{const ue=X.current;if(!ue)return;const we=Ne=>{Ne.preventDefault(),Me.current=!0,z(Dt=>Se(Dt*(Ne.deltaY<0?1.1:1/1.1)))};return ue.addEventListener("wheel",we,{passive:!1}),()=>ue.removeEventListener("wheel",we)});const vt=ue=>{var Dt,He;const we=O.current;if(!we)return;const Ne=we.getBoundingClientRect();if(typeof ue.clientX=="number"&&typeof ue.clientY=="number"){const{clientX:es,clientY:hs,...ys}=ue;(Dt=we.contentWindow)==null||Dt.postMessage({...ys,x:es-Ne.left,y:hs-Ne.top},"*");return}(He=we.contentWindow)==null||He.postMessage(ue,"*")},[Lt,wt]=U.useState(!1),bt=U.useRef(!1),st=U.useRef(0),it=U.useRef(null),pt=ue=>{if(it.current={x:ue.clientX,y:ue.clientY},ve)return;const{clientX:we,clientY:Ne}=ue;cancelAnimationFrame(st.current),st.current=requestAnimationFrame(()=>{vt({type:"sapiom-canvas:hover",clientX:we,clientY:Ne})})},xt=()=>{cancelAnimationFrame(st.current),it.current=null,wt(!1),bt.current=!1,vt({type:"sapiom-canvas:hover",x:-1,y:-1})},Ot=ue=>{if(ue.button!==0)return;const we=ue.currentTarget;try{we.setPointerCapture(ue.pointerId)}catch{}Ce(!0),vt({type:"sapiom-canvas:press",clientX:ue.clientX,clientY:ue.clientY,down:!0});let Ne=!0;const Dt=()=>{Ne&&(Ne=!1,vt({type:"sapiom-canvas:press",down:!1}))};let He=ue.clientX,es=ue.clientY;const hs=ue.clientX,ys=ue.clientY,Ws=Ft=>{const ui=Ft.clientX-He,Bt=Ft.clientY-es;He=Ft.clientX,es=Ft.clientY,(Math.abs(Ft.clientX-hs)>=4||Math.abs(Ft.clientY-ys)>=4)&&(Dt(),Me.current=!0),ne(In=>({x:In.x+ui,y:In.y+Bt}))},Ns=Ft=>{Ce(!1),Dt(),we.removeEventListener("pointermove",Ws),we.removeEventListener("pointerup",Ns),we.removeEventListener("pointercancel",Ns),Math.abs(Ft.clientX-hs)<4&&Math.abs(Ft.clientY-ys)<4&&(vt({type:"sapiom-canvas:pick",clientX:Ft.clientX,clientY:Ft.clientY}),bt.current||jt(null))};we.addEventListener("pointermove",Ws),we.addEventListener("pointerup",Ns),we.addEventListener("pointercancel",Ns)},[Je,jt]=U.useState(null);U.useEffect(()=>{if(!L&&Je==null)return;const ue=we=>{we.key==="Escape"&&(Je!=null?jt(null):h())};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[L,Je,h]);const[Ct,Pt]=U.useState(!0),[_e,ze]=U.useState(!1),[nt,Rt]=U.useState(null),[gt,$s]=U.useState(null),[Tt,Ps]=U.useState(null),[is,ns]=U.useState(null),[Ds,Jt]=U.useState(null);U.useEffect(()=>{const ue=we=>{var Dt;const Ne=we.data;if(!(!Ne||we.source!==((Dt=O.current)==null?void 0:Dt.contentWindow))){if(Ne.type==="sapiom-canvas:overview")Rt({description:typeof Ne.description=="string"?Ne.description:"",stats:typeof Ne.stats=="string"?Ne.stats:"",notes:Array.isArray(Ne.notes)?Ne.notes.filter(He=>typeof He=="string"):[]});else if(Ne.type==="sapiom-canvas:graph")Ps(Lv(Ne.graph));else if(Ne.type==="sapiom-canvas:node"){const He=Ne.id;typeof He=="string"&&jt(He)}else if(Ne.type==="sapiom:node-click"){const He=Ne.stepName;typeof He=="string"&&Ps(es=>{if(es){const hs=es.nodes.find(ys=>ys.label===He)??es.nodes.find(ys=>ys.id===He)??null;hs&&jt(hs.id)}return es})}else if(Ne.type==="sapiom-canvas:hit"){const He=typeof Ne.id=="string";wt(He),bt.current=He}else if(Ne.type==="sapiom-canvas:size"){const He=Ne;typeof He.width=="number"&&He.width>0&&typeof He.height=="number"&&He.height>0&&Oe({width:He.width,height:He.height,insetTop:typeof He.insetTop=="number"&&He.insetTop>=0?He.insetTop:0,insetBottom:typeof He.insetBottom=="number"&&He.insetBottom>=0?He.insetBottom:0,insetX:typeof He.insetX=="number"&&He.insetX>=0?He.insetX:0})}else if(Ne.type==="sapiom-canvas:error"){const He=Ne;$s({title:typeof He.title=="string"?He.title:"",reason:typeof He.reason=="string"?He.reason:""})}}};return window.addEventListener("message",ue),()=>window.removeEventListener("message",ue)},[]),U.useEffect(()=>{Rt(null),$s(null),Ps(null),ns(null),jt(null),Jt(null),Pt(!0),wt(!1),bt.current=!1,Oe(null),Ke({zoom:1,x:0,y:0}),Me.current=!1},[a,k]);const Zt=Tt&&is?Tt.nodes.find(ue=>ue.id===is)??null:null,re=U.useRef(null);Zt&&(re.current=Zt),Tt||(re.current=null);const de=Zt??re.current,be=Tt&&Je?Tt.nodes.find(ue=>ue.id===Je)??null:null;U.useEffect(()=>{var ue,we;(we=(ue=O.current)==null?void 0:ue.contentWindow)==null||we.postMessage({type:"sapiom-canvas:select",id:is??Je},"*")},[is,Je]);const ye=U.useCallback(()=>{var ue,we;!x||!b||!a||bp()||W||(we=(ue=O.current)==null?void 0:ue.contentWindow)==null||we.postMessage({type:"sapiom:run-state",steps:x.steps,status:x.status,target:b},"*")},[x,b,a,W]);U.useEffect(()=>{ye()},[ye]);const ke=nt??void 0,[ht,yt]=U.useState(new Set);U.useEffect(()=>Nc(T),[]),U.useEffect(()=>{if(P(!0),!a){A(!1);return}A(!1);let ue=!1;return I(!0),fetch(`/canvas/${a}/`,{method:"HEAD"}).then(we=>!ue&&A(we.ok)).catch(()=>{}).finally(()=>!ue&&I(!1)),()=>{ue=!0}},[a]),U.useEffect(()=>{!_||!a||_.type==="canvas.reload"&&_.harnessSessionId===a&&(A(!0),P(!0),R(ue=>ue+1))},[_,a]);const et=(E==null?void 0:E.path)??null;U.useEffect(()=>{P(!0),R(ue=>ue+1),z(1),ne({x:0,y:0}),Ke({zoom:1,x:0,y:0}),Me.current=!1},[et]);const Et=m.filter(ue=>ue.harnessSessionId===a&&(ue.workflowPath==null||ue.workflowPath===et)),qt=Et.find(ue=>ue.status==="running")??null,le=Et.filter(ue=>ue.status!=="running").sort((ue,we)=>(we.endedAt??"").localeCompare(ue.endedAt??""))[0],xe=!qt&&(le==null?void 0:le.status)==="failed"&&!ht.has(le.id)?le:null,Ee=xe?p.find(ue=>ue.id===xe.macroId)??null:null,Be=a!=null&&!0,We=y&&Be;return n.jsxs("aside",{className:"canvas-pane",children:[E&&!N&&n.jsx(w1,{workflow:E,detailStep:Zt,onBack:()=>ns(null),onAskAgent:u,surface:v,stepsSummary:Tt&&Tt.nodes.length>0?Nv(Tt):null,run:x,runTarget:b,runs:d,onSelectRun:f}),S?n.jsx(Ts,{className:"canvas-empty",testId:"canvas-empty-no-session",icon:"Radio",title:`No running session for ${S}`,body:v==="steps"?"Start a session to map this agent's steps here.":"Start a session to map, run, and inspect this agent."}):N||!a?v==="steps"?n.jsx(Ts,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its workflow steps here."}):n.jsx(Ts,{className:"canvas-empty",icon:"Radio",title:"No session",body:"Start a session to see its canvas here."}):xe?n.jsxs("div",{className:"canvas-task-failed","data-testid":"canvas-task-failed",children:[n.jsxs("p",{className:"canvas-task-title",children:[n.jsx(fe,{name:"TriangleAlert",size:14})," ",xe.label," failed."]}),xe.errorTail&&n.jsx("pre",{className:"canvas-task-error",children:xe.errorTail}),n.jsxs("div",{className:"canvas-task-actions",children:[Ee&&n.jsx("button",{className:"btn-primary","data-testid":"canvas-task-retry",onClick:()=>g(Ee),children:"Retry"}),n.jsx("button",{className:"btn-ghost","data-testid":"canvas-task-dismiss",onClick:()=>yt(ue=>{const we=new Set(ue);return we.add(xe.id),we}),children:"Dismiss"})]})]}):qt&&!We?n.jsxs("div",{className:"canvas-task-activity","data-testid":"canvas-task-activity",children:[n.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:n.jsx(fe,{name:"Workflow",size:20})}),n.jsx("div",{className:"canvas-task-title",children:n.jsxs("span",{children:[qt.label," is running…"]})}),qt.statusLines.length>0&&n.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:qt.statusLines.slice(-8).map((ue,we)=>n.jsx("li",{children:ue},`${we}-${ue}`))}),n.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}):H?n.jsxs("div",{className:"canvas-loading","data-testid":"canvas-loading",children:[n.jsx("span",{className:"canvas-task-spinner","aria-hidden":"true"}),n.jsx("p",{className:"canvas-empty-hint",children:v==="steps"?"Loading steps…":"Loading canvas…"})]}):!We&&v==="steps"&&x?n.jsx("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:n.jsx(Wf,{run:x,target:b})}):!We&&q?n.jsx(Ts,{className:"canvas-empty",testId:"canvas-empty-exited",icon:"History",title:"Session ended",body:`Resume the session to see its ${v==="steps"?"workflow steps":"workflow diagram"} here.`}):We?n.jsx("div",{className:"canvas-frame-wrap"+(L?" is-expanded":""),"data-view":v==="board"?"board":Zt?"detail":"steps",children:n.jsxs("div",{className:"canvas-slide-track",children:[n.jsxs("div",{className:"canvas-slide-pane",children:[n.jsxs("div",{className:"canvas-visual"+(v==="steps"?" is-offstage":""),children:[n.jsxs("div",{className:"canvas-view-controls","data-testid":"canvas-view-controls",children:[n.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-out","aria-label":"Zoom out",title:"Zoom out",disabled:D<=ee+.001,onClick:()=>{Me.current=!0,z(ue=>Math.max(ee,Math.round((ue-.25)*100)/100))},children:n.jsx(fe,{name:"ZoomOut",size:14})}),n.jsxs("button",{className:"theme-toggle canvas-zoom-reset","data-testid":"canvas-zoom-reset","aria-label":"Reset zoom",title:"Reset zoom",disabled:D===1,onClick:()=>{Me.current=!0,z(1)},children:[Math.round(D*100),"%"]}),n.jsx("button",{className:"theme-toggle","data-testid":"canvas-zoom-in","aria-label":"Zoom in",title:"Zoom in",disabled:D>=2,onClick:()=>{Me.current=!0,z(ue=>Math.min(2,Math.round((ue+.25)*100)/100))},children:n.jsx(fe,{name:"ZoomIn",size:14})}),n.jsx("button",{className:"theme-toggle","data-testid":"canvas-fit","aria-label":"Fit to view",title:"Fit to view",disabled:D===Pe.zoom&&Q.x===Pe.x&&Q.y===Pe.y,onClick:ft,children:n.jsx(fe,{name:"Frame",size:14})})]}),L&&n.jsx("button",{className:"macro-icon-btn canvas-expand-exit","data-testid":"canvas-expand-exit","aria-label":"Exit expanded canvas",title:"Exit expanded canvas (Esc)",onClick:h,children:n.jsx(fe,{name:"Minimize2",size:14})}),(W||Z)&&n.jsxs("div",{className:"canvas-skeleton canvas-loading--overlay"+(W?"":" is-fading"),"data-testid":"canvas-loading",role:"status","aria-label":"Rendering diagram",children:[n.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-title"}),n.jsxs("div",{className:"canvas-skeleton-row",children:[n.jsx("div",{className:"canvas-skeleton-block"}),n.jsx("div",{className:"canvas-skeleton-block"})]}),n.jsxs("div",{className:"canvas-skeleton-row",children:[n.jsx("div",{className:"canvas-skeleton-block"}),n.jsx("div",{className:"canvas-skeleton-block"}),n.jsx("div",{className:"canvas-skeleton-block"})]}),n.jsx("div",{className:"canvas-skeleton-block canvas-skeleton-wide"})]}),gt&&n.jsxs("div",{className:"canvas-render-error","data-testid":"canvas-render-error",children:[n.jsx("span",{className:"canvas-error-icon","aria-hidden":"true",children:n.jsx(fe,{name:"TriangleAlert",size:20})}),n.jsx("div",{className:"canvas-task-title",children:"Render failed"}),n.jsx("p",{className:"canvas-error-summary",children:(()=>{const ue=gt.reason.trim();return ue.length<4?"The workflow graph could not be extracted. Open the terminal for details.":ue.includes(": ")?ue.slice(ue.indexOf(": ")+2).split(". ")[0]:ue})()}),n.jsxs("div",{className:"canvas-error-actions",children:[n.jsx("button",{className:"btn-primary","data-testid":"canvas-error-fix",onClick:()=>u(`The canvas render for ${gt.title||"this workflow"} failed: ${gt.reason} Fix the project so the workflow graph extracts cleanly.`),children:"Ask agent to fix"}),n.jsx("button",{className:"btn-ghost","data-testid":"canvas-error-retry",onClick:()=>{V.current=Date.now()+900,P(!0),R(ue=>ue+1)},children:"Retry"})]}),n.jsxs("details",{className:"canvas-error-details",children:[n.jsx("summary",{children:"Details"}),n.jsx("pre",{children:gt.reason.trim().length>=4?gt.reason:"The rendered document reported a failure without details. Re-render the diagram or check the terminal."})]})]}),qt&&n.jsxs("div",{className:"canvas-task-activity canvas-task-activity--overlay","data-testid":"canvas-task-activity",children:[n.jsx("span",{className:"canvas-task-icon","aria-hidden":"true",children:n.jsx(fe,{name:"Workflow",size:20})}),n.jsx("div",{className:"canvas-task-title",children:n.jsxs("span",{children:[qt.label," is running…"]})}),qt.statusLines.length>0&&n.jsx("ul",{className:"canvas-task-lines","data-testid":"canvas-task-lines",children:qt.statusLines.slice(-8).map((ue,we)=>n.jsx("li",{children:ue},`${we}-${ue}`))}),n.jsx("p",{className:"canvas-empty-hint",children:"Running as a background task, so your session stays free. The canvas reloads here when it finishes."})]}),ke&&!Ct&&!be&&n.jsx("button",{className:"theme-toggle canvas-overview-open","data-testid":"canvas-overview-toggle","aria-label":"Show workflow overview","data-tooltip":"Show workflow overview",onClick:()=>Pt(!0),children:"i"}),v==="board"&&n.jsx("button",{className:"theme-toggle canvas-chat-toggle"+(_e?" is-active":""),"data-testid":"canvas-chat-toggle","aria-label":_e?"Close chat":"Open chat","data-tooltip":"Chat — ask about this workflow or the selected step",onClick:()=>ze(ue=>!ue),children:n.jsx(fe,{name:"MessageSquare",size:14})}),n.jsx("iframe",{ref:O,className:"canvas-iframe",src:`/canvas/${a}/?theme=${C}`,sandbox:"allow-scripts",onLoad:()=>{var ue,we,Ne,Dt;$(),(we=(ue=O.current)==null?void 0:ue.contentWindow)==null||we.postMessage({type:"sapiom-canvas:view",zoom:D,x:Q.x,y:Q.y},"*"),x&&b&&a&&((Dt=(Ne=O.current)==null?void 0:Ne.contentWindow)==null||Dt.postMessage({type:"sapiom:run-state",steps:x.steps,status:x.status,target:b},"*"))}},`${a}:${k}`),n.jsx("div",{ref:X,className:"canvas-pan-layer"+(ve?" is-panning":""),"data-testid":"canvas-pan-layer","data-over-node":Lt&&!ve?"true":void 0,onPointerDown:Ot,onPointerMove:pt,onPointerLeave:xt,onDoubleClick:ft})]}),v==="steps"&&n.jsx("div",{className:"canvas-steps-surface","data-testid":"canvas-steps-surface",children:Tt&&Tt.nodes.length>0?n.jsx(m1,{graph:Tt,run:x,runTarget:b,workflows:l,onOpenWorkflow:o,expandedId:Ds,onToggle:ue=>Jt(we=>we===ue?null:ue),onOpenDetail:ns}):x?n.jsx(Wf,{run:x,target:b}):n.jsx(Ts,{className:"canvas-empty",icon:"Workflow",title:"No steps yet",body:"This diagram has no step graph. It regenerates automatically from the bound workflow — check the terminal if it never appears."})}),v==="board"&&(ke&&Ct||be)&&n.jsx(y1,{overview:ke??null,selectedNode:be,graph:Tt,run:x,workflows:l,onOpenWorkflow:o,onOpenSteps:()=>{Je&&ns(Je),w()},onDeselect:()=>jt(null),onCollapse:()=>Pt(!1)}),v==="board"&&_e&&n.jsx(g1,{node:be,run:x,onInjectPrompt:u,onClose:()=>ze(!1)})]}),n.jsx("div",{className:"canvas-slide-pane","aria-hidden":Zt?void 0:!0,children:de&&Tt&&n.jsx(_1,{graph:Tt,node:de,run:x,workflows:l,onOpenWorkflow:o})})]})}):n.jsx(Ts,{className:"canvas-empty",icon:"Workflow",title:v==="steps"?"No steps yet":"Nothing generated yet",body:v==="steps"?"Steps are read from the bound workflow's diagram — generated automatically from its code.":"Generated automatically from the bound workflow; it refreshes when the code changes."})]})}const E1="https://tools.sapiom.ai",k1="x-sapiom-api-key",A1="YOUR_SAPIOM_API_KEY";function j1(a){return a==null?"{ /* your input */ }":JSON.stringify(a,null,2).replace(/\n/g,`
419
+ `)}function R1(a){return a==null?"{}":JSON.stringify(a)}function T1(a){return a.replace(/'/g,"'\\''")}function D1(a,_){return`import { agents } from "@sapiom/tools";
420
+
421
+ const result = await agents.run({
422
+ definition: ${JSON.stringify(a)},
423
+ input: ${j1(_)},
424
+ });
425
+
426
+ if (result.status === "completed") {
427
+ console.log(result.output);
428
+ }
429
+ `}function N1(a,_,E){const S=T1(`{ "input": ${R1(_)} }`);return`curl -X POST ${E}/agents/v1/definitions/${a}/executions \\
430
+ -H "${k1}: ${A1}" \\
431
+ -H "Content-Type: application/json" \\
432
+ -d '${S}'
433
+ `}function M1(a){const{definition:_,inputSample:E,baseUrl:S=E1}=a;return{typescript:D1(_,E),curl:N1(_,E,S)}}const L1="https://app.sapiom.ai/settings?tab=api-keys";function O1({boundWorkflow:a,agentsBaseUrl:_}){return a.definitionId==null?null:n.jsx(B1,{boundWorkflow:a,agentsBaseUrl:_})}function B1({boundWorkflow:a,agentsBaseUrl:_}){const[E,S]=U.useState("typescript"),[N,q]=U.useState(!1),L=a.definitionSlug==null,h=a.definitionSlug??a.name,{typescript:p,curl:m}=M1({definition:h,baseUrl:_}),g=E==="typescript"?p:m,u=()=>{navigator.clipboard.writeText(g).then(()=>{q(!0),window.setTimeout(()=>q(!1),2e3)}).catch(()=>{})};return n.jsxs("div",{className:"snippet-panel","data-testid":"snippet-panel",children:[n.jsx("div",{className:"snippet-panel-header",children:n.jsx("span",{className:"snippet-panel-title",children:"Trigger from your code"})}),n.jsxs("div",{className:"snippet-slug-row",children:[n.jsx("span",{className:"snippet-slug-label",children:"Agent"}),n.jsx("code",{className:"snippet-slug","data-testid":"snippet-slug",children:h})]}),L&&n.jsx("p",{className:"snippet-slug-inferred","data-testid":"snippet-slug-inferred",children:"Inferred from the project name. Confirm it matches your deployed agent."}),n.jsxs("div",{className:"snippet-tabs",role:"tablist","aria-label":"Snippet language",children:[n.jsx("button",{role:"tab","aria-selected":E==="typescript","aria-controls":"snippet-code-panel",className:"snippet-tab"+(E==="typescript"?" is-active":""),"data-testid":"snippet-tab-ts",onClick:()=>S("typescript"),children:"TypeScript (SDK)"}),n.jsx("button",{role:"tab","aria-selected":E==="curl","aria-controls":"snippet-code-panel",className:"snippet-tab"+(E==="curl"?" is-active":""),"data-testid":"snippet-tab-curl",onClick:()=>S("curl"),children:"cURL (HTTP)"})]}),n.jsxs("div",{className:"snippet-code-wrap",role:"tabpanel",id:"snippet-code-panel",children:[n.jsx("pre",{className:"snippet-code","data-testid":"snippet-code",children:n.jsx("code",{children:g})}),n.jsx("button",{className:"snippet-copy"+(N?" is-copied":""),"data-testid":"snippet-copy","aria-label":N?"Copied":"Copy snippet",onClick:u,children:N?"Copied":"Copy"})]}),n.jsxs("p",{className:"snippet-hint",children:["Replace ",n.jsx("code",{children:"YOUR_SAPIOM_API_KEY"})," with a key from your"," ",n.jsx("a",{className:"snippet-link","data-testid":"snippet-api-key-link",href:L1,target:"_blank",rel:"noreferrer",children:"Sapiom dashboard"}),". Add ",n.jsx("code",{children:"idempotencyKey"})," to the body to deduplicate retries."]})]})}function H1({boundWorkflow:a,noSessionAgent:_=null,agentsBaseUrl:E}){if(!a)return n.jsx(Ts,{className:"code-panel-empty",icon:"Code",title:_?`No running session for ${_}`:"No agent bound",body:_?"Start a session to trigger this agent from your code.":"Open an agent to see how to trigger it from your code."});const S=a.definitionId!=null;return n.jsxs("div",{className:"code-panel",children:[n.jsxs("div",{className:"workflow-actions-header code-panel-header","data-testid":"code-panel-header",children:[n.jsx("span",{className:"workflow-actions-name",children:a.name}),S?n.jsxs("span",{className:"status-tag workflow-deployed-tag","data-testid":"code-panel-status","data-tooltip":"Deployed to production",children:[n.jsx("span",{className:"workflow-dot workflow-dot-pinned","aria-hidden":"true"}),"Deployed"]}):n.jsxs("span",{className:"status-tag code-panel-draft-tag","data-testid":"code-panel-status","data-tooltip":"Exists locally only. Deploy it to call it from your code.",children:[n.jsx(fe,{name:"CloudOff",size:13}),"Draft"]})]}),S?n.jsx("div",{className:"code-panel-body","data-testid":"code-panel-body",children:n.jsx(O1,{boundWorkflow:a,agentsBaseUrl:E},a.path)}):n.jsx(Ts,{className:"code-panel-empty",icon:"Code",title:"Deploy to trigger from code",body:`${a.name} is a draft. Once it deploys, copy-paste TypeScript SDK and cURL calls for it appear here.`})]})}function Yf(a,_){if(!a)return{score:0,indices:[]};const E=a.toLowerCase(),S=_.toLowerCase();let N=0,q=0,L=0;const h=[];for(let p=0;p<E.length;p++){const m=E[p],g=S.indexOf(m,q);if(g===-1)return null;L=g===q?L+1:0,N+=10-Math.min(g-q,8),N+=L*3,g===0&&(N+=5),h.push(g),q=g+1}return{score:N,indices:h}}const z1={command:"LayoutTemplate",session:"Radio",past:"History",workflow:"Workflow",recent:"Folder",path:"Folder"},gc={command:"Actions",session:"Sessions",past:"Past sessions",workflow:"Workflows",recent:"Folders",path:"Folders"},U1=6;function Kf(a,_){if(!_||_.length===0)return a;const E=new Set(_),S=[];let N="",q=E.has(0);const L=h=>{N&&(S.push(q?n.jsx("b",{className:"palette-match",children:N},h):N),N="")};for(let h=0;h<a.length;h++){const p=E.has(h);p!==q&&(L(h),q=p),N+=a[h]}return L(a.length),S}function I1(a,_){const E=Yf(a,_.label);if(E)return{item:{..._,labelIndices:E.indices},score:1e3+E.score};const S=Yf(a,_.meta);return S?{item:{..._,metaIndices:S.indices},score:S.score}:null}function q1({sessions:a,workflows:_,recentDirs:E,history:S,listDir:N,onSelectSession:q,onReviewSummary:L,onOpenPath:h,onBrowseTemplates:p,onClose:m}){const[g,u]=U.useState(""),[v,w]=U.useState([]),[x,b]=U.useState(!1),[d,f]=U.useState(!1),[l,o]=U.useState(0),y=U.useRef(null);U.useEffect(()=>{var T;(T=y.current)==null||T.focus()},[]);const A=g.startsWith("/")||g.startsWith("~");U.useEffect(()=>{if(!A){w([]),f(!1);return}let T=!1;b(!0),f(!1);const H=setTimeout(()=>{N(g).then(I=>{T||w(I.dirs)}).catch(()=>{T||(w([]),f(!0))}).finally(()=>!T&&b(!1))},150);return()=>{T=!0,clearTimeout(H)}},[g,A,N]);const k=U.useMemo(()=>{if(A){const Y=g.trim(),V=Y?[{id:`confirm:${Y}`,kind:"path",label:Y,meta:"Open this path",path:Y}]:[],M=v.map($=>({id:`dir:${$.path}`,kind:"path",label:$.name,meta:$.path,path:$.path}));return[...V,...M]}const T=a.filter(Y=>Y.status!=="exited").map(Y=>({id:`session:${Y.id}`,kind:"session",label:Y.title,meta:Y.cwd,sessionId:Y.id})),H=new Set(a.map(Y=>Y.id)),I=new Set(a.map(Y=>Y.agentSessionId).filter(Y=>Y!=null)),W=[...a.filter(Y=>Y.status==="exited").map(Y=>({id:`past:${Y.id}`,kind:"past",label:Y.title,meta:Y.cwd,sessionId:Y.id})),...S.filter(Y=>!(Y.harnessSessionId!=null&&H.has(Y.harnessSessionId))&&!I.has(Y.agentSessionId)).map(Y=>({id:`summary:${Y.agentSessionId}`,kind:"past",label:Y.title,meta:Y.cwd,summary:Y}))],P=_.map(Y=>({id:`workflow:${Y.path}`,kind:"workflow",label:Y.name,meta:Y.path,path:Y.path})),Z=[{id:"command:browse-templates",kind:"command",label:"Browse templates",meta:"Gallery and starters"}],te=new Set(_.map(Y=>Y.path)),F=E.filter(Y=>!te.has(Y)).map(Y=>({id:`recent:${Y}`,kind:"recent",label:Y.split("/").filter(Boolean).pop()??Y,meta:Y,path:Y}));return g?[T,W,P,F,Z].flatMap(Y=>Y.map(V=>I1(g,V)).filter(V=>V!==null).sort((V,M)=>M.score-V.score).map(V=>V.item)).slice(0,20):[...T,...W.slice(0,U1),...P,...F].slice(0,20-Z.length).concat(Z)},[g,A,v,a,_,E,S]);U.useEffect(()=>o(0),[k.length,g]);const R=T=>{T.kind==="command"?p():(T.kind==="session"||T.kind==="past")&&T.sessionId?q(T.sessionId):T.kind==="past"&&T.summary?L(T.summary):T.path&&h(T.path),m()},C=T=>{if(T.key==="ArrowDown")T.preventDefault(),o(H=>Math.min(H+1,k.length-1));else if(T.key==="ArrowUp")T.preventDefault(),o(H=>Math.max(H-1,0));else if(T.key==="Enter"){T.preventDefault();const H=k[l];H&&R(H)}else T.key==="Escape"&&m()};return n.jsx("div",{className:"modal-backdrop",onClick:m,children:n.jsxs("div",{className:"modal command-palette",onClick:T=>T.stopPropagation(),children:[n.jsx("input",{ref:y,className:"command-palette-input","data-testid":"command-palette-input",placeholder:"Jump to a session, workflow, or path…",value:g,onChange:T=>u(T.target.value),onKeyDown:C}),n.jsxs("div",{className:"command-palette-list","data-testid":"command-palette-list",children:[A&&x&&n.jsx("div",{className:"command-palette-empty",children:"Loading…"}),A&&d&&!x&&n.jsx("div",{className:"command-palette-error","data-testid":"command-palette-error",role:"alert",children:"Couldn't read that path."}),k.length===0&&!x&&!d&&n.jsx("div",{className:"command-palette-empty",children:"No matches"}),k.map((T,H)=>n.jsxs("div",{className:"command-palette-row",children:[!A&&(H===0||gc[T.kind]!==gc[k[H-1].kind])&&n.jsx("div",{className:"command-palette-section","data-testid":"command-palette-section",children:gc[T.kind]}),n.jsxs("button",{type:"button",className:"command-palette-item"+(H===l?" is-selected":""),"data-testid":`command-palette-item-${H}`,onMouseEnter:()=>o(H),onClick:()=>R(T),children:[n.jsx(fe,{name:z1[T.kind],size:14}),n.jsx("span",{className:"command-palette-item-label",children:Kf(T.label,T.labelIndices)}),n.jsx("span",{className:"command-palette-item-meta",children:Kf(T.meta,T.metaIndices)})]})]},T.id))]})]})})}const $1={offline:{icon:"CloudOff",title:"You're offline",body:"Sapiom Studio can't reach the network. Check your connection — the moment you're back, retry to pick up right where you left off."},auth:{icon:"Plug",title:"Session needs a refresh",body:"Your credential was rejected — it may have rotated or expired. Retry to reconnect with the current key; you won't lose your place."},error:{icon:"TriangleAlert",title:"Couldn't reach Sapiom Studio",body:"The server didn't respond as expected. This is usually temporary — retry in a moment."}};function P1({status:a,onRetry:_,retrying:E=!1,detail:S,onStartAuth:N}){const q=$1[a],[L,h]=U.useState({status:"idle"}),p=async()=>{if(N){h({status:"pending"});try{await N(),h({status:"idle"})}catch(m){const g=m instanceof Error?m.message:"Could not start sign-in. Try again.";h({status:"error",message:g})}}};return n.jsx("div",{className:"app-status connectivity-screen","data-testid":"connectivity-screen","data-status":a,role:"alert",children:n.jsxs("div",{className:"connectivity-screen-inner",children:[n.jsx("span",{className:"connectivity-screen-icon","aria-hidden":"true",children:n.jsx(fe,{name:q.icon,size:22})}),n.jsx("span",{className:"connectivity-screen-title",children:q.title}),n.jsx("span",{className:"connectivity-screen-body",children:q.body}),a==="error"&&S&&n.jsx("span",{className:"connectivity-screen-detail","data-testid":"connectivity-screen-detail",children:S}),n.jsx("button",{className:"btn-primary connectivity-screen-retry","data-testid":"connectivity-retry",onClick:_,disabled:E||L.status==="pending",children:E?"Reconnecting…":"Retry"}),a==="auth"&&N&&n.jsxs("div",{className:"connectivity-screen-auth-section",children:[L.status==="pending"?n.jsxs("span",{className:"connectivity-auth-pending","data-testid":"connectivity-auth-pending",children:[n.jsx(fe,{name:"Loader",size:14}),"Opening browser… waiting for sign-in"]}):n.jsxs("button",{className:"btn-secondary connectivity-connect-btn","data-testid":"connectivity-connect-btn",onClick:()=>void p(),children:[n.jsx(fe,{name:"Plug",size:14}),"Connect account"]}),L.status==="error"&&n.jsx("span",{className:"connectivity-auth-error","data-testid":"connectivity-auth-error",children:L.message})]})]})})}function W1({onDismiss:a}){return n.jsxs("div",{className:"connectivity-banner",role:"status","data-testid":"connectivity-banner",children:[n.jsx("span",{className:"connectivity-banner-icon","aria-hidden":"true",children:n.jsx(fe,{name:"CloudOff",size:14})}),n.jsx("span",{className:"connectivity-banner-text",children:"You're offline. The Studio stays usable, but live actions (runs, deploys, the terminal) pause until your connection returns."}),a&&n.jsx("button",{className:"connectivity-banner-dismiss","aria-label":"Dismiss offline notice","data-testid":"connectivity-banner-dismiss",onClick:a,children:"×"})]})}function F1(a,_,E){const S=new Map;for(const N of _)S.has(N.agentSessionId)||S.set(N.agentSessionId,N);for(const N of a)E.has(N.cwd)||S.has(N.agentSessionId)||S.set(N.agentSessionId,N);return Array.from(S.values()).sort((N,q)=>q.lastActiveAt.localeCompare(N.lastActiveAt))}const Y1=12;function Np(a,_,E){var q;const S=[],N=L=>{L&&!S.includes(L)&&S.push(L)};return N((q=a.find(L=>L.id===E))==null?void 0:q.cwd),a.forEach(L=>N(L.cwd)),_.forEach(L=>N(L)),S.slice(0,Y1)}const Un={"claude-code":"Claude Code",codex:"Codex"};function Mp(a,_=Date.now()){const E=_-new Date(a).getTime(),S=Math.floor(E/6e4);if(S<1)return"just now";if(S<60)return`${S}m ago`;const N=Math.floor(S/60);if(N<24)return`${N}h ago`;const q=Math.floor(N/24);return q<7?`${q}d ago`:new Date(a).toLocaleDateString([],{month:"short",day:"numeric"})}function K1(a,_){const E=new Date(_).getTime()-new Date(a).getTime();if(!Number.isFinite(E)||E<=0)return null;const S=Math.floor(E/6e4);if(S<1)return"under a minute";if(S<60)return`${S}m`;const N=Math.floor(S/60);return N<24?`${N}h ${S%60}m`:`${Math.floor(N/24)}d ${N%24}h`}function Xf(a){return a.resumeMode===void 0?"checking":a.resumeMode==="agent-resume"?"resume":(a.turnCount??a.messageCount??0)>0?"from-summary":"empty"}function X1(a){switch(a){case"resume":return null;case"from-summary":return"from summary";case"empty":return"nothing recorded";case"checking":return"checking…"}}function Ec(a,_=Date.now(),E={}){const S=[];E.includeHarness!==!1&&S.push(Un[a.harness]),a.gitBranch&&S.push(a.gitBranch);const N=a.turnCount??a.messageCount;N!=null&&N>0&&S.push(`${N} ${N===1?"turn":"turns"}`);const q=E.state?X1(E.state):null;return q&&S.push(q),S.push(Mp(a.lastActiveAt,_)),S.join(" · ")}function Lp(a,_){const[E,S]=U.useState(a===null?{status:"empty"}:{status:"loading"});return U.useEffect(()=>{if(a===null){S({status:"empty"});return}let N=!1;return S({status:"loading"}),_(a).then(q=>{N||S(q?{status:"ready",record:q}:{status:"empty"})},q=>{N||S({status:"error",message:q instanceof Error?q.message:String(q)})}),()=>{N=!0}},[a,_]),E}function Op({text:a}){const _=a.split(`
434
+ `),E=[];let S=0,N=0;function q(){return N++}function L(h){const p=[],m=/(`[^`]+`|\*\*[^*]+\*\*|\*[^*]+\*)/g;let g=0,u;for(;(u=m.exec(h))!==null;){u.index>g&&p.push(h.slice(g,u.index));const v=u[0];v.startsWith("`")&&v.endsWith("`")?p.push(n.jsx("code",{className:"chat-inline-code",children:v.slice(1,-1)},q())):v.startsWith("**")&&v.endsWith("**")?p.push(n.jsx("strong",{children:v.slice(2,-2)},q())):v.startsWith("*")&&v.endsWith("*")?p.push(n.jsx("em",{children:v.slice(1,-1)},q())):p.push(v),g=u.index+v.length}return g<h.length&&p.push(h.slice(g)),p}for(;S<_.length;){const h=_[S];if(h.startsWith("```")){const u=h.slice(3).trim(),v=[];for(S++;S<_.length&&!_[S].startsWith("```");)v.push(_[S]),S++;S++,E.push(n.jsx("pre",{className:"chat-code-block","data-lang":u||void 0,children:n.jsx("code",{className:u?`language-${u}`:void 0,children:v.join(`
435
+ `)})},q()));continue}const p=h.match(/^(#{1,3})\s+(.+)/);if(p){const v=`h${p[1].length}`;E.push(n.jsx(v,{className:"chat-heading",children:L(p[2])},q())),S++;continue}if(h.startsWith("> ")){E.push(n.jsx("blockquote",{className:"chat-blockquote",children:L(h.slice(2))},q())),S++;continue}if(/^- \[[ x]\]/.test(h)){const u=[];for(;S<_.length&&/^- \[[ x]\]/.test(_[S]);){const v=_[S][3]==="x";u.push({text:_[S].replace(/^- \[[ x]\]\s?/,""),checked:v}),S++}E.push(n.jsx("ul",{className:"chat-list chat-checklist",children:u.map((v,w)=>n.jsx("li",{children:L(v.text)},w))},q()));continue}if(/^[-*+]\s+/.test(h)){const u=[];for(;S<_.length&&/^[-*+]\s+/.test(_[S]);){const v=_[S].replace(/^[-*+]\s+/,"");u.push(n.jsx("li",{children:L(v)},q())),S++}E.push(n.jsx("ul",{className:"chat-list",children:u},q()));continue}if(!h.trim()){S++;continue}const m=u=>u.startsWith("```")||/^#{1,3}\s+/.test(u)||u.startsWith("> ")||/^[-*+]\s+/.test(u),g=[h];for(S++;S<_.length&&_[S].trim()&&!m(_[S]);)g.push(_[S]),S++;E.push(n.jsx("p",{className:"chat-paragraph",children:L(g.join(" "))},q()))}return n.jsx(n.Fragment,{children:E})}const Gf={"assistant-narration-gap":"Only each turn's final assistant message was recorded — anything said between tool calls is missing.","truncated-tool-output":"Large tool results were truncated when recorded and can't be shown in full.","missing-assistant-text":"This agent doesn't report assistant text to the harness, so replies aren't shown.","incomplete-final-turn":"The last turn never completed — the session ended while it was still running.","compacted-archive":"Read from this session's archived copy: the conversation is whole, but tool inputs and results were shortened to keep it small enough to keep.","dropped-early-turns":"The archived copy only had room for the most recent turns — earlier ones are gone."},G1=["assistant-narration-gap","truncated-tool-output","missing-assistant-text","incomplete-final-turn","compacted-archive","dropped-early-turns"];function V1(a){const _=new Set(a),E=G1.filter(N=>_.has(N)).map(N=>Gf[N]),S=[..._].filter(N=>!(N in Gf)).map(N=>`Known gap reported by the harness: ${N}.`);return[...E,...S]}function Z1(a){if(!a)return null;const _=[];return a.inputTokens!=null&&_.push(`${Vf(a.inputTokens)} in`),a.outputTokens!=null&&_.push(`${Vf(a.outputTokens)} out`),_.length>0?_.join(" · "):null}function Vf(a){if(a<1e3)return String(a);const _=a/1e3;return`${_<100?_.toFixed(1):Math.round(_)}k`}function Bp(a,_=Date.now()){if(!a)return null;const E=new Date(a);if(Number.isNaN(E.getTime()))return null;const S=E.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),N=new Date(_);return E.getFullYear()===N.getFullYear()&&E.getMonth()===N.getMonth()&&E.getDate()===N.getDate()?S:`${E.toLocaleDateString([],{day:"numeric",month:"short"})}, ${S}`}function Q1(a,_){const E=a??"unknown tool";if(!_)return E;const S=_.replace(/\s+/g," ").trim();if(!S)return E;const N=S.length>80?`${S.slice(0,80)}…`:S;return`${E} · ${N}`}function J1({record:a}){const _=V1(a.limitations),E=Bp(a.archivedAt);return n.jsxs("div",{className:"transcript","data-testid":"session-transcript",children:[n.jsxs("div",{className:"transcript-notice","data-testid":"transcript-reconstructed",children:[n.jsx("span",{className:"transcript-badge",children:"Reconstructed"}),n.jsxs("div",{className:"transcript-notice-body",children:[n.jsx("p",{className:"transcript-notice-lead",children:"Rebuilt from the harness's own recording of this session, not a replay of your terminal."}),a.archivedAt!==null&&n.jsx("p",{className:"transcript-notice-lead transcript-notice-archived","data-testid":"transcript-archived",children:E?`Archived copy from ${E}, kept after this session's raw events aged out of the local log.`:"Archived copy, kept after this session's raw events aged out of the local log."}),_.length>0&&n.jsx("ul",{className:"transcript-notice-list","data-testid":"transcript-limitations",children:_.map(S=>n.jsx("li",{children:S},S))})]})]}),n.jsx("ol",{className:"transcript-turns",children:a.turns.map(S=>n.jsx(ey,{turn:S},S.index))})]})}function ey({turn:a}){const _=Z1(a.usage),E=Bp(a.promptAt);return n.jsxs("li",{className:"transcript-turn","data-testid":"transcript-turn","data-turn":a.index,children:[n.jsxs("div",{className:"transcript-role transcript-role-user",children:[n.jsx("span",{className:"transcript-role-label",children:"You"}),E&&n.jsx("span",{className:"transcript-time",children:E})]}),a.prompt!==null?n.jsx("div",{className:"transcript-prompt","data-testid":"transcript-prompt",children:a.prompt}):n.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-prompt",children:"No prompt recorded for this turn — the harness started recording after it began."}),a.toolCalls.length>0&&n.jsx("ul",{className:"transcript-tools","data-testid":"transcript-tools",children:a.toolCalls.map((S,N)=>n.jsx(ty,{call:S},`${S.at}-${N}`))}),n.jsxs("div",{className:"transcript-role transcript-role-agent",children:[n.jsx("span",{className:"transcript-role-label",children:"Agent"}),a.model&&n.jsx("span",{className:"transcript-model",children:a.model}),_&&n.jsx("span",{className:"transcript-usage",children:_})]}),a.assistantText!==null?n.jsx("div",{className:"transcript-assistant","data-testid":"transcript-assistant",children:n.jsx(Op,{text:a.assistantText})}):n.jsx("div",{className:"transcript-absent","data-testid":"transcript-no-assistant",children:a.incomplete?"This turn never completed — no reply was recorded.":"No assistant text was recorded for this turn."}),a.incomplete&&n.jsx("div",{className:"transcript-incomplete","data-testid":"transcript-incomplete",children:"Turn incomplete"})]})}function ty({call:a}){return n.jsx("li",{className:"transcript-tool",children:n.jsxs("details",{"data-testid":"transcript-tool-call",children:[n.jsxs("summary",{className:"transcript-tool-summary",children:[n.jsx("span",{className:"transcript-tool-name",children:Q1(a.name,a.input)}),a.responseTruncated&&n.jsx("span",{className:"transcript-tool-truncated","data-testid":"transcript-tool-truncated",children:"truncated"})]}),n.jsxs("div",{className:"transcript-tool-body",children:[a.input&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"transcript-tool-heading",children:"Input"}),n.jsx("pre",{className:"transcript-tool-pre",children:a.input})]}),n.jsx("div",{className:"transcript-tool-heading",children:"Result"}),a.responseSummary?n.jsx("pre",{className:"transcript-tool-pre",children:a.responseSummary}):n.jsx("div",{className:"transcript-absent",children:"No result recorded."}),a.responseTruncated&&n.jsx("div",{className:"transcript-absent",children:"The recorded result was truncated at the collector's size cap; the rest isn't recoverable."})]})]})})}function Zf(a){return a.agentSessionId==null?"This session can't be resumed: it exited before establishing a session id.":`${Un[a.harness]} has no saved conversation for this session, so there's nothing to hand back. That happens when a session ends before its first prompt — the agent never writes a transcript for those.`}function sy({session:a,resumeMode:_,loadRecord:E,onResume:S,onContinue:N,onClose:q}){const L=a.agentSessionId!=null&&_!=="rehydrate",h=K1(a.createdAt,a.lastActiveAt),p=Lp(a.id,E),m=p.status!=="empty",g=!L&&p.status==="ready";return n.jsxs("div",{className:"dead-session-pane","data-testid":"dead-session-pane","data-has-record":m,children:[n.jsxs("div",{className:"dead-session-summary",children:[n.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:n.jsx(fe,{name:"SquareTerminal",size:18})}),n.jsx("div",{className:"dead-session-title",children:"Session exited"}),n.jsxs("div",{className:"dead-session-meta",children:[a.cwd,a.exitCode!=null&&` · exit code ${a.exitCode}`]}),n.jsxs("dl",{className:"dead-session-detail","data-testid":"dead-session-detail",children:[a.title&&n.jsxs("div",{className:"dead-session-detail-row",children:[n.jsx("dt",{children:"Session"}),n.jsx("dd",{children:a.title})]}),n.jsxs("div",{className:"dead-session-detail-row",children:[n.jsx("dt",{children:"Agent"}),n.jsx("dd",{children:Un[a.harness]})]}),h&&n.jsxs("div",{className:"dead-session-detail-row",children:[n.jsx("dt",{children:"Ran for"}),n.jsx("dd",{children:h})]}),n.jsxs("div",{className:"dead-session-detail-row",children:[n.jsx("dt",{children:"Ended"}),n.jsx("dd",{children:Mp(a.lastActiveAt)})]})]}),n.jsxs("div",{className:"dead-session-actions",children:[g?n.jsx("button",{className:"btn-primary","data-testid":"dead-session-continue",onClick:N,children:"Continue here"}):n.jsx("button",{className:"btn-primary","data-testid":"dead-session-resume",onClick:S,disabled:!L,title:L?void 0:Zf(a),children:"Resume"}),n.jsx("button",{className:"btn-ghost","data-testid":"dead-session-close",onClick:q,children:"Close"})]}),!L&&n.jsxs("div",{className:"dead-session-resume-reason","data-testid":"dead-session-resume-reason",children:[Zf(a)," ",g?"Continuing opens a fresh session in this directory, seeded with the reconstruction below — a briefing about this session, not its context. The new agent will need to check the repository before relying on any of it.":"Start a new session in this directory instead; there is no recording of this one to carry over either."]})]}),m&&n.jsx("div",{className:"dead-session-record","data-testid":"dead-session-record",children:n.jsx(Hp,{state:p})})]})}function iy({summary:a,loadRecord:_,onStart:E,onClose:S}){const N=a.resumeMode==="agent-resume",q=a.harnessSessionId??a.agentSessionId,L=Lp(q,_),h=!N&&L.status==="ready";return n.jsxs("div",{className:"past-session-pane","data-testid":"past-session-pane",children:[n.jsxs("header",{className:"past-session-header",children:[n.jsxs("div",{className:"past-session-heading",children:[n.jsx("div",{className:"dead-session-title",children:a.title}),n.jsxs("div",{className:"dead-session-meta",children:[Ec(a)," · ",a.cwd]})]}),n.jsxs("div",{className:"dead-session-actions",children:[n.jsx("button",{className:"btn-primary","data-testid":"past-session-start",onClick:E,children:N?"Resume":h?"Continue here":"New session here"}),n.jsx("button",{className:"btn-ghost","data-testid":"past-session-close",onClick:S,children:"Close"})]})]}),!N&&n.jsxs("div",{className:"dead-session-resume-reason","data-testid":"past-session-reason",children:[Un[a.harness]," has no saved conversation for this session, so it can't be reattached — sessions that end before their first prompt are never written to the agent's history."," ",h?"Continuing opens a fresh session here, seeded with the reconstruction below. The new agent gets a briefing about this session, not its context — it will need to check the repository before relying on any of it.":"Starting opens a fresh session in the same directory, with no context from this one."]}),n.jsx("div",{className:"past-session-body",children:n.jsx(Hp,{state:L})})]})}function Hp({state:a}){return a.status==="loading"?n.jsx("div",{className:"past-session-status","data-testid":"past-session-loading",children:"Rebuilding this session's transcript…"}):a.status==="error"?n.jsxs("div",{className:"past-session-status","data-testid":"past-session-error",children:["Couldn't load this session's transcript: ",a.message]}):a.status==="empty"?n.jsxs("div",{className:"past-session-status","data-testid":"past-session-empty",children:[n.jsx("span",{className:"empty-state-icon","aria-hidden":"true",children:n.jsx(fe,{name:"SquareTerminal",size:18})}),"No transcript for this session: the harness has no recorded events for it. Sessions the Studio didn't run — or ones whose events have aged out of the local log — show up here as history rows only."]}):n.jsx(J1,{record:a.record})}const ny="~/.sapiom/harness",ay={events:`${ny}/events.ndjson`},ry=["image/png","image/jpeg","image/gif","image/webp"],Qf=10*1024*1024,zp=["claude-code","codex"],ly=U.createContext(null),yc=a=>a<1024?`${a} B`:a<1024*1024?`${Math.round(a/1024)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`,oy=a=>new Promise((_,E)=>{const S=new FileReader;S.onload=()=>_(String(S.result)),S.onerror=()=>E(S.error??new Error("could not read file")),S.readAsDataURL(a)}),cy=({sessionId:a,harness:_,api:E,showToast:S,children:N})=>{const[q,L]=U.useState(null),[h,p]=U.useState([]),[m,g]=U.useState(!1),[u,v]=U.useState(!1),w=U.useRef(null),x=U.useRef(0);U.useEffect(()=>{let C=!1;return E.listHarnesses().then(T=>{C||L(T)}).catch(()=>{}),()=>{C=!0}},[E]);const b=U.useMemo(()=>{var C;return q?((C=q.find(T=>T.id===_))==null?void 0:C.imageInput)??!1:!0},[q,_]);U.useEffect(()=>{p([]),x.current=0,g(!1)},[a]);const d=U.useCallback(async C=>{const T=C.filter(I=>I.type.startsWith("image/"));if(T.length===0)return;const H=[];for(const I of T){if(!ry.includes(I.type)){S(`${I.name||"image"}: ${I.type} isn't a supported image type.`);continue}if(I.size>Qf){S(`${I.name||"image"} is ${yc(I.size)}, over the ${yc(Qf)} limit.`);continue}try{const W=await oy(I);H.push({id:crypto.randomUUID(),dataUrl:W,filename:I.name||"pasted-image",mediaType:I.type,bytes:I.size})}catch{S(`Could not read ${I.name||"image"}.`)}}H.length>0&&p(I=>[...I,...H])},[S]);U.useEffect(()=>{if(!b)return;const C=T=>{var W;const H=(W=T.clipboardData)==null?void 0:W.items;if(!H)return;const I=[];for(let P=0;P<H.length;P+=1){const Z=H[P];if(Z.kind==="file"&&Z.type.startsWith("image/")){const te=Z.getAsFile();te&&I.push(te)}}I.length!==0&&(T.preventDefault(),d(I))};return window.addEventListener("paste",C),()=>window.removeEventListener("paste",C)},[b,d]);const f=U.useCallback(C=>{p(T=>T.filter(H=>H.id!==C))},[]),l=U.useCallback(async()=>{if(h.length===0||u)return;v(!0);let C=null;for(const T of h)try{await E.attachImage(a,{dataUrl:T.dataUrl,filename:T.filename}),p(H=>H.filter(I=>I.id!==T.id))}catch(H){C=H instanceof ss&&H.reason?H.reason:H.message;break}v(!1),C&&S(C)},[h,u,E,a,S]),o=U.useCallback(C=>{Array.from(C.dataTransfer.types).includes("Files")&&(x.current+=1,g(!0))},[]),y=U.useCallback(C=>{Array.from(C.dataTransfer.types).includes("Files")&&C.preventDefault()},[]),A=U.useCallback(()=>{x.current=Math.max(0,x.current-1),x.current===0&&g(!1)},[]),k=U.useCallback(C=>{Array.from(C.dataTransfer.types).includes("Files")&&(C.preventDefault(),x.current=0,g(!1),d(Array.from(C.dataTransfer.files)))},[d]),R=U.useCallback(()=>{var C;(C=w.current)==null||C.click()},[]);return b?n.jsxs("div",{className:"image-composer","data-testid":"image-composer",onDragEnter:o,onDragOver:y,onDragLeave:A,onDrop:k,children:[n.jsx(ly.Provider,{value:R,children:n.jsx("div",{className:"image-composer-pane",children:N})}),m&&n.jsxs("div",{className:"image-composer-dropzone","data-testid":"image-composer-dropzone",children:[n.jsx(fe,{name:"ImageUp",size:28}),n.jsx("span",{children:"Drop an image to attach it"})]}),h.length>0&&n.jsxs("div",{className:"image-composer-bar",children:[n.jsx("ul",{className:"image-composer-thumbs","data-testid":"image-composer-thumbs",children:h.map(C=>n.jsxs("li",{className:"image-composer-thumb",title:`${C.filename} · ${yc(C.bytes)}`,children:[n.jsx("img",{src:C.dataUrl,alt:C.filename}),n.jsx("button",{type:"button",className:"image-composer-thumb-remove",onClick:()=>f(C.id),disabled:u,"aria-label":`Remove ${C.filename}`,"data-tooltip":`Remove ${C.filename}`,"data-testid":"image-composer-thumb-remove",children:n.jsx(fe,{name:"X",size:11})})]},C.id))}),n.jsx("button",{type:"button",className:"image-composer-send btn-primary",onClick:()=>void l(),disabled:u,"data-testid":"image-composer-send",children:u?"Sending…":`Send ${h.length} to agent`})]}),n.jsx("input",{ref:w,type:"file",accept:"image/*",multiple:!0,hidden:!0,"data-testid":"image-composer-file-input",onChange:C=>{const T=C.target.files?Array.from(C.target.files):[];d(T),C.target.value=""}})]}):n.jsx(n.Fragment,{children:N})};function Up({onCancel:a,onConfirm:_,triggerRef:E}){const S=U.useRef(null);return zn(!0,{onDismiss:a,containerRef:S,triggerRef:E}),n.jsx("div",{className:"modal-backdrop",onClick:a,children:n.jsxs("div",{ref:S,className:"modal modal-confirm",role:"alertdialog","aria-label":"End session","data-testid":"end-session-confirm",onClick:N=>N.stopPropagation(),children:[n.jsxs("div",{className:"modal-header",children:["End session?",n.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:a,children:n.jsx(fe,{name:"X",size:14})})]}),n.jsx("div",{className:"modal-body",children:n.jsx("p",{className:"modal-copy",children:"This kills the live terminal; anything the agent is doing right now stops. The session stays resumable from history once it has an agent session id."})}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn-ghost",autoFocus:!0,onClick:a,children:"Keep session"}),n.jsx("button",{className:"btn-danger","data-testid":"end-session-confirm-btn",onClick:_,children:"End session"})]})]})})}const uy="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",hy="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",dy={"claude-code":uy,codex:hy},fy=["M105.267 60.7219L98.8902 71.7648L92.1353 83.4669L83.3114 98.7521L70.18 121.491H0L13.1249 98.7521H57.042L72.6274 71.7648L79.0038 60.7219L72.2619 49.0459H98.5247L105.267 60.7219Z","M114.072 0L100.954 22.7189H57.0694L57.0498 22.6928L57.0368 22.7189L41.8365 49.047L35.0945 60.723L41.471 71.7659H15.2016L8.8252 60.723L15.5671 49.047L21.9631 37.978L30.774 22.7189L43.8923 0H114.072Z"];function Ma({kind:a,size:_=16}){if(a==="sapiom")return n.jsx("svg",{viewBox:"0 0 115 122",width:_,height:_,fill:"currentColor","aria-hidden":"true",focusable:"false",children:fy.map(S=>n.jsx("path",{d:S},S.slice(0,16)))});const E=dy[a];return E?n.jsx("svg",{viewBox:"0 0 24 24",width:_,height:_,fill:"currentColor","aria-hidden":"true",focusable:"false",children:n.jsx("path",{d:E})}):n.jsx(fe,{name:"SquareTerminal",size:_})}function py(a,_){return a.status==="exited"?"exited":_?"busy":a.status==="running"?"live":a.status}function my(a){return a.split("/").filter(Boolean).pop()??a}function _y({overviewMode:a=!1,openedAgentName:_=null,reviewTitle:E=null,activeSession:S,sessionName:N,onRenameSession:q,boundWorkflowName:L,busy:h,onExpandRail:p,onExpandRight:m,onCloseSession:g,onOpenInEditor:u,onToast:v}){const[w,x]=U.useState(!1),[b,d]=U.useState(!1),[f,l]=U.useState(!1),[o,y]=U.useState(""),A=U.useRef(null),k=()=>d(!1),R=()=>{S&&q(S.id,o),l(!1)};return n.jsxs("div",{className:"session-bar",children:[p&&n.jsx("button",{className:"gear-btn","data-testid":"rail-expand","aria-label":"Expand workspace panel",title:"Expand workspace panel",onClick:p,children:n.jsx(fe,{name:"Menu",size:15})}),n.jsx("div",{className:"session-context","data-testid":"session-context","data-session-id":(S==null?void 0:S.id)??"",children:a?n.jsxs(n.Fragment,{children:[n.jsx(fe,{name:"Radio",size:13}),n.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:"Overview"})]}):_?n.jsxs(n.Fragment,{children:[n.jsx(fe,{name:"Zap",size:13}),n.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:_}),n.jsx("span",{className:"status-tag session-status-tag session-context-status","data-testid":"session-status-tag","data-status":"none","data-tooltip":"No running session for this agent. Start one to work on it.",children:"no session"})]}):E?n.jsxs(n.Fragment,{children:[n.jsx(fe,{name:"History",size:13}),n.jsx("span",{className:"session-context-title","data-testid":"session-context-title",children:E}),n.jsxs("span",{className:"status-tag session-status-tag session-context-status","data-testid":"session-status-tag","data-status":"exited","data-tooltip":"A past session under review. Resume it from the pane below.",children:[n.jsx("span",{className:"session-dot","data-status":"exited"}),"past"]})]}):S?n.jsxs(n.Fragment,{children:[n.jsx(Ma,{kind:S.harness,size:13}),f?n.jsx("input",{className:"group-name-input session-rename-input session-context-rename","data-testid":"session-rename-input",value:o,autoFocus:!0,onFocus:C=>C.currentTarget.select(),onChange:C=>y(C.target.value),onKeyDown:C=>{C.key==="Enter"&&R(),C.key==="Escape"&&l(!1)},onBlur:R}):n.jsx("span",{className:"session-context-title","data-testid":"session-context-title","data-tooltip":`${Un[S.harness]} · ${my(S.cwd)} · ${S.cwd}`,children:N??S.title}),L&&n.jsxs("span",{className:"session-workflow-chip","data-testid":"session-workflow-chip","data-tooltip":`Bound to ${L}; shown in Canvas`,children:["· ",L]}),n.jsxs("span",{className:"status-tag session-status-tag session-context-status","data-testid":"session-status-tag","data-status":S.status,"data-tooltip":h?"The agent produced output in the last few seconds":S.status==="running"?"Session is live; the terminal is connected":S.status==="exited"?"Session ended; resume it from the dead-session pane or history":"Session is starting",children:[h?n.jsx("span",{className:"session-busy","data-testid":"session-busy","aria-hidden":"true"}):n.jsx("span",{className:"session-dot","data-status":S.status}),py(S,h)]})]}):n.jsx("span",{className:"session-context-none",children:"No active session"})}),!a&&!E&&!_&&S&&n.jsxs("div",{className:"session-menu-wrap",children:[n.jsx("button",{ref:A,className:"theme-toggle","data-testid":"session-menu","aria-label":"Session options","data-tooltip":"Session options","aria-haspopup":"menu","aria-expanded":b,onClick:()=>d(C=>!C),children:n.jsx(fe,{name:"MoreHorizontal",size:14})}),n.jsxs(ci,{open:b,anchorRef:A,onDismiss:k,placement:"down-end",className:"session-menu",role:"menu",testid:"session-menu-popover",children:[n.jsxs("button",{role:"menuitem",className:"profile-menu-item",onClick:()=>{var C;(C=navigator.clipboard)==null||C.writeText(S.cwd).then(()=>v("Path copied.")).catch(()=>v("Couldn't copy the path.")),k()},children:[n.jsx(fe,{name:"Copy",size:13}),"Copy path"]}),n.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-rename",onClick:()=>{y(N??S.title),l(!0),k()},children:[n.jsx(fe,{name:"Pencil",size:13}),"Rename session"]}),n.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"session-open-editor",onClick:()=>{u(S.cwd),k()},children:[n.jsx(fe,{name:"Code",size:13}),"Open in editor"]}),S.status!=="exited"&&n.jsxs("button",{role:"menuitem",className:"profile-menu-item session-menu-danger","data-testid":"session-end-btn",onClick:()=>{k(),x(!0)},children:[n.jsx(fe,{name:"X",size:13}),"End session…"]})]})]}),m&&n.jsx("button",{className:"gear-btn","data-testid":"right-expand","aria-label":"Expand canvas panel",title:"Expand canvas panel",onClick:m,children:n.jsx(fe,{name:"List",size:15})}),w&&S&&n.jsx(Up,{triggerRef:A,onCancel:()=>x(!1),onConfirm:()=>{x(!1),g(S.id)}})]})}function vy(a,_,E){if(a.requiresWorkflow){if(!_)return"Select a workflow first";if(a.action.kind==="open-url"&&a.action.url.includes("{{workflow.definitionId}}")&&_.definitionId==null)return"Not deployed yet"}return a.action.kind!=="open-url"&&!E?"Start a session first":null}function gy(a,_){return a.replace("{{workflow.definitionId}}",String((_==null?void 0:_.definitionId)??""))}function el(a,_,E){const S={event:a,..._?{data:_}:{}};fetch("/api/track",{method:"POST",headers:{"Content-Type":"application/json","X-Harness-Token":On()},body:JSON.stringify(S),keepalive:!0}).catch(()=>{})}function yy({workflow:a,activeSessionId:_,sessionReady:E,macros:S,onRunMacro:N,preview:q,lastDeployError:L,authenticated:h,directActionSettleSeq:p}){const m=x=>S.find(b=>b.id===x),g=a.definitionId!=null,[u,v]=U.useState(null);U.useEffect(()=>{v(null)},[a.path,g,L,p]);const w=[{id:"local",label:"Local Run",icon:"FlaskConical",macro:m("run_local"),testId:"session-step-local",hint:"Test: run locally with every capability stubbed - no real calls."},{id:"run",label:"Prod Run",icon:"Play",macro:m("prod_run"),testId:"session-step-run",hint:"Ship: start a real cloud execution on Sapiom.",needsDeploy:!0,needsAuth:!0},{id:"deploy",label:"Deploy",icon:"CloudUpload",macro:m("deploy"),testId:"session-step-deploy",hint:"Ship: push and build on Sapiom.",primary:!0,needsAuth:!0}].filter(x=>x.macro);return n.jsxs("div",{className:"session-steps","data-testid":"session-steps","aria-label":"Agent actions",children:[n.jsxs("span",{className:"status-tag session-lifecycle-chip","data-testid":"session-lifecycle-chip","data-deployed":g,"data-deploy-error":L!=null&&!g?"":void 0,"data-tooltip":g?`Deployed to Sapiom (definition ${a.definitionId}). Run starts real cloud executions.`:L!=null?"Last deploy failed. Retry Deploy to push to Sapiom.":"Draft: exists locally only. Building here uses your Claude Code account; Deploy publishes to Sapiom.",children:[n.jsx(fe,{name:g?"Cloud":"CloudOff",size:13}),n.jsx("span",{className:"session-lifecycle-label",children:g?"Deployed":L!=null?"Deploy failed":"Draft"})]}),q&&n.jsxs("a",{className:"status-tag status-tag-action session-preview-chip","data-testid":"session-preview-chip",href:q.url,target:"_blank",rel:"noreferrer","aria-label":`Preview :${q.port}`,"data-tooltip":`The agent is serving an app on port ${q.port}. Opens ${q.url}`,children:[n.jsx(fe,{name:"ExternalLink",size:12}),n.jsx("span",{className:"session-preview-label",children:"Preview "}),":",q.port]}),n.jsx("div",{className:"session-actions",children:w.map(x=>{const b=x.needsAuth&&!h?"Connect your account first":null,d=x.needsDeploy&&!g?L!=null?"Last deploy failed — retry Deploy":"Not deployed yet":null,f=!E&&x.macro&&x.macro.action.kind!=="open-url"?"Session is starting":null,l=b??d??f??(x.macro?vy(x.macro,a,_):null),o=x.label;return n.jsxs("button",{className:"session-step"+(x.primary?" session-action-primary":""),"data-testid":x.testId,"data-pending":u===x.id||void 0,disabled:!!l,"data-tooltip":l?`${o}: ${l}`:x.hint,"aria-label":l?`${o}: ${l}`:o,onClick:()=>{x.macro&&(N(x.macro),v(x.id),el("macro.invoked",{macroId:x.macro.id}))},children:[n.jsx(fe,{name:x.icon,size:14}),n.jsx("span",{className:"session-step-label",children:x.label})]},x.id)})})]})}function Sy({sessions:a,activeSessionId:_,busySessionIds:E,labelOf:S,agentName:N,onSelect:q,onClose:L,onNew:h}){const[p,m]=U.useState(null),g=U.useRef(null);return n.jsxs("div",{className:"session-tabs",role:"tablist","aria-label":"Sessions","data-testid":"session-tabs",children:[a.map(u=>{const v=u.id===_,w=E.has(u.id),x=S(u);return n.jsxs("div",{className:"session-tab"+(v?" is-active":""),"data-testid":`session-tab-${u.id}`,children:[n.jsxs("button",{type:"button",role:"tab","aria-selected":v,className:"session-tab-main","data-testid":`session-tab-main-${u.id}`,title:`${x} · ${Un[u.harness]}`,onClick:()=>q(u.id),children:[n.jsx(Ma,{kind:u.harness,size:13}),n.jsx("span",{className:"session-tab-label",children:x}),w?n.jsx("span",{className:"session-tab-busy","data-testid":`session-tab-busy-${u.id}`,"aria-hidden":"true"}):n.jsx("span",{className:"session-tab-dot","data-status":u.status,"aria-hidden":"true"})]}),n.jsx("button",{type:"button",className:"session-tab-close","data-testid":`session-tab-close-${u.id}`,"aria-label":`Close ${x}`,"data-tooltip":"End session",onClick:b=>{g.current=b.currentTarget,m(u.id)},children:n.jsx(fe,{name:"X",size:12})})]},u.id)}),n.jsx("button",{type:"button",className:"session-tab-new","data-testid":"session-tab-new","aria-label":`New session on ${N}`,"data-tooltip":"New session on this agent",onClick:h,children:n.jsx(fe,{name:"Plus",size:14})}),p&&n.jsx(Up,{triggerRef:g,onCancel:()=>m(null),onConfirm:()=>{const u=p;m(null),L(u)}})]})}function by({onDismiss:a,onOpenSettings:_}){return n.jsxs("div",{className:"telemetry-notice",role:"status","data-testid":"telemetry-notice",children:[n.jsx("div",{className:"telemetry-notice-body",children:n.jsxs("p",{className:"telemetry-notice-text",children:["Analytics are ",n.jsx("strong",{children:"on by default"}),": usage events (including prompts and tool calls) are collected locally and sent to Sapiom to help improve the product. Change this any time in"," ",n.jsx("button",{className:"telemetry-notice-settings-link",onClick:()=>{_(),a()},children:"Settings"}),", or use the indicator in the top bar."]})}),n.jsx("button",{className:"telemetry-notice-dismiss","aria-label":"Dismiss analytics notice","data-testid":"telemetry-notice-dismiss",onClick:a,children:"×"})]})}const Cy=/^[a-z0-9][a-z0-9-]{0,213}$/,Ip="sapiom-agent",wy=3,Jf=32,xy=new Set(["a","an","and","any","are","as","at","be","can","could","do","each","every","for","from","get","i","if","in","into","is","it","its","just","me","my","need","of","on","once","or","our","please","should","so","that","the","their","them","then","there","this","to","us","want","we","when","with","would","you","your","daily","day","hourly","hour","week","weekly","month","monthly","morning","evening","night","always","regularly"]);function Oc(a){return Cy.test(a)}function Ey(a){var L;const _=a.toLowerCase().replace(/[^a-z0-9]+/g," ").split(" ").filter(Boolean),E=_.filter(h=>!xy.has(h)),S=E.length>0?E:_,N=[];for(const h of S.slice(0,wy)){if((N.length===0?h:`${N.join("-")}-${h}`).length>Jf)break;N.push(h)}const q=N.join("-")||((L=S[0])==null?void 0:L.slice(0,Jf))||"";return Oc(q)?q:Ip}function qp(a,_){const E=(_==null?void 0:_.trim().replace(/\/+$/,""))??"",S=a.trim();return!E||!S?"":`${E}/${S}`}function ky(a){var _,E,S;return((_=a.settingsRoot)==null?void 0:_.trim())||((E=a.defaultProjectRoot)==null?void 0:E.trim())||((S=a.launchDir)==null?void 0:S.trim())||""}function Ay(a){const _=a.replace(/\/+$/,""),E=_.lastIndexOf("/");if(E<0)return null;const S=_.slice(0,E);return S===_?null:S||"/"}function jy(a,_){const E=new Set(_);if(!E.has(a))return a;for(let S=2;S<1e3;S+=1){const N=`${a}-${S}`;if(!E.has(N)&&Oc(N))return N}return a}const Ry=[{kind:"starter",id:"default",name:"Default starter",description:"A minimal two-step starter."},{kind:"starter",id:"coding-pause",name:"Coding pause",description:"The launch + pauseUntilSignal + resume pattern for a non-blocking coding-agent run."}],Ty={starter:"Starter","product-engineering":"Product and engineering","reliability-governance":"Reliability and governance","revenue-marketing":"Revenue and marketing","customer-experience":"Customer experience","data-knowledge":"Data and knowledge","finance-legal-people":"Finance, legal and people"};function Dy(a){return a?Ty[a]??a.replace(/-/g," ").replace(/^./,_=>_.toUpperCase()):"Uncategorised"}function $p(a){return a!=null&&a.label?a.score>0?`${a.label} ${a.score}/5`:a.label:"—"}function Pp(a){const{basis:_}=a,E=[];_.llmSteps>0&&E.push(`${_.llmSteps} model ${_.llmSteps===1?"step":"steps"}`),_.chainedLlmSteps>0&&E.push(`${_.chainedLlmSteps} chained`),_.mediaCapabilities>0&&E.push(`${_.mediaCapabilities} media ${_.mediaCapabilities===1?"generator":"generators"}`),E.push(`${_.stepCount} ${_.stepCount===1?"step":"steps"}`),_.capabilityCount>0&&E.push(`${_.capabilityCount} ${_.capabilityCount===1?"capability":"capabilities"}`);const S=_.llmSteps===0&&_.mediaCapabilities===0?" · deterministic":"";return`${E.join(", ")}${S}`}function Ny(a){return`${a.label}: ${Pp(a)}`}function ep(a,_){const E=_.trim().toLowerCase();return E?[a.name,a.description,a.id,...a.kind==="gallery"?a.tags:[],...a.kind==="gallery"?a.capabilities:[]].join(" ").toLowerCase().includes(E):!0}function My(a,_){const E="When the project is ready, offer a free local test run (sapiom_dev_agents_run_local) as the next step.";return a.kind==="gallery"?`Clone the Sapiom gallery template "${a.id}" into this directory: call the sapiom_dev_agents_clone tool with dir "${_}" and templateId "${a.id}". If it reports you are not authenticated, run sapiom_authenticate first and retry. After the clone, read the project's AGENTS.md and run npm install. `+E:`Scaffold the "${a.id}" starter in this directory: run \`sapiom agents init . -t ${a.id}\`, then run npm install and read AGENTS.md. Use the sapiom-agent-authoring skill to adapt the workflow. `+E}function Ly(a){var N,q;const _=a.steps.map(L=>({id:L.name,kind:L.kind,label:L.name,role:L.kind.startsWith("terminal")?"terminal":L.kind==="entry"?"entry":"step",description:L.description??"",timeoutMs:null,inputSchema:null,capabilities:L.capabilities})),E=new Map;for(const L of a.transitions)L.kind==="continue"&&E.set(L.from,(E.get(L.from)??0)+1);const S=a.transitions.map(L=>({from:L.from,to:L.to,kind:L.kind==="pause"?"cross":(E.get(L.from)??0)>1?"branching":"sequential",label:L.label??""}));return{name:a.name,entry:((N=a.steps.find(L=>L.kind==="entry"))==null?void 0:N.name)??((q=a.steps[0])==null?void 0:q.name)??"",nodes:_,edges:S,groups:[],warnings:[]}}function Oy(a,_){const E=a.kind==="starter"&&a.id==="default"?Ip:a.id;return qp(E,_)}const Hn="(none)",tp={query:"",category:null,cadence:null};function By(a){return a.query.trim()!==""||a.category!==null||a.cadence!==null}const Hy={"on-demand":"On demand",scheduled:"Scheduled","on-event":"On event","on-webhook":"Webhook"};function Wp(a){return a?Hy[a]??a.replace(/-/g," ").replace(/^./,_=>_.toUpperCase()):"No trigger declared"}function Fp(a,_,E){const S=new Map;for(const N of a){const q=_(N)??Hn;S.set(q,(S.get(q)??0)+1)}return[...S.entries()].map(([N,q])=>({value:N,label:E(N),count:q})).sort((N,q)=>N.value===Hn?1:q.value===Hn?-1:q.count-N.count||N.label.localeCompare(q.label))}function zy(a){return Fp(a,_=>_.category,_=>_===Hn?"Uncategorised":Dy(_))}function Uy(a){return Fp(a,_=>_.cadence,_=>_===Hn?"No trigger declared":Wp(_))}function sp(a,_){return _===null?!0:_===Hn?a===null:a===_}function Iy(a,_,E){return a.filter(S=>E(S,_.query)&&sp(S.category,_.category)&&sp(S.cadence,_.cadence))}function Xr({children:a,variant:_="tag",title:E}){return n.jsx("span",{className:_==="count"?"pill pill--count":"pill",title:E,children:a})}const ip=3;function qy({template:a,onPreview:_,onUse:E}){const[S,N]=U.useState(!1),q=U.useRef(null),L=[{term:"Steps",value:String(a.stepCount)},{term:"Trigger",value:a.cadence?Wp(a.cadence):"Not declared"},{term:"Complexity",value:$p(a.complexity),...a.complexity?{title:Ny(a.complexity)}:{title:"This catalog response carried no complexity band."}},{term:"Capabilities",value:a.capabilities.length>0?String(a.capabilities.length):"None"}];return n.jsxs(n.Fragment,{children:[n.jsx("button",{ref:q,type:"button",className:"theme-toggle template-card-info","data-testid":`template-card-info-${a.id}`,"aria-label":`What ${a.name} runs and costs`,"aria-expanded":S,onClick:()=>N(h=>!h),children:n.jsx(fe,{name:"Info",size:14})}),n.jsxs(ci,{open:S,anchorRef:q,onDismiss:()=>N(!1),placement:"down-end",className:"template-facts",testid:"template-facts",children:[n.jsx("dl",{className:"template-fact-list",children:L.map(h=>n.jsxs("div",{className:"template-fact",children:[n.jsx("dt",{children:h.term}),n.jsx("dd",{title:h.title,children:h.value})]},h.term))}),n.jsxs("div",{className:"template-fact-actions",children:[n.jsx("button",{type:"button",className:"btn-line","data-testid":`template-facts-preview-${a.id}`,onClick:()=>{N(!1),_(a)},children:"Preview"}),n.jsx("button",{type:"button",className:"btn-primary","data-testid":`template-facts-use-${a.id}`,onClick:()=>{N(!1),E(a)},children:"Use"})]})]})]})}function np({template:a,onOpen:_,onUse:E}){const S=a.kind==="gallery"?a.tags.slice(0,ip):[],N=a.kind==="gallery"?a.tags.length-S.length:0;return n.jsxs("article",{className:"template-card","data-testid":`template-card-${a.id}`,children:[n.jsx("button",{type:"button",className:"template-card-hitbox","data-testid":`template-card-open-${a.id}`,onClick:()=>_(a),children:n.jsxs("span",{className:"visually-hidden",children:["Open ",a.name]})}),n.jsxs("div",{className:"template-card-header",children:[n.jsx("h3",{className:"template-card-name",children:a.name}),a.kind==="gallery"&&n.jsx(qy,{template:a,onPreview:_,onUse:E})]}),n.jsx("p",{className:"template-card-desc","data-testid":"template-card-desc",children:a.description}),a.kind==="starter"?n.jsx("div",{className:"template-card-tags",children:n.jsx(Xr,{children:"offline"})}):S.length>0&&n.jsxs("div",{className:"template-card-tags",children:[S.map(q=>n.jsx(Xr,{children:q},q)),N>0&&n.jsxs(Xr,{variant:"count",title:a.tags.slice(ip).join(", "),children:["+",N]})]})]})}function $y({detail:a}){const _=Ly(a);return n.jsx("div",{className:"template-graph","data-testid":"template-graph",children:_.nodes.map(E=>{const S=_.edges.filter(N=>N.from===E.id);return n.jsxs("div",{className:"template-graph-item","data-testid":`template-graph-node-${E.id}`,children:[n.jsxs("div",{className:"template-graph-node",children:[n.jsx("span",{className:"canvas-step-dot dot--"+E.kind,"aria-hidden":"true"}),n.jsx("span",{className:"template-graph-name",children:E.label}),E.kind==="terminal-success"&&n.jsx("span",{className:"template-step-exit",children:"exit"}),E.kind==="terminal-warn"&&n.jsx("span",{className:"template-step-exit template-step-exit--warn",children:"fails out"}),E.kind==="pause"&&n.jsx("span",{className:"template-step-pause",children:"pause"}),E.capabilities.map(N=>n.jsx("code",{className:"template-cap",children:N},N))]}),S.map(N=>n.jsxs("div",{className:"canvas-step-transition template-graph-edge",children:[n.jsx(fe,{name:"CornerDownRight",size:12}),n.jsx("span",{className:"canvas-step-transition-target",children:N.to}),N.label&&n.jsx("span",{className:"canvas-step-transition-label",children:N.label})]},`${N.from}->${N.to}`))]},E.id)})})}function Py({example:a,index:_}){return n.jsxs("details",{className:"template-example",children:[n.jsx("summary",{className:"template-example-summary",children:a.title??`Example ${_+1}`}),n.jsxs("div",{className:"template-example-body",children:[n.jsx("span",{className:"template-example-label",children:"Input"}),n.jsx("pre",{className:"template-example-json",children:JSON.stringify(a.input,null,2)}),a.output!==null&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"template-example-label",children:"Output"}),n.jsx("pre",{className:"template-example-json",children:JSON.stringify(a.output,null,2)})]})]})]})}function Wy({detail:a}){return n.jsxs(n.Fragment,{children:[a.whatItDoes&&n.jsx("p",{className:"template-lead",children:a.whatItDoes}),a.steps.length>0&&n.jsxs("section",{className:"template-section",children:[n.jsx("h4",{className:"template-section-title",children:"Steps"}),n.jsx($y,{detail:a}),n.jsx("ol",{className:"template-steps",children:a.steps.map((_,E)=>n.jsxs("li",{className:"template-step",children:[n.jsx("span",{className:"template-step-index","aria-hidden":"true",children:E+1}),n.jsxs("span",{className:"template-step-copy",children:[n.jsxs("span",{className:"template-step-name",children:[_.name,n.jsx("span",{className:"template-step-role",children:_.sublabel})]}),_.description&&n.jsx("span",{className:"template-step-desc",children:_.description})]}),_.capabilities.map(S=>n.jsx("code",{className:"template-cap",children:S},S))]},_.name))})]}),n.jsxs("section",{className:"template-section",children:[n.jsx("h4",{className:"template-section-title",children:"Capabilities and complexity"}),a.capabilities.length>0?n.jsx("div",{className:"template-caps",children:a.capabilities.map(_=>n.jsx("code",{className:"template-cap",children:_},_))}):n.jsx("p",{className:"template-note","data-testid":"template-caps-none",children:"Declares no metered capabilities."}),n.jsx("p",{className:"template-note","data-testid":"template-complexity-note",children:a.complexity?n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:$p(a.complexity)})," —"," ",Pp(a.complexity),". A rough estimate of how involved this template is, not a price. Local test runs stub every capability and are free."]}):n.jsx(n.Fragment,{children:"This catalog response carried no complexity band, so none is shown. Local test runs stub every capability and are free."})})]}),a.requiredSecrets.length>0&&n.jsxs("section",{className:"template-section",children:[n.jsx("h4",{className:"template-section-title",children:"Credentials you supply"}),n.jsx("ul",{className:"template-usecases",children:a.requiredSecrets.map(_=>n.jsxs("li",{children:[n.jsx("code",{className:"template-cap",children:_.key})," ",_.label,_.description&&n.jsxs(n.Fragment,{children:[" — ",_.description]})]},_.key))})]}),a.useCases.length>0&&n.jsxs("section",{className:"template-section",children:[n.jsx("h4",{className:"template-section-title",children:"Use cases"}),n.jsx("ul",{className:"template-usecases",children:a.useCases.map(_=>n.jsx("li",{children:_},_))})]}),a.examples.length>0&&n.jsxs("section",{className:"template-section",children:[n.jsx("h4",{className:"template-section-title",children:"Examples"}),a.examples.map((_,E)=>n.jsx(Py,{example:_,index:E},_.title??E))]}),a.notes&&n.jsxs("section",{className:"template-section",children:[n.jsx("h4",{className:"template-section-title",children:"Notes"}),n.jsx("div",{className:"template-notes",children:n.jsx(Op,{text:a.notes})})]})]})}function Fy({template:a,getTemplate:_}){const[E,S]=U.useState(null),[N,q]=U.useState(null);return U.useEffect(()=>{if(a.kind!=="gallery"){S(null),q(null);return}let L=!1;return S(null),q(null),_(a.id).then(h=>{L||S(h)}).catch(h=>{L||q(h instanceof Error?h.message:String(h))}),()=>{L=!0}},[a.kind,a.id,_]),n.jsxs("div",{className:"template-detail","data-testid":"template-detail",children:[n.jsxs("div",{className:"template-detail-head",children:[n.jsx("h3",{className:"template-detail-name",children:a.name}),n.jsx("div",{className:"template-tags",children:(a.kind==="gallery"?a.tags:["bundled"]).map(L=>n.jsx("span",{className:"template-tag",children:L},L))})]}),a.kind==="gallery"?n.jsxs(n.Fragment,{children:[(E==null?void 0:E.author)&&n.jsxs("span",{className:"template-byline",children:["By"," ",E.author.url?n.jsx("a",{href:E.author.url,target:"_blank",rel:"noopener noreferrer",children:E.author.name}):E.author.name]}),!E&&!N&&n.jsx("p",{className:"template-lead",children:a.description}),N&&n.jsxs("p",{className:"template-note","data-testid":"template-detail-error",children:["Could not load this template’s details: ",N]}),E&&n.jsx(Wy,{detail:E})]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"template-lead",children:a.description}),n.jsx("p",{className:"template-note",children:"Scaffolds an npm-install-ready TypeScript project with a starter agent in index.ts."})]}),n.jsx("p",{className:"template-handoff","data-testid":"template-handoff",children:a.kind==="gallery"?"Using it forks the template into a repo you own, then clones it here. Needs a signed-in Sapiom account; the agent asks you to sign in if it is missing.":"Scaffolds offline from the template bundled with the CLI. No account, no network."})]})}function ap({title:a,allLabel:_,allCount:E,options:S,value:N,onSelect:q,testIdPrefix:L}){if(S.length<2)return null;const h=[{value:"",label:_,count:E,testId:`${L}-all`,selects:null},...S.map(p=>({...p,testId:`${L}-${p.value}`,selects:p.value}))];return n.jsxs("div",{className:"facet",children:[n.jsx("span",{className:"facet-title",children:a}),n.jsx("div",{className:"facet-rows",role:"radiogroup","aria-label":a,children:h.map(p=>{const m=N===p.selects;return n.jsxs("button",{type:"button",role:"radio","aria-checked":m,className:m?"facet-row is-active":"facet-row","data-testid":p.testId,onClick:()=>q(p.selects),children:[n.jsx("span",{className:"facet-row-label",children:p.label}),n.jsx(Xr,{variant:"count",children:p.count})]},p.testId)})})]})}function Yy({catalog:a,filter:_,onChange:E}){return n.jsxs("div",{className:"template-filters","data-testid":"template-filters",children:[n.jsxs("div",{className:"template-search",children:[n.jsx(fe,{name:"Search",size:14}),n.jsx("input",{className:"template-search-input",type:"search",value:_.query,placeholder:"Search templates","aria-label":"Search templates","data-testid":"template-search",onChange:S=>E({..._,query:S.target.value})})]}),n.jsx(ap,{title:"Category",allLabel:"All templates",allCount:a.length,options:zy(a),value:_.category,onSelect:S=>E({..._,category:S}),testIdPrefix:"templates-category"}),n.jsx(ap,{title:"Trigger",allLabel:"Any trigger",allCount:a.length,options:Uy(a),value:_.cadence,onSelect:S=>E({..._,cadence:S}),testIdPrefix:"templates-cadence"})]})}function Ky(a){const _=a.split("/").filter(Boolean);return _.length<=2?a:`/${_[0]}/…/${_[_.length-1]}`}function tl({value:a,onChange:_,onSubmit:E,recentDirs:S,listDir:N,onNewDirChange:q}){const[L,h]=U.useState(a),[p,m]=U.useState([]),[g,u]=U.useState(a),[v,w]=U.useState(!1),[x,b]=U.useState(null),[d,f]=U.useState(0),[l,o]=U.useState(!0),[y,A]=U.useState(!1),[k,R]=U.useState(0),C=U.useRef(null),[T,H]=U.useState("none"),I=()=>{const V=C.current;if(!V)return;const M=V.scrollLeft>2,$=V.scrollLeft+V.clientWidth<V.scrollWidth-2;H(M&&$?"both":M?"left":$?"right":"none")};U.useEffect(()=>{I()},[S]),U.useEffect(()=>{let V=!1;w(!0),b(null),A(!1);const M=D=>{const z=D.replace(/\/+$/,""),Q=z.slice(0,z.lastIndexOf("/"));return!z.includes("/")||Q===z?null:Q||"/"},$=setTimeout(()=>{N(a||void 0).then(D=>{V||(h(D.path),m(D.dirs),u(D.parent))}).catch(async()=>{const D=M(a);if(!D||V){V||b("Couldn't read that directory.");return}try{const z=await N(D);if(V)return;h(z.path),m(z.dirs),u(z.parent),A(!0)}catch{V||b("Couldn't read that directory.")}}).finally(()=>!V&&w(!1))},150);return()=>{V=!0,clearTimeout($)}},[a,k]);const W=a.startsWith(L)?a.slice(L.length).replace(/^\//,""):"",P=W?p.filter(V=>V.name.toLowerCase().startsWith(W.toLowerCase())):p,Z=Math.min(d,Math.max(P.length-1,0)),te=!v&&!x&&P.length===0&&(y||W!=="");U.useEffect(()=>{q==null||q(te)},[te]);const F=V=>_(V),Y=V=>{var $;const M=l&&P.length>0;V.key==="ArrowDown"&&M?(V.preventDefault(),f(Math.min(Z+1,P.length-1))):V.key==="ArrowUp"&&M?(V.preventDefault(),f(Math.max(Z-1,0))):V.key==="Enter"&&(M?(F((($=P[Z])==null?void 0:$.path)??P[0].path),f(0)):E())};return n.jsxs("div",{className:"dir-picker",children:[n.jsxs("div",{className:"dir-picker-inputrow",children:[n.jsx("button",{type:"button",className:"dir-picker-up","data-testid":"dir-picker-up",disabled:g===L,onClick:()=>F(g),"aria-label":"Up to parent directory","data-tooltip":"Up to parent directory",children:n.jsx(fe,{name:"CornerLeftUp",size:14})}),n.jsx("input",{id:"new-session-cwd",autoFocus:!0,"aria-label":"Workspace folder",className:"modal-input dir-picker-input","data-testid":"dir-picker-input",value:a,placeholder:"/path/to/workspace",onChange:V=>_(V.target.value),onKeyDown:Y}),n.jsx("button",{type:"button",className:"dir-picker-up dir-picker-browse"+(l?" is-active":""),"data-testid":"dir-picker-browse","aria-pressed":l,onClick:()=>{if(!l){o(!0);return}te&&L&&L!==a?F(L):o(!1)},"aria-label":"Browse subdirectories","data-tooltip":l?te?"Browse the nearest existing folder":"Hide the directory listing":"Browse subdirectories",children:n.jsx(fe,{name:"Folder",size:14})})]}),S.length>0&&n.jsx("div",{className:"recent-dirs",ref:C,"data-fade":T,onScroll:I,children:S.map(V=>n.jsx("button",{type:"button",className:"recent-dir-chip",title:V,onClick:()=>F(V),children:Ky(V)},V))}),l&&n.jsxs("div",{className:"dir-picker-listing","data-testid":"dir-picker-listing",children:[n.jsx("div",{className:"dir-picker-path",children:L}),v&&n.jsx("div",{className:"dir-picker-empty",children:"Loading…"}),!v&&x&&n.jsxs("div",{className:"dir-picker-error","data-testid":"dir-picker-error",role:"alert",children:[n.jsx(fe,{name:"TriangleAlert",size:14}),n.jsx("span",{children:x}),n.jsx("button",{type:"button",className:"btn-ghost dir-picker-retry","data-testid":"dir-picker-retry",onClick:()=>R(V=>V+1),children:"Retry"})]}),te&&n.jsx("div",{className:"dir-picker-newdir","data-testid":"dir-picker-newdir",children:"New folder. It will be created when you start."}),!v&&!x&&!te&&P.length===0&&n.jsx("div",{className:"dir-picker-empty",children:"No subdirectories"}),!v&&!x&&P.map((V,M)=>n.jsxs("button",{type:"button",className:"dir-picker-item"+(M===Z?" is-selected":""),"data-testid":`dir-picker-item-${V.name}`,onMouseEnter:()=>f(M),onClick:()=>F(V.path),children:[n.jsx(fe,{name:"Folder",size:13}),n.jsx("span",{className:"dir-picker-item-name",children:V.name}),V.hasAgentProject&&n.jsxs("span",{className:"dir-picker-item-badge","data-testid":`dir-picker-badge-${V.name}`,title:"Contains sapiom.json",children:[n.jsx(fe,{name:"Check",size:11}),"Agent"]})]},V.path))]})]})}function Xy({template:a,initialDest:_,recentDirs:E,listDir:S,onCancel:N,onConfirm:q,triggerRef:L}){const[h,p]=U.useState(_),[m,g]=U.useState(!1),[u,v]=U.useState(null),w=U.useRef(null);zn(!m,{onDismiss:N,containerRef:w,triggerRef:L});const x=async()=>{const b=h.trim();if(!(!b||m)){g(!0),v(null);try{await q(b)}catch(d){v(d.message),g(!1)}}};return n.jsx("div",{className:"modal-backdrop",children:n.jsxs("div",{className:"modal modal-confirm modal-template-use",role:"dialog","aria-label":`Use ${a.name}`,"data-testid":"template-use-dialog",ref:w,children:[n.jsxs("div",{className:"modal-header",children:["Use ",a.name,n.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",disabled:m,onClick:N,children:n.jsx(fe,{name:"X",size:14})})]}),n.jsxs("div",{className:"modal-body",children:[n.jsx(tl,{value:h,onChange:p,onSubmit:()=>void x(),recentDirs:E,listDir:S}),u?n.jsx("p",{className:"modal-error","data-testid":"template-use-error",children:u}):n.jsx("p",{className:"modal-field-hint",children:"A session starts here and sets the template up in it. A folder that does not exist yet is created."})]}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn-ghost",disabled:m,onClick:N,children:"Cancel"}),n.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"template-use-confirm",disabled:m||!h.trim(),onClick:()=>void x(),children:m?"Starting…":"Start session"})]})]})})}function Gy({projectRoot:a,recentDirs:_,listDir:E,onExit:S,onUse:N,listTemplates:q,getTemplate:L}){const[h,p]=U.useState(null),[m,g]=U.useState(null),[u,v]=U.useState(tp),[w,x]=U.useState(null),[b,d]=U.useState(null),f=U.useRef(null);U.useEffect(()=>{let R=!1;return q().then(C=>{R||p(C)}).catch(C=>{R||g(C instanceof Error?C.message:String(C))}),()=>{R=!0}},[]);const l=U.useMemo(()=>((h==null?void 0:h.templates)??[]).map(R=>({...R,kind:"gallery"})),[h]),o=U.useMemo(()=>Iy(l,u,ep),[l,u]),y=U.useMemo(()=>u.category!==null||u.cadence!==null?[]:Ry.filter(R=>ep(R,u.query)),[u]),A=h===null&&m===null,k=m?`Could not load the template gallery: ${m}`:!h||h.source==="live"?null:h.reason==="signed-out"?"Sign in to Sapiom to browse the template gallery. The bundled starters below work offline.":"The template gallery is unreachable right now. The bundled starters below work offline.";return n.jsxs("section",{className:"templates-panel","data-testid":"templates-panel","aria-label":"Templates",children:[n.jsxs("div",{className:"templates-bar",children:[n.jsx("button",{type:"button",className:"theme-toggle templates-back","data-testid":w?"template-detail-back":"templates-exit","aria-label":w?"Back to all templates":"Back to the session",title:w?"All templates":"Back to the session",onClick:()=>w?x(null):S(),children:n.jsx(fe,{name:"ArrowLeft",size:14})}),n.jsx("span",{className:"templates-bar-title",children:w?w.name:"Templates"}),w&&n.jsx("button",{ref:f,type:"button",className:"btn-primary templates-bar-use","data-testid":"template-use-btn",onClick:()=>d(w),children:"Use template"})]}),n.jsx("div",{className:"templates-scroll",children:n.jsx("div",{className:"templates-measure",children:w?n.jsx(Fy,{template:w,getTemplate:L}):n.jsxs(n.Fragment,{children:[n.jsxs("header",{className:"templates-hero",children:[n.jsx("h2",{className:"templates-hero-title",children:"Start from a template"}),n.jsx("p",{className:"templates-hero-copy",children:A?"Loading the catalog…":`${l.length} runnable agent workflows. Open one to read what it does, then use it. A session starts in a new folder and sets it up for you.`})]}),k&&n.jsxs("div",{className:"templates-degraded","data-testid":"templates-degraded",role:"status",children:[n.jsx(fe,{name:"TriangleAlert",size:14}),n.jsx("span",{children:k})]}),n.jsxs("div",{className:"templates-layout",children:[n.jsx(Yy,{catalog:l,filter:u,onChange:v}),n.jsxs("div",{className:"templates-results",children:[o.length>0&&n.jsx("div",{className:"templates-grid","data-testid":"templates-grid",children:o.map(R=>n.jsx(np,{template:R,onOpen:x,onUse:d},R.id))}),o.length===0&&!A&&l.length>0&&n.jsx(Ts,{className:"templates-empty",testId:"templates-empty",icon:"Search",title:"No template matches these filters",body:`Search a tag or a capability, or clear the filters to see all ${l.length}.`,cta:By(u)?n.jsx("button",{type:"button",className:"btn-line","data-testid":"templates-empty-clear",onClick:()=>v(tp),children:"Clear filters"}):void 0}),y.length>0&&n.jsxs("section",{className:"templates-starters","data-testid":"templates-starters",children:[n.jsx("span",{className:"facet-title",children:"Bundled starters"}),n.jsx("p",{className:"templates-starters-copy",children:"Shipped with the CLI. These scaffold with no account and no network."}),n.jsx("div",{className:"templates-grid",children:y.map(R=>n.jsx(np,{template:R,onOpen:x,onUse:d},R.id))})]})]})]})]})})}),b&&n.jsx(Xy,{template:b,initialDest:Oy(b,a),recentDirs:_,listDir:E,onCancel:()=>d(null),triggerRef:f,onConfirm:async R=>{await N(R,b),S()}})]})}var Sc={exports:{}},rp;function Vy(){return rp||(rp=1,(function(a,_){(function(E,S){a.exports=S()})(globalThis,(()=>(()=>{var E={4567:function(L,h,p){var m=this&&this.__decorate||function(l,o,y,A){var k,R=arguments.length,C=R<3?o:A===null?A=Object.getOwnPropertyDescriptor(o,y):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(l,o,y,A);else for(var T=l.length-1;T>=0;T--)(k=l[T])&&(C=(R<3?k(C):R>3?k(o,y,C):k(o,y))||C);return R>3&&C&&Object.defineProperty(o,y,C),C},g=this&&this.__param||function(l,o){return function(y,A){o(y,A,l)}};Object.defineProperty(h,"__esModule",{value:!0}),h.AccessibilityManager=void 0;const u=p(9042),v=p(9924),w=p(844),x=p(4725),b=p(2585),d=p(3656);let f=h.AccessibilityManager=class extends w.Disposable{constructor(l,o,y,A){super(),this._terminal=l,this._coreBrowserService=y,this._renderService=A,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let k=0;k<this._terminal.rows;k++)this._rowElements[k]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[k]);if(this._topBoundaryFocusListener=k=>this._handleBoundaryFocus(k,0),this._bottomBoundaryFocusListener=k=>this._handleBoundaryFocus(k,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((k=>this._handleResize(k.rows)))),this.register(this._terminal.onRender((k=>this._refreshRows(k.start,k.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((k=>this._handleChar(k)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
436
+ `)))),this.register(this._terminal.onA11yTab((k=>this._handleTab(k)))),this.register(this._terminal.onKey((k=>this._handleKey(k.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,d.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,w.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(l){for(let o=0;o<l;o++)this._handleChar(" ")}_handleChar(l){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==l&&(this._charsToAnnounce+=l):this._charsToAnnounce+=l,l===`
437
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(l){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(l)||this._charsToConsume.push(l)}_refreshRows(l,o){this._liveRegionDebouncer.refresh(l,o,this._terminal.rows)}_renderRows(l,o){const y=this._terminal.buffer,A=y.lines.length.toString();for(let k=l;k<=o;k++){const R=y.lines.get(y.ydisp+k),C=[],T=(R==null?void 0:R.translateToString(!0,void 0,void 0,C))||"",H=(y.ydisp+k+1).toString(),I=this._rowElements[k];I&&(T.length===0?(I.innerText=" ",this._rowColumns.set(I,[0,1])):(I.textContent=T,this._rowColumns.set(I,C)),I.setAttribute("aria-posinset",H),I.setAttribute("aria-setsize",A))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(l,o){const y=l.target,A=this._rowElements[o===0?1:this._rowElements.length-2];if(y.getAttribute("aria-posinset")===(o===0?"1":`${this._terminal.buffer.lines.length}`)||l.relatedTarget!==A)return;let k,R;if(o===0?(k=y,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(k=this._rowElements.shift(),R=y,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),o===0){const C=this._createAccessibilityTreeNode();this._rowElements.unshift(C),this._rowContainer.insertAdjacentElement("afterbegin",C)}else{const C=this._createAccessibilityTreeNode();this._rowElements.push(C),this._rowContainer.appendChild(C)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(o===0?-1:1),this._rowElements[o===0?1:this._rowElements.length-2].focus(),l.preventDefault(),l.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const l=document.getSelection();if(!l)return;if(l.isCollapsed)return void(this._rowContainer.contains(l.anchorNode)&&this._terminal.clearSelection());if(!l.anchorNode||!l.focusNode)return void console.error("anchorNode and/or focusNode are null");let o={node:l.anchorNode,offset:l.anchorOffset},y={node:l.focusNode,offset:l.focusOffset};if((o.node.compareDocumentPosition(y.node)&Node.DOCUMENT_POSITION_PRECEDING||o.node===y.node&&o.offset>y.offset)&&([o,y]=[y,o]),o.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(o={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(o.node))return;const A=this._rowElements.slice(-1)[0];if(y.node.compareDocumentPosition(A)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(y={node:A,offset:((T=A.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(y.node))return;const k=({node:H,offset:I})=>{const W=H instanceof Text?H.parentNode:H;let P=parseInt(W==null?void 0:W.getAttribute("aria-posinset"),10)-1;if(isNaN(P))return console.warn("row is invalid. Race condition?"),null;const Z=this._rowColumns.get(W);if(!Z)return console.warn("columns is null. Race condition?"),null;let te=I<Z.length?Z[I]:Z.slice(-1)[0]+1;return te>=this._terminal.cols&&(++P,te=0),{row:P,column:te}},R=k(o),C=k(y);if(R&&C){if(R.row>C.row||R.row===C.row&&R.column>=C.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(C.row-R.row)*this._terminal.cols-R.column+C.column)}}_handleResize(l){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let o=this._rowContainer.children.length;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);for(;this._rowElements.length>l;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const l=this._coreBrowserService.mainDocument.createElement("div");return l.setAttribute("role","listitem"),l.tabIndex=-1,this._refreshRowDimensions(l),l}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let l=0;l<this._terminal.rows;l++)this._refreshRowDimensions(this._rowElements[l])}}_refreshRowDimensions(l){l.style.height=`${this._renderService.dimensions.css.cell.height}px`}};h.AccessibilityManager=f=m([g(1,b.IInstantiationService),g(2,x.ICoreBrowserService),g(3,x.IRenderService)],f)},3614:(L,h)=>{function p(v){return v.replace(/\r?\n/g,"\r")}function m(v,w){return w?"\x1B[200~"+v+"\x1B[201~":v}function g(v,w,x,b){v=m(v=p(v),x.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(v,!0),w.value=""}function u(v,w,x){const b=x.getBoundingClientRect(),d=v.clientX-b.left-10,f=v.clientY-b.top-10;w.style.width="20px",w.style.height="20px",w.style.left=`${d}px`,w.style.top=`${f}px`,w.style.zIndex="1000",w.focus()}Object.defineProperty(h,"__esModule",{value:!0}),h.rightClickHandler=h.moveTextAreaUnderMouseCursor=h.paste=h.handlePasteEvent=h.copyHandler=h.bracketTextForPaste=h.prepareTextForTerminal=void 0,h.prepareTextForTerminal=p,h.bracketTextForPaste=m,h.copyHandler=function(v,w){v.clipboardData&&v.clipboardData.setData("text/plain",w.selectionText),v.preventDefault()},h.handlePasteEvent=function(v,w,x,b){v.stopPropagation(),v.clipboardData&&g(v.clipboardData.getData("text/plain"),w,x,b)},h.paste=g,h.moveTextAreaUnderMouseCursor=u,h.rightClickHandler=function(v,w,x,b,d){u(v,w,x),d&&b.rightClickSelect(v),w.value=b.selectionText,w.select()}},7239:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ColorContrastCache=void 0;const m=p(1505);h.ColorContrastCache=class{constructor(){this._color=new m.TwoKeyMap,this._css=new m.TwoKeyMap}setCss(g,u,v){this._css.set(g,u,v)}getCss(g,u){return this._css.get(g,u)}setColor(g,u,v){this._color.set(g,u,v)}getColor(g,u){return this._color.get(g,u)}clear(){this._color.clear(),this._css.clear()}}},3656:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.addDisposableDomListener=void 0,h.addDisposableDomListener=function(p,m,g,u){p.addEventListener(m,g,u);let v=!1;return{dispose:()=>{v||(v=!0,p.removeEventListener(m,g,u))}}}},3551:function(L,h,p){var m=this&&this.__decorate||function(f,l,o,y){var A,k=arguments.length,R=k<3?l:y===null?y=Object.getOwnPropertyDescriptor(l,o):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(f,l,o,y);else for(var C=f.length-1;C>=0;C--)(A=f[C])&&(R=(k<3?A(R):k>3?A(l,o,R):A(l,o))||R);return k>3&&R&&Object.defineProperty(l,o,R),R},g=this&&this.__param||function(f,l){return function(o,y){l(o,y,f)}};Object.defineProperty(h,"__esModule",{value:!0}),h.Linkifier=void 0;const u=p(3656),v=p(8460),w=p(844),x=p(2585),b=p(4725);let d=h.Linkifier=class extends w.Disposable{get currentLink(){return this._currentLink}constructor(f,l,o,y,A){super(),this._element=f,this._mouseService=l,this._renderService=o,this._bufferService=y,this._linkProviderService=A,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,w.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,w.toDisposable)((()=>{var k;this._lastMouseEvent=void 0,(k=this._activeProviderReplies)==null||k.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,u.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,u.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,u.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(f){this._lastMouseEvent=f;const l=this._positionFromMouseEvent(f,this._element,this._mouseService);if(!l)return;this._isMouseOut=!1;const o=f.composedPath();for(let y=0;y<o.length;y++){const A=o[y];if(A.classList.contains("xterm"))break;if(A.classList.contains("xterm-hover"))return}this._lastBufferCell&&l.x===this._lastBufferCell.x&&l.y===this._lastBufferCell.y||(this._handleHover(l),this._lastBufferCell=l)}_handleHover(f){if(this._activeLine!==f.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(f,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,f)||(this._clearCurrentLink(),this._askForLink(f,!0))}_askForLink(f,l){var y,A;this._activeProviderReplies&&l||((y=this._activeProviderReplies)==null||y.forEach((k=>{k==null||k.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=f.y);let o=!1;for(const[k,R]of this._linkProviderService.linkProviders.entries())l?(A=this._activeProviderReplies)!=null&&A.get(k)&&(o=this._checkLinkProviderResult(k,f,o)):R.provideLinks(f.y,(C=>{var H,I;if(this._isMouseOut)return;const T=C==null?void 0:C.map((W=>({link:W})));(H=this._activeProviderReplies)==null||H.set(k,T),o=this._checkLinkProviderResult(k,f,o),((I=this._activeProviderReplies)==null?void 0:I.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(f.y,this._activeProviderReplies)}))}_removeIntersectingLinks(f,l){const o=new Set;for(let y=0;y<l.size;y++){const A=l.get(y);if(A)for(let k=0;k<A.length;k++){const R=A[k],C=R.link.range.start.y<f?0:R.link.range.start.x,T=R.link.range.end.y>f?this._bufferService.cols:R.link.range.end.x;for(let H=C;H<=T;H++){if(o.has(H)){A.splice(k--,1);break}o.add(H)}}}}_checkLinkProviderResult(f,l,o){var k;if(!this._activeProviderReplies)return o;const y=this._activeProviderReplies.get(f);let A=!1;for(let R=0;R<f;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(A=!0);if(!A&&y){const R=y.find((C=>this._linkAtPosition(C.link,l)));R&&(o=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!o)for(let R=0;R<this._activeProviderReplies.size;R++){const C=(k=this._activeProviderReplies.get(R))==null?void 0:k.find((T=>this._linkAtPosition(T.link,l)));if(C){o=!0,this._handleNewLink(C);break}}return o}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(f){if(!this._currentLink)return;const l=this._positionFromMouseEvent(f,this._element,this._mouseService);l&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,l)&&this._currentLink.link.activate(f,this._currentLink.link.text)}_clearCurrentLink(f,l){this._currentLink&&this._lastMouseEvent&&(!f||!l||this._currentLink.link.range.start.y>=f&&this._currentLink.link.range.end.y<=l)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,w.disposeArray)(this._linkCacheDisposables))}_handleNewLink(f){if(!this._lastMouseEvent)return;const l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._linkAtPosition(f.link,l)&&(this._currentLink=f,this._currentLink.state={decorations:{underline:f.link.decorations===void 0||f.link.decorations.underline,pointerCursor:f.link.decorations===void 0||f.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,f.link,this._lastMouseEvent),f.link.decorations={},Object.defineProperties(f.link.decorations,{pointerCursor:{get:()=>{var o,y;return(y=(o=this._currentLink)==null?void 0:o.state)==null?void 0:y.decorations.pointerCursor},set:o=>{var y;(y=this._currentLink)!=null&&y.state&&this._currentLink.state.decorations.pointerCursor!==o&&(this._currentLink.state.decorations.pointerCursor=o,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",o))}},underline:{get:()=>{var o,y;return(y=(o=this._currentLink)==null?void 0:o.state)==null?void 0:y.decorations.underline},set:o=>{var y,A,k;(y=this._currentLink)!=null&&y.state&&((k=(A=this._currentLink)==null?void 0:A.state)==null?void 0:k.decorations.underline)!==o&&(this._currentLink.state.decorations.underline=o,this._currentLink.state.isHovered&&this._fireUnderlineEvent(f.link,o))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((o=>{if(!this._currentLink)return;const y=o.start===0?0:o.start+1+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.ydisp+1+o.end;if(this._currentLink.link.range.start.y>=y&&this._currentLink.link.range.end.y<=A&&(this._clearCurrentLink(y,A),this._lastMouseEvent)){const k=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);k&&this._askForLink(k,!1)}}))))}_linkHover(f,l,o){var y;(y=this._currentLink)!=null&&y.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!0),this._currentLink.state.decorations.pointerCursor&&f.classList.add("xterm-cursor-pointer")),l.hover&&l.hover(o,l.text)}_fireUnderlineEvent(f,l){const o=f.range,y=this._bufferService.buffer.ydisp,A=this._createLinkUnderlineEvent(o.start.x-1,o.start.y-y-1,o.end.x,o.end.y-y-1,void 0);(l?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(A)}_linkLeave(f,l,o){var y;(y=this._currentLink)!=null&&y.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(l,!1),this._currentLink.state.decorations.pointerCursor&&f.classList.remove("xterm-cursor-pointer")),l.leave&&l.leave(o,l.text)}_linkAtPosition(f,l){const o=f.range.start.y*this._bufferService.cols+f.range.start.x,y=f.range.end.y*this._bufferService.cols+f.range.end.x,A=l.y*this._bufferService.cols+l.x;return o<=A&&A<=y}_positionFromMouseEvent(f,l,o){const y=o.getCoords(f,l,this._bufferService.cols,this._bufferService.rows);if(y)return{x:y[0],y:y[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(f,l,o,y,A){return{x1:f,y1:l,x2:o,y2:y,cols:this._bufferService.cols,fg:A}}};h.Linkifier=d=m([g(1,b.IMouseService),g(2,b.IRenderService),g(3,x.IBufferService),g(4,b.ILinkProviderService)],d)},9042:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.tooMuchOutput=h.promptLabel=void 0,h.promptLabel="Terminal input",h.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(L,h,p){var m=this&&this.__decorate||function(b,d,f,l){var o,y=arguments.length,A=y<3?d:l===null?l=Object.getOwnPropertyDescriptor(d,f):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,d,f,l);else for(var k=b.length-1;k>=0;k--)(o=b[k])&&(A=(y<3?o(A):y>3?o(d,f,A):o(d,f))||A);return y>3&&A&&Object.defineProperty(d,f,A),A},g=this&&this.__param||function(b,d){return function(f,l){d(f,l,b)}};Object.defineProperty(h,"__esModule",{value:!0}),h.OscLinkProvider=void 0;const u=p(511),v=p(2585);let w=h.OscLinkProvider=class{constructor(b,d,f){this._bufferService=b,this._optionsService=d,this._oscLinkService=f}provideLinks(b,d){var T;const f=this._bufferService.buffer.lines.get(b-1);if(!f)return void d(void 0);const l=[],o=this._optionsService.rawOptions.linkHandler,y=new u.CellData,A=f.getTrimmedLength();let k=-1,R=-1,C=!1;for(let H=0;H<A;H++)if(R!==-1||f.hasContent(H)){if(f.loadCell(H,y),y.hasExtendedAttrs()&&y.extended.urlId){if(R===-1){R=H,k=y.extended.urlId;continue}C=y.extended.urlId!==k}else R!==-1&&(C=!0);if(C||R!==-1&&H===A-1){const I=(T=this._oscLinkService.getLinkData(k))==null?void 0:T.uri;if(I){const W={start:{x:R+1,y:b},end:{x:H+(C||H!==A-1?0:1),y:b}};let P=!1;if(!(o!=null&&o.allowNonHttpProtocols))try{const Z=new URL(I);["http:","https:"].includes(Z.protocol)||(P=!0)}catch{P=!0}P||l.push({text:I,range:W,activate:(Z,te)=>o?o.activate(Z,te,W):x(0,te),hover:(Z,te)=>{var F;return(F=o==null?void 0:o.hover)==null?void 0:F.call(o,Z,te,W)},leave:(Z,te)=>{var F;return(F=o==null?void 0:o.leave)==null?void 0:F.call(o,Z,te,W)}})}C=!1,y.hasExtendedAttrs()&&y.extended.urlId?(R=H,k=y.extended.urlId):(R=-1,k=-1)}}d(l)}};function x(b,d){if(confirm(`Do you want to navigate to ${d}?
438
+
439
+ WARNING: This link could potentially be dangerous`)){const f=window.open();if(f){try{f.opener=null}catch{}f.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}}h.OscLinkProvider=w=m([g(0,v.IBufferService),g(1,v.IOptionsService),g(2,v.IOscLinkService)],w)},6193:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.RenderDebouncer=void 0,h.RenderDebouncer=class{constructor(p,m){this._renderCallback=p,this._coreBrowserService=m,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(p){return this._refreshCallbacks.push(p),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(p,m,g){this._rowCount=g,p=p!==void 0?p:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,p):p,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const p=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(p,m),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const p of this._refreshCallbacks)p(0);this._refreshCallbacks=[]}}},3236:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Terminal=void 0;const m=p(3614),g=p(3656),u=p(3551),v=p(9042),w=p(3730),x=p(1680),b=p(3107),d=p(5744),f=p(2950),l=p(1296),o=p(428),y=p(4269),A=p(5114),k=p(8934),R=p(3230),C=p(9312),T=p(4725),H=p(6731),I=p(8055),W=p(8969),P=p(8460),Z=p(844),te=p(6114),F=p(8437),Y=p(2584),V=p(7399),M=p(5941),$=p(9074),D=p(2585),z=p(5435),Q=p(4567),ne=p(779);class ve extends W.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(X={}){super(X),this.browser=te,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Z.MutableDisposable),this._onCursorMove=this.register(new P.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new P.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new P.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new P.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new P.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new P.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new P.EventEmitter),this._onBlur=this.register(new P.EventEmitter),this._onA11yCharEmitter=this.register(new P.EventEmitter),this._onA11yTabEmitter=this.register(new P.EventEmitter),this._onWillOpen=this.register(new P.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance($.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(T.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(w.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((O,ee)=>this.refresh(O,ee)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((O=>this._reportWindowsOptions(O)))),this.register(this._inputHandler.onColor((O=>this._handleColorEvent(O)))),this.register((0,P.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,P.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,P.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((O=>this._afterResize(O.cols,O.rows)))),this.register((0,Z.toDisposable)((()=>{var O,ee;this._customKeyEventHandler=void 0,(ee=(O=this.element)==null?void 0:O.parentNode)==null||ee.removeChild(this.element)})))}_handleColorEvent(X){if(this._themeService)for(const O of X){let ee,oe="";switch(O.index){case 256:ee="foreground",oe="10";break;case 257:ee="background",oe="11";break;case 258:ee="cursor",oe="12";break;default:ee="ansi",oe="4;"+O.index}switch(O.type){case 0:const Se=I.color.toColorRGB(ee==="ansi"?this._themeService.colors.ansi[O.index]:this._themeService.colors[ee]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${oe};${(0,M.toRgbString)(Se)}${Y.C1_ESCAPED.ST}`);break;case 1:if(ee==="ansi")this._themeService.modifyColors((ge=>ge.ansi[O.index]=I.channels.toColor(...O.color)));else{const ge=ee;this._themeService.modifyColors((Oe=>Oe[ge]=I.channels.toColor(...O.color)))}break;case 2:this._themeService.restoreColor(O.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(X){X?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Q.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(X){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var X;return(X=this.textarea)==null?void 0:X.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const X=this.buffer.ybase+this.buffer.y,O=this.buffer.lines.get(X);if(!O)return;const ee=Math.min(this.buffer.x,this.cols-1),oe=this._renderService.dimensions.css.cell.height,Se=O.getWidth(ee),ge=this._renderService.dimensions.css.cell.width*Se,Oe=this.buffer.y*this._renderService.dimensions.css.cell.height,Me=ee*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Me+"px",this.textarea.style.top=Oe+"px",this.textarea.style.width=ge+"px",this.textarea.style.height=oe+"px",this.textarea.style.lineHeight=oe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",(O=>{this.hasSelection()&&(0,m.copyHandler)(O,this._selectionService)})));const X=O=>(0,m.handlePasteEvent)(O,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",X)),this.register((0,g.addDisposableDomListener)(this.element,"paste",X)),te.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(O=>{O.button===2&&(0,m.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",(O=>{(0,m.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),te.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",(O=>{O.button===1&&(0,m.moveTextAreaUnderMouseCursor)(O,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(X=>this._keyUp(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(X=>this._keyDown(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(X=>this._keyPress(X)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(X=>this._compositionHelper.compositionupdate(X)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(X=>this._inputEvent(X)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(X){var ee;if(!X)throw new Error("Terminal requires a parent element.");if(X.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ee=this.element)==null?void 0:ee.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=X.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),X.appendChild(this.element);const O=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),O.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",(oe=>this.updateCursorStyle(oe)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),O.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),te.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(A.CoreBrowserService,this.textarea,X.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(T.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(oe=>this._handleTextAreaFocus(oe)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(o.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(T.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(H.ThemeService),this._instantiationService.setService(T.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(y.CharacterJoinerService),this._instantiationService.setService(T.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(T.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((oe=>this._onRender.fire(oe)))),this.onResize((oe=>this._renderService.resize(oe.cols,oe.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(k.MouseService),this._instantiationService.setService(T.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(u.Linkifier,this.screenElement)),this.element.appendChild(O);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(x.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(C.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(T.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((oe=>this._renderService.handleSelectionChanged(oe.start,oe.end,oe.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((oe=>{this.textarea.value=oe,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((oe=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(b.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(oe=>this._selectionService.handleMouseDown(oe)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Q.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(oe=>this._handleScreenReaderModeOptionChange(oe)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(d.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(oe=>{!this._overviewRulerRenderer&&oe&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(d.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(l.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const X=this,O=this.element;function ee(ge){const Oe=X._mouseService.getMouseReportCoords(ge,X.screenElement);if(!Oe)return!1;let Me,Pe;switch(ge.overrideType||ge.type){case"mousemove":Pe=32,ge.buttons===void 0?(Me=3,ge.button!==void 0&&(Me=ge.button<3?ge.button:3)):Me=1&ge.buttons?0:4&ge.buttons?1:2&ge.buttons?2:3;break;case"mouseup":Pe=0,Me=ge.button<3?ge.button:3;break;case"mousedown":Pe=1,Me=ge.button<3?ge.button:3;break;case"wheel":if(X._customWheelEventHandler&&X._customWheelEventHandler(ge)===!1||X.viewport.getLinesScrolled(ge)===0)return!1;Pe=ge.deltaY<0?0:1,Me=4;break;default:return!1}return!(Pe===void 0||Me===void 0||Me>4)&&X.coreMouseService.triggerMouseEvent({col:Oe.col,row:Oe.row,x:Oe.x,y:Oe.y,button:Me,action:Pe,ctrl:ge.ctrlKey,alt:ge.altKey,shift:ge.shiftKey})}const oe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Se={mouseup:ge=>(ee(ge),ge.buttons||(this._document.removeEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.removeEventListener("mousemove",oe.mousedrag)),this.cancel(ge)),wheel:ge=>(ee(ge),this.cancel(ge,!0)),mousedrag:ge=>{ge.buttons&&ee(ge)},mousemove:ge=>{ge.buttons||ee(ge)}};this.register(this.coreMouseService.onProtocolChange((ge=>{ge?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ge)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ge?oe.mousemove||(O.addEventListener("mousemove",Se.mousemove),oe.mousemove=Se.mousemove):(O.removeEventListener("mousemove",oe.mousemove),oe.mousemove=null),16&ge?oe.wheel||(O.addEventListener("wheel",Se.wheel,{passive:!1}),oe.wheel=Se.wheel):(O.removeEventListener("wheel",oe.wheel),oe.wheel=null),2&ge?oe.mouseup||(oe.mouseup=Se.mouseup):(this._document.removeEventListener("mouseup",oe.mouseup),oe.mouseup=null),4&ge?oe.mousedrag||(oe.mousedrag=Se.mousedrag):(this._document.removeEventListener("mousemove",oe.mousedrag),oe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(O,"mousedown",(ge=>{if(ge.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ge))return ee(ge),oe.mouseup&&this._document.addEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.addEventListener("mousemove",oe.mousedrag),this.cancel(ge)}))),this.register((0,g.addDisposableDomListener)(O,"wheel",(ge=>{if(!oe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ge)===!1)return!1;if(!this.buffer.hasScrollback){const Oe=this.viewport.getLinesScrolled(ge);if(Oe===0)return;const Me=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ge.deltaY<0?"A":"B");let Pe="";for(let Ke=0;Ke<Math.abs(Oe);Ke++)Pe+=Me;return this.coreService.triggerDataEvent(Pe,!0),this.cancel(ge,!0)}return this.viewport.handleWheel(ge)?this.cancel(ge):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)(O,"touchstart",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ge),this.cancel(ge)}),{passive:!0})),this.register((0,g.addDisposableDomListener)(O,"touchmove",(ge=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ge)?void 0:this.cancel(ge)}),{passive:!1}))}refresh(X,O){var ee;(ee=this._renderService)==null||ee.refreshRows(X,O)}updateCursorStyle(X){var O;(O=this._selectionService)!=null&&O.shouldColumnSelect(X)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(X,O,ee=0){var oe;ee===1?(super.scrollLines(X,O,ee),this.refresh(0,this.rows-1)):(oe=this.viewport)==null||oe.scrollLines(X)}paste(X){(0,m.paste)(X,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(X){this._customKeyEventHandler=X}attachCustomWheelEventHandler(X){this._customWheelEventHandler=X}registerLinkProvider(X){return this._linkProviderService.registerLinkProvider(X)}registerCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const O=this._characterJoinerService.register(X);return this.refresh(0,this.rows-1),O}deregisterCharacterJoiner(X){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(X)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(X){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+X)}registerDecoration(X){return this._decorationService.registerDecoration(X)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(X,O,ee){this._selectionService.setSelection(X,O,ee)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var X;(X=this._selectionService)==null||X.clearSelection()}selectAll(){var X;(X=this._selectionService)==null||X.selectAll()}selectLines(X,O){var ee;(ee=this._selectionService)==null||ee.selectLines(X,O)}_keyDown(X){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;const O=this.browser.isMac&&this.options.macOptionIsMeta&&X.altKey;if(!O&&!this._compositionHelper.keydown(X))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;O||X.key!=="Dead"&&X.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ee=(0,V.evaluateKeyboardEvent)(X,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(X),ee.type===3||ee.type===2){const oe=this.rows-1;return this.scrollLines(ee.type===2?-oe:oe),this.cancel(X,!0)}return ee.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,X)||(ee.cancel&&this.cancel(X,!0),!ee.key||!!(X.key&&!X.ctrlKey&&!X.altKey&&!X.metaKey&&X.key.length===1&&X.key.charCodeAt(0)>=65&&X.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ee.key!==Y.C0.ETX&&ee.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ee.key,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(ee.key,!0),!this.optionsService.rawOptions.screenReaderMode||X.altKey||X.ctrlKey?this.cancel(X,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(X,O){const ee=X.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||X.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey||X.isWindows&&O.getModifierState("AltGraph");return O.type==="keypress"?ee:ee&&(!O.keyCode||O.keyCode>47)}_keyUp(X){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1||((function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18})(X)||this.focus(),this.updateCursorStyle(X),this._keyPressHandled=!1)}_keyPress(X){let O;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(X)===!1)return!1;if(this.cancel(X),X.charCode)O=X.charCode;else if(X.which===null||X.which===void 0)O=X.keyCode;else{if(X.which===0||X.charCode===0)return!1;O=X.which}return!(!O||(X.altKey||X.ctrlKey||X.metaKey)&&!this._isThirdLevelShift(this.browser,X)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:X}),this._showCursor(),this.coreService.triggerDataEvent(O,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(X){if(X.data&&X.inputType==="insertText"&&(!X.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const O=X.data;return this.coreService.triggerDataEvent(O,!0),this.cancel(X),!0}return!1}resize(X,O){X!==this.cols||O!==this.rows?super.resize(X,O):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(X,O){var ee,oe;(ee=this._charSizeService)==null||ee.measure(),(oe=this.viewport)==null||oe.syncScrollArea(!0)}clear(){var X;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let O=1;O<this.rows;O++)this.buffer.lines.push(this.buffer.getBlankLine(F.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(X=this.viewport)==null||X.reset(),this.refresh(0,this.rows-1)}}reset(){var O,ee;this.options.rows=this.rows,this.options.cols=this.cols;const X=this._customKeyEventHandler;this._setup(),super.reset(),(O=this._selectionService)==null||O.reset(),this._decorationService.reset(),(ee=this.viewport)==null||ee.reset(),this._customKeyEventHandler=X,this.refresh(0,this.rows-1)}clearTextureAtlas(){var X;(X=this._renderService)==null||X.clearTextureAtlas()}_reportFocus(){var X;(X=this.element)!=null&&X.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(X){if(this._renderService)switch(X){case z.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const O=this._renderService.dimensions.css.canvas.width.toFixed(0),ee=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${ee};${O}t`);break;case z.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const oe=this._renderService.dimensions.css.cell.width.toFixed(0),Se=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[6;${Se};${oe}t`)}}cancel(X,O){if(this.options.cancelEvents||O)return X.preventDefault(),X.stopPropagation(),!1}}h.Terminal=ve},9924:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.TimeBasedDebouncer=void 0,h.TimeBasedDebouncer=class{constructor(p,m=1e3){this._renderCallback=p,this._debounceThresholdMS=m,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(p,m,g){this._rowCount=g,p=p!==void 0?p:0,m=m!==void 0?m:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,p):p,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,m):m;const u=Date.now();if(u-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=u,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=u-this._lastRefreshMs,w=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),w)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const p=Math.max(this._rowStart,0),m=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(p,m)}}},1680:function(L,h,p){var m=this&&this.__decorate||function(f,l,o,y){var A,k=arguments.length,R=k<3?l:y===null?y=Object.getOwnPropertyDescriptor(l,o):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(f,l,o,y);else for(var C=f.length-1;C>=0;C--)(A=f[C])&&(R=(k<3?A(R):k>3?A(l,o,R):A(l,o))||R);return k>3&&R&&Object.defineProperty(l,o,R),R},g=this&&this.__param||function(f,l){return function(o,y){l(o,y,f)}};Object.defineProperty(h,"__esModule",{value:!0}),h.Viewport=void 0;const u=p(3656),v=p(4725),w=p(8460),x=p(844),b=p(2585);let d=h.Viewport=class extends x.Disposable{constructor(f,l,o,y,A,k,R,C){super(),this._viewportElement=f,this._scrollArea=l,this._bufferService=o,this._optionsService=y,this._charSizeService=A,this._renderService=k,this._coreBrowserService=R,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,u.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((T=>this._activeBuffer=T.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((T=>this._renderDimensions=T))),this._handleThemeChange(C.colors),this.register(C.onChangeColors((T=>this._handleThemeChange(T)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(f){this._viewportElement.style.backgroundColor=f.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(f){if(f)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const l=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==l&&(this._lastRecordedBufferHeight=l,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const f=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==f&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=f),this._refreshAnimationFrame=null}syncScrollArea(f=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(f);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(f)}_handleScroll(f){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const l=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:l,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const f=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(f*(this._smoothScrollState.target-this._smoothScrollState.origin)),f<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(f,l){const o=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(l<0&&this._viewportElement.scrollTop!==0||l>0&&o<this._lastRecordedBufferHeight)||(f.cancelable&&f.preventDefault(),!1)}handleWheel(f){const l=this._getPixelsScrolled(f);return l!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+l:this._smoothScrollState.target+=l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=l,this._bubbleScroll(f,l))}scrollLines(f){if(f!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const l=f*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+l,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:f,suppressScrollEvent:!1})}_getPixelsScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let l=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_LINE?l*=this._currentRowHeight:f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._currentRowHeight*this._bufferService.rows),l}getBufferElements(f,l){var C;let o,y="";const A=[],k=l??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let T=f;T<k;T++){const H=R.get(T);if(!H)continue;const I=(C=R.get(T+1))==null?void 0:C.isWrapped;if(y+=H.translateToString(!I),!I||T===R.length-1){const W=document.createElement("div");W.textContent=y,A.push(W),y.length>0&&(o=W),y=""}}return{bufferElements:A,cursorElement:o}}getLinesScrolled(f){if(f.deltaY===0||f.shiftKey)return 0;let l=this._applyScrollModifier(f.deltaY,f);return f.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=this._currentRowHeight+0,this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):f.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_applyScrollModifier(f,l){const o=this._optionsService.rawOptions.fastScrollModifier;return o==="alt"&&l.altKey||o==="ctrl"&&l.ctrlKey||o==="shift"&&l.shiftKey?f*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:f*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(f){this._lastTouchY=f.touches[0].pageY}handleTouchMove(f){const l=this._lastTouchY-f.touches[0].pageY;return this._lastTouchY=f.touches[0].pageY,l!==0&&(this._viewportElement.scrollTop+=l,this._bubbleScroll(f,l))}};h.Viewport=d=m([g(2,b.IBufferService),g(3,b.IOptionsService),g(4,v.ICharSizeService),g(5,v.IRenderService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],d)},3107:function(L,h,p){var m=this&&this.__decorate||function(b,d,f,l){var o,y=arguments.length,A=y<3?d:l===null?l=Object.getOwnPropertyDescriptor(d,f):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,d,f,l);else for(var k=b.length-1;k>=0;k--)(o=b[k])&&(A=(y<3?o(A):y>3?o(d,f,A):o(d,f))||A);return y>3&&A&&Object.defineProperty(d,f,A),A},g=this&&this.__param||function(b,d){return function(f,l){d(f,l,b)}};Object.defineProperty(h,"__esModule",{value:!0}),h.BufferDecorationRenderer=void 0;const u=p(4725),v=p(844),w=p(2585);let x=h.BufferDecorationRenderer=class extends v.Disposable{constructor(b,d,f,l,o){super(),this._screenElement=b,this._bufferService=d,this._coreBrowserService=f,this._decorationService=l,this._renderService=o,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((y=>this._removeDecoration(y)))),this.register((0,v.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const b of this._decorationService.decorations)this._renderDecoration(b);this._dimensionsChanged=!1}_renderDecoration(b){this._refreshStyle(b),this._dimensionsChanged&&this._refreshXPosition(b)}_createElement(b){var l;const d=this._coreBrowserService.mainDocument.createElement("div");d.classList.add("xterm-decoration"),d.classList.toggle("xterm-decoration-top-layer",((l=b==null?void 0:b.options)==null?void 0:l.layer)==="top"),d.style.width=`${Math.round((b.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,d.style.height=(b.options.height||1)*this._renderService.dimensions.css.cell.height+"px",d.style.top=(b.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",d.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const f=b.options.x??0;return f&&f>this._bufferService.cols&&(d.style.display="none"),this._refreshXPosition(b,d),d}_refreshStyle(b){const d=b.marker.line-this._bufferService.buffers.active.ydisp;if(d<0||d>=this._bufferService.rows)b.element&&(b.element.style.display="none",b.onRenderEmitter.fire(b.element));else{let f=this._decorationElements.get(b);f||(f=this._createElement(b),b.element=f,this._decorationElements.set(b,f),this._container.appendChild(f),b.onDispose((()=>{this._decorationElements.delete(b),f.remove()}))),f.style.top=d*this._renderService.dimensions.css.cell.height+"px",f.style.display=this._altBufferIsActive?"none":"block",b.onRenderEmitter.fire(f)}}_refreshXPosition(b,d=b.element){if(!d)return;const f=b.options.x??0;(b.options.anchor||"left")==="right"?d.style.right=f?f*this._renderService.dimensions.css.cell.width+"px":"":d.style.left=f?f*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(b){var d;(d=this._decorationElements.get(b))==null||d.remove(),this._decorationElements.delete(b),b.dispose()}};h.BufferDecorationRenderer=x=m([g(1,w.IBufferService),g(2,u.ICoreBrowserService),g(3,w.IDecorationService),g(4,u.IRenderService)],x)},5871:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ColorZoneStore=void 0,h.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(p){if(p.options.overviewRulerOptions){for(const m of this._zones)if(m.color===p.options.overviewRulerOptions.color&&m.position===p.options.overviewRulerOptions.position){if(this._lineIntersectsZone(m,p.marker.line))return;if(this._lineAdjacentToZone(m,p.marker.line,p.options.overviewRulerOptions.position))return void this._addLineToZone(m,p.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=p.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=p.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=p.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=p.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:p.options.overviewRulerOptions.color,position:p.options.overviewRulerOptions.position,startBufferLine:p.marker.line,endBufferLine:p.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(p){this._linePadding=p}_lineIntersectsZone(p,m){return m>=p.startBufferLine&&m<=p.endBufferLine}_lineAdjacentToZone(p,m,g){return m>=p.startBufferLine-this._linePadding[g||"full"]&&m<=p.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(p,m){p.startBufferLine=Math.min(p.startBufferLine,m),p.endBufferLine=Math.max(p.endBufferLine,m)}}},5744:function(L,h,p){var m=this&&this.__decorate||function(o,y,A,k){var R,C=arguments.length,T=C<3?y:k===null?k=Object.getOwnPropertyDescriptor(y,A):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(o,y,A,k);else for(var H=o.length-1;H>=0;H--)(R=o[H])&&(T=(C<3?R(T):C>3?R(y,A,T):R(y,A))||T);return C>3&&T&&Object.defineProperty(y,A,T),T},g=this&&this.__param||function(o,y){return function(A,k){y(A,k,o)}};Object.defineProperty(h,"__esModule",{value:!0}),h.OverviewRulerRenderer=void 0;const u=p(5871),v=p(4725),w=p(844),x=p(2585),b={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f={full:0,left:0,center:0,right:0};let l=h.OverviewRulerRenderer=class extends w.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(o,y,A,k,R,C,T){var I;super(),this._viewportElement=o,this._screenElement=y,this._bufferService=A,this._decorationService=k,this._renderService=R,this._optionsService=C,this._coreBrowserService=T,this._colorZoneStore=new u.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(I=this._viewportElement.parentElement)==null||I.insertBefore(this._canvas,this._viewportElement);const H=this._canvas.getContext("2d");if(!H)throw new Error("Ctx cannot be null");this._ctx=H,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,w.toDisposable)((()=>{var W;(W=this._canvas)==null||W.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const o=Math.floor(this._canvas.width/3),y=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=o,d.center=y,d.right=o,this._refreshDrawHeightConstants(),f.full=0,f.left=0,f.center=d.left,f.right=d.left+d.center}_refreshDrawHeightConstants(){b.full=Math.round(2*this._coreBrowserService.dpr);const o=this._canvas.height/this._bufferService.buffer.lines.length,y=Math.round(Math.max(Math.min(o,12),6)*this._coreBrowserService.dpr);b.left=y,b.center=y,b.right=y}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*b.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const y of this._decorationService.decorations)this._colorZoneStore.addDecoration(y);this._ctx.lineWidth=1;const o=this._colorZoneStore.zones;for(const y of o)y.position!=="full"&&this._renderColorZone(y);for(const y of o)y.position==="full"&&this._renderColorZone(y);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(o){this._ctx.fillStyle=o.color,this._ctx.fillRect(f[o.position||"full"],Math.round((this._canvas.height-1)*(o.startBufferLine/this._bufferService.buffers.active.lines.length)-b[o.position||"full"]/2),d[o.position||"full"],Math.round((this._canvas.height-1)*((o.endBufferLine-o.startBufferLine)/this._bufferService.buffers.active.lines.length)+b[o.position||"full"]))}_queueRefresh(o,y){this._shouldUpdateDimensions=o||this._shouldUpdateDimensions,this._shouldUpdateAnchor=y||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};h.OverviewRulerRenderer=l=m([g(2,x.IBufferService),g(3,x.IDecorationService),g(4,v.IRenderService),g(5,x.IOptionsService),g(6,v.ICoreBrowserService)],l)},2950:function(L,h,p){var m=this&&this.__decorate||function(b,d,f,l){var o,y=arguments.length,A=y<3?d:l===null?l=Object.getOwnPropertyDescriptor(d,f):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,d,f,l);else for(var k=b.length-1;k>=0;k--)(o=b[k])&&(A=(y<3?o(A):y>3?o(d,f,A):o(d,f))||A);return y>3&&A&&Object.defineProperty(d,f,A),A},g=this&&this.__param||function(b,d){return function(f,l){d(f,l,b)}};Object.defineProperty(h,"__esModule",{value:!0}),h.CompositionHelper=void 0;const u=p(4725),v=p(2585),w=p(2584);let x=h.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(b,d,f,l,o,y){this._textarea=b,this._compositionView=d,this._bufferService=f,this._optionsService=l,this._coreService=o,this._renderService=y,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(b){this._compositionView.textContent=b.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(b){if(this._isComposing||this._isSendingComposition){if(b.keyCode===229||b.keyCode===16||b.keyCode===17||b.keyCode===18)return!1;this._finalizeComposition(!1)}return b.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(b){if(this._compositionView.classList.remove("active"),this._isComposing=!1,b){const d={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let f;this._isSendingComposition=!1,d.start+=this._dataAlreadySent.length,f=this._isComposing?this._textarea.value.substring(d.start,d.end):this._textarea.value.substring(d.start),f.length>0&&this._coreService.triggerDataEvent(f,!0)}}),0)}else{this._isSendingComposition=!1;const d=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(d,!0)}}_handleAnyTextareaChanges(){const b=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const d=this._textarea.value,f=d.replace(b,"");this._dataAlreadySent=f,d.length>b.length?this._coreService.triggerDataEvent(f,!0):d.length<b.length?this._coreService.triggerDataEvent(`${w.C0.DEL}`,!0):d.length===b.length&&d!==b&&this._coreService.triggerDataEvent(d,!0)}}),0)}updateCompositionElements(b){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const d=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),f=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=d*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const y=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=l+"px",this._textarea.style.width=Math.max(y.width,1)+"px",this._textarea.style.height=Math.max(y.height,1)+"px",this._textarea.style.lineHeight=y.height+"px"}b||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};h.CompositionHelper=x=m([g(2,v.IBufferService),g(3,v.IOptionsService),g(4,v.ICoreService),g(5,u.IRenderService)],x)},9806:(L,h)=>{function p(m,g,u){const v=u.getBoundingClientRect(),w=m.getComputedStyle(u),x=parseInt(w.getPropertyValue("padding-left")),b=parseInt(w.getPropertyValue("padding-top"));return[g.clientX-v.left-x,g.clientY-v.top-b]}Object.defineProperty(h,"__esModule",{value:!0}),h.getCoords=h.getCoordsRelativeToElement=void 0,h.getCoordsRelativeToElement=p,h.getCoords=function(m,g,u,v,w,x,b,d,f){if(!x)return;const l=p(m,g,u);return l?(l[0]=Math.ceil((l[0]+(f?b/2:0))/b),l[1]=Math.ceil(l[1]/d),l[0]=Math.min(Math.max(l[0],1),v+(f?1:0)),l[1]=Math.min(Math.max(l[1],1),w),l):void 0}},9504:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.moveToCellSequence=void 0;const m=p(2584);function g(d,f,l,o){const y=d-u(d,l),A=f-u(f,l),k=Math.abs(y-A)-(function(R,C,T){let H=0;const I=R-u(R,T),W=C-u(C,T);for(let P=0;P<Math.abs(I-W);P++){const Z=v(R,C)==="A"?-1:1,te=T.buffer.lines.get(I+Z*P);te!=null&&te.isWrapped&&H++}return H})(d,f,l);return b(k,x(v(d,f),o))}function u(d,f){let l=0,o=f.buffer.lines.get(d),y=o==null?void 0:o.isWrapped;for(;y&&d>=0&&d<f.rows;)l++,o=f.buffer.lines.get(--d),y=o==null?void 0:o.isWrapped;return l}function v(d,f){return d>f?"A":"B"}function w(d,f,l,o,y,A){let k=d,R=f,C="";for(;k!==l||R!==o;)k+=y?1:-1,y&&k>A.cols-1?(C+=A.buffer.translateBufferLineToString(R,!1,d,k),k=0,d=0,R++):!y&&k<0&&(C+=A.buffer.translateBufferLineToString(R,!1,0,d+1),k=A.cols-1,d=k,R--);return C+A.buffer.translateBufferLineToString(R,!1,d,k)}function x(d,f){const l=f?"O":"[";return m.C0.ESC+l+d}function b(d,f){d=Math.floor(d);let l="";for(let o=0;o<d;o++)l+=f;return l}h.moveToCellSequence=function(d,f,l,o){const y=l.buffer.x,A=l.buffer.y;if(!l.buffer.hasScrollback)return(function(C,T,H,I,W,P){return g(T,I,W,P).length===0?"":b(w(C,T,C,T-u(T,W),!1,W).length,x("D",P))})(y,A,0,f,l,o)+g(A,f,l,o)+(function(C,T,H,I,W,P){let Z;Z=g(T,I,W,P).length>0?I-u(I,W):T;const te=I,F=(function(Y,V,M,$,D,z){let Q;return Q=g(M,$,D,z).length>0?$-u($,D):V,Y<M&&Q<=$||Y>=M&&Q<$?"C":"D"})(C,T,H,I,W,P);return b(w(C,Z,H,te,F==="C",W).length,x(F,P))})(y,A,d,f,l,o);let k;if(A===f)return k=y>d?"D":"C",b(Math.abs(y-d),x(k,o));k=A>f?"D":"C";const R=Math.abs(A-f);return b((function(C,T){return T.cols-C})(A>f?d:y,l)+(R-1)*l.cols+1+((A>f?y:d)-1),x(k,o))}},1296:function(L,h,p){var m=this&&this.__decorate||function(P,Z,te,F){var Y,V=arguments.length,M=V<3?Z:F===null?F=Object.getOwnPropertyDescriptor(Z,te):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(P,Z,te,F);else for(var $=P.length-1;$>=0;$--)(Y=P[$])&&(M=(V<3?Y(M):V>3?Y(Z,te,M):Y(Z,te))||M);return V>3&&M&&Object.defineProperty(Z,te,M),M},g=this&&this.__param||function(P,Z){return function(te,F){Z(te,F,P)}};Object.defineProperty(h,"__esModule",{value:!0}),h.DomRenderer=void 0;const u=p(3787),v=p(2550),w=p(2223),x=p(6171),b=p(6052),d=p(4725),f=p(8055),l=p(8460),o=p(844),y=p(2585),A="xterm-dom-renderer-owner-",k="xterm-rows",R="xterm-fg-",C="xterm-bg-",T="xterm-focus",H="xterm-selection";let I=1,W=h.DomRenderer=class extends o.Disposable{constructor(P,Z,te,F,Y,V,M,$,D,z,Q,ne,ve){super(),this._terminal=P,this._document=Z,this._element=te,this._screenElement=F,this._viewportElement=Y,this._helperContainer=V,this._linkifier2=M,this._charSizeService=D,this._optionsService=z,this._bufferService=Q,this._coreBrowserService=ne,this._themeService=ve,this._terminalClass=I++,this._rowElements=[],this._selectionRenderModel=(0,b.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new l.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(k),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(H),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,x.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((Ce=>this._injectCss(Ce)))),this._injectCss(this._themeService.colors),this._rowFactory=$.createInstance(u.DomRendererRowFactory,document),this._element.classList.add(A+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((Ce=>this._handleLinkHover(Ce)))),this.register(this._linkifier2.onHideLinkUnderline((Ce=>this._handleLinkLeave(Ce)))),this.register((0,o.toDisposable)((()=>{this._element.classList.remove(A+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new v.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const P=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*P,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*P),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/P),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/P),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const te of this._rowElements)te.style.width=`${this.dimensions.css.canvas.width}px`,te.style.height=`${this.dimensions.css.cell.height}px`,te.style.lineHeight=`${this.dimensions.css.cell.height}px`,te.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Z=`${this._terminalSelector} .${k} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Z,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(P){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Z=`${this._terminalSelector} .${k} { color: ${P.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Z+=`${this._terminalSelector} .${k} .xterm-dim { color: ${f.color.multiplyOpacity(P.foreground,.5).css};}`,Z+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const te=`blink_underline_${this._terminalClass}`,F=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;Z+=`@keyframes ${te} { 50% { border-bottom-style: hidden; }}`,Z+=`@keyframes ${F} { 50% { box-shadow: none; }}`,Z+=`@keyframes ${Y} { 0% { background-color: ${P.cursor.css}; color: ${P.cursorAccent.css}; } 50% { background-color: inherit; color: ${P.cursor.css}; }}`,Z+=`${this._terminalSelector} .${k}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${te} 1s step-end infinite;}${this._terminalSelector} .${k}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${k}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-block { background-color: ${P.cursor.css}; color: ${P.cursorAccent.css};}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${P.cursor.css} !important; color: ${P.cursorAccent.css} !important;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${P.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${P.cursor.css} inset;}${this._terminalSelector} .${k} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${P.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Z+=`${this._terminalSelector} .${H} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${H} div { position: absolute; background-color: ${P.selectionBackgroundOpaque.css};}${this._terminalSelector} .${H} div { position: absolute; background-color: ${P.selectionInactiveBackgroundOpaque.css};}`;for(const[V,M]of P.ansi.entries())Z+=`${this._terminalSelector} .${R}${V} { color: ${M.css}; }${this._terminalSelector} .${R}${V}.xterm-dim { color: ${f.color.multiplyOpacity(M,.5).css}; }${this._terminalSelector} .${C}${V} { background-color: ${M.css}; }`;Z+=`${this._terminalSelector} .${R}${w.INVERTED_DEFAULT_COLOR} { color: ${f.color.opaque(P.background).css}; }${this._terminalSelector} .${R}${w.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${f.color.multiplyOpacity(f.color.opaque(P.background),.5).css}; }${this._terminalSelector} .${C}${w.INVERTED_DEFAULT_COLOR} { background-color: ${P.foreground.css}; }`,this._themeStyleElement.textContent=Z}_setDefaultSpacing(){const P=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${P}px`,this._rowFactory.defaultSpacing=P}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(P,Z){for(let te=this._rowElements.length;te<=Z;te++){const F=this._document.createElement("div");this._rowContainer.appendChild(F),this._rowElements.push(F)}for(;this._rowElements.length>Z;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(P,Z){this._refreshRowElements(P,Z),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(T),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(T),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(P,Z,te){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(P,Z,te),this.renderRows(0,this._bufferService.rows-1),!P||!Z)return;this._selectionRenderModel.update(this._terminal,P,Z,te);const F=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,M=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||M<0)return;const $=this._document.createDocumentFragment();if(te){const D=P[0]>Z[0];$.appendChild(this._createSelectionElement(V,D?Z[0]:P[0],D?P[0]:Z[0],M-V+1))}else{const D=F===V?P[0]:0,z=V===Y?Z[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(V,D,z));const Q=M-V-1;if($.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,Q)),V!==M){const ne=Y===M?Z[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(M,0,ne))}}this._selectionContainer.appendChild($)}_createSelectionElement(P,Z,te,F=1){const Y=this._document.createElement("div"),V=Z*this.dimensions.css.cell.width;let M=this.dimensions.css.cell.width*(te-Z);return V+M>this.dimensions.css.canvas.width&&(M=this.dimensions.css.canvas.width-V),Y.style.height=F*this.dimensions.css.cell.height+"px",Y.style.top=P*this.dimensions.css.cell.height+"px",Y.style.left=`${V}px`,Y.style.width=`${M}px`,Y}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const P of this._rowElements)P.replaceChildren()}renderRows(P,Z){const te=this._bufferService.buffer,F=te.ybase+te.y,Y=Math.min(te.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,M=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=P;D<=Z;D++){const z=D+te.ydisp,Q=this._rowElements[D],ne=te.lines.get(z);if(!Q||!ne)break;Q.replaceChildren(...this._rowFactory.createRow(ne,z,z===F,M,$,Y,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${A}${this._terminalClass}`}_handleLinkHover(P){this._setCellUnderline(P.x1,P.x2,P.y1,P.y2,P.cols,!0)}_handleLinkLeave(P){this._setCellUnderline(P.x1,P.x2,P.y1,P.y2,P.cols,!1)}_setCellUnderline(P,Z,te,F,Y,V){te<0&&(P=0),F<0&&(Z=0);const M=this._bufferService.rows-1;te=Math.max(Math.min(te,M),0),F=Math.max(Math.min(F,M),0),Y=Math.min(Y,this._bufferService.cols);const $=this._bufferService.buffer,D=$.ybase+$.y,z=Math.min($.x,Y-1),Q=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,ve=this._optionsService.rawOptions.cursorInactiveStyle;for(let Ce=te;Ce<=F;++Ce){const X=Ce+$.ydisp,O=this._rowElements[Ce],ee=$.lines.get(X);if(!O||!ee)break;O.replaceChildren(...this._rowFactory.createRow(ee,X,X===D,ne,ve,z,Q,this.dimensions.css.cell.width,this._widthCache,V?Ce===te?P:0:-1,V?(Ce===F?Z:Y)-1:-1))}}};h.DomRenderer=W=m([g(7,y.IInstantiationService),g(8,d.ICharSizeService),g(9,y.IOptionsService),g(10,y.IBufferService),g(11,d.ICoreBrowserService),g(12,d.IThemeService)],W)},3787:function(L,h,p){var m=this&&this.__decorate||function(k,R,C,T){var H,I=arguments.length,W=I<3?R:T===null?T=Object.getOwnPropertyDescriptor(R,C):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(k,R,C,T);else for(var P=k.length-1;P>=0;P--)(H=k[P])&&(W=(I<3?H(W):I>3?H(R,C,W):H(R,C))||W);return I>3&&W&&Object.defineProperty(R,C,W),W},g=this&&this.__param||function(k,R){return function(C,T){R(C,T,k)}};Object.defineProperty(h,"__esModule",{value:!0}),h.DomRendererRowFactory=void 0;const u=p(2223),v=p(643),w=p(511),x=p(2585),b=p(8055),d=p(4725),f=p(4269),l=p(6171),o=p(3734);let y=h.DomRendererRowFactory=class{constructor(k,R,C,T,H,I,W){this._document=k,this._characterJoinerService=R,this._optionsService=C,this._coreBrowserService=T,this._coreService=H,this._decorationService=I,this._themeService=W,this._workCell=new w.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(k,R,C){this._selectionStart=k,this._selectionEnd=R,this._columnSelectMode=C}createRow(k,R,C,T,H,I,W,P,Z,te,F){const Y=[],V=this._characterJoinerService.getJoinedCharacters(R),M=this._themeService.colors;let $,D=k.getNoBgTrimmedLength();C&&D<I+1&&(D=I+1);let z=0,Q="",ne=0,ve=0,Ce=0,X=!1,O=0,ee=!1,oe=0;const Se=[],ge=te!==-1&&F!==-1;for(let Oe=0;Oe<D;Oe++){k.loadCell(Oe,this._workCell);let Me=this._workCell.getWidth();if(Me===0)continue;let Pe=!1,Ke=Oe,Re=this._workCell;if(V.length>0&&Oe===V[0][0]){Pe=!0;const _e=V.shift();Re=new f.JoinedCellData(this._workCell,k.translateToString(!0,_e[0],_e[1]),_e[1]-_e[0]),Ke=_e[1]-1,Me=Re.getWidth()}const ft=this._isCellInSelection(Oe,R),vt=C&&Oe===I,Lt=ge&&Oe>=te&&Oe<=F;let wt=!1;this._decorationService.forEachDecorationAtCell(Oe,R,void 0,(_e=>{wt=!0}));let bt=Re.getChars()||v.WHITESPACE_CELL_CHAR;if(bt===" "&&(Re.isUnderline()||Re.isOverline())&&(bt=" "),oe=Me*P-Z.get(bt,Re.isBold(),Re.isItalic()),$){if(z&&(ft&&ee||!ft&&!ee&&Re.bg===ne)&&(ft&&ee&&M.selectionForeground||Re.fg===ve)&&Re.extended.ext===Ce&&Lt===X&&oe===O&&!vt&&!Pe&&!wt){Re.isInvisible()?Q+=v.WHITESPACE_CELL_CHAR:Q+=bt,z++;continue}z&&($.textContent=Q),$=this._document.createElement("span"),z=0,Q=""}else $=this._document.createElement("span");if(ne=Re.bg,ve=Re.fg,Ce=Re.extended.ext,X=Lt,O=oe,ee=ft,Pe&&I>=Oe&&I<=Ke&&(I=Oe),!this._coreService.isCursorHidden&&vt&&this._coreService.isCursorInitialized){if(Se.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&Se.push("xterm-cursor-blink"),Se.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(H)switch(H){case"outline":Se.push("xterm-cursor-outline");break;case"block":Se.push("xterm-cursor-block");break;case"bar":Se.push("xterm-cursor-bar");break;case"underline":Se.push("xterm-cursor-underline")}}if(Re.isBold()&&Se.push("xterm-bold"),Re.isItalic()&&Se.push("xterm-italic"),Re.isDim()&&Se.push("xterm-dim"),Q=Re.isInvisible()?v.WHITESPACE_CELL_CHAR:Re.getChars()||v.WHITESPACE_CELL_CHAR,Re.isUnderline()&&(Se.push(`xterm-underline-${Re.extended.underlineStyle}`),Q===" "&&(Q=" "),!Re.isUnderlineColorDefault()))if(Re.isUnderlineColorRGB())$.style.textDecorationColor=`rgb(${o.AttributeData.toColorRGB(Re.getUnderlineColor()).join(",")})`;else{let _e=Re.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Re.isBold()&&_e<8&&(_e+=8),$.style.textDecorationColor=M.ansi[_e].css}Re.isOverline()&&(Se.push("xterm-overline"),Q===" "&&(Q=" ")),Re.isStrikethrough()&&Se.push("xterm-strikethrough"),Lt&&($.style.textDecoration="underline");let st=Re.getFgColor(),it=Re.getFgColorMode(),pt=Re.getBgColor(),xt=Re.getBgColorMode();const Ot=!!Re.isInverse();if(Ot){const _e=st;st=pt,pt=_e;const ze=it;it=xt,xt=ze}let Je,jt,Ct,Pt=!1;switch(this._decorationService.forEachDecorationAtCell(Oe,R,void 0,(_e=>{_e.options.layer!=="top"&&Pt||(_e.backgroundColorRGB&&(xt=50331648,pt=_e.backgroundColorRGB.rgba>>8&16777215,Je=_e.backgroundColorRGB),_e.foregroundColorRGB&&(it=50331648,st=_e.foregroundColorRGB.rgba>>8&16777215,jt=_e.foregroundColorRGB),Pt=_e.options.layer==="top")})),!Pt&&ft&&(Je=this._coreBrowserService.isFocused?M.selectionBackgroundOpaque:M.selectionInactiveBackgroundOpaque,pt=Je.rgba>>8&16777215,xt=50331648,Pt=!0,M.selectionForeground&&(it=50331648,st=M.selectionForeground.rgba>>8&16777215,jt=M.selectionForeground)),Pt&&Se.push("xterm-decoration-top"),xt){case 16777216:case 33554432:Ct=M.ansi[pt],Se.push(`xterm-bg-${pt}`);break;case 50331648:Ct=b.channels.toColor(pt>>16,pt>>8&255,255&pt),this._addStyle($,`background-color:#${A((pt>>>0).toString(16),"0",6)}`);break;default:Ot?(Ct=M.foreground,Se.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):Ct=M.background}switch(Je||Re.isDim()&&(Je=b.color.multiplyOpacity(Ct,.5)),it){case 16777216:case 33554432:Re.isBold()&&st<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(st+=8),this._applyMinimumContrast($,Ct,M.ansi[st],Re,Je,void 0)||Se.push(`xterm-fg-${st}`);break;case 50331648:const _e=b.channels.toColor(st>>16&255,st>>8&255,255&st);this._applyMinimumContrast($,Ct,_e,Re,Je,jt)||this._addStyle($,`color:#${A(st.toString(16),"0",6)}`);break;default:this._applyMinimumContrast($,Ct,M.foreground,Re,Je,jt)||Ot&&Se.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}Se.length&&($.className=Se.join(" "),Se.length=0),vt||Pe||wt?$.textContent=Q:z++,oe!==this.defaultSpacing&&($.style.letterSpacing=`${oe}px`),Y.push($),Oe=Ke}return $&&z&&($.textContent=Q),Y}_applyMinimumContrast(k,R,C,T,H,I){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,l.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const W=this._getContrastCache(T);let P;if(H||I||(P=W.getColor(R.rgba,C.rgba)),P===void 0){const Z=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);P=b.color.ensureContrastRatio(H||R,I||C,Z),W.setColor((H||R).rgba,(I||C).rgba,P??null)}return!!P&&(this._addStyle(k,`color:${P.css}`),!0)}_getContrastCache(k){return k.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(k,R){k.setAttribute("style",`${k.getAttribute("style")||""}${R};`)}_isCellInSelection(k,R){const C=this._selectionStart,T=this._selectionEnd;return!(!C||!T)&&(this._columnSelectMode?C[0]<=T[0]?k>=C[0]&&R>=C[1]&&k<T[0]&&R<=T[1]:k<C[0]&&R>=C[1]&&k>=T[0]&&R<=T[1]:R>C[1]&&R<T[1]||C[1]===T[1]&&R===C[1]&&k>=C[0]&&k<T[0]||C[1]<T[1]&&R===T[1]&&k<T[0]||C[1]<T[1]&&R===C[1]&&k>=C[0])}};function A(k,R,C){for(;k.length<C;)k=R+k;return k}h.DomRendererRowFactory=y=m([g(1,d.ICharacterJoinerService),g(2,x.IOptionsService),g(3,d.ICoreBrowserService),g(4,x.ICoreService),g(5,x.IDecorationService),g(6,d.IThemeService)],y)},2550:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.WidthCache=void 0,h.WidthCache=class{constructor(p,m){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=p.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=p.createElement("span");g.classList.add("xterm-char-measure-element");const u=p.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold";const v=p.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontStyle="italic";const w=p.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontWeight="bold",w.style.fontStyle="italic",this._measureElements=[g,u,v,w],this._container.appendChild(g),this._container.appendChild(u),this._container.appendChild(v),this._container.appendChild(w),m.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(p,m,g,u){p===this._font&&m===this._fontSize&&g===this._weight&&u===this._weightBold||(this._font=p,this._fontSize=m,this._weight=g,this._weightBold=u,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${u}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${u}`,this.clear())}get(p,m,g){let u=0;if(!m&&!g&&p.length===1&&(u=p.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const x=this._measure(p,0);return x>0&&(this._flat[u]=x),x}let v=p;m&&(v+="B"),g&&(v+="I");let w=this._holey.get(v);if(w===void 0){let x=0;m&&(x|=1),g&&(x|=2),w=this._measure(p,x),w>0&&this._holey.set(v,w)}return w}_measure(p,m){const g=this._measureElements[m];return g.textContent=p.repeat(32),g.offsetWidth/32}}},2223:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.TEXT_BASELINE=h.DIM_OPACITY=h.INVERTED_DEFAULT_COLOR=void 0;const m=p(6114);h.INVERTED_DEFAULT_COLOR=257,h.DIM_OPACITY=.5,h.TEXT_BASELINE=m.isFirefox||m.isLegacyEdge?"bottom":"ideographic"},6171:(L,h)=>{function p(g){return 57508<=g&&g<=57558}function m(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(h,"__esModule",{value:!0}),h.computeNextVariantOffset=h.createRenderDimensions=h.treatGlyphAsBackgroundColor=h.allowRescaling=h.isEmoji=h.isRestrictedPowerlineGlyph=h.isPowerlineGlyph=h.throwIfFalsy=void 0,h.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},h.isPowerlineGlyph=p,h.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},h.isEmoji=m,h.allowRescaling=function(g,u,v,w){return u===1&&v>Math.ceil(1.5*w)&&g!==void 0&&g>255&&!m(g)&&!p(g)&&!(function(x){return 57344<=x&&x<=63743})(g)},h.treatGlyphAsBackgroundColor=function(g){return p(g)||(function(u){return 9472<=u&&u<=9631})(g)},h.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},h.computeNextVariantOffset=function(g,u,v=0){return(g-(2*Math.round(u)-v))%(2*Math.round(u))}},6052:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.createSelectionRenderModel=void 0;class p{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,u,v,w=!1){if(this.selectionStart=u,this.selectionEnd=v,!u||!v||u[0]===v[0]&&u[1]===v[1])return void this.clear();const x=g.buffers.active.ydisp,b=u[1]-x,d=v[1]-x,f=Math.max(b,0),l=Math.min(d,g.rows-1);f>=g.rows||l<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=w,this.viewportStartRow=b,this.viewportEndRow=d,this.viewportCappedStartRow=f,this.viewportCappedEndRow=l,this.startCol=u[0],this.endCol=v[0])}isCellSelected(g,u,v){return!!this.hasSelection&&(v-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?u>=this.startCol&&v>=this.viewportCappedStartRow&&u<this.endCol&&v<=this.viewportCappedEndRow:u<this.startCol&&v>=this.viewportCappedStartRow&&u>=this.endCol&&v<=this.viewportCappedEndRow:v>this.viewportStartRow&&v<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&v===this.viewportStartRow&&u>=this.startCol&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportEndRow&&u<this.endCol||this.viewportStartRow<this.viewportEndRow&&v===this.viewportStartRow&&u>=this.startCol)}}h.createSelectionRenderModel=function(){return new p}},456:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.SelectionModel=void 0,h.SelectionModel=class{constructor(p){this._bufferService=p,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const p=this.selectionStart[0]+this.selectionStartLength;return p>this._bufferService.cols?p%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(p/this._bufferService.cols)-1]:[p%this._bufferService.cols,this.selectionStart[1]+Math.floor(p/this._bufferService.cols)]:[p,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const p=this.selectionStart[0]+this.selectionStartLength;return p>this._bufferService.cols?[p%this._bufferService.cols,this.selectionStart[1]+Math.floor(p/this._bufferService.cols)]:[Math.max(p,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const p=this.selectionStart,m=this.selectionEnd;return!(!p||!m)&&(p[1]>m[1]||p[1]===m[1]&&p[0]>m[0])}handleTrim(p){return this.selectionStart&&(this.selectionStart[1]-=p),this.selectionEnd&&(this.selectionEnd[1]-=p),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(L,h,p){var m=this&&this.__decorate||function(l,o,y,A){var k,R=arguments.length,C=R<3?o:A===null?A=Object.getOwnPropertyDescriptor(o,y):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(l,o,y,A);else for(var T=l.length-1;T>=0;T--)(k=l[T])&&(C=(R<3?k(C):R>3?k(o,y,C):k(o,y))||C);return R>3&&C&&Object.defineProperty(o,y,C),C},g=this&&this.__param||function(l,o){return function(y,A){o(y,A,l)}};Object.defineProperty(h,"__esModule",{value:!0}),h.CharSizeService=void 0;const u=p(2585),v=p(8460),w=p(844);let x=h.CharSizeService=class extends w.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(l,o,y){super(),this._optionsService=y,this.width=0,this.height=0,this._onCharSizeChange=this.register(new v.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new f(this._optionsService))}catch{this._measureStrategy=this.register(new d(l,o,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const l=this._measureStrategy.measure();l.width===this.width&&l.height===this.height||(this.width=l.width,this.height=l.height,this._onCharSizeChange.fire())}};h.CharSizeService=x=m([g(2,u.IOptionsService)],x);class b extends w.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(o,y){o!==void 0&&o>0&&y!==void 0&&y>0&&(this._result.width=o,this._result.height=y)}}class d extends b{constructor(o,y,A){super(),this._document=o,this._parentElement=y,this._optionsService=A,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class f extends b{constructor(o){super(),this._optionsService=o,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const y=this._ctx.measureText("W");if(!("width"in y&&"fontBoundingBoxAscent"in y&&"fontBoundingBoxDescent"in y))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const o=this._ctx.measureText("W");return this._validateAndSet(o.width,o.fontBoundingBoxAscent+o.fontBoundingBoxDescent),this._result}}},4269:function(L,h,p){var m=this&&this.__decorate||function(f,l,o,y){var A,k=arguments.length,R=k<3?l:y===null?y=Object.getOwnPropertyDescriptor(l,o):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(f,l,o,y);else for(var C=f.length-1;C>=0;C--)(A=f[C])&&(R=(k<3?A(R):k>3?A(l,o,R):A(l,o))||R);return k>3&&R&&Object.defineProperty(l,o,R),R},g=this&&this.__param||function(f,l){return function(o,y){l(o,y,f)}};Object.defineProperty(h,"__esModule",{value:!0}),h.CharacterJoinerService=h.JoinedCellData=void 0;const u=p(3734),v=p(643),w=p(511),x=p(2585);class b extends u.AttributeData{constructor(l,o,y){super(),this.content=0,this.combinedData="",this.fg=l.fg,this.bg=l.bg,this.combinedData=o,this._width=y}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(l){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}h.JoinedCellData=b;let d=h.CharacterJoinerService=class Yp{constructor(l){this._bufferService=l,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new w.CellData}register(l){const o={id:this._nextCharacterJoinerId++,handler:l};return this._characterJoiners.push(o),o.id}deregister(l){for(let o=0;o<this._characterJoiners.length;o++)if(this._characterJoiners[o].id===l)return this._characterJoiners.splice(o,1),!0;return!1}getJoinedCharacters(l){if(this._characterJoiners.length===0)return[];const o=this._bufferService.buffer.lines.get(l);if(!o||o.length===0)return[];const y=[],A=o.translateToString(!0);let k=0,R=0,C=0,T=o.getFg(0),H=o.getBg(0);for(let I=0;I<o.getTrimmedLength();I++)if(o.loadCell(I,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==H){if(I-k>1){const W=this._getJoinedRanges(A,C,R,o,k);for(let P=0;P<W.length;P++)y.push(W[P])}k=I,C=R,T=this._workCell.fg,H=this._workCell.bg}R+=this._workCell.getChars().length||v.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-k>1){const I=this._getJoinedRanges(A,C,R,o,k);for(let W=0;W<I.length;W++)y.push(I[W])}return y}_getJoinedRanges(l,o,y,A,k){const R=l.substring(o,y);let C=[];try{C=this._characterJoiners[0].handler(R)}catch(T){console.error(T)}for(let T=1;T<this._characterJoiners.length;T++)try{const H=this._characterJoiners[T].handler(R);for(let I=0;I<H.length;I++)Yp._mergeRanges(C,H[I])}catch(H){console.error(H)}return this._stringRangesToCellRanges(C,A,k),C}_stringRangesToCellRanges(l,o,y){let A=0,k=!1,R=0,C=l[A];if(C){for(let T=y;T<this._bufferService.cols;T++){const H=o.getWidth(T),I=o.getString(T).length||v.WHITESPACE_CELL_CHAR.length;if(H!==0){if(!k&&C[0]<=R&&(C[0]=T,k=!0),C[1]<=R){if(C[1]=T,C=l[++A],!C)break;C[0]<=R?(C[0]=T,k=!0):k=!1}R+=I}}C&&(C[1]=this._bufferService.cols)}}static _mergeRanges(l,o){let y=!1;for(let A=0;A<l.length;A++){const k=l[A];if(y){if(o[1]<=k[0])return l[A-1][1]=o[1],l;if(o[1]<=k[1])return l[A-1][1]=Math.max(o[1],k[1]),l.splice(A,1),l;l.splice(A,1),A--}else{if(o[1]<=k[0])return l.splice(A,0,o),l;if(o[1]<=k[1])return k[0]=Math.min(o[0],k[0]),l;o[0]<k[1]&&(k[0]=Math.min(o[0],k[0]),y=!0)}}return y?l[l.length-1][1]=o[1]:l.push(o),l}};h.CharacterJoinerService=d=m([g(0,x.IBufferService)],d)},5114:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.CoreBrowserService=void 0;const m=p(844),g=p(8460),u=p(3656);class v extends m.Disposable{constructor(b,d,f){super(),this._textarea=b,this._window=d,this.mainDocument=f,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new w(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((l=>this._screenDprMonitor.setWindow(l)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(b){this._window!==b&&(this._window=b,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}h.CoreBrowserService=v;class w extends m.Disposable{constructor(b){super(),this._parentWindow=b,this._windowResizeListener=this.register(new m.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,m.toDisposable)((()=>this.clearListener())))}setWindow(b){this._parentWindow=b,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,u.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var b;this._outerListener&&((b=this._resolutionMediaMatchList)==null||b.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.LinkProviderService=void 0;const m=p(844);class g extends m.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,m.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(v){return this.linkProviders.push(v),{dispose:()=>{const w=this.linkProviders.indexOf(v);w!==-1&&this.linkProviders.splice(w,1)}}}}h.LinkProviderService=g},8934:function(L,h,p){var m=this&&this.__decorate||function(x,b,d,f){var l,o=arguments.length,y=o<3?b:f===null?f=Object.getOwnPropertyDescriptor(b,d):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(x,b,d,f);else for(var A=x.length-1;A>=0;A--)(l=x[A])&&(y=(o<3?l(y):o>3?l(b,d,y):l(b,d))||y);return o>3&&y&&Object.defineProperty(b,d,y),y},g=this&&this.__param||function(x,b){return function(d,f){b(d,f,x)}};Object.defineProperty(h,"__esModule",{value:!0}),h.MouseService=void 0;const u=p(4725),v=p(9806);let w=h.MouseService=class{constructor(x,b){this._renderService=x,this._charSizeService=b}getCoords(x,b,d,f,l){return(0,v.getCoords)(window,x,b,d,f,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(x,b){const d=(0,v.getCoordsRelativeToElement)(window,x,b);if(this._charSizeService.hasValidSize)return d[0]=Math.min(Math.max(d[0],0),this._renderService.dimensions.css.canvas.width-1),d[1]=Math.min(Math.max(d[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(d[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(d[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(d[0]),y:Math.floor(d[1])}}};h.MouseService=w=m([g(0,u.IRenderService),g(1,u.ICharSizeService)],w)},3230:function(L,h,p){var m=this&&this.__decorate||function(l,o,y,A){var k,R=arguments.length,C=R<3?o:A===null?A=Object.getOwnPropertyDescriptor(o,y):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(l,o,y,A);else for(var T=l.length-1;T>=0;T--)(k=l[T])&&(C=(R<3?k(C):R>3?k(o,y,C):k(o,y))||C);return R>3&&C&&Object.defineProperty(o,y,C),C},g=this&&this.__param||function(l,o){return function(y,A){o(y,A,l)}};Object.defineProperty(h,"__esModule",{value:!0}),h.RenderService=void 0;const u=p(6193),v=p(4725),w=p(8460),x=p(844),b=p(7226),d=p(2585);let f=h.RenderService=class extends x.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(l,o,y,A,k,R,C,T){super(),this._rowCount=l,this._charSizeService=A,this._renderer=this.register(new x.MutableDisposable),this._pausedResizeTask=new b.DebouncedIdleTask,this._observerDisposable=this.register(new x.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new w.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new w.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new w.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new w.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u.RenderDebouncer(((H,I)=>this._renderRows(H,I)),C),this.register(this._renderDebouncer),this.register(C.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var H;return(H=this._renderer.value)==null?void 0:H.clear()}))),this.register(y.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(k.onDecorationRegistered((()=>this._fullRefresh()))),this.register(k.onDecorationRemoved((()=>this._fullRefresh()))),this.register(y.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(y.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(T.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(C.window,o),this.register(C.onWindowChange((H=>this._registerIntersectionObserver(H,o))))}_registerIntersectionObserver(l,o){if("IntersectionObserver"in l){const y=new l.IntersectionObserver((A=>this._handleIntersectionChange(A[A.length-1])),{threshold:0});y.observe(o),this._observerDisposable.value=(0,x.toDisposable)((()=>y.disconnect()))}}_handleIntersectionChange(l){this._isPaused=l.isIntersecting===void 0?l.intersectionRatio===0:!l.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(l,o,y=!1){this._isPaused?this._needsFullRefresh=!0:(y||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(l,o,this._rowCount))}_renderRows(l,o){this._renderer.value&&(l=Math.min(l,this._rowCount-1),o=Math.min(o,this._rowCount-1),this._renderer.value.renderRows(l,o),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:l,end:o}),this._onRender.fire({start:l,end:o}),this._isNextRenderRedrawOnly=!0)}resize(l,o){this._rowCount=o,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(l){this._renderer.value=l,this._renderer.value&&(this._renderer.value.onRequestRedraw((o=>this.refreshRows(o.start,o.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(l){return this._renderDebouncer.addRefreshCallback(l)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var l,o;this._renderer.value&&((o=(l=this._renderer.value).clearTextureAtlas)==null||o.call(l),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(l,o){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var y;return(y=this._renderer.value)==null?void 0:y.handleResize(l,o)})):this._renderer.value.handleResize(l,o),this._fullRefresh())}handleCharSizeChanged(){var l;(l=this._renderer.value)==null||l.handleCharSizeChanged()}handleBlur(){var l;(l=this._renderer.value)==null||l.handleBlur()}handleFocus(){var l;(l=this._renderer.value)==null||l.handleFocus()}handleSelectionChanged(l,o,y){var A;this._selectionState.start=l,this._selectionState.end=o,this._selectionState.columnSelectMode=y,(A=this._renderer.value)==null||A.handleSelectionChanged(l,o,y)}handleCursorMove(){var l;(l=this._renderer.value)==null||l.handleCursorMove()}clear(){var l;(l=this._renderer.value)==null||l.clear()}};h.RenderService=f=m([g(2,d.IOptionsService),g(3,v.ICharSizeService),g(4,d.IDecorationService),g(5,d.IBufferService),g(6,v.ICoreBrowserService),g(7,v.IThemeService)],f)},9312:function(L,h,p){var m=this&&this.__decorate||function(C,T,H,I){var W,P=arguments.length,Z=P<3?T:I===null?I=Object.getOwnPropertyDescriptor(T,H):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(C,T,H,I);else for(var te=C.length-1;te>=0;te--)(W=C[te])&&(Z=(P<3?W(Z):P>3?W(T,H,Z):W(T,H))||Z);return P>3&&Z&&Object.defineProperty(T,H,Z),Z},g=this&&this.__param||function(C,T){return function(H,I){T(H,I,C)}};Object.defineProperty(h,"__esModule",{value:!0}),h.SelectionService=void 0;const u=p(9806),v=p(9504),w=p(456),x=p(4725),b=p(8460),d=p(844),f=p(6114),l=p(4841),o=p(511),y=p(2585),A=" ",k=new RegExp(A,"g");let R=h.SelectionService=class extends d.Disposable{constructor(C,T,H,I,W,P,Z,te,F){super(),this._element=C,this._screenElement=T,this._linkifier=H,this._bufferService=I,this._coreService=W,this._mouseService=P,this._optionsService=Z,this._renderService=te,this._coreBrowserService=F,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new o.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new b.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new b.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new b.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new b.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new w.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,d.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const C=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!C||!T||C[0]===T[0]&&C[1]===T[1])}get selectionText(){const C=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;if(!C||!T)return"";const H=this._bufferService.buffer,I=[];if(this._activeSelectionMode===3){if(C[0]===T[0])return"";const W=C[0]<T[0]?C[0]:T[0],P=C[0]<T[0]?T[0]:C[0];for(let Z=C[1];Z<=T[1];Z++){const te=H.translateBufferLineToString(Z,!0,W,P);I.push(te)}}else{const W=C[1]===T[1]?T[0]:void 0;I.push(H.translateBufferLineToString(C[1],!0,C[0],W));for(let P=C[1]+1;P<=T[1]-1;P++){const Z=H.lines.get(P),te=H.translateBufferLineToString(P,!0);Z!=null&&Z.isWrapped?I[I.length-1]+=te:I.push(te)}if(C[1]!==T[1]){const P=H.lines.get(T[1]),Z=H.translateBufferLineToString(T[1],!0,0,T[0]);P&&P.isWrapped?I[I.length-1]+=Z:I.push(Z)}}return I.map((W=>W.replace(k," "))).join(f.isWindows?`\r
440
+ `:`
441
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(C){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),f.isLinux&&C&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(C){const T=this._getMouseBufferCoords(C),H=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!!(H&&I&&T)&&this._areCoordsInSelection(T,H,I)}isCellInSelection(C,T){const H=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!H||!I)&&this._areCoordsInSelection([C,T],H,I)}_areCoordsInSelection(C,T,H){return C[1]>T[1]&&C[1]<H[1]||T[1]===H[1]&&C[1]===T[1]&&C[0]>=T[0]&&C[0]<H[0]||T[1]<H[1]&&C[1]===H[1]&&C[0]<H[0]||T[1]<H[1]&&C[1]===T[1]&&C[0]>=T[0]}_selectWordAtCursor(C,T){var W,P;const H=(P=(W=this._linkifier.currentLink)==null?void 0:W.link)==null?void 0:P.range;if(H)return this._model.selectionStart=[H.start.x-1,H.start.y-1],this._model.selectionStartLength=(0,l.getRangeLength)(H,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const I=this._getMouseBufferCoords(C);return!!I&&(this._selectWordAt(I,T),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(C,T){this._model.clearSelection(),C=Math.max(C,0),T=Math.min(T,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,C],this._model.selectionEnd=[this._bufferService.cols,T],this.refresh(),this._onSelectionChange.fire()}_handleTrim(C){this._model.handleTrim(C)&&this.refresh()}_getMouseBufferCoords(C){const T=this._mouseService.getCoords(C,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(T)return T[0]--,T[1]--,T[1]+=this._bufferService.buffer.ydisp,T}_getMouseEventScrollAmount(C){let T=(0,u.getCoordsRelativeToElement)(this._coreBrowserService.window,C,this._screenElement)[1];const H=this._renderService.dimensions.css.canvas.height;return T>=0&&T<=H?0:(T>H&&(T-=H),T=Math.min(Math.max(T,-50),50),T/=50,T/Math.abs(T)+Math.round(14*T))}shouldForceSelection(C){return f.isMac?C.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:C.shiftKey}handleMouseDown(C){if(this._mouseDownTimeStamp=C.timeStamp,(C.button!==2||!this.hasSelection)&&C.button===0){if(!this._enabled){if(!this.shouldForceSelection(C))return;C.stopPropagation()}C.preventDefault(),this._dragScrollAmount=0,this._enabled&&C.shiftKey?this._handleIncrementalClick(C):C.detail===1?this._handleSingleClick(C):C.detail===2?this._handleDoubleClick(C):C.detail===3&&this._handleTripleClick(C),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(C){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(C))}_handleSingleClick(C){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(C)?3:0,this._model.selectionStart=this._getMouseBufferCoords(C),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const T=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);T&&T.length!==this._model.selectionStart[0]&&T.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(C){this._selectWordAtCursor(C,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(C){const T=this._getMouseBufferCoords(C);T&&(this._activeSelectionMode=2,this._selectLineAt(T[1]))}shouldColumnSelect(C){return C.altKey&&!(f.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(C){if(C.stopImmediatePropagation(),!this._model.selectionStart)return;const T=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(C),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(C),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const H=this._bufferService.buffer;if(this._model.selectionEnd[1]<H.lines.length){const I=H.lines.get(this._model.selectionEnd[1]);I&&I.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}T&&T[0]===this._model.selectionEnd[0]&&T[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const C=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(C.ydisp+this._bufferService.rows,C.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=C.ydisp),this.refresh()}}_handleMouseUp(C){const T=C.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&T<500&&C.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const H=this._mouseService.getCoords(C,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(H&&H[0]!==void 0&&H[1]!==void 0){const I=(0,v.moveToCellSequence)(H[0]-1,H[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(I,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const C=this._model.finalSelectionStart,T=this._model.finalSelectionEnd,H=!(!C||!T||C[0]===T[0]&&C[1]===T[1]);H?C&&T&&(this._oldSelectionStart&&this._oldSelectionEnd&&C[0]===this._oldSelectionStart[0]&&C[1]===this._oldSelectionStart[1]&&T[0]===this._oldSelectionEnd[0]&&T[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(C,T,H)):this._oldHasSelection&&this._fireOnSelectionChange(C,T,H)}_fireOnSelectionChange(C,T,H){this._oldSelectionStart=C,this._oldSelectionEnd=T,this._oldHasSelection=H,this._onSelectionChange.fire()}_handleBufferActivate(C){this.clearSelection(),this._trimListener.dispose(),this._trimListener=C.activeBuffer.lines.onTrim((T=>this._handleTrim(T)))}_convertViewportColToCharacterIndex(C,T){let H=T;for(let I=0;T>=I;I++){const W=C.loadCell(I,this._workCell).getChars().length;this._workCell.getWidth()===0?H--:W>1&&T!==I&&(H+=W-1)}return H}setSelection(C,T,H){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[C,T],this._model.selectionStartLength=H,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(C){this._isClickInSelection(C)||(this._selectWordAtCursor(C,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(C,T,H=!0,I=!0){if(C[0]>=this._bufferService.cols)return;const W=this._bufferService.buffer,P=W.lines.get(C[1]);if(!P)return;const Z=W.translateBufferLineToString(C[1],!1);let te=this._convertViewportColToCharacterIndex(P,C[0]),F=te;const Y=C[0]-te;let V=0,M=0,$=0,D=0;if(Z.charAt(te)===" "){for(;te>0&&Z.charAt(te-1)===" ";)te--;for(;F<Z.length&&Z.charAt(F+1)===" ";)F++}else{let ne=C[0],ve=C[0];P.getWidth(ne)===0&&(V++,ne--),P.getWidth(ve)===2&&(M++,ve++);const Ce=P.getString(ve).length;for(Ce>1&&(D+=Ce-1,F+=Ce-1);ne>0&&te>0&&!this._isCharWordSeparator(P.loadCell(ne-1,this._workCell));){P.loadCell(ne-1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,ne--):X>1&&($+=X-1,te-=X-1),te--,ne--}for(;ve<P.length&&F+1<Z.length&&!this._isCharWordSeparator(P.loadCell(ve+1,this._workCell));){P.loadCell(ve+1,this._workCell);const X=this._workCell.getChars().length;this._workCell.getWidth()===2?(M++,ve++):X>1&&(D+=X-1,F+=X-1),F++,ve++}}F++;let z=te+Y-V+$,Q=Math.min(this._bufferService.cols,F-te+V+M-$-D);if(T||Z.slice(te,F).trim()!==""){if(H&&z===0&&P.getCodePoint(0)!==32){const ne=W.lines.get(C[1]-1);if(ne&&P.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const ve=this._getWordAt([this._bufferService.cols-1,C[1]-1],!1,!0,!1);if(ve){const Ce=this._bufferService.cols-ve.start;z-=Ce,Q+=Ce}}}if(I&&z+Q===this._bufferService.cols&&P.getCodePoint(this._bufferService.cols-1)!==32){const ne=W.lines.get(C[1]+1);if(ne!=null&&ne.isWrapped&&ne.getCodePoint(0)!==32){const ve=this._getWordAt([0,C[1]+1],!1,!1,!0);ve&&(Q+=ve.length)}}return{start:z,length:Q}}}_selectWordAt(C,T){const H=this._getWordAt(C,T);if(H){for(;H.start<0;)H.start+=this._bufferService.cols,C[1]--;this._model.selectionStart=[H.start,C[1]],this._model.selectionStartLength=H.length}}_selectToWordAt(C){const T=this._getWordAt(C,!0);if(T){let H=C[1];for(;T.start<0;)T.start+=this._bufferService.cols,H--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,H++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,H]}}_isCharWordSeparator(C){return C.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(C.getChars())>=0}_selectLineAt(C){const T=this._bufferService.buffer.getWrappedRangeForLine(C),H={start:{x:0,y:T.first},end:{x:this._bufferService.cols-1,y:T.last}};this._model.selectionStart=[0,T.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,l.getRangeLength)(H,this._bufferService.cols)}};h.SelectionService=R=m([g(3,y.IBufferService),g(4,y.ICoreService),g(5,x.IMouseService),g(6,y.IOptionsService),g(7,x.IRenderService),g(8,x.ICoreBrowserService)],R)},4725:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ILinkProviderService=h.IThemeService=h.ICharacterJoinerService=h.ISelectionService=h.IRenderService=h.IMouseService=h.ICoreBrowserService=h.ICharSizeService=void 0;const m=p(8343);h.ICharSizeService=(0,m.createDecorator)("CharSizeService"),h.ICoreBrowserService=(0,m.createDecorator)("CoreBrowserService"),h.IMouseService=(0,m.createDecorator)("MouseService"),h.IRenderService=(0,m.createDecorator)("RenderService"),h.ISelectionService=(0,m.createDecorator)("SelectionService"),h.ICharacterJoinerService=(0,m.createDecorator)("CharacterJoinerService"),h.IThemeService=(0,m.createDecorator)("ThemeService"),h.ILinkProviderService=(0,m.createDecorator)("LinkProviderService")},6731:function(L,h,p){var m=this&&this.__decorate||function(R,C,T,H){var I,W=arguments.length,P=W<3?C:H===null?H=Object.getOwnPropertyDescriptor(C,T):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(R,C,T,H);else for(var Z=R.length-1;Z>=0;Z--)(I=R[Z])&&(P=(W<3?I(P):W>3?I(C,T,P):I(C,T))||P);return W>3&&P&&Object.defineProperty(C,T,P),P},g=this&&this.__param||function(R,C){return function(T,H){C(T,H,R)}};Object.defineProperty(h,"__esModule",{value:!0}),h.ThemeService=h.DEFAULT_ANSI_COLORS=void 0;const u=p(7239),v=p(8055),w=p(8460),x=p(844),b=p(2585),d=v.css.toColor("#ffffff"),f=v.css.toColor("#000000"),l=v.css.toColor("#ffffff"),o=v.css.toColor("#000000"),y={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};h.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[v.css.toColor("#2e3436"),v.css.toColor("#cc0000"),v.css.toColor("#4e9a06"),v.css.toColor("#c4a000"),v.css.toColor("#3465a4"),v.css.toColor("#75507b"),v.css.toColor("#06989a"),v.css.toColor("#d3d7cf"),v.css.toColor("#555753"),v.css.toColor("#ef2929"),v.css.toColor("#8ae234"),v.css.toColor("#fce94f"),v.css.toColor("#729fcf"),v.css.toColor("#ad7fa8"),v.css.toColor("#34e2e2"),v.css.toColor("#eeeeec")],C=[0,95,135,175,215,255];for(let T=0;T<216;T++){const H=C[T/36%6|0],I=C[T/6%6|0],W=C[T%6];R.push({css:v.channels.toCss(H,I,W),rgba:v.channels.toRgba(H,I,W)})}for(let T=0;T<24;T++){const H=8+10*T;R.push({css:v.channels.toCss(H,H,H),rgba:v.channels.toRgba(H,H,H)})}return R})());let A=h.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new u.ColorContrastCache,this._halfContrastCache=new u.ColorContrastCache,this._onChangeColors=this.register(new w.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d,background:f,cursor:l,cursorAccent:o,selectionForeground:void 0,selectionBackgroundTransparent:y,selectionBackgroundOpaque:v.color.blend(f,y),selectionInactiveBackgroundTransparent:y,selectionInactiveBackgroundOpaque:v.color.blend(f,y),ansi:h.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(R={}){const C=this._colors;if(C.foreground=k(R.foreground,d),C.background=k(R.background,f),C.cursor=k(R.cursor,l),C.cursorAccent=k(R.cursorAccent,o),C.selectionBackgroundTransparent=k(R.selectionBackground,y),C.selectionBackgroundOpaque=v.color.blend(C.background,C.selectionBackgroundTransparent),C.selectionInactiveBackgroundTransparent=k(R.selectionInactiveBackground,C.selectionBackgroundTransparent),C.selectionInactiveBackgroundOpaque=v.color.blend(C.background,C.selectionInactiveBackgroundTransparent),C.selectionForeground=R.selectionForeground?k(R.selectionForeground,v.NULL_COLOR):void 0,C.selectionForeground===v.NULL_COLOR&&(C.selectionForeground=void 0),v.color.isOpaque(C.selectionBackgroundTransparent)&&(C.selectionBackgroundTransparent=v.color.opacity(C.selectionBackgroundTransparent,.3)),v.color.isOpaque(C.selectionInactiveBackgroundTransparent)&&(C.selectionInactiveBackgroundTransparent=v.color.opacity(C.selectionInactiveBackgroundTransparent,.3)),C.ansi=h.DEFAULT_ANSI_COLORS.slice(),C.ansi[0]=k(R.black,h.DEFAULT_ANSI_COLORS[0]),C.ansi[1]=k(R.red,h.DEFAULT_ANSI_COLORS[1]),C.ansi[2]=k(R.green,h.DEFAULT_ANSI_COLORS[2]),C.ansi[3]=k(R.yellow,h.DEFAULT_ANSI_COLORS[3]),C.ansi[4]=k(R.blue,h.DEFAULT_ANSI_COLORS[4]),C.ansi[5]=k(R.magenta,h.DEFAULT_ANSI_COLORS[5]),C.ansi[6]=k(R.cyan,h.DEFAULT_ANSI_COLORS[6]),C.ansi[7]=k(R.white,h.DEFAULT_ANSI_COLORS[7]),C.ansi[8]=k(R.brightBlack,h.DEFAULT_ANSI_COLORS[8]),C.ansi[9]=k(R.brightRed,h.DEFAULT_ANSI_COLORS[9]),C.ansi[10]=k(R.brightGreen,h.DEFAULT_ANSI_COLORS[10]),C.ansi[11]=k(R.brightYellow,h.DEFAULT_ANSI_COLORS[11]),C.ansi[12]=k(R.brightBlue,h.DEFAULT_ANSI_COLORS[12]),C.ansi[13]=k(R.brightMagenta,h.DEFAULT_ANSI_COLORS[13]),C.ansi[14]=k(R.brightCyan,h.DEFAULT_ANSI_COLORS[14]),C.ansi[15]=k(R.brightWhite,h.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const T=Math.min(C.ansi.length-16,R.extendedAnsi.length);for(let H=0;H<T;H++)C.ansi[H+16]=k(R.extendedAnsi[H],h.DEFAULT_ANSI_COLORS[H+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[R]=this._restoreColors.ansi[R]}else for(let C=0;C<this._restoreColors.ansi.length;++C)this._colors.ansi[C]=this._restoreColors.ansi[C]}modifyColors(R){R(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function k(R,C){if(R!==void 0)try{return v.css.toColor(R)}catch{}return C}h.ThemeService=A=m([g(0,b.IOptionsService)],A)},6349:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.CircularList=void 0;const m=p(8460),g=p(844);class u extends g.Disposable{constructor(w){super(),this._maxLength=w,this.onDeleteEmitter=this.register(new m.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new m.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new m.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(w){if(this._maxLength===w)return;const x=new Array(w);for(let b=0;b<Math.min(w,this.length);b++)x[b]=this._array[this._getCyclicIndex(b)];this._array=x,this._maxLength=w,this._startIndex=0}get length(){return this._length}set length(w){if(w>this._length)for(let x=this._length;x<w;x++)this._array[x]=void 0;this._length=w}get(w){return this._array[this._getCyclicIndex(w)]}set(w,x){this._array[this._getCyclicIndex(w)]=x}push(w){this._array[this._getCyclicIndex(this._length)]=w,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(w,x,...b){if(x){for(let d=w;d<this._length-x;d++)this._array[this._getCyclicIndex(d)]=this._array[this._getCyclicIndex(d+x)];this._length-=x,this.onDeleteEmitter.fire({index:w,amount:x})}for(let d=this._length-1;d>=w;d--)this._array[this._getCyclicIndex(d+b.length)]=this._array[this._getCyclicIndex(d)];for(let d=0;d<b.length;d++)this._array[this._getCyclicIndex(w+d)]=b[d];if(b.length&&this.onInsertEmitter.fire({index:w,amount:b.length}),this._length+b.length>this._maxLength){const d=this._length+b.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=b.length}trimStart(w){w>this._length&&(w=this._length),this._startIndex+=w,this._length-=w,this.onTrimEmitter.fire(w)}shiftElements(w,x,b){if(!(x<=0)){if(w<0||w>=this._length)throw new Error("start argument out of range");if(w+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(let f=x-1;f>=0;f--)this.set(w+f+b,this.get(w+f));const d=w+x+b-this._length;if(d>0)for(this._length+=d;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let d=0;d<x;d++)this.set(w+d+b,this.get(w+d))}}_getCyclicIndex(w){return(this._startIndex+w)%this._maxLength}}h.CircularList=u},1439:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.clone=void 0,h.clone=function p(m,g=5){if(typeof m!="object")return m;const u=Array.isArray(m)?[]:{};for(const v in m)u[v]=g<=1?m[v]:m[v]&&p(m[v],g-1);return u}},8055:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.contrastRatio=h.toPaddedHex=h.rgba=h.rgb=h.css=h.color=h.channels=h.NULL_COLOR=void 0;let p=0,m=0,g=0,u=0;var v,w,x,b,d;function f(o){const y=o.toString(16);return y.length<2?"0"+y:y}function l(o,y){return o<y?(y+.05)/(o+.05):(o+.05)/(y+.05)}h.NULL_COLOR={css:"#00000000",rgba:0},(function(o){o.toCss=function(y,A,k,R){return R!==void 0?`#${f(y)}${f(A)}${f(k)}${f(R)}`:`#${f(y)}${f(A)}${f(k)}`},o.toRgba=function(y,A,k,R=255){return(y<<24|A<<16|k<<8|R)>>>0},o.toColor=function(y,A,k,R){return{css:o.toCss(y,A,k,R),rgba:o.toRgba(y,A,k,R)}}})(v||(h.channels=v={})),(function(o){function y(A,k){return u=Math.round(255*k),[p,m,g]=d.toChannels(A.rgba),{css:v.toCss(p,m,g,u),rgba:v.toRgba(p,m,g,u)}}o.blend=function(A,k){if(u=(255&k.rgba)/255,u===1)return{css:k.css,rgba:k.rgba};const R=k.rgba>>24&255,C=k.rgba>>16&255,T=k.rgba>>8&255,H=A.rgba>>24&255,I=A.rgba>>16&255,W=A.rgba>>8&255;return p=H+Math.round((R-H)*u),m=I+Math.round((C-I)*u),g=W+Math.round((T-W)*u),{css:v.toCss(p,m,g),rgba:v.toRgba(p,m,g)}},o.isOpaque=function(A){return(255&A.rgba)==255},o.ensureContrastRatio=function(A,k,R){const C=d.ensureContrastRatio(A.rgba,k.rgba,R);if(C)return v.toColor(C>>24&255,C>>16&255,C>>8&255)},o.opaque=function(A){const k=(255|A.rgba)>>>0;return[p,m,g]=d.toChannels(k),{css:v.toCss(p,m,g),rgba:k}},o.opacity=y,o.multiplyOpacity=function(A,k){return u=255&A.rgba,y(A,u*k/255)},o.toColorRGB=function(A){return[A.rgba>>24&255,A.rgba>>16&255,A.rgba>>8&255]}})(w||(h.color=w={})),(function(o){let y,A;try{const k=document.createElement("canvas");k.width=1,k.height=1;const R=k.getContext("2d",{willReadFrequently:!0});R&&(y=R,y.globalCompositeOperation="copy",A=y.createLinearGradient(0,0,1,1))}catch{}o.toColor=function(k){if(k.match(/#[\da-f]{3,8}/i))switch(k.length){case 4:return p=parseInt(k.slice(1,2).repeat(2),16),m=parseInt(k.slice(2,3).repeat(2),16),g=parseInt(k.slice(3,4).repeat(2),16),v.toColor(p,m,g);case 5:return p=parseInt(k.slice(1,2).repeat(2),16),m=parseInt(k.slice(2,3).repeat(2),16),g=parseInt(k.slice(3,4).repeat(2),16),u=parseInt(k.slice(4,5).repeat(2),16),v.toColor(p,m,g,u);case 7:return{css:k,rgba:(parseInt(k.slice(1),16)<<8|255)>>>0};case 9:return{css:k,rgba:parseInt(k.slice(1),16)>>>0}}const R=k.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return p=parseInt(R[1]),m=parseInt(R[2]),g=parseInt(R[3]),u=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),v.toColor(p,m,g,u);if(!y||!A)throw new Error("css.toColor: Unsupported css format");if(y.fillStyle=A,y.fillStyle=k,typeof y.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(y.fillRect(0,0,1,1),[p,m,g,u]=y.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:v.toRgba(p,m,g,u),css:k}}})(x||(h.css=x={})),(function(o){function y(A,k,R){const C=A/255,T=k/255,H=R/255;return .2126*(C<=.03928?C/12.92:Math.pow((C+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(H<=.03928?H/12.92:Math.pow((H+.055)/1.055,2.4))}o.relativeLuminance=function(A){return y(A>>16&255,A>>8&255,255&A)},o.relativeLuminance2=y})(b||(h.rgb=b={})),(function(o){function y(k,R,C){const T=k>>24&255,H=k>>16&255,I=k>>8&255;let W=R>>24&255,P=R>>16&255,Z=R>>8&255,te=l(b.relativeLuminance2(W,P,Z),b.relativeLuminance2(T,H,I));for(;te<C&&(W>0||P>0||Z>0);)W-=Math.max(0,Math.ceil(.1*W)),P-=Math.max(0,Math.ceil(.1*P)),Z-=Math.max(0,Math.ceil(.1*Z)),te=l(b.relativeLuminance2(W,P,Z),b.relativeLuminance2(T,H,I));return(W<<24|P<<16|Z<<8|255)>>>0}function A(k,R,C){const T=k>>24&255,H=k>>16&255,I=k>>8&255;let W=R>>24&255,P=R>>16&255,Z=R>>8&255,te=l(b.relativeLuminance2(W,P,Z),b.relativeLuminance2(T,H,I));for(;te<C&&(W<255||P<255||Z<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),P=Math.min(255,P+Math.ceil(.1*(255-P))),Z=Math.min(255,Z+Math.ceil(.1*(255-Z))),te=l(b.relativeLuminance2(W,P,Z),b.relativeLuminance2(T,H,I));return(W<<24|P<<16|Z<<8|255)>>>0}o.blend=function(k,R){if(u=(255&R)/255,u===1)return R;const C=R>>24&255,T=R>>16&255,H=R>>8&255,I=k>>24&255,W=k>>16&255,P=k>>8&255;return p=I+Math.round((C-I)*u),m=W+Math.round((T-W)*u),g=P+Math.round((H-P)*u),v.toRgba(p,m,g)},o.ensureContrastRatio=function(k,R,C){const T=b.relativeLuminance(k>>8),H=b.relativeLuminance(R>>8);if(l(T,H)<C){if(H<T){const P=y(k,R,C),Z=l(T,b.relativeLuminance(P>>8));if(Z<C){const te=A(k,R,C);return Z>l(T,b.relativeLuminance(te>>8))?P:te}return P}const I=A(k,R,C),W=l(T,b.relativeLuminance(I>>8));if(W<C){const P=y(k,R,C);return W>l(T,b.relativeLuminance(P>>8))?I:P}return I}},o.reduceLuminance=y,o.increaseLuminance=A,o.toChannels=function(k){return[k>>24&255,k>>16&255,k>>8&255,255&k]}})(d||(h.rgba=d={})),h.toPaddedHex=f,h.contrastRatio=l},8969:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.CoreTerminal=void 0;const m=p(844),g=p(2585),u=p(4348),v=p(7866),w=p(744),x=p(7302),b=p(6975),d=p(8460),f=p(1753),l=p(1480),o=p(7994),y=p(9282),A=p(5435),k=p(5981),R=p(2660);let C=!1;class T extends m.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new d.EventEmitter),this._onScroll.event((I=>{var W;(W=this._onScrollApi)==null||W.fire(I.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(I){for(const W in I)this.optionsService.options[W]=I[W]}constructor(I){super(),this._windowsWrappingHeuristics=this.register(new m.MutableDisposable),this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new d.EventEmitter),this._instantiationService=new u.InstantiationService,this.optionsService=this.register(new x.OptionsService(I)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(w.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(v.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(b.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(f.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(l.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(o.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,d.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,d.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,d.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,d.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((W=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new k.WriteBuffer(((W,P)=>this._inputHandler.parse(W,P)))),this.register((0,d.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(I,W){this._writeBuffer.write(I,W)}writeSync(I,W){this._logService.logLevel<=g.LogLevelEnum.WARN&&!C&&(this._logService.warn("writeSync is unreliable and will be removed soon."),C=!0),this._writeBuffer.writeSync(I,W)}input(I,W=!0){this.coreService.triggerDataEvent(I,W)}resize(I,W){isNaN(I)||isNaN(W)||(I=Math.max(I,w.MINIMUM_COLS),W=Math.max(W,w.MINIMUM_ROWS),this._bufferService.resize(I,W))}scroll(I,W=!1){this._bufferService.scroll(I,W)}scrollLines(I,W,P){this._bufferService.scrollLines(I,W,P)}scrollPages(I){this.scrollLines(I*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(I){const W=I-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(I,W){return this._inputHandler.registerEscHandler(I,W)}registerDcsHandler(I,W){return this._inputHandler.registerDcsHandler(I,W)}registerCsiHandler(I,W){return this._inputHandler.registerCsiHandler(I,W)}registerOscHandler(I,W){return this._inputHandler.registerOscHandler(I,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let I=!1;const W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?I=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(I=!0),I?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const I=[];I.push(this.onLineFeed(y.updateWindowsModeWrappedState.bind(null,this._bufferService))),I.push(this.registerCsiHandler({final:"H"},(()=>((0,y.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,m.toDisposable)((()=>{for(const W of I)W.dispose()}))}}}h.CoreTerminal=T},8460:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.runAndSubscribe=h.forwardEvent=h.EventEmitter=void 0,h.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=p=>(this._listeners.push(p),{dispose:()=>{if(!this._disposed){for(let m=0;m<this._listeners.length;m++)if(this._listeners[m]===p)return void this._listeners.splice(m,1)}}})),this._event}fire(p,m){const g=[];for(let u=0;u<this._listeners.length;u++)g.push(this._listeners[u]);for(let u=0;u<g.length;u++)g[u].call(void 0,p,m)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},h.forwardEvent=function(p,m){return p((g=>m.fire(g)))},h.runAndSubscribe=function(p,m){return m(void 0),p((g=>m(g)))}},5435:function(L,h,p){var m=this&&this.__decorate||function(V,M,$,D){var z,Q=arguments.length,ne=Q<3?M:D===null?D=Object.getOwnPropertyDescriptor(M,$):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(V,M,$,D);else for(var ve=V.length-1;ve>=0;ve--)(z=V[ve])&&(ne=(Q<3?z(ne):Q>3?z(M,$,ne):z(M,$))||ne);return Q>3&&ne&&Object.defineProperty(M,$,ne),ne},g=this&&this.__param||function(V,M){return function($,D){M($,D,V)}};Object.defineProperty(h,"__esModule",{value:!0}),h.InputHandler=h.WindowsOptionsReportType=void 0;const u=p(2584),v=p(7116),w=p(2015),x=p(844),b=p(482),d=p(8437),f=p(8460),l=p(643),o=p(511),y=p(3734),A=p(2585),k=p(1480),R=p(6242),C=p(6351),T=p(5941),H={"(":0,")":1,"*":2,"+":3,"-":1,".":2},I=131072;function W(V,M){if(V>24)return M.setWinLines||!1;switch(V){case 1:return!!M.restoreWin;case 2:return!!M.minimizeWin;case 3:return!!M.setWinPosition;case 4:return!!M.setWinSizePixels;case 5:return!!M.raiseWin;case 6:return!!M.lowerWin;case 7:return!!M.refreshWin;case 8:return!!M.setWinSizeChars;case 9:return!!M.maximizeWin;case 10:return!!M.fullscreenWin;case 11:return!!M.getWinState;case 13:return!!M.getWinPosition;case 14:return!!M.getWinSizePixels;case 15:return!!M.getScreenSizePixels;case 16:return!!M.getCellSizePixels;case 18:return!!M.getWinSizeChars;case 19:return!!M.getScreenSizeChars;case 20:return!!M.getIconTitle;case 21:return!!M.getWinTitle;case 22:return!!M.pushTitle;case 23:return!!M.popTitle;case 24:return!!M.setWinLines}return!1}var P;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(P||(h.WindowsOptionsReportType=P={}));let Z=0;class te extends x.Disposable{getAttrData(){return this._curAttrData}constructor(M,$,D,z,Q,ne,ve,Ce,X=new w.EscapeSequenceParser){super(),this._bufferService=M,this._charsetService=$,this._coreService=D,this._logService=z,this._optionsService=Q,this._oscLinkService=ne,this._coreMouseService=ve,this._unicodeService=Ce,this._parser=X,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new b.StringToUtf32,this._utf8Decoder=new b.Utf8ToUtf32,this._workCell=new o.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new f.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new f.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new f.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new f.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new f.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new f.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new f.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new f.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new f.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new f.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new f.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new f.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new F(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((O=>this._activeBuffer=O.activeBuffer))),this._parser.setCsiHandlerFallback(((O,ee)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(O),params:ee.toArray()})})),this._parser.setEscHandlerFallback((O=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(O)})})),this._parser.setExecuteHandlerFallback((O=>{this._logService.debug("Unknown EXECUTE code: ",{code:O})})),this._parser.setOscHandlerFallback(((O,ee,oe)=>{this._logService.debug("Unknown OSC code: ",{identifier:O,action:ee,data:oe})})),this._parser.setDcsHandlerFallback(((O,ee,oe)=>{ee==="HOOK"&&(oe=oe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(O),action:ee,payload:oe})})),this._parser.setPrintHandler(((O,ee,oe)=>this.print(O,ee,oe))),this._parser.registerCsiHandler({final:"@"},(O=>this.insertChars(O))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(O=>this.scrollLeft(O))),this._parser.registerCsiHandler({final:"A"},(O=>this.cursorUp(O))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(O=>this.scrollRight(O))),this._parser.registerCsiHandler({final:"B"},(O=>this.cursorDown(O))),this._parser.registerCsiHandler({final:"C"},(O=>this.cursorForward(O))),this._parser.registerCsiHandler({final:"D"},(O=>this.cursorBackward(O))),this._parser.registerCsiHandler({final:"E"},(O=>this.cursorNextLine(O))),this._parser.registerCsiHandler({final:"F"},(O=>this.cursorPrecedingLine(O))),this._parser.registerCsiHandler({final:"G"},(O=>this.cursorCharAbsolute(O))),this._parser.registerCsiHandler({final:"H"},(O=>this.cursorPosition(O))),this._parser.registerCsiHandler({final:"I"},(O=>this.cursorForwardTab(O))),this._parser.registerCsiHandler({final:"J"},(O=>this.eraseInDisplay(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(O=>this.eraseInDisplay(O,!0))),this._parser.registerCsiHandler({final:"K"},(O=>this.eraseInLine(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(O=>this.eraseInLine(O,!0))),this._parser.registerCsiHandler({final:"L"},(O=>this.insertLines(O))),this._parser.registerCsiHandler({final:"M"},(O=>this.deleteLines(O))),this._parser.registerCsiHandler({final:"P"},(O=>this.deleteChars(O))),this._parser.registerCsiHandler({final:"S"},(O=>this.scrollUp(O))),this._parser.registerCsiHandler({final:"T"},(O=>this.scrollDown(O))),this._parser.registerCsiHandler({final:"X"},(O=>this.eraseChars(O))),this._parser.registerCsiHandler({final:"Z"},(O=>this.cursorBackwardTab(O))),this._parser.registerCsiHandler({final:"`"},(O=>this.charPosAbsolute(O))),this._parser.registerCsiHandler({final:"a"},(O=>this.hPositionRelative(O))),this._parser.registerCsiHandler({final:"b"},(O=>this.repeatPrecedingCharacter(O))),this._parser.registerCsiHandler({final:"c"},(O=>this.sendDeviceAttributesPrimary(O))),this._parser.registerCsiHandler({prefix:">",final:"c"},(O=>this.sendDeviceAttributesSecondary(O))),this._parser.registerCsiHandler({final:"d"},(O=>this.linePosAbsolute(O))),this._parser.registerCsiHandler({final:"e"},(O=>this.vPositionRelative(O))),this._parser.registerCsiHandler({final:"f"},(O=>this.hVPosition(O))),this._parser.registerCsiHandler({final:"g"},(O=>this.tabClear(O))),this._parser.registerCsiHandler({final:"h"},(O=>this.setMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(O=>this.setModePrivate(O))),this._parser.registerCsiHandler({final:"l"},(O=>this.resetMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(O=>this.resetModePrivate(O))),this._parser.registerCsiHandler({final:"m"},(O=>this.charAttributes(O))),this._parser.registerCsiHandler({final:"n"},(O=>this.deviceStatus(O))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(O=>this.deviceStatusPrivate(O))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(O=>this.softReset(O))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(O=>this.setCursorStyle(O))),this._parser.registerCsiHandler({final:"r"},(O=>this.setScrollRegion(O))),this._parser.registerCsiHandler({final:"s"},(O=>this.saveCursor(O))),this._parser.registerCsiHandler({final:"t"},(O=>this.windowOptions(O))),this._parser.registerCsiHandler({final:"u"},(O=>this.restoreCursor(O))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(O=>this.insertColumns(O))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(O=>this.deleteColumns(O))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(O=>this.selectProtected(O))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(O=>this.requestMode(O,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(O=>this.requestMode(O,!1))),this._parser.setExecuteHandler(u.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(u.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(u.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(u.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(u.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(u.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(u.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(u.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(u.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(u.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((O=>(this.setTitle(O),this.setIconName(O),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((O=>this.setIconName(O)))),this._parser.registerOscHandler(2,new R.OscHandler((O=>this.setTitle(O)))),this._parser.registerOscHandler(4,new R.OscHandler((O=>this.setOrReportIndexedColor(O)))),this._parser.registerOscHandler(8,new R.OscHandler((O=>this.setHyperlink(O)))),this._parser.registerOscHandler(10,new R.OscHandler((O=>this.setOrReportFgColor(O)))),this._parser.registerOscHandler(11,new R.OscHandler((O=>this.setOrReportBgColor(O)))),this._parser.registerOscHandler(12,new R.OscHandler((O=>this.setOrReportCursorColor(O)))),this._parser.registerOscHandler(104,new R.OscHandler((O=>this.restoreIndexedColor(O)))),this._parser.registerOscHandler(110,new R.OscHandler((O=>this.restoreFgColor(O)))),this._parser.registerOscHandler(111,new R.OscHandler((O=>this.restoreBgColor(O)))),this._parser.registerOscHandler(112,new R.OscHandler((O=>this.restoreCursorColor(O)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const O in v.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:O},(()=>this.selectCharset("("+O))),this._parser.registerEscHandler({intermediates:")",final:O},(()=>this.selectCharset(")"+O))),this._parser.registerEscHandler({intermediates:"*",final:O},(()=>this.selectCharset("*"+O))),this._parser.registerEscHandler({intermediates:"+",final:O},(()=>this.selectCharset("+"+O))),this._parser.registerEscHandler({intermediates:"-",final:O},(()=>this.selectCharset("-"+O))),this._parser.registerEscHandler({intermediates:".",final:O},(()=>this.selectCharset("."+O))),this._parser.registerEscHandler({intermediates:"/",final:O},(()=>this.selectCharset("/"+O)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((O=>(this._logService.error("Parsing error: ",O),O))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new C.DcsHandler(((O,ee)=>this.requestStatusString(O,ee))))}_preserveStack(M,$,D,z){this._parseStack.paused=!0,this._parseStack.cursorStartX=M,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=D,this._parseStack.position=z}_logSlowResolvingAsync(M){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([M,new Promise((($,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch(($=>{if($!=="#SLOW_TIMEOUT")throw $;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(M,$){let D,z=this._activeBuffer.x,Q=this._activeBuffer.y,ne=0;const ve=this._parseStack.paused;if(ve){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(D),D;z=this._parseStack.cursorStartX,Q=this._parseStack.cursorStartY,this._parseStack.paused=!1,M.length>I&&(ne=this._parseStack.position+I)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof M=="string"?` "${M}"`:` "${Array.prototype.map.call(M,(O=>String.fromCharCode(O))).join("")}"`),typeof M=="string"?M.split("").map((O=>O.charCodeAt(0))):M),this._parseBuffer.length<M.length&&this._parseBuffer.length<I&&(this._parseBuffer=new Uint32Array(Math.min(M.length,I))),ve||this._dirtyRowTracker.clearRange(),M.length>I)for(let O=ne;O<M.length;O+=I){const ee=O+I<M.length?O+I:M.length,oe=typeof M=="string"?this._stringDecoder.decode(M.substring(O,ee),this._parseBuffer):this._utf8Decoder.decode(M.subarray(O,ee),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,oe))return this._preserveStack(z,Q,oe,O),this._logSlowResolvingAsync(D),D}else if(!ve){const O=typeof M=="string"?this._stringDecoder.decode(M,this._parseBuffer):this._utf8Decoder.decode(M,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,O))return this._preserveStack(z,Q,O,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===z&&this._activeBuffer.y===Q||this._onCursorMove.fire();const Ce=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),X=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);X<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(X,this._bufferService.rows-1),Math.min(Ce,this._bufferService.rows-1))}print(M,$,D){let z,Q;const ne=this._charsetService.charset,ve=this._optionsService.rawOptions.screenReaderMode,Ce=this._bufferService.cols,X=this._coreService.decPrivateModes.wraparound,O=this._coreService.modes.insertMode,ee=this._curAttrData;let oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-$>0&&oe.getWidth(this._activeBuffer.x-1)===2&&oe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ee);let Se=this._parser.precedingJoinState;for(let ge=$;ge<D;++ge){if(z=M[ge],z<127&&ne){const Ke=ne[String.fromCharCode(z)];Ke&&(z=Ke.charCodeAt(0))}const Oe=this._unicodeService.charProperties(z,Se);Q=k.UnicodeService.extractWidth(Oe);const Me=k.UnicodeService.extractShouldJoin(Oe),Pe=Me?k.UnicodeService.extractWidth(Se):0;if(Se=Oe,ve&&this._onA11yChar.fire((0,b.stringFromCodePoint)(z)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Q-Pe>Ce){if(X){const Ke=oe;let Re=this._activeBuffer.x-Pe;for(this._activeBuffer.x=Pe,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Pe>0&&oe instanceof d.BufferLine&&oe.copyCellsFrom(Ke,Re,0,Pe,!1);Re<Ce;)Ke.setCellFromCodepoint(Re++,0,1,ee)}else if(this._activeBuffer.x=Ce-1,Q===2)continue}if(Me&&this._activeBuffer.x){const Ke=oe.getWidth(this._activeBuffer.x-1)?1:2;oe.addCodepointToCell(this._activeBuffer.x-Ke,z,Q);for(let Re=Q-Pe;--Re>=0;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}else if(O&&(oe.insertCells(this._activeBuffer.x,Q-Pe,this._activeBuffer.getNullCell(ee)),oe.getWidth(Ce-1)===2&&oe.setCellFromCodepoint(Ce-1,l.NULL_CELL_CODE,l.NULL_CELL_WIDTH,ee)),oe.setCellFromCodepoint(this._activeBuffer.x++,z,Q,ee),Q>0)for(;--Q;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ee)}this._parser.precedingJoinState=Se,this._activeBuffer.x<Ce&&D-$>0&&oe.getWidth(this._activeBuffer.x)===0&&!oe.hasContent(this._activeBuffer.x)&&oe.setCellFromCodepoint(this._activeBuffer.x,0,1,ee),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(M,$){return M.final!=="t"||M.prefix||M.intermediates?this._parser.registerCsiHandler(M,$):this._parser.registerCsiHandler(M,(D=>!W(D.params[0],this._optionsService.rawOptions.windowOptions)||$(D)))}registerDcsHandler(M,$){return this._parser.registerDcsHandler(M,new C.DcsHandler($))}registerEscHandler(M,$){return this._parser.registerEscHandler(M,$)}registerOscHandler(M,$){return this._parser.registerOscHandler(M,new R.OscHandler($))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var M;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((M=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&M.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);$.hasWidth(this._activeBuffer.x)&&!$.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const M=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-M),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(M=this._bufferService.cols-1){this._activeBuffer.x=Math.min(M,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(M,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=M,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=M,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(M,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+M,this._activeBuffer.y+$)}cursorUp(M){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,M.params[0]||1)):this._moveCursor(0,-(M.params[0]||1)),!0}cursorDown(M){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,M.params[0]||1)):this._moveCursor(0,M.params[0]||1),!0}cursorForward(M){return this._moveCursor(M.params[0]||1,0),!0}cursorBackward(M){return this._moveCursor(-(M.params[0]||1),0),!0}cursorNextLine(M){return this.cursorDown(M),this._activeBuffer.x=0,!0}cursorPrecedingLine(M){return this.cursorUp(M),this._activeBuffer.x=0,!0}cursorCharAbsolute(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(M){return this._setCursor(M.length>=2?(M.params[1]||1)-1:0,(M.params[0]||1)-1),!0}charPosAbsolute(M){return this._setCursor((M.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(M){return this._moveCursor(M.params[0]||1,0),!0}linePosAbsolute(M){return this._setCursor(this._activeBuffer.x,(M.params[0]||1)-1),!0}vPositionRelative(M){return this._moveCursor(0,M.params[0]||1),!0}hVPosition(M){return this.cursorPosition(M),!0}tabClear(M){const $=M.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=M.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(M){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=M.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(M){const $=M.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(M,$,D,z=!1,Q=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);ne.replaceCells($,D,this._activeBuffer.getNullCell(this._eraseAttrData()),Q),z&&(ne.isWrapped=!1)}_resetBufferLine(M,$=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+M),D.isWrapped=!1)}eraseInDisplay(M,$=!1){let D;switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);D<this._bufferService.rows;D++)this._resetBufferLine(D,$);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,$),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,$);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,$);this._dirtyRowTracker.markDirty(0);break;case 3:const z=this._activeBuffer.lines.length-this._bufferService.rows;z>0&&(this._activeBuffer.lines.trimStart(z),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-z,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-z,0),this._onScroll.fire(0))}return!0}eraseInLine(M,$=!1){switch(this._restrictCursor(this._bufferService.cols),M.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,$);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,$)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(M){this._restrictCursor();let $=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y,z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Q=this._bufferService.rows-1+this._activeBuffer.ybase-z+1;for(;$--;)this._activeBuffer.lines.splice(Q-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(M){this._restrictCursor();let $=M.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y;let z;for(z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-z;$--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(M){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.insertCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(M){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.deleteCells(this._activeBuffer.x,M.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(M){let $=M.params[0]||1;for(;$--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(M){let $=M.params[0]||1;for(;$--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(d.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=M.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);z.deleteCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=M.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);z.insertCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=M.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);z.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(M){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=M.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);z.deleteCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(M){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(M.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(M){const $=this._parser.precedingJoinState;if(!$)return!0;const D=M.params[0]||1,z=k.UnicodeService.extractWidth($),Q=this._activeBuffer.x-z,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Q),ve=new Uint32Array(ne.length*D);let Ce=0;for(let O=0;O<ne.length;){const ee=ne.codePointAt(O)||0;ve[Ce++]=ee,O+=ee>65535?2:1}let X=Ce;for(let O=1;O<D;++O)ve.copyWithin(X,0,Ce),X+=Ce;return this.print(ve,0,X),!0}sendDeviceAttributesPrimary(M){return M.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(u.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(u.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(M){return M.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(u.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(u.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(M.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(M){return(this._optionsService.rawOptions.termName+"").indexOf(M)===0}setMode(M){for(let $=0;$<M.length;$++)switch(M.params[$]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(M){for(let $=0;$<M.length;$++)switch(M.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),this._charsetService.setgCharset(1,v.DEFAULT_CHARSET),this._charsetService.setgCharset(2,v.DEFAULT_CHARSET),this._charsetService.setgCharset(3,v.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(M){for(let $=0;$<M.length;$++)switch(M.params[$]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(M){for(let $=0;$<M.length;$++)switch(M.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),M.params[$]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(M,$){const D=this._coreService.decPrivateModes,{activeProtocol:z,activeEncoding:Q}=this._coreMouseService,ne=this._coreService,{buffers:ve,cols:Ce}=this._bufferService,{active:X,alt:O}=ve,ee=this._optionsService.rawOptions,oe=Me=>Me?1:2,Se=M.params[0];return ge=Se,Oe=$?Se===2?4:Se===4?oe(ne.modes.insertMode):Se===12?3:Se===20?oe(ee.convertEol):0:Se===1?oe(D.applicationCursorKeys):Se===3?ee.windowOptions.setWinLines?Ce===80?2:Ce===132?1:0:0:Se===6?oe(D.origin):Se===7?oe(D.wraparound):Se===8?3:Se===9?oe(z==="X10"):Se===12?oe(ee.cursorBlink):Se===25?oe(!ne.isCursorHidden):Se===45?oe(D.reverseWraparound):Se===66?oe(D.applicationKeypad):Se===67?4:Se===1e3?oe(z==="VT200"):Se===1002?oe(z==="DRAG"):Se===1003?oe(z==="ANY"):Se===1004?oe(D.sendFocus):Se===1005?4:Se===1006?oe(Q==="SGR"):Se===1015?4:Se===1016?oe(Q==="SGR_PIXELS"):Se===1048?1:Se===47||Se===1047||Se===1049?oe(X===O):Se===2004?oe(D.bracketedPasteMode):0,ne.triggerDataEvent(`${u.C0.ESC}[${$?"":"?"}${ge};${Oe}$y`),!0;var ge,Oe}_updateAttrColor(M,$,D,z,Q){return $===2?(M|=50331648,M&=-16777216,M|=y.AttributeData.fromColorRGB([D,z,Q])):$===5&&(M&=-50331904,M|=33554432|255&D),M}_extractColor(M,$,D){const z=[0,0,-1,0,0,0];let Q=0,ne=0;do{if(z[ne+Q]=M.params[$+ne],M.hasSubParams($+ne)){const ve=M.getSubParams($+ne);let Ce=0;do z[1]===5&&(Q=1),z[ne+Ce+1+Q]=ve[Ce];while(++Ce<ve.length&&Ce+ne+1+Q<z.length);break}if(z[1]===5&&ne+Q>=2||z[1]===2&&ne+Q>=5)break;z[1]&&(Q=1)}while(++ne+$<M.length&&ne+Q<z.length);for(let ve=2;ve<z.length;++ve)z[ve]===-1&&(z[ve]=0);switch(z[0]){case 38:D.fg=this._updateAttrColor(D.fg,z[1],z[3],z[4],z[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,z[1],z[3],z[4],z[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,z[1],z[3],z[4],z[5])}return ne}_processUnderline(M,$){$.extended=$.extended.clone(),(!~M||M>5)&&(M=1),$.extended.underlineStyle=M,$.fg|=268435456,M===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(M){M.fg=d.DEFAULT_ATTR_DATA.fg,M.bg=d.DEFAULT_ATTR_DATA.bg,M.extended=M.extended.clone(),M.extended.underlineStyle=0,M.extended.underlineColor&=-67108864,M.updateExtended()}charAttributes(M){if(M.length===1&&M.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=M.length;let D;const z=this._curAttrData;for(let Q=0;Q<$;Q++)D=M.params[Q],D>=30&&D<=37?(z.fg&=-50331904,z.fg|=16777216|D-30):D>=40&&D<=47?(z.bg&=-50331904,z.bg|=16777216|D-40):D>=90&&D<=97?(z.fg&=-50331904,z.fg|=16777224|D-90):D>=100&&D<=107?(z.bg&=-50331904,z.bg|=16777224|D-100):D===0?this._processSGR0(z):D===1?z.fg|=134217728:D===3?z.bg|=67108864:D===4?(z.fg|=268435456,this._processUnderline(M.hasSubParams(Q)?M.getSubParams(Q)[0]:1,z)):D===5?z.fg|=536870912:D===7?z.fg|=67108864:D===8?z.fg|=1073741824:D===9?z.fg|=2147483648:D===2?z.bg|=134217728:D===21?this._processUnderline(2,z):D===22?(z.fg&=-134217729,z.bg&=-134217729):D===23?z.bg&=-67108865:D===24?(z.fg&=-268435457,this._processUnderline(0,z)):D===25?z.fg&=-536870913:D===27?z.fg&=-67108865:D===28?z.fg&=-1073741825:D===29?z.fg&=2147483647:D===39?(z.fg&=-67108864,z.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):D===49?(z.bg&=-67108864,z.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?Q+=this._extractColor(M,Q,z):D===53?z.bg|=1073741824:D===55?z.bg&=-1073741825:D===59?(z.extended=z.extended.clone(),z.extended.underlineColor=-1,z.updateExtended()):D===100?(z.fg&=-67108864,z.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,z.bg&=-67108864,z.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(M){switch(M.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${$};${D}R`)}return!0}deviceStatusPrivate(M){if(M.params[0]===6){const $=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${$};${D}R`)}return!0}softReset(M){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(M){const $=M.params[0]||1;switch($){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const D=$%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(M){const $=M.params[0]||1;let D;return(M.length<2||(D=M.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>$&&(this._activeBuffer.scrollTop=$-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(M){if(!W(M.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=M.length>1?M.params[1]:0;switch(M.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(P.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(P.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${u.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:$!==0&&$!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),$!==0&&$!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:$!==0&&$!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),$!==0&&$!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(M){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(M){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(M){return this._windowTitle=M,this._onTitleChange.fire(M),!0}setIconName(M){return this._iconName=M,!0}setOrReportIndexedColor(M){const $=[],D=M.split(";");for(;D.length>1;){const z=D.shift(),Q=D.shift();if(/^\d+$/.exec(z)){const ne=parseInt(z);if(Y(ne))if(Q==="?")$.push({type:0,index:ne});else{const ve=(0,T.parseColor)(Q);ve&&$.push({type:1,index:ne,color:ve})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(M){const $=M.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(M,$){this._getCurrentLinkId()&&this._finishHyperlink();const D=M.split(":");let z;const Q=D.findIndex((ne=>ne.startsWith("id=")));return Q!==-1&&(z=D[Q].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:z,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(M,$){const D=M.split(";");for(let z=0;z<D.length&&!($>=this._specialColors.length);++z,++$)if(D[z]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const Q=(0,T.parseColor)(D[z]);Q&&this._onColor.fire([{type:1,index:this._specialColors[$],color:Q}])}return!0}setOrReportFgColor(M){return this._setOrReportSpecialColor(M,0)}setOrReportBgColor(M){return this._setOrReportSpecialColor(M,1)}setOrReportCursorColor(M){return this._setOrReportSpecialColor(M,2)}restoreIndexedColor(M){if(!M)return this._onColor.fire([{type:2}]),!0;const $=[],D=M.split(";");for(let z=0;z<D.length;++z)if(/^\d+$/.exec(D[z])){const Q=parseInt(D[z]);Y(Q)&&$.push({type:2,index:Q})}return $.length&&this._onColor.fire($),!0}restoreFgColor(M){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(M){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(M){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,v.DEFAULT_CHARSET),!0}selectCharset(M){return M.length!==2?(this.selectDefaultCharset(),!0):(M[0]==="/"||this._charsetService.setgCharset(H[M[0]],v.CHARSETS[M[1]]||v.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const M=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,M,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(M){return this._charsetService.setgLevel(M),!0}screenAlignmentPattern(){const M=new o.CellData;M.content=4194373,M.fg=this._curAttrData.fg,M.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$<this._bufferService.rows;++$){const D=this._activeBuffer.ybase+this._activeBuffer.y+$,z=this._activeBuffer.lines.get(D);z&&(z.fill(M),z.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(M,$){const D=this._bufferService.buffer,z=this._optionsService.rawOptions;return(Q=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${Q}${u.C0.ESC}\\`),!0))(M==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:M==='"p'?'P1$r61;1"p':M==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:M==="m"?"P1$r0m":M===" q"?`P1$r${{block:2,underline:4,bar:6}[z.cursorStyle]-(z.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(M,$){this._dirtyRowTracker.markRangeDirty(M,$)}}h.InputHandler=te;let F=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,M){V>M&&(Z=V,V=M,M=Z),V<this.start&&(this.start=V),M>this.end&&(this.end=M)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(V){return 0<=V&&V<256}F=m([g(0,A.IBufferService)],F)},844:(L,h)=>{function p(m){for(const g of m)g.dispose();m.length=0}Object.defineProperty(h,"__esModule",{value:!0}),h.getDisposeArrayDisposable=h.disposeArray=h.toDisposable=h.MutableDisposable=h.Disposable=void 0,h.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const m of this._disposables)m.dispose();this._disposables.length=0}register(m){return this._disposables.push(m),m}unregister(m){const g=this._disposables.indexOf(m);g!==-1&&this._disposables.splice(g,1)}},h.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(m){var g;this._isDisposed||m===this._value||((g=this._value)==null||g.dispose(),this._value=m)}clear(){this.value=void 0}dispose(){var m;this._isDisposed=!0,(m=this._value)==null||m.dispose(),this._value=void 0}},h.toDisposable=function(m){return{dispose:m}},h.disposeArray=p,h.getDisposeArrayDisposable=function(m){return{dispose:()=>p(m)}}},1505:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.FourKeyMap=h.TwoKeyMap=void 0;class p{constructor(){this._data={}}set(g,u,v){this._data[g]||(this._data[g]={}),this._data[g][u]=v}get(g,u){return this._data[g]?this._data[g][u]:void 0}clear(){this._data={}}}h.TwoKeyMap=p,h.FourKeyMap=class{constructor(){this._data=new p}set(m,g,u,v,w){this._data.get(m,g)||this._data.set(m,g,new p),this._data.get(m,g).set(u,v,w)}get(m,g,u,v){var w;return(w=this._data.get(m,g))==null?void 0:w.get(u,v)}clear(){this._data.clear()}}},6114:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.isChromeOS=h.isLinux=h.isWindows=h.isIphone=h.isIpad=h.isMac=h.getSafariVersion=h.isSafari=h.isLegacyEdge=h.isFirefox=h.isNode=void 0,h.isNode=typeof process<"u"&&"title"in process;const p=h.isNode?"node":navigator.userAgent,m=h.isNode?"node":navigator.platform;h.isFirefox=p.includes("Firefox"),h.isLegacyEdge=p.includes("Edge"),h.isSafari=/^((?!chrome|android).)*safari/i.test(p),h.getSafariVersion=function(){if(!h.isSafari)return 0;const g=p.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},h.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(m),h.isIpad=m==="iPad",h.isIphone=m==="iPhone",h.isWindows=["Windows","Win16","Win32","WinCE"].includes(m),h.isLinux=m.indexOf("Linux")>=0,h.isChromeOS=/\bCrOS\b/.test(p)},6106:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.SortedList=void 0;let p=0;h.SortedList=class{constructor(m){this._getKey=m,this._array=[]}clear(){this._array.length=0}insert(m){this._array.length!==0?(p=this._search(this._getKey(m)),this._array.splice(p,0,m)):this._array.push(m)}delete(m){if(this._array.length===0)return!1;const g=this._getKey(m);if(g===void 0||(p=this._search(g),p===-1)||this._getKey(this._array[p])!==g)return!1;do if(this._array[p]===m)return this._array.splice(p,1),!0;while(++p<this._array.length&&this._getKey(this._array[p])===g);return!1}*getKeyIterator(m){if(this._array.length!==0&&(p=this._search(m),!(p<0||p>=this._array.length)&&this._getKey(this._array[p])===m))do yield this._array[p];while(++p<this._array.length&&this._getKey(this._array[p])===m)}forEachByKey(m,g){if(this._array.length!==0&&(p=this._search(m),!(p<0||p>=this._array.length)&&this._getKey(this._array[p])===m))do g(this._array[p]);while(++p<this._array.length&&this._getKey(this._array[p])===m)}values(){return[...this._array].values()}_search(m){let g=0,u=this._array.length-1;for(;u>=g;){let v=g+u>>1;const w=this._getKey(this._array[v]);if(w>m)u=v-1;else{if(!(w<m)){for(;v>0&&this._getKey(this._array[v-1])===m;)v--;return v}g=v+1}}return g}}},7226:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.DebouncedIdleTask=h.IdleTaskQueue=h.PriorityTaskQueue=void 0;const m=p(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(w){this._tasks.push(w),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(w){this._idleCallback=void 0;let x=0,b=0,d=w.timeRemaining(),f=0;for(;this._i<this._tasks.length;){if(x=Date.now(),this._tasks[this._i]()||this._i++,x=Math.max(1,Date.now()-x),b=Math.max(x,b),f=w.timeRemaining(),1.5*b>f)return d-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-x))}ms`),void this._start();d=f}this.clear()}}class u extends g{_requestCallback(w){return setTimeout((()=>w(this._createDeadline(16))))}_cancelCallback(w){clearTimeout(w)}_createDeadline(w){const x=Date.now()+w;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}h.PriorityTaskQueue=u,h.IdleTaskQueue=!m.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(v){return requestIdleCallback(v)}_cancelCallback(v){cancelIdleCallback(v)}}:u,h.DebouncedIdleTask=class{constructor(){this._queue=new h.IdleTaskQueue}set(v){this._queue.clear(),this._queue.enqueue(v)}flush(){this._queue.flush()}}},9282:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.updateWindowsModeWrappedState=void 0;const m=p(643);h.updateWindowsModeWrappedState=function(g){const u=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),v=u==null?void 0:u.get(g.cols-1),w=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);w&&v&&(w.isWrapped=v[m.CHAR_DATA_CODE_INDEX]!==m.NULL_CELL_CODE&&v[m.CHAR_DATA_CODE_INDEX]!==m.WHITESPACE_CELL_CODE)}},3734:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ExtendedAttrs=h.AttributeData=void 0;class p{constructor(){this.fg=0,this.bg=0,this.extended=new m}static toColorRGB(u){return[u>>>16&255,u>>>8&255,255&u]}static fromColorRGB(u){return(255&u[0])<<16|(255&u[1])<<8|255&u[2]}clone(){const u=new p;return u.fg=this.fg,u.bg=this.bg,u.extended=this.extended.clone(),u}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}h.AttributeData=p;class m{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(u){this._ext=u}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(u){this._ext&=-469762049,this._ext|=u<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(u){this._ext&=-67108864,this._ext|=67108863&u}get urlId(){return this._urlId}set urlId(u){this._urlId=u}get underlineVariantOffset(){const u=(3758096384&this._ext)>>29;return u<0?4294967288^u:u}set underlineVariantOffset(u){this._ext&=536870911,this._ext|=u<<29&3758096384}constructor(u=0,v=0){this._ext=0,this._urlId=0,this._ext=u,this._urlId=v}clone(){return new m(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}h.ExtendedAttrs=m},9092:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Buffer=h.MAX_BUFFER_SIZE=void 0;const m=p(6349),g=p(7226),u=p(3734),v=p(8437),w=p(4634),x=p(511),b=p(643),d=p(4863),f=p(7116);h.MAX_BUFFER_SIZE=4294967295,h.Buffer=class{constructor(l,o,y){this._hasScrollback=l,this._optionsService=o,this._bufferService=y,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=f.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,b.NULL_CELL_CHAR,b.NULL_CELL_WIDTH,b.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,b.WHITESPACE_CELL_CHAR,b.WHITESPACE_CELL_WIDTH,b.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(l){return l?(this._nullCell.fg=l.fg,this._nullCell.bg=l.bg,this._nullCell.extended=l.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(l){return l?(this._whitespaceCell.fg=l.fg,this._whitespaceCell.bg=l.bg,this._whitespaceCell.extended=l.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(l,o){return new v.BufferLine(this._bufferService.cols,this.getNullCell(l),o)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const l=this.ybase+this.y-this.ydisp;return l>=0&&l<this._rows}_getCorrectBufferLength(l){if(!this._hasScrollback)return l;const o=l+this._optionsService.rawOptions.scrollback;return o>h.MAX_BUFFER_SIZE?h.MAX_BUFFER_SIZE:o}fillViewportRows(l){if(this.lines.length===0){l===void 0&&(l=v.DEFAULT_ATTR_DATA);let o=this._rows;for(;o--;)this.lines.push(this.getBlankLine(l))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new m.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(l,o){const y=this.getNullCell(v.DEFAULT_ATTR_DATA);let A=0;const k=this._getCorrectBufferLength(o);if(k>this.lines.maxLength&&(this.lines.maxLength=k),this.lines.length>0){if(this._cols<l)for(let C=0;C<this.lines.length;C++)A+=+this.lines.get(C).resize(l,y);let R=0;if(this._rows<o)for(let C=this._rows;C<o;C++)this.lines.length<o+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new v.BufferLine(l,y)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new v.BufferLine(l,y)));else for(let C=this._rows;C>o;C--)this.lines.length>o+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(k<this.lines.maxLength){const C=this.lines.length-k;C>0&&(this.lines.trimStart(C),this.ybase=Math.max(this.ybase-C,0),this.ydisp=Math.max(this.ydisp-C,0),this.savedY=Math.max(this.savedY-C,0)),this.lines.maxLength=k}this.x=Math.min(this.x,l-1),this.y=Math.min(this.y,o-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,l-1),this.scrollTop=0}if(this.scrollBottom=o-1,this._isReflowEnabled&&(this._reflow(l,o),this._cols>l))for(let R=0;R<this.lines.length;R++)A+=+this.lines.get(R).resize(l,y);this._cols=l,this._rows=o,this._memoryCleanupQueue.clear(),A>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let l=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,l=!1);let o=0;for(;this._memoryCleanupPosition<this.lines.length;)if(o+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),o>100)return!0;return l}get _isReflowEnabled(){const l=this._optionsService.rawOptions.windowsPty;return l&&l.buildNumber?this._hasScrollback&&l.backend==="conpty"&&l.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(l,o){this._cols!==l&&(l>this._cols?this._reflowLarger(l,o):this._reflowSmaller(l,o))}_reflowLarger(l,o){const y=(0,w.reflowLargerGetLinesToRemove)(this.lines,this._cols,l,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(y.length>0){const A=(0,w.reflowLargerCreateNewLayout)(this.lines,y);(0,w.reflowLargerApplyNewLayout)(this.lines,A.layout),this._reflowLargerAdjustViewport(l,o,A.countRemoved)}}_reflowLargerAdjustViewport(l,o,y){const A=this.getNullCell(v.DEFAULT_ATTR_DATA);let k=y;for(;k-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<o&&this.lines.push(new v.BufferLine(l,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-y,0)}_reflowSmaller(l,o){const y=this.getNullCell(v.DEFAULT_ATTR_DATA),A=[];let k=0;for(let R=this.lines.length-1;R>=0;R--){let C=this.lines.get(R);if(!C||!C.isWrapped&&C.getTrimmedLength()<=l)continue;const T=[C];for(;C.isWrapped&&R>0;)C=this.lines.get(--R),T.unshift(C);const H=this.ybase+this.y;if(H>=R&&H<R+T.length)continue;const I=T[T.length-1].getTrimmedLength(),W=(0,w.reflowSmallerGetNewLineLengths)(T,this._cols,l),P=W.length-T.length;let Z;Z=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+P):Math.max(0,this.lines.length-this.lines.maxLength+P);const te=[];for(let D=0;D<P;D++){const z=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);te.push(z)}te.length>0&&(A.push({start:R+T.length+k,newLines:te}),k+=te.length),T.push(...te);let F=W.length-1,Y=W[F];Y===0&&(F--,Y=W[F]);let V=T.length-P-1,M=I;for(;V>=0;){const D=Math.min(M,Y);if(T[F]===void 0)break;if(T[F].copyCellsFrom(T[V],M-D,Y-D,D,!0),Y-=D,Y===0&&(F--,Y=W[F]),M-=D,M===0){V--;const z=Math.max(V,0);M=(0,w.getWrappedLineTrimmedLength)(T,z,this._cols)}}for(let D=0;D<T.length;D++)W[D]<l&&T[D].setCell(W[D],y);let $=P-Z;for(;$-- >0;)this.ybase===0?this.y<o-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+k)-o&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+o-1)}if(A.length>0){const R=[],C=[];for(let F=0;F<this.lines.length;F++)C.push(this.lines.get(F));const T=this.lines.length;let H=T-1,I=0,W=A[I];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+k);let P=0;for(let F=Math.min(this.lines.maxLength-1,T+k-1);F>=0;F--)if(W&&W.start>H+P){for(let Y=W.newLines.length-1;Y>=0;Y--)this.lines.set(F--,W.newLines[Y]);F++,R.push({index:H+1,amount:W.newLines.length}),P+=W.newLines.length,W=A[++I]}else this.lines.set(F,C[H--]);let Z=0;for(let F=R.length-1;F>=0;F--)R[F].index+=Z,this.lines.onInsertEmitter.fire(R[F]),Z+=R[F].amount;const te=Math.max(0,T+k-this.lines.maxLength);te>0&&this.lines.onTrimEmitter.fire(te)}}translateBufferLineToString(l,o,y=0,A){const k=this.lines.get(l);return k?k.translateToString(o,y,A):""}getWrappedRangeForLine(l){let o=l,y=l;for(;o>0&&this.lines.get(o).isWrapped;)o--;for(;y+1<this.lines.length&&this.lines.get(y+1).isWrapped;)y++;return{first:o,last:y}}setupTabStops(l){for(l!=null?this.tabs[l]||(l=this.prevStop(l)):(this.tabs={},l=0);l<this._cols;l+=this._optionsService.rawOptions.tabStopWidth)this.tabs[l]=!0}prevStop(l){for(l==null&&(l=this.x);!this.tabs[--l]&&l>0;);return l>=this._cols?this._cols-1:l<0?0:l}nextStop(l){for(l==null&&(l=this.x);!this.tabs[++l]&&l<this._cols;);return l>=this._cols?this._cols-1:l<0?0:l}clearMarkers(l){this._isClearing=!0;for(let o=0;o<this.markers.length;o++)this.markers[o].line===l&&(this.markers[o].dispose(),this.markers.splice(o--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let l=0;l<this.markers.length;l++)this.markers[l].dispose(),this.markers.splice(l--,1);this._isClearing=!1}addMarker(l){const o=new d.Marker(l);return this.markers.push(o),o.register(this.lines.onTrim((y=>{o.line-=y,o.line<0&&o.dispose()}))),o.register(this.lines.onInsert((y=>{o.line>=y.index&&(o.line+=y.amount)}))),o.register(this.lines.onDelete((y=>{o.line>=y.index&&o.line<y.index+y.amount&&o.dispose(),o.line>y.index&&(o.line-=y.amount)}))),o.register(o.onDispose((()=>this._removeMarker(o)))),o}_removeMarker(l){this._isClearing||this.markers.splice(this.markers.indexOf(l),1)}}},8437:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BufferLine=h.DEFAULT_ATTR_DATA=void 0;const m=p(3734),g=p(511),u=p(643),v=p(482);h.DEFAULT_ATTR_DATA=Object.freeze(new m.AttributeData);let w=0;class x{constructor(d,f,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*d);const o=f||g.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let y=0;y<d;++y)this.setCell(y,o);this.length=d}get(d){const f=this._data[3*d+0],l=2097151&f;return[this._data[3*d+1],2097152&f?this._combined[d]:l?(0,v.stringFromCodePoint)(l):"",f>>22,2097152&f?this._combined[d].charCodeAt(this._combined[d].length-1):l]}set(d,f){this._data[3*d+1]=f[u.CHAR_DATA_ATTR_INDEX],f[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[d]=f[1],this._data[3*d+0]=2097152|d|f[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*d+0]=f[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[u.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(d){return this._data[3*d+0]>>22}hasWidth(d){return 12582912&this._data[3*d+0]}getFg(d){return this._data[3*d+1]}getBg(d){return this._data[3*d+2]}hasContent(d){return 4194303&this._data[3*d+0]}getCodePoint(d){const f=this._data[3*d+0];return 2097152&f?this._combined[d].charCodeAt(this._combined[d].length-1):2097151&f}isCombined(d){return 2097152&this._data[3*d+0]}getString(d){const f=this._data[3*d+0];return 2097152&f?this._combined[d]:2097151&f?(0,v.stringFromCodePoint)(2097151&f):""}isProtected(d){return 536870912&this._data[3*d+2]}loadCell(d,f){return w=3*d,f.content=this._data[w+0],f.fg=this._data[w+1],f.bg=this._data[w+2],2097152&f.content&&(f.combinedData=this._combined[d]),268435456&f.bg&&(f.extended=this._extendedAttrs[d]),f}setCell(d,f){2097152&f.content&&(this._combined[d]=f.combinedData),268435456&f.bg&&(this._extendedAttrs[d]=f.extended),this._data[3*d+0]=f.content,this._data[3*d+1]=f.fg,this._data[3*d+2]=f.bg}setCellFromCodepoint(d,f,l,o){268435456&o.bg&&(this._extendedAttrs[d]=o.extended),this._data[3*d+0]=f|l<<22,this._data[3*d+1]=o.fg,this._data[3*d+2]=o.bg}addCodepointToCell(d,f,l){let o=this._data[3*d+0];2097152&o?this._combined[d]+=(0,v.stringFromCodePoint)(f):2097151&o?(this._combined[d]=(0,v.stringFromCodePoint)(2097151&o)+(0,v.stringFromCodePoint)(f),o&=-2097152,o|=2097152):o=f|4194304,l&&(o&=-12582913,o|=l<<22),this._data[3*d+0]=o}insertCells(d,f,l){if((d%=this.length)&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,l),f<this.length-d){const o=new g.CellData;for(let y=this.length-d-f-1;y>=0;--y)this.setCell(d+f+y,this.loadCell(d+y,o));for(let y=0;y<f;++y)this.setCell(d+y,l)}else for(let o=d;o<this.length;++o)this.setCell(o,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(d,f,l){if(d%=this.length,f<this.length-d){const o=new g.CellData;for(let y=0;y<this.length-d-f;++y)this.setCell(d+y,this.loadCell(d+f+y,o));for(let y=this.length-f;y<this.length;++y)this.setCell(y,l)}else for(let o=d;o<this.length;++o)this.setCell(o,l);d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,l),this.getWidth(d)!==0||this.hasContent(d)||this.setCellFromCodepoint(d,0,1,l)}replaceCells(d,f,l,o=!1){if(o)for(d&&this.getWidth(d-1)===2&&!this.isProtected(d-1)&&this.setCellFromCodepoint(d-1,0,1,l),f<this.length&&this.getWidth(f-1)===2&&!this.isProtected(f)&&this.setCellFromCodepoint(f,0,1,l);d<f&&d<this.length;)this.isProtected(d)||this.setCell(d,l),d++;else for(d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,l),f<this.length&&this.getWidth(f-1)===2&&this.setCellFromCodepoint(f,0,1,l);d<f&&d<this.length;)this.setCell(d++,l)}resize(d,f){if(d===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const l=3*d;if(d>this.length){if(this._data.buffer.byteLength>=4*l)this._data=new Uint32Array(this._data.buffer,0,l);else{const o=new Uint32Array(l);o.set(this._data),this._data=o}for(let o=this.length;o<d;++o)this.setCell(o,f)}else{this._data=this._data.subarray(0,l);const o=Object.keys(this._combined);for(let A=0;A<o.length;A++){const k=parseInt(o[A],10);k>=d&&delete this._combined[k]}const y=Object.keys(this._extendedAttrs);for(let A=0;A<y.length;A++){const k=parseInt(y[A],10);k>=d&&delete this._extendedAttrs[k]}}return this.length=d,4*l*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const d=new Uint32Array(this._data.length);return d.set(this._data),this._data=d,1}return 0}fill(d,f=!1){if(f)for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,d);else{this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,d)}}copyFrom(d){this.length!==d.length?this._data=new Uint32Array(d._data):this._data.set(d._data),this.length=d.length,this._combined={};for(const f in d._combined)this._combined[f]=d._combined[f];this._extendedAttrs={};for(const f in d._extendedAttrs)this._extendedAttrs[f]=d._extendedAttrs[f];this.isWrapped=d.isWrapped}clone(){const d=new x(0);d._data=new Uint32Array(this._data),d.length=this.length;for(const f in this._combined)d._combined[f]=this._combined[f];for(const f in this._extendedAttrs)d._extendedAttrs[f]=this._extendedAttrs[f];return d.isWrapped=this.isWrapped,d}getTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0])return d+(this._data[3*d+0]>>22);return 0}getNoBgTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0]||50331648&this._data[3*d+2])return d+(this._data[3*d+0]>>22);return 0}copyCellsFrom(d,f,l,o,y){const A=d._data;if(y)for(let R=o-1;R>=0;R--){for(let C=0;C<3;C++)this._data[3*(l+R)+C]=A[3*(f+R)+C];268435456&A[3*(f+R)+2]&&(this._extendedAttrs[l+R]=d._extendedAttrs[f+R])}else for(let R=0;R<o;R++){for(let C=0;C<3;C++)this._data[3*(l+R)+C]=A[3*(f+R)+C];268435456&A[3*(f+R)+2]&&(this._extendedAttrs[l+R]=d._extendedAttrs[f+R])}const k=Object.keys(d._combined);for(let R=0;R<k.length;R++){const C=parseInt(k[R],10);C>=f&&(this._combined[C-f+l]=d._combined[C])}}translateToString(d,f,l,o){f=f??0,l=l??this.length,d&&(l=Math.min(l,this.getTrimmedLength())),o&&(o.length=0);let y="";for(;f<l;){const A=this._data[3*f+0],k=2097151&A,R=2097152&A?this._combined[f]:k?(0,v.stringFromCodePoint)(k):u.WHITESPACE_CELL_CHAR;if(y+=R,o)for(let C=0;C<R.length;++C)o.push(f);f+=A>>22||1}return o&&o.push(f),y}}h.BufferLine=x},4841:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.getRangeLength=void 0,h.getRangeLength=function(p,m){if(p.start.y>p.end.y)throw new Error(`Buffer range end (${p.end.x}, ${p.end.y}) cannot be before start (${p.start.x}, ${p.start.y})`);return m*(p.end.y-p.start.y)+(p.end.x-p.start.x+1)}},4634:(L,h)=>{function p(m,g,u){if(g===m.length-1)return m[g].getTrimmedLength();const v=!m[g].hasContent(u-1)&&m[g].getWidth(u-1)===1,w=m[g+1].getWidth(0)===2;return v&&w?u-1:u}Object.defineProperty(h,"__esModule",{value:!0}),h.getWrappedLineTrimmedLength=h.reflowSmallerGetNewLineLengths=h.reflowLargerApplyNewLayout=h.reflowLargerCreateNewLayout=h.reflowLargerGetLinesToRemove=void 0,h.reflowLargerGetLinesToRemove=function(m,g,u,v,w){const x=[];for(let b=0;b<m.length-1;b++){let d=b,f=m.get(++d);if(!f.isWrapped)continue;const l=[m.get(b)];for(;d<m.length&&f.isWrapped;)l.push(f),f=m.get(++d);if(v>=b&&v<d){b+=l.length-1;continue}let o=0,y=p(l,o,g),A=1,k=0;for(;A<l.length;){const C=p(l,A,g),T=C-k,H=u-y,I=Math.min(T,H);l[o].copyCellsFrom(l[A],k,y,I,!1),y+=I,y===u&&(o++,y=0),k+=I,k===C&&(A++,k=0),y===0&&o!==0&&l[o-1].getWidth(u-1)===2&&(l[o].copyCellsFrom(l[o-1],u-1,y++,1,!1),l[o-1].setCell(u-1,w))}l[o].replaceCells(y,u,w);let R=0;for(let C=l.length-1;C>0&&(C>o||l[C].getTrimmedLength()===0);C--)R++;R>0&&(x.push(b+l.length-R),x.push(R)),b+=l.length-1}return x},h.reflowLargerCreateNewLayout=function(m,g){const u=[];let v=0,w=g[v],x=0;for(let b=0;b<m.length;b++)if(w===b){const d=g[++v];m.onDeleteEmitter.fire({index:b-x,amount:d}),b+=d-1,x+=d,w=g[++v]}else u.push(b);return{layout:u,countRemoved:x}},h.reflowLargerApplyNewLayout=function(m,g){const u=[];for(let v=0;v<g.length;v++)u.push(m.get(g[v]));for(let v=0;v<u.length;v++)m.set(v,u[v]);m.length=g.length},h.reflowSmallerGetNewLineLengths=function(m,g,u){const v=[],w=m.map(((f,l)=>p(m,l,g))).reduce(((f,l)=>f+l));let x=0,b=0,d=0;for(;d<w;){if(w-d<u){v.push(w-d);break}x+=u;const f=p(m,b,g);x>f&&(x-=f,b++);const l=m[b].getWidth(x-1)===2;l&&x--;const o=l?u-1:u;v.push(o),d+=o}return v},h.getWrappedLineTrimmedLength=p},5295:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BufferSet=void 0;const m=p(8460),g=p(844),u=p(9092);class v extends g.Disposable{constructor(x,b){super(),this._optionsService=x,this._bufferService=b,this._onBufferActivate=this.register(new m.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new u.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new u.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(x,b){this._normal.resize(x,b),this._alt.resize(x,b),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}h.BufferSet=v},511:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.CellData=void 0;const m=p(482),g=p(643),u=p(3734);class v extends u.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new u.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const b=new v;return b.setFromCharData(x),b}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,m.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let b=!1;if(x[g.CHAR_DATA_CHAR_INDEX].length>2)b=!0;else if(x[g.CHAR_DATA_CHAR_INDEX].length===2){const d=x[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=d&&d<=56319){const f=x[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=f&&f<=57343?this.content=1024*(d-55296)+f-56320+65536|x[g.CHAR_DATA_WIDTH_INDEX]<<22:b=!0}else b=!0}else this.content=x[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[g.CHAR_DATA_WIDTH_INDEX]<<22;b&&(this.combinedData=x[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}h.CellData=v},643:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.WHITESPACE_CELL_CODE=h.WHITESPACE_CELL_WIDTH=h.WHITESPACE_CELL_CHAR=h.NULL_CELL_CODE=h.NULL_CELL_WIDTH=h.NULL_CELL_CHAR=h.CHAR_DATA_CODE_INDEX=h.CHAR_DATA_WIDTH_INDEX=h.CHAR_DATA_CHAR_INDEX=h.CHAR_DATA_ATTR_INDEX=h.DEFAULT_EXT=h.DEFAULT_ATTR=h.DEFAULT_COLOR=void 0,h.DEFAULT_COLOR=0,h.DEFAULT_ATTR=256|h.DEFAULT_COLOR<<9,h.DEFAULT_EXT=0,h.CHAR_DATA_ATTR_INDEX=0,h.CHAR_DATA_CHAR_INDEX=1,h.CHAR_DATA_WIDTH_INDEX=2,h.CHAR_DATA_CODE_INDEX=3,h.NULL_CELL_CHAR="",h.NULL_CELL_WIDTH=1,h.NULL_CELL_CODE=0,h.WHITESPACE_CELL_CHAR=" ",h.WHITESPACE_CELL_WIDTH=1,h.WHITESPACE_CELL_CODE=32},4863:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Marker=void 0;const m=p(8460),g=p(844);class u{get id(){return this._id}constructor(w){this.line=w,this.isDisposed=!1,this._disposables=[],this._id=u._nextId++,this._onDispose=this.register(new m.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(w){return this._disposables.push(w),w}}h.Marker=u,u._nextId=1},7116:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.DEFAULT_CHARSET=h.CHARSETS=void 0,h.CHARSETS={},h.DEFAULT_CHARSET=h.CHARSETS.B,h.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},h.CHARSETS.A={"#":"£"},h.CHARSETS.B=void 0,h.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},h.CHARSETS.C=h.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},h.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},h.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},h.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},h.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},h.CHARSETS.E=h.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},h.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},h.CHARSETS.H=h.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},h.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(L,h)=>{var p,m,g;Object.defineProperty(h,"__esModule",{value:!0}),h.C1_ESCAPED=h.C1=h.C0=void 0,(function(u){u.NUL="\0",u.SOH="",u.STX="",u.ETX="",u.EOT="",u.ENQ="",u.ACK="",u.BEL="\x07",u.BS="\b",u.HT=" ",u.LF=`
442
+ `,u.VT="\v",u.FF="\f",u.CR="\r",u.SO="",u.SI="",u.DLE="",u.DC1="",u.DC2="",u.DC3="",u.DC4="",u.NAK="",u.SYN="",u.ETB="",u.CAN="",u.EM="",u.SUB="",u.ESC="\x1B",u.FS="",u.GS="",u.RS="",u.US="",u.SP=" ",u.DEL=""})(p||(h.C0=p={})),(function(u){u.PAD="€",u.HOP="",u.BPH="‚",u.NBH="ƒ",u.IND="„",u.NEL="…",u.SSA="†",u.ESA="‡",u.HTS="ˆ",u.HTJ="‰",u.VTS="Š",u.PLD="‹",u.PLU="Œ",u.RI="",u.SS2="Ž",u.SS3="",u.DCS="",u.PU1="‘",u.PU2="’",u.STS="“",u.CCH="”",u.MW="•",u.SPA="–",u.EPA="—",u.SOS="˜",u.SGCI="™",u.SCI="š",u.CSI="›",u.ST="œ",u.OSC="",u.PM="ž",u.APC="Ÿ"})(m||(h.C1=m={})),(function(u){u.ST=`${p.ESC}\\`})(g||(h.C1_ESCAPED=g={}))},7399:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.evaluateKeyboardEvent=void 0;const m=p(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};h.evaluateKeyboardEvent=function(u,v,w,x){const b={type:0,cancel:!1,key:void 0},d=(u.shiftKey?1:0)|(u.altKey?2:0)|(u.ctrlKey?4:0)|(u.metaKey?8:0);switch(u.keyCode){case 0:u.key==="UIKeyInputUpArrow"?b.key=v?m.C0.ESC+"OA":m.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?b.key=v?m.C0.ESC+"OD":m.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?b.key=v?m.C0.ESC+"OC":m.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(b.key=v?m.C0.ESC+"OB":m.C0.ESC+"[B");break;case 8:b.key=u.ctrlKey?"\b":m.C0.DEL,u.altKey&&(b.key=m.C0.ESC+b.key);break;case 9:if(u.shiftKey){b.key=m.C0.ESC+"[Z";break}b.key=m.C0.HT,b.cancel=!0;break;case 13:b.key=u.altKey?m.C0.ESC+m.C0.CR:m.C0.CR,b.cancel=!0;break;case 27:b.key=m.C0.ESC,u.altKey&&(b.key=m.C0.ESC+m.C0.ESC),b.cancel=!0;break;case 37:if(u.metaKey)break;d?(b.key=m.C0.ESC+"[1;"+(d+1)+"D",b.key===m.C0.ESC+"[1;3D"&&(b.key=m.C0.ESC+(w?"b":"[1;5D"))):b.key=v?m.C0.ESC+"OD":m.C0.ESC+"[D";break;case 39:if(u.metaKey)break;d?(b.key=m.C0.ESC+"[1;"+(d+1)+"C",b.key===m.C0.ESC+"[1;3C"&&(b.key=m.C0.ESC+(w?"f":"[1;5C"))):b.key=v?m.C0.ESC+"OC":m.C0.ESC+"[C";break;case 38:if(u.metaKey)break;d?(b.key=m.C0.ESC+"[1;"+(d+1)+"A",w||b.key!==m.C0.ESC+"[1;3A"||(b.key=m.C0.ESC+"[1;5A")):b.key=v?m.C0.ESC+"OA":m.C0.ESC+"[A";break;case 40:if(u.metaKey)break;d?(b.key=m.C0.ESC+"[1;"+(d+1)+"B",w||b.key!==m.C0.ESC+"[1;3B"||(b.key=m.C0.ESC+"[1;5B")):b.key=v?m.C0.ESC+"OB":m.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(b.key=m.C0.ESC+"[2~");break;case 46:b.key=d?m.C0.ESC+"[3;"+(d+1)+"~":m.C0.ESC+"[3~";break;case 36:b.key=d?m.C0.ESC+"[1;"+(d+1)+"H":v?m.C0.ESC+"OH":m.C0.ESC+"[H";break;case 35:b.key=d?m.C0.ESC+"[1;"+(d+1)+"F":v?m.C0.ESC+"OF":m.C0.ESC+"[F";break;case 33:u.shiftKey?b.type=2:u.ctrlKey?b.key=m.C0.ESC+"[5;"+(d+1)+"~":b.key=m.C0.ESC+"[5~";break;case 34:u.shiftKey?b.type=3:u.ctrlKey?b.key=m.C0.ESC+"[6;"+(d+1)+"~":b.key=m.C0.ESC+"[6~";break;case 112:b.key=d?m.C0.ESC+"[1;"+(d+1)+"P":m.C0.ESC+"OP";break;case 113:b.key=d?m.C0.ESC+"[1;"+(d+1)+"Q":m.C0.ESC+"OQ";break;case 114:b.key=d?m.C0.ESC+"[1;"+(d+1)+"R":m.C0.ESC+"OR";break;case 115:b.key=d?m.C0.ESC+"[1;"+(d+1)+"S":m.C0.ESC+"OS";break;case 116:b.key=d?m.C0.ESC+"[15;"+(d+1)+"~":m.C0.ESC+"[15~";break;case 117:b.key=d?m.C0.ESC+"[17;"+(d+1)+"~":m.C0.ESC+"[17~";break;case 118:b.key=d?m.C0.ESC+"[18;"+(d+1)+"~":m.C0.ESC+"[18~";break;case 119:b.key=d?m.C0.ESC+"[19;"+(d+1)+"~":m.C0.ESC+"[19~";break;case 120:b.key=d?m.C0.ESC+"[20;"+(d+1)+"~":m.C0.ESC+"[20~";break;case 121:b.key=d?m.C0.ESC+"[21;"+(d+1)+"~":m.C0.ESC+"[21~";break;case 122:b.key=d?m.C0.ESC+"[23;"+(d+1)+"~":m.C0.ESC+"[23~";break;case 123:b.key=d?m.C0.ESC+"[24;"+(d+1)+"~":m.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(w&&!x||!u.altKey||u.metaKey)!w||u.altKey||u.ctrlKey||u.shiftKey||!u.metaKey?u.key&&!u.ctrlKey&&!u.altKey&&!u.metaKey&&u.keyCode>=48&&u.key.length===1?b.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(b.key=m.C0.US),u.key==="@"&&(b.key=m.C0.NUL)):u.keyCode===65&&(b.type=1);else{const f=g[u.keyCode],l=f==null?void 0:f[u.shiftKey?1:0];if(l)b.key=m.C0.ESC+l;else if(u.keyCode>=65&&u.keyCode<=90){const o=u.ctrlKey?u.keyCode-64:u.keyCode+32;let y=String.fromCharCode(o);u.shiftKey&&(y=y.toUpperCase()),b.key=m.C0.ESC+y}else if(u.keyCode===32)b.key=m.C0.ESC+(u.ctrlKey?m.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let o=u.code.slice(3,4);u.shiftKey||(o=o.toLowerCase()),b.key=m.C0.ESC+o,b.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?b.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?b.key=m.C0.NUL:u.keyCode>=51&&u.keyCode<=55?b.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?b.key=m.C0.DEL:u.keyCode===219?b.key=m.C0.ESC:u.keyCode===220?b.key=m.C0.FS:u.keyCode===221&&(b.key=m.C0.GS)}return b}},482:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Utf8ToUtf32=h.StringToUtf32=h.utf32ToString=h.stringFromCodePoint=void 0,h.stringFromCodePoint=function(p){return p>65535?(p-=65536,String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):String.fromCharCode(p)},h.utf32ToString=function(p,m=0,g=p.length){let u="";for(let v=m;v<g;++v){let w=p[v];w>65535?(w-=65536,u+=String.fromCharCode(55296+(w>>10))+String.fromCharCode(w%1024+56320)):u+=String.fromCharCode(w)}return u},h.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(p,m){const g=p.length;if(!g)return 0;let u=0,v=0;if(this._interim){const w=p.charCodeAt(v++);56320<=w&&w<=57343?m[u++]=1024*(this._interim-55296)+w-56320+65536:(m[u++]=this._interim,m[u++]=w),this._interim=0}for(let w=v;w<g;++w){const x=p.charCodeAt(w);if(55296<=x&&x<=56319){if(++w>=g)return this._interim=x,u;const b=p.charCodeAt(w);56320<=b&&b<=57343?m[u++]=1024*(x-55296)+b-56320+65536:(m[u++]=x,m[u++]=b)}else x!==65279&&(m[u++]=x)}return u}},h.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(p,m){const g=p.length;if(!g)return 0;let u,v,w,x,b=0,d=0,f=0;if(this.interim[0]){let y=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let k,R=0;for(;(k=63&this.interim[++R])&&R<4;)A<<=6,A|=k;const C=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=C-R;for(;f<T;){if(f>=g)return 0;if(k=p[f++],(192&k)!=128){f--,y=!0;break}this.interim[R++]=k,A<<=6,A|=63&k}y||(C===2?A<128?f--:m[b++]=A:C===3?A<2048||A>=55296&&A<=57343||A===65279||(m[b++]=A):A<65536||A>1114111||(m[b++]=A)),this.interim.fill(0)}const l=g-4;let o=f;for(;o<g;){for(;!(!(o<l)||128&(u=p[o])||128&(v=p[o+1])||128&(w=p[o+2])||128&(x=p[o+3]));)m[b++]=u,m[b++]=v,m[b++]=w,m[b++]=x,o+=4;if(u=p[o++],u<128)m[b++]=u;else if((224&u)==192){if(o>=g)return this.interim[0]=u,b;if(v=p[o++],(192&v)!=128){o--;continue}if(d=(31&u)<<6|63&v,d<128){o--;continue}m[b++]=d}else if((240&u)==224){if(o>=g)return this.interim[0]=u,b;if(v=p[o++],(192&v)!=128){o--;continue}if(o>=g)return this.interim[0]=u,this.interim[1]=v,b;if(w=p[o++],(192&w)!=128){o--;continue}if(d=(15&u)<<12|(63&v)<<6|63&w,d<2048||d>=55296&&d<=57343||d===65279)continue;m[b++]=d}else if((248&u)==240){if(o>=g)return this.interim[0]=u,b;if(v=p[o++],(192&v)!=128){o--;continue}if(o>=g)return this.interim[0]=u,this.interim[1]=v,b;if(w=p[o++],(192&w)!=128){o--;continue}if(o>=g)return this.interim[0]=u,this.interim[1]=v,this.interim[2]=w,b;if(x=p[o++],(192&x)!=128){o--;continue}if(d=(7&u)<<18|(63&v)<<12|(63&w)<<6|63&x,d<65536||d>1114111)continue;m[b++]=d}}return b}}},225:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.UnicodeV6=void 0;const m=p(1480),g=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],u=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let v;h.UnicodeV6=class{constructor(){if(this.version="6",!v){v=new Uint8Array(65536),v.fill(1),v[0]=0,v.fill(0,1,32),v.fill(0,127,160),v.fill(2,4352,4448),v[9001]=2,v[9002]=2,v.fill(2,11904,42192),v[12351]=1,v.fill(2,44032,55204),v.fill(2,63744,64256),v.fill(2,65040,65050),v.fill(2,65072,65136),v.fill(2,65280,65377),v.fill(2,65504,65511);for(let w=0;w<g.length;++w)v.fill(0,g[w][0],g[w][1]+1)}}wcwidth(w){return w<32?0:w<127?1:w<65536?v[w]:(function(x,b){let d,f=0,l=b.length-1;if(x<b[0][0]||x>b[l][1])return!1;for(;l>=f;)if(d=f+l>>1,x>b[d][1])f=d+1;else{if(!(x<b[d][0]))return!0;l=d-1}return!1})(w,u)?0:w>=131072&&w<=196605||w>=196608&&w<=262141?2:1}charProperties(w,x){let b=this.wcwidth(w),d=b===0&&x!==0;if(d){const f=m.UnicodeService.extractWidth(x);f===0?d=!1:f>b&&(b=f)}return m.UnicodeService.createPropertyValue(0,b,d)}}},5981:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.WriteBuffer=void 0;const m=p(8460),g=p(844);class u extends g.Disposable{constructor(w){super(),this._action=w,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(w,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let b;for(this._isSyncWriting=!0;b=this._writeBuffer.shift();){this._action(b);const d=this._callbacks.shift();d&&d()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(w,x){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=w.length,this._writeBuffer.push(w),this._callbacks.push(x)}_innerWrite(w=0,x=!0){const b=w||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const d=this._writeBuffer[this._bufferOffset],f=this._action(d,x);if(f){const o=y=>Date.now()-b>=12?setTimeout((()=>this._innerWrite(0,y))):this._innerWrite(b,y);return void f.catch((y=>(queueMicrotask((()=>{throw y})),Promise.resolve(!1)))).then(o)}const l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=d.length,Date.now()-b>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}h.WriteBuffer=u},5941:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.toRgbString=h.parseColor=void 0;const p=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,m=/^[\da-f]+$/;function g(u,v){const w=u.toString(16),x=w.length<2?"0"+w:w;switch(v){case 4:return w[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}h.parseColor=function(u){if(!u)return;let v=u.toLowerCase();if(v.indexOf("rgb:")===0){v=v.slice(4);const w=p.exec(v);if(w){const x=w[1]?15:w[4]?255:w[7]?4095:65535;return[Math.round(parseInt(w[1]||w[4]||w[7]||w[10],16)/x*255),Math.round(parseInt(w[2]||w[5]||w[8]||w[11],16)/x*255),Math.round(parseInt(w[3]||w[6]||w[9]||w[12],16)/x*255)]}}else if(v.indexOf("#")===0&&(v=v.slice(1),m.exec(v)&&[3,6,9,12].includes(v.length))){const w=v.length/3,x=[0,0,0];for(let b=0;b<3;++b){const d=parseInt(v.slice(w*b,w*b+w),16);x[b]=w===1?d<<4:w===2?d:w===3?d>>4:d>>8}return x}},h.toRgbString=function(u,v=16){const[w,x,b]=u;return`rgb:${g(w,v)}/${g(x,v)}/${g(b,v)}`}},5770:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.PAYLOAD_LIMIT=void 0,h.PAYLOAD_LIMIT=1e7},6351:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.DcsHandler=h.DcsParser=void 0;const m=p(482),g=p(8742),u=p(5770),v=[];h.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=v,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=v}registerHandler(x,b){this._handlers[x]===void 0&&(this._handlers[x]=[]);const d=this._handlers[x];return d.push(b),{dispose:()=>{const f=d.indexOf(b);f!==-1&&d.splice(f,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=v,this._ident=0}hook(x,b){if(this.reset(),this._ident=x,this._active=this._handlers[x]||v,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].hook(b);else this._handlerFb(this._ident,"HOOK",b)}put(x,b,d){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(x,b,d);else this._handlerFb(this._ident,"PUT",(0,m.utf32ToString)(x,b,d))}unhook(x,b=!0){if(this._active.length){let d=!1,f=this._active.length-1,l=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,d=b,l=this._stack.fallThrough,this._stack.paused=!1),!l&&d===!1){for(;f>=0&&(d=this._active[f].unhook(x),d!==!0);f--)if(d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,d;f--}for(;f>=0;f--)if(d=this._active[f].unhook(!1),d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,d}else this._handlerFb(this._ident,"UNHOOK",x);this._active=v,this._ident=0}};const w=new g.Params;w.addParam(0),h.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=w,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():w,this._data="",this._hitLimit=!1}put(x,b,d){this._hitLimit||(this._data+=(0,m.utf32ToString)(x,b,d),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let b=!1;if(this._hitLimit)b=!1;else if(x&&(b=this._handler(this._data,this._params),b instanceof Promise))return b.then((d=>(this._params=w,this._data="",this._hitLimit=!1,d)));return this._params=w,this._data="",this._hitLimit=!1,b}}},2015:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.EscapeSequenceParser=h.VT500_TRANSITION_TABLE=h.TransitionTable=void 0;const m=p(844),g=p(8742),u=p(6242),v=p(6351);class w{constructor(f){this.table=new Uint8Array(f)}setDefault(f,l){this.table.fill(f<<4|l)}add(f,l,o,y){this.table[l<<8|f]=o<<4|y}addMany(f,l,o,y){for(let A=0;A<f.length;A++)this.table[l<<8|f[A]]=o<<4|y}}h.TransitionTable=w;const x=160;h.VT500_TRANSITION_TABLE=(function(){const d=new w(4095),f=Array.apply(null,Array(256)).map(((R,C)=>C)),l=(R,C)=>f.slice(R,C),o=l(32,127),y=l(0,24);y.push(25),y.push.apply(y,l(28,32));const A=l(0,14);let k;for(k in d.setDefault(1,0),d.addMany(o,0,2,0),A)d.addMany([24,26,153,154],k,3,0),d.addMany(l(128,144),k,3,0),d.addMany(l(144,152),k,3,0),d.add(156,k,0,0),d.add(27,k,11,1),d.add(157,k,4,8),d.addMany([152,158,159],k,0,7),d.add(155,k,11,3),d.add(144,k,11,9);return d.addMany(y,0,3,0),d.addMany(y,1,3,1),d.add(127,1,0,1),d.addMany(y,8,0,8),d.addMany(y,3,3,3),d.add(127,3,0,3),d.addMany(y,4,3,4),d.add(127,4,0,4),d.addMany(y,6,3,6),d.addMany(y,5,3,5),d.add(127,5,0,5),d.addMany(y,2,3,2),d.add(127,2,0,2),d.add(93,1,4,8),d.addMany(o,8,5,8),d.add(127,8,5,8),d.addMany([156,27,24,26,7],8,6,0),d.addMany(l(28,32),8,0,8),d.addMany([88,94,95],1,0,7),d.addMany(o,7,0,7),d.addMany(y,7,0,7),d.add(156,7,0,0),d.add(127,7,0,7),d.add(91,1,11,3),d.addMany(l(64,127),3,7,0),d.addMany(l(48,60),3,8,4),d.addMany([60,61,62,63],3,9,4),d.addMany(l(48,60),4,8,4),d.addMany(l(64,127),4,7,0),d.addMany([60,61,62,63],4,0,6),d.addMany(l(32,64),6,0,6),d.add(127,6,0,6),d.addMany(l(64,127),6,0,0),d.addMany(l(32,48),3,9,5),d.addMany(l(32,48),5,9,5),d.addMany(l(48,64),5,0,6),d.addMany(l(64,127),5,7,0),d.addMany(l(32,48),4,9,5),d.addMany(l(32,48),1,9,2),d.addMany(l(32,48),2,9,2),d.addMany(l(48,127),2,10,0),d.addMany(l(48,80),1,10,0),d.addMany(l(81,88),1,10,0),d.addMany([89,90,92],1,10,0),d.addMany(l(96,127),1,10,0),d.add(80,1,11,9),d.addMany(y,9,0,9),d.add(127,9,0,9),d.addMany(l(28,32),9,0,9),d.addMany(l(32,48),9,9,12),d.addMany(l(48,60),9,8,10),d.addMany([60,61,62,63],9,9,10),d.addMany(y,11,0,11),d.addMany(l(32,128),11,0,11),d.addMany(l(28,32),11,0,11),d.addMany(y,10,0,10),d.add(127,10,0,10),d.addMany(l(28,32),10,0,10),d.addMany(l(48,60),10,8,10),d.addMany([60,61,62,63],10,0,11),d.addMany(l(32,48),10,9,12),d.addMany(y,12,0,12),d.add(127,12,0,12),d.addMany(l(28,32),12,0,12),d.addMany(l(32,48),12,9,12),d.addMany(l(48,64),12,0,11),d.addMany(l(64,127),12,12,13),d.addMany(l(64,127),10,12,13),d.addMany(l(64,127),9,12,13),d.addMany(y,13,13,13),d.addMany(o,13,13,13),d.add(127,13,0,13),d.addMany([27,156,24,26],13,14,0),d.add(x,0,2,0),d.add(x,8,5,8),d.add(x,6,0,6),d.add(x,11,0,11),d.add(x,13,13,13),d})();class b extends m.Disposable{constructor(f=h.VT500_TRANSITION_TABLE){super(),this._transitions=f,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(l,o,y)=>{},this._executeHandlerFb=l=>{},this._csiHandlerFb=(l,o)=>{},this._escHandlerFb=l=>{},this._errorHandlerFb=l=>l,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,m.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new u.OscParser),this._dcsParser=this.register(new v.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(f,l=[64,126]){let o=0;if(f.prefix){if(f.prefix.length>1)throw new Error("only one byte as prefix supported");if(o=f.prefix.charCodeAt(0),o&&60>o||o>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(f.intermediates){if(f.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let A=0;A<f.intermediates.length;++A){const k=f.intermediates.charCodeAt(A);if(32>k||k>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");o<<=8,o|=k}}if(f.final.length!==1)throw new Error("final must be a single byte");const y=f.final.charCodeAt(0);if(l[0]>y||y>l[1])throw new Error(`final must be in range ${l[0]} .. ${l[1]}`);return o<<=8,o|=y,o}identToString(f){const l=[];for(;f;)l.push(String.fromCharCode(255&f)),f>>=8;return l.reverse().join("")}setPrintHandler(f){this._printHandler=f}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(f,l){const o=this._identifier(f,[48,126]);this._escHandlers[o]===void 0&&(this._escHandlers[o]=[]);const y=this._escHandlers[o];return y.push(l),{dispose:()=>{const A=y.indexOf(l);A!==-1&&y.splice(A,1)}}}clearEscHandler(f){this._escHandlers[this._identifier(f,[48,126])]&&delete this._escHandlers[this._identifier(f,[48,126])]}setEscHandlerFallback(f){this._escHandlerFb=f}setExecuteHandler(f,l){this._executeHandlers[f.charCodeAt(0)]=l}clearExecuteHandler(f){this._executeHandlers[f.charCodeAt(0)]&&delete this._executeHandlers[f.charCodeAt(0)]}setExecuteHandlerFallback(f){this._executeHandlerFb=f}registerCsiHandler(f,l){const o=this._identifier(f);this._csiHandlers[o]===void 0&&(this._csiHandlers[o]=[]);const y=this._csiHandlers[o];return y.push(l),{dispose:()=>{const A=y.indexOf(l);A!==-1&&y.splice(A,1)}}}clearCsiHandler(f){this._csiHandlers[this._identifier(f)]&&delete this._csiHandlers[this._identifier(f)]}setCsiHandlerFallback(f){this._csiHandlerFb=f}registerDcsHandler(f,l){return this._dcsParser.registerHandler(this._identifier(f),l)}clearDcsHandler(f){this._dcsParser.clearHandler(this._identifier(f))}setDcsHandlerFallback(f){this._dcsParser.setHandlerFallback(f)}registerOscHandler(f,l){return this._oscParser.registerHandler(f,l)}clearOscHandler(f){this._oscParser.clearHandler(f)}setOscHandlerFallback(f){this._oscParser.setHandlerFallback(f)}setErrorHandler(f){this._errorHandler=f}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(f,l,o,y,A){this._parseStack.state=f,this._parseStack.handlers=l,this._parseStack.handlerPos=o,this._parseStack.transition=y,this._parseStack.chunkPos=A}parse(f,l,o){let y,A=0,k=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(o===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const C=this._parseStack.handlers;let T=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(o===!1&&T>-1){for(;T>=0&&(y=C[T](this._params),y!==!0);T--)if(y instanceof Promise)return this._parseStack.handlerPos=T,y}this._parseStack.handlers=[];break;case 4:if(o===!1&&T>-1){for(;T>=0&&(y=C[T](),y!==!0);T--)if(y instanceof Promise)return this._parseStack.handlerPos=T,y}this._parseStack.handlers=[];break;case 6:if(A=f[this._parseStack.chunkPos],y=this._dcsParser.unhook(A!==24&&A!==26,o),y)return y;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(A=f[this._parseStack.chunkPos],y=this._oscParser.end(A!==24&&A!==26,o),y)return y;A===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let C=R;C<l;++C){switch(A=f[C],k=this._transitions.table[this.currentState<<8|(A<160?A:x)],k>>4){case 2:for(let P=C+1;;++P){if(P>=l||(A=f[P])<32||A>126&&A<x){this._printHandler(f,C,P),C=P-1;break}if(++P>=l||(A=f[P])<32||A>126&&A<x){this._printHandler(f,C,P),C=P-1;break}if(++P>=l||(A=f[P])<32||A>126&&A<x){this._printHandler(f,C,P),C=P-1;break}if(++P>=l||(A=f[P])<32||A>126&&A<x){this._printHandler(f,C,P),C=P-1;break}}break;case 3:this._executeHandlers[A]?this._executeHandlers[A]():this._executeHandlerFb(A),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:C,code:A,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const T=this._csiHandlers[this._collect<<8|A];let H=T?T.length-1:-1;for(;H>=0&&(y=T[H](this._params),y!==!0);H--)if(y instanceof Promise)return this._preserveStack(3,T,H,k,C),y;H<0&&this._csiHandlerFb(this._collect<<8|A,this._params),this.precedingJoinState=0;break;case 8:do switch(A){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(A-48)}while(++C<l&&(A=f[C])>47&&A<60);C--;break;case 9:this._collect<<=8,this._collect|=A;break;case 10:const I=this._escHandlers[this._collect<<8|A];let W=I?I.length-1:-1;for(;W>=0&&(y=I[W](),y!==!0);W--)if(y instanceof Promise)return this._preserveStack(4,I,W,k,C),y;W<0&&this._escHandlerFb(this._collect<<8|A),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|A,this._params);break;case 13:for(let P=C+1;;++P)if(P>=l||(A=f[P])===24||A===26||A===27||A>127&&A<x){this._dcsParser.put(f,C,P),C=P-1;break}break;case 14:if(y=this._dcsParser.unhook(A!==24&&A!==26),y)return this._preserveStack(6,[],0,k,C),y;A===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let P=C+1;;P++)if(P>=l||(A=f[P])<32||A>127&&A<x){this._oscParser.put(f,C,P),C=P-1;break}break;case 6:if(y=this._oscParser.end(A!==24&&A!==26),y)return this._preserveStack(5,[],0,k,C),y;A===27&&(k|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&k}}}h.EscapeSequenceParser=b},6242:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.OscHandler=h.OscParser=void 0;const m=p(5770),g=p(482),u=[];h.OscParser=class{constructor(){this._state=0,this._active=u,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(v,w){this._handlers[v]===void 0&&(this._handlers[v]=[]);const x=this._handlers[v];return x.push(w),{dispose:()=>{const b=x.indexOf(w);b!==-1&&x.splice(b,1)}}}clearHandler(v){this._handlers[v]&&delete this._handlers[v]}setHandlerFallback(v){this._handlerFb=v}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=u}reset(){if(this._state===2)for(let v=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;v>=0;--v)this._active[v].end(!1);this._stack.paused=!1,this._active=u,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||u,this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].start();else this._handlerFb(this._id,"START")}_put(v,w,x){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(v,w,x);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(v,w,x))}start(){this.reset(),this._state=1}put(v,w,x){if(this._state!==3){if(this._state===1)for(;w<x;){const b=v[w++];if(b===59){this._state=2,this._start();break}if(b<48||57<b)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+b-48}this._state===2&&x-w>0&&this._put(v,w,x)}}end(v,w=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,b=this._active.length-1,d=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,x=w,d=this._stack.fallThrough,this._stack.paused=!1),!d&&x===!1){for(;b>=0&&(x=this._active[b].end(v),x!==!0);b--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,x;b--}for(;b>=0;b--)if(x=this._active[b].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",v);this._active=u,this._id=-1,this._state=0}}},h.OscHandler=class{constructor(v){this._handler=v,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(v,w,x){this._hitLimit||(this._data+=(0,g.utf32ToString)(v,w,x),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(v){let w=!1;if(this._hitLimit)w=!1;else if(v&&(w=this._handler(this._data),w instanceof Promise))return w.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,w}}},8742:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.Params=void 0;const p=2147483647;class m{static fromArray(u){const v=new m;if(!u.length)return v;for(let w=Array.isArray(u[0])?1:0;w<u.length;++w){const x=u[w];if(Array.isArray(x))for(let b=0;b<x.length;++b)v.addSubParam(x[b]);else v.addParam(x)}return v}constructor(u=32,v=32){if(this.maxLength=u,this.maxSubParamsLength=v,v>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(u),this.length=0,this._subParams=new Int32Array(v),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(u),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const u=new m(this.maxLength,this.maxSubParamsLength);return u.params.set(this.params),u.length=this.length,u._subParams.set(this._subParams),u._subParamsLength=this._subParamsLength,u._subParamsIdx.set(this._subParamsIdx),u._rejectDigits=this._rejectDigits,u._rejectSubDigits=this._rejectSubDigits,u._digitIsSub=this._digitIsSub,u}toArray(){const u=[];for(let v=0;v<this.length;++v){u.push(this.params[v]);const w=this._subParamsIdx[v]>>8,x=255&this._subParamsIdx[v];x-w>0&&u.push(Array.prototype.slice.call(this._subParams,w,x))}return u}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(u){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=u>p?p:u}}addSubParam(u){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(u<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=u>p?p:u,this._subParamsIdx[this.length-1]++}}hasSubParams(u){return(255&this._subParamsIdx[u])-(this._subParamsIdx[u]>>8)>0}getSubParams(u){const v=this._subParamsIdx[u]>>8,w=255&this._subParamsIdx[u];return w-v>0?this._subParams.subarray(v,w):null}getSubParamsAll(){const u={};for(let v=0;v<this.length;++v){const w=this._subParamsIdx[v]>>8,x=255&this._subParamsIdx[v];x-w>0&&(u[v]=this._subParams.slice(w,x))}return u}addDigit(u){let v;if(this._rejectDigits||!(v=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const w=this._digitIsSub?this._subParams:this.params,x=w[v-1];w[v-1]=~x?Math.min(10*x+u,p):u}}h.Params=m},5741:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.AddonManager=void 0,h.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let p=this._addons.length-1;p>=0;p--)this._addons[p].instance.dispose()}loadAddon(p,m){const g={instance:m,dispose:m.dispose,isDisposed:!1};this._addons.push(g),m.dispose=()=>this._wrappedAddonDispose(g),m.activate(p)}_wrappedAddonDispose(p){if(p.isDisposed)return;let m=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===p){m=g;break}if(m===-1)throw new Error("Could not dispose an addon that has not been loaded");p.isDisposed=!0,p.dispose.apply(p.instance),this._addons.splice(m,1)}}},8771:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BufferApiView=void 0;const m=p(3785),g=p(511);h.BufferApiView=class{constructor(u,v){this._buffer=u,this.type=v}init(u){return this._buffer=u,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(u){const v=this._buffer.lines.get(u);if(v)return new m.BufferLineApiView(v)}getNullCell(){return new g.CellData}}},3785:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BufferLineApiView=void 0;const m=p(511);h.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,u){if(!(g<0||g>=this._line.length))return u?(this._line.loadCell(g,u),u):this._line.loadCell(g,new m.CellData)}translateToString(g,u,v){return this._line.translateToString(g,u,v)}}},8285:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BufferNamespaceApi=void 0;const m=p(8771),g=p(8460),u=p(844);class v extends u.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new m.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new m.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}h.BufferNamespaceApi=v},7975:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ParserApi=void 0,h.ParserApi=class{constructor(p){this._core=p}registerCsiHandler(p,m){return this._core.registerCsiHandler(p,(g=>m(g.toArray())))}addCsiHandler(p,m){return this.registerCsiHandler(p,m)}registerDcsHandler(p,m){return this._core.registerDcsHandler(p,((g,u)=>m(g,u.toArray())))}addDcsHandler(p,m){return this.registerDcsHandler(p,m)}registerEscHandler(p,m){return this._core.registerEscHandler(p,m)}addEscHandler(p,m){return this.registerEscHandler(p,m)}registerOscHandler(p,m){return this._core.registerOscHandler(p,m)}addOscHandler(p,m){return this.registerOscHandler(p,m)}}},7090:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.UnicodeApi=void 0,h.UnicodeApi=class{constructor(p){this._core=p}register(p){this._core.unicodeService.register(p)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(p){this._core.unicodeService.activeVersion=p}}},744:function(L,h,p){var m=this&&this.__decorate||function(d,f,l,o){var y,A=arguments.length,k=A<3?f:o===null?o=Object.getOwnPropertyDescriptor(f,l):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,f,l,o);else for(var R=d.length-1;R>=0;R--)(y=d[R])&&(k=(A<3?y(k):A>3?y(f,l,k):y(f,l))||k);return A>3&&k&&Object.defineProperty(f,l,k),k},g=this&&this.__param||function(d,f){return function(l,o){f(l,o,d)}};Object.defineProperty(h,"__esModule",{value:!0}),h.BufferService=h.MINIMUM_ROWS=h.MINIMUM_COLS=void 0;const u=p(8460),v=p(844),w=p(5295),x=p(2585);h.MINIMUM_COLS=2,h.MINIMUM_ROWS=1;let b=h.BufferService=class extends v.Disposable{get buffer(){return this.buffers.active}constructor(d){super(),this.isUserScrolling=!1,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new u.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(d.rawOptions.cols||0,h.MINIMUM_COLS),this.rows=Math.max(d.rawOptions.rows||0,h.MINIMUM_ROWS),this.buffers=this.register(new w.BufferSet(d,this))}resize(d,f){this.cols=d,this.rows=f,this.buffers.resize(d,f),this._onResize.fire({cols:d,rows:f})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(d,f=!1){const l=this.buffer;let o;o=this._cachedBlankLine,o&&o.length===this.cols&&o.getFg(0)===d.fg&&o.getBg(0)===d.bg||(o=l.getBlankLine(d,f),this._cachedBlankLine=o),o.isWrapped=f;const y=l.ybase+l.scrollTop,A=l.ybase+l.scrollBottom;if(l.scrollTop===0){const k=l.lines.isFull;A===l.lines.length-1?k?l.lines.recycle().copyFrom(o):l.lines.push(o.clone()):l.lines.splice(A+1,0,o.clone()),k?this.isUserScrolling&&(l.ydisp=Math.max(l.ydisp-1,0)):(l.ybase++,this.isUserScrolling||l.ydisp++)}else{const k=A-y+1;l.lines.shiftElements(y+1,k-1,-1),l.lines.set(A,o.clone())}this.isUserScrolling||(l.ydisp=l.ybase),this._onScroll.fire(l.ydisp)}scrollLines(d,f,l){const o=this.buffer;if(d<0){if(o.ydisp===0)return;this.isUserScrolling=!0}else d+o.ydisp>=o.ybase&&(this.isUserScrolling=!1);const y=o.ydisp;o.ydisp=Math.max(Math.min(o.ydisp+d,o.ybase),0),y!==o.ydisp&&(f||this._onScroll.fire(o.ydisp))}};h.BufferService=b=m([g(0,x.IOptionsService)],b)},7994:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.CharsetService=void 0,h.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(p){this.glevel=p,this.charset=this._charsets[p]}setgCharset(p,m){this._charsets[p]=m,this.glevel===p&&(this.charset=m)}}},1753:function(L,h,p){var m=this&&this.__decorate||function(o,y,A,k){var R,C=arguments.length,T=C<3?y:k===null?k=Object.getOwnPropertyDescriptor(y,A):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(o,y,A,k);else for(var H=o.length-1;H>=0;H--)(R=o[H])&&(T=(C<3?R(T):C>3?R(y,A,T):R(y,A))||T);return C>3&&T&&Object.defineProperty(y,A,T),T},g=this&&this.__param||function(o,y){return function(A,k){y(A,k,o)}};Object.defineProperty(h,"__esModule",{value:!0}),h.CoreMouseService=void 0;const u=p(2585),v=p(8460),w=p(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:o=>o.button!==4&&o.action===1&&(o.ctrl=!1,o.alt=!1,o.shift=!1,!0)},VT200:{events:19,restrict:o=>o.action!==32},DRAG:{events:23,restrict:o=>o.action!==32||o.button!==3},ANY:{events:31,restrict:o=>!0}};function b(o,y){let A=(o.ctrl?16:0)|(o.shift?4:0)|(o.alt?8:0);return o.button===4?(A|=64,A|=o.action):(A|=3&o.button,4&o.button&&(A|=64),8&o.button&&(A|=128),o.action===32?A|=32:o.action!==0||y||(A|=3)),A}const d=String.fromCharCode,f={DEFAULT:o=>{const y=[b(o,!1)+32,o.col+32,o.row+32];return y[0]>255||y[1]>255||y[2]>255?"":`\x1B[M${d(y[0])}${d(y[1])}${d(y[2])}`},SGR:o=>{const y=o.action===0&&o.button!==4?"m":"M";return`\x1B[<${b(o,!0)};${o.col};${o.row}${y}`},SGR_PIXELS:o=>{const y=o.action===0&&o.button!==4?"m":"M";return`\x1B[<${b(o,!0)};${o.x};${o.y}${y}`}};let l=h.CoreMouseService=class extends w.Disposable{constructor(o,y){super(),this._bufferService=o,this._coreService=y,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new v.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const A of Object.keys(x))this.addProtocol(A,x[A]);for(const A of Object.keys(f))this.addEncoding(A,f[A]);this.reset()}addProtocol(o,y){this._protocols[o]=y}addEncoding(o,y){this._encodings[o]=y}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(o){if(!this._protocols[o])throw new Error(`unknown protocol "${o}"`);this._activeProtocol=o,this._onProtocolChange.fire(this._protocols[o].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(o){if(!this._encodings[o])throw new Error(`unknown encoding "${o}"`);this._activeEncoding=o}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(o){if(o.col<0||o.col>=this._bufferService.cols||o.row<0||o.row>=this._bufferService.rows||o.button===4&&o.action===32||o.button===3&&o.action!==32||o.button!==4&&(o.action===2||o.action===3)||(o.col++,o.row++,o.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,o,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(o))return!1;const y=this._encodings[this._activeEncoding](o);return y&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(y):this._coreService.triggerDataEvent(y,!0)),this._lastEvent=o,!0}explainEvents(o){return{down:!!(1&o),up:!!(2&o),drag:!!(4&o),move:!!(8&o),wheel:!!(16&o)}}_equalEvents(o,y,A){if(A){if(o.x!==y.x||o.y!==y.y)return!1}else if(o.col!==y.col||o.row!==y.row)return!1;return o.button===y.button&&o.action===y.action&&o.ctrl===y.ctrl&&o.alt===y.alt&&o.shift===y.shift}};h.CoreMouseService=l=m([g(0,u.IBufferService),g(1,u.ICoreService)],l)},6975:function(L,h,p){var m=this&&this.__decorate||function(l,o,y,A){var k,R=arguments.length,C=R<3?o:A===null?A=Object.getOwnPropertyDescriptor(o,y):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(l,o,y,A);else for(var T=l.length-1;T>=0;T--)(k=l[T])&&(C=(R<3?k(C):R>3?k(o,y,C):k(o,y))||C);return R>3&&C&&Object.defineProperty(o,y,C),C},g=this&&this.__param||function(l,o){return function(y,A){o(y,A,l)}};Object.defineProperty(h,"__esModule",{value:!0}),h.CoreService=void 0;const u=p(1439),v=p(8460),w=p(844),x=p(2585),b=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let f=h.CoreService=class extends w.Disposable{constructor(l,o,y){super(),this._bufferService=l,this._logService=o,this._optionsService=y,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new v.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new v.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new v.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new v.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,u.clone)(b),this.decPrivateModes=(0,u.clone)(d)}reset(){this.modes=(0,u.clone)(b),this.decPrivateModes=(0,u.clone)(d)}triggerDataEvent(l,o=!1){if(this._optionsService.rawOptions.disableStdin)return;const y=this._bufferService.buffer;o&&this._optionsService.rawOptions.scrollOnUserInput&&y.ybase!==y.ydisp&&this._onRequestScrollToBottom.fire(),o&&this._onUserInput.fire(),this._logService.debug(`sending data "${l}"`,(()=>l.split("").map((A=>A.charCodeAt(0))))),this._onData.fire(l)}triggerBinaryEvent(l){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${l}"`,(()=>l.split("").map((o=>o.charCodeAt(0))))),this._onBinary.fire(l))}};h.CoreService=f=m([g(0,x.IBufferService),g(1,x.ILogService),g(2,x.IOptionsService)],f)},9074:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.DecorationService=void 0;const m=p(8055),g=p(8460),u=p(844),v=p(6106);let w=0,x=0;class b extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new v.SortedList((l=>l==null?void 0:l.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,u.toDisposable)((()=>this.reset())))}registerDecoration(l){if(l.marker.isDisposed)return;const o=new d(l);if(o){const y=o.marker.onDispose((()=>o.dispose()));o.onDispose((()=>{o&&(this._decorations.delete(o)&&this._onDecorationRemoved.fire(o),y.dispose())})),this._decorations.insert(o),this._onDecorationRegistered.fire(o)}return o}reset(){for(const l of this._decorations.values())l.dispose();this._decorations.clear()}*getDecorationsAtCell(l,o,y){let A=0,k=0;for(const R of this._decorations.getKeyIterator(o))A=R.options.x??0,k=A+(R.options.width??1),l>=A&&l<k&&(!y||(R.options.layer??"bottom")===y)&&(yield R)}forEachDecorationAtCell(l,o,y,A){this._decorations.forEachByKey(o,(k=>{w=k.options.x??0,x=w+(k.options.width??1),l>=w&&l<x&&(!y||(k.options.layer??"bottom")===y)&&A(k)}))}}h.DecorationService=b;class d extends u.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=m.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=m.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(l){super(),this.options=l,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=l.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.InstantiationService=h.ServiceCollection=void 0;const m=p(2585),g=p(8343);class u{constructor(...w){this._entries=new Map;for(const[x,b]of w)this.set(x,b)}set(w,x){const b=this._entries.get(w);return this._entries.set(w,x),b}forEach(w){for(const[x,b]of this._entries.entries())w(x,b)}has(w){return this._entries.has(w)}get(w){return this._entries.get(w)}}h.ServiceCollection=u,h.InstantiationService=class{constructor(){this._services=new u,this._services.set(m.IInstantiationService,this)}setService(v,w){this._services.set(v,w)}getService(v){return this._services.get(v)}createInstance(v,...w){const x=(0,g.getServiceDependencies)(v).sort(((f,l)=>f.index-l.index)),b=[];for(const f of x){const l=this._services.get(f.id);if(!l)throw new Error(`[createInstance] ${v.name} depends on UNKNOWN service ${f.id}.`);b.push(l)}const d=x.length>0?x[0].index:w.length;if(w.length!==d)throw new Error(`[createInstance] First service dependency of ${v.name} at position ${d+1} conflicts with ${w.length} static arguments`);return new v(...w,...b)}}},7866:function(L,h,p){var m=this&&this.__decorate||function(d,f,l,o){var y,A=arguments.length,k=A<3?f:o===null?o=Object.getOwnPropertyDescriptor(f,l):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(d,f,l,o);else for(var R=d.length-1;R>=0;R--)(y=d[R])&&(k=(A<3?y(k):A>3?y(f,l,k):y(f,l))||k);return A>3&&k&&Object.defineProperty(f,l,k),k},g=this&&this.__param||function(d,f){return function(l,o){f(l,o,d)}};Object.defineProperty(h,"__esModule",{value:!0}),h.traceCall=h.setTraceLogger=h.LogService=void 0;const u=p(844),v=p(2585),w={trace:v.LogLevelEnum.TRACE,debug:v.LogLevelEnum.DEBUG,info:v.LogLevelEnum.INFO,warn:v.LogLevelEnum.WARN,error:v.LogLevelEnum.ERROR,off:v.LogLevelEnum.OFF};let x,b=h.LogService=class extends u.Disposable{get logLevel(){return this._logLevel}constructor(d){super(),this._optionsService=d,this._logLevel=v.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=w[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(d){for(let f=0;f<d.length;f++)typeof d[f]=="function"&&(d[f]=d[f]())}_log(d,f,l){this._evalLazyOptionalParams(l),d.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+f,...l)}trace(d,...f){var l;this._logLevel<=v.LogLevelEnum.TRACE&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.trace.bind(this._optionsService.options.logger))??console.log,d,f)}debug(d,...f){var l;this._logLevel<=v.LogLevelEnum.DEBUG&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.debug.bind(this._optionsService.options.logger))??console.log,d,f)}info(d,...f){var l;this._logLevel<=v.LogLevelEnum.INFO&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.info.bind(this._optionsService.options.logger))??console.info,d,f)}warn(d,...f){var l;this._logLevel<=v.LogLevelEnum.WARN&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.warn.bind(this._optionsService.options.logger))??console.warn,d,f)}error(d,...f){var l;this._logLevel<=v.LogLevelEnum.ERROR&&this._log(((l=this._optionsService.options.logger)==null?void 0:l.error.bind(this._optionsService.options.logger))??console.error,d,f)}};h.LogService=b=m([g(0,v.IOptionsService)],b),h.setTraceLogger=function(d){x=d},h.traceCall=function(d,f,l){if(typeof l.value!="function")throw new Error("not supported");const o=l.value;l.value=function(...y){if(x.logLevel!==v.LogLevelEnum.TRACE)return o.apply(this,y);x.trace(`GlyphRenderer#${o.name}(${y.map((k=>JSON.stringify(k))).join(", ")})`);const A=o.apply(this,y);return x.trace(`GlyphRenderer#${o.name} return`,A),A}}},7302:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.OptionsService=h.DEFAULT_OPTIONS=void 0;const m=p(8460),g=p(844),u=p(6114);h.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:u.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const v=["normal","bold","100","200","300","400","500","600","700","800","900"];class w extends g.Disposable{constructor(b){super(),this._onOptionChange=this.register(new m.EventEmitter),this.onOptionChange=this._onOptionChange.event;const d={...h.DEFAULT_OPTIONS};for(const f in b)if(f in d)try{const l=b[f];d[f]=this._sanitizeAndValidateOption(f,l)}catch(l){console.error(l)}this.rawOptions=d,this.options={...d},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(b,d){return this.onOptionChange((f=>{f===b&&d(this.rawOptions[b])}))}onMultipleOptionChange(b,d){return this.onOptionChange((f=>{b.indexOf(f)!==-1&&d()}))}_setupOptions(){const b=f=>{if(!(f in h.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);return this.rawOptions[f]},d=(f,l)=>{if(!(f in h.DEFAULT_OPTIONS))throw new Error(`No option with key "${f}"`);l=this._sanitizeAndValidateOption(f,l),this.rawOptions[f]!==l&&(this.rawOptions[f]=l,this._onOptionChange.fire(f))};for(const f in this.rawOptions){const l={get:b.bind(this,f),set:d.bind(this,f)};Object.defineProperty(this.options,f,l)}}_sanitizeAndValidateOption(b,d){switch(b){case"cursorStyle":if(d||(d=h.DEFAULT_OPTIONS[b]),!(function(f){return f==="block"||f==="underline"||f==="bar"})(d))throw new Error(`"${d}" is not a valid value for ${b}`);break;case"wordSeparator":d||(d=h.DEFAULT_OPTIONS[b]);break;case"fontWeight":case"fontWeightBold":if(typeof d=="number"&&1<=d&&d<=1e3)break;d=v.includes(d)?d:h.DEFAULT_OPTIONS[b];break;case"cursorWidth":d=Math.floor(d);case"lineHeight":case"tabStopWidth":if(d<1)throw new Error(`${b} cannot be less than 1, value: ${d}`);break;case"minimumContrastRatio":d=Math.max(1,Math.min(21,Math.round(10*d)/10));break;case"scrollback":if((d=Math.min(d,4294967295))<0)throw new Error(`${b} cannot be less than 0, value: ${d}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(d<=0)throw new Error(`${b} cannot be less than or equal to 0, value: ${d}`);break;case"rows":case"cols":if(!d&&d!==0)throw new Error(`${b} must be numeric, value: ${d}`);break;case"windowsPty":d=d??{}}return d}}h.OptionsService=w},2660:function(L,h,p){var m=this&&this.__decorate||function(w,x,b,d){var f,l=arguments.length,o=l<3?x:d===null?d=Object.getOwnPropertyDescriptor(x,b):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(w,x,b,d);else for(var y=w.length-1;y>=0;y--)(f=w[y])&&(o=(l<3?f(o):l>3?f(x,b,o):f(x,b))||o);return l>3&&o&&Object.defineProperty(x,b,o),o},g=this&&this.__param||function(w,x){return function(b,d){x(b,d,w)}};Object.defineProperty(h,"__esModule",{value:!0}),h.OscLinkService=void 0;const u=p(2585);let v=h.OscLinkService=class{constructor(w){this._bufferService=w,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(w){const x=this._bufferService.buffer;if(w.id===void 0){const y=x.addMarker(x.ybase+x.y),A={data:w,id:this._nextId++,lines:[y]};return y.onDispose((()=>this._removeMarkerFromLink(A,y))),this._dataByLinkId.set(A.id,A),A.id}const b=w,d=this._getEntryIdKey(b),f=this._entriesWithId.get(d);if(f)return this.addLineToLink(f.id,x.ybase+x.y),f.id;const l=x.addMarker(x.ybase+x.y),o={id:this._nextId++,key:this._getEntryIdKey(b),data:b,lines:[l]};return l.onDispose((()=>this._removeMarkerFromLink(o,l))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(w,x){const b=this._dataByLinkId.get(w);if(b&&b.lines.every((d=>d.line!==x))){const d=this._bufferService.buffer.addMarker(x);b.lines.push(d),d.onDispose((()=>this._removeMarkerFromLink(b,d)))}}getLinkData(w){var x;return(x=this._dataByLinkId.get(w))==null?void 0:x.data}_getEntryIdKey(w){return`${w.id};;${w.uri}`}_removeMarkerFromLink(w,x){const b=w.lines.indexOf(x);b!==-1&&(w.lines.splice(b,1),w.lines.length===0&&(w.data.id!==void 0&&this._entriesWithId.delete(w.key),this._dataByLinkId.delete(w.id)))}};h.OscLinkService=v=m([g(0,u.IBufferService)],v)},8343:(L,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.createDecorator=h.getServiceDependencies=h.serviceRegistry=void 0;const p="di$target",m="di$dependencies";h.serviceRegistry=new Map,h.getServiceDependencies=function(g){return g[m]||[]},h.createDecorator=function(g){if(h.serviceRegistry.has(g))return h.serviceRegistry.get(g);const u=function(v,w,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(b,d,f){d[p]===d?d[m].push({id:b,index:f}):(d[m]=[{id:b,index:f}],d[p]=d)})(u,v,x)};return u.toString=()=>g,h.serviceRegistry.set(g,u),u}},2585:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.IDecorationService=h.IUnicodeService=h.IOscLinkService=h.IOptionsService=h.ILogService=h.LogLevelEnum=h.IInstantiationService=h.ICharsetService=h.ICoreService=h.ICoreMouseService=h.IBufferService=void 0;const m=p(8343);var g;h.IBufferService=(0,m.createDecorator)("BufferService"),h.ICoreMouseService=(0,m.createDecorator)("CoreMouseService"),h.ICoreService=(0,m.createDecorator)("CoreService"),h.ICharsetService=(0,m.createDecorator)("CharsetService"),h.IInstantiationService=(0,m.createDecorator)("InstantiationService"),(function(u){u[u.TRACE=0]="TRACE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARN=3]="WARN",u[u.ERROR=4]="ERROR",u[u.OFF=5]="OFF"})(g||(h.LogLevelEnum=g={})),h.ILogService=(0,m.createDecorator)("LogService"),h.IOptionsService=(0,m.createDecorator)("OptionsService"),h.IOscLinkService=(0,m.createDecorator)("OscLinkService"),h.IUnicodeService=(0,m.createDecorator)("UnicodeService"),h.IDecorationService=(0,m.createDecorator)("DecorationService")},1480:(L,h,p)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.UnicodeService=void 0;const m=p(8460),g=p(225);class u{static extractShouldJoin(w){return(1&w)!=0}static extractWidth(w){return w>>1&3}static extractCharKind(w){return w>>3}static createPropertyValue(w,x,b=!1){return(16777215&w)<<3|(3&x)<<1|(b?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new m.EventEmitter,this.onChange=this._onChange.event;const w=new g.UnicodeV6;this.register(w),this._active=w.version,this._activeProvider=w}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(w){if(!this._providers[w])throw new Error(`unknown Unicode version "${w}"`);this._active=w,this._activeProvider=this._providers[w],this._onChange.fire(w)}register(w){this._providers[w.version]=w}wcwidth(w){return this._activeProvider.wcwidth(w)}getStringCellWidth(w){let x=0,b=0;const d=w.length;for(let f=0;f<d;++f){let l=w.charCodeAt(f);if(55296<=l&&l<=56319){if(++f>=d)return x+this.wcwidth(l);const A=w.charCodeAt(f);56320<=A&&A<=57343?l=1024*(l-55296)+A-56320+65536:x+=this.wcwidth(A)}const o=this.charProperties(l,b);let y=u.extractWidth(o);u.extractShouldJoin(o)&&(y-=u.extractWidth(b)),x+=y,b=o}return x}charProperties(w,x){return this._activeProvider.charProperties(w,x)}}h.UnicodeService=u}},S={};function N(L){var h=S[L];if(h!==void 0)return h.exports;var p=S[L]={exports:{}};return E[L].call(p.exports,p,p.exports,N),p.exports}var q={};return(()=>{var L=q;Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;const h=N(9042),p=N(3236),m=N(844),g=N(5741),u=N(8285),v=N(7975),w=N(7090),x=["cols","rows"];class b extends m.Disposable{constructor(f){super(),this._core=this.register(new p.Terminal(f)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const l=y=>this._core.options[y],o=(y,A)=>{this._checkReadonlyOptions(y),this._core.options[y]=A};for(const y in this._core.options){const A={get:l.bind(this,y),set:o.bind(this,y)};Object.defineProperty(this._publicOptions,y,A)}}_checkReadonlyOptions(f){if(x.includes(f))throw new Error(`Option "${f}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new v.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new w.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new u.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const f=this._core.coreService.decPrivateModes;let l="none";switch(this._core.coreMouseService.activeProtocol){case"X10":l="x10";break;case"VT200":l="vt200";break;case"DRAG":l="drag";break;case"ANY":l="any"}return{applicationCursorKeysMode:f.applicationCursorKeys,applicationKeypadMode:f.applicationKeypad,bracketedPasteMode:f.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:l,originMode:f.origin,reverseWraparoundMode:f.reverseWraparound,sendFocusMode:f.sendFocus,wraparoundMode:f.wraparound}}get options(){return this._publicOptions}set options(f){for(const l in f)this._publicOptions[l]=f[l]}blur(){this._core.blur()}focus(){this._core.focus()}input(f,l=!0){this._core.input(f,l)}resize(f,l){this._verifyIntegers(f,l),this._core.resize(f,l)}open(f){this._core.open(f)}attachCustomKeyEventHandler(f){this._core.attachCustomKeyEventHandler(f)}attachCustomWheelEventHandler(f){this._core.attachCustomWheelEventHandler(f)}registerLinkProvider(f){return this._core.registerLinkProvider(f)}registerCharacterJoiner(f){return this._checkProposedApi(),this._core.registerCharacterJoiner(f)}deregisterCharacterJoiner(f){this._checkProposedApi(),this._core.deregisterCharacterJoiner(f)}registerMarker(f=0){return this._verifyIntegers(f),this._core.registerMarker(f)}registerDecoration(f){return this._checkProposedApi(),this._verifyPositiveIntegers(f.x??0,f.width??0,f.height??0),this._core.registerDecoration(f)}hasSelection(){return this._core.hasSelection()}select(f,l,o){this._verifyIntegers(f,l,o),this._core.select(f,l,o)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(f,l){this._verifyIntegers(f,l),this._core.selectLines(f,l)}dispose(){super.dispose()}scrollLines(f){this._verifyIntegers(f),this._core.scrollLines(f)}scrollPages(f){this._verifyIntegers(f),this._core.scrollPages(f)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(f){this._verifyIntegers(f),this._core.scrollToLine(f)}clear(){this._core.clear()}write(f,l){this._core.write(f,l)}writeln(f,l){this._core.write(f),this._core.write(`\r
443
+ `,l)}paste(f){this._core.paste(f)}refresh(f,l){this._verifyIntegers(f,l),this._core.refresh(f,l)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(f){this._addonManager.loadAddon(this,f)}static get strings(){return h}_verifyIntegers(...f){for(const l of f)if(l===1/0||isNaN(l)||l%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...f){for(const l of f)if(l&&(l===1/0||isNaN(l)||l%1!=0||l<0))throw new Error("This API only accepts positive integers")}}L.Terminal=b})(),q})()))})(Sc)),Sc.exports}var Zy=Vy(),bc={exports:{}},lp;function Qy(){return lp||(lp=1,(function(a,_){(function(E,S){a.exports=S()})(self,(()=>(()=>{var E={};return(()=>{var S=E;Object.defineProperty(S,"__esModule",{value:!0}),S.FitAddon=void 0,S.FitAddon=class{activate(N){this._terminal=N}dispose(){}fit(){const N=this.proposeDimensions();if(!N||!this._terminal||isNaN(N.cols)||isNaN(N.rows))return;const q=this._terminal._core;this._terminal.rows===N.rows&&this._terminal.cols===N.cols||(q._renderService.clear(),this._terminal.resize(N.cols,N.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const N=this._terminal._core,q=N._renderService.dimensions;if(q.css.cell.width===0||q.css.cell.height===0)return;const L=this._terminal.options.scrollback===0?0:N.viewport.scrollBarWidth,h=window.getComputedStyle(this._terminal.element.parentElement),p=parseInt(h.getPropertyValue("height")),m=Math.max(0,parseInt(h.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),u=p-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),v=m-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-L;return{cols:Math.max(2,Math.floor(v/q.css.cell.width)),rows:Math.max(1,Math.floor(u/q.css.cell.height))}}}})(),E})()))})(bc)),bc.exports}var Jy=Qy(),Cc={exports:{}},op;function eS(){return op||(op=1,(function(a,_){(function(E,S){a.exports=S()})(self,(()=>(()=>{var E={6:(L,h)=>{function p(g){try{const u=new URL(g),v=u.password&&u.username?`${u.protocol}//${u.username}:${u.password}@${u.host}`:u.username?`${u.protocol}//${u.username}@${u.host}`:`${u.protocol}//${u.host}`;return g.toLocaleLowerCase().startsWith(v.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(h,"__esModule",{value:!0}),h.LinkComputer=h.WebLinkProvider=void 0,h.WebLinkProvider=class{constructor(g,u,v,w={}){this._terminal=g,this._regex=u,this._handler=v,this._options=w}provideLinks(g,u){const v=m.computeLink(g,this._regex,this._terminal,this._handler);u(this._addCallbacks(v))}_addCallbacks(g){return g.map((u=>(u.leave=this._options.leave,u.hover=(v,w)=>{if(this._options.hover){const{range:x}=u;this._options.hover(v,w,x)}},u)))}};class m{static computeLink(u,v,w,x){const b=new RegExp(v.source,(v.flags||"")+"g"),[d,f]=m._getWindowedLineStrings(u-1,w),l=d.join("");let o;const y=[];for(;o=b.exec(l);){const A=o[0];if(!p(A))continue;const[k,R]=m._mapStrIdx(w,f,0,o.index),[C,T]=m._mapStrIdx(w,k,R,A.length);if(k===-1||R===-1||C===-1||T===-1)continue;const H={start:{x:R+1,y:k+1},end:{x:T,y:C+1}};y.push({range:H,text:A,activate:x})}return y}static _getWindowedLineStrings(u,v){let w,x=u,b=u,d=0,f="";const l=[];if(w=v.buffer.active.getLine(u)){const o=w.translateToString(!0);if(w.isWrapped&&o[0]!==" "){for(d=0;(w=v.buffer.active.getLine(--x))&&d<2048&&(f=w.translateToString(!0),d+=f.length,l.push(f),w.isWrapped&&f.indexOf(" ")===-1););l.reverse()}for(l.push(o),d=0;(w=v.buffer.active.getLine(++b))&&w.isWrapped&&d<2048&&(f=w.translateToString(!0),d+=f.length,l.push(f),f.indexOf(" ")===-1););}return[l,x]}static _mapStrIdx(u,v,w,x){const b=u.buffer.active,d=b.getNullCell();let f=w;for(;x;){const l=b.getLine(v);if(!l)return[-1,-1];for(let o=f;o<l.length;++o){l.getCell(o,d);const y=d.getChars();if(d.getWidth()&&(x-=y.length||1,o===l.length-1&&y==="")){const A=b.getLine(v+1);A&&A.isWrapped&&(A.getCell(0,d),d.getWidth()===2&&(x+=1))}if(x<0)return[v,o]}v++,f=0}return[v,f]}}h.LinkComputer=m}},S={};function N(L){var h=S[L];if(h!==void 0)return h.exports;var p=S[L]={exports:{}};return E[L](p,p.exports,N),p.exports}var q={};return(()=>{var L=q;Object.defineProperty(L,"__esModule",{value:!0}),L.WebLinksAddon=void 0;const h=N(6),p=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function m(g,u){const v=window.open();if(v){try{v.opener=null}catch{}v.location.href=u}else console.warn("Opening link blocked as opener could not be cleared")}L.WebLinksAddon=class{constructor(g=m,u={}){this._handler=g,this._options=u}activate(g){this._terminal=g;const u=this._options,v=u.urlRegex||p;this._linkProvider=this._terminal.registerLinkProvider(new h.WebLinkProvider(this._terminal,v,this._handler,u))}dispose(){var g;(g=this._linkProvider)==null||g.dispose()}}})(),q})()))})(Cc)),Cc.exports}var tS=eS();function sS(a,_){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal?session=${encodeURIComponent(a)}&token=${encodeURIComponent(_)}`}const iS=15e3,nS=new Set([4001,4004]),aS='"Geist Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace';function Gr(a,_){return typeof document>"u"?_:getComputedStyle(document.documentElement).getPropertyValue(a).trim()||_}const rS={black:"#1a1a1e",red:"#f87171",green:"#4ade80",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#9b8fc4",cyan:"#22d3ee",white:"#f3f3f5",brightBlack:"#404046",brightRed:"#ff9b96",brightGreen:"#86efac",brightYellow:"#ffd966",brightBlue:"#60a5fa",brightMagenta:"#c4b5fd",brightCyan:"#67e8f9",brightWhite:"#ffffff"},lS={black:"#3a3a3e",red:"#dc2626",green:"#16a34a",yellow:"#b45309",blue:"#2563eb",magenta:"#7c3aed",cyan:"#0891b2",white:"#d4d4d8",brightBlack:"#6b6b75",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#f59e0b",brightBlue:"#3b82f6",brightMagenta:"#9b8fc4",brightCyan:"#22d3ee",brightWhite:"#ffffff"};function cp(a){const _=Gr("--bg",a==="dark"?"#0c0c0e":"#fbfbfc"),E=Gr("--ink",a==="dark"?"#f3f3f5":"#16161a"),S=Gr("--brand",a==="dark"?"#6be195":"#167e3a");return{...a==="dark"?rS:lS,background:_,foreground:E,cursor:S,cursorAccent:_,selectionBackground:`${S}40`}}const oS=({sessionId:a,token:_})=>{const E=U.useRef(null),S=U.useRef(null),[N,q]=U.useState("connecting"),[L,h]=U.useState(null);U.useEffect(()=>Nc(m=>{S.current&&(S.current.options.theme=cp(m))}),[]),U.useEffect(()=>{var y;const m=E.current;if(!m)return;let g=!1,u=0,v=null,w=null;const x=new Zy.Terminal({cursorBlink:!0,fontSize:13,fontFamily:Gr("--mono",aS),theme:cp(Dc()),scrollback:1e4,allowProposedApi:!0});S.current=x;const b=new Jy.FitAddon;x.loadAddon(b),x.loadAddon(new tS.WebLinksAddon),x.parser.registerCsiHandler({prefix:">",final:"q"},()=>(x.write("\x1BP>|XTerm(370)\x1B\\"),!0)),x.parser.registerOscHandler(52,A=>{var C;const k=A.split(";");if(k.length<2)return!1;const R=k[k.length-1];try{const T=atob(R),H=Uint8Array.from(T,W=>W.charCodeAt(0)),I=new TextDecoder().decode(H);(C=navigator.clipboard)==null||C.writeText(I).catch(()=>{})}catch{}return!0}),x.open(m),b.fit(),(y=document.fonts)==null||y.ready.then(()=>{g||(b.fit(),f())});const d=x.onData(A=>{(w==null?void 0:w.readyState)===WebSocket.OPEN&&w.send(A)}),f=()=>{(w==null?void 0:w.readyState)===WebSocket.OPEN&&w.send(JSON.stringify({type:"resize",cols:x.cols,rows:x.rows}))},l=new ResizeObserver(()=>{b.fit(),f()});l.observe(m);function o(){if(g)return;const A=new WebSocket(sS(a,_));w=A,A.onopen=()=>{u=0,q("connected"),h(null),b.fit(),f()},A.onmessage=k=>{const R=typeof k.data=="string"?k.data:new TextDecoder().decode(k.data);x.write(R)},A.onclose=k=>{if(g)return;if(nS.has(k.code)){q("error"),h(k.reason||`Connection refused (${k.code})`);return}const R=Math.min(1e3*2**u,iS);u+=1,q("connecting"),v=setTimeout(o,R)}}return o(),()=>{g=!0,v&&clearTimeout(v),l.disconnect(),d.dispose(),w==null||w.close(),x.dispose(),S.current=null}},[a,_]);const p=N==="connected"?"Connected":N==="error"?L??"Error":"Connecting…";return n.jsxs("div",{className:"harness-terminal",children:[n.jsxs("div",{className:"terminal-statusbar","data-status":N,children:[n.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),n.jsx("span",{className:"terminal-status-label",children:p})]}),n.jsx("div",{ref:E,className:"terminal-screen"})]})},cS=8e3;function uS({message:a,onDismiss:_}){return U.useEffect(()=>{const E=window.setTimeout(_,cS);return()=>window.clearTimeout(E)},[a,_]),n.jsxs("div",{className:"toast",role:"alert","data-testid":"toast",children:[n.jsx("span",{className:"toast-message",children:a}),n.jsx("button",{className:"toast-dismiss","aria-label":"Dismiss",onClick:_,children:"×"})]})}function hS(){const a=U.useRef(null);return U.useEffect(()=>{const _=a.current;if(!_)return;let E=null;const S=()=>{E=null,_.dataset.show="false",_.textContent=""},N=h=>{const p=h.closest("[data-tooltip], [title], [data-tip-stash]");if(!p||p===E)return;const m=p;m.title&&(m.dataset.tipStash=m.title,m.removeAttribute("title"));const g=m.dataset.tooltip||m.dataset.tipStash;if(!g)return;E=p,_.textContent=g,_.dataset.show="true";const u=p.getBoundingClientRect(),{offsetWidth:v,offsetHeight:w}=_,x=p.closest(".rail-workflows");if(x&&x.getBoundingClientRect().right+v+14<=window.innerWidth){const f=x.getBoundingClientRect().right+8,l=Math.min(Math.max(u.top+u.height/2-w/2,6),window.innerHeight-w-6);_.style.transform=`translate(${Math.round(f)}px, ${Math.round(l)}px)`;return}const b=Math.min(Math.max(u.left+u.width/2-v/2,6),window.innerWidth-v-6),d=u.top-w-7>=4?u.top-w-7:u.bottom+7;_.style.transform=`translate(${Math.round(b)}px, ${Math.round(d)}px)`},q=h=>N(h.target),L=h=>{E&&!E.contains(h.relatedTarget)&&S()};return document.addEventListener("pointerover",q,!0),document.addEventListener("pointerout",L,!0),document.addEventListener("pointerdown",S,!0),document.addEventListener("keydown",S,!0),document.addEventListener("scroll",S,!0),window.addEventListener("blur",S),()=>{document.removeEventListener("pointerover",q,!0),document.removeEventListener("pointerout",L,!0),document.removeEventListener("pointerdown",S,!0),document.removeEventListener("keydown",S,!0),document.removeEventListener("scroll",S,!0),window.removeEventListener("blur",S)}},[]),n.jsx("div",{ref:a,className:"app-tooltip","data-show":"false",role:"tooltip","aria-hidden":"true"})}const up=a=>a.split("/").filter(Boolean).pop()??a,dS=(a,_)=>a===_||a.startsWith(`${_}/`);function fS(a,_,E){const S=new Map;for(const p of a){const m=S.get(p.cwd);(!m||p.lastActiveAt>m)&&S.set(p.cwd,p.lastActiveAt)}const N=p=>E.filter(m=>dS(m.path,p)).length,q=Array.from(S.entries()).sort(([p,m],[g,u])=>u.localeCompare(m)||p.localeCompare(g)).map(([p,m])=>({cwd:p,label:up(p),lastActiveAt:m,agentCount:N(p)})),L=new Set(S.keys()),h=[];for(const p of _)L.has(p)||(L.add(p),h.push({cwd:p,label:up(p),lastActiveAt:null,agentCount:N(p)}));return[...q,...h]}function pS(a,_){const E=_.reduce((S,N)=>S+N.agentCount,0);return Math.max(0,a.length-E)}const Kp=[{id:"have",title:"Open a folder",sub:"Add a folder that already holds an agent",icon:"Folder"},{id:"template",title:"Start from a template",sub:"Ready-made workflows you can edit",icon:"LayoutTemplate"},{id:"idea",title:"Start from an idea",sub:"Describe it; the agent scaffolds it",icon:"Sparkles"}];function Xp({recentDirs:a,projectRoot:_,listDir:E,onClose:S,onConnect:N,onScan:q,onScaffold:L,onBrowseTemplates:h,onSaveProjectRoot:p,listHarnesses:m,triggerRef:g,initialDoor:u}){const[v,w]=U.useState(u??null),[x,b]=U.useState([]);U.useEffect(()=>{let o=!1;return m().then(y=>{o||b(y)}).catch(()=>{}),()=>{o=!0}},[m]);const d=U.useRef(null);zn(!0,{onDismiss:S,containerRef:d,triggerRef:g});const f=Kp.find(o=>o.id===v)??null,l=o=>{if(o==="template"){h();return}w(o)};return n.jsx("div",{className:"modal-backdrop",children:n.jsxs("div",{className:"modal modal-add-workspace",role:"dialog","aria-label":f?f.title:"Add to Sapiom",ref:d,children:[n.jsxs("div",{className:"modal-header",children:[v&&!u&&n.jsx("button",{type:"button",className:"theme-toggle aw-back","aria-label":"Back to all options","data-testid":"aw-back",onClick:()=>w(null),children:n.jsx(fe,{name:"ArrowLeft",size:14})}),n.jsx("span",{className:"aw-title",children:f?f.title:"Add to Sapiom"}),n.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:S,children:n.jsx(fe,{name:"X",size:14})})]}),!v&&n.jsx(Gp,{onPick:l}),v==="have"&&n.jsx(mS,{recentDirs:a,listDir:E,onConnect:N,onScan:q,onScaffold:L,onBrowseTemplates:h,entries:x,onDone:S}),v==="idea"&&n.jsx(gS,{projectRoot:_,listDir:E,onScaffold:L,onSaveProjectRoot:p,onDone:S})]})})}function Gp({onPick:a}){return n.jsx("div",{className:"aw-doors","data-testid":"aw-doors",children:Kp.map(_=>n.jsxs("button",{type:"button",className:"aw-door","data-testid":`aw-door-${_.id}`,onClick:()=>a(_.id),children:[n.jsx("span",{className:"aw-door-icon","aria-hidden":"true",children:n.jsx(fe,{name:_.icon,size:15})}),n.jsxs("span",{className:"aw-door-text",children:[n.jsx("span",{className:"aw-door-title",children:_.title}),n.jsx("span",{className:"aw-door-sub",children:_.sub})]}),n.jsx("span",{className:"aw-door-arrow","aria-hidden":"true",children:n.jsx(fe,{name:"ArrowRight",size:14})})]},_.id))})}function mS({recentDirs:a,listDir:_,onConnect:E,onScan:S,onScaffold:N,onBrowseTemplates:q,entries:L,onDone:h}){const[p,m]=U.useState(a[0]??""),[g,u]=U.useState(!1),[v,w]=U.useState(null),[x,b]=U.useState(!1),[d,f]=U.useState(!1),[l,o]=U.useState(null),y=U.useCallback(async()=>{const k=wc(p.trim());if(!k)return;if(g){w({kind:"new"});return}b(!0),o(null);const R=Ay(k);try{const C=R?await _(R):null;if(!!(C!=null&&C.dirs.some(W=>wc(W.path)===k&&W.hasAgentProject))){w({kind:"project"});return}const H=await _(k);if(wc(H.path)!==k){w({kind:"new"});return}const I=H.dirs.filter(W=>W.hasAgentProject).length;w(I>0?{kind:"multi",found:I}:{kind:"plain"})}catch{try{R&&await _(R),w({kind:"new"})}catch{o("Couldn't read that directory.")}}finally{b(!1)}},[p,g,_]),A=async k=>{f(!0),o(null);try{await k(),h()}catch(R){o(R.message)}finally{f(!1)}};return v?n.jsxs(n.Fragment,{children:[n.jsx(vS,{path:p.trim(),outcome:v,busy:d,onChange:()=>w(null),onConnect:()=>void A(()=>E(p.trim())),onScan:()=>void A(async()=>{if(await S(p.trim())===0)throw new Error("No agent projects found under this folder.")}),onScaffold:()=>void A(()=>N(p.trim(),Bc())),onBrowseTemplates:q,entries:L}),l&&n.jsx("div",{className:"modal-error",children:l})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"modal-body",children:[n.jsx("section",{className:"modal-section",children:n.jsx(tl,{value:p,onChange:m,onSubmit:()=>void y(),recentDirs:a,listDir:_,onNewDirChange:u})}),n.jsx("p",{className:"modal-field-hint",children:"Any folder — we'll tell you what we find in it."}),l&&n.jsx("div",{className:"modal-error",children:l})]}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn-ghost",onClick:h,disabled:x,children:"Cancel"}),n.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-have-continue",onClick:()=>void y(),disabled:x||!p.trim(),children:x?"Checking…":"Continue"})]})]})}function _S({entries:a}){const[_,E]=U.useState(!1),[S,N]=U.useState(null),q=U.useRef(null);U.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const L=a.filter(u=>u.installMcpPrompt.trim().length>0);if(L.length===0)return null;const h=Bc(),p=L.find(u=>u.id===h)??L[0],m=L.filter(u=>u.id!==p.id),g=u=>{var v;(v=navigator.clipboard)==null||v.writeText(u.installMcpPrompt).then(()=>{el("mcp.install",{harness:u.id}),N(u.id),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>N(null),1600)}).catch(()=>{})};return n.jsxs("div",{className:"aw-mcp","data-testid":"mcp-install",children:[n.jsxs("div",{className:"aw-mcp-row",children:[n.jsxs("span",{className:"aw-mcp-text",children:["Also drive this project from your own terminal?"," ",n.jsx("span",{className:"aw-mcp-dim",children:"Sapiom MCP isn't set up here."})]}),n.jsxs("button",{type:"button",className:"btn-ghost","data-testid":`mcp-install-copy-${p.id}`,onClick:()=>g(p),children:[n.jsx(fe,{name:"Copy",size:13}),S===p.id?"Copied":"Copy setup prompt"]}),m.length>0&&n.jsx("button",{type:"button",className:"btn-ghost aw-mcp-more","aria-expanded":_,"aria-label":"Setup prompts for other agents","data-testid":"mcp-install-more",onClick:()=>E(u=>!u),children:n.jsx(fe,{name:_?"ChevronDown":"ChevronRight",size:13})})]}),_&&n.jsx("div",{className:"aw-mcp-list",children:m.map(u=>n.jsxs("div",{className:"aw-mcp-list-row",children:[n.jsx("span",{className:"aw-mcp-text",children:u.label}),n.jsxs("button",{type:"button",className:"btn-ghost","data-testid":`mcp-install-copy-${u.id}`,onClick:()=>g(u),children:[n.jsx(fe,{name:"Copy",size:13}),S===u.id?"Copied":"Copy"]})]},u.id))})]})}function vS({path:a,outcome:_,busy:E,onChange:S,onConnect:N,onScan:q,onScaffold:L,onBrowseTemplates:h,entries:p}){const m=_.kind==="project"||_.kind==="multi";return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"aw-result","data-tone":m?"good":"todo","data-testid":"aw-result","aria-live":"polite",children:[n.jsxs("div",{className:"aw-result-head",children:[n.jsx("span",{className:"aw-result-glyph","aria-hidden":"true",children:n.jsx(fe,{name:m?"Check":"TriangleAlert",size:14})}),n.jsxs("span",{className:"aw-result-text",children:[n.jsxs("span",{className:"aw-result-title",children:[_.kind==="project"&&"This is an agent project",_.kind==="multi"&&`${_.found} agent ${_.found===1?"project":"projects"} under this folder`,_.kind==="plain"&&"No agent project in this folder",_.kind==="new"&&"This folder doesn't exist yet"]}),n.jsx("span",{className:"aw-result-path",title:a,children:a})]}),n.jsx("button",{type:"button",className:"btn-ghost aw-result-change",onClick:S,disabled:E,children:"Change"})]}),_.kind==="plain"&&n.jsx(_S,{entries:p})]}),n.jsxs("div",{className:"modal-actions",children:[_.kind==="project"&&n.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add",onClick:N,disabled:E,children:E?"Adding…":"Add workspace"}),_.kind==="multi"&&n.jsx("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-add-all",onClick:q,disabled:E,children:E?"Adding…":`Add all ${_.found}`}),(_.kind==="plain"||_.kind==="new")&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",className:"btn-ghost",onClick:h,disabled:E,children:[n.jsx(fe,{name:"LayoutTemplate",size:13}),"Start from a template"]}),_.kind==="plain"&&n.jsx("button",{type:"button",className:"btn-ghost","data-testid":"aw-add-anyway",onClick:N,disabled:E,title:"Add the folder as a workspace now and scaffold an agent in it later",children:"Add folder anyway"}),n.jsxs("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-scaffold-here",onClick:L,disabled:E,children:[n.jsx(fe,{name:"Sparkles",size:13}),E?"Starting…":"Scaffold an agent here"]})]})]})]})}function gS({projectRoot:a,listDir:_,onScaffold:E,onSaveProjectRoot:S,onDone:N}){const[q,L]=U.useState(""),[h,p]=U.useState(""),[m,g]=U.useState(!1),[u,v]=U.useState(a??""),[w,x]=U.useState(!1),[b,d]=U.useState(!1),[f,l]=U.useState(new Set),[o,y]=U.useState(!1),[A,k]=U.useState(null);U.useEffect(()=>{const F=u.trim();if(!F)return;let Y=!1;return _(F).then(V=>{Y||l(new Set(V.dirs.map(M=>M.name)))}).catch(()=>{Y||l(new Set)}),()=>{Y=!0}},[u,_]);const R=F=>{L(F),m||p(jy(Ey(F),f))},C=h.trim(),T=Oc(C),H=T&&f.has(C),I=qp(C,u),W=!!q.trim()&&T&&!H&&!!I&&!o,P=()=>C?T?H?"That folder already exists here. Pick another name.":"Becomes the agent's name.":"Lowercase letters, numbers and dashes only — it becomes the package name.":"Becomes the agent's name.",Z=async()=>{if(W){y(!0),k(null);try{await E(I,Bc(),q.trim()),N()}catch(F){k(F.message),y(!1)}}},te=async F=>{const Y=F.trim();if(Y){v(Y),x(!1);try{await S(Y),d(!0)}catch(V){k(V.message)}}};return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"modal-body",children:[n.jsxs("label",{className:"aw-field",htmlFor:"aw-idea",children:[n.jsx("span",{className:"aw-field-label",children:"What should it do?"}),n.jsx("textarea",{id:"aw-idea",className:"modal-input aw-textarea","data-testid":"aw-idea",rows:3,value:q,placeholder:"Every morning, diff our competitors' pricing pages and Slack me the changes.",onChange:F=>R(F.target.value)})]}),n.jsxs("label",{className:"aw-field",htmlFor:"aw-name",children:[n.jsx("span",{className:"aw-field-label",children:"Name"}),n.jsx("input",{id:"aw-name",className:"modal-input","data-testid":"aw-name",value:h,spellCheck:!1,"aria-invalid":!!C&&(!T||H),onChange:F=>{p(F.target.value),g(!0)}})]}),w?n.jsxs("section",{className:"modal-section aw-root-picker",children:[n.jsx(tl,{value:u,onChange:v,onSubmit:()=>void te(u),recentDirs:[],listDir:_}),n.jsxs("div",{className:"aw-root-actions",children:[n.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>x(!1),children:"Cancel"}),n.jsx("button",{type:"button",className:"btn-ghost",onClick:()=>void te(u),children:"Use this folder"})]})]}):n.jsxs("div",{className:"aw-target",children:[n.jsx("span",{className:"aw-target-path","data-testid":"aw-target",title:I||u,children:I||`${u}/…`}),n.jsx("button",{type:"button",className:"btn-ghost aw-root-change","data-testid":"aw-change-root",onClick:()=>x(!0),children:"Change root…"})]}),n.jsx("p",{className:"modal-field-hint","data-invalid":!!C&&(!T||H),children:P()}),b&&n.jsx("p",{className:"modal-field-hint",children:"Saved as your default projects folder."}),A&&n.jsx("div",{className:"modal-error",children:A})]}),n.jsxs("div",{className:"modal-actions",children:[n.jsx("button",{className:"btn-ghost",onClick:N,disabled:o,children:"Cancel"}),n.jsxs("button",{className:"btn-primary modal-primary-cta","data-testid":"aw-scaffold-it",onClick:()=>void Z(),disabled:!W,children:[n.jsx(fe,{name:"Sparkles",size:13}),o?"Starting…":"Scaffold it"]})]})]})}function Bc(){return qs().preferredHarness??"claude-code"}function wc(a){return a.length>1?a.replace(/\/+$/,""):a}const yS=5;function SS({recentDirs:a,sessions:_,workflows:E,projectRoot:S,listDir:N,onCreateSession:q,onConnect:L,onScan:h,onScaffold:p,onSaveProjectRoot:m,listHarnesses:g,onBrowseTemplates:u,onDismiss:v,firstRun:w}){const[x,b]=U.useState(!1),[d,f]=U.useState(null),[l,o]=U.useState(null),y=U.useRef(null),A=U.useRef(null),k=U.useRef(null);zn(!x,{onDismiss:v,containerRef:k});const R=fS(_,a,E),C=R.slice(0,yS),T=pS(E,C),H=async I=>{var W;if(!l){o(I),f(null);try{const Z=(await g()).filter(Y=>Y.installed&&zp.includes(Y.id)),te=qs().preferredHarness,F=(te&&Z.some(Y=>Y.id===te)?te:void 0)??((W=Z[0])==null?void 0:W.id)??"claude-code";await q(I,F)}catch(P){f(P.message),o(null)}}};return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"modal-backdrop welcome-panel","data-testid":"welcome-panel",role:"dialog","aria-modal":"true","aria-label":w?"Welcome to Sapiom Agent Studio":"Sapiom Agent Studio",children:n.jsxs("div",{className:"welcome-card",ref:k,children:[n.jsx("button",{type:"button",className:"theme-toggle modal-close welcome-close","data-testid":"welcome-close","aria-label":"Close",title:"Close",onClick:v,children:n.jsx(fe,{name:"X",size:14})}),n.jsxs("div",{className:"welcome-body",children:[n.jsx("h1",{className:"welcome-title",children:w?"Welcome to Sapiom Agent Studio":"Sapiom Agent Studio"}),n.jsx("p",{className:"welcome-intro",children:"Studio turns the agent workflows in your codebase into a diagram you can run. Local runs are free and offline, with every step’s input, output and capability call on screen. Nothing ships until you say so."}),d&&n.jsx("div",{className:"welcome-error",children:d}),n.jsxs("div",{className:"welcome-open","data-testid":"welcome-open-card",children:[n.jsx("span",{className:"welcome-open-icon","aria-hidden":"true",children:n.jsx(fe,{name:"Folder",size:20})}),n.jsxs("span",{className:"welcome-open-copy",children:[n.jsx("span",{className:"welcome-open-title",children:"Open a folder"}),n.jsx("span",{className:"welcome-open-desc",children:"Workflows in the folder appear in the rail. Nothing is uploaded."})]}),n.jsx("button",{ref:y,type:"button",className:"btn-primary welcome-open-cta","data-testid":"welcome-start-project",onClick:()=>b(!0),children:"Open folder"})]}),n.jsxs("div",{className:"welcome-open","data-testid":"welcome-templates-card",children:[n.jsx("span",{className:"welcome-open-icon","aria-hidden":"true",children:n.jsx(fe,{name:"LayoutTemplate",size:20})}),n.jsxs("span",{className:"welcome-open-copy",children:[n.jsx("span",{className:"welcome-open-title",children:"Start from a template"}),n.jsx("span",{className:"welcome-open-desc",children:"Runnable starters, cloned locally and free to test."})]}),n.jsx("button",{ref:A,type:"button",className:"btn-line welcome-open-cta","data-testid":"welcome-browse-templates",onClick:u,children:"Browse templates"})]}),n.jsxs("a",{className:"welcome-docs-btn","data-testid":"welcome-docs",href:"https://docs.sapiom.ai/agents/quick-start",target:"_blank",rel:"noopener noreferrer",children:["Read documentation ",n.jsx(fe,{name:"ArrowUpRight",size:12})]}),R.length>0&&n.jsxs("div",{className:"welcome-recents-block",children:[n.jsx("h2",{className:"welcome-recents-title",children:"Recent workspaces"}),n.jsx("ul",{className:"welcome-recents","data-testid":"welcome-recents",children:C.map(I=>n.jsx("li",{children:n.jsxs("button",{type:"button",className:"welcome-recent","data-testid":`welcome-recent-${I.label}`,title:I.cwd,disabled:l!==null,onClick:()=>void H(I.cwd),children:[n.jsx(fe,{name:"Folder",size:13}),n.jsx("span",{className:"welcome-recent-name",children:I.label}),n.jsx("span",{className:"welcome-recent-path",children:l===I.cwd?"Opening…":I.cwd}),n.jsxs("span",{className:"welcome-recent-meta",children:[I.agentCount>0&&`${I.agentCount} agent${I.agentCount===1?"":"s"}`,I.agentCount>0&&I.lastActiveAt&&" · ",I.lastActiveAt&&Dp(Date.parse(I.lastActiveAt))]})]})},I.cwd))}),T>0&&n.jsxs("p",{className:"welcome-recents-note","data-testid":"welcome-recents-note",children:[E.length," agent"," ",E.length===1?"project":"projects"," known in total — the rail lists them all."]})]}),n.jsxs("span",{className:"welcome-hints-kbd",children:["or press ",n.jsx("kbd",{children:"⌘K"})]})]})]})}),x&&n.jsx(Xp,{recentDirs:a,projectRoot:S,listDir:N,onClose:()=>b(!1),onConnect:L,onScan:h,onScaffold:p,onSaveProjectRoot:m,listHarnesses:g,onBrowseTemplates:()=>{b(!1),u()},triggerRef:y,initialDoor:"have"})]})}const bS="data:image/svg+xml,%3csvg%20width='115'%20height='122'%20viewBox='0%200%20115%20122'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M105.267%2060.7219L98.8902%2071.7648L92.1353%2083.4669L83.3114%2098.7521L70.18%20121.491H0L13.1249%2098.7521H57.042L72.6274%2071.7648L79.0038%2060.7219L72.2619%2049.0459H98.5247L105.267%2060.7219Z'%20fill='%236BE195'/%3e%3cpath%20d='M114.072%200L100.954%2022.7189H57.0694L57.0498%2022.6928L57.0368%2022.7189L41.8365%2049.047L35.0945%2060.723L41.471%2071.7659H15.2016L8.8252%2060.723L15.5671%2049.047L21.9631%2037.978L30.774%2022.7189L43.8923%200H114.072Z'%20fill='%236BE195'/%3e%3c/svg%3e";function CS({onCollapse:a}){const[_,E]=U.useState(Dc());return U.useEffect(()=>Nc(E),[]),n.jsxs("header",{className:"brand-header",children:[n.jsxs("div",{className:"brand-lockup",children:[n.jsx("img",{src:bS,alt:"",className:"brand-mark"}),n.jsx("span",{className:"brand-name",children:"Sapiom"}),n.jsx("span",{className:"brand-divider"}),n.jsx("span",{className:"brand-product",children:"Studio"})]}),n.jsxs("div",{className:"brand-header-tools",children:[n.jsx("button",{className:"theme-toggle","data-testid":"theme-toggle","aria-label":_==="dark"?"Switch to light mode":"Switch to dark mode",title:_==="dark"?"Switch to light mode":"Switch to dark mode",onClick:Rv,children:n.jsx(fe,{name:_==="dark"?"Sun":"Moon",size:15})}),n.jsx("button",{className:"theme-toggle","data-testid":"rail-collapse","aria-label":"Collapse workspace panel",title:"Collapse workspace panel",onClick:a,children:n.jsx(fe,{name:"PanelLeftClose",size:15})})]})]})}const wS=[{id:"claude-code",label:"Claude Code",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:"",imageInput:!1},{id:"codex",label:"Codex CLI",mode:"embedded",experimental:!1,installed:!0,installMcpPrompt:"",imageInput:!1}];function xS(a){const _=a.filter(E=>E.id==="sapiom");return _.length===0?a:[..._,...a.filter(E=>E.id!=="sapiom")]}function Hc(a){return a.mode==="embedded"&&a.installed&&zp.includes(a.id)}function ES(a){if(Hc(a))return null;if(a.mode==="external")return`${a.label} runs in its own app. Studio can't launch it yet.`;if(!a.installed){const _=a.installMcpPrompt.trim();return _.length>0?_:`${a.label} isn't on this machine's PATH. Install its CLI, then restart the Studio server.`}return`This Studio build can't launch ${a.label} yet.`}function kS(a,_){var E;return((E=a.find(S=>S.id===_))==null?void 0:E.label)??_}function AS({entries:a,activeId:_,testidPrefix:E,onPick:S}){return n.jsx(n.Fragment,{children:a.map(N=>{const q=Hc(N),L=N.id===_,h=ES(N);return n.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":L,"aria-disabled":!q||void 0,className:"profile-menu-item provider-item"+(q?"":" is-unavailable"),"data-testid":`${E}-${N.id}`,"data-tooltip":h??void 0,onClick:()=>{q&&S(N.id)},children:[n.jsx("span",{className:"provider-item-check","aria-hidden":"true",children:L&&n.jsx(fe,{name:"Check",size:13})}),n.jsx(Ma,{kind:N.id,size:13}),N.label]},N.id)})})}function jS({recentDirs:a,launchDir:_,listDir:E,onClose:S,onCreate:N,listHarnesses:q,triggerRef:L}){const[h,p]=U.useState(_??a[0]??""),[m,g]=U.useState(()=>qs().preferredHarness??"claude-code"),[u,v]=U.useState(wS),[w,x]=U.useState(!1),[b,d]=U.useState(null),[f,l]=U.useState(!1),o=U.useCallback(()=>l(!1),[]),y=U.useRef(null),A=U.useRef(null);zn(!f,{onDismiss:S,containerRef:A,triggerRef:L}),U.useEffect(()=>{if(!q)return;let R=!1;return q().then(C=>{if(R||C.length===0)return;v(xS(C));const T=C.filter(Hc);g(H=>{var I;return T.some(W=>W.id===H)?H:((I=T[0])==null?void 0:I.id)??H})}).catch(()=>{}),()=>{R=!0}},[q]);const k=async()=>{const R=h.trim();if(R){x(!0),d(null);try{await N(R,m),S()}catch(C){d(C.message)}finally{x(!1)}}};return n.jsx("div",{className:"modal-backdrop",children:n.jsxs("div",{className:"modal modal-new-session",role:"dialog","aria-label":"New session",ref:A,children:[n.jsxs("div",{className:"modal-header",children:["New session",n.jsx("button",{className:"theme-toggle modal-close","aria-label":"Close",title:"Close",onClick:S,disabled:w,children:n.jsx(fe,{name:"X",size:14})})]}),n.jsxs("div",{className:"modal-body",children:[n.jsx("section",{className:"modal-section",children:n.jsx(tl,{value:h,onChange:p,onSubmit:()=>void k(),recentDirs:a,listDir:E})}),n.jsx("p",{className:"modal-field-hint",children:"Pick the workspace folder the agent runs in; the session is named after the folder."}),b&&n.jsx("div",{className:"modal-error",children:b})]}),n.jsxs("div",{className:"modal-actions",children:[n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:y,type:"button",className:"harness-select","data-testid":"harness-select","aria-haspopup":"menu","aria-expanded":f,"aria-label":"Agent for this session","data-tooltip":"Which coding agent runs this session",disabled:w,onClick:()=>l(R=>!R),children:[n.jsx(Ma,{kind:m,size:14}),n.jsx("span",{className:"harness-select-label",children:kS(u,m)}),n.jsx("span",{className:"disclosure-caret"+(f?" is-open":""),"aria-hidden":"true",children:n.jsx(fe,{name:"ChevronDown",size:12})})]}),n.jsx(ci,{open:f,anchorRef:y,onDismiss:o,placement:"up-start",className:"session-menu harness-select-menu",role:"menu",testid:"harness-select-menu",children:n.jsx(AS,{entries:u,activeId:m,testidPrefix:"harness-option",onPick:R=>{g(R),o()}})})]}),n.jsx("button",{className:"btn-ghost",onClick:S,disabled:w,children:"Cancel"}),n.jsx("button",{className:"btn-primary modal-primary-cta",onClick:()=>void k(),disabled:w||!h.trim(),children:w?"Starting…":"Start session"})]})]})})}function RS({authenticated:a,organizationName:_,telemetryOptIn:E,consentSource:S,consentEnvReason:N,onToggleTelemetry:q,rollingSummary:L,onToggleRollingSummary:h,onStartAuth:p,onDisconnect:m}){const[g,u]=U.useState(!1),[v,w]=U.useState({status:"idle"}),x=S==="env-forced-off",b=x?!1:E,d=async()=>{const y=!E;u(!0);try{await q(y),el("consent.changed",{optIn:y})}finally{u(!1)}},f=async()=>{u(!0);try{await h(!L)}finally{u(!1)}},l=async()=>{w({status:"pending"});try{await p()}catch(y){const A=y instanceof Error?y.message:"Could not start sign-in. Try again.";w({status:"error",message:A})}},o=async()=>{u(!0);try{await m()}finally{u(!1)}};return a&&v.status==="pending"&&w({status:"idle"}),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"settings-identity",children:a?_??"Signed in":"Not signed in"}),!a&&n.jsx("div",{className:"settings-auth-row",children:v.status==="pending"?n.jsxs("span",{className:"settings-auth-pending","data-testid":"settings-auth-pending",children:[n.jsx(fe,{name:"Loader",size:13}),"Opening browser… waiting for sign-in"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"btn-primary settings-connect-btn","data-testid":"settings-connect-btn",onClick:()=>void l(),children:"Connect account"}),v.status==="error"&&n.jsx("p",{className:"settings-note settings-auth-error","data-testid":"settings-auth-error",children:v.message})]})}),a&&n.jsx("div",{className:"settings-auth-row",children:n.jsxs("button",{type:"button",className:"settings-disconnect-btn","data-testid":"settings-disconnect-btn",disabled:g,onClick:()=>void o(),children:[n.jsx(fe,{name:"LogOut",size:13}),g?"Signing out…":"Disconnect"]})}),n.jsxs("label",{className:"settings-toggle-row",children:[n.jsx("span",{children:"Send usage analytics to Sapiom"}),n.jsx("button",{type:"button",role:"switch","aria-checked":b,"data-testid":"telemetry-toggle",className:"toggle-switch"+(b?" is-on":""),disabled:g||x,onClick:()=>void d(),children:n.jsx("span",{className:"toggle-knob"})})]}),x&&n.jsxs("p",{className:"settings-note settings-env-note","data-testid":"telemetry-env-note",children:["Analytics is turned off by ",N?`$${N}`:"an environment variable",". Unset it and restart the Studio server to manage consent here."]}),n.jsxs("p",{className:"settings-note",children:["Prompts, tool calls, and session lifecycle events are always written locally to"," ",n.jsx("code",{children:ay.events}),". With your consent, they’re also sent to Sapiom."]}),n.jsxs("label",{className:"settings-toggle-row",children:[n.jsx("span",{children:"Summarize sessions in the background"}),n.jsx("button",{type:"button",role:"switch","aria-checked":L,"data-testid":"rolling-summary-toggle",className:"toggle-switch"+(L?" is-on":""),disabled:g,onClick:()=>void f(),children:n.jsx("span",{className:"toggle-knob"})})]}),n.jsxs("p",{className:"settings-note",children:["Off by default, because it uses tokens you didn’t ask to use: every 10 turns, and once at the end, a cheap one-shot agent run folds the session into a short summary. Continuing a session the agent can no longer reattach to then explains what the work was"," ",n.jsx("em",{children:"for"}),", not just what it last did. With this off, continuing still works — it carries the last few turns instead."]})]})}function hp({workflow:a,isFocused:_,onFocus:E}){const S=a.definitionId!=null;return n.jsx("div",{className:"workflow-item"+(_?" is-focused":""),"data-testid":`workflow-${a.name}`,children:n.jsxs("button",{className:"tree-row workflow-item-trigger",onClick:()=>E(a.path),"aria-pressed":_,"data-tooltip":_?"Focused agent":"Focus this agent",children:[n.jsx(fe,{name:"Zap",size:13}),n.jsx("span",{className:"tree-row-label",children:a.name}),n.jsx("span",{className:"workflow-status","data-deployed":S,"data-testid":`workflow-status-${a.name}`,title:S?"Deployed to Sapiom":"Draft. Not deployed to Sapiom yet.",children:n.jsx(fe,{name:S?"Cloud":"CloudOff",size:13})})]})})}const TS=a=>a.split("/").filter(Boolean).pop()??a,DS=(a,_)=>a===_||a.startsWith(`${_}/`);function NS(a,_){const E=_.filter(m=>m.status!=="exited"),S=new Set(a),N=new Map;for(const m of _){const g=N.get(m.cwd);(!g||m.createdAt>g)&&N.set(m.cwd,m.createdAt)}const q=Array.from(N.keys()).sort((m,g)=>{const u=(N.get(g)??"").localeCompare(N.get(m)??"");return u!==0?u:m.localeCompare(g)}),L=m=>{let g=null;for(const u of q)DS(m,u)&&(g===null||u.length>g.length)&&(g=u);return g},h=[];for(const m of q){const g=a.filter(v=>S.has(v)&&L(v.path)===m).sort((v,w)=>v.path.localeCompare(w.path)).map(v=>(S.delete(v),{workflow:v})),u=E.filter(v=>v.boundWorkflowPath==null&&L(v.cwd)===m).sort((v,w)=>w.createdAt.localeCompare(v.createdAt)||v.id.localeCompare(w.id));g.length===0&&u.length===0||h.push({cwd:m,label:TS(m),agents:g,bareSessions:u})}const p=Array.from(S).sort((m,g)=>m.path.localeCompare(g.path)).map(m=>({workflow:m}));return{workspaces:h,orphanAgents:p}}const MS="https://app.sapiom.ai/workflows",LS=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),OS=LS?"⌘K":"Ctrl+K";function BS({label:a,cwd:_,collapsed:E,onToggleCollapsed:S,onOpenInEditor:N,onCopyPath:q}){return n.jsxs("div",{className:"workspace-row","data-testid":`workspace-group-${a}`,children:[n.jsxs("button",{className:"workspace-row-main",onClick:S,title:_,"aria-expanded":!E,children:[n.jsx(fe,{name:"Folder",size:13}),n.jsx("span",{className:"tree-row-label",children:a}),n.jsx("span",{className:"workspace-caret"+(E?"":" is-open"),"aria-hidden":"true",children:n.jsx(fe,{name:"ChevronDown",size:13})})]}),n.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${a}`,"data-tooltip":"Copy path",onClick:()=>q(_),children:n.jsx(fe,{name:"Copy",size:13})}),n.jsx("button",{className:"workspace-row-action","data-testid":`workspace-open-editor-${a}`,"aria-label":`Open ${a} in editor`,"data-tooltip":"Open in editor",onClick:()=>N(_),children:n.jsx(fe,{name:"Code",size:13})})]})}function HS({label:a,cwd:_,sessionId:E,isFocused:S,onFocus:N,onScaffold:q,onOpenInEditor:L,onCopyPath:h}){return n.jsxs("div",{className:"workspace-row"+(S?" is-selected":""),"data-testid":`workspace-group-${a}`,children:[n.jsxs("button",{className:"workspace-row-main","data-testid":`workspace-focus-${a}`,"aria-label":`Focus ${a}`,"aria-pressed":S,"data-tooltip":"Folder with sessions, no agent yet. Focus to work in it.",onClick:()=>N(_),children:[n.jsx(fe,{name:"Folder",size:13}),n.jsx("span",{className:"tree-row-label",children:a})]}),n.jsx("button",{className:"workspace-row-action","data-testid":`workspace-scaffold-${a}`,"aria-label":`Scaffold an agent in ${a}`,"data-tooltip":"Scaffold an agent here",onClick:()=>q(E),children:n.jsx(fe,{name:"Sparkles",size:13})}),n.jsx("button",{className:"workspace-row-action","data-testid":`workspace-open-editor-${a}`,"aria-label":`Open ${a} in editor`,"data-tooltip":"Open in editor",onClick:()=>L(_),children:n.jsx(fe,{name:"Code",size:13})}),n.jsx("button",{className:"workspace-row-action","aria-label":`Copy path for ${a}`,"data-tooltip":"Copy path",onClick:()=>h(_),children:n.jsx(fe,{name:"Copy",size:13})})]})}function dp({testid:a,harness:_,title:E,meta:S,cwd:N,resumeMode:q,isSelected:L,onOpen:h}){const p=q==="agent-resume"?"true":q==="rehydrate"?"false":"unknown";return n.jsxs("button",{"data-testid":a,className:"session-dropdown-item"+(L?" is-selected":""),"data-resumable":p,title:N,onClick:h,children:[n.jsx("span",{className:"session-item-icon",children:n.jsx(Ma,{kind:_,size:13})}),n.jsxs("span",{className:"session-item-copy",children:[n.jsx("span",{className:"session-item-title",children:E}),n.jsx("span",{className:"session-item-meta",children:S})]})]})}function zS({width:a,minWidth:_,workflows:E,sessions:S,activeSessionId:N,focusedAgentPath:q,onFocusAgent:L,onOpenPalette:h,onConnect:p,onCollapse:m,onSelectSession:g,overviewSelected:u,onSelectOverview:v,onReviewSummary:w,history:x,historyLoading:b,onOpenHistory:d,recentDirs:f,launchDir:l,listDir:o,onCreateSession:y,listHarnesses:A,onScaffoldSession:k,onScaffoldInSession:R,projectRoot:C,onSaveProjectRoot:T,onBrowseTemplates:H,templatesActive:I,onScanWorkflows:W,onOpenInEditor:P,onToast:Z,telemetryOptIn:te,rollingSummary:F,consentSource:Y,consentEnvReason:V,authenticated:M,organizationName:$,onToggleTelemetry:D,onToggleRollingSummary:z,onStartAuth:Q,onDisconnect:ne,settingsOpen:ve,onSetSettingsOpen:Ce}){const[X,O]=U.useState(null),ee=U.useRef(null),[oe,Se]=U.useState(!1),[ge,Oe]=U.useState("have"),Me=U.useCallback(()=>Se(!1),[]),[Pe,Ke]=U.useState(!1),Re=U.useRef(null),ft=U.useCallback(()=>Ke(!1),[]),[vt,Lt]=U.useState(()=>new Set(qs().collapsedCwds??[])),wt=_e=>{Lt(ze=>{const nt=new Set(ze);return nt.has(_e)?nt.delete(_e):nt.add(_e),nt})};U.useEffect(()=>{Bn({collapsedCwds:Array.from(vt)})},[vt]);const bt=S.filter(_e=>_e.status==="exited"),st=()=>{const _e=!Pe;if(_e&&Se(!1),Ke(_e),_e){const ze=Np(S,f,N);ze.length>0&&d(ze)}},it=new Set(S.map(_e=>_e.id)),pt=new Set(S.map(_e=>_e.agentSessionId).filter(_e=>_e!=null)),xt=x.filter(_e=>!(_e.harnessSessionId!=null&&it.has(_e.harnessSessionId))&&!pt.has(_e.agentSessionId)),Ot=[...bt.map(_e=>({kind:"exited",at:_e.lastActiveAt,session:_e})),...xt.map(_e=>({kind:"summary",at:_e.lastActiveAt,summary:_e}))].sort((_e,ze)=>ze.at.localeCompare(_e.at)),Je=new Map(x.map(_e=>[_e.agentSessionId,_e])),{workspaces:jt,orphanAgents:Ct}=NS(E,S),Pt=_e=>{var ze;(ze=navigator.clipboard)==null||ze.writeText(_e).then(()=>Z("Path copied.")).catch(()=>Z("Couldn't copy the path."))};return n.jsxs("aside",{className:"rail rail-workflows",style:{width:a,minWidth:_},children:[n.jsx(CS,{onCollapse:m}),n.jsx("div",{className:"rail-search",children:n.jsxs("button",{className:"palette-trigger","data-testid":"palette-trigger","aria-label":"Jump to session, workflow, or path",onClick:h,children:[n.jsx(fe,{name:"Search",size:13}),n.jsx("span",{className:"palette-trigger-text",children:"Jump to…"}),n.jsx("span",{className:"palette-trigger-hint",children:OS})]})}),n.jsxs("button",{type:"button",className:"rail-nav-row"+(I?" is-selected":""),"data-testid":"rail-templates","aria-current":I?"page":void 0,onClick:H,children:[n.jsx(fe,{name:"LayoutTemplate",size:14}),n.jsx("span",{children:"Templates"})]}),n.jsxs("div",{className:"rail-header",children:["Workspaces",n.jsxs("div",{className:"rail-header-actions",children:[n.jsxs("button",{ref:Re,className:"theme-toggle rail-header-btn","data-testid":"history-trigger","aria-label":"Sessions and history",title:"Sessions and history",onClick:st,children:[n.jsx(fe,{name:"History",size:14}),bt.length>0&&n.jsx("span",{className:"session-history-badge","data-testid":"session-history-badge",children:bt.length})]}),n.jsx("button",{ref:ee,className:"theme-toggle rail-header-btn","data-testid":"add-workspace","aria-label":"Add workspace","aria-expanded":oe,title:"Add a workspace: a folder containing an agent project (sapiom.json). Its agent appears in the rail.",onClick:()=>{Ke(!1),Se(_e=>!_e)},children:n.jsx(fe,{name:"Plus",size:14})})]})]}),n.jsxs("div",{className:"rail-tree",children:[n.jsxs(ci,{open:oe,anchorRef:ee,onDismiss:Me,placement:"right-start",className:"connect-card add-card",testid:"add-menu",children:[n.jsxs("div",{className:"connect-card-header",children:[n.jsx("span",{children:"Add"}),n.jsx("button",{className:"theme-toggle connect-card-close",onClick:Me,"aria-label":"Close",title:"Close",children:n.jsx(fe,{name:"X",size:13})})]}),n.jsx("div",{className:"connect-card-body",children:n.jsx(Gp,{onPick:_e=>{if(Se(!1),_e==="template"){H();return}Oe(_e),O("workspace")}})})]}),n.jsxs(ci,{open:Pe,anchorRef:Re,onDismiss:ft,placement:"down-end",className:"connect-card history-card",testid:"history-menu",children:[n.jsxs("div",{className:"connect-card-header",children:[n.jsx("span",{children:"Sessions"}),n.jsx("button",{className:"theme-toggle connect-card-close",onClick:ft,"aria-label":"Close",title:"Close",children:n.jsx(fe,{name:"X",size:13})})]}),n.jsxs("div",{className:"connect-card-body history-card-body",children:[n.jsxs("button",{className:"session-dropdown-item session-dropdown-new","data-testid":"new-session-btn",onClick:()=>{Ke(!1),O("session")},children:[n.jsx("span",{className:"session-item-icon",children:n.jsx(fe,{name:"Plus",size:13})}),n.jsx("span",{className:"session-item-copy",children:n.jsx("span",{className:"session-item-title",children:"New session…"})})]}),n.jsx("div",{className:"session-dropdown-section",children:"Past sessions"}),Ot.map(_e=>{if(_e.kind==="exited"){const ze=_e.session.agentSessionId==null?void 0:Je.get(_e.session.agentSessionId),nt=_e.session.agentSessionId==null?"rehydrate":ze==null?void 0:ze.resumeMode;return n.jsx(dp,{testid:`exited-session-${_e.session.id}`,harness:_e.session.harness,title:_e.session.title,meta:Ec({..._e.session,gitBranch:ze==null?void 0:ze.gitBranch,turnCount:ze==null?void 0:ze.turnCount,messageCount:ze==null?void 0:ze.messageCount},void 0,{includeHarness:!1,state:Xf({resumeMode:nt,turnCount:ze==null?void 0:ze.turnCount})}),cwd:_e.session.cwd,resumeMode:nt,isSelected:_e.session.id===N,onOpen:()=>{g(_e.session.id),Ke(!1)}},_e.session.id)}return n.jsx(dp,{testid:`history-${_e.summary.agentSessionId}`,harness:_e.summary.harness,title:_e.summary.title,meta:Ec(_e.summary,void 0,{includeHarness:!1,state:Xf(_e.summary)}),cwd:_e.summary.cwd,resumeMode:_e.summary.resumeMode,isSelected:!1,onOpen:()=>{w(_e.summary),Ke(!1)}},_e.summary.agentSessionId)}),b&&n.jsx("div",{className:"session-dropdown-empty",children:"Loading…"}),!b&&Ot.length===0&&n.jsx("div",{className:"session-dropdown-empty",children:"No past sessions yet"})]})]}),n.jsxs("div",{className:"rail-list",children:[jt.length===0&&Ct.length===0&&n.jsx(Ts,{className:"rail-empty",icon:"Folder",title:"No agents yet",body:"Open a workspace folder to start a session, or add one. Agents (sapiom.json) appear here automatically."}),jt.map(_e=>{const ze=vt.has(_e.cwd);if(_e.agents.length===0&&_e.bareSessions.length>0){const Rt=_e.bareSessions[0];return n.jsx("div",{className:"workspace-group",children:n.jsx(HS,{label:_e.label,cwd:_e.cwd,sessionId:Rt.id,isFocused:_e.cwd===q,onFocus:L,onScaffold:R,onOpenInEditor:P,onCopyPath:Pt})},_e.cwd)}return n.jsxs("div",{className:"workspace-group",children:[n.jsx(BS,{label:_e.label,cwd:_e.cwd,collapsed:ze,onToggleCollapsed:()=>wt(_e.cwd),onOpenInEditor:P,onCopyPath:Pt}),!ze&&_e.agents.map(Rt=>n.jsx(hp,{workflow:Rt.workflow,isFocused:Rt.workflow.path===q,onFocus:L},Rt.workflow.path))]},_e.cwd)}),Ct.length>0&&n.jsxs("div",{className:"workspace-group",children:[n.jsx("div",{className:"workspace-row",children:n.jsxs("div",{className:"workspace-row-main workspace-row-static","data-tooltip":"Agents that live outside any session folder. Focus one to start a session in its own folder.",children:[n.jsx(fe,{name:"Folder",size:13}),n.jsx("span",{className:"tree-row-label",children:"No workspace"})]})}),Ct.map(_e=>n.jsx(hp,{workflow:_e.workflow,isFocused:_e.workflow.path===q,onFocus:L},_e.workflow.path))]})]})]}),n.jsx("div",{className:"rail-footer",children:n.jsx(US,{authenticated:M,organizationName:$,telemetryOptIn:te,rollingSummary:F,consentSource:Y,consentEnvReason:V,onToggleTelemetry:D,onToggleRollingSummary:z,onStartAuth:Q,onDisconnect:ne,settingsOpen:ve,onSetSettingsOpen:Ce,overviewSelected:u,onSelectOverview:v})}),X==="workspace"&&n.jsx(Xp,{recentDirs:f,projectRoot:C,listDir:o,onClose:()=>O(null),onConnect:async _e=>{await p(_e)},onScan:W,onScaffold:k,onSaveProjectRoot:T,listHarnesses:A,onBrowseTemplates:()=>{O(null),H()},triggerRef:ee,initialDoor:ge}),X==="session"&&n.jsx(jS,{recentDirs:f,launchDir:l,listDir:o,onClose:()=>O(null),onCreate:y,listHarnesses:A,triggerRef:Re})]})}function US({authenticated:a,organizationName:_,telemetryOptIn:E,rollingSummary:S,consentSource:N,consentEnvReason:q,onToggleTelemetry:L,onToggleRollingSummary:h,onStartAuth:p,onDisconnect:m,settingsOpen:g,onSetSettingsOpen:u,overviewSelected:v,onSelectOverview:w}){const[x,b]=U.useState(!1),[d,f]=U.useState({status:"idle"}),l=U.useRef(null),o=U.useCallback(()=>b(!1),[]),y=U.useCallback(()=>u(!1),[u]),A=bp(),k=d.status==="pending";a&&d.status==="pending"&&f({status:"idle"});const R=k?"Connecting…":a?_??"Signed in":"Not signed in",C=k?"opening browser":a?"Sapiom account":"connect to get started",T=(_??"S").charAt(0).toUpperCase(),H=async()=>{o(),f({status:"pending"});try{await p()}catch(I){const W=I instanceof Error?I.message:"Could not start sign-in. Try again.";f({status:"error",message:W})}};return n.jsxs("div",{className:"rail-footer-row rail-profile-wrap",children:[n.jsxs("button",{ref:l,className:"rail-profile","data-testid":"brand-identity","aria-haspopup":"menu","aria-expanded":x,title:"Account",onClick:()=>b(I=>!I),children:[n.jsx("span",{className:"rail-profile-avatar","aria-hidden":"true",children:T}),n.jsxs("span",{className:"rail-profile-copy",children:[n.jsx("span",{className:"rail-profile-name",children:R}),n.jsx("span",{className:"rail-profile-meta",children:C})]}),n.jsx("span",{className:"identity-dot","data-authenticated":a,"data-pending":k}),n.jsx(fe,{name:"ChevronDown",size:13})]}),n.jsx(ci,{open:g,anchorRef:l,onDismiss:y,placement:"up-start",matchWidth:!0,className:"settings-popover",testid:"settings-popover",children:n.jsx(RS,{authenticated:a,organizationName:_,telemetryOptIn:E,rollingSummary:S,consentSource:N,consentEnvReason:q,onToggleTelemetry:L,onToggleRollingSummary:h,onStartAuth:p,onDisconnect:m})}),n.jsxs(ci,{open:x,anchorRef:l,onDismiss:o,placement:"up-start",matchWidth:!0,className:"profile-menu",role:"menu",testid:"profile-menu",children:[n.jsxs("button",{role:"menuitem",className:"profile-menu-item"+(v?" is-selected":""),"data-testid":"rail-overview",onClick:()=>{w(),o()},children:[n.jsx(fe,{name:"Info",size:13}),"Overview"]}),n.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-open-dashboard",onClick:()=>{window.open(MS,"_blank","noopener,noreferrer"),o()},children:[n.jsx(fe,{name:"ExternalLink",size:13}),"Open Sapiom dashboard"]}),n.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"settings-trigger",onClick:()=>{u(!0),o()},children:[n.jsx(fe,{name:"Settings",size:13}),"Settings"]}),!a&&n.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-connect-account",disabled:k,onClick:()=>void H(),children:[n.jsx(fe,{name:"Plug",size:13}),k?"Connecting…":"Connect account"]}),a&&n.jsxs("button",{role:"menuitem",className:"profile-menu-item","data-testid":"profile-disconnect-account",onClick:()=>{m(),o()},children:[n.jsx(fe,{name:"LogOut",size:13}),"Disconnect"]}),A,d.status==="error"&&n.jsx("p",{className:"profile-menu-auth-error","data-testid":"profile-auth-error",children:d.message})]})]})}const IS=new Set([401,403]);function qS(a){return a?a.networkError===!0||a.status===void 0:!1}function $S(a){return(a==null?void 0:a.status)!==void 0&&IS.has(a.status)}function PS(a){const{online:_,error:E}=a;return!_||qS(E)?"offline":$S(E)?"auth":E?"error":"online"}function fp(){return typeof navigator>"u"?!0:navigator.onLine!==!1}function WS(){const[a,_]=U.useState(fp);return U.useEffect(()=>{const E=()=>_(fp());return window.addEventListener("online",E),window.addEventListener("offline",E),E(),()=>{window.removeEventListener("online",E),window.removeEventListener("offline",E)}},[]),a}const pp={deploy:"deploy",prod_run:"prod-run",run_local:"run-local"};function FS(a){return Object.prototype.hasOwnProperty.call(pp,a)?pp[a]:null}const Vp=a=>a.split("/").filter(Boolean).pop()??a;function mp(a,_){var E;return(E=_[a.id])!=null&&E.trim()?!1:!a.title||a.title===Vp(a.cwd)}function _p(a,_,E){var h;const S=(h=E[a.id])==null?void 0:h.trim();if(S)return S;if(!mp(a,E))return a.title;const N=Vp(a.cwd),L=_.filter(p=>p.cwd===a.cwd&&(p.status!=="exited"||p.id===a.id)&&mp(p,E)).sort((p,m)=>p.createdAt.localeCompare(m.createdAt)||p.id.localeCompare(m.id)).findIndex(p=>p.id===a.id);return L>0?`${N} ${L+1}`:N}const Zp="(max-width: 768px)";function kc(){return typeof window<"u"&&window.matchMedia(Zp).matches}function YS(a){const _=window.matchMedia(Zp);return _.addEventListener("change",a),()=>_.removeEventListener("change",a)}function KS(){return U.useSyncExternalStore(YS,kc,()=>!1)}const Qp="sapiom-harness-pane-widths",zc=180,Jp=480,Ac=320,Li=320,em=720;function jc(a,_,E){return Math.min(Math.max(a,_),E)}function XS(){const a={rail:Ac,canvas:null};if(typeof window>"u")return a;try{const _=window.localStorage.getItem(Qp);if(!_)return a;const E=JSON.parse(_);return{rail:jc(typeof E.rail=="number"?E.rail:Ac,zc,Jp),canvas:typeof E.canvas=="number"?jc(E.canvas,Li,em):null}}catch{return a}}function vp(a){window.localStorage.setItem(Qp,JSON.stringify(a))}function GS(){const[a,_]=U.useState(XS),E=(N,q,L,h,p)=>m=>{const g=m.currentTarget;g.setPointerCapture(m.pointerId);const u=m.clientX,v=p(),w=b=>{const d=jc(v+(b.clientX-u)*q,L,h);_(f=>f[N]===d?f:{...f,[N]:d})},x=()=>{g.removeEventListener("pointermove",w),g.removeEventListener("pointerup",x),_(b=>(vp(b),b))};g.addEventListener("pointermove",w),g.addEventListener("pointerup",x)},S=(N,q)=>{_(L=>{const h={...L,[N]:q};return vp(h),h})};return{widths:a,startRailDrag:E("rail",1,zc,Jp,()=>a.rail),startCanvasDrag:E("canvas",-1,Li,em,()=>{if(a.canvas!=null)return a.canvas;const N=document.querySelector(".canvas-pane");return N?N.getBoundingClientRect().width:Li}),resetRail:()=>S("rail",Ac),resetCanvas:()=>S("canvas",null)}}const VS=2e3;function ZS(a){const _=new URL("/ws/events",window.location.href);_.protocol=_.protocol==="https:"?"wss:":"ws:",_.searchParams.set("token",On());let E=null,S=null,N=!1;const q=()=>{E=new WebSocket(_),E.addEventListener("message",L=>{try{a(JSON.parse(L.data))}catch{}}),E.addEventListener("close",()=>{N||(S=setTimeout(q,VS))})};return q(),()=>{N=!0,S&&clearTimeout(S),E==null||E.close()}}const gp=4e3;function QS(a){if(typeof a=="string")return a;if(a!==null&&typeof a=="object"){const _=a,E=[_.ts,_.level,_.msg??_.message].filter(S=>typeof S=="string"||typeof S=="number");if(E.length>0)return E.map(String).join(" ")}return String(a)}function JS(a){if(!Array.isArray(a)||a.length===0)return;const _=a.map(QS).join(`
444
+ `).trim();if(_!=="")return _.length>gp?_.slice(_.length-gp):_}function eb(a){return a==="succeeded"?"passed":a==="threw"?"failed":"pending"}function tb(a){return a==="completed"?"completed":a==="failed"?"failed":"running"}function sb(a){var S;const _={id:`${a.step}-${a.attempt}`,name:a.step,status:eb(a.status)};a.input!==void 0&&(_.input=a.input),a.output!==void 0&&(_.output=a.output),(S=a.error)!=null&&S.message&&(_.error=a.error.message);const E=JS(a.logs);return E!==void 0&&(_.logSlice=E),a.calls&&a.calls.length>0&&(_.calls=a.calls.map(N=>({capability:N.capability,stubUsed:N.stubUsed,args:N.args,result:N.result}))),_}function ib(a,_={}){const E={executionId:_.executionId??"",status:tb(_.outcome),steps:a.map(sb),stubbed:!0};return _.unusedStubs&&_.unusedStubs.length>0&&(E.unusedStubs=_.unusedStubs),_.stubWarnings&&_.stubWarnings.length>0&&(E.stubWarnings=_.stubWarnings),E}const ut=kv(),nb=3e3,ab=8;function rb(){const[a,_]=U.useState(null),[E,S]=U.useState(null),N=U.useRef(null);N.current=E;const[q,L]=U.useState(!0),[h,p]=U.useState(null),[m,g]=U.useState(null),[u,v]=U.useState(0),[w,x]=U.useState(null),[b,d]=U.useState(null),[f,l]=U.useState([]),[o,y]=U.useState(null),[A,k]=U.useState(!1),R=U.useRef(new Map),C=U.useRef(0),[T,H]=U.useState(null),[I,W]=U.useState(new Set),[P,Z]=U.useState([]),te=U.useRef(new Map),[F,Y]=U.useState(new Map),[V,M]=U.useState(new Map),[$,D]=U.useState(new Map),z=U.useRef(new Map),[Q,ne]=U.useState(new Map),[ve,Ce]=U.useState(new Map),[X,O]=U.useState(0),ee=U.useCallback(()=>{O(re=>re+1)},[]),oe=U.useRef(0),Se=U.useCallback(re=>{oe.current+=1,d(re)},[]),ge=U.useRef([]),Oe=U.useCallback(re=>{ut.getRunState(re).then(de=>Y(be=>{const ye=be.get(re);return ye?new Map(be).set(re,{...ye,run:de}):be})).catch(()=>{})},[]),Me=U.useCallback((re,de,be)=>{const ye=z.current.get(re);ye&&clearInterval(ye);const ke=Ln(ge.current.find(et=>et.id===re)),ht=Date.now();M(et=>{const Et=et.get(re)??[];return Et.includes(de)?et:new Map(et).set(re,[...Et,de])}),D(et=>{if(!et.has(re))return et;const Et=new Map(et);return Et.delete(re),Et});const yt=async()=>{try{const et=await ut.getRunState(de);if(Y(Et=>new Map(Et).set(de,{run:et,target:be,workflowPath:ke,observedAt:ht})),et.status!=="running"){const Et=z.current.get(re);Et&&clearInterval(Et),z.current.delete(re)}}catch{const et=z.current.get(re);et&&clearInterval(et),z.current.delete(re)}};yt(),z.current.set(re,setInterval(()=>void yt(),2e3))},[]),Pe=U.useRef(0),Ke=U.useCallback(async(re,de,be)=>{Pe.current+=1;const ye=`local-${Date.now()}-${Pe.current}`,ke=Ln(ge.current.find(Ee=>Ee.id===re)),ht=Date.now(),yt=[];let et,Et,qt;M(Ee=>{const Be=Ee.get(re)??[];return Be.includes(ye)?Ee:new Map(Ee).set(re,[...Be,ye])}),D(Ee=>{if(!Ee.has(re))return Ee;const Be=new Map(Ee);return Be.delete(re),Be});const le=()=>{const Ee=ib(yt,{executionId:ye,outcome:et,unusedStubs:Et,stubWarnings:qt});Y(Be=>new Map(Be).set(ye,{run:Ee,target:"local",workflowPath:ke,observedAt:ht}))};le();const xe=Ee=>{Ee.kind==="summary"?(et=Ee.outcome,Et=Ee.unusedStubs,qt=Ee.stubWarnings):Ee.kind==="error"?(et="failed",yt.push({step:"run-local",attempt:1,input:be,status:"threw",error:{name:"RunLocalError",message:Ee.error},logs:[]})):yt.push(Ee),le()};try{await ut.runLocal({sourceDir:de,input:be},xe)}catch(Ee){et="failed",le(),y(Ee instanceof ss&&Ee.reason?Ee.reason:Ee.message)}finally{ee()}},[ee]),Re=U.useCallback((re,de)=>{D(be=>new Map(be).set(re,de)),Oe(de)},[Oe]),ft=U.useMemo(()=>{const re=new Map;return V.forEach((de,be)=>{const ye=$.get(be),ke=ye&&de.includes(ye)?ye:de[de.length-1],ht=ke?F.get(ke):void 0;ht&&re.set(be,ht)}),re},[V,$,F]);U.useEffect(()=>{ge.current=(a==null?void 0:a.sessions)??[]},[a]),U.useEffect(()=>{const re=z.current;return()=>{re.forEach(de=>clearInterval(de)),re.clear()}},[]),U.useEffect(()=>{const re=te.current;return()=>{re.forEach(de=>clearTimeout(de)),re.clear()}},[]),U.useEffect(()=>{let re=!1;return u>0&&(L(!0),p(null),g(null)),Promise.all([ut.getState(),ut.getSettings()]).then(([de,be])=>{if(re)return;_(de),S(be),g(null),de.tasks&&Z(de.tasks);const ye=de.sessions.find(ke=>ke.status!=="exited");ye&&d(ye.id),de.workflows[0]&&x(de.workflows[0].path)}).catch(de=>{re||(p(de.message),g(de instanceof ss?{status:de.status}:{networkError:!0}))}).finally(()=>!re&&L(!1)),()=>{re=!0}},[u]);const vt=U.useCallback(()=>v(re=>re+1),[]);U.useEffect(()=>{if(!b)return;const re=a==null?void 0:a.sessions.find(de=>de.id===b);x(Ln(re)??null)},[b]);const Lt=U.useCallback(async()=>{const re=await ut.listWorkflows();_(de=>de&&{...de,workflows:re})},[]);U.useEffect(()=>ZS(re=>{if(H(re),re.type==="session.status"){if(_(de=>{if(!de)return de;const ye=de.sessions.some(ke=>ke.id===re.session.id)?de.sessions.map(ke=>ke.id===re.session.id?re.session:ke):[...de.sessions,re.session];return{...de,sessions:ye}}),re.session.status==="exited"){const de=re.session.id,be=te.current.get(de);be&&(clearTimeout(be),te.current.delete(de)),W(ye=>{if(!ye.has(de))return ye;const ke=new Set(ye);return ke.delete(de),ke})}}else if(re.type==="workflows.changed")Lt();else if(re.type==="execution.started")Me(re.harnessSessionId,re.executionId,re.target);else if(re.type==="port.detected")ne(de=>new Map(de).set(re.harnessSessionId,{port:re.port,url:re.url}));else if(re.type==="task.status")Z(de=>de.some(ye=>ye.id===re.task.id)?de.map(ye=>ye.id===re.task.id?re.task:ye):[...de,re.task]);else if(re.type==="session.activity"){const de=re.harnessSessionId;W(ye=>ye.has(de)?ye:new Set(ye).add(de));const be=te.current.get(de);be&&clearTimeout(be),te.current.set(de,setTimeout(()=>{te.current.delete(de),W(ye=>{if(!ye.has(de))return ye;const ke=new Set(ye);return ke.delete(de),ke})},nb))}else re.type==="auth.changed"&&_(de=>de&&{...de,authenticated:re.authenticated,organizationName:re.organizationName})}),[Lt,Me]);const wt=U.useCallback(async re=>{const de=Array.from(new Set(re)),be=de.map(ye=>{const ke=R.current.get(ye);if(ke)return ke;const ht=ut.sessionHistory(ye).finally(()=>{R.current.delete(ye)});return R.current.set(ye,ht),ht});C.current+=1,k(!0);try{const ye=await Promise.allSettled(be),ke=[],ht=new Set;ye.forEach((yt,et)=>{yt.status==="fulfilled"&&(ht.add(de[et]),ke.push(...yt.value))}),l(yt=>F1(yt,ke,ht))}finally{C.current-=1,C.current===0&&k(!1)}},[]),bt=U.useCallback(async re=>{var ye;const de=await ut.createSession(re);_(ke=>ke&&!ke.sessions.some(ht=>ht.id===de.id)?{...ke,sessions:[...ke.sessions,de]}:ke),Se(de.id);const be=[re.cwd,...(((ye=N.current)==null?void 0:ye.recentDirs)??[]).filter(ke=>ke!==re.cwd)].slice(0,ab);S(ke=>ke&&{...ke,recentDirs:be});try{const ke=await ut.updateSettings({recentDirs:be});S(ht=>ht&&{...ht,recentDirs:ke.recentDirs})}catch{}return de},[Se]),st=U.useCallback(()=>ut.listTemplates(),[]),it=U.useCallback(re=>ut.getTemplate(re),[]),pt=U.useCallback(re=>ut.sessionRecord(re),[]),xt=U.useCallback(async re=>{const de=oe.current;try{const be=await ut.resumeSession(re);return _(ye=>ye&&{...ye,sessions:ye.sessions.map(ke=>ke.id===be.id?be:ke)}),oe.current===de&&Se(be.id),be}catch(be){throw y(be instanceof ss&&be.reason?be.reason:be.message),be}},[Se]),Ot=U.useCallback(async({cwd:re,harness:de,from:be})=>{const ye=await bt({cwd:re,harness:de,rehydrateFrom:be});return ye.rehydratedFrom||y("Nothing was recorded for that session, so this one starts fresh."),ye},[bt]),Je=U.useCallback(async re=>{var be;const de=re.harnessSessionId??((be=a==null?void 0:a.sessions.find(ye=>ye.agentSessionId===re.agentSessionId))==null?void 0:be.id);if(re.resumeMode==="rehydrate")return Ot({cwd:re.cwd,harness:re.harness,from:de??re.agentSessionId});if(de)return xt(de);try{const ye=await ut.adoptSession({agentSessionId:re.agentSessionId,harness:re.harness,cwd:re.cwd,title:re.title,lastActiveAt:re.lastActiveAt});return _(ke=>{if(!ke)return ke;const ht=ke.sessions.some(yt=>yt.id===ye.id)?ke.sessions.map(yt=>yt.id===ye.id?ye:yt):[...ke.sessions,ye];return{...ke,sessions:ht}}),Se(ye.id),ye}catch(ye){throw y(ye instanceof ss&&ye.reason?ye.reason:ye.message),ye}},[a,xt,Ot,Se]),jt=U.useCallback(async re=>{try{await ut.killSession(re)}catch(be){throw y(be instanceof ss&&be.reason?be.reason:be.message),be}const de=((a==null?void 0:a.sessions)??[]).filter(be=>be.id!==re);if(_(be=>be&&{...be,sessions:de}),b===re){const be=de.find(ye=>ye.status!=="exited");Se(be?be.id:null)}},[a,b,Se]),Ct=U.useCallback(async re=>{const de=await ut.connectWorkflow(re);return _(be=>be&&{...be,workflows:[...be.workflows.filter(ye=>ye.path!==de.path),de]}),de},[]),Pt=U.useCallback(async re=>{const de=await ut.scanWorkflows(re);return await Lt(),de},[Lt]),_e=U.useCallback(()=>ut.listHarnesses(),[]),ze=U.useCallback(async(re,de)=>{const be=await ut.bindWorkflow(re,de);_(ye=>ye&&{...ye,sessions:ye.sessions.map(ke=>ke.id===be.id?be:ke)})},[]),nt=U.useCallback(async re=>{const de=await ut.updateSettings(re);return S(de),re.telemetryOptIn!==void 0&&_(be=>be&&{...be,telemetryOptIn:de.telemetryOptIn}),de},[]),Rt=U.useCallback(async(re,de)=>{try{await ut.runMacro(re,de)}catch(be){y(be instanceof ss&&be.reason?be.reason:be.message)}},[]),gt=U.useCallback(async re=>{y("Deploying — building on Sapiom…");try{const de=await ut.deploy(re,be=>{be.phase==="building"&&y("Deploying — building on Sapiom…")});if(de.phase==="ready")y("Deployed to Sapiom."),Ce(be=>{if(!be.has(re))return be;const ye=new Map(be);return ye.delete(re),ye}),await Lt();else if(de.phase==="error"){const be=de.hint?`Deploy failed: ${de.message} (${de.hint})`:`Deploy failed: ${de.message}`;y(be),Ce(ye=>new Map(ye).set(re,be))}}catch(de){const be=de instanceof ss&&de.reason?de.reason:de.message;y(be),Ce(ye=>new Map(ye).set(re,be))}finally{ee()}},[Lt,ee]),$s=U.useCallback(async(re,de,be)=>{try{const{executionId:ye}=await ut.run({definitionId:de,input:be});Me(re,ye,"prod")}catch(ye){y(ye instanceof ss&&ye.reason?ye.reason:ye.message)}finally{ee()}},[Me,ee]),Tt=U.useCallback(async()=>ut.startAuth(),[]),Ps=U.useCallback(async()=>{try{await ut.disconnect()}catch(re){y(re instanceof ss&&re.reason?re.reason:re.message)}},[]),is=U.useCallback(()=>y(null),[]),ns=U.useCallback(async(re,de)=>{await ut.injectInput(re,{text:de,submit:!0})},[]),Ds=U.useCallback(re=>{y(re)},[]),Jt=U.useCallback(re=>ve.get(re)??null,[ve]),Zt=U.useCallback(re=>ut.listDir(re),[]);return{state:a,loading:q,error:h,errorKind:m,reload:vt,settings:E,bootToken:On(),selectedWorkflowPath:w,setSelectedWorkflowPath:x,activeSessionId:b,setActiveSessionId:Se,history:f,historyLoading:A,loadHistory:wt,createSession:bt,listTemplates:st,getTemplate:it,sessionRecord:pt,resumeSession:xt,rehydrateSession:Ot,resumeFromHistory:Je,closeSession:jt,connectWorkflow:Ct,scanWorkflows:Pt,listHarnesses:_e,bindWorkflow:ze,updateSettings:nt,runMacro:Rt,deploy:gt,startProdRun:$s,runLocal:Ke,injectInput:ns,showToast:Ds,lastDeployErrorFor:Jt,directActionSettleSeq:X,listDir:Zt,lastMessage:T,runsBySession:ft,runsByExecution:F,runIdsBySession:V,selectRun:Re,previewBySession:Q,toast:o,dismissToast:is,busySessionIds:I,tasks:P,api:ut,startAuth:Tt,disconnect:Ps}}function Kr(a,_){return _?a.filter(E=>E.status!=="exited"&&(E.boundWorkflowPath===_||E.boundWorkflowPath==null&&E.cwd===_)).sort((E,S)=>E.createdAt.localeCompare(S.createdAt)||E.id.localeCompare(S.id)):[]}const lb=()=>{var Ds,Jt,Zt,re,de,be,ye,ke,ht,yt,et,Et,qt;const a=rb(),_=WS(),[E,S]=U.useState(!1),[N,q]=U.useState(!1),[L,h]=U.useState(!1),[p,m]=U.useState(null),[g,u]=U.useState(!1),[v,w]=U.useState(()=>{const le=qs().rightTab;return le==="canvas"||le==="steps"||le==="code"?le:"canvas"}),[x,b]=U.useState(v==="code"),[d,f]=U.useState(null),[l,o]=U.useState(!1),[y,A]=U.useState(()=>qs().sessionNames??{}),k=()=>{q(!1),h(!0)},R=(le,xe)=>{A(Ee=>{const Be={...Ee},We=xe.trim();return We?Be[le]=We:delete Be[le],Bn({sessionNames:Be}),Be})},[C,T]=U.useState(()=>kc()||(qs().railCollapsed??!1)),[H,I]=U.useState(()=>kc()||(qs().rightCollapsed??!1)),[W,P]=U.useState(!1),Z=KS(),{widths:te,startRailDrag:F,startCanvasDrag:Y,resetRail:V,resetCanvas:M}=GS();U.useEffect(()=>{const le=xe=>{var Be;const Ee=xe.key.toLowerCase();if((xe.metaKey||xe.ctrlKey)&&(Ee==="k"||Ee==="p")){xe.preventDefault(),S(!0);return}if((xe.metaKey||xe.ctrlKey)&&/^[1-9]$/.test(xe.key)){const ue=Kr(((Be=a.state)==null?void 0:Be.sessions)??[],p)[Number(xe.key)-1];ue&&(xe.preventDefault(),q(!1),f(null),a.setActiveSessionId(ue.id))}};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[(Ds=a.state)==null?void 0:Ds.sessions,p]);const $=ky({settingsRoot:(Jt=a.settings)==null?void 0:Jt.projectRoot,defaultProjectRoot:(Zt=a.state)==null?void 0:Zt.defaultProjectRoot,launchDir:(re=a.state)==null?void 0:re.launchDir}),D=async le=>{await a.updateSettings({projectRoot:le})};U.useEffect(()=>{var xe;if(!E||!a.state)return;const le=Np(a.state.sessions,((xe=a.settings)==null?void 0:xe.recentDirs)??[],a.activeSessionId);le.length>0&&a.loadHistory(le)},[E]);const z=U.useRef(!1);U.useEffect(()=>{var xe;if(z.current||!a.state)return;z.current=!0;const le=a.state.sessions.find(Ee=>Ee.id===a.activeSessionId);m(Ln(le)??((xe=a.state.workflows[0])==null?void 0:xe.path)??null)},[a.state,a.activeSessionId]);const Q=U.useRef(Z);U.useEffect(()=>{Q.current!==Z&&(Q.current=Z,T(Z),I(Z))},[Z]),U.useEffect(()=>{Z||Bn({railCollapsed:C,rightCollapsed:H})},[C,H,Z]),U.useEffect(()=>{Bn({rightTab:v})},[v]);const ne=((de=a.state)==null?void 0:de.sessions.find(le=>le.id===a.activeSessionId&&le.status==="exited"))??null,ve=ne!=null&&ne.agentSessionId?(be=a.history.find(le=>le.agentSessionId===ne.agentSessionId))==null?void 0:be.resumeMode:"rehydrate",Ce=(ne==null?void 0:ne.agentSessionId)!=null&&ve===void 0?ne.cwd:null,X=a.loadHistory;if(U.useEffect(()=>{Ce&&X([Ce])},[Ce,X]),a.loading)return n.jsx("div",{className:"app-status",children:"Loading Sapiom Studio…"});if(a.error||!a.state){const le=PS({online:_,error:a.errorKind});return n.jsx(P1,{status:le==="online"?"error":le,onRetry:a.reload,detail:a.error,onStartAuth:le==="auth"?a.startAuth:void 0})}const{state:O}=a,ee=O.sessions.find(le=>le.id===a.activeSessionId)??null,oe=Ln(ee),Se=O.workflows.find(le=>le.path===oe)??null,ge=O.workflows.find(le=>le.path===p)??null,Oe=Kr(O.sessions,p),Me=O.sessions.some(le=>le.status!=="exited"),Pe=N||O.firstRun===!0&&!Me&&!L,Ke=d!=null,Re=!Ke&&(ee==null?void 0:ee.status)==="exited",ft=!Ke&&!Re&&ge!=null&&Oe.length===0,vt=!Ke&&!Re&&!ft&&ee!=null&&ee.status!=="exited",Lt=vt&&Oe.length>0,wt=ft?null:Se,bt=ft?(ge==null?void 0:ge.name)??null:null,st=a.activeSessionId?a.runsBySession.get(a.activeSessionId)??null:null,it=a.activeSessionId?(a.runIdsBySession.get(a.activeSessionId)??[]).map(le=>a.runsByExecution.get(le)).filter(le=>le!==void 0):[],pt=()=>{Z&&T(!0)},xt=async(le,xe)=>{q(!1),f(null),m(le),pt();const Ee=await a.createSession({cwd:le,harness:xe});return el("session.created"),Ee},Ot=async(le,xe)=>{await xt(le,xe)},Je=(le,xe,Ee)=>{const Be=async We=>{try{await a.injectInput(le,xe)}catch(ue){if(We<6&&ue instanceof ss&&ue.status===409){window.setTimeout(()=>void Be(We+1),1500);return}a.showToast(Ee)}};Be(0)},jt=async(le,xe,Ee)=>{const Be=await xt(le,xe),We="Scaffold a new Sapiom agent project in this directory: run `sapiom agents init .`, then use the sapiom-agent-authoring skill to",ue=Ee==null?void 0:Ee.trim();Je(Be.id,ue?`${We} build this:
445
+
446
+ ${ue}`:`${We} define the first workflow.`,"Couldn't send the scaffold prompt. Ask the agent to run sapiom agents init.")},Ct=le=>{(async()=>{const xe=Kr(O.sessions,le.path)[0],Ee=(xe==null?void 0:xe.cwd)??le.path;try{const Be=await xt(Ee,"claude-code");await a.bindWorkflow(Be.id,le.path),m(le.path)}catch(Be){a.showToast(Be.message||"Couldn't start the session.")}})()},Pt=le=>{Je(le,"Scaffold a new Sapiom agent project in this directory: run `sapiom agents init .`, then use the sapiom-agent-authoring skill to define the first workflow.","Couldn't send the scaffold prompt. Ask the agent to run sapiom agents init.")},_e=async(le,xe)=>{const Ee=await xt(le,"claude-code");Je(Ee.id,My(xe,le),xe.kind==="gallery"?"Couldn't send the clone prompt. Ask the agent to run sapiom_dev_agents_clone.":"Couldn't send the starter prompt. Ask the agent to run sapiom agents init.")},ze=async le=>{const xe=await a.scanWorkflows(le);return a.showToast(xe.length===0?"No agent projects found under this folder.":xe.length===1?"Found 1 agent project.":`Found ${xe.length} agent projects.`),xe.length},nt=le=>{q(!1),f(null),pt();const xe=O.sessions.find(Ee=>Ee.id===le);xe&&m(Ln(xe)??xe.cwd),a.setActiveSessionId(le)},Rt=le=>{q(!1),f(null),a.setActiveSessionId(le)},gt=le=>{(async()=>{const xe=Oe.find(Be=>Be.id!==le)??null,Ee=a.activeSessionId===le;try{await a.closeSession(le)}catch{return}Ee&&a.setActiveSessionId(xe?xe.id:null)})()},$s=le=>{q(!1),f(le),pt()},Tt=le=>{var Ee;const xe=((Ee=a.settings)==null?void 0:Ee.editorUrlTemplate)??"vscode://file{path}";window.location.href=xe.replace("{path}",encodeURI(le))},Ps=le=>{q(!1),f(null),m(le),pt();const xe=Kr(O.sessions,le);if(xe.some(Be=>Be.id===a.activeSessionId))return;const Ee=xe[xe.length-1]??null;a.setActiveSessionId(Ee?Ee.id:null)},is=async le=>{pt();const xe=O.sessions.filter(we=>we.status!=="exited"),Ee=we=>we.boundWorkflowPath===le||le===we.cwd||le.startsWith(`${we.cwd}/`),Be=xe.find(we=>we.id===a.activeSessionId),We=Be&&Ee(Be)?Be:xe.filter(Ee).sort((we,Ne)=>Ne.cwd.length-we.cwd.length||Ne.createdAt.localeCompare(we.createdAt))[0];let ue;if(We)q(!1),f(null),We.id!==a.activeSessionId&&a.setActiveSessionId(We.id),ue=We.id;else try{ue=(await xt(le,"claude-code")).id}catch(we){return a.showToast(we.message||"Couldn't start a session in this folder."),null}return await a.bindWorkflow(ue,le),m(le),ue},ns=(le,xe)=>{(async()=>{let Ee=a.activeSessionId;if(le&&(Ee=await is(le.path)??Ee),xe.action.kind==="open-url"){window.open(gy(xe.action.url,le),"_blank","noopener,noreferrer");return}if(!Ee)return;const Be=FS(xe.id);if(Be!==null){if(Be==="deploy")le?a.deploy(le.path):a.showToast("Select a workflow first.");else if(Be==="prod-run")if((le==null?void 0:le.definitionId)!=null)a.startProdRun(Ee,String(le.definitionId));else{const We=le?a.lastDeployErrorFor(le.path):null;a.showToast(We?"Last deploy failed — retry Deploy.":"This agent isn't deployed yet — deploy it first.")}else Be==="run-local"&&(le?a.runLocal(Ee,le.path):a.showToast("Select a workflow first."));return}a.runMacro(xe.id,{harnessSessionId:Ee,workflowPath:le==null?void 0:le.path})})()};return n.jsxs("div",{className:"app-shell",children:[Z&&!C&&n.jsx("div",{className:"shell-scrim","data-testid":"rail-drawer-scrim","aria-hidden":"true",onClick:()=>T(!0)}),!C&&n.jsx(zS,{projectRoot:$||null,onSaveProjectRoot:D,width:te.rail,minWidth:zc,workflows:O.workflows,sessions:O.sessions,activeSessionId:a.activeSessionId,focusedAgentPath:p,onFocusAgent:Ps,onOpenPalette:()=>S(!0),onConnect:async le=>{await a.connectWorkflow(le)},onCollapse:()=>T(!0),onSelectSession:nt,overviewSelected:N,onSelectOverview:()=>{q(!0),f(null),pt()},onReviewSummary:$s,history:a.history,historyLoading:a.historyLoading,onOpenHistory:le=>void a.loadHistory(le),recentDirs:((ye=a.settings)==null?void 0:ye.recentDirs)??[],launchDir:O.launchDir??null,listDir:a.listDir,onCreateSession:Ot,listHarnesses:a.listHarnesses,onScaffoldSession:jt,onScaffoldInSession:Pt,onBrowseTemplates:()=>o(!0),templatesActive:l,onScanWorkflows:ze,onOpenInEditor:Tt,onToast:a.showToast,telemetryOptIn:((ke=a.settings)==null?void 0:ke.telemetryOptIn)??O.telemetryOptIn,consentSource:O.consentSource,consentEnvReason:O.consentEnvReason,authenticated:O.authenticated,organizationName:O.organizationName,onToggleTelemetry:async le=>{await a.updateSettings({telemetryOptIn:le})},rollingSummary:((ht=a.settings)==null?void 0:ht.rollingSummary)===!0,onToggleRollingSummary:async le=>{await a.updateSettings({rollingSummary:le})},onStartAuth:a.startAuth,onDisconnect:a.disconnect,settingsOpen:g,onSetSettingsOpen:u}),!C&&!Z&&n.jsx("div",{className:"pane-resize-handle pane-resize-handle-rail",style:{left:te.rail},onPointerDown:F,onDoubleClick:V,role:"separator","aria-orientation":"vertical","aria-label":"Resize workspace rail","data-testid":"resize-handle-rail"}),n.jsxs("div",{className:"workspace-main",children:[!_&&n.jsx(W1,{}),O.consentSource==="default-silent"&&!((yt=a.settings)!=null&&yt.telemetryNoticeDismissed)&&n.jsx(by,{onDismiss:()=>{a.updateSettings({telemetryNoticeDismissed:!0})},onOpenSettings:()=>u(!0)}),n.jsxs("div",{className:"app"+(l?" is-browsing":""),style:{gridTemplateColumns:l||Z?"minmax(0, 1fr)":H?`minmax(${Li}px, 1fr)`:te.canvas==null?`minmax(${Li}px, 1fr) minmax(${Li}px, 1fr)`:`minmax(${Li}px, 1fr) minmax(${Li}px, ${te.canvas}px)`},children:[l&&n.jsx(Gy,{projectRoot:$||null,recentDirs:((et=a.settings)==null?void 0:et.recentDirs)??[],listDir:a.listDir,onExit:()=>o(!1),onUse:_e,listTemplates:a.listTemplates,getTemplate:a.getTemplate}),n.jsxs("div",{className:"center-pane",children:[n.jsx(_y,{openedAgentName:bt,reviewTitle:d?d.title:null,activeSession:vt||Re?ee:null,sessionName:ee?_p(ee,O.sessions,y):null,onRenameSession:R,boundWorkflowName:(Se==null?void 0:Se.name)??null,busy:ee!=null&&a.busySessionIds.has(ee.id),onCloseSession:le=>void a.closeSession(le),onOpenInEditor:Tt,onToast:a.showToast,onExpandRail:C?()=>T(!1):null,onExpandRight:H?()=>I(!1):null}),Lt&&n.jsx(Sy,{sessions:Oe,activeSessionId:a.activeSessionId,busySessionIds:a.busySessionIds,labelOf:le=>_p(le,O.sessions,y),agentName:(ge==null?void 0:ge.name)??(ee==null?void 0:ee.title)??"this agent",onSelect:Rt,onClose:gt,onNew:()=>{ge?Ct(ge):p&&Ot(p,"claude-code")}}),vt&&ee&&Se&&n.jsx(yy,{workflow:Se,activeSessionId:a.activeSessionId,sessionReady:ee.ready===!0&&ee.status!=="exited",macros:O.macros,onRunMacro:le=>ns(Se,le),preview:a.previewBySession.get(ee.id)??null,lastDeployError:a.lastDeployErrorFor(Se.path),authenticated:O.authenticated,directActionSettleSeq:a.directActionSettleSeq}),n.jsx("div",{className:"terminal-slot",children:Ke&&d?n.jsx(iy,{summary:d,loadRecord:a.sessionRecord,onStart:()=>{const le=d;f(null),a.resumeFromHistory(le)},onClose:()=>f(null)}):Re&&ee?n.jsx(sy,{session:ee,resumeMode:ve,loadRecord:a.sessionRecord,onResume:()=>void a.resumeSession(ee.id),onContinue:()=>void a.rehydrateSession({cwd:ee.cwd,harness:ee.harness,from:ee.id}),onClose:()=>void a.closeSession(ee.id)}):ft&&ge?n.jsx(Ts,{className:"terminal-empty",testId:"open-agent-empty",icon:"Radio",title:`No running session for ${ge.name}`,body:"Start a session to map, run, and inspect this agent.",cta:n.jsxs("button",{className:"btn-primary","data-testid":"open-agent-start-session",onClick:()=>Ct(ge),children:[n.jsx(fe,{name:"Plus",size:14})," Start session"]})}):vt&&a.activeSessionId?n.jsx(cy,{sessionId:a.activeSessionId,harness:(ee==null?void 0:ee.harness)??"claude-code",api:a.api,showToast:a.showToast,children:n.jsx("div",{className:"agent-view","data-testid":"agent-view",children:n.jsx("div",{className:"agent-view-panel",id:"agent-panel-terminal",children:n.jsx(oS,{sessionId:a.activeSessionId,token:a.bootToken})})})}):n.jsx(Ts,{className:"terminal-empty",icon:"Radio",title:"No active session",body:"Focus an agent in the workspace panel, then start a session. Your coding agent runs right here, in a real terminal. ⌘K jumps anywhere."})})]}),!H&&!Z&&n.jsx("div",{className:"pane-resize-handle pane-resize-handle-canvas",style:{right:te.canvas??"50%"},onPointerDown:Y,onDoubleClick:M,role:"separator","aria-orientation":"vertical","aria-label":"Resize canvas pane","data-testid":"resize-handle-canvas"}),Z&&!H&&n.jsx("div",{className:"shell-scrim","data-testid":"right-sheet-scrim","aria-hidden":"true",onClick:()=>I(!0)}),n.jsxs("div",{className:"right-pane"+(H?" is-collapsed":""),children:[n.jsxs("div",{className:"right-pane-tabs",role:"tablist","aria-label":"Right pane",children:[n.jsx("button",{role:"tab","aria-selected":v==="canvas",className:"right-pane-tab"+(v==="canvas"?" is-active":""),onClick:()=>w("canvas"),"data-testid":"right-tab-canvas",children:"Canvas"}),n.jsx("button",{role:"tab","aria-selected":v==="steps",className:"right-pane-tab"+(v==="steps"?" is-active":""),onClick:()=>w("steps"),"data-testid":"right-tab-steps",children:"Steps"}),n.jsx("button",{role:"tab","aria-selected":v==="code",className:"right-pane-tab"+(v==="code"?" is-active":""),onClick:()=>{w("code"),b(!0)},"data-testid":"right-tab-code",children:"Code"}),n.jsxs("div",{className:"right-pane-corner",children:[v==="canvas"&&(wt==null?void 0:wt.definitionId)!=null&&n.jsxs("a",{className:"status-tag status-tag-action workflow-deployed-tag right-pane-deployed","data-testid":"workflow-dashboard-link",href:`https://app.sapiom.ai/workflows/${wt.definitionId}`,target:"_blank",rel:"noreferrer","aria-label":"Deployed — open in the Sapiom dashboard","data-tooltip":"Open this workflow in the Sapiom dashboard",children:[n.jsx(fe,{name:"Cloud",size:12}),"deployed"]}),v==="canvas"&&n.jsx("button",{className:"theme-toggle","data-testid":"canvas-expand","aria-label":W?"Exit expanded canvas":"Expand canvas",title:W?"Exit expanded canvas":"Expand canvas",onClick:()=>P(le=>!le),children:n.jsx(fe,{name:W?"Minimize2":"Maximize2",size:15})}),n.jsx("button",{className:"theme-toggle right-pane-collapse","data-testid":"right-collapse","aria-label":"Collapse canvas panel",title:"Collapse canvas panel",onClick:()=>I(!0),children:n.jsx(fe,{name:"PanelRightClose",size:15})})]})]}),n.jsx("div",{className:"right-pane-panel"+(v==="canvas"||v==="steps"?"":" is-hidden"),"data-testid":"right-panel-canvas",children:n.jsx(x1,{sessionId:a.activeSessionId,lastMessage:a.lastMessage,boundWorkflow:wt,noSessionAgent:bt,overviewActive:Pe,sessionExited:Re,expanded:W,onToggleExpanded:()=>P(le=>!le),macros:O.macros,tasks:a.tasks,surface:v==="steps"?"steps":"board",onOpenSteps:()=>w("steps"),run:(st==null?void 0:st.run)??null,runTarget:(st==null?void 0:st.target)??null,runs:it,onSelectRun:le=>{a.activeSessionId&&a.selectRun(a.activeSessionId,le)},workflows:O.workflows,onOpenWorkflow:le=>void is(le),onRunMacro:le=>ns(Se,le),onInjectPrompt:le=>{a.activeSessionId&&a.injectInput(a.activeSessionId,le)}})}),(v==="code"||x)&&n.jsx("div",{className:"right-pane-panel"+(v==="code"?"":" is-hidden"),"data-testid":"right-panel-code",children:n.jsx(H1,{boundWorkflow:wt,noSessionAgent:bt,agentsBaseUrl:O.agentsBaseUrl})})]})]})]}),E&&n.jsx(q1,{sessions:O.sessions,workflows:O.workflows,recentDirs:((Et=a.settings)==null?void 0:Et.recentDirs)??[],history:a.history,listDir:a.listDir,onSelectSession:nt,onReviewSummary:$s,onOpenPath:le=>void Ot(le,"claude-code"),onBrowseTemplates:()=>o(!0),onClose:()=>S(!1)}),Pe&&n.jsx(SS,{recentDirs:((qt=a.settings)==null?void 0:qt.recentDirs)??[],sessions:O.sessions,workflows:O.workflows,projectRoot:$||null,onConnect:async le=>{await a.connectWorkflow(le)},onScan:ze,onScaffold:jt,onSaveProjectRoot:D,listDir:a.listDir,onCreateSession:Ot,listHarnesses:a.listHarnesses,onBrowseTemplates:()=>{k(),o(!0)},onDismiss:k,firstRun:O.firstRun===!0}),a.toast&&n.jsx(uS,{message:a.toast,onDismiss:a.dismissToast}),n.jsx(hS,{})]})};window.addEventListener("scroll",()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},{passive:!0});Sv.createRoot(document.getElementById("root")).render(n.jsx(U.StrictMode,{children:n.jsx(lb,{})}));