@rynx-ai/server 0.1.11-beta.30 → 0.1.11-beta.31

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 (85) hide show
  1. package/dist/control-api.js +37 -0
  2. package/dist/control-web/assets/{abnfDiagram-VRR7QNED-COu02MlJ.js → abnfDiagram-VRR7QNED-8c99_3I5.js} +1 -1
  3. package/dist/control-web/assets/{arc-DqiFeYAM.js → arc-FWW96Tzo.js} +1 -1
  4. package/dist/control-web/assets/{architectureDiagram-ZJ3FMSHR-BWFGgUV4.js → architectureDiagram-ZJ3FMSHR-B5FrqoRB.js} +1 -1
  5. package/dist/control-web/assets/{blockDiagram-677ZJIJ3-ZC0bXDzB.js → blockDiagram-677ZJIJ3-DJRwOGMa.js} +1 -1
  6. package/dist/control-web/assets/{c4Diagram-LMCZKHZV-Uupq5I-s.js → c4Diagram-LMCZKHZV-B8FCUurl.js} +1 -1
  7. package/dist/control-web/assets/channel-Bnyhn1Qs.js +1 -0
  8. package/dist/control-web/assets/{chunk-2Q5K7J3B-C77vwuDM.js → chunk-2Q5K7J3B-DC5xexY2.js} +1 -1
  9. package/dist/control-web/assets/{chunk-32BRIVSS-BkfLE_TX.js → chunk-32BRIVSS-DAzT69zb.js} +1 -1
  10. package/dist/control-web/assets/{chunk-5VM5RSS4-By6zfDWW.js → chunk-5VM5RSS4-CXKpL77L.js} +1 -1
  11. package/dist/control-web/assets/{chunk-EX3LRPZG-CO439p_3.js → chunk-EX3LRPZG-DQKQvoPv.js} +1 -1
  12. package/dist/control-web/assets/{chunk-JWPE2WC7-B9BPEwug.js → chunk-JWPE2WC7-CWMqpJoT.js} +1 -1
  13. package/dist/control-web/assets/{chunk-MOJQB5TN-CYKygWZz.js → chunk-MOJQB5TN-Bd8jn7RZ.js} +1 -1
  14. package/dist/control-web/assets/{chunk-RYQCIY6F-ug-An4HG.js → chunk-RYQCIY6F-DKXEMFO6.js} +1 -1
  15. package/dist/control-web/assets/{chunk-V7JOEXUC-3UFQGnKX.js → chunk-V7JOEXUC-BUDLq5nU.js} +1 -1
  16. package/dist/control-web/assets/{chunk-VR4S4FIN-DjspjYUb.js → chunk-VR4S4FIN-C65l7VIz.js} +1 -1
  17. package/dist/control-web/assets/{chunk-XXDRQBXY-3znnutie.js → chunk-XXDRQBXY-Y2498HkC.js} +1 -1
  18. package/dist/control-web/assets/classDiagram-OUVF2IWQ-CBtXSdwW.js +1 -0
  19. package/dist/control-web/assets/classDiagram-v2-EOCWNBFH-CBtXSdwW.js +1 -0
  20. package/dist/control-web/assets/{cose-bilkent-JH36ORCC-Dr28goCd.js → cose-bilkent-JH36ORCC-C9aVXb8E.js} +1 -1
  21. package/dist/control-web/assets/{cynefin-VYW2F7L2-Be5uJhnw.js → cynefin-VYW2F7L2-BsyMhvG0.js} +1 -1
  22. package/dist/control-web/assets/{cynefinDiagram-TSTJHNR4-BLxtSvL6.js → cynefinDiagram-TSTJHNR4-DwY43f3-.js} +1 -1
  23. package/dist/control-web/assets/{dagre-VKFMJZFB-DPRuDV5p.js → dagre-VKFMJZFB-CP1xk7Ox.js} +1 -1
  24. package/dist/control-web/assets/{diagram-FQU43EPY-Cybg22U0.js → diagram-FQU43EPY-D_yRnH1b.js} +1 -1
  25. package/dist/control-web/assets/{diagram-G47NLZAW-CGeIKUfW.js → diagram-G47NLZAW-DpTmLmbm.js} +1 -1
  26. package/dist/control-web/assets/{diagram-NH7WQ7WH-BJq5MBRm.js → diagram-NH7WQ7WH-Wh_P26Dr.js} +1 -1
  27. package/dist/control-web/assets/{diagram-OA4YK3LP-DquOQGwg.js → diagram-OA4YK3LP-BMMaO78f.js} +1 -1
  28. package/dist/control-web/assets/{diagram-WEI45ONY-Cblb4xP2.js → diagram-WEI45ONY-D8smty9F.js} +1 -1
  29. package/dist/control-web/assets/{ebnfDiagram-CCIWWBDH-CQjHiOqj.js → ebnfDiagram-CCIWWBDH-BqVsmEYh.js} +1 -1
  30. package/dist/control-web/assets/{erDiagram-Q63AITRT-Bspr3uKJ.js → erDiagram-Q63AITRT-CxaumIzW.js} +1 -1
  31. package/dist/control-web/assets/{flowDiagram-23GEKE2U-CxcZyBA-.js → flowDiagram-23GEKE2U-DZhUBne-.js} +1 -1
  32. package/dist/control-web/assets/{ganttDiagram-NO4QXBWP-qBdh7A-P.js → ganttDiagram-NO4QXBWP-B20dY8SF.js} +1 -1
  33. package/dist/control-web/assets/{gitGraphDiagram-IHSO6WYX-BTYub2KT.js → gitGraphDiagram-IHSO6WYX-CAlnqFfW.js} +1 -1
  34. package/dist/control-web/assets/{highlighted-body-OFNGDK62-DyksUrwu.js → highlighted-body-OFNGDK62-vBlGjC8F.js} +1 -1
  35. package/dist/control-web/assets/{index-BDaSctIT.js → index-B3g4Kfko.js} +1 -1
  36. package/dist/control-web/assets/index-BKqZNg1a.js +718 -0
  37. package/dist/control-web/assets/index-CZrE_F_i.css +32 -0
  38. package/dist/control-web/assets/{infoDiagram-FWYZ7A6U-ChbQR3Zo.js → infoDiagram-FWYZ7A6U-PaEyeSke.js} +1 -1
  39. package/dist/control-web/assets/{ishikawaDiagram-FXEZZL3T-C-4_qGzn.js → ishikawaDiagram-FXEZZL3T-BwsgPXGC.js} +1 -1
  40. package/dist/control-web/assets/{journeyDiagram-5HDEW3XC-B090zN18.js → journeyDiagram-5HDEW3XC-BUEf1NEq.js} +1 -1
  41. package/dist/control-web/assets/{kanban-definition-HUTT4EX6-RlTcRbPs.js → kanban-definition-HUTT4EX6-CiTCwnJ7.js} +1 -1
  42. package/dist/control-web/assets/{linear-DTuNxDqu.js → linear-Cs4GSPvX.js} +1 -1
  43. package/dist/control-web/assets/{mermaid-GHXKKRXX-BkcV3dgg.js → mermaid-GHXKKRXX-C_lUqoOB.js} +6 -6
  44. package/dist/control-web/assets/{mindmap-definition-LN4V7U3C-DYby41E9.js → mindmap-definition-LN4V7U3C-B8TkylOR.js} +1 -1
  45. package/dist/control-web/assets/{pegDiagram-2B236MQR-CPK6GaEv.js → pegDiagram-2B236MQR-Bnge_jzz.js} +1 -1
  46. package/dist/control-web/assets/{pieDiagram-ENE6RG2P-DLCmXuji.js → pieDiagram-ENE6RG2P-DOP7FAKG.js} +1 -1
  47. package/dist/control-web/assets/{quadrantDiagram-ABIIQ3AL-RIS8r7CA.js → quadrantDiagram-ABIIQ3AL-Cqqu5uu-.js} +1 -1
  48. package/dist/control-web/assets/{railroadDiagram-RFXS5EU6-B1HB7xsg.js → railroadDiagram-RFXS5EU6-1bk56BMW.js} +1 -1
  49. package/dist/control-web/assets/{requirementDiagram-TGXJPOKE-Inh_4hU0.js → requirementDiagram-TGXJPOKE-BHVwG79A.js} +1 -1
  50. package/dist/control-web/assets/{sankeyDiagram-HTMAVEWB-DPF33kPB.js → sankeyDiagram-HTMAVEWB-ghjBFqfs.js} +1 -1
  51. package/dist/control-web/assets/{sequenceDiagram-DBY2YBRQ-iywKWoYc.js → sequenceDiagram-DBY2YBRQ-DChtyqq5.js} +1 -1
  52. package/dist/control-web/assets/{sizeCapture-X5ZJPWSS-DlnHubz9.js → sizeCapture-X5ZJPWSS-BNp94nCS.js} +1 -1
  53. package/dist/control-web/assets/{stateDiagram-2N3HPSRC-CShzll2N.js → stateDiagram-2N3HPSRC-CaFYkZZ2.js} +1 -1
  54. package/dist/control-web/assets/stateDiagram-v2-6OUMAXLB-CCvEZFYI.js +1 -0
  55. package/dist/control-web/assets/{swimlanes-5IMT3BWC-CxlQpFBv.js → swimlanes-5IMT3BWC-CV2YWeYv.js} +2 -2
  56. package/dist/control-web/assets/swimlanesDiagram-G3AALYLV-BFAdJHEB.js +8 -0
  57. package/dist/control-web/assets/{timeline-definition-FHXFAJF6-Dlx59Xc3.js → timeline-definition-FHXFAJF6-Cq32UWLH.js} +1 -1
  58. package/dist/control-web/assets/{vennDiagram-L72KCM5P-DLsv4i_t.js → vennDiagram-L72KCM5P-BgBoqPth.js} +1 -1
  59. package/dist/control-web/assets/{wardleyDiagram-EHGQE667-BazV8fpH.js → wardleyDiagram-EHGQE667-VsC2Gfpu.js} +1 -1
  60. package/dist/control-web/assets/{xychartDiagram-FW5EYKEG-Bx9uDlYu.js → xychartDiagram-FW5EYKEG-CyFiAunt.js} +1 -1
  61. package/dist/control-web/index.html +2 -2
  62. package/dist/desktop-browser-host.d.ts +3 -1
  63. package/dist/desktop-browser-host.js +39 -4
  64. package/dist/machine-session-service.d.ts +12 -0
  65. package/dist/machine-session-service.js +31 -7
  66. package/dist/remote-runtime-dispatcher.d.ts +1 -1
  67. package/dist/remote-runtime-dispatcher.js +26 -1
  68. package/dist/remote-runtime-session-projection.d.ts +1 -0
  69. package/dist/remote-runtime-session-projection.js +1 -0
  70. package/dist/server.d.ts +23 -1
  71. package/dist/server.js +94 -11
  72. package/dist/session-browser-service.d.ts +24 -4
  73. package/dist/session-browser-service.js +127 -1
  74. package/dist/session-pending-inputs.d.ts +40 -0
  75. package/dist/session-pending-inputs.js +84 -0
  76. package/dist/session-portal.d.ts +14 -2
  77. package/dist/session-portal.js +268 -31
  78. package/package.json +7 -7
  79. package/dist/control-web/assets/channel-3HG15wfa.js +0 -1
  80. package/dist/control-web/assets/classDiagram-OUVF2IWQ-WmU4L9YT.js +0 -1
  81. package/dist/control-web/assets/classDiagram-v2-EOCWNBFH-WmU4L9YT.js +0 -1
  82. package/dist/control-web/assets/index-B9SAq_63.js +0 -718
  83. package/dist/control-web/assets/index-CtaYRNgJ.css +0 -32
  84. package/dist/control-web/assets/stateDiagram-v2-6OUMAXLB-Cdx0fWna.js +0 -1
  85. package/dist/control-web/assets/swimlanesDiagram-G3AALYLV-CoX0jnUu.js +0 -8
@@ -0,0 +1,718 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-GHXKKRXX-C_lUqoOB.js","assets/mermaid-GHXKKRXX-BYZTj3zW.css"])))=>i.map(i=>d[i]);
2
+ var aL=Object.defineProperty;var oL=(e,t,r)=>t in e?aL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var us=(e,t,r)=>oL(e,typeof t!="symbol"?t+"":t,r);function lL(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const n in s)if(n!=="default"&&!(n in e)){const l=Object.getOwnPropertyDescriptor(s,n);l&&Object.defineProperty(e,n,l.get?l:{enumerable:!0,get:()=>s[n]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(n){if(n.ep)return;n.ep=!0;const l=r(n);fetch(n.href,l)}})();function Xk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sv={exports:{}},yu={};/**
3
+ * @license React
4
+ * react-jsx-runtime.production.js
5
+ *
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */var KS;function cL(){if(KS)return yu;KS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,n,l){var c=null;if(l!==void 0&&(c=""+l),n.key!==void 0&&(c=""+n.key),"key"in n){l={};for(var d in n)d!=="key"&&(l[d]=n[d])}else l=n;return n=l.ref,{$$typeof:e,type:s,key:c,ref:n!==void 0?n:null,props:l}}return yu.Fragment=t,yu.jsx=r,yu.jsxs=r,yu}var XS;function uL(){return XS||(XS=1,Sv.exports=cL()),Sv.exports}var o=uL(),Cv={exports:{}},Xe={};/**
11
+ * @license React
12
+ * react.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var ZS;function dL(){if(ZS)return Xe;ZS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,k={};function C(D,V,X){this.props=D,this.context=V,this.refs=k,this.updater=X||w}C.prototype.isReactComponent={},C.prototype.setState=function(D,V){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,V,"setState")},C.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function E(){}E.prototype=C.prototype;function N(D,V,X){this.props=D,this.context=V,this.refs=k,this.updater=X||w}var R=N.prototype=new E;R.constructor=N,S(R,C.prototype),R.isPureReactComponent=!0;var T=Array.isArray;function P(){}var z={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function F(D,V,X){var J=X.ref;return{$$typeof:e,type:D,key:V,ref:J!==void 0?J:null,props:X}}function Y(D,V){return F(D.type,V,D.props)}function q(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function $(D){var V={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(X){return V[X]})}var M=/\/+/g;function U(D,V){return typeof D=="object"&&D!==null&&D.key!=null?$(""+D.key):V.toString(36)}function W(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(P,P):(D.status="pending",D.then(function(V){D.status==="pending"&&(D.status="fulfilled",D.value=V)},function(V){D.status==="pending"&&(D.status="rejected",D.reason=V)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function A(D,V,X,J,se){var de=typeof D;(de==="undefined"||de==="boolean")&&(D=null);var Z=!1;if(D===null)Z=!0;else switch(de){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(D.$$typeof){case e:case t:Z=!0;break;case v:return Z=D._init,A(Z(D._payload),V,X,J,se)}}if(Z)return se=se(D),Z=J===""?"."+U(D,0):J,T(se)?(X="",Z!=null&&(X=Z.replace(M,"$&/")+"/"),A(se,V,X,"",function(we){return we})):se!=null&&(q(se)&&(se=Y(se,X+(se.key==null||D&&D.key===se.key?"":(""+se.key).replace(M,"$&/")+"/")+Z)),V.push(se)),1;Z=0;var ce=J===""?".":J+":";if(T(D))for(var le=0;le<D.length;le++)J=D[le],de=ce+U(J,le),Z+=A(J,V,X,de,se);else if(le=y(D),typeof le=="function")for(D=le.call(D),le=0;!(J=D.next()).done;)J=J.value,de=ce+U(J,le++),Z+=A(J,V,X,de,se);else if(de==="object"){if(typeof D.then=="function")return A(W(D),V,X,J,se);throw V=String(D),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Z}function O(D,V,X){if(D==null)return D;var J=[],se=0;return A(D,J,"","",function(de){return V.call(X,de,se++)}),J}function L(D){if(D._status===-1){var V=D._result;V=V(),V.then(function(X){(D._status===0||D._status===-1)&&(D._status=1,D._result=X)},function(X){(D._status===0||D._status===-1)&&(D._status=2,D._result=X)}),D._status===-1&&(D._status=0,D._result=V)}if(D._status===1)return D._result.default;throw D._result}var G=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=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(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},H={map:O,forEach:function(D,V,X){O(D,function(){V.apply(this,arguments)},X)},count:function(D){var V=0;return O(D,function(){V++}),V},toArray:function(D){return O(D,function(V){return V})||[]},only:function(D){if(!q(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Xe.Activity=g,Xe.Children=H,Xe.Component=C,Xe.Fragment=r,Xe.Profiler=n,Xe.PureComponent=N,Xe.StrictMode=s,Xe.Suspense=m,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(D){return z.H.useMemoCache(D)}},Xe.cache=function(D){return function(){return D.apply(null,arguments)}},Xe.cacheSignal=function(){return null},Xe.cloneElement=function(D,V,X){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var J=S({},D.props),se=D.key;if(V!=null)for(de in V.key!==void 0&&(se=""+V.key),V)!B.call(V,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&V.ref===void 0||(J[de]=V[de]);var de=arguments.length-2;if(de===1)J.children=X;else if(1<de){for(var Z=Array(de),ce=0;ce<de;ce++)Z[ce]=arguments[ce+2];J.children=Z}return F(D.type,se,J)},Xe.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:l,_context:D},D},Xe.createElement=function(D,V,X){var J,se={},de=null;if(V!=null)for(J in V.key!==void 0&&(de=""+V.key),V)B.call(V,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(se[J]=V[J]);var Z=arguments.length-2;if(Z===1)se.children=X;else if(1<Z){for(var ce=Array(Z),le=0;le<Z;le++)ce[le]=arguments[le+2];se.children=ce}if(D&&D.defaultProps)for(J in Z=D.defaultProps,Z)se[J]===void 0&&(se[J]=Z[J]);return F(D,de,se)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(D){return{$$typeof:d,render:D}},Xe.isValidElement=q,Xe.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:L}},Xe.memo=function(D,V){return{$$typeof:h,type:D,compare:V===void 0?null:V}},Xe.startTransition=function(D){var V=z.T,X={};z.T=X;try{var J=D(),se=z.S;se!==null&&se(X,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(P,G)}catch(de){G(de)}finally{V!==null&&X.types!==null&&(V.types=X.types),z.T=V}},Xe.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Xe.use=function(D){return z.H.use(D)},Xe.useActionState=function(D,V,X){return z.H.useActionState(D,V,X)},Xe.useCallback=function(D,V){return z.H.useCallback(D,V)},Xe.useContext=function(D){return z.H.useContext(D)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(D,V){return z.H.useDeferredValue(D,V)},Xe.useEffect=function(D,V){return z.H.useEffect(D,V)},Xe.useEffectEvent=function(D){return z.H.useEffectEvent(D)},Xe.useId=function(){return z.H.useId()},Xe.useImperativeHandle=function(D,V,X){return z.H.useImperativeHandle(D,V,X)},Xe.useInsertionEffect=function(D,V){return z.H.useInsertionEffect(D,V)},Xe.useLayoutEffect=function(D,V){return z.H.useLayoutEffect(D,V)},Xe.useMemo=function(D,V){return z.H.useMemo(D,V)},Xe.useOptimistic=function(D,V){return z.H.useOptimistic(D,V)},Xe.useReducer=function(D,V,X){return z.H.useReducer(D,V,X)},Xe.useRef=function(D){return z.H.useRef(D)},Xe.useState=function(D){return z.H.useState(D)},Xe.useSyncExternalStore=function(D,V,X){return z.H.useSyncExternalStore(D,V,X)},Xe.useTransition=function(){return z.H.useTransition()},Xe.version="19.2.7",Xe}var QS;function S0(){return QS||(QS=1,Cv.exports=dL()),Cv.exports}var p=S0();const Ce=Xk(p),fo=lL({__proto__:null,default:Ce},[p]);var kv={exports:{}},bu={},Ev={exports:{}},Rv={};/**
19
+ * @license React
20
+ * scheduler.production.js
21
+ *
22
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */var JS;function hL(){return JS||(JS=1,(function(e){function t(A,O){var L=A.length;A.push(O);e:for(;0<L;){var G=L-1>>>1,H=A[G];if(0<n(H,O))A[G]=O,A[L]=H,L=G;else break e}}function r(A){return A.length===0?null:A[0]}function s(A){if(A.length===0)return null;var O=A[0],L=A.pop();if(L!==O){A[0]=L;e:for(var G=0,H=A.length,D=H>>>1;G<D;){var V=2*(G+1)-1,X=A[V],J=V+1,se=A[J];if(0>n(X,L))J<H&&0>n(se,X)?(A[G]=se,A[J]=L,G=J):(A[G]=X,A[V]=L,G=V);else if(J<H&&0>n(se,L))A[G]=se,A[J]=L,G=J;else break e}}return O}function n(A,O){var L=A.sortIndex-O.sortIndex;return L!==0?L:A.id-O.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],h=[],v=1,g=null,x=3,y=!1,w=!1,S=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(A){for(var O=r(h);O!==null;){if(O.callback===null)s(h);else if(O.startTime<=A)s(h),O.sortIndex=O.expirationTime,t(m,O);else break;O=r(h)}}function T(A){if(S=!1,R(A),!w)if(r(m)!==null)w=!0,P||(P=!0,$());else{var O=r(h);O!==null&&W(T,O.startTime-A)}}var P=!1,z=-1,B=5,F=-1;function Y(){return k?!0:!(e.unstable_now()-F<B)}function q(){if(k=!1,P){var A=e.unstable_now();F=A;var O=!0;try{e:{w=!1,S&&(S=!1,E(z),z=-1),y=!0;var L=x;try{t:{for(R(A),g=r(m);g!==null&&!(g.expirationTime>A&&Y());){var G=g.callback;if(typeof G=="function"){g.callback=null,x=g.priorityLevel;var H=G(g.expirationTime<=A);if(A=e.unstable_now(),typeof H=="function"){g.callback=H,R(A),O=!0;break t}g===r(m)&&s(m),R(A)}else s(m);g=r(m)}if(g!==null)O=!0;else{var D=r(h);D!==null&&W(T,D.startTime-A),O=!1}}break e}finally{g=null,x=L,y=!1}O=void 0}}finally{O?$():P=!1}}}var $;if(typeof N=="function")$=function(){N(q)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,U=M.port2;M.port1.onmessage=q,$=function(){U.postMessage(null)}}else $=function(){C(q,0)};function W(A,O){z=C(function(){A(e.unstable_now())},O)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(A){switch(x){case 1:case 2:case 3:var O=3;break;default:O=x}var L=x;x=O;try{return A()}finally{x=L}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(A,O){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var L=x;x=A;try{return O()}finally{x=L}},e.unstable_scheduleCallback=function(A,O,L){var G=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?G+L:G):L=G,A){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=L+H,A={id:v++,callback:O,priorityLevel:A,startTime:L,expirationTime:H,sortIndex:-1},L>G?(A.sortIndex=L,t(h,A),r(m)===null&&A===r(h)&&(S?(E(z),z=-1):S=!0,W(T,L-G))):(A.sortIndex=H,t(m,A),w||y||(w=!0,P||(P=!0,$()))),A},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(A){var O=x;return function(){var L=x;x=O;try{return A.apply(this,arguments)}finally{x=L}}}})(Rv)),Rv}var eC;function fL(){return eC||(eC=1,Ev.exports=hL()),Ev.exports}var Nv={exports:{}},ds={};/**
27
+ * @license React
28
+ * react-dom.production.js
29
+ *
30
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
31
+ *
32
+ * This source code is licensed under the MIT license found in the
33
+ * LICENSE file in the root directory of this source tree.
34
+ */var tC;function mL(){if(tC)return ds;tC=1;var e=S0();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},n=Symbol.for("react.portal");function l(m,h,v){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:n,key:g==null?null:""+g,children:m,containerInfo:h,implementation:v}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return ds.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,ds.createPortal=function(m,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(m,h,null,v)},ds.flushSync=function(m){var h=c.T,v=s.p;try{if(c.T=null,s.p=2,m)return m()}finally{c.T=h,s.p=v,s.d.f()}},ds.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(m,h))},ds.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},ds.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var v=h.as,g=d(v,h.crossOrigin),x=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?s.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:y}):v==="script"&&s.d.X(m,{crossOrigin:g,integrity:x,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},ds.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=d(h.as,h.crossOrigin);s.d.M(m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(m)},ds.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,g=d(v,h.crossOrigin);s.d.L(m,v,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},ds.preloadModule=function(m,h){if(typeof m=="string")if(h){var v=d(h.as,h.crossOrigin);s.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(m)},ds.requestFormReset=function(m){s.d.r(m)},ds.unstable_batchedUpdates=function(m,h){return m(h)},ds.useFormState=function(m,h,v){return c.H.useFormState(m,h,v)},ds.useFormStatus=function(){return c.H.useHostTransitionStatus()},ds.version="19.2.7",ds}var rC;function Zk(){if(rC)return Nv.exports;rC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Nv.exports=mL(),Nv.exports}/**
35
+ * @license React
36
+ * react-dom-client.production.js
37
+ *
38
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
39
+ *
40
+ * This source code is licensed under the MIT license found in the
41
+ * LICENSE file in the root directory of this source tree.
42
+ */var sC;function pL(){if(sC)return bu;sC=1;var e=fL(),t=S0(),r=Zk();function s(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function l(i){var a=i,u=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(u=a.return),i=a.return;while(i)}return a.tag===3?u:null}function c(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function d(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function m(i){if(l(i)!==i)throw Error(s(188))}function h(i){var a=i.alternate;if(!a){if(a=l(i),a===null)throw Error(s(188));return a!==i?null:i}for(var u=i,f=a;;){var _=u.return;if(_===null)break;var b=_.alternate;if(b===null){if(f=_.return,f!==null){u=f;continue}break}if(_.child===b.child){for(b=_.child;b;){if(b===u)return m(_),i;if(b===f)return m(_),a;b=b.sibling}throw Error(s(188))}if(u.return!==f.return)u=_,f=b;else{for(var j=!1,I=_.child;I;){if(I===u){j=!0,u=_,f=b;break}if(I===f){j=!0,f=_,u=b;break}I=I.sibling}if(!j){for(I=b.child;I;){if(I===u){j=!0,u=b,f=_;break}if(I===f){j=!0,f=b,u=_;break}I=I.sibling}if(!j)throw Error(s(189))}}if(u.alternate!==f)throw Error(s(190))}if(u.tag!==3)throw Error(s(188));return u.stateNode.current===u?i:a}function v(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=v(i),a!==null)return a;i=i.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function $(i){return i===null||typeof i!="object"?null:(i=q&&i[q]||i["@@iterator"],typeof i=="function"?i:null)}var M=Symbol.for("react.client.reference");function U(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===M?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case T:return"Suspense";case P:return"SuspenseList";case F:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case N:return i.displayName||"Context";case E:return(i._context.displayName||"Context")+".Consumer";case R:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case z:return a=i.displayName||null,a!==null?a:U(i.type)||"Memo";case B:a=i._payload,i=i._init;try{return U(i(a))}catch{}}return null}var W=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},G=[],H=-1;function D(i){return{current:i}}function V(i){0>H||(i.current=G[H],G[H]=null,H--)}function X(i,a){H++,G[H]=i.current,i.current=a}var J=D(null),se=D(null),de=D(null),Z=D(null);function ce(i,a){switch(X(de,a),X(se,i),X(J,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?_S(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=_S(a),i=xS(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}V(J),X(J,i)}function le(){V(J),V(se),V(de)}function we(i){i.memoizedState!==null&&X(Z,i);var a=J.current,u=xS(a,i.type);a!==u&&(X(se,i),X(J,u))}function Ee(i){se.current===i&&(V(J),V(se)),Z.current===i&&(V(Z),gu._currentValue=L)}var Re,te;function ie(i){if(Re===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Re=a&&a[1]||"",te=-1<u.stack.indexOf(`
43
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
44
+ `+Re+i+te}var ke=!1;function Ke(i,a){if(!i||ke)return"";ke=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(ue){var oe=ue}Reflect.construct(i,[],ge)}else{try{ge.call()}catch(ue){oe=ue}i.call(ge.prototype)}}else{try{throw Error()}catch(ue){oe=ue}(ge=i())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(ue){if(ue&&oe&&typeof ue.stack=="string")return[ue.stack,oe.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=f.DetermineComponentFrameRoot(),j=b[0],I=b[1];if(j&&I){var K=j.split(`
45
+ `),ae=I.split(`
46
+ `);for(_=f=0;f<K.length&&!K[f].includes("DetermineComponentFrameRoot");)f++;for(;_<ae.length&&!ae[_].includes("DetermineComponentFrameRoot");)_++;if(f===K.length||_===ae.length)for(f=K.length-1,_=ae.length-1;1<=f&&0<=_&&K[f]!==ae[_];)_--;for(;1<=f&&0<=_;f--,_--)if(K[f]!==ae[_]){if(f!==1||_!==1)do if(f--,_--,0>_||K[f]!==ae[_]){var he=`
47
+ `+K[f].replace(" at new "," at ");return i.displayName&&he.includes("<anonymous>")&&(he=he.replace("<anonymous>",i.displayName)),he}while(1<=f&&0<=_);break}}}finally{ke=!1,Error.prepareStackTrace=u}return(u=i?i.displayName||i.name:"")?ie(u):""}function _e(i,a){switch(i.tag){case 26:case 27:case 5:return ie(i.type);case 16:return ie("Lazy");case 13:return i.child!==a&&a!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return Ke(i.type,!1);case 11:return Ke(i.type.render,!1);case 1:return Ke(i.type,!0);case 31:return ie("Activity");default:return""}}function ye(i){try{var a="",u=null;do a+=_e(i,u),u=i,i=i.return;while(i);return a}catch(f){return`
48
+ Error generating stack: `+f.message+`
49
+ `+f.stack}}var Ie=Object.prototype.hasOwnProperty,ze=e.unstable_scheduleCallback,pt=e.unstable_cancelCallback,rt=e.unstable_shouldYield,$e=e.unstable_requestPaint,He=e.unstable_now,Nt=e.unstable_getCurrentPriorityLevel,Ct=e.unstable_ImmediatePriority,gs=e.unstable_UserBlockingPriority,cs=e.unstable_NormalPriority,gr=e.unstable_LowPriority,kt=e.unstable_IdlePriority,Fe=e.log,jt=e.unstable_setDisableYieldValue,zs=null,Mr=null;function vs(i){if(typeof Fe=="function"&&jt(i),Mr&&typeof Mr.setStrictMode=="function")try{Mr.setStrictMode(zs,i)}catch{}}var Ht=Math.clz32?Math.clz32:Qe,Te=Math.log,Ve=Math.LN2;function Qe(i){return i>>>=0,i===0?32:31-(Te(i)/Ve|0)|0}var sr=256,es=262144,lt=4194304;function vr(i){var a=i&42;if(a!==0)return a;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function qe(i,a,u){var f=i.pendingLanes;if(f===0)return 0;var _=0,b=i.suspendedLanes,j=i.pingedLanes;i=i.warmLanes;var I=f&134217727;return I!==0?(f=I&~b,f!==0?_=vr(f):(j&=I,j!==0?_=vr(j):u||(u=I&~i,u!==0&&(_=vr(u))))):(I=f&~b,I!==0?_=vr(I):j!==0?_=vr(j):u||(u=f&~i,u!==0&&(_=vr(u)))),_===0?0:a!==0&&a!==_&&(a&b)===0&&(b=_&-_,u=a&-a,b>=u||b===32&&(u&4194048)!==0)?a:_}function Et(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function Ft(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Qt(){var i=lt;return lt<<=1,(lt&62914560)===0&&(lt=4194304),i}function Cs(i){for(var a=[],u=0;31>u;u++)a.push(i);return a}function st(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function ir(i,a,u,f,_,b){var j=i.pendingLanes;i.pendingLanes=u,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=u,i.entangledLanes&=u,i.errorRecoveryDisabledLanes&=u,i.shellSuspendCounter=0;var I=i.entanglements,K=i.expirationTimes,ae=i.hiddenUpdates;for(u=j&~u;0<u;){var he=31-Ht(u),ge=1<<he;I[he]=0,K[he]=-1;var oe=ae[he];if(oe!==null)for(ae[he]=null,he=0;he<oe.length;he++){var ue=oe[he];ue!==null&&(ue.lane&=-536870913)}u&=~ge}f!==0&&It(i,f,0),b!==0&&_===0&&i.tag!==0&&(i.suspendedLanes|=b&~(j&~a))}function It(i,a,u){i.pendingLanes|=a,i.suspendedLanes&=~a;var f=31-Ht(a);i.entangledLanes|=a,i.entanglements[f]=i.entanglements[f]|1073741824|u&261930}function zt(i,a){var u=i.entangledLanes|=a;for(i=i.entanglements;u;){var f=31-Ht(u),_=1<<f;_&a|i[f]&a&&(i[f]|=a),u&=~_}}function nr(i,a){var u=a&-a;return u=(u&42)!==0?1:Pi(u),(u&(i.suspendedLanes|a))!==0?0:u}function Pi(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ar(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Dn(){var i=O.p;return i!==0?i:(i=window.event,i===void 0?32:HS(i.type))}function bo(i,a){var u=O.p;try{return O.p=i,a()}finally{O.p=u}}var _r=Math.random().toString(36).slice(2),$t="__reactFiber$"+_r,ct="__reactProps$"+_r,Ii="__reactContainer$"+_r,nn="__reactEvents$"+_r,pl="__reactListeners$"+_r,xe="__reactHandles$"+_r,De="__reactResources$"+_r,dt="__reactMarker$"+_r;function Jt(i){delete i[$t],delete i[ct],delete i[nn],delete i[pl],delete i[xe]}function Kt(i){var a=i[$t];if(a)return a;for(var u=i.parentNode;u;){if(a=u[Ii]||u[$t]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(i=ES(i);i!==null;){if(u=i[$t])return u;i=ES(i)}return a}i=u,u=i.parentNode}return null}function ks(i){if(i=i[$t]||i[Ii]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function ni(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(s(33))}function Es(i){var a=i[De];return a||(a=i[De]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function $r(i){i[dt]=!0}var ab=new Set,ob={};function wo(i,a){gl(i,a),gl(i+"Capture",a)}function gl(i,a){for(ob[i]=a,i=0;i<a.length;i++)ab.add(a[i])}var ZM=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]*$"),lb={},cb={};function QM(i){return Ie.call(cb,i)?!0:Ie.call(lb,i)?!1:ZM.test(i)?cb[i]=!0:(lb[i]=!0,!1)}function Ld(i,a,u){if(QM(a))if(u===null)i.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var f=a.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+u)}}function Od(i,a,u){if(u===null)i.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+u)}}function Ln(i,a,u,f){if(f===null)i.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(u);return}i.setAttributeNS(a,u,""+f)}}function ai(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ub(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function JM(i,a,u){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var _=f.get,b=f.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return _.call(this)},set:function(j){u=""+j,b.call(this,j)}}),Object.defineProperty(i,a,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(j){u=""+j},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function gp(i){if(!i._valueTracker){var a=ub(i)?"checked":"value";i._valueTracker=JM(i,a,""+i[a])}}function db(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var u=a.getValue(),f="";return i&&(f=ub(i)?i.checked?"true":"false":i.value),i=f,i!==u?(a.setValue(i),!0):!1}function Bd(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var e3=/[\n"\\]/g;function oi(i){return i.replace(e3,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function vp(i,a,u,f,_,b,j,I){i.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?i.type=j:i.removeAttribute("type"),a!=null?j==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+ai(a)):i.value!==""+ai(a)&&(i.value=""+ai(a)):j!=="submit"&&j!=="reset"||i.removeAttribute("value"),a!=null?_p(i,j,ai(a)):u!=null?_p(i,j,ai(u)):f!=null&&i.removeAttribute("value"),_==null&&b!=null&&(i.defaultChecked=!!b),_!=null&&(i.checked=_&&typeof _!="function"&&typeof _!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?i.name=""+ai(I):i.removeAttribute("name")}function hb(i,a,u,f,_,b,j,I){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.type=b),a!=null||u!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){gp(i);return}u=u!=null?""+ai(u):"",a=a!=null?""+ai(a):u,I||a===i.value||(i.value=a),i.defaultValue=a}f=f??_,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=I?i.checked:!!f,i.defaultChecked=!!f,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(i.name=j),gp(i)}function _p(i,a,u){a==="number"&&Bd(i.ownerDocument)===i||i.defaultValue===""+u||(i.defaultValue=""+u)}function vl(i,a,u,f){if(i=i.options,a){a={};for(var _=0;_<u.length;_++)a["$"+u[_]]=!0;for(u=0;u<i.length;u++)_=a.hasOwnProperty("$"+i[u].value),i[u].selected!==_&&(i[u].selected=_),_&&f&&(i[u].defaultSelected=!0)}else{for(u=""+ai(u),a=null,_=0;_<i.length;_++){if(i[_].value===u){i[_].selected=!0,f&&(i[_].defaultSelected=!0);return}a!==null||i[_].disabled||(a=i[_])}a!==null&&(a.selected=!0)}}function fb(i,a,u){if(a!=null&&(a=""+ai(a),a!==i.value&&(i.value=a),u==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=u!=null?""+ai(u):""}function mb(i,a,u,f){if(a==null){if(f!=null){if(u!=null)throw Error(s(92));if(W(f)){if(1<f.length)throw Error(s(93));f=f[0]}u=f}u==null&&(u=""),a=u}u=ai(a),i.defaultValue=u,f=i.textContent,f===u&&f!==""&&f!==null&&(i.value=f),gp(i)}function _l(i,a){if(a){var u=i.firstChild;if(u&&u===i.lastChild&&u.nodeType===3){u.nodeValue=a;return}}i.textContent=a}var t3=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 pb(i,a,u){var f=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":f?i.setProperty(a,u):typeof u!="number"||u===0||t3.has(a)?a==="float"?i.cssFloat=u:i[a]=(""+u).trim():i[a]=u+"px"}function gb(i,a,u){if(a!=null&&typeof a!="object")throw Error(s(62));if(i=i.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||a!=null&&a.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var _ in a)f=a[_],a.hasOwnProperty(_)&&u[_]!==f&&pb(i,_,f)}else for(var b in a)a.hasOwnProperty(b)&&pb(i,b,a[b])}function xp(i){if(i.indexOf("-")===-1)return!1;switch(i){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 r3=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"]]),s3=/^[\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 Pd(i){return s3.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function On(){}var yp=null;function bp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var xl=null,yl=null;function vb(i){var a=ks(i);if(a&&(i=a.stateNode)){var u=i[ct]||null;e:switch(i=a.stateNode,a.type){case"input":if(vp(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=i;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+oi(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var f=u[a];if(f!==i&&f.form===i.form){var _=f[ct]||null;if(!_)throw Error(s(90));vp(f,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(a=0;a<u.length;a++)f=u[a],f.form===i.form&&db(f)}break e;case"textarea":fb(i,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&vl(i,!!u.multiple,a,!1)}}}var wp=!1;function _b(i,a,u){if(wp)return i(a,u);wp=!0;try{var f=i(a);return f}finally{if(wp=!1,(xl!==null||yl!==null)&&(Ch(),xl&&(a=xl,i=yl,yl=xl=null,vb(a),i)))for(a=0;a<i.length;a++)vb(i[a])}}function Dc(i,a){var u=i.stateNode;if(u===null)return null;var f=u[ct]||null;if(f===null)return null;u=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(u&&typeof u!="function")throw Error(s(231,a,typeof u));return u}var Bn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Sp=!1;if(Bn)try{var Lc={};Object.defineProperty(Lc,"passive",{get:function(){Sp=!0}}),window.addEventListener("test",Lc,Lc),window.removeEventListener("test",Lc,Lc)}catch{Sp=!1}var xa=null,Cp=null,Id=null;function xb(){if(Id)return Id;var i,a=Cp,u=a.length,f,_="value"in xa?xa.value:xa.textContent,b=_.length;for(i=0;i<u&&a[i]===_[i];i++);var j=u-i;for(f=1;f<=j&&a[u-f]===_[b-f];f++);return Id=_.slice(i,1<f?1-f:void 0)}function zd(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function $d(){return!0}function yb(){return!1}function Rs(i){function a(u,f,_,b,j){this._reactName=u,this._targetInst=_,this.type=f,this.nativeEvent=b,this.target=j,this.currentTarget=null;for(var I in i)i.hasOwnProperty(I)&&(u=i[I],this[I]=u?u(b):b[I]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?$d:yb,this.isPropagationStopped=yb,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=$d)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=$d)},persist:function(){},isPersistent:$d}),a}var So={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ud=Rs(So),Oc=g({},So,{view:0,detail:0}),i3=Rs(Oc),kp,Ep,Bc,Hd=g({},Oc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Np,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Bc&&(Bc&&i.type==="mousemove"?(kp=i.screenX-Bc.screenX,Ep=i.screenY-Bc.screenY):Ep=kp=0,Bc=i),kp)},movementY:function(i){return"movementY"in i?i.movementY:Ep}}),bb=Rs(Hd),n3=g({},Hd,{dataTransfer:0}),a3=Rs(n3),o3=g({},Oc,{relatedTarget:0}),Rp=Rs(o3),l3=g({},So,{animationName:0,elapsedTime:0,pseudoElement:0}),c3=Rs(l3),u3=g({},So,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),d3=Rs(u3),h3=g({},So,{data:0}),wb=Rs(h3),f3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},m3={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"},p3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g3(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=p3[i])?!!a[i]:!1}function Np(){return g3}var v3=g({},Oc,{key:function(i){if(i.key){var a=f3[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=zd(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?m3[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Np,charCode:function(i){return i.type==="keypress"?zd(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?zd(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),_3=Rs(v3),x3=g({},Hd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sb=Rs(x3),y3=g({},Oc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Np}),b3=Rs(y3),w3=g({},So,{propertyName:0,elapsedTime:0,pseudoElement:0}),S3=Rs(w3),C3=g({},Hd,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),k3=Rs(C3),E3=g({},So,{newState:0,oldState:0}),R3=Rs(E3),N3=[9,13,27,32],jp=Bn&&"CompositionEvent"in window,Pc=null;Bn&&"documentMode"in document&&(Pc=document.documentMode);var j3=Bn&&"TextEvent"in window&&!Pc,Cb=Bn&&(!jp||Pc&&8<Pc&&11>=Pc),kb=" ",Eb=!1;function Rb(i,a){switch(i){case"keyup":return N3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nb(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var bl=!1;function A3(i,a){switch(i){case"compositionend":return Nb(a);case"keypress":return a.which!==32?null:(Eb=!0,kb);case"textInput":return i=a.data,i===kb&&Eb?null:i;default:return null}}function T3(i,a){if(bl)return i==="compositionend"||!jp&&Rb(i,a)?(i=xb(),Id=Cp=xa=null,bl=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Cb&&a.locale!=="ko"?null:a.data;default:return null}}var M3={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 jb(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!M3[i.type]:a==="textarea"}function Ab(i,a,u,f){xl?yl?yl.push(f):yl=[f]:xl=f,a=Th(a,"onChange"),0<a.length&&(u=new Ud("onChange","change",null,u,f),i.push({event:u,listeners:a}))}var Ic=null,zc=null;function D3(i){hS(i,0)}function Fd(i){var a=ni(i);if(db(a))return i}function Tb(i,a){if(i==="change")return a}var Mb=!1;if(Bn){var Ap;if(Bn){var Tp="oninput"in document;if(!Tp){var Db=document.createElement("div");Db.setAttribute("oninput","return;"),Tp=typeof Db.oninput=="function"}Ap=Tp}else Ap=!1;Mb=Ap&&(!document.documentMode||9<document.documentMode)}function Lb(){Ic&&(Ic.detachEvent("onpropertychange",Ob),zc=Ic=null)}function Ob(i){if(i.propertyName==="value"&&Fd(zc)){var a=[];Ab(a,zc,i,bp(i)),_b(D3,a)}}function L3(i,a,u){i==="focusin"?(Lb(),Ic=a,zc=u,Ic.attachEvent("onpropertychange",Ob)):i==="focusout"&&Lb()}function O3(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Fd(zc)}function B3(i,a){if(i==="click")return Fd(a)}function P3(i,a){if(i==="input"||i==="change")return Fd(a)}function I3(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var $s=typeof Object.is=="function"?Object.is:I3;function $c(i,a){if($s(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var u=Object.keys(i),f=Object.keys(a);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var _=u[f];if(!Ie.call(a,_)||!$s(i[_],a[_]))return!1}return!0}function Bb(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Pb(i,a){var u=Bb(i);i=0;for(var f;u;){if(u.nodeType===3){if(f=i+u.textContent.length,i<=a&&f>=a)return{node:u,offset:a-i};i=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Bb(u)}}function Ib(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Ib(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function zb(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=Bd(i.document);a instanceof i.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)i=a.contentWindow;else break;a=Bd(i.document)}return a}function Mp(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var z3=Bn&&"documentMode"in document&&11>=document.documentMode,wl=null,Dp=null,Uc=null,Lp=!1;function $b(i,a,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Lp||wl==null||wl!==Bd(f)||(f=wl,"selectionStart"in f&&Mp(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Uc&&$c(Uc,f)||(Uc=f,f=Th(Dp,"onSelect"),0<f.length&&(a=new Ud("onSelect","select",null,a,u),i.push({event:a,listeners:f}),a.target=wl)))}function Co(i,a){var u={};return u[i.toLowerCase()]=a.toLowerCase(),u["Webkit"+i]="webkit"+a,u["Moz"+i]="moz"+a,u}var Sl={animationend:Co("Animation","AnimationEnd"),animationiteration:Co("Animation","AnimationIteration"),animationstart:Co("Animation","AnimationStart"),transitionrun:Co("Transition","TransitionRun"),transitionstart:Co("Transition","TransitionStart"),transitioncancel:Co("Transition","TransitionCancel"),transitionend:Co("Transition","TransitionEnd")},Op={},Ub={};Bn&&(Ub=document.createElement("div").style,"AnimationEvent"in window||(delete Sl.animationend.animation,delete Sl.animationiteration.animation,delete Sl.animationstart.animation),"TransitionEvent"in window||delete Sl.transitionend.transition);function ko(i){if(Op[i])return Op[i];if(!Sl[i])return i;var a=Sl[i],u;for(u in a)if(a.hasOwnProperty(u)&&u in Ub)return Op[i]=a[u];return i}var Hb=ko("animationend"),Fb=ko("animationiteration"),qb=ko("animationstart"),$3=ko("transitionrun"),U3=ko("transitionstart"),H3=ko("transitioncancel"),Wb=ko("transitionend"),Vb=new Map,Bp="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(" ");Bp.push("scrollEnd");function zi(i,a){Vb.set(i,a),wo(a,[i])}var qd=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},li=[],Cl=0,Pp=0;function Wd(){for(var i=Cl,a=Pp=Cl=0;a<i;){var u=li[a];li[a++]=null;var f=li[a];li[a++]=null;var _=li[a];li[a++]=null;var b=li[a];if(li[a++]=null,f!==null&&_!==null){var j=f.pending;j===null?_.next=_:(_.next=j.next,j.next=_),f.pending=_}b!==0&&Gb(u,_,b)}}function Vd(i,a,u,f){li[Cl++]=i,li[Cl++]=a,li[Cl++]=u,li[Cl++]=f,Pp|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function Ip(i,a,u,f){return Vd(i,a,u,f),Gd(i)}function Eo(i,a){return Vd(i,null,null,a),Gd(i)}function Gb(i,a,u){i.lanes|=u;var f=i.alternate;f!==null&&(f.lanes|=u);for(var _=!1,b=i.return;b!==null;)b.childLanes|=u,f=b.alternate,f!==null&&(f.childLanes|=u),b.tag===22&&(i=b.stateNode,i===null||i._visibility&1||(_=!0)),i=b,b=b.return;return i.tag===3?(b=i.stateNode,_&&a!==null&&(_=31-Ht(u),i=b.hiddenUpdates,f=i[_],f===null?i[_]=[a]:f.push(a),a.lane=u|536870912),b):null}function Gd(i){if(50<cu)throw cu=0,Gg=null,Error(s(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var kl={};function F3(i,a,u,f){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Us(i,a,u,f){return new F3(i,a,u,f)}function zp(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Pn(i,a){var u=i.alternate;return u===null?(u=Us(i.tag,a,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=a,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&65011712,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,a=i.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u.refCleanup=i.refCleanup,u}function Yb(i,a){i.flags&=65011714;var u=i.alternate;return u===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=u.childLanes,i.lanes=u.lanes,i.child=u.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=u.memoizedProps,i.memoizedState=u.memoizedState,i.updateQueue=u.updateQueue,i.type=u.type,a=u.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function Yd(i,a,u,f,_,b){var j=0;if(f=i,typeof i=="function")zp(i)&&(j=1);else if(typeof i=="string")j=YD(i,u,J.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case F:return i=Us(31,u,a,_),i.elementType=F,i.lanes=b,i;case S:return Ro(u.children,_,b,a);case k:j=8,_|=24;break;case C:return i=Us(12,u,a,_|2),i.elementType=C,i.lanes=b,i;case T:return i=Us(13,u,a,_),i.elementType=T,i.lanes=b,i;case P:return i=Us(19,u,a,_),i.elementType=P,i.lanes=b,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case N:j=10;break e;case E:j=9;break e;case R:j=11;break e;case z:j=14;break e;case B:j=16,f=null;break e}j=29,u=Error(s(130,i===null?"null":typeof i,"")),f=null}return a=Us(j,u,a,_),a.elementType=i,a.type=f,a.lanes=b,a}function Ro(i,a,u,f){return i=Us(7,i,f,a),i.lanes=u,i}function $p(i,a,u){return i=Us(6,i,null,a),i.lanes=u,i}function Kb(i){var a=Us(18,null,null,0);return a.stateNode=i,a}function Up(i,a,u){return a=Us(4,i.children!==null?i.children:[],i.key,a),a.lanes=u,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var Xb=new WeakMap;function ci(i,a){if(typeof i=="object"&&i!==null){var u=Xb.get(i);return u!==void 0?u:(a={value:i,source:a,stack:ye(a)},Xb.set(i,a),a)}return{value:i,source:a,stack:ye(a)}}var El=[],Rl=0,Kd=null,Hc=0,ui=[],di=0,ya=null,an=1,on="";function In(i,a){El[Rl++]=Hc,El[Rl++]=Kd,Kd=i,Hc=a}function Zb(i,a,u){ui[di++]=an,ui[di++]=on,ui[di++]=ya,ya=i;var f=an;i=on;var _=32-Ht(f)-1;f&=~(1<<_),u+=1;var b=32-Ht(a)+_;if(30<b){var j=_-_%5;b=(f&(1<<j)-1).toString(32),f>>=j,_-=j,an=1<<32-Ht(a)+_|u<<_|f,on=b+i}else an=1<<b|u<<_|f,on=i}function Hp(i){i.return!==null&&(In(i,1),Zb(i,1,0))}function Fp(i){for(;i===Kd;)Kd=El[--Rl],El[Rl]=null,Hc=El[--Rl],El[Rl]=null;for(;i===ya;)ya=ui[--di],ui[di]=null,on=ui[--di],ui[di]=null,an=ui[--di],ui[di]=null}function Qb(i,a){ui[di++]=an,ui[di++]=on,ui[di++]=ya,an=a.id,on=a.overflow,ya=i}var ts=null,qt=null,_t=!1,ba=null,hi=!1,qp=Error(s(519));function wa(i){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fc(ci(a,i)),qp}function Jb(i){var a=i.stateNode,u=i.type,f=i.memoizedProps;switch(a[$t]=i,a[ct]=f,u){case"dialog":ft("cancel",a),ft("close",a);break;case"iframe":case"object":case"embed":ft("load",a);break;case"video":case"audio":for(u=0;u<du.length;u++)ft(du[u],a);break;case"source":ft("error",a);break;case"img":case"image":case"link":ft("error",a),ft("load",a);break;case"details":ft("toggle",a);break;case"input":ft("invalid",a),hb(a,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":ft("invalid",a);break;case"textarea":ft("invalid",a),mb(a,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||f.suppressHydrationWarning===!0||gS(a.textContent,u)?(f.popover!=null&&(ft("beforetoggle",a),ft("toggle",a)),f.onScroll!=null&&ft("scroll",a),f.onScrollEnd!=null&&ft("scrollend",a),f.onClick!=null&&(a.onclick=On),a=!0):a=!1,a||wa(i,!0)}function e1(i){for(ts=i.return;ts;)switch(ts.tag){case 5:case 31:case 13:hi=!1;return;case 27:case 3:hi=!0;return;default:ts=ts.return}}function Nl(i){if(i!==ts)return!1;if(!_t)return e1(i),_t=!0,!1;var a=i.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=i.type,u=!(u!=="form"&&u!=="button")||lv(i.type,i.memoizedProps)),u=!u),u&&qt&&wa(i),e1(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));qt=kS(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));qt=kS(i)}else a===27?(a=qt,Ba(i.type)?(i=fv,fv=null,qt=i):qt=a):qt=ts?mi(i.stateNode.nextSibling):null;return!0}function No(){qt=ts=null,_t=!1}function Wp(){var i=ba;return i!==null&&(Ts===null?Ts=i:Ts.push.apply(Ts,i),ba=null),i}function Fc(i){ba===null?ba=[i]:ba.push(i)}var Vp=D(null),jo=null,zn=null;function Sa(i,a,u){X(Vp,a._currentValue),a._currentValue=u}function $n(i){i._currentValue=Vp.current,V(Vp)}function Gp(i,a,u){for(;i!==null;){var f=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),i===u)break;i=i.return}}function Yp(i,a,u,f){var _=i.child;for(_!==null&&(_.return=i);_!==null;){var b=_.dependencies;if(b!==null){var j=_.child;b=b.firstContext;e:for(;b!==null;){var I=b;b=_;for(var K=0;K<a.length;K++)if(I.context===a[K]){b.lanes|=u,I=b.alternate,I!==null&&(I.lanes|=u),Gp(b.return,u,i),f||(j=null);break e}b=I.next}}else if(_.tag===18){if(j=_.return,j===null)throw Error(s(341));j.lanes|=u,b=j.alternate,b!==null&&(b.lanes|=u),Gp(j,u,i),j=null}else j=_.child;if(j!==null)j.return=_;else for(j=_;j!==null;){if(j===i){j=null;break}if(_=j.sibling,_!==null){_.return=j.return,j=_;break}j=j.return}_=j}}function jl(i,a,u,f){i=null;for(var _=a,b=!1;_!==null;){if(!b){if((_.flags&524288)!==0)b=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var j=_.alternate;if(j===null)throw Error(s(387));if(j=j.memoizedProps,j!==null){var I=_.type;$s(_.pendingProps.value,j.value)||(i!==null?i.push(I):i=[I])}}else if(_===Z.current){if(j=_.alternate,j===null)throw Error(s(387));j.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(i!==null?i.push(gu):i=[gu])}_=_.return}i!==null&&Yp(a,i,u,f),a.flags|=262144}function Xd(i){for(i=i.firstContext;i!==null;){if(!$s(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ao(i){jo=i,zn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function rs(i){return t1(jo,i)}function Zd(i,a){return jo===null&&Ao(i),t1(i,a)}function t1(i,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},zn===null){if(i===null)throw Error(s(308));zn=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else zn=zn.next=a;return u}var q3=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(u,f){i.push(f)}};this.abort=function(){a.aborted=!0,i.forEach(function(u){return u()})}},W3=e.unstable_scheduleCallback,V3=e.unstable_NormalPriority,wr={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kp(){return{controller:new q3,data:new Map,refCount:0}}function qc(i){i.refCount--,i.refCount===0&&W3(V3,function(){i.controller.abort()})}var Wc=null,Xp=0,Al=0,Tl=null;function G3(i,a){if(Wc===null){var u=Wc=[];Xp=0,Al=Jg(),Tl={status:"pending",value:void 0,then:function(f){u.push(f)}}}return Xp++,a.then(r1,r1),a}function r1(){if(--Xp===0&&Wc!==null){Tl!==null&&(Tl.status="fulfilled");var i=Wc;Wc=null,Al=0,Tl=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function Y3(i,a){var u=[],f={status:"pending",value:null,reason:null,then:function(_){u.push(_)}};return i.then(function(){f.status="fulfilled",f.value=a;for(var _=0;_<u.length;_++)(0,u[_])(a)},function(_){for(f.status="rejected",f.reason=_,_=0;_<u.length;_++)(0,u[_])(void 0)}),f}var s1=A.S;A.S=function(i,a){$w=He(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&G3(i,a),s1!==null&&s1(i,a)};var To=D(null);function Zp(){var i=To.current;return i!==null?i:Ut.pooledCache}function Qd(i,a){a===null?X(To,To.current):X(To,a.pool)}function i1(){var i=Zp();return i===null?null:{parent:wr._currentValue,pool:i}}var Ml=Error(s(460)),Qp=Error(s(474)),Jd=Error(s(542)),eh={then:function(){}};function n1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function a1(i,a,u){switch(u=i[u],u===void 0?i.push(a):u!==a&&(a.then(On,On),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,l1(i),i;default:if(typeof a.status=="string")a.then(On,On);else{if(i=Ut,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=a,i.status="pending",i.then(function(f){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=f}},function(f){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,l1(i),i}throw Do=a,Ml}}function Mo(i){try{var a=i._init;return a(i._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Do=u,Ml):u}}var Do=null;function o1(){if(Do===null)throw Error(s(459));var i=Do;return Do=null,i}function l1(i){if(i===Ml||i===Jd)throw Error(s(483))}var Dl=null,Vc=0;function th(i){var a=Vc;return Vc+=1,Dl===null&&(Dl=[]),a1(Dl,i,a)}function Gc(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function rh(i,a){throw a.$$typeof===x?Error(s(525)):(i=Object.prototype.toString.call(a),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function c1(i){function a(ee,Q){if(i){var ne=ee.deletions;ne===null?(ee.deletions=[Q],ee.flags|=16):ne.push(Q)}}function u(ee,Q){if(!i)return null;for(;Q!==null;)a(ee,Q),Q=Q.sibling;return null}function f(ee){for(var Q=new Map;ee!==null;)ee.key!==null?Q.set(ee.key,ee):Q.set(ee.index,ee),ee=ee.sibling;return Q}function _(ee,Q){return ee=Pn(ee,Q),ee.index=0,ee.sibling=null,ee}function b(ee,Q,ne){return ee.index=ne,i?(ne=ee.alternate,ne!==null?(ne=ne.index,ne<Q?(ee.flags|=67108866,Q):ne):(ee.flags|=67108866,Q)):(ee.flags|=1048576,Q)}function j(ee){return i&&ee.alternate===null&&(ee.flags|=67108866),ee}function I(ee,Q,ne,fe){return Q===null||Q.tag!==6?(Q=$p(ne,ee.mode,fe),Q.return=ee,Q):(Q=_(Q,ne),Q.return=ee,Q)}function K(ee,Q,ne,fe){var Ue=ne.type;return Ue===S?he(ee,Q,ne.props.children,fe,ne.key):Q!==null&&(Q.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===B&&Mo(Ue)===Q.type)?(Q=_(Q,ne.props),Gc(Q,ne),Q.return=ee,Q):(Q=Yd(ne.type,ne.key,ne.props,null,ee.mode,fe),Gc(Q,ne),Q.return=ee,Q)}function ae(ee,Q,ne,fe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ne.containerInfo||Q.stateNode.implementation!==ne.implementation?(Q=Up(ne,ee.mode,fe),Q.return=ee,Q):(Q=_(Q,ne.children||[]),Q.return=ee,Q)}function he(ee,Q,ne,fe,Ue){return Q===null||Q.tag!==7?(Q=Ro(ne,ee.mode,fe,Ue),Q.return=ee,Q):(Q=_(Q,ne),Q.return=ee,Q)}function ge(ee,Q,ne){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=$p(""+Q,ee.mode,ne),Q.return=ee,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return ne=Yd(Q.type,Q.key,Q.props,null,ee.mode,ne),Gc(ne,Q),ne.return=ee,ne;case w:return Q=Up(Q,ee.mode,ne),Q.return=ee,Q;case B:return Q=Mo(Q),ge(ee,Q,ne)}if(W(Q)||$(Q))return Q=Ro(Q,ee.mode,ne,null),Q.return=ee,Q;if(typeof Q.then=="function")return ge(ee,th(Q),ne);if(Q.$$typeof===N)return ge(ee,Zd(ee,Q),ne);rh(ee,Q)}return null}function oe(ee,Q,ne,fe){var Ue=Q!==null?Q.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ue!==null?null:I(ee,Q,""+ne,fe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case y:return ne.key===Ue?K(ee,Q,ne,fe):null;case w:return ne.key===Ue?ae(ee,Q,ne,fe):null;case B:return ne=Mo(ne),oe(ee,Q,ne,fe)}if(W(ne)||$(ne))return Ue!==null?null:he(ee,Q,ne,fe,null);if(typeof ne.then=="function")return oe(ee,Q,th(ne),fe);if(ne.$$typeof===N)return oe(ee,Q,Zd(ee,ne),fe);rh(ee,ne)}return null}function ue(ee,Q,ne,fe,Ue){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return ee=ee.get(ne)||null,I(Q,ee,""+fe,Ue);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:return ee=ee.get(fe.key===null?ne:fe.key)||null,K(Q,ee,fe,Ue);case w:return ee=ee.get(fe.key===null?ne:fe.key)||null,ae(Q,ee,fe,Ue);case B:return fe=Mo(fe),ue(ee,Q,ne,fe,Ue)}if(W(fe)||$(fe))return ee=ee.get(ne)||null,he(Q,ee,fe,Ue,null);if(typeof fe.then=="function")return ue(ee,Q,ne,th(fe),Ue);if(fe.$$typeof===N)return ue(ee,Q,ne,Zd(Q,fe),Ue);rh(Q,fe)}return null}function Me(ee,Q,ne,fe){for(var Ue=null,wt=null,Oe=Q,it=Q=0,vt=null;Oe!==null&&it<ne.length;it++){Oe.index>it?(vt=Oe,Oe=null):vt=Oe.sibling;var St=oe(ee,Oe,ne[it],fe);if(St===null){Oe===null&&(Oe=vt);break}i&&Oe&&St.alternate===null&&a(ee,Oe),Q=b(St,Q,it),wt===null?Ue=St:wt.sibling=St,wt=St,Oe=vt}if(it===ne.length)return u(ee,Oe),_t&&In(ee,it),Ue;if(Oe===null){for(;it<ne.length;it++)Oe=ge(ee,ne[it],fe),Oe!==null&&(Q=b(Oe,Q,it),wt===null?Ue=Oe:wt.sibling=Oe,wt=Oe);return _t&&In(ee,it),Ue}for(Oe=f(Oe);it<ne.length;it++)vt=ue(Oe,ee,it,ne[it],fe),vt!==null&&(i&&vt.alternate!==null&&Oe.delete(vt.key===null?it:vt.key),Q=b(vt,Q,it),wt===null?Ue=vt:wt.sibling=vt,wt=vt);return i&&Oe.forEach(function(Ua){return a(ee,Ua)}),_t&&In(ee,it),Ue}function We(ee,Q,ne,fe){if(ne==null)throw Error(s(151));for(var Ue=null,wt=null,Oe=Q,it=Q=0,vt=null,St=ne.next();Oe!==null&&!St.done;it++,St=ne.next()){Oe.index>it?(vt=Oe,Oe=null):vt=Oe.sibling;var Ua=oe(ee,Oe,St.value,fe);if(Ua===null){Oe===null&&(Oe=vt);break}i&&Oe&&Ua.alternate===null&&a(ee,Oe),Q=b(Ua,Q,it),wt===null?Ue=Ua:wt.sibling=Ua,wt=Ua,Oe=vt}if(St.done)return u(ee,Oe),_t&&In(ee,it),Ue;if(Oe===null){for(;!St.done;it++,St=ne.next())St=ge(ee,St.value,fe),St!==null&&(Q=b(St,Q,it),wt===null?Ue=St:wt.sibling=St,wt=St);return _t&&In(ee,it),Ue}for(Oe=f(Oe);!St.done;it++,St=ne.next())St=ue(Oe,ee,it,St.value,fe),St!==null&&(i&&St.alternate!==null&&Oe.delete(St.key===null?it:St.key),Q=b(St,Q,it),wt===null?Ue=St:wt.sibling=St,wt=St);return i&&Oe.forEach(function(nL){return a(ee,nL)}),_t&&In(ee,it),Ue}function Ot(ee,Q,ne,fe){if(typeof ne=="object"&&ne!==null&&ne.type===S&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case y:e:{for(var Ue=ne.key;Q!==null;){if(Q.key===Ue){if(Ue=ne.type,Ue===S){if(Q.tag===7){u(ee,Q.sibling),fe=_(Q,ne.props.children),fe.return=ee,ee=fe;break e}}else if(Q.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===B&&Mo(Ue)===Q.type){u(ee,Q.sibling),fe=_(Q,ne.props),Gc(fe,ne),fe.return=ee,ee=fe;break e}u(ee,Q);break}else a(ee,Q);Q=Q.sibling}ne.type===S?(fe=Ro(ne.props.children,ee.mode,fe,ne.key),fe.return=ee,ee=fe):(fe=Yd(ne.type,ne.key,ne.props,null,ee.mode,fe),Gc(fe,ne),fe.return=ee,ee=fe)}return j(ee);case w:e:{for(Ue=ne.key;Q!==null;){if(Q.key===Ue)if(Q.tag===4&&Q.stateNode.containerInfo===ne.containerInfo&&Q.stateNode.implementation===ne.implementation){u(ee,Q.sibling),fe=_(Q,ne.children||[]),fe.return=ee,ee=fe;break e}else{u(ee,Q);break}else a(ee,Q);Q=Q.sibling}fe=Up(ne,ee.mode,fe),fe.return=ee,ee=fe}return j(ee);case B:return ne=Mo(ne),Ot(ee,Q,ne,fe)}if(W(ne))return Me(ee,Q,ne,fe);if($(ne)){if(Ue=$(ne),typeof Ue!="function")throw Error(s(150));return ne=Ue.call(ne),We(ee,Q,ne,fe)}if(typeof ne.then=="function")return Ot(ee,Q,th(ne),fe);if(ne.$$typeof===N)return Ot(ee,Q,Zd(ee,ne),fe);rh(ee,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Q!==null&&Q.tag===6?(u(ee,Q.sibling),fe=_(Q,ne),fe.return=ee,ee=fe):(u(ee,Q),fe=$p(ne,ee.mode,fe),fe.return=ee,ee=fe),j(ee)):u(ee,Q)}return function(ee,Q,ne,fe){try{Vc=0;var Ue=Ot(ee,Q,ne,fe);return Dl=null,Ue}catch(Oe){if(Oe===Ml||Oe===Jd)throw Oe;var wt=Us(29,Oe,null,ee.mode);return wt.lanes=fe,wt.return=ee,wt}finally{}}}var Lo=c1(!0),u1=c1(!1),Ca=!1;function Jp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eg(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ka(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ea(i,a,u){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(Rt&2)!==0){var _=f.pending;return _===null?a.next=a:(a.next=_.next,_.next=a),f.pending=a,a=Gd(i),Gb(i,null,u),a}return Vd(i,f,a,u),Gd(i)}function Yc(i,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var f=a.lanes;f&=i.pendingLanes,u|=f,a.lanes=u,zt(i,u)}}function tg(i,a){var u=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var _=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var j={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};b===null?_=b=j:b=b.next=j,u=u.next}while(u!==null);b===null?_=b=a:b=b.next=a}else _=b=a;u={baseState:f.baseState,firstBaseUpdate:_,lastBaseUpdate:b,shared:f.shared,callbacks:f.callbacks},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=a:i.next=a,u.lastBaseUpdate=a}var rg=!1;function Kc(){if(rg){var i=Tl;if(i!==null)throw i}}function Xc(i,a,u,f){rg=!1;var _=i.updateQueue;Ca=!1;var b=_.firstBaseUpdate,j=_.lastBaseUpdate,I=_.shared.pending;if(I!==null){_.shared.pending=null;var K=I,ae=K.next;K.next=null,j===null?b=ae:j.next=ae,j=K;var he=i.alternate;he!==null&&(he=he.updateQueue,I=he.lastBaseUpdate,I!==j&&(I===null?he.firstBaseUpdate=ae:I.next=ae,he.lastBaseUpdate=K))}if(b!==null){var ge=_.baseState;j=0,he=ae=K=null,I=b;do{var oe=I.lane&-536870913,ue=oe!==I.lane;if(ue?(gt&oe)===oe:(f&oe)===oe){oe!==0&&oe===Al&&(rg=!0),he!==null&&(he=he.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var Me=i,We=I;oe=a;var Ot=u;switch(We.tag){case 1:if(Me=We.payload,typeof Me=="function"){ge=Me.call(Ot,ge,oe);break e}ge=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=We.payload,oe=typeof Me=="function"?Me.call(Ot,ge,oe):Me,oe==null)break e;ge=g({},ge,oe);break e;case 2:Ca=!0}}oe=I.callback,oe!==null&&(i.flags|=64,ue&&(i.flags|=8192),ue=_.callbacks,ue===null?_.callbacks=[oe]:ue.push(oe))}else ue={lane:oe,tag:I.tag,payload:I.payload,callback:I.callback,next:null},he===null?(ae=he=ue,K=ge):he=he.next=ue,j|=oe;if(I=I.next,I===null){if(I=_.shared.pending,I===null)break;ue=I,I=ue.next,ue.next=null,_.lastBaseUpdate=ue,_.shared.pending=null}}while(!0);he===null&&(K=ge),_.baseState=K,_.firstBaseUpdate=ae,_.lastBaseUpdate=he,b===null&&(_.shared.lanes=0),Ta|=j,i.lanes=j,i.memoizedState=ge}}function d1(i,a){if(typeof i!="function")throw Error(s(191,i));i.call(a)}function h1(i,a){var u=i.callbacks;if(u!==null)for(i.callbacks=null,i=0;i<u.length;i++)d1(u[i],a)}var Ll=D(null),sh=D(0);function f1(i,a){i=Kn,X(sh,i),X(Ll,a),Kn=i|a.baseLanes}function sg(){X(sh,Kn),X(Ll,Ll.current)}function ig(){Kn=sh.current,V(Ll),V(sh)}var Hs=D(null),fi=null;function Ra(i){var a=i.alternate;X(xr,xr.current&1),X(Hs,i),fi===null&&(a===null||Ll.current!==null||a.memoizedState!==null)&&(fi=i)}function ng(i){X(xr,xr.current),X(Hs,i),fi===null&&(fi=i)}function m1(i){i.tag===22?(X(xr,xr.current),X(Hs,i),fi===null&&(fi=i)):Na()}function Na(){X(xr,xr.current),X(Hs,Hs.current)}function Fs(i){V(Hs),fi===i&&(fi=null),V(xr)}var xr=D(0);function ih(i){for(var a=i;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||dv(u)||hv(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Un=0,et=null,Dt=null,Sr=null,nh=!1,Ol=!1,Oo=!1,ah=0,Zc=0,Bl=null,K3=0;function or(){throw Error(s(321))}function ag(i,a){if(a===null)return!1;for(var u=0;u<a.length&&u<i.length;u++)if(!$s(i[u],a[u]))return!1;return!0}function og(i,a,u,f,_,b){return Un=b,et=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,A.H=i===null||i.memoizedState===null?Z1:wg,Oo=!1,b=u(f,_),Oo=!1,Ol&&(b=g1(a,u,f,_)),p1(i),b}function p1(i){A.H=eu;var a=Dt!==null&&Dt.next!==null;if(Un=0,Sr=Dt=et=null,nh=!1,Zc=0,Bl=null,a)throw Error(s(300));i===null||Cr||(i=i.dependencies,i!==null&&Xd(i)&&(Cr=!0))}function g1(i,a,u,f){et=i;var _=0;do{if(Ol&&(Bl=null),Zc=0,Ol=!1,25<=_)throw Error(s(301));if(_+=1,Sr=Dt=null,i.updateQueue!=null){var b=i.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}A.H=Q1,b=a(u,f)}while(Ol);return b}function X3(){var i=A.H,a=i.useState()[0];return a=typeof a.then=="function"?Qc(a):a,i=i.useState()[0],(Dt!==null?Dt.memoizedState:null)!==i&&(et.flags|=1024),a}function lg(){var i=ah!==0;return ah=0,i}function cg(i,a,u){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~u}function ug(i){if(nh){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}nh=!1}Un=0,Sr=Dt=et=null,Ol=!1,Zc=ah=0,Bl=null}function _s(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sr===null?et.memoizedState=Sr=i:Sr=Sr.next=i,Sr}function yr(){if(Dt===null){var i=et.alternate;i=i!==null?i.memoizedState:null}else i=Dt.next;var a=Sr===null?et.memoizedState:Sr.next;if(a!==null)Sr=a,Dt=i;else{if(i===null)throw et.alternate===null?Error(s(467)):Error(s(310));Dt=i,i={memoizedState:Dt.memoizedState,baseState:Dt.baseState,baseQueue:Dt.baseQueue,queue:Dt.queue,next:null},Sr===null?et.memoizedState=Sr=i:Sr=Sr.next=i}return Sr}function oh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qc(i){var a=Zc;return Zc+=1,Bl===null&&(Bl=[]),i=a1(Bl,i,a),a=et,(Sr===null?a.memoizedState:Sr.next)===null&&(a=a.alternate,A.H=a===null||a.memoizedState===null?Z1:wg),i}function lh(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Qc(i);if(i.$$typeof===N)return rs(i)}throw Error(s(438,String(i)))}function dg(i){var a=null,u=et.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var f=et.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(_){return _.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=oh(),et.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(i),f=0;f<i;f++)u[f]=Y;return a.index++,u}function Hn(i,a){return typeof a=="function"?a(i):a}function ch(i){var a=yr();return hg(a,Dt,i)}function hg(i,a,u){var f=i.queue;if(f===null)throw Error(s(311));f.lastRenderedReducer=u;var _=i.baseQueue,b=f.pending;if(b!==null){if(_!==null){var j=_.next;_.next=b.next,b.next=j}a.baseQueue=_=b,f.pending=null}if(b=i.baseState,_===null)i.memoizedState=b;else{a=_.next;var I=j=null,K=null,ae=a,he=!1;do{var ge=ae.lane&-536870913;if(ge!==ae.lane?(gt&ge)===ge:(Un&ge)===ge){var oe=ae.revertLane;if(oe===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),ge===Al&&(he=!0);else if((Un&oe)===oe){ae=ae.next,oe===Al&&(he=!0);continue}else ge={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(I=K=ge,j=b):K=K.next=ge,et.lanes|=oe,Ta|=oe;ge=ae.action,Oo&&u(b,ge),b=ae.hasEagerState?ae.eagerState:u(b,ge)}else oe={lane:ge,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},K===null?(I=K=oe,j=b):K=K.next=oe,et.lanes|=ge,Ta|=ge;ae=ae.next}while(ae!==null&&ae!==a);if(K===null?j=b:K.next=I,!$s(b,i.memoizedState)&&(Cr=!0,he&&(u=Tl,u!==null)))throw u;i.memoizedState=b,i.baseState=j,i.baseQueue=K,f.lastRenderedState=b}return _===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function fg(i){var a=yr(),u=a.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=i;var f=u.dispatch,_=u.pending,b=a.memoizedState;if(_!==null){u.pending=null;var j=_=_.next;do b=i(b,j.action),j=j.next;while(j!==_);$s(b,a.memoizedState)||(Cr=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),u.lastRenderedState=b}return[b,f]}function v1(i,a,u){var f=et,_=yr(),b=_t;if(b){if(u===void 0)throw Error(s(407));u=u()}else u=a();var j=!$s((Dt||_).memoizedState,u);if(j&&(_.memoizedState=u,Cr=!0),_=_.queue,gg(y1.bind(null,f,_,i),[i]),_.getSnapshot!==a||j||Sr!==null&&Sr.memoizedState.tag&1){if(f.flags|=2048,Pl(9,{destroy:void 0},x1.bind(null,f,_,u,a),null),Ut===null)throw Error(s(349));b||(Un&127)!==0||_1(f,a,u)}return u}function _1(i,a,u){i.flags|=16384,i={getSnapshot:a,value:u},a=et.updateQueue,a===null?(a=oh(),et.updateQueue=a,a.stores=[i]):(u=a.stores,u===null?a.stores=[i]:u.push(i))}function x1(i,a,u,f){a.value=u,a.getSnapshot=f,b1(a)&&w1(i)}function y1(i,a,u){return u(function(){b1(a)&&w1(i)})}function b1(i){var a=i.getSnapshot;i=i.value;try{var u=a();return!$s(i,u)}catch{return!0}}function w1(i){var a=Eo(i,2);a!==null&&Ms(a,i,2)}function mg(i){var a=_s();if(typeof i=="function"){var u=i;if(i=u(),Oo){vs(!0);try{u()}finally{vs(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hn,lastRenderedState:i},a}function S1(i,a,u,f){return i.baseState=u,hg(i,Dt,typeof f=="function"?f:Hn)}function Z3(i,a,u,f,_){if(hh(i))throw Error(s(485));if(i=a.action,i!==null){var b={payload:_,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){b.listeners.push(j)}};A.T!==null?u(!0):b.isTransition=!1,f(b),u=a.pending,u===null?(b.next=a.pending=b,C1(a,b)):(b.next=u.next,a.pending=u.next=b)}}function C1(i,a){var u=a.action,f=a.payload,_=i.state;if(a.isTransition){var b=A.T,j={};A.T=j;try{var I=u(_,f),K=A.S;K!==null&&K(j,I),k1(i,a,I)}catch(ae){pg(i,a,ae)}finally{b!==null&&j.types!==null&&(b.types=j.types),A.T=b}}else try{b=u(_,f),k1(i,a,b)}catch(ae){pg(i,a,ae)}}function k1(i,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){E1(i,a,f)},function(f){return pg(i,a,f)}):E1(i,a,u)}function E1(i,a,u){a.status="fulfilled",a.value=u,R1(a),i.state=u,a=i.pending,a!==null&&(u=a.next,u===a?i.pending=null:(u=u.next,a.next=u,C1(i,u)))}function pg(i,a,u){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=u,R1(a),a=a.next;while(a!==f)}i.action=null}function R1(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function N1(i,a){return a}function j1(i,a){if(_t){var u=Ut.formState;if(u!==null){e:{var f=et;if(_t){if(qt){t:{for(var _=qt,b=hi;_.nodeType!==8;){if(!b){_=null;break t}if(_=mi(_.nextSibling),_===null){_=null;break t}}b=_.data,_=b==="F!"||b==="F"?_:null}if(_){qt=mi(_.nextSibling),f=_.data==="F!";break e}}wa(f)}f=!1}f&&(a=u[0])}}return u=_s(),u.memoizedState=u.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:N1,lastRenderedState:a},u.queue=f,u=Y1.bind(null,et,f),f.dispatch=u,f=mg(!1),b=bg.bind(null,et,!1,f.queue),f=_s(),_={state:a,dispatch:null,action:i,pending:null},f.queue=_,u=Z3.bind(null,et,_,b,u),_.dispatch=u,f.memoizedState=i,[a,u,!1]}function A1(i){var a=yr();return T1(a,Dt,i)}function T1(i,a,u){if(a=hg(i,a,N1)[0],i=ch(Hn)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Qc(a)}catch(j){throw j===Ml?Jd:j}else f=a;a=yr();var _=a.queue,b=_.dispatch;return u!==a.memoizedState&&(et.flags|=2048,Pl(9,{destroy:void 0},Q3.bind(null,_,u),null)),[f,b,i]}function Q3(i,a){i.action=a}function M1(i){var a=yr(),u=Dt;if(u!==null)return T1(a,u,i);yr(),a=a.memoizedState,u=yr();var f=u.queue.dispatch;return u.memoizedState=i,[a,f,!1]}function Pl(i,a,u,f){return i={tag:i,create:u,deps:f,inst:a,next:null},a=et.updateQueue,a===null&&(a=oh(),et.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=i.next=i:(f=u.next,u.next=i,i.next=f,a.lastEffect=i),i}function D1(){return yr().memoizedState}function uh(i,a,u,f){var _=_s();et.flags|=i,_.memoizedState=Pl(1|a,{destroy:void 0},u,f===void 0?null:f)}function dh(i,a,u,f){var _=yr();f=f===void 0?null:f;var b=_.memoizedState.inst;Dt!==null&&f!==null&&ag(f,Dt.memoizedState.deps)?_.memoizedState=Pl(a,b,u,f):(et.flags|=i,_.memoizedState=Pl(1|a,b,u,f))}function L1(i,a){uh(8390656,8,i,a)}function gg(i,a){dh(2048,8,i,a)}function J3(i){et.flags|=4;var a=et.updateQueue;if(a===null)a=oh(),et.updateQueue=a,a.events=[i];else{var u=a.events;u===null?a.events=[i]:u.push(i)}}function O1(i){var a=yr().memoizedState;return J3({ref:a,nextImpl:i}),function(){if((Rt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function B1(i,a){return dh(4,2,i,a)}function P1(i,a){return dh(4,4,i,a)}function I1(i,a){if(typeof a=="function"){i=i();var u=a(i);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function z1(i,a,u){u=u!=null?u.concat([i]):null,dh(4,4,I1.bind(null,a,i),u)}function vg(){}function $1(i,a){var u=yr();a=a===void 0?null:a;var f=u.memoizedState;return a!==null&&ag(a,f[1])?f[0]:(u.memoizedState=[i,a],i)}function U1(i,a){var u=yr();a=a===void 0?null:a;var f=u.memoizedState;if(a!==null&&ag(a,f[1]))return f[0];if(f=i(),Oo){vs(!0);try{i()}finally{vs(!1)}}return u.memoizedState=[f,a],f}function _g(i,a,u){return u===void 0||(Un&1073741824)!==0&&(gt&261930)===0?i.memoizedState=a:(i.memoizedState=u,i=Hw(),et.lanes|=i,Ta|=i,u)}function H1(i,a,u,f){return $s(u,a)?u:Ll.current!==null?(i=_g(i,u,f),$s(i,a)||(Cr=!0),i):(Un&42)===0||(Un&1073741824)!==0&&(gt&261930)===0?(Cr=!0,i.memoizedState=u):(i=Hw(),et.lanes|=i,Ta|=i,a)}function F1(i,a,u,f,_){var b=O.p;O.p=b!==0&&8>b?b:8;var j=A.T,I={};A.T=I,bg(i,!1,a,u);try{var K=_(),ae=A.S;if(ae!==null&&ae(I,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var he=Y3(K,f);Jc(i,a,he,Vs(i))}else Jc(i,a,f,Vs(i))}catch(ge){Jc(i,a,{then:function(){},status:"rejected",reason:ge},Vs())}finally{O.p=b,j!==null&&I.types!==null&&(j.types=I.types),A.T=j}}function eD(){}function xg(i,a,u,f){if(i.tag!==5)throw Error(s(476));var _=q1(i).queue;F1(i,_,a,L,u===null?eD:function(){return W1(i),u(f)})}function q1(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hn,lastRenderedState:L},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hn,lastRenderedState:u},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function W1(i){var a=q1(i);a.next===null&&(a=i.alternate.memoizedState),Jc(i,a.next.queue,{},Vs())}function yg(){return rs(gu)}function V1(){return yr().memoizedState}function G1(){return yr().memoizedState}function tD(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var u=Vs();i=ka(u);var f=Ea(a,i,u);f!==null&&(Ms(f,a,u),Yc(f,a,u)),a={cache:Kp()},i.payload=a;return}a=a.return}}function rD(i,a,u){var f=Vs();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},hh(i)?K1(a,u):(u=Ip(i,a,u,f),u!==null&&(Ms(u,i,f),X1(u,a,f)))}function Y1(i,a,u){var f=Vs();Jc(i,a,u,f)}function Jc(i,a,u,f){var _={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(hh(i))K1(a,_);else{var b=i.alternate;if(i.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var j=a.lastRenderedState,I=b(j,u);if(_.hasEagerState=!0,_.eagerState=I,$s(I,j))return Vd(i,a,_,0),Ut===null&&Wd(),!1}catch{}finally{}if(u=Ip(i,a,_,f),u!==null)return Ms(u,i,f),X1(u,a,f),!0}return!1}function bg(i,a,u,f){if(f={lane:2,revertLane:Jg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},hh(i)){if(a)throw Error(s(479))}else a=Ip(i,u,f,2),a!==null&&Ms(a,i,2)}function hh(i){var a=i.alternate;return i===et||a!==null&&a===et}function K1(i,a){Ol=nh=!0;var u=i.pending;u===null?a.next=a:(a.next=u.next,u.next=a),i.pending=a}function X1(i,a,u){if((u&4194048)!==0){var f=a.lanes;f&=i.pendingLanes,u|=f,a.lanes=u,zt(i,u)}}var eu={readContext:rs,use:lh,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useLayoutEffect:or,useInsertionEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useSyncExternalStore:or,useId:or,useHostTransitionStatus:or,useFormState:or,useActionState:or,useOptimistic:or,useMemoCache:or,useCacheRefresh:or};eu.useEffectEvent=or;var Z1={readContext:rs,use:lh,useCallback:function(i,a){return _s().memoizedState=[i,a===void 0?null:a],i},useContext:rs,useEffect:L1,useImperativeHandle:function(i,a,u){u=u!=null?u.concat([i]):null,uh(4194308,4,I1.bind(null,a,i),u)},useLayoutEffect:function(i,a){return uh(4194308,4,i,a)},useInsertionEffect:function(i,a){uh(4,2,i,a)},useMemo:function(i,a){var u=_s();a=a===void 0?null:a;var f=i();if(Oo){vs(!0);try{i()}finally{vs(!1)}}return u.memoizedState=[f,a],f},useReducer:function(i,a,u){var f=_s();if(u!==void 0){var _=u(a);if(Oo){vs(!0);try{u(a)}finally{vs(!1)}}}else _=a;return f.memoizedState=f.baseState=_,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:_},f.queue=i,i=i.dispatch=rD.bind(null,et,i),[f.memoizedState,i]},useRef:function(i){var a=_s();return i={current:i},a.memoizedState=i},useState:function(i){i=mg(i);var a=i.queue,u=Y1.bind(null,et,a);return a.dispatch=u,[i.memoizedState,u]},useDebugValue:vg,useDeferredValue:function(i,a){var u=_s();return _g(u,i,a)},useTransition:function(){var i=mg(!1);return i=F1.bind(null,et,i.queue,!0,!1),_s().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,u){var f=et,_=_s();if(_t){if(u===void 0)throw Error(s(407));u=u()}else{if(u=a(),Ut===null)throw Error(s(349));(gt&127)!==0||_1(f,a,u)}_.memoizedState=u;var b={value:u,getSnapshot:a};return _.queue=b,L1(y1.bind(null,f,b,i),[i]),f.flags|=2048,Pl(9,{destroy:void 0},x1.bind(null,f,b,u,a),null),u},useId:function(){var i=_s(),a=Ut.identifierPrefix;if(_t){var u=on,f=an;u=(f&~(1<<32-Ht(f)-1)).toString(32)+u,a="_"+a+"R_"+u,u=ah++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=K3++,a="_"+a+"r_"+u.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:yg,useFormState:j1,useActionState:j1,useOptimistic:function(i){var a=_s();a.memoizedState=a.baseState=i;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=bg.bind(null,et,!0,u),u.dispatch=a,[i,a]},useMemoCache:dg,useCacheRefresh:function(){return _s().memoizedState=tD.bind(null,et)},useEffectEvent:function(i){var a=_s(),u={impl:i};return a.memoizedState=u,function(){if((Rt&2)!==0)throw Error(s(440));return u.impl.apply(void 0,arguments)}}},wg={readContext:rs,use:lh,useCallback:$1,useContext:rs,useEffect:gg,useImperativeHandle:z1,useInsertionEffect:B1,useLayoutEffect:P1,useMemo:U1,useReducer:ch,useRef:D1,useState:function(){return ch(Hn)},useDebugValue:vg,useDeferredValue:function(i,a){var u=yr();return H1(u,Dt.memoizedState,i,a)},useTransition:function(){var i=ch(Hn)[0],a=yr().memoizedState;return[typeof i=="boolean"?i:Qc(i),a]},useSyncExternalStore:v1,useId:V1,useHostTransitionStatus:yg,useFormState:A1,useActionState:A1,useOptimistic:function(i,a){var u=yr();return S1(u,Dt,i,a)},useMemoCache:dg,useCacheRefresh:G1};wg.useEffectEvent=O1;var Q1={readContext:rs,use:lh,useCallback:$1,useContext:rs,useEffect:gg,useImperativeHandle:z1,useInsertionEffect:B1,useLayoutEffect:P1,useMemo:U1,useReducer:fg,useRef:D1,useState:function(){return fg(Hn)},useDebugValue:vg,useDeferredValue:function(i,a){var u=yr();return Dt===null?_g(u,i,a):H1(u,Dt.memoizedState,i,a)},useTransition:function(){var i=fg(Hn)[0],a=yr().memoizedState;return[typeof i=="boolean"?i:Qc(i),a]},useSyncExternalStore:v1,useId:V1,useHostTransitionStatus:yg,useFormState:M1,useActionState:M1,useOptimistic:function(i,a){var u=yr();return Dt!==null?S1(u,Dt,i,a):(u.baseState=i,[i,u.queue.dispatch])},useMemoCache:dg,useCacheRefresh:G1};Q1.useEffectEvent=O1;function Sg(i,a,u,f){a=i.memoizedState,u=u(f,a),u=u==null?a:g({},a,u),i.memoizedState=u,i.lanes===0&&(i.updateQueue.baseState=u)}var Cg={enqueueSetState:function(i,a,u){i=i._reactInternals;var f=Vs(),_=ka(f);_.payload=a,u!=null&&(_.callback=u),a=Ea(i,_,f),a!==null&&(Ms(a,i,f),Yc(a,i,f))},enqueueReplaceState:function(i,a,u){i=i._reactInternals;var f=Vs(),_=ka(f);_.tag=1,_.payload=a,u!=null&&(_.callback=u),a=Ea(i,_,f),a!==null&&(Ms(a,i,f),Yc(a,i,f))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var u=Vs(),f=ka(u);f.tag=2,a!=null&&(f.callback=a),a=Ea(i,f,u),a!==null&&(Ms(a,i,u),Yc(a,i,u))}};function J1(i,a,u,f,_,b,j){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,b,j):a.prototype&&a.prototype.isPureReactComponent?!$c(u,f)||!$c(_,b):!0}function ew(i,a,u,f){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,f),a.state!==i&&Cg.enqueueReplaceState(a,a.state,null)}function Bo(i,a){var u=a;if("ref"in a){u={};for(var f in a)f!=="ref"&&(u[f]=a[f])}if(i=i.defaultProps){u===a&&(u=g({},u));for(var _ in i)u[_]===void 0&&(u[_]=i[_])}return u}function tw(i){qd(i)}function rw(i){console.error(i)}function sw(i){qd(i)}function fh(i,a){try{var u=i.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function iw(i,a,u){try{var f=i.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function kg(i,a,u){return u=ka(u),u.tag=3,u.payload={element:null},u.callback=function(){fh(i,a)},u}function nw(i){return i=ka(i),i.tag=3,i}function aw(i,a,u,f){var _=u.type.getDerivedStateFromError;if(typeof _=="function"){var b=f.value;i.payload=function(){return _(b)},i.callback=function(){iw(a,u,f)}}var j=u.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(i.callback=function(){iw(a,u,f),typeof _!="function"&&(Ma===null?Ma=new Set([this]):Ma.add(this));var I=f.stack;this.componentDidCatch(f.value,{componentStack:I!==null?I:""})})}function sD(i,a,u,f,_){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=u.alternate,a!==null&&jl(a,u,_,!0),u=Hs.current,u!==null){switch(u.tag){case 31:case 13:return fi===null?kh():u.alternate===null&&lr===0&&(lr=3),u.flags&=-257,u.flags|=65536,u.lanes=_,f===eh?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([f]):a.add(f),Xg(i,f,_)),!1;case 22:return u.flags|=65536,f===eh?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([f]):u.add(f)),Xg(i,f,_)),!1}throw Error(s(435,u.tag))}return Xg(i,f,_),kh(),!1}if(_t)return a=Hs.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,f!==qp&&(i=Error(s(422),{cause:f}),Fc(ci(i,u)))):(f!==qp&&(a=Error(s(423),{cause:f}),Fc(ci(a,u))),i=i.current.alternate,i.flags|=65536,_&=-_,i.lanes|=_,f=ci(f,u),_=kg(i.stateNode,f,_),tg(i,_),lr!==4&&(lr=2)),!1;var b=Error(s(520),{cause:f});if(b=ci(b,u),lu===null?lu=[b]:lu.push(b),lr!==4&&(lr=2),a===null)return!0;f=ci(f,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,i=_&-_,u.lanes|=i,i=kg(u.stateNode,f,i),tg(u,i),!1;case 1:if(a=u.type,b=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Ma===null||!Ma.has(b))))return u.flags|=65536,_&=-_,u.lanes|=_,_=nw(_),aw(_,i,u,f),tg(u,_),!1}u=u.return}while(u!==null);return!1}var Eg=Error(s(461)),Cr=!1;function ss(i,a,u,f){a.child=i===null?u1(a,null,u,f):Lo(a,i.child,u,f)}function ow(i,a,u,f,_){u=u.render;var b=a.ref;if("ref"in f){var j={};for(var I in f)I!=="ref"&&(j[I]=f[I])}else j=f;return Ao(a),f=og(i,a,u,j,b,_),I=lg(),i!==null&&!Cr?(cg(i,a,_),Fn(i,a,_)):(_t&&I&&Hp(a),a.flags|=1,ss(i,a,f,_),a.child)}function lw(i,a,u,f,_){if(i===null){var b=u.type;return typeof b=="function"&&!zp(b)&&b.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=b,cw(i,a,b,f,_)):(i=Yd(u.type,null,f,a,a.mode,_),i.ref=a.ref,i.return=a,a.child=i)}if(b=i.child,!Lg(i,_)){var j=b.memoizedProps;if(u=u.compare,u=u!==null?u:$c,u(j,f)&&i.ref===a.ref)return Fn(i,a,_)}return a.flags|=1,i=Pn(b,f),i.ref=a.ref,i.return=a,a.child=i}function cw(i,a,u,f,_){if(i!==null){var b=i.memoizedProps;if($c(b,f)&&i.ref===a.ref)if(Cr=!1,a.pendingProps=f=b,Lg(i,_))(i.flags&131072)!==0&&(Cr=!0);else return a.lanes=i.lanes,Fn(i,a,_)}return Rg(i,a,u,f,_)}function uw(i,a,u,f){var _=f.children,b=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|u:u,i!==null){for(f=a.child=i.child,_=0;f!==null;)_=_|f.lanes|f.childLanes,f=f.sibling;f=_&~b}else f=0,a.child=null;return dw(i,a,b,u,f)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&Qd(a,b!==null?b.cachePool:null),b!==null?f1(a,b):sg(),m1(a);else return f=a.lanes=536870912,dw(i,a,b!==null?b.baseLanes|u:u,u,f)}else b!==null?(Qd(a,b.cachePool),f1(a,b),Na(),a.memoizedState=null):(i!==null&&Qd(a,null),sg(),Na());return ss(i,a,_,u),a.child}function tu(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function dw(i,a,u,f,_){var b=Zp();return b=b===null?null:{parent:wr._currentValue,pool:b},a.memoizedState={baseLanes:u,cachePool:b},i!==null&&Qd(a,null),sg(),m1(a),i!==null&&jl(i,a,f,!0),a.childLanes=_,null}function mh(i,a){return a=gh({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function hw(i,a,u){return Lo(a,i.child,null,u),i=mh(a,a.pendingProps),i.flags|=2,Fs(a),a.memoizedState=null,i}function iD(i,a,u){var f=a.pendingProps,_=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(_t){if(f.mode==="hidden")return i=mh(a,f),a.lanes=536870912,tu(null,i);if(ng(a),(i=qt)?(i=CS(i,hi),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:ya!==null?{id:an,overflow:on}:null,retryLane:536870912,hydrationErrors:null},u=Kb(i),u.return=a,a.child=u,ts=a,qt=null)):i=null,i===null)throw wa(a);return a.lanes=536870912,null}return mh(a,f)}var b=i.memoizedState;if(b!==null){var j=b.dehydrated;if(ng(a),_)if(a.flags&256)a.flags&=-257,a=hw(i,a,u);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(s(558));else if(Cr||jl(i,a,u,!1),_=(u&i.childLanes)!==0,Cr||_){if(f=Ut,f!==null&&(j=nr(f,u),j!==0&&j!==b.retryLane))throw b.retryLane=j,Eo(i,j),Ms(f,i,j),Eg;kh(),a=hw(i,a,u)}else i=b.treeContext,qt=mi(j.nextSibling),ts=a,_t=!0,ba=null,hi=!1,i!==null&&Qb(a,i),a=mh(a,f),a.flags|=4096;return a}return i=Pn(i.child,{mode:f.mode,children:f.children}),i.ref=a.ref,a.child=i,i.return=a,i}function ph(i,a){var u=a.ref;if(u===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(s(284));(i===null||i.ref!==u)&&(a.flags|=4194816)}}function Rg(i,a,u,f,_){return Ao(a),u=og(i,a,u,f,void 0,_),f=lg(),i!==null&&!Cr?(cg(i,a,_),Fn(i,a,_)):(_t&&f&&Hp(a),a.flags|=1,ss(i,a,u,_),a.child)}function fw(i,a,u,f,_,b){return Ao(a),a.updateQueue=null,u=g1(a,f,u,_),p1(i),f=lg(),i!==null&&!Cr?(cg(i,a,b),Fn(i,a,b)):(_t&&f&&Hp(a),a.flags|=1,ss(i,a,u,b),a.child)}function mw(i,a,u,f,_){if(Ao(a),a.stateNode===null){var b=kl,j=u.contextType;typeof j=="object"&&j!==null&&(b=rs(j)),b=new u(f,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=Cg,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=f,b.state=a.memoizedState,b.refs={},Jp(a),j=u.contextType,b.context=typeof j=="object"&&j!==null?rs(j):kl,b.state=a.memoizedState,j=u.getDerivedStateFromProps,typeof j=="function"&&(Sg(a,u,j,f),b.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(j=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),j!==b.state&&Cg.enqueueReplaceState(b,b.state,null),Xc(a,f,b,_),Kc(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(i===null){b=a.stateNode;var I=a.memoizedProps,K=Bo(u,I);b.props=K;var ae=b.context,he=u.contextType;j=kl,typeof he=="object"&&he!==null&&(j=rs(he));var ge=u.getDerivedStateFromProps;he=typeof ge=="function"||typeof b.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,he||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(I||ae!==j)&&ew(a,b,f,j),Ca=!1;var oe=a.memoizedState;b.state=oe,Xc(a,f,b,_),Kc(),ae=a.memoizedState,I||oe!==ae||Ca?(typeof ge=="function"&&(Sg(a,u,ge,f),ae=a.memoizedState),(K=Ca||J1(a,u,K,f,oe,ae,j))?(he||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=ae),b.props=f,b.state=ae,b.context=j,f=K):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{b=a.stateNode,eg(i,a),j=a.memoizedProps,he=Bo(u,j),b.props=he,ge=a.pendingProps,oe=b.context,ae=u.contextType,K=kl,typeof ae=="object"&&ae!==null&&(K=rs(ae)),I=u.getDerivedStateFromProps,(ae=typeof I=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(j!==ge||oe!==K)&&ew(a,b,f,K),Ca=!1,oe=a.memoizedState,b.state=oe,Xc(a,f,b,_),Kc();var ue=a.memoizedState;j!==ge||oe!==ue||Ca||i!==null&&i.dependencies!==null&&Xd(i.dependencies)?(typeof I=="function"&&(Sg(a,u,I,f),ue=a.memoizedState),(he=Ca||J1(a,u,he,f,oe,ue,K)||i!==null&&i.dependencies!==null&&Xd(i.dependencies))?(ae||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(f,ue,K),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(f,ue,K)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=ue),b.props=f,b.state=ue,b.context=K,f=he):(typeof b.componentDidUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),f=!1)}return b=f,ph(i,a),f=(a.flags&128)!==0,b||f?(b=a.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,i!==null&&f?(a.child=Lo(a,i.child,null,_),a.child=Lo(a,null,u,_)):ss(i,a,u,_),a.memoizedState=b.state,i=a.child):i=Fn(i,a,_),i}function pw(i,a,u,f){return No(),a.flags|=256,ss(i,a,u,f),a.child}var Ng={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jg(i){return{baseLanes:i,cachePool:i1()}}function Ag(i,a,u){return i=i!==null?i.childLanes&~u:0,a&&(i|=Ws),i}function gw(i,a,u){var f=a.pendingProps,_=!1,b=(a.flags&128)!==0,j;if((j=b)||(j=i!==null&&i.memoizedState===null?!1:(xr.current&2)!==0),j&&(_=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,i===null){if(_t){if(_?Ra(a):Na(),(i=qt)?(i=CS(i,hi),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:ya!==null?{id:an,overflow:on}:null,retryLane:536870912,hydrationErrors:null},u=Kb(i),u.return=a,a.child=u,ts=a,qt=null)):i=null,i===null)throw wa(a);return hv(i)?a.lanes=32:a.lanes=536870912,null}var I=f.children;return f=f.fallback,_?(Na(),_=a.mode,I=gh({mode:"hidden",children:I},_),f=Ro(f,_,u,null),I.return=a,f.return=a,I.sibling=f,a.child=I,f=a.child,f.memoizedState=jg(u),f.childLanes=Ag(i,j,u),a.memoizedState=Ng,tu(null,f)):(Ra(a),Tg(a,I))}var K=i.memoizedState;if(K!==null&&(I=K.dehydrated,I!==null)){if(b)a.flags&256?(Ra(a),a.flags&=-257,a=Mg(i,a,u)):a.memoizedState!==null?(Na(),a.child=i.child,a.flags|=128,a=null):(Na(),I=f.fallback,_=a.mode,f=gh({mode:"visible",children:f.children},_),I=Ro(I,_,u,null),I.flags|=2,f.return=a,I.return=a,f.sibling=I,a.child=f,Lo(a,i.child,null,u),f=a.child,f.memoizedState=jg(u),f.childLanes=Ag(i,j,u),a.memoizedState=Ng,a=tu(null,f));else if(Ra(a),hv(I)){if(j=I.nextSibling&&I.nextSibling.dataset,j)var ae=j.dgst;j=ae,f=Error(s(419)),f.stack="",f.digest=j,Fc({value:f,source:null,stack:null}),a=Mg(i,a,u)}else if(Cr||jl(i,a,u,!1),j=(u&i.childLanes)!==0,Cr||j){if(j=Ut,j!==null&&(f=nr(j,u),f!==0&&f!==K.retryLane))throw K.retryLane=f,Eo(i,f),Ms(j,i,f),Eg;dv(I)||kh(),a=Mg(i,a,u)}else dv(I)?(a.flags|=192,a.child=i.child,a=null):(i=K.treeContext,qt=mi(I.nextSibling),ts=a,_t=!0,ba=null,hi=!1,i!==null&&Qb(a,i),a=Tg(a,f.children),a.flags|=4096);return a}return _?(Na(),I=f.fallback,_=a.mode,K=i.child,ae=K.sibling,f=Pn(K,{mode:"hidden",children:f.children}),f.subtreeFlags=K.subtreeFlags&65011712,ae!==null?I=Pn(ae,I):(I=Ro(I,_,u,null),I.flags|=2),I.return=a,f.return=a,f.sibling=I,a.child=f,tu(null,f),f=a.child,I=i.child.memoizedState,I===null?I=jg(u):(_=I.cachePool,_!==null?(K=wr._currentValue,_=_.parent!==K?{parent:K,pool:K}:_):_=i1(),I={baseLanes:I.baseLanes|u,cachePool:_}),f.memoizedState=I,f.childLanes=Ag(i,j,u),a.memoizedState=Ng,tu(i.child,f)):(Ra(a),u=i.child,i=u.sibling,u=Pn(u,{mode:"visible",children:f.children}),u.return=a,u.sibling=null,i!==null&&(j=a.deletions,j===null?(a.deletions=[i],a.flags|=16):j.push(i)),a.child=u,a.memoizedState=null,u)}function Tg(i,a){return a=gh({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function gh(i,a){return i=Us(22,i,null,a),i.lanes=0,i}function Mg(i,a,u){return Lo(a,i.child,null,u),i=Tg(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function vw(i,a,u){i.lanes|=a;var f=i.alternate;f!==null&&(f.lanes|=a),Gp(i.return,a,u)}function Dg(i,a,u,f,_,b){var j=i.memoizedState;j===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:_,treeForkCount:b}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=f,j.tail=u,j.tailMode=_,j.treeForkCount=b)}function _w(i,a,u){var f=a.pendingProps,_=f.revealOrder,b=f.tail;f=f.children;var j=xr.current,I=(j&2)!==0;if(I?(j=j&1|2,a.flags|=128):j&=1,X(xr,j),ss(i,a,f,u),f=_t?Hc:0,!I&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&vw(i,u,a);else if(i.tag===19)vw(i,u,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(_){case"forwards":for(u=a.child,_=null;u!==null;)i=u.alternate,i!==null&&ih(i)===null&&(_=u),u=u.sibling;u=_,u===null?(_=a.child,a.child=null):(_=u.sibling,u.sibling=null),Dg(a,!1,_,u,b,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,_=a.child,a.child=null;_!==null;){if(i=_.alternate,i!==null&&ih(i)===null){a.child=_;break}i=_.sibling,_.sibling=u,u=_,_=i}Dg(a,!0,u,null,b,f);break;case"together":Dg(a,!1,null,null,void 0,f);break;default:a.memoizedState=null}return a.child}function Fn(i,a,u){if(i!==null&&(a.dependencies=i.dependencies),Ta|=a.lanes,(u&a.childLanes)===0)if(i!==null){if(jl(i,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(s(153));if(a.child!==null){for(i=a.child,u=Pn(i,i.pendingProps),a.child=u,u.return=a;i.sibling!==null;)i=i.sibling,u=u.sibling=Pn(i,i.pendingProps),u.return=a;u.sibling=null}return a.child}function Lg(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&Xd(i)))}function nD(i,a,u){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Sa(a,wr,i.memoizedState.cache),No();break;case 27:case 5:we(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:Sa(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,ng(a),null;break;case 13:var f=a.memoizedState;if(f!==null)return f.dehydrated!==null?(Ra(a),a.flags|=128,null):(u&a.child.childLanes)!==0?gw(i,a,u):(Ra(a),i=Fn(i,a,u),i!==null?i.sibling:null);Ra(a);break;case 19:var _=(i.flags&128)!==0;if(f=(u&a.childLanes)!==0,f||(jl(i,a,u,!1),f=(u&a.childLanes)!==0),_){if(f)return _w(i,a,u);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),X(xr,xr.current),f)break;return null;case 22:return a.lanes=0,uw(i,a,u,a.pendingProps);case 24:Sa(a,wr,i.memoizedState.cache)}return Fn(i,a,u)}function xw(i,a,u){if(i!==null)if(i.memoizedProps!==a.pendingProps)Cr=!0;else{if(!Lg(i,u)&&(a.flags&128)===0)return Cr=!1,nD(i,a,u);Cr=(i.flags&131072)!==0}else Cr=!1,_t&&(a.flags&1048576)!==0&&Zb(a,Hc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(i=Mo(a.elementType),a.type=i,typeof i=="function")zp(i)?(f=Bo(i,f),a.tag=1,a=mw(null,a,i,f,u)):(a.tag=0,a=Rg(null,a,i,f,u));else{if(i!=null){var _=i.$$typeof;if(_===R){a.tag=11,a=ow(null,a,i,f,u);break e}else if(_===z){a.tag=14,a=lw(null,a,i,f,u);break e}}throw a=U(i)||i,Error(s(306,a,""))}}return a;case 0:return Rg(i,a,a.type,a.pendingProps,u);case 1:return f=a.type,_=Bo(f,a.pendingProps),mw(i,a,f,_,u);case 3:e:{if(ce(a,a.stateNode.containerInfo),i===null)throw Error(s(387));f=a.pendingProps;var b=a.memoizedState;_=b.element,eg(i,a),Xc(a,f,null,u);var j=a.memoizedState;if(f=j.cache,Sa(a,wr,f),f!==b.cache&&Yp(a,[wr],u,!0),Kc(),f=j.element,b.isDehydrated)if(b={element:f,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=pw(i,a,f,u);break e}else if(f!==_){_=ci(Error(s(424)),a),Fc(_),a=pw(i,a,f,u);break e}else{switch(i=a.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(qt=mi(i.firstChild),ts=a,_t=!0,ba=null,hi=!0,u=u1(a,null,f,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(No(),f===_){a=Fn(i,a,u);break e}ss(i,a,f,u)}a=a.child}return a;case 26:return ph(i,a),i===null?(u=AS(a.type,null,a.pendingProps,null))?a.memoizedState=u:_t||(u=a.type,i=a.pendingProps,f=Mh(de.current).createElement(u),f[$t]=a,f[ct]=i,is(f,u,i),$r(f),a.stateNode=f):a.memoizedState=AS(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return we(a),i===null&&_t&&(f=a.stateNode=RS(a.type,a.pendingProps,de.current),ts=a,hi=!0,_=qt,Ba(a.type)?(fv=_,qt=mi(f.firstChild)):qt=_),ss(i,a,a.pendingProps.children,u),ph(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&_t&&((_=f=qt)&&(f=OD(f,a.type,a.pendingProps,hi),f!==null?(a.stateNode=f,ts=a,qt=mi(f.firstChild),hi=!1,_=!0):_=!1),_||wa(a)),we(a),_=a.type,b=a.pendingProps,j=i!==null?i.memoizedProps:null,f=b.children,lv(_,b)?f=null:j!==null&&lv(_,j)&&(a.flags|=32),a.memoizedState!==null&&(_=og(i,a,X3,null,null,u),gu._currentValue=_),ph(i,a),ss(i,a,f,u),a.child;case 6:return i===null&&_t&&((i=u=qt)&&(u=BD(u,a.pendingProps,hi),u!==null?(a.stateNode=u,ts=a,qt=null,i=!0):i=!1),i||wa(a)),null;case 13:return gw(i,a,u);case 4:return ce(a,a.stateNode.containerInfo),f=a.pendingProps,i===null?a.child=Lo(a,null,f,u):ss(i,a,f,u),a.child;case 11:return ow(i,a,a.type,a.pendingProps,u);case 7:return ss(i,a,a.pendingProps,u),a.child;case 8:return ss(i,a,a.pendingProps.children,u),a.child;case 12:return ss(i,a,a.pendingProps.children,u),a.child;case 10:return f=a.pendingProps,Sa(a,a.type,f.value),ss(i,a,f.children,u),a.child;case 9:return _=a.type._context,f=a.pendingProps.children,Ao(a),_=rs(_),f=f(_),a.flags|=1,ss(i,a,f,u),a.child;case 14:return lw(i,a,a.type,a.pendingProps,u);case 15:return cw(i,a,a.type,a.pendingProps,u);case 19:return _w(i,a,u);case 31:return iD(i,a,u);case 22:return uw(i,a,u,a.pendingProps);case 24:return Ao(a),f=rs(wr),i===null?(_=Zp(),_===null&&(_=Ut,b=Kp(),_.pooledCache=b,b.refCount++,b!==null&&(_.pooledCacheLanes|=u),_=b),a.memoizedState={parent:f,cache:_},Jp(a),Sa(a,wr,_)):((i.lanes&u)!==0&&(eg(i,a),Xc(a,null,null,u),Kc()),_=i.memoizedState,b=a.memoizedState,_.parent!==f?(_={parent:f,cache:f},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),Sa(a,wr,f)):(f=b.cache,Sa(a,wr,f),f!==_.cache&&Yp(a,[wr],u,!0))),ss(i,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function qn(i){i.flags|=4}function Og(i,a,u,f,_){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(_&335544128)===_)if(i.stateNode.complete)i.flags|=8192;else if(Vw())i.flags|=8192;else throw Do=eh,Qp}else i.flags&=-16777217}function yw(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!OS(a))if(Vw())i.flags|=8192;else throw Do=eh,Qp}function vh(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?Qt():536870912,i.lanes|=a,Ul|=a)}function ru(i,a){if(!_t)switch(i.tailMode){case"hidden":a=i.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?i.tail=null:u.sibling=null;break;case"collapsed":u=i.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Wt(i){var a=i.alternate!==null&&i.alternate.child===i.child,u=0,f=0;if(a)for(var _=i.child;_!==null;)u|=_.lanes|_.childLanes,f|=_.subtreeFlags&65011712,f|=_.flags&65011712,_.return=i,_=_.sibling;else for(_=i.child;_!==null;)u|=_.lanes|_.childLanes,f|=_.subtreeFlags,f|=_.flags,_.return=i,_=_.sibling;return i.subtreeFlags|=f,i.childLanes=u,a}function aD(i,a,u){var f=a.pendingProps;switch(Fp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(a),null;case 1:return Wt(a),null;case 3:return u=a.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),$n(wr),le(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(i===null||i.child===null)&&(Nl(a)?qn(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Wp())),Wt(a),null;case 26:var _=a.type,b=a.memoizedState;return i===null?(qn(a),b!==null?(Wt(a),yw(a,b)):(Wt(a),Og(a,_,null,f,u))):b?b!==i.memoizedState?(qn(a),Wt(a),yw(a,b)):(Wt(a),a.flags&=-16777217):(i=i.memoizedProps,i!==f&&qn(a),Wt(a),Og(a,_,i,f,u)),null;case 27:if(Ee(a),u=de.current,_=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&qn(a);else{if(!f){if(a.stateNode===null)throw Error(s(166));return Wt(a),null}i=J.current,Nl(a)?Jb(a):(i=RS(_,f,u),a.stateNode=i,qn(a))}return Wt(a),null;case 5:if(Ee(a),_=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==f&&qn(a);else{if(!f){if(a.stateNode===null)throw Error(s(166));return Wt(a),null}if(b=J.current,Nl(a))Jb(a);else{var j=Mh(de.current);switch(b){case 1:b=j.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:b=j.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":b=j.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":b=j.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":b=j.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof f.is=="string"?j.createElement("select",{is:f.is}):j.createElement("select"),f.multiple?b.multiple=!0:f.size&&(b.size=f.size);break;default:b=typeof f.is=="string"?j.createElement(_,{is:f.is}):j.createElement(_)}}b[$t]=a,b[ct]=f;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)b.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=b;e:switch(is(b,_,f),_){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&qn(a)}}return Wt(a),Og(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,u),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==f&&qn(a);else{if(typeof f!="string"&&a.stateNode===null)throw Error(s(166));if(i=de.current,Nl(a)){if(i=a.stateNode,u=a.memoizedProps,f=null,_=ts,_!==null)switch(_.tag){case 27:case 5:f=_.memoizedProps}i[$t]=a,i=!!(i.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||gS(i.nodeValue,u)),i||wa(a,!0)}else i=Mh(i).createTextNode(f),i[$t]=a,a.stateNode=i}return Wt(a),null;case 31:if(u=a.memoizedState,i===null||i.memoizedState!==null){if(f=Nl(a),u!==null){if(i===null){if(!f)throw Error(s(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(557));i[$t]=a}else No(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Wt(a),i=!1}else u=Wp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),i=!0;if(!i)return a.flags&256?(Fs(a),a):(Fs(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Wt(a),null;case 13:if(f=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(_=Nl(a),f!==null&&f.dehydrated!==null){if(i===null){if(!_)throw Error(s(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(s(317));_[$t]=a}else No(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Wt(a),_=!1}else _=Wp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(Fs(a),a):(Fs(a),null)}return Fs(a),(a.flags&128)!==0?(a.lanes=u,a):(u=f!==null,i=i!==null&&i.memoizedState!==null,u&&(f=a.child,_=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(_=f.alternate.memoizedState.cachePool.pool),b=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(b=f.memoizedState.cachePool.pool),b!==_&&(f.flags|=2048)),u!==i&&u&&(a.child.flags|=8192),vh(a,a.updateQueue),Wt(a),null);case 4:return le(),i===null&&sv(a.stateNode.containerInfo),Wt(a),null;case 10:return $n(a.type),Wt(a),null;case 19:if(V(xr),f=a.memoizedState,f===null)return Wt(a),null;if(_=(a.flags&128)!==0,b=f.rendering,b===null)if(_)ru(f,!1);else{if(lr!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(b=ih(i),b!==null){for(a.flags|=128,ru(f,!1),i=b.updateQueue,a.updateQueue=i,vh(a,i),a.subtreeFlags=0,i=u,u=a.child;u!==null;)Yb(u,i),u=u.sibling;return X(xr,xr.current&1|2),_t&&In(a,f.treeForkCount),a.child}i=i.sibling}f.tail!==null&&He()>wh&&(a.flags|=128,_=!0,ru(f,!1),a.lanes=4194304)}else{if(!_)if(i=ih(b),i!==null){if(a.flags|=128,_=!0,i=i.updateQueue,a.updateQueue=i,vh(a,i),ru(f,!0),f.tail===null&&f.tailMode==="hidden"&&!b.alternate&&!_t)return Wt(a),null}else 2*He()-f.renderingStartTime>wh&&u!==536870912&&(a.flags|=128,_=!0,ru(f,!1),a.lanes=4194304);f.isBackwards?(b.sibling=a.child,a.child=b):(i=f.last,i!==null?i.sibling=b:a.child=b,f.last=b)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=He(),i.sibling=null,u=xr.current,X(xr,_?u&1|2:u&1),_t&&In(a,f.treeForkCount),i):(Wt(a),null);case 22:case 23:return Fs(a),ig(),f=a.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(u&536870912)!==0&&(a.flags&128)===0&&(Wt(a),a.subtreeFlags&6&&(a.flags|=8192)):Wt(a),u=a.updateQueue,u!==null&&vh(a,u.retryQueue),u=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==u&&(a.flags|=2048),i!==null&&V(To),null;case 24:return u=null,i!==null&&(u=i.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),$n(wr),Wt(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function oD(i,a){switch(Fp(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return $n(wr),le(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return Ee(a),null;case 31:if(a.memoizedState!==null){if(Fs(a),a.alternate===null)throw Error(s(340));No()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(Fs(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(s(340));No()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return V(xr),null;case 4:return le(),null;case 10:return $n(a.type),null;case 22:case 23:return Fs(a),ig(),i!==null&&V(To),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return $n(wr),null;case 25:return null;default:return null}}function bw(i,a){switch(Fp(a),a.tag){case 3:$n(wr),le();break;case 26:case 27:case 5:Ee(a);break;case 4:le();break;case 31:a.memoizedState!==null&&Fs(a);break;case 13:Fs(a);break;case 19:V(xr);break;case 10:$n(a.type);break;case 22:case 23:Fs(a),ig(),i!==null&&V(To);break;case 24:$n(wr)}}function su(i,a){try{var u=a.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var _=f.next;u=_;do{if((u.tag&i)===i){f=void 0;var b=u.create,j=u.inst;f=b(),j.destroy=f}u=u.next}while(u!==_)}}catch(I){Tt(a,a.return,I)}}function ja(i,a,u){try{var f=a.updateQueue,_=f!==null?f.lastEffect:null;if(_!==null){var b=_.next;f=b;do{if((f.tag&i)===i){var j=f.inst,I=j.destroy;if(I!==void 0){j.destroy=void 0,_=a;var K=u,ae=I;try{ae()}catch(he){Tt(_,K,he)}}}f=f.next}while(f!==b)}}catch(he){Tt(a,a.return,he)}}function ww(i){var a=i.updateQueue;if(a!==null){var u=i.stateNode;try{h1(a,u)}catch(f){Tt(i,i.return,f)}}}function Sw(i,a,u){u.props=Bo(i.type,i.memoizedProps),u.state=i.memoizedState;try{u.componentWillUnmount()}catch(f){Tt(i,a,f)}}function iu(i,a){try{var u=i.ref;if(u!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof u=="function"?i.refCleanup=u(f):u.current=f}}catch(_){Tt(i,a,_)}}function ln(i,a){var u=i.ref,f=i.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(_){Tt(i,a,_)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(_){Tt(i,a,_)}else u.current=null}function Cw(i){var a=i.type,u=i.memoizedProps,f=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(_){Tt(i,i.return,_)}}function Bg(i,a,u){try{var f=i.stateNode;jD(f,i.type,u,a),f[ct]=a}catch(_){Tt(i,i.return,_)}}function kw(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Ba(i.type)||i.tag===4}function Pg(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||kw(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Ba(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Ig(i,a,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(i,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(i),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=On));else if(f!==4&&(f===27&&Ba(i.type)&&(u=i.stateNode,a=null),i=i.child,i!==null))for(Ig(i,a,u),i=i.sibling;i!==null;)Ig(i,a,u),i=i.sibling}function _h(i,a,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,a?u.insertBefore(i,a):u.appendChild(i);else if(f!==4&&(f===27&&Ba(i.type)&&(u=i.stateNode),i=i.child,i!==null))for(_h(i,a,u),i=i.sibling;i!==null;)_h(i,a,u),i=i.sibling}function Ew(i){var a=i.stateNode,u=i.memoizedProps;try{for(var f=i.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);is(a,f,u),a[$t]=i,a[ct]=u}catch(b){Tt(i,i.return,b)}}var Wn=!1,kr=!1,zg=!1,Rw=typeof WeakSet=="function"?WeakSet:Set,Ur=null;function lD(i,a){if(i=i.containerInfo,av=zh,i=zb(i),Mp(i)){if("selectionStart"in i)var u={start:i.selectionStart,end:i.selectionEnd};else e:{u=(u=i.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var _=f.anchorOffset,b=f.focusNode;f=f.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var j=0,I=-1,K=-1,ae=0,he=0,ge=i,oe=null;t:for(;;){for(var ue;ge!==u||_!==0&&ge.nodeType!==3||(I=j+_),ge!==b||f!==0&&ge.nodeType!==3||(K=j+f),ge.nodeType===3&&(j+=ge.nodeValue.length),(ue=ge.firstChild)!==null;)oe=ge,ge=ue;for(;;){if(ge===i)break t;if(oe===u&&++ae===_&&(I=j),oe===b&&++he===f&&(K=j),(ue=ge.nextSibling)!==null)break;ge=oe,oe=ge.parentNode}ge=ue}u=I===-1||K===-1?null:{start:I,end:K}}else u=null}u=u||{start:0,end:0}}else u=null;for(ov={focusedElem:i,selectionRange:u},zh=!1,Ur=a;Ur!==null;)if(a=Ur,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,Ur=i;else for(;Ur!==null;){switch(a=Ur,b=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(u=0;u<i.length;u++)_=i[u],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&b!==null){i=void 0,u=a,_=b.memoizedProps,b=b.memoizedState,f=u.stateNode;try{var Me=Bo(u.type,_);i=f.getSnapshotBeforeUpdate(Me,b),f.__reactInternalSnapshotBeforeUpdate=i}catch(We){Tt(u,u.return,We)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,u=i.nodeType,u===9)uv(i);else if(u===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":uv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(s(163))}if(i=a.sibling,i!==null){i.return=a.return,Ur=i;break}Ur=a.return}}function Nw(i,a,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Gn(i,u),f&4&&su(5,u);break;case 1:if(Gn(i,u),f&4)if(i=u.stateNode,a===null)try{i.componentDidMount()}catch(j){Tt(u,u.return,j)}else{var _=Bo(u.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(_,a,i.__reactInternalSnapshotBeforeUpdate)}catch(j){Tt(u,u.return,j)}}f&64&&ww(u),f&512&&iu(u,u.return);break;case 3:if(Gn(i,u),f&64&&(i=u.updateQueue,i!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{h1(i,a)}catch(j){Tt(u,u.return,j)}}break;case 27:a===null&&f&4&&Ew(u);case 26:case 5:Gn(i,u),a===null&&f&4&&Cw(u),f&512&&iu(u,u.return);break;case 12:Gn(i,u);break;case 31:Gn(i,u),f&4&&Tw(i,u);break;case 13:Gn(i,u),f&4&&Mw(i,u),f&64&&(i=u.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(u=vD.bind(null,u),PD(i,u))));break;case 22:if(f=u.memoizedState!==null||Wn,!f){a=a!==null&&a.memoizedState!==null||kr,_=Wn;var b=kr;Wn=f,(kr=a)&&!b?Yn(i,u,(u.subtreeFlags&8772)!==0):Gn(i,u),Wn=_,kr=b}break;case 30:break;default:Gn(i,u)}}function jw(i){var a=i.alternate;a!==null&&(i.alternate=null,jw(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&Jt(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Xt=null,Ns=!1;function Vn(i,a,u){for(u=u.child;u!==null;)Aw(i,a,u),u=u.sibling}function Aw(i,a,u){if(Mr&&typeof Mr.onCommitFiberUnmount=="function")try{Mr.onCommitFiberUnmount(zs,u)}catch{}switch(u.tag){case 26:kr||ln(u,a),Vn(i,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:kr||ln(u,a);var f=Xt,_=Ns;Ba(u.type)&&(Xt=u.stateNode,Ns=!1),Vn(i,a,u),fu(u.stateNode),Xt=f,Ns=_;break;case 5:kr||ln(u,a);case 6:if(f=Xt,_=Ns,Xt=null,Vn(i,a,u),Xt=f,Ns=_,Xt!==null)if(Ns)try{(Xt.nodeType===9?Xt.body:Xt.nodeName==="HTML"?Xt.ownerDocument.body:Xt).removeChild(u.stateNode)}catch(b){Tt(u,a,b)}else try{Xt.removeChild(u.stateNode)}catch(b){Tt(u,a,b)}break;case 18:Xt!==null&&(Ns?(i=Xt,wS(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,u.stateNode),Kl(i)):wS(Xt,u.stateNode));break;case 4:f=Xt,_=Ns,Xt=u.stateNode.containerInfo,Ns=!0,Vn(i,a,u),Xt=f,Ns=_;break;case 0:case 11:case 14:case 15:ja(2,u,a),kr||ja(4,u,a),Vn(i,a,u);break;case 1:kr||(ln(u,a),f=u.stateNode,typeof f.componentWillUnmount=="function"&&Sw(u,a,f)),Vn(i,a,u);break;case 21:Vn(i,a,u);break;case 22:kr=(f=kr)||u.memoizedState!==null,Vn(i,a,u),kr=f;break;default:Vn(i,a,u)}}function Tw(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Kl(i)}catch(u){Tt(a,a.return,u)}}}function Mw(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Kl(i)}catch(u){Tt(a,a.return,u)}}function cD(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new Rw),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new Rw),a;default:throw Error(s(435,i.tag))}}function xh(i,a){var u=cD(i);a.forEach(function(f){if(!u.has(f)){u.add(f);var _=_D.bind(null,i,f);f.then(_,_)}})}function js(i,a){var u=a.deletions;if(u!==null)for(var f=0;f<u.length;f++){var _=u[f],b=i,j=a,I=j;e:for(;I!==null;){switch(I.tag){case 27:if(Ba(I.type)){Xt=I.stateNode,Ns=!1;break e}break;case 5:Xt=I.stateNode,Ns=!1;break e;case 3:case 4:Xt=I.stateNode.containerInfo,Ns=!0;break e}I=I.return}if(Xt===null)throw Error(s(160));Aw(b,j,_),Xt=null,Ns=!1,b=_.alternate,b!==null&&(b.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Dw(a,i),a=a.sibling}var $i=null;function Dw(i,a){var u=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:js(a,i),As(i),f&4&&(ja(3,i,i.return),su(3,i),ja(5,i,i.return));break;case 1:js(a,i),As(i),f&512&&(kr||u===null||ln(u,u.return)),f&64&&Wn&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(u=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var _=$i;if(js(a,i),As(i),f&512&&(kr||u===null||ln(u,u.return)),f&4){var b=u!==null?u.memoizedState:null;if(f=i.memoizedState,u===null)if(f===null)if(i.stateNode===null){e:{f=i.type,u=i.memoizedProps,_=_.ownerDocument||_;t:switch(f){case"title":b=_.getElementsByTagName("title")[0],(!b||b[dt]||b[$t]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=_.createElement(f),_.head.insertBefore(b,_.querySelector("head > title"))),is(b,f,u),b[$t]=i,$r(b),f=b;break e;case"link":var j=DS("link","href",_).get(f+(u.href||""));if(j){for(var I=0;I<j.length;I++)if(b=j[I],b.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&b.getAttribute("rel")===(u.rel==null?null:u.rel)&&b.getAttribute("title")===(u.title==null?null:u.title)&&b.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){j.splice(I,1);break t}}b=_.createElement(f),is(b,f,u),_.head.appendChild(b);break;case"meta":if(j=DS("meta","content",_).get(f+(u.content||""))){for(I=0;I<j.length;I++)if(b=j[I],b.getAttribute("content")===(u.content==null?null:""+u.content)&&b.getAttribute("name")===(u.name==null?null:u.name)&&b.getAttribute("property")===(u.property==null?null:u.property)&&b.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&b.getAttribute("charset")===(u.charSet==null?null:u.charSet)){j.splice(I,1);break t}}b=_.createElement(f),is(b,f,u),_.head.appendChild(b);break;default:throw Error(s(468,f))}b[$t]=i,$r(b),f=b}i.stateNode=f}else LS(_,i.type,i.stateNode);else i.stateNode=MS(_,f,i.memoizedProps);else b!==f?(b===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):b.count--,f===null?LS(_,i.type,i.stateNode):MS(_,f,i.memoizedProps)):f===null&&i.stateNode!==null&&Bg(i,i.memoizedProps,u.memoizedProps)}break;case 27:js(a,i),As(i),f&512&&(kr||u===null||ln(u,u.return)),u!==null&&f&4&&Bg(i,i.memoizedProps,u.memoizedProps);break;case 5:if(js(a,i),As(i),f&512&&(kr||u===null||ln(u,u.return)),i.flags&32){_=i.stateNode;try{_l(_,"")}catch(Me){Tt(i,i.return,Me)}}f&4&&i.stateNode!=null&&(_=i.memoizedProps,Bg(i,_,u!==null?u.memoizedProps:_)),f&1024&&(zg=!0);break;case 6:if(js(a,i),As(i),f&4){if(i.stateNode===null)throw Error(s(162));f=i.memoizedProps,u=i.stateNode;try{u.nodeValue=f}catch(Me){Tt(i,i.return,Me)}}break;case 3:if(Oh=null,_=$i,$i=Dh(a.containerInfo),js(a,i),$i=_,As(i),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Kl(a.containerInfo)}catch(Me){Tt(i,i.return,Me)}zg&&(zg=!1,Lw(i));break;case 4:f=$i,$i=Dh(i.stateNode.containerInfo),js(a,i),As(i),$i=f;break;case 12:js(a,i),As(i);break;case 31:js(a,i),As(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,xh(i,f)));break;case 13:js(a,i),As(i),i.child.flags&8192&&i.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(bh=He()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,xh(i,f)));break;case 22:_=i.memoizedState!==null;var K=u!==null&&u.memoizedState!==null,ae=Wn,he=kr;if(Wn=ae||_,kr=he||K,js(a,i),kr=he,Wn=ae,As(i),f&8192)e:for(a=i.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(u===null||K||Wn||kr||Po(i)),u=null,a=i;;){if(a.tag===5||a.tag===26){if(u===null){K=u=a;try{if(b=K.stateNode,_)j=b.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{I=K.stateNode;var ge=K.memoizedProps.style,oe=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;I.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Me){Tt(K,K.return,Me)}}}else if(a.tag===6){if(u===null){K=a;try{K.stateNode.nodeValue=_?"":K.memoizedProps}catch(Me){Tt(K,K.return,Me)}}}else if(a.tag===18){if(u===null){K=a;try{var ue=K.stateNode;_?SS(ue,!0):SS(K.stateNode,!1)}catch(Me){Tt(K,K.return,Me)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}f&4&&(f=i.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,xh(i,u))));break;case 19:js(a,i),As(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,xh(i,f)));break;case 30:break;case 21:break;default:js(a,i),As(i)}}function As(i){var a=i.flags;if(a&2){try{for(var u,f=i.return;f!==null;){if(kw(f)){u=f;break}f=f.return}if(u==null)throw Error(s(160));switch(u.tag){case 27:var _=u.stateNode,b=Pg(i);_h(i,b,_);break;case 5:var j=u.stateNode;u.flags&32&&(_l(j,""),u.flags&=-33);var I=Pg(i);_h(i,I,j);break;case 3:case 4:var K=u.stateNode.containerInfo,ae=Pg(i);Ig(i,ae,K);break;default:throw Error(s(161))}}catch(he){Tt(i,i.return,he)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function Lw(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;Lw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function Gn(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Nw(i,a.alternate,a),a=a.sibling}function Po(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:ja(4,a,a.return),Po(a);break;case 1:ln(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Sw(a,a.return,u),Po(a);break;case 27:fu(a.stateNode);case 26:case 5:ln(a,a.return),Po(a);break;case 22:a.memoizedState===null&&Po(a);break;case 30:Po(a);break;default:Po(a)}i=i.sibling}}function Yn(i,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var f=a.alternate,_=i,b=a,j=b.flags;switch(b.tag){case 0:case 11:case 15:Yn(_,b,u),su(4,b);break;case 1:if(Yn(_,b,u),f=b,_=f.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(ae){Tt(f,f.return,ae)}if(f=b,_=f.updateQueue,_!==null){var I=f.stateNode;try{var K=_.shared.hiddenCallbacks;if(K!==null)for(_.shared.hiddenCallbacks=null,_=0;_<K.length;_++)d1(K[_],I)}catch(ae){Tt(f,f.return,ae)}}u&&j&64&&ww(b),iu(b,b.return);break;case 27:Ew(b);case 26:case 5:Yn(_,b,u),u&&f===null&&j&4&&Cw(b),iu(b,b.return);break;case 12:Yn(_,b,u);break;case 31:Yn(_,b,u),u&&j&4&&Tw(_,b);break;case 13:Yn(_,b,u),u&&j&4&&Mw(_,b);break;case 22:b.memoizedState===null&&Yn(_,b,u),iu(b,b.return);break;case 30:break;default:Yn(_,b,u)}a=a.sibling}}function $g(i,a){var u=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==u&&(i!=null&&i.refCount++,u!=null&&qc(u))}function Ug(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&qc(i))}function Ui(i,a,u,f){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Ow(i,a,u,f),a=a.sibling}function Ow(i,a,u,f){var _=a.flags;switch(a.tag){case 0:case 11:case 15:Ui(i,a,u,f),_&2048&&su(9,a);break;case 1:Ui(i,a,u,f);break;case 3:Ui(i,a,u,f),_&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&qc(i)));break;case 12:if(_&2048){Ui(i,a,u,f),i=a.stateNode;try{var b=a.memoizedProps,j=b.id,I=b.onPostCommit;typeof I=="function"&&I(j,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(K){Tt(a,a.return,K)}}else Ui(i,a,u,f);break;case 31:Ui(i,a,u,f);break;case 13:Ui(i,a,u,f);break;case 23:break;case 22:b=a.stateNode,j=a.alternate,a.memoizedState!==null?b._visibility&2?Ui(i,a,u,f):nu(i,a):b._visibility&2?Ui(i,a,u,f):(b._visibility|=2,Il(i,a,u,f,(a.subtreeFlags&10256)!==0||!1)),_&2048&&$g(j,a);break;case 24:Ui(i,a,u,f),_&2048&&Ug(a.alternate,a);break;default:Ui(i,a,u,f)}}function Il(i,a,u,f,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=i,j=a,I=u,K=f,ae=j.flags;switch(j.tag){case 0:case 11:case 15:Il(b,j,I,K,_),su(8,j);break;case 23:break;case 22:var he=j.stateNode;j.memoizedState!==null?he._visibility&2?Il(b,j,I,K,_):nu(b,j):(he._visibility|=2,Il(b,j,I,K,_)),_&&ae&2048&&$g(j.alternate,j);break;case 24:Il(b,j,I,K,_),_&&ae&2048&&Ug(j.alternate,j);break;default:Il(b,j,I,K,_)}a=a.sibling}}function nu(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=i,f=a,_=f.flags;switch(f.tag){case 22:nu(u,f),_&2048&&$g(f.alternate,f);break;case 24:nu(u,f),_&2048&&Ug(f.alternate,f);break;default:nu(u,f)}a=a.sibling}}var au=8192;function zl(i,a,u){if(i.subtreeFlags&au)for(i=i.child;i!==null;)Bw(i,a,u),i=i.sibling}function Bw(i,a,u){switch(i.tag){case 26:zl(i,a,u),i.flags&au&&i.memoizedState!==null&&KD(u,$i,i.memoizedState,i.memoizedProps);break;case 5:zl(i,a,u);break;case 3:case 4:var f=$i;$i=Dh(i.stateNode.containerInfo),zl(i,a,u),$i=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=au,au=16777216,zl(i,a,u),au=f):zl(i,a,u));break;default:zl(i,a,u)}}function Pw(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function ou(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];Ur=f,zw(f,i)}Pw(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Iw(i),i=i.sibling}function Iw(i){switch(i.tag){case 0:case 11:case 15:ou(i),i.flags&2048&&ja(9,i,i.return);break;case 3:ou(i);break;case 12:ou(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,yh(i)):ou(i);break;default:ou(i)}}function yh(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];Ur=f,zw(f,i)}Pw(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:ja(8,a,a.return),yh(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,yh(a));break;default:yh(a)}i=i.sibling}}function zw(i,a){for(;Ur!==null;){var u=Ur;switch(u.tag){case 0:case 11:case 15:ja(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:qc(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,Ur=f;else e:for(u=i;Ur!==null;){f=Ur;var _=f.sibling,b=f.return;if(jw(f),f===u){Ur=null;break e}if(_!==null){_.return=b,Ur=_;break e}Ur=b}}}var uD={getCacheForType:function(i){var a=rs(wr),u=a.data.get(i);return u===void 0&&(u=i(),a.data.set(i,u)),u},cacheSignal:function(){return rs(wr).controller.signal}},dD=typeof WeakMap=="function"?WeakMap:Map,Rt=0,Ut=null,ht=null,gt=0,At=0,qs=null,Aa=!1,$l=!1,Hg=!1,Kn=0,lr=0,Ta=0,Io=0,Fg=0,Ws=0,Ul=0,lu=null,Ts=null,qg=!1,bh=0,$w=0,wh=1/0,Sh=null,Ma=null,Dr=0,Da=null,Hl=null,Xn=0,Wg=0,Vg=null,Uw=null,cu=0,Gg=null;function Vs(){return(Rt&2)!==0&&gt!==0?gt&-gt:A.T!==null?Jg():Dn()}function Hw(){if(Ws===0)if((gt&536870912)===0||_t){var i=es;es<<=1,(es&3932160)===0&&(es=262144),Ws=i}else Ws=536870912;return i=Hs.current,i!==null&&(i.flags|=32),Ws}function Ms(i,a,u){(i===Ut&&(At===2||At===9)||i.cancelPendingCommit!==null)&&(Fl(i,0),La(i,gt,Ws,!1)),st(i,u),((Rt&2)===0||i!==Ut)&&(i===Ut&&((Rt&2)===0&&(Io|=u),lr===4&&La(i,gt,Ws,!1)),cn(i))}function Fw(i,a,u){if((Rt&6)!==0)throw Error(s(327));var f=!u&&(a&127)===0&&(a&i.expiredLanes)===0||Et(i,a),_=f?mD(i,a):Kg(i,a,!0),b=f;do{if(_===0){$l&&!f&&La(i,a,0,!1);break}else{if(u=i.current.alternate,b&&!hD(u)){_=Kg(i,a,!1),b=!1;continue}if(_===2){if(b=a,i.errorRecoveryDisabledLanes&b)var j=0;else j=i.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var I=i;_=lu;var K=I.current.memoizedState.isDehydrated;if(K&&(Fl(I,j).flags|=256),j=Kg(I,j,!1),j!==2){if(Hg&&!K){I.errorRecoveryDisabledLanes|=b,Io|=b,_=4;break e}b=Ts,Ts=_,b!==null&&(Ts===null?Ts=b:Ts.push.apply(Ts,b))}_=j}if(b=!1,_!==2)continue}}if(_===1){Fl(i,0),La(i,a,0,!0);break}e:{switch(f=i,b=_,b){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:La(f,a,Ws,!Aa);break e;case 2:Ts=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(_=bh+300-He(),10<_)){if(La(f,a,Ws,!Aa),qe(f,0,!0)!==0)break e;Xn=a,f.timeoutHandle=yS(qw.bind(null,f,u,Ts,Sh,qg,a,Ws,Io,Ul,Aa,b,"Throttled",-0,0),_);break e}qw(f,u,Ts,Sh,qg,a,Ws,Io,Ul,Aa,b,null,-0,0)}}break}while(!0);cn(i)}function qw(i,a,u,f,_,b,j,I,K,ae,he,ge,oe,ue){if(i.timeoutHandle=-1,ge=a.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},Bw(a,b,ge);var Me=(b&62914560)===b?bh-He():(b&4194048)===b?$w-He():0;if(Me=XD(ge,Me),Me!==null){Xn=b,i.cancelPendingCommit=Me(Qw.bind(null,i,a,b,u,f,_,j,I,K,he,ge,null,oe,ue)),La(i,b,j,!ae);return}}Qw(i,a,b,u,f,_,j,I,K)}function hD(i){for(var a=i;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var _=u[f],b=_.getSnapshot;_=_.value;try{if(!$s(b(),_))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function La(i,a,u,f){a&=~Fg,a&=~Io,i.suspendedLanes|=a,i.pingedLanes&=~a,f&&(i.warmLanes|=a),f=i.expirationTimes;for(var _=a;0<_;){var b=31-Ht(_),j=1<<b;f[b]=-1,_&=~j}u!==0&&It(i,u,a)}function Ch(){return(Rt&6)===0?(uu(0),!1):!0}function Yg(){if(ht!==null){if(At===0)var i=ht.return;else i=ht,zn=jo=null,ug(i),Dl=null,Vc=0,i=ht;for(;i!==null;)bw(i.alternate,i),i=i.return;ht=null}}function Fl(i,a){var u=i.timeoutHandle;u!==-1&&(i.timeoutHandle=-1,MD(u)),u=i.cancelPendingCommit,u!==null&&(i.cancelPendingCommit=null,u()),Xn=0,Yg(),Ut=i,ht=u=Pn(i.current,null),gt=a,At=0,qs=null,Aa=!1,$l=Et(i,a),Hg=!1,Ul=Ws=Fg=Io=Ta=lr=0,Ts=lu=null,qg=!1,(a&8)!==0&&(a|=a&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=a;0<f;){var _=31-Ht(f),b=1<<_;a|=i[_],f&=~b}return Kn=a,Wd(),u}function Ww(i,a){et=null,A.H=eu,a===Ml||a===Jd?(a=o1(),At=3):a===Qp?(a=o1(),At=4):At=a===Eg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,qs=a,ht===null&&(lr=1,fh(i,ci(a,i.current)))}function Vw(){var i=Hs.current;return i===null?!0:(gt&4194048)===gt?fi===null:(gt&62914560)===gt||(gt&536870912)!==0?i===fi:!1}function Gw(){var i=A.H;return A.H=eu,i===null?eu:i}function Yw(){var i=A.A;return A.A=uD,i}function kh(){lr=4,Aa||(gt&4194048)!==gt&&Hs.current!==null||($l=!0),(Ta&134217727)===0&&(Io&134217727)===0||Ut===null||La(Ut,gt,Ws,!1)}function Kg(i,a,u){var f=Rt;Rt|=2;var _=Gw(),b=Yw();(Ut!==i||gt!==a)&&(Sh=null,Fl(i,a)),a=!1;var j=lr;e:do try{if(At!==0&&ht!==null){var I=ht,K=qs;switch(At){case 8:Yg(),j=6;break e;case 3:case 2:case 9:case 6:Hs.current===null&&(a=!0);var ae=At;if(At=0,qs=null,ql(i,I,K,ae),u&&$l){j=0;break e}break;default:ae=At,At=0,qs=null,ql(i,I,K,ae)}}fD(),j=lr;break}catch(he){Ww(i,he)}while(!0);return a&&i.shellSuspendCounter++,zn=jo=null,Rt=f,A.H=_,A.A=b,ht===null&&(Ut=null,gt=0,Wd()),j}function fD(){for(;ht!==null;)Kw(ht)}function mD(i,a){var u=Rt;Rt|=2;var f=Gw(),_=Yw();Ut!==i||gt!==a?(Sh=null,wh=He()+500,Fl(i,a)):$l=Et(i,a);e:do try{if(At!==0&&ht!==null){a=ht;var b=qs;t:switch(At){case 1:At=0,qs=null,ql(i,a,b,1);break;case 2:case 9:if(n1(b)){At=0,qs=null,Xw(a);break}a=function(){At!==2&&At!==9||Ut!==i||(At=7),cn(i)},b.then(a,a);break e;case 3:At=7;break e;case 4:At=5;break e;case 7:n1(b)?(At=0,qs=null,Xw(a)):(At=0,qs=null,ql(i,a,b,7));break;case 5:var j=null;switch(ht.tag){case 26:j=ht.memoizedState;case 5:case 27:var I=ht;if(j?OS(j):I.stateNode.complete){At=0,qs=null;var K=I.sibling;if(K!==null)ht=K;else{var ae=I.return;ae!==null?(ht=ae,Eh(ae)):ht=null}break t}}At=0,qs=null,ql(i,a,b,5);break;case 6:At=0,qs=null,ql(i,a,b,6);break;case 8:Yg(),lr=6;break e;default:throw Error(s(462))}}pD();break}catch(he){Ww(i,he)}while(!0);return zn=jo=null,A.H=f,A.A=_,Rt=u,ht!==null?0:(Ut=null,gt=0,Wd(),lr)}function pD(){for(;ht!==null&&!rt();)Kw(ht)}function Kw(i){var a=xw(i.alternate,i,Kn);i.memoizedProps=i.pendingProps,a===null?Eh(i):ht=a}function Xw(i){var a=i,u=a.alternate;switch(a.tag){case 15:case 0:a=fw(u,a,a.pendingProps,a.type,void 0,gt);break;case 11:a=fw(u,a,a.pendingProps,a.type.render,a.ref,gt);break;case 5:ug(a);default:bw(u,a),a=ht=Yb(a,Kn),a=xw(u,a,Kn)}i.memoizedProps=i.pendingProps,a===null?Eh(i):ht=a}function ql(i,a,u,f){zn=jo=null,ug(a),Dl=null,Vc=0;var _=a.return;try{if(sD(i,_,a,u,gt)){lr=1,fh(i,ci(u,i.current)),ht=null;return}}catch(b){if(_!==null)throw ht=_,b;lr=1,fh(i,ci(u,i.current)),ht=null;return}a.flags&32768?(_t||f===1?i=!0:$l||(gt&536870912)!==0?i=!1:(Aa=i=!0,(f===2||f===9||f===3||f===6)&&(f=Hs.current,f!==null&&f.tag===13&&(f.flags|=16384))),Zw(a,i)):Eh(a)}function Eh(i){var a=i;do{if((a.flags&32768)!==0){Zw(a,Aa);return}i=a.return;var u=aD(a.alternate,a,Kn);if(u!==null){ht=u;return}if(a=a.sibling,a!==null){ht=a;return}ht=a=i}while(a!==null);lr===0&&(lr=5)}function Zw(i,a){do{var u=oD(i.alternate,i);if(u!==null){u.flags&=32767,ht=u;return}if(u=i.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(i=i.sibling,i!==null)){ht=i;return}ht=i=u}while(i!==null);lr=6,ht=null}function Qw(i,a,u,f,_,b,j,I,K){i.cancelPendingCommit=null;do Rh();while(Dr!==0);if((Rt&6)!==0)throw Error(s(327));if(a!==null){if(a===i.current)throw Error(s(177));if(b=a.lanes|a.childLanes,b|=Pp,ir(i,u,b,j,I,K),i===Ut&&(ht=Ut=null,gt=0),Hl=a,Da=i,Xn=u,Wg=b,Vg=_,Uw=f,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,xD(cs,function(){return sS(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=A.T,A.T=null,_=O.p,O.p=2,j=Rt,Rt|=4;try{lD(i,a,u)}finally{Rt=j,O.p=_,A.T=f}}Dr=1,Jw(),eS(),tS()}}function Jw(){if(Dr===1){Dr=0;var i=Da,a=Hl,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=A.T,A.T=null;var f=O.p;O.p=2;var _=Rt;Rt|=4;try{Dw(a,i);var b=ov,j=zb(i.containerInfo),I=b.focusedElem,K=b.selectionRange;if(j!==I&&I&&I.ownerDocument&&Ib(I.ownerDocument.documentElement,I)){if(K!==null&&Mp(I)){var ae=K.start,he=K.end;if(he===void 0&&(he=ae),"selectionStart"in I)I.selectionStart=ae,I.selectionEnd=Math.min(he,I.value.length);else{var ge=I.ownerDocument||document,oe=ge&&ge.defaultView||window;if(oe.getSelection){var ue=oe.getSelection(),Me=I.textContent.length,We=Math.min(K.start,Me),Ot=K.end===void 0?We:Math.min(K.end,Me);!ue.extend&&We>Ot&&(j=Ot,Ot=We,We=j);var ee=Pb(I,We),Q=Pb(I,Ot);if(ee&&Q&&(ue.rangeCount!==1||ue.anchorNode!==ee.node||ue.anchorOffset!==ee.offset||ue.focusNode!==Q.node||ue.focusOffset!==Q.offset)){var ne=ge.createRange();ne.setStart(ee.node,ee.offset),ue.removeAllRanges(),We>Ot?(ue.addRange(ne),ue.extend(Q.node,Q.offset)):(ne.setEnd(Q.node,Q.offset),ue.addRange(ne))}}}}for(ge=[],ue=I;ue=ue.parentNode;)ue.nodeType===1&&ge.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<ge.length;I++){var fe=ge[I];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}zh=!!av,ov=av=null}finally{Rt=_,O.p=f,A.T=u}}i.current=a,Dr=2}}function eS(){if(Dr===2){Dr=0;var i=Da,a=Hl,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=A.T,A.T=null;var f=O.p;O.p=2;var _=Rt;Rt|=4;try{Nw(i,a.alternate,a)}finally{Rt=_,O.p=f,A.T=u}}Dr=3}}function tS(){if(Dr===4||Dr===3){Dr=0,$e();var i=Da,a=Hl,u=Xn,f=Uw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Dr=5:(Dr=0,Hl=Da=null,rS(i,i.pendingLanes));var _=i.pendingLanes;if(_===0&&(Ma=null),ar(u),a=a.stateNode,Mr&&typeof Mr.onCommitFiberRoot=="function")try{Mr.onCommitFiberRoot(zs,a,void 0,(a.current.flags&128)===128)}catch{}if(f!==null){a=A.T,_=O.p,O.p=2,A.T=null;try{for(var b=i.onRecoverableError,j=0;j<f.length;j++){var I=f[j];b(I.value,{componentStack:I.stack})}}finally{A.T=a,O.p=_}}(Xn&3)!==0&&Rh(),cn(i),_=i.pendingLanes,(u&261930)!==0&&(_&42)!==0?i===Gg?cu++:(cu=0,Gg=i):cu=0,uu(0)}}function rS(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,qc(a)))}function Rh(){return Jw(),eS(),tS(),sS()}function sS(){if(Dr!==5)return!1;var i=Da,a=Wg;Wg=0;var u=ar(Xn),f=A.T,_=O.p;try{O.p=32>u?32:u,A.T=null,u=Vg,Vg=null;var b=Da,j=Xn;if(Dr=0,Hl=Da=null,Xn=0,(Rt&6)!==0)throw Error(s(331));var I=Rt;if(Rt|=4,Iw(b.current),Ow(b,b.current,j,u),Rt=I,uu(0,!1),Mr&&typeof Mr.onPostCommitFiberRoot=="function")try{Mr.onPostCommitFiberRoot(zs,b)}catch{}return!0}finally{O.p=_,A.T=f,rS(i,a)}}function iS(i,a,u){a=ci(u,a),a=kg(i.stateNode,a,2),i=Ea(i,a,2),i!==null&&(st(i,2),cn(i))}function Tt(i,a,u){if(i.tag===3)iS(i,i,u);else for(;a!==null;){if(a.tag===3){iS(a,i,u);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ma===null||!Ma.has(f))){i=ci(u,i),u=nw(2),f=Ea(a,u,2),f!==null&&(aw(u,f,a,i),st(f,2),cn(f));break}}a=a.return}}function Xg(i,a,u){var f=i.pingCache;if(f===null){f=i.pingCache=new dD;var _=new Set;f.set(a,_)}else _=f.get(a),_===void 0&&(_=new Set,f.set(a,_));_.has(u)||(Hg=!0,_.add(u),i=gD.bind(null,i,a,u),a.then(i,i))}function gD(i,a,u){var f=i.pingCache;f!==null&&f.delete(a),i.pingedLanes|=i.suspendedLanes&u,i.warmLanes&=~u,Ut===i&&(gt&u)===u&&(lr===4||lr===3&&(gt&62914560)===gt&&300>He()-bh?(Rt&2)===0&&Fl(i,0):Fg|=u,Ul===gt&&(Ul=0)),cn(i)}function nS(i,a){a===0&&(a=Qt()),i=Eo(i,a),i!==null&&(st(i,a),cn(i))}function vD(i){var a=i.memoizedState,u=0;a!==null&&(u=a.retryLane),nS(i,u)}function _D(i,a){var u=0;switch(i.tag){case 31:case 13:var f=i.stateNode,_=i.memoizedState;_!==null&&(u=_.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(s(314))}f!==null&&f.delete(a),nS(i,u)}function xD(i,a){return ze(i,a)}var Nh=null,Wl=null,Zg=!1,jh=!1,Qg=!1,Oa=0;function cn(i){i!==Wl&&i.next===null&&(Wl===null?Nh=Wl=i:Wl=Wl.next=i),jh=!0,Zg||(Zg=!0,bD())}function uu(i,a){if(!Qg&&jh){Qg=!0;do for(var u=!1,f=Nh;f!==null;){if(i!==0){var _=f.pendingLanes;if(_===0)var b=0;else{var j=f.suspendedLanes,I=f.pingedLanes;b=(1<<31-Ht(42|i)+1)-1,b&=_&~(j&~I),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(u=!0,cS(f,b))}else b=gt,b=qe(f,f===Ut?b:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(b&3)===0||Et(f,b)||(u=!0,cS(f,b));f=f.next}while(u);Qg=!1}}function yD(){aS()}function aS(){jh=Zg=!1;var i=0;Oa!==0&&TD()&&(i=Oa);for(var a=He(),u=null,f=Nh;f!==null;){var _=f.next,b=oS(f,a);b===0?(f.next=null,u===null?Nh=_:u.next=_,_===null&&(Wl=u)):(u=f,(i!==0||(b&3)!==0)&&(jh=!0)),f=_}Dr!==0&&Dr!==5||uu(i),Oa!==0&&(Oa=0)}function oS(i,a){for(var u=i.suspendedLanes,f=i.pingedLanes,_=i.expirationTimes,b=i.pendingLanes&-62914561;0<b;){var j=31-Ht(b),I=1<<j,K=_[j];K===-1?((I&u)===0||(I&f)!==0)&&(_[j]=Ft(I,a)):K<=a&&(i.expiredLanes|=I),b&=~I}if(a=Ut,u=gt,u=qe(i,i===a?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,u===0||i===a&&(At===2||At===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&pt(f),i.callbackNode=null,i.callbackPriority=0;if((u&3)===0||Et(i,u)){if(a=u&-u,a===i.callbackPriority)return a;switch(f!==null&&pt(f),ar(u)){case 2:case 8:u=gs;break;case 32:u=cs;break;case 268435456:u=kt;break;default:u=cs}return f=lS.bind(null,i),u=ze(u,f),i.callbackPriority=a,i.callbackNode=u,a}return f!==null&&f!==null&&pt(f),i.callbackPriority=2,i.callbackNode=null,2}function lS(i,a){if(Dr!==0&&Dr!==5)return i.callbackNode=null,i.callbackPriority=0,null;var u=i.callbackNode;if(Rh()&&i.callbackNode!==u)return null;var f=gt;return f=qe(i,i===Ut?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(Fw(i,f,a),oS(i,He()),i.callbackNode!=null&&i.callbackNode===u?lS.bind(null,i):null)}function cS(i,a){if(Rh())return null;Fw(i,a,!0)}function bD(){DD(function(){(Rt&6)!==0?ze(Ct,yD):aS()})}function Jg(){if(Oa===0){var i=Al;i===0&&(i=sr,sr<<=1,(sr&261888)===0&&(sr=256)),Oa=i}return Oa}function uS(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Pd(""+i)}function dS(i,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,i.id&&u.setAttribute("form",i.id),a.parentNode.insertBefore(u,a),i=new FormData(i),u.parentNode.removeChild(u),i}function wD(i,a,u,f,_){if(a==="submit"&&u&&u.stateNode===_){var b=uS((_[ct]||null).action),j=f.submitter;j&&(a=(a=j[ct]||null)?uS(a.formAction):j.getAttribute("formAction"),a!==null&&(b=a,j=null));var I=new Ud("action","action",null,f,_);i.push({event:I,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Oa!==0){var K=j?dS(_,j):new FormData(_);xg(u,{pending:!0,data:K,method:_.method,action:b},null,K)}}else typeof b=="function"&&(I.preventDefault(),K=j?dS(_,j):new FormData(_),xg(u,{pending:!0,data:K,method:_.method,action:b},b,K))},currentTarget:_}]})}}for(var ev=0;ev<Bp.length;ev++){var tv=Bp[ev],SD=tv.toLowerCase(),CD=tv[0].toUpperCase()+tv.slice(1);zi(SD,"on"+CD)}zi(Hb,"onAnimationEnd"),zi(Fb,"onAnimationIteration"),zi(qb,"onAnimationStart"),zi("dblclick","onDoubleClick"),zi("focusin","onFocus"),zi("focusout","onBlur"),zi($3,"onTransitionRun"),zi(U3,"onTransitionStart"),zi(H3,"onTransitionCancel"),zi(Wb,"onTransitionEnd"),gl("onMouseEnter",["mouseout","mouseover"]),gl("onMouseLeave",["mouseout","mouseover"]),gl("onPointerEnter",["pointerout","pointerover"]),gl("onPointerLeave",["pointerout","pointerover"]),wo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wo("onBeforeInput",["compositionend","keypress","textInput","paste"]),wo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var du="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(" "),kD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(du));function hS(i,a){a=(a&4)!==0;for(var u=0;u<i.length;u++){var f=i[u],_=f.event;f=f.listeners;e:{var b=void 0;if(a)for(var j=f.length-1;0<=j;j--){var I=f[j],K=I.instance,ae=I.currentTarget;if(I=I.listener,K!==b&&_.isPropagationStopped())break e;b=I,_.currentTarget=ae;try{b(_)}catch(he){qd(he)}_.currentTarget=null,b=K}else for(j=0;j<f.length;j++){if(I=f[j],K=I.instance,ae=I.currentTarget,I=I.listener,K!==b&&_.isPropagationStopped())break e;b=I,_.currentTarget=ae;try{b(_)}catch(he){qd(he)}_.currentTarget=null,b=K}}}}function ft(i,a){var u=a[nn];u===void 0&&(u=a[nn]=new Set);var f=i+"__bubble";u.has(f)||(fS(a,i,2,!1),u.add(f))}function rv(i,a,u){var f=0;a&&(f|=4),fS(u,i,f,a)}var Ah="_reactListening"+Math.random().toString(36).slice(2);function sv(i){if(!i[Ah]){i[Ah]=!0,ab.forEach(function(u){u!=="selectionchange"&&(kD.has(u)||rv(u,!1,i),rv(u,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[Ah]||(a[Ah]=!0,rv("selectionchange",!1,a))}}function fS(i,a,u,f){switch(HS(a)){case 2:var _=JD;break;case 8:_=eL;break;default:_=_v}u=_.bind(null,a,u,i),_=void 0,!Sp||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(_=!0),f?_!==void 0?i.addEventListener(a,u,{capture:!0,passive:_}):i.addEventListener(a,u,!0):_!==void 0?i.addEventListener(a,u,{passive:_}):i.addEventListener(a,u,!1)}function iv(i,a,u,f,_){var b=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var j=f.tag;if(j===3||j===4){var I=f.stateNode.containerInfo;if(I===_)break;if(j===4)for(j=f.return;j!==null;){var K=j.tag;if((K===3||K===4)&&j.stateNode.containerInfo===_)return;j=j.return}for(;I!==null;){if(j=Kt(I),j===null)return;if(K=j.tag,K===5||K===6||K===26||K===27){f=b=j;continue e}I=I.parentNode}}f=f.return}_b(function(){var ae=b,he=bp(u),ge=[];e:{var oe=Vb.get(i);if(oe!==void 0){var ue=Ud,Me=i;switch(i){case"keypress":if(zd(u)===0)break e;case"keydown":case"keyup":ue=_3;break;case"focusin":Me="focus",ue=Rp;break;case"focusout":Me="blur",ue=Rp;break;case"beforeblur":case"afterblur":ue=Rp;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=bb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=a3;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=b3;break;case Hb:case Fb:case qb:ue=c3;break;case Wb:ue=S3;break;case"scroll":case"scrollend":ue=i3;break;case"wheel":ue=k3;break;case"copy":case"cut":case"paste":ue=d3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Sb;break;case"toggle":case"beforetoggle":ue=R3}var We=(a&4)!==0,Ot=!We&&(i==="scroll"||i==="scrollend"),ee=We?oe!==null?oe+"Capture":null:oe;We=[];for(var Q=ae,ne;Q!==null;){var fe=Q;if(ne=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ne===null||ee===null||(fe=Dc(Q,ee),fe!=null&&We.push(hu(Q,fe,ne))),Ot)break;Q=Q.return}0<We.length&&(oe=new ue(oe,Me,null,u,he),ge.push({event:oe,listeners:We}))}}if((a&7)===0){e:{if(oe=i==="mouseover"||i==="pointerover",ue=i==="mouseout"||i==="pointerout",oe&&u!==yp&&(Me=u.relatedTarget||u.fromElement)&&(Kt(Me)||Me[Ii]))break e;if((ue||oe)&&(oe=he.window===he?he:(oe=he.ownerDocument)?oe.defaultView||oe.parentWindow:window,ue?(Me=u.relatedTarget||u.toElement,ue=ae,Me=Me?Kt(Me):null,Me!==null&&(Ot=l(Me),We=Me.tag,Me!==Ot||We!==5&&We!==27&&We!==6)&&(Me=null)):(ue=null,Me=ae),ue!==Me)){if(We=bb,fe="onMouseLeave",ee="onMouseEnter",Q="mouse",(i==="pointerout"||i==="pointerover")&&(We=Sb,fe="onPointerLeave",ee="onPointerEnter",Q="pointer"),Ot=ue==null?oe:ni(ue),ne=Me==null?oe:ni(Me),oe=new We(fe,Q+"leave",ue,u,he),oe.target=Ot,oe.relatedTarget=ne,fe=null,Kt(he)===ae&&(We=new We(ee,Q+"enter",Me,u,he),We.target=ne,We.relatedTarget=Ot,fe=We),Ot=fe,ue&&Me)t:{for(We=ED,ee=ue,Q=Me,ne=0,fe=ee;fe;fe=We(fe))ne++;fe=0;for(var Ue=Q;Ue;Ue=We(Ue))fe++;for(;0<ne-fe;)ee=We(ee),ne--;for(;0<fe-ne;)Q=We(Q),fe--;for(;ne--;){if(ee===Q||Q!==null&&ee===Q.alternate){We=ee;break t}ee=We(ee),Q=We(Q)}We=null}else We=null;ue!==null&&mS(ge,oe,ue,We,!1),Me!==null&&Ot!==null&&mS(ge,Ot,Me,We,!0)}}e:{if(oe=ae?ni(ae):window,ue=oe.nodeName&&oe.nodeName.toLowerCase(),ue==="select"||ue==="input"&&oe.type==="file")var wt=Tb;else if(jb(oe))if(Mb)wt=P3;else{wt=O3;var Oe=L3}else ue=oe.nodeName,!ue||ue.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ae&&xp(ae.elementType)&&(wt=Tb):wt=B3;if(wt&&(wt=wt(i,ae))){Ab(ge,wt,u,he);break e}Oe&&Oe(i,oe,ae),i==="focusout"&&ae&&oe.type==="number"&&ae.memoizedProps.value!=null&&_p(oe,"number",oe.value)}switch(Oe=ae?ni(ae):window,i){case"focusin":(jb(Oe)||Oe.contentEditable==="true")&&(wl=Oe,Dp=ae,Uc=null);break;case"focusout":Uc=Dp=wl=null;break;case"mousedown":Lp=!0;break;case"contextmenu":case"mouseup":case"dragend":Lp=!1,$b(ge,u,he);break;case"selectionchange":if(z3)break;case"keydown":case"keyup":$b(ge,u,he)}var it;if(jp)e:{switch(i){case"compositionstart":var vt="onCompositionStart";break e;case"compositionend":vt="onCompositionEnd";break e;case"compositionupdate":vt="onCompositionUpdate";break e}vt=void 0}else bl?Rb(i,u)&&(vt="onCompositionEnd"):i==="keydown"&&u.keyCode===229&&(vt="onCompositionStart");vt&&(Cb&&u.locale!=="ko"&&(bl||vt!=="onCompositionStart"?vt==="onCompositionEnd"&&bl&&(it=xb()):(xa=he,Cp="value"in xa?xa.value:xa.textContent,bl=!0)),Oe=Th(ae,vt),0<Oe.length&&(vt=new wb(vt,i,null,u,he),ge.push({event:vt,listeners:Oe}),it?vt.data=it:(it=Nb(u),it!==null&&(vt.data=it)))),(it=j3?A3(i,u):T3(i,u))&&(vt=Th(ae,"onBeforeInput"),0<vt.length&&(Oe=new wb("onBeforeInput","beforeinput",null,u,he),ge.push({event:Oe,listeners:vt}),Oe.data=it)),wD(ge,i,ae,u,he)}hS(ge,a)})}function hu(i,a,u){return{instance:i,listener:a,currentTarget:u}}function Th(i,a){for(var u=a+"Capture",f=[];i!==null;){var _=i,b=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||b===null||(_=Dc(i,u),_!=null&&f.unshift(hu(i,_,b)),_=Dc(i,a),_!=null&&f.push(hu(i,_,b))),i.tag===3)return f;i=i.return}return[]}function ED(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function mS(i,a,u,f,_){for(var b=a._reactName,j=[];u!==null&&u!==f;){var I=u,K=I.alternate,ae=I.stateNode;if(I=I.tag,K!==null&&K===f)break;I!==5&&I!==26&&I!==27||ae===null||(K=ae,_?(ae=Dc(u,b),ae!=null&&j.unshift(hu(u,ae,K))):_||(ae=Dc(u,b),ae!=null&&j.push(hu(u,ae,K)))),u=u.return}j.length!==0&&i.push({event:a,listeners:j})}var RD=/\r\n?/g,ND=/\u0000|\uFFFD/g;function pS(i){return(typeof i=="string"?i:""+i).replace(RD,`
50
+ `).replace(ND,"")}function gS(i,a){return a=pS(a),pS(i)===a}function Lt(i,a,u,f,_,b){switch(u){case"children":typeof f=="string"?a==="body"||a==="textarea"&&f===""||_l(i,f):(typeof f=="number"||typeof f=="bigint")&&a!=="body"&&_l(i,""+f);break;case"className":Od(i,"class",f);break;case"tabIndex":Od(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Od(i,u,f);break;case"style":gb(i,f,b);break;case"data":if(a!=="object"){Od(i,"data",f);break}case"src":case"href":if(f===""&&(a!=="a"||u!=="href")){i.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(u);break}f=Pd(""+f),i.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(u,"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 b=="function"&&(u==="formAction"?(a!=="input"&&Lt(i,a,"name",_.name,_,null),Lt(i,a,"formEncType",_.formEncType,_,null),Lt(i,a,"formMethod",_.formMethod,_,null),Lt(i,a,"formTarget",_.formTarget,_,null)):(Lt(i,a,"encType",_.encType,_,null),Lt(i,a,"method",_.method,_,null),Lt(i,a,"target",_.target,_,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(u);break}f=Pd(""+f),i.setAttribute(u,f);break;case"onClick":f!=null&&(i.onclick=On);break;case"onScroll":f!=null&&ft("scroll",i);break;case"onScrollEnd":f!=null&&ft("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(s(61));if(u=f.__html,u!=null){if(_.children!=null)throw Error(s(60));i.innerHTML=u}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}u=Pd(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,""+f):i.removeAttribute(u);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":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,""):i.removeAttribute(u);break;case"capture":case"download":f===!0?i.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(u,f):i.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(u,f):i.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(u):i.setAttribute(u,f);break;case"popover":ft("beforetoggle",i),ft("toggle",i),Ld(i,"popover",f);break;case"xlinkActuate":Ln(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ln(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ln(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ln(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ln(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ln(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ln(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ln(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ln(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Ld(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=r3.get(u)||u,Ld(i,u,f))}}function nv(i,a,u,f,_,b){switch(u){case"style":gb(i,f,b);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(s(61));if(u=f.__html,u!=null){if(_.children!=null)throw Error(s(60));i.innerHTML=u}}break;case"children":typeof f=="string"?_l(i,f):(typeof f=="number"||typeof f=="bigint")&&_l(i,""+f);break;case"onScroll":f!=null&&ft("scroll",i);break;case"onScrollEnd":f!=null&&ft("scrollend",i);break;case"onClick":f!=null&&(i.onclick=On);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ob.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(_=u.endsWith("Capture"),a=u.slice(2,_?u.length-7:void 0),b=i[ct]||null,b=b!=null?b[u]:null,typeof b=="function"&&i.removeEventListener(a,b,_),typeof f=="function")){typeof b!="function"&&b!==null&&(u in i?i[u]=null:i.hasAttribute(u)&&i.removeAttribute(u)),i.addEventListener(a,f,_);break e}u in i?i[u]=f:f===!0?i.setAttribute(u,""):Ld(i,u,f)}}}function is(i,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ft("error",i),ft("load",i);var f=!1,_=!1,b;for(b in u)if(u.hasOwnProperty(b)){var j=u[b];if(j!=null)switch(b){case"src":f=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Lt(i,a,b,j,u,null)}}_&&Lt(i,a,"srcSet",u.srcSet,u,null),f&&Lt(i,a,"src",u.src,u,null);return;case"input":ft("invalid",i);var I=b=j=_=null,K=null,ae=null;for(f in u)if(u.hasOwnProperty(f)){var he=u[f];if(he!=null)switch(f){case"name":_=he;break;case"type":j=he;break;case"checked":K=he;break;case"defaultChecked":ae=he;break;case"value":b=he;break;case"defaultValue":I=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,a));break;default:Lt(i,a,f,he,u,null)}}hb(i,b,I,K,ae,j,_,!1);return;case"select":ft("invalid",i),f=j=b=null;for(_ in u)if(u.hasOwnProperty(_)&&(I=u[_],I!=null))switch(_){case"value":b=I;break;case"defaultValue":j=I;break;case"multiple":f=I;default:Lt(i,a,_,I,u,null)}a=b,u=j,i.multiple=!!f,a!=null?vl(i,!!f,a,!1):u!=null&&vl(i,!!f,u,!0);return;case"textarea":ft("invalid",i),b=_=f=null;for(j in u)if(u.hasOwnProperty(j)&&(I=u[j],I!=null))switch(j){case"value":f=I;break;case"defaultValue":_=I;break;case"children":b=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(s(91));break;default:Lt(i,a,j,I,u,null)}mb(i,f,_,b);return;case"option":for(K in u)if(u.hasOwnProperty(K)&&(f=u[K],f!=null))switch(K){case"selected":i.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Lt(i,a,K,f,u,null)}return;case"dialog":ft("beforetoggle",i),ft("toggle",i),ft("cancel",i),ft("close",i);break;case"iframe":case"object":ft("load",i);break;case"video":case"audio":for(f=0;f<du.length;f++)ft(du[f],i);break;case"image":ft("error",i),ft("load",i);break;case"details":ft("toggle",i);break;case"embed":case"source":case"link":ft("error",i),ft("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in u)if(u.hasOwnProperty(ae)&&(f=u[ae],f!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Lt(i,a,ae,f,u,null)}return;default:if(xp(a)){for(he in u)u.hasOwnProperty(he)&&(f=u[he],f!==void 0&&nv(i,a,he,f,u,void 0));return}}for(I in u)u.hasOwnProperty(I)&&(f=u[I],f!=null&&Lt(i,a,I,f,u,null))}function jD(i,a,u,f){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,b=null,j=null,I=null,K=null,ae=null,he=null;for(ue in u){var ge=u[ue];if(u.hasOwnProperty(ue)&&ge!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":K=ge;default:f.hasOwnProperty(ue)||Lt(i,a,ue,null,f,ge)}}for(var oe in f){var ue=f[oe];if(ge=u[oe],f.hasOwnProperty(oe)&&(ue!=null||ge!=null))switch(oe){case"type":b=ue;break;case"name":_=ue;break;case"checked":ae=ue;break;case"defaultChecked":he=ue;break;case"value":j=ue;break;case"defaultValue":I=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,a));break;default:ue!==ge&&Lt(i,a,oe,ue,f,ge)}}vp(i,j,I,K,ae,he,b,_);return;case"select":ue=j=I=oe=null;for(b in u)if(K=u[b],u.hasOwnProperty(b)&&K!=null)switch(b){case"value":break;case"multiple":ue=K;default:f.hasOwnProperty(b)||Lt(i,a,b,null,f,K)}for(_ in f)if(b=f[_],K=u[_],f.hasOwnProperty(_)&&(b!=null||K!=null))switch(_){case"value":oe=b;break;case"defaultValue":I=b;break;case"multiple":j=b;default:b!==K&&Lt(i,a,_,b,f,K)}a=I,u=j,f=ue,oe!=null?vl(i,!!u,oe,!1):!!f!=!!u&&(a!=null?vl(i,!!u,a,!0):vl(i,!!u,u?[]:"",!1));return;case"textarea":ue=oe=null;for(I in u)if(_=u[I],u.hasOwnProperty(I)&&_!=null&&!f.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Lt(i,a,I,null,f,_)}for(j in f)if(_=f[j],b=u[j],f.hasOwnProperty(j)&&(_!=null||b!=null))switch(j){case"value":oe=_;break;case"defaultValue":ue=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:_!==b&&Lt(i,a,j,_,f,b)}fb(i,oe,ue);return;case"option":for(var Me in u)if(oe=u[Me],u.hasOwnProperty(Me)&&oe!=null&&!f.hasOwnProperty(Me))switch(Me){case"selected":i.selected=!1;break;default:Lt(i,a,Me,null,f,oe)}for(K in f)if(oe=f[K],ue=u[K],f.hasOwnProperty(K)&&oe!==ue&&(oe!=null||ue!=null))switch(K){case"selected":i.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:Lt(i,a,K,oe,f,ue)}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 We in u)oe=u[We],u.hasOwnProperty(We)&&oe!=null&&!f.hasOwnProperty(We)&&Lt(i,a,We,null,f,oe);for(ae in f)if(oe=f[ae],ue=u[ae],f.hasOwnProperty(ae)&&oe!==ue&&(oe!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,a));break;default:Lt(i,a,ae,oe,f,ue)}return;default:if(xp(a)){for(var Ot in u)oe=u[Ot],u.hasOwnProperty(Ot)&&oe!==void 0&&!f.hasOwnProperty(Ot)&&nv(i,a,Ot,void 0,f,oe);for(he in f)oe=f[he],ue=u[he],!f.hasOwnProperty(he)||oe===ue||oe===void 0&&ue===void 0||nv(i,a,he,oe,f,ue);return}}for(var ee in u)oe=u[ee],u.hasOwnProperty(ee)&&oe!=null&&!f.hasOwnProperty(ee)&&Lt(i,a,ee,null,f,oe);for(ge in f)oe=f[ge],ue=u[ge],!f.hasOwnProperty(ge)||oe===ue||oe==null&&ue==null||Lt(i,a,ge,oe,f,ue)}function vS(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function AD(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var _=u[f],b=_.transferSize,j=_.initiatorType,I=_.duration;if(b&&I&&vS(j)){for(j=0,I=_.responseEnd,f+=1;f<u.length;f++){var K=u[f],ae=K.startTime;if(ae>I)break;var he=K.transferSize,ge=K.initiatorType;he&&vS(ge)&&(K=K.responseEnd,j+=he*(K<I?1:(I-ae)/(K-ae)))}if(--f,a+=8*(b+j)/(_.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var av=null,ov=null;function Mh(i){return i.nodeType===9?i:i.ownerDocument}function _S(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function xS(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function lv(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var cv=null;function TD(){var i=window.event;return i&&i.type==="popstate"?i===cv?!1:(cv=i,!0):(cv=null,!1)}var yS=typeof setTimeout=="function"?setTimeout:void 0,MD=typeof clearTimeout=="function"?clearTimeout:void 0,bS=typeof Promise=="function"?Promise:void 0,DD=typeof queueMicrotask=="function"?queueMicrotask:typeof bS<"u"?function(i){return bS.resolve(null).then(i).catch(LD)}:yS;function LD(i){setTimeout(function(){throw i})}function Ba(i){return i==="head"}function wS(i,a){var u=a,f=0;do{var _=u.nextSibling;if(i.removeChild(u),_&&_.nodeType===8)if(u=_.data,u==="/$"||u==="/&"){if(f===0){i.removeChild(_),Kl(a);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")fu(i.ownerDocument.documentElement);else if(u==="head"){u=i.ownerDocument.head,fu(u);for(var b=u.firstChild;b;){var j=b.nextSibling,I=b.nodeName;b[dt]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&b.rel.toLowerCase()==="stylesheet"||u.removeChild(b),b=j}}else u==="body"&&fu(i.ownerDocument.body);u=_}while(u);Kl(a)}function SS(i,a){var u=i;i=0;do{var f=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(i===0)break;i--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||i++;u=f}while(u)}function uv(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":uv(u),Jt(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}i.removeChild(u)}}function OD(i,a,u,f){for(;i.nodeType===1;){var _=u;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[dt])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(b=i.getAttribute("rel"),b==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(b!==_.rel||i.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||i.getAttribute("title")!==(_.title==null?null:_.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(b=i.getAttribute("src"),(b!==(_.src==null?null:_.src)||i.getAttribute("type")!==(_.type==null?null:_.type)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&b&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var b=_.name==null?null:""+_.name;if(_.type==="hidden"&&i.getAttribute("name")===b)return i}else return i;if(i=mi(i.nextSibling),i===null)break}return null}function BD(i,a,u){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!u||(i=mi(i.nextSibling),i===null))return null;return i}function CS(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=mi(i.nextSibling),i===null))return null;return i}function dv(i){return i.data==="$?"||i.data==="$~"}function hv(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function PD(i,a){var u=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||u.readyState!=="loading")a();else{var f=function(){a(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function mi(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var fv=null;function kS(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var u=i.data;if(u==="/$"||u==="/&"){if(a===0)return mi(i.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}i=i.nextSibling}return null}function ES(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var u=i.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return i;a--}else u!=="/$"&&u!=="/&"||a++}i=i.previousSibling}return null}function RS(i,a,u){switch(a=Mh(u),i){case"html":if(i=a.documentElement,!i)throw Error(s(452));return i;case"head":if(i=a.head,!i)throw Error(s(453));return i;case"body":if(i=a.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function fu(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);Jt(i)}var pi=new Map,NS=new Set;function Dh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Zn=O.d;O.d={f:ID,r:zD,D:$D,C:UD,L:HD,m:FD,X:WD,S:qD,M:VD};function ID(){var i=Zn.f(),a=Ch();return i||a}function zD(i){var a=ks(i);a!==null&&a.tag===5&&a.type==="form"?W1(a):Zn.r(i)}var Vl=typeof document>"u"?null:document;function jS(i,a,u){var f=Vl;if(f&&typeof a=="string"&&a){var _=oi(a);_='link[rel="'+i+'"][href="'+_+'"]',typeof u=="string"&&(_+='[crossorigin="'+u+'"]'),NS.has(_)||(NS.add(_),i={rel:i,crossOrigin:u,href:a},f.querySelector(_)===null&&(a=f.createElement("link"),is(a,"link",i),$r(a),f.head.appendChild(a)))}}function $D(i){Zn.D(i),jS("dns-prefetch",i,null)}function UD(i,a){Zn.C(i,a),jS("preconnect",i,a)}function HD(i,a,u){Zn.L(i,a,u);var f=Vl;if(f&&i&&a){var _='link[rel="preload"][as="'+oi(a)+'"]';a==="image"&&u&&u.imageSrcSet?(_+='[imagesrcset="'+oi(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(_+='[imagesizes="'+oi(u.imageSizes)+'"]')):_+='[href="'+oi(i)+'"]';var b=_;switch(a){case"style":b=Gl(i);break;case"script":b=Yl(i)}pi.has(b)||(i=g({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:i,as:a},u),pi.set(b,i),f.querySelector(_)!==null||a==="style"&&f.querySelector(mu(b))||a==="script"&&f.querySelector(pu(b))||(a=f.createElement("link"),is(a,"link",i),$r(a),f.head.appendChild(a)))}}function FD(i,a){Zn.m(i,a);var u=Vl;if(u&&i){var f=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+oi(f)+'"][href="'+oi(i)+'"]',b=_;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Yl(i)}if(!pi.has(b)&&(i=g({rel:"modulepreload",href:i},a),pi.set(b,i),u.querySelector(_)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(pu(b)))return}f=u.createElement("link"),is(f,"link",i),$r(f),u.head.appendChild(f)}}}function qD(i,a,u){Zn.S(i,a,u);var f=Vl;if(f&&i){var _=Es(f).hoistableStyles,b=Gl(i);a=a||"default";var j=_.get(b);if(!j){var I={loading:0,preload:null};if(j=f.querySelector(mu(b)))I.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":a},u),(u=pi.get(b))&&mv(i,u);var K=j=f.createElement("link");$r(K),is(K,"link",i),K._p=new Promise(function(ae,he){K.onload=ae,K.onerror=he}),K.addEventListener("load",function(){I.loading|=1}),K.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Lh(j,a,f)}j={type:"stylesheet",instance:j,count:1,state:I},_.set(b,j)}}}function WD(i,a){Zn.X(i,a);var u=Vl;if(u&&i){var f=Es(u).hoistableScripts,_=Yl(i),b=f.get(_);b||(b=u.querySelector(pu(_)),b||(i=g({src:i,async:!0},a),(a=pi.get(_))&&pv(i,a),b=u.createElement("script"),$r(b),is(b,"link",i),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(_,b))}}function VD(i,a){Zn.M(i,a);var u=Vl;if(u&&i){var f=Es(u).hoistableScripts,_=Yl(i),b=f.get(_);b||(b=u.querySelector(pu(_)),b||(i=g({src:i,async:!0,type:"module"},a),(a=pi.get(_))&&pv(i,a),b=u.createElement("script"),$r(b),is(b,"link",i),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},f.set(_,b))}}function AS(i,a,u,f){var _=(_=de.current)?Dh(_):null;if(!_)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Gl(u.href),u=Es(_).hoistableStyles,f=u.get(a),f||(f={type:"style",instance:null,count:0,state:null},u.set(a,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){i=Gl(u.href);var b=Es(_).hoistableStyles,j=b.get(i);if(j||(_=_.ownerDocument||_,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(i,j),(b=_.querySelector(mu(i)))&&!b._p&&(j.instance=b,j.state.loading=5),pi.has(i)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},pi.set(i,u),b||GD(_,i,u,j.state))),a&&f===null)throw Error(s(528,""));return j}if(a&&f!==null)throw Error(s(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Yl(u),u=Es(_).hoistableScripts,f=u.get(a),f||(f={type:"script",instance:null,count:0,state:null},u.set(a,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function Gl(i){return'href="'+oi(i)+'"'}function mu(i){return'link[rel="stylesheet"]['+i+"]"}function TS(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function GD(i,a,u,f){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?f.loading=1:(a=i.createElement("link"),f.preload=a,a.addEventListener("load",function(){return f.loading|=1}),a.addEventListener("error",function(){return f.loading|=2}),is(a,"link",u),$r(a),i.head.appendChild(a))}function Yl(i){return'[src="'+oi(i)+'"]'}function pu(i){return"script[async]"+i}function MS(i,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var f=i.querySelector('style[data-href~="'+oi(u.href)+'"]');if(f)return a.instance=f,$r(f),f;var _=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),$r(f),is(f,"style",_),Lh(f,u.precedence,i),a.instance=f;case"stylesheet":_=Gl(u.href);var b=i.querySelector(mu(_));if(b)return a.state.loading|=4,a.instance=b,$r(b),b;f=TS(u),(_=pi.get(_))&&mv(f,_),b=(i.ownerDocument||i).createElement("link"),$r(b);var j=b;return j._p=new Promise(function(I,K){j.onload=I,j.onerror=K}),is(b,"link",f),a.state.loading|=4,Lh(b,u.precedence,i),a.instance=b;case"script":return b=Yl(u.src),(_=i.querySelector(pu(b)))?(a.instance=_,$r(_),_):(f=u,(_=pi.get(b))&&(f=g({},u),pv(f,_)),i=i.ownerDocument||i,_=i.createElement("script"),$r(_),is(_,"link",f),i.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(f=a.instance,a.state.loading|=4,Lh(f,u.precedence,i));return a.instance}function Lh(i,a,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=f.length?f[f.length-1]:null,b=_,j=0;j<f.length;j++){var I=f[j];if(I.dataset.precedence===a)b=I;else if(b!==_)break}b?b.parentNode.insertBefore(i,b.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(i,a.firstChild))}function mv(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function pv(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var Oh=null;function DS(i,a,u){if(Oh===null){var f=new Map,_=Oh=new Map;_.set(u,f)}else _=Oh,f=_.get(u),f||(f=new Map,_.set(u,f));if(f.has(i))return f;for(f.set(i,null),u=u.getElementsByTagName(i),_=0;_<u.length;_++){var b=u[_];if(!(b[dt]||b[$t]||i==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var j=b.getAttribute(a)||"";j=i+j;var I=f.get(j);I?I.push(b):f.set(j,[b])}}return f}function LS(i,a,u){i=i.ownerDocument||i,i.head.insertBefore(u,a==="title"?i.querySelector("head > title"):null)}function YD(i,a,u){if(u===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return i=a.disabled,typeof a.precedence=="string"&&i==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function OS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function KD(i,a,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var _=Gl(f.href),b=a.querySelector(mu(_));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=Bh.bind(i),a.then(i,i)),u.state.loading|=4,u.instance=b,$r(b);return}b=a.ownerDocument||a,f=TS(f),(_=pi.get(_))&&mv(f,_),b=b.createElement("link"),$r(b);var j=b;j._p=new Promise(function(I,K){j.onload=I,j.onerror=K}),is(b,"link",f),u.instance=b}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(i.count++,u=Bh.bind(i),a.addEventListener("load",u),a.addEventListener("error",u))}}var gv=0;function XD(i,a){return i.stylesheets&&i.count===0&&Ih(i,i.stylesheets),0<i.count||0<i.imgCount?function(u){var f=setTimeout(function(){if(i.stylesheets&&Ih(i,i.stylesheets),i.unsuspend){var b=i.unsuspend;i.unsuspend=null,b()}},6e4+a);0<i.imgBytes&&gv===0&&(gv=62500*AD());var _=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Ih(i,i.stylesheets),i.unsuspend)){var b=i.unsuspend;i.unsuspend=null,b()}},(i.imgBytes>gv?50:800)+a);return i.unsuspend=u,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(_)}}:null}function Bh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ih(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Ph=null;function Ih(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Ph=new Map,a.forEach(ZD,i),Ph=null,Bh.call(i))}function ZD(i,a){if(!(a.state.loading&4)){var u=Ph.get(i);if(u)var f=u.get(null);else{u=new Map,Ph.set(i,u);for(var _=i.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<_.length;b++){var j=_[b];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(u.set(j.dataset.precedence,j),f=j)}f&&u.set(null,f)}_=a.instance,j=_.getAttribute("data-precedence"),b=u.get(j)||f,b===f&&u.set(null,_),u.set(j,_),this.count++,f=Bh.bind(this),_.addEventListener("load",f),_.addEventListener("error",f),b?b.parentNode.insertBefore(_,b.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(_,i.firstChild)),a.state.loading|=4}}var gu={$$typeof:N,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function QD(i,a,u,f,_,b,j,I,K){this.tag=1,this.containerInfo=i,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=Cs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cs(0),this.hiddenUpdates=Cs(null),this.identifierPrefix=f,this.onUncaughtError=_,this.onCaughtError=b,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function BS(i,a,u,f,_,b,j,I,K,ae,he,ge){return i=new QD(i,a,u,j,K,ae,he,ge,I),a=1,b===!0&&(a|=24),b=Us(3,null,null,a),i.current=b,b.stateNode=i,a=Kp(),a.refCount++,i.pooledCache=a,a.refCount++,b.memoizedState={element:f,isDehydrated:u,cache:a},Jp(b),i}function PS(i){return i?(i=kl,i):kl}function IS(i,a,u,f,_,b){_=PS(_),f.context===null?f.context=_:f.pendingContext=_,f=ka(a),f.payload={element:u},b=b===void 0?null:b,b!==null&&(f.callback=b),u=Ea(i,f,a),u!==null&&(Ms(u,i,a),Yc(u,i,a))}function zS(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u<a?u:a}}function vv(i,a){zS(i,a),(i=i.alternate)&&zS(i,a)}function $S(i){if(i.tag===13||i.tag===31){var a=Eo(i,67108864);a!==null&&Ms(a,i,67108864),vv(i,67108864)}}function US(i){if(i.tag===13||i.tag===31){var a=Vs();a=Pi(a);var u=Eo(i,a);u!==null&&Ms(u,i,a),vv(i,a)}}var zh=!0;function JD(i,a,u,f){var _=A.T;A.T=null;var b=O.p;try{O.p=2,_v(i,a,u,f)}finally{O.p=b,A.T=_}}function eL(i,a,u,f){var _=A.T;A.T=null;var b=O.p;try{O.p=8,_v(i,a,u,f)}finally{O.p=b,A.T=_}}function _v(i,a,u,f){if(zh){var _=xv(f);if(_===null)iv(i,a,f,$h,u),FS(i,f);else if(rL(_,i,a,u,f))f.stopPropagation();else if(FS(i,f),a&4&&-1<tL.indexOf(i)){for(;_!==null;){var b=ks(_);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var j=vr(b.pendingLanes);if(j!==0){var I=b;for(I.pendingLanes|=2,I.entangledLanes|=2;j;){var K=1<<31-Ht(j);I.entanglements[1]|=K,j&=~K}cn(b),(Rt&6)===0&&(wh=He()+500,uu(0))}}break;case 31:case 13:I=Eo(b,2),I!==null&&Ms(I,b,2),Ch(),vv(b,2)}if(b=xv(f),b===null&&iv(i,a,f,$h,u),b===_)break;_=b}_!==null&&f.stopPropagation()}else iv(i,a,f,null,u)}}function xv(i){return i=bp(i),yv(i)}var $h=null;function yv(i){if($h=null,i=Kt(i),i!==null){var a=l(i);if(a===null)i=null;else{var u=a.tag;if(u===13){if(i=c(a),i!==null)return i;i=null}else if(u===31){if(i=d(a),i!==null)return i;i=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return $h=i,null}function HS(i){switch(i){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(Nt()){case Ct:return 2;case gs:return 8;case cs:case gr:return 32;case kt:return 268435456;default:return 32}default:return 32}}var bv=!1,Pa=null,Ia=null,za=null,vu=new Map,_u=new Map,$a=[],tL="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 FS(i,a){switch(i){case"focusin":case"focusout":Pa=null;break;case"dragenter":case"dragleave":Ia=null;break;case"mouseover":case"mouseout":za=null;break;case"pointerover":case"pointerout":vu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":_u.delete(a.pointerId)}}function xu(i,a,u,f,_,b){return i===null||i.nativeEvent!==b?(i={blockedOn:a,domEventName:u,eventSystemFlags:f,nativeEvent:b,targetContainers:[_]},a!==null&&(a=ks(a),a!==null&&$S(a)),i):(i.eventSystemFlags|=f,a=i.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),i)}function rL(i,a,u,f,_){switch(a){case"focusin":return Pa=xu(Pa,i,a,u,f,_),!0;case"dragenter":return Ia=xu(Ia,i,a,u,f,_),!0;case"mouseover":return za=xu(za,i,a,u,f,_),!0;case"pointerover":var b=_.pointerId;return vu.set(b,xu(vu.get(b)||null,i,a,u,f,_)),!0;case"gotpointercapture":return b=_.pointerId,_u.set(b,xu(_u.get(b)||null,i,a,u,f,_)),!0}return!1}function qS(i){var a=Kt(i.target);if(a!==null){var u=l(a);if(u!==null){if(a=u.tag,a===13){if(a=c(u),a!==null){i.blockedOn=a,bo(i.priority,function(){US(u)});return}}else if(a===31){if(a=d(u),a!==null){i.blockedOn=a,bo(i.priority,function(){US(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){i.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Uh(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var u=xv(i.nativeEvent);if(u===null){u=i.nativeEvent;var f=new u.constructor(u.type,u);yp=f,u.target.dispatchEvent(f),yp=null}else return a=ks(u),a!==null&&$S(a),i.blockedOn=u,!1;a.shift()}return!0}function WS(i,a,u){Uh(i)&&u.delete(a)}function sL(){bv=!1,Pa!==null&&Uh(Pa)&&(Pa=null),Ia!==null&&Uh(Ia)&&(Ia=null),za!==null&&Uh(za)&&(za=null),vu.forEach(WS),_u.forEach(WS)}function Hh(i,a){i.blockedOn===a&&(i.blockedOn=null,bv||(bv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,sL)))}var Fh=null;function VS(i){Fh!==i&&(Fh=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fh===i&&(Fh=null);for(var a=0;a<i.length;a+=3){var u=i[a],f=i[a+1],_=i[a+2];if(typeof f!="function"){if(yv(f||u)===null)continue;break}var b=ks(u);b!==null&&(i.splice(a,3),a-=3,xg(b,{pending:!0,data:_,method:u.method,action:f},f,_))}}))}function Kl(i){function a(K){return Hh(K,i)}Pa!==null&&Hh(Pa,i),Ia!==null&&Hh(Ia,i),za!==null&&Hh(za,i),vu.forEach(a),_u.forEach(a);for(var u=0;u<$a.length;u++){var f=$a[u];f.blockedOn===i&&(f.blockedOn=null)}for(;0<$a.length&&(u=$a[0],u.blockedOn===null);)qS(u),u.blockedOn===null&&$a.shift();if(u=(i.ownerDocument||i).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var _=u[f],b=u[f+1],j=_[ct]||null;if(typeof b=="function")j||VS(u);else if(j){var I=null;if(b&&b.hasAttribute("formAction")){if(_=b,j=b[ct]||null)I=j.formAction;else if(yv(_)!==null)continue}else I=j.action;typeof I=="function"?u[f+1]=I:(u.splice(f,3),f-=3),VS(u)}}}function GS(){function i(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(j){return _=j})},focusReset:"manual",scroll:"manual"})}function a(){_!==null&&(_(),_=null),f||setTimeout(u,20)}function u(){if(!f&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,_=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),_!==null&&(_(),_=null)}}}function wv(i){this._internalRoot=i}qh.prototype.render=wv.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(s(409));var u=a.current,f=Vs();IS(u,f,i,a,null,null)},qh.prototype.unmount=wv.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;IS(i.current,2,null,i,null,null),Ch(),a[Ii]=null}};function qh(i){this._internalRoot=i}qh.prototype.unstable_scheduleHydration=function(i){if(i){var a=Dn();i={blockedOn:null,target:i,priority:a};for(var u=0;u<$a.length&&a!==0&&a<$a[u].priority;u++);$a.splice(u,0,i),u===0&&qS(i)}};var YS=t.version;if(YS!=="19.2.7")throw Error(s(527,YS,"19.2.7"));O.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(a),i=i!==null?v(i):null,i=i===null?null:i.stateNode,i};var iL={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wh.isDisabled&&Wh.supportsFiber)try{zs=Wh.inject(iL),Mr=Wh}catch{}}return bu.createRoot=function(i,a){if(!n(i))throw Error(s(299));var u=!1,f="",_=tw,b=rw,j=sw;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(_=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=BS(i,1,!1,null,null,u,f,null,_,b,j,GS),i[Ii]=a.current,sv(i),new wv(a)},bu.hydrateRoot=function(i,a,u){if(!n(i))throw Error(s(299));var f=!1,_="",b=tw,j=rw,I=sw,K=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(_=u.identifierPrefix),u.onUncaughtError!==void 0&&(b=u.onUncaughtError),u.onCaughtError!==void 0&&(j=u.onCaughtError),u.onRecoverableError!==void 0&&(I=u.onRecoverableError),u.formState!==void 0&&(K=u.formState)),a=BS(i,1,!0,a,u??null,f,_,K,b,j,I,GS),a.context=PS(null),u=a.current,f=Vs(),f=Pi(f),_=ka(f),_.callback=null,Ea(u,_,f),u=f,a.current.lanes=u,st(a,u),cn(a),i[Ii]=a.current,sv(i),new qh(a)},bu.version="19.2.7",bu}var iC;function gL(){if(iC)return kv.exports;iC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),kv.exports=pL(),kv.exports}var vL=gL();/**
51
+ * react-router v7.18.1
52
+ *
53
+ * Copyright (c) Remix Software Inc.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE.md file in the root directory of this source tree.
57
+ *
58
+ * @license MIT
59
+ */var C0=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Qk=/^[\\/]{2}/;function _L(e,t){return t+e.replace(/\\/g,"/")}var nC="popstate";function aC(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function xL(e={}){function t(s,n){var h;let l=(h=n.state)==null?void 0:h.masked,{pathname:c,search:d,hash:m}=l||s.location;return F_("",{pathname:c,search:d,hash:m},n.state&&n.state.usr||null,n.state&&n.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,n){return typeof n=="string"?n:ed(n)}return bL(t,r,null,e)}function Tr(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ri(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function yL(){return Math.random().toString(36).substring(2,10)}function oC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function F_(e,t,r=null,s,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?pd(t):t,state:r,key:t&&t.key||s||yL(),mask:n}}function ed({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function pd(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function bL(e,t,r,s={}){let{window:n=document.defaultView,v5Compat:l=!1}=s,c=n.history,d="POP",m=null,h=v();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function v(){return(c.state||{idx:null}).idx}function g(){d="POP";let k=v(),C=k==null?null:k-h;h=k,m&&m({action:d,location:S.location,delta:C})}function x(k,C){d="PUSH";let E=aC(k)?k:F_(S.location,k,C);h=v()+1;let N=oC(E,h),R=S.createHref(E.mask||E);try{c.pushState(N,"",R)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;n.location.assign(R)}l&&m&&m({action:d,location:S.location,delta:1})}function y(k,C){d="REPLACE";let E=aC(k)?k:F_(S.location,k,C);h=v();let N=oC(E,h),R=S.createHref(E.mask||E);c.replaceState(N,"",R),l&&m&&m({action:d,location:S.location,delta:0})}function w(k){return wL(n,k)}let S={get action(){return d},get location(){return e(n,c)},listen(k){if(m)throw new Error("A history only accepts one active listener");return n.addEventListener(nC,g),m=k,()=>{n.removeEventListener(nC,g),m=null}},createHref(k){return t(n,k)},createURL:w,encodeLocation(k){let C=w(k);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:y,go(k){return c.go(k)}};return S}function wL(e,t,r=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),Tr(s,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:ed(t);return n=n.replace(/ $/,"%20"),!r&&Qk.test(n)&&(n=s+n),new URL(n,s)}function Jk(e,t,r="/"){return SL(e,t,r,!1)}function SL(e,t,r,s,n){let l=typeof t=="string"?pd(t):t,c=oa(l.pathname||"/",r);if(c==null)return null;let d=CL(e),m=null,h=OL(c);for(let v=0;m==null&&v<d.length;++v)m=LL(d[v],h,s);return m}function CL(e){let t=eE(e);return kL(t),t}function eE(e,t=[],r=[],s="",n=!1){let l=(c,d,m=n,h)=>{let v={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&m)return;Tr(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let g=Vi([s,v.relativePath]),x=r.concat(v);c.children&&c.children.length>0&&(Tr(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),eE(c.children,t,x,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:ML(g,c.index),routesMeta:x.map((y,w)=>{let[S,k]=sE(y.relativePath,y.caseSensitive,w===x.length-1);return{...y,matcher:S,compiledParams:k}})})};return e.forEach((c,d)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))l(c,d);else for(let h of tE(c.path))l(c,d,!0,h)}),t}function tE(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,n=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return n?[l,""]:[l];let c=tE(s.join("/")),d=[];return d.push(...c.map(m=>m===""?l:[l,m].join("/"))),n&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function kL(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:DL(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}var EL=/^:[\w-]+$/,RL=3,NL=2,jL=1,AL=10,TL=-2,lC=e=>e==="*";function ML(e,t){let r=e.split("/"),s=r.length;return r.some(lC)&&(s+=TL),t&&(s+=NL),r.filter(n=>!lC(n)).reduce((n,l)=>n+(EL.test(l)?RL:l===""?jL:AL),s)}function DL(e,t){return e.length===t.length&&e.slice(0,-1).every((s,n)=>s===t[n])?e[e.length-1]-t[t.length-1]:0}function LL(e,t,r=!1){let{routesMeta:s}=e,n={},l="/",c=[];for(let d=0;d<s.length;++d){let m=s[d],h=d===s.length-1,v=l==="/"?t:t.slice(l.length)||"/",g={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},x=m.matcher&&m.compiledParams?rE(g,v,m.matcher,m.compiledParams):Wf(g,v),y=m.route;if(!x&&h&&r&&!s[s.length-1].route.index&&(x=Wf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!x)return null;Object.assign(n,x.params),c.push({params:n,pathname:Vi([l,x.pathname]),pathnameBase:IL(Vi([l,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(l=Vi([l,x.pathnameBase]))}return c}function Wf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=sE(e.path,e.caseSensitive,e.end);return rE(e,t,r,s)}function rE(e,t,r,s){let n=t.match(r);if(!n)return null;let l=n[0],c=l.replace(/(.)\/+$/,"$1"),d=n.slice(1);return{params:s.reduce((h,{paramName:v,isOptional:g},x)=>{if(v==="*"){let w=d[x]||"";c=l.slice(0,l.length-w.length).replace(/(.)\/+$/,"$1")}const y=d[x];return g&&!y?h[v]=void 0:h[v]=(y||"").replace(/%2F/g,"/"),h},{}),pathname:l,pathnameBase:c,pattern:e}}function sE(e,t=!1,r=!0){Ri(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m,h,v)=>{if(s.push({paramName:d,isOptional:m!=null}),m){let g=v.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),s]}function OL(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ri(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function oa(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}function BL(e,t="/"){let{pathname:r,search:s="",hash:n=""}=typeof e=="string"?pd(e):e,l;return r?(r=iE(r),r.startsWith("/")?l=cC(r.substring(1),"/"):l=cC(r,t)):l=t,{pathname:l,search:zL(s),hash:$L(n)}}function cC(e,t){let r=Vf(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function jv(e,t,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function PL(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function k0(e){let t=PL(e);return t.map((r,s)=>s===t.length-1?r.pathname:r.pathnameBase)}function bm(e,t,r,s=!1){let n;typeof e=="string"?n=pd(e):(n={...e},Tr(!n.pathname||!n.pathname.includes("?"),jv("?","pathname","search",n)),Tr(!n.pathname||!n.pathname.includes("#"),jv("#","pathname","hash",n)),Tr(!n.search||!n.search.includes("#"),jv("#","search","hash",n)));let l=e===""||n.pathname==="",c=l?"/":n.pathname,d;if(c==null)d=r;else{let g=t.length-1;if(!s&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;n.pathname=x.join("/")}d=g>=0?t[g]:"/"}let m=BL(n,d),h=c&&c!=="/"&&c.endsWith("/"),v=(l||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||v)&&(m.pathname+="/"),m}var iE=e=>e.replace(/[\\/]{2,}/g,"/"),Vi=e=>iE(e.join("/")),Vf=e=>e.replace(/\/+$/,""),IL=e=>Vf(e).replace(/^\/*/,"/"),zL=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$L=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,UL=class{constructor(e,t,r,s=!1){this.status=e,this.statusText=t||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function HL(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FL(e){let t=e.map(r=>r.route.path).filter(Boolean);return Vi(t)||"/"}var nE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function aE(e,t){let r=e;if(typeof r!="string"||!C0.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,n=!1;if(nE)try{let l=new URL(window.location.href),c=Qk.test(r)?new URL(_L(r,l.protocol)):new URL(r),d=oa(c.pathname,t);c.origin===l.origin&&d!=null?r=d+c.search+c.hash:n=!0}catch{Ri(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:n,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var oE=["POST","PUT","PATCH","DELETE"];new Set(oE);var qL=["GET",...oE];new Set(qL);var WL=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function VL(e){try{return WL.includes(new URL(e).protocol)}catch{return!1}}var bc=p.createContext(null);bc.displayName="DataRouter";var wm=p.createContext(null);wm.displayName="DataRouterState";var lE=p.createContext(!1);function GL(){return p.useContext(lE)}var cE=p.createContext({isTransitioning:!1});cE.displayName="ViewTransition";var YL=p.createContext(new Map);YL.displayName="Fetchers";var KL=p.createContext(null);KL.displayName="Await";var ei=p.createContext(null);ei.displayName="Navigation";var Sm=p.createContext(null);Sm.displayName="Location";var Ji=p.createContext({outlet:null,matches:[],isDataRoute:!1});Ji.displayName="Route";var E0=p.createContext(null);E0.displayName="RouteError";var uE="REACT_ROUTER_ERROR",XL="REDIRECT",ZL="ROUTE_ERROR_RESPONSE";function QL(e){if(e.startsWith(`${uE}:${XL}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function JL(e){if(e.startsWith(`${uE}:${ZL}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new UL(t.status,t.statusText,t.data)}catch{}}function e4(e,{relative:t}={}){Tr(wc(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=p.useContext(ei),{hash:n,pathname:l,search:c}=gd(e,{relative:t}),d=l;return r!=="/"&&(d=l==="/"?r:Vi([r,l])),s.createHref({pathname:d,search:c,hash:n})}function wc(){return p.useContext(Sm)!=null}function Qr(){return Tr(wc(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Sm).location}var dE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hE(e){p.useContext(ei).static||p.useLayoutEffect(e)}function mo(){let{isDataRoute:e}=p.useContext(Ji);return e?f4():t4()}function t4(){Tr(wc(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(bc),{basename:t,navigator:r}=p.useContext(ei),{matches:s}=p.useContext(Ji),{pathname:n}=Qr(),l=JSON.stringify(k0(s)),c=p.useRef(!1);return hE(()=>{c.current=!0}),p.useCallback((m,h={})=>{if(Ri(c.current,dE),!c.current)return;if(typeof m=="number"){r.go(m);return}let v=bm(m,JSON.parse(l),n,h.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:Vi([t,v.pathname])),(h.replace?r.replace:r.push)(v,h.state,h)},[t,r,l,n,e])}p.createContext(null);function fE(){let{matches:e}=p.useContext(Ji),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function gd(e,{relative:t}={}){let{matches:r}=p.useContext(Ji),{pathname:s}=Qr(),n=JSON.stringify(k0(r));return p.useMemo(()=>bm(e,JSON.parse(n),s,t==="path"),[e,n,s,t])}function r4(e,t){return mE(e)}function mE(e,t,r){Tr(wc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=p.useContext(ei),{matches:n}=p.useContext(Ji),l=n[n.length-1],c=l?l.params:{},d=l?l.pathname:"/",m=l?l.pathnameBase:"/",h=l&&l.route;{let k=h&&h.path||"";gE(d,!h||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
+
61
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let v=Qr(),g;g=v;let x=g.pathname||"/",y=x;if(m!=="/"){let k=m.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(k.length).join("/")}let w=r&&r.state.matches.length?r.state.matches.map(k=>Object.assign(k,{route:r.manifest[k.route.id]||k.route})):Jk(e,{pathname:y});return Ri(h||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Ri(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),o4(w&&w.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Vi([m,s.encodeLocation?s.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?m:Vi([m,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),n,r)}function s4(){let e=h4(),t=HL(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:l},"ErrorBoundary")," or"," ",p.createElement("code",{style:l},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),r?p.createElement("pre",{style:n},r):null,c)}var i4=p.createElement(s4,null),pE=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=JL(e.digest);r&&(e=r)}let t=e!==void 0?p.createElement(Ji.Provider,{value:this.props.routeContext},p.createElement(E0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(n4,{error:e},t):t}};pE.contextType=lE;var Av=new WeakMap;function n4({children:e,error:t}){let{basename:r}=p.useContext(ei);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=QL(t.digest);if(s){let n=Av.get(t);if(n)throw n;let l=aE(s.location,r),c=l.absoluteURL||l.to;if(VL(c))throw new Error("Invalid redirect location");if(nE&&!Av.get(t))if(l.isExternal||s.reloadDocument)window.location.href=c;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw Av.set(t,d),d}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return e}function a4({routeContext:e,match:t,children:r}){let s=p.useContext(bc);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),p.createElement(Ji.Provider,{value:e},r)}function o4(e,t=[],r){let s=r==null?void 0:r.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let n=e,l=s==null?void 0:s.errors;if(l!=null){let v=n.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);Tr(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),n=n.slice(0,Math.min(n.length,v+1))}let c=!1,d=-1;if(r&&s){c=s.renderFallback;for(let v=0;v<n.length;v++){let g=n[v];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(d=v),g.route.id){let{loaderData:x,errors:y}=s,w=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!y||y[g.route.id]===void 0);if(g.route.lazy||w){r.isStatic&&(c=!0),d>=0?n=n.slice(0,d+1):n=[n[0]];break}}}}let m=r==null?void 0:r.onError,h=s&&m?(v,g)=>{var x,y;m(v,{location:s.location,params:((y=(x=s.matches)==null?void 0:x[0])==null?void 0:y.params)??{},pattern:FL(s.matches),errorInfo:g})}:void 0;return n.reduceRight((v,g,x)=>{let y,w=!1,S=null,k=null;s&&(y=l&&g.route.id?l[g.route.id]:void 0,S=g.route.errorElement||i4,c&&(d<0&&x===0?(gE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,k=null):d===x&&(w=!0,k=g.route.hydrateFallbackElement||null)));let C=t.concat(n.slice(0,x+1)),E=()=>{let N;return y?N=S:w?N=k:g.route.Component?N=p.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=v,p.createElement(a4,{match:g,routeContext:{outlet:v,matches:C,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?p.createElement(pE,{location:s.location,revalidation:s.revalidation,component:S,error:y,children:E(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):E()},null)}function R0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function l4(e){let t=p.useContext(bc);return Tr(t,R0(e)),t}function c4(e){let t=p.useContext(wm);return Tr(t,R0(e)),t}function u4(e){let t=p.useContext(Ji);return Tr(t,R0(e)),t}function N0(e){let t=u4(e),r=t.matches[t.matches.length-1];return Tr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function d4(){return N0("useRouteId")}function h4(){var s;let e=p.useContext(E0),t=c4("useRouteError"),r=N0("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[r]}function f4(){let{router:e}=l4("useNavigate"),t=N0("useNavigate"),r=p.useRef(!1);return hE(()=>{r.current=!0}),p.useCallback(async(n,l={})=>{Ri(r.current,dE),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...l}))},[e,t])}var uC={};function gE(e,t,r){!t&&!uC[e]&&(uC[e]=!0,Ri(!1,r))}p.memo(m4);function m4({routes:e,manifest:t,future:r,state:s,isStatic:n,onError:l}){return mE(e,void 0,{manifest:t,state:s,isStatic:n,onError:l})}function Qa({to:e,replace:t,state:r,relative:s}){Tr(wc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n}=p.useContext(ei);Ri(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=p.useContext(Ji),{pathname:c}=Qr(),d=mo(),m=bm(e,k0(l),c,s==="path"),h=JSON.stringify(m);return p.useEffect(()=>{d(JSON.parse(h),{replace:t,state:r,relative:s})},[d,h,s,t,r]),null}function p4({basename:e="/",children:t=null,location:r,navigationType:s="POP",navigator:n,static:l=!1,useTransitions:c}){Tr(!wc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=p.useMemo(()=>({basename:d,navigator:n,static:l,useTransitions:c,future:{}}),[d,n,l,c]);typeof r=="string"&&(r=pd(r));let{pathname:h="/",search:v="",hash:g="",state:x=null,key:y="default",mask:w}=r,S=p.useMemo(()=>{let k=oa(h,d);return k==null?null:{location:{pathname:k,search:v,hash:g,state:x,key:y,mask:w},navigationType:s}},[d,h,v,g,x,y,s,w]);return Ri(S!=null,`<Router basename="${d}"> is not able to match the URL "${h}${v}${g}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:p.createElement(ei.Provider,{value:m},p.createElement(Sm.Provider,{children:t,value:S}))}var Cf="get",kf="application/x-www-form-urlencoded";function Cm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function g4(e){return Cm(e)&&e.tagName.toLowerCase()==="button"}function v4(e){return Cm(e)&&e.tagName.toLowerCase()==="form"}function _4(e){return Cm(e)&&e.tagName.toLowerCase()==="input"}function x4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function y4(e,t){return e.button===0&&(!t||t==="_self")&&!x4(e)}function q_(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let s=e[r];return t.concat(Array.isArray(s)?s.map(n=>[r,n]):[[r,s]])},[]))}function b4(e,t){let r=q_(e);return t&&t.forEach((s,n)=>{r.has(n)||t.getAll(n).forEach(l=>{r.append(n,l)})}),r}var Vh=null;function w4(){if(Vh===null)try{new FormData(document.createElement("form"),0),Vh=!1}catch{Vh=!0}return Vh}var S4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Tv(e){return e!=null&&!S4.has(e)?(Ri(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${kf}"`),null):e}function C4(e,t){let r,s,n,l,c;if(v4(e)){let d=e.getAttribute("action");s=d?oa(d,t):null,r=e.getAttribute("method")||Cf,n=Tv(e.getAttribute("enctype"))||kf,l=new FormData(e)}else if(g4(e)||_4(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||d.getAttribute("action");if(s=m?oa(m,t):null,r=e.getAttribute("formmethod")||d.getAttribute("method")||Cf,n=Tv(e.getAttribute("formenctype"))||Tv(d.getAttribute("enctype"))||kf,l=new FormData(d,e),!w4()){let{name:h,type:v,value:g}=e;if(v==="image"){let x=h?`${h}.`:"";l.append(`${x}x`,"0"),l.append(`${x}y`,"0")}else h&&l.append(h,g)}}else{if(Cm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Cf,s=null,n=kf,c=e}return l&&n==="text/plain"&&(c=l,l=void 0),{action:s,method:r.toLowerCase(),encType:n,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function j0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vE(e,t,r,s){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${s}`:n.pathname=`${n.pathname}.${s}`:n.pathname==="/"?n.pathname=`_root.${s}`:t&&oa(n.pathname,t)==="/"?n.pathname=`${Vf(t)}/_root.${s}`:n.pathname=`${Vf(n.pathname)}.${s}`,n}async function k4(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function E4(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function R4(e,t,r){let s=await Promise.all(e.map(async n=>{let l=t.routes[n.route.id];if(l){let c=await k4(l,r);return c.links?c.links():[]}return[]}));return T4(s.flat(1).filter(E4).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function dC(e,t,r,s,n,l){let c=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,d=(m,h)=>{var v;return r[h].pathname!==m.pathname||((v=r[h].route.path)==null?void 0:v.endsWith("*"))&&r[h].params["*"]!==m.params["*"]};return l==="assets"?t.filter((m,h)=>c(m,h)||d(m,h)):l==="data"?t.filter((m,h)=>{var g;let v=s.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(c(m,h)||d(m,h))return!0;if(m.route.shouldRevalidate){let x=m.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function N4(e,t,{includeHydrateFallback:r}={}){return j4(e.map(s=>{let n=t.routes[s.route.id];if(!n)return[];let l=[n.module];return n.clientActionModule&&(l=l.concat(n.clientActionModule)),n.clientLoaderModule&&(l=l.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(l=l.concat(n.hydrateFallbackModule)),n.imports&&(l=l.concat(n.imports)),l}).flat(1))}function j4(e){return[...new Set(e)]}function A4(e){let t={},r=Object.keys(e).sort();for(let s of r)t[s]=e[s];return t}function T4(e,t){let r=new Set;return new Set(t),e.reduce((s,n)=>{let l=JSON.stringify(A4(n));return r.has(l)||(r.add(l),s.push({key:l,link:n})),s},[])}function A0(){let e=p.useContext(bc);return j0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function M4(){let e=p.useContext(wm);return j0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var T0=p.createContext(void 0);T0.displayName="FrameworkContext";function km(){let e=p.useContext(T0);return j0(e,"You must render this element inside a <HydratedRouter> element"),e}function D4(e,t){let r=p.useContext(T0),[s,n]=p.useState(!1),[l,c]=p.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:h,onMouseLeave:v,onTouchStart:g}=t,x=p.useRef(null);p.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let S=C=>{C.forEach(E=>{c(E.isIntersecting)})},k=new IntersectionObserver(S,{threshold:.5});return x.current&&k.observe(x.current),()=>{k.disconnect()}}},[e]),p.useEffect(()=>{if(s){let S=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(S)}}},[s]);let y=()=>{n(!0)},w=()=>{n(!1),c(!1)};return r?e!=="intent"?[l,x,{}]:[l,x,{onFocus:wu(d,y),onBlur:wu(m,w),onMouseEnter:wu(h,y),onMouseLeave:wu(v,w),onTouchStart:wu(g,y)}]:[!1,x,{}]}function wu(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function L4({page:e,...t}){let r=GL(),{nonce:s}=km(),{router:n}=A0(),l=p.useMemo(()=>Jk(n.routes,e,n.basename),[n.routes,e,n.basename]);return l?(t.nonce==null&&s&&(t={...t,nonce:s}),r?p.createElement(B4,{page:e,matches:l,...t}):p.createElement(P4,{page:e,matches:l,...t})):null}function O4(e){let{manifest:t,routeModules:r}=km(),[s,n]=p.useState([]);return p.useEffect(()=>{let l=!1;return R4(e,t,r).then(c=>{l||n(c)}),()=>{l=!0}},[e,t,r]),s}function B4({page:e,matches:t,...r}){let s=Qr(),{future:n}=km(),{basename:l}=A0(),c=p.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let d=vE(e,l,n.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?m=!0:h.push(v.route.id);return m&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[l,n.v8_trailingSlashAwareDataRequests,e,s,t]);return p.createElement(p.Fragment,null,c.map(d=>p.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...r})))}function P4({page:e,matches:t,...r}){let s=Qr(),{future:n,manifest:l,routeModules:c}=km(),{basename:d}=A0(),{loaderData:m,matches:h}=M4(),v=p.useMemo(()=>dC(e,t,h,l,s,"data"),[e,t,h,l,s]),g=p.useMemo(()=>dC(e,t,h,l,s,"assets"),[e,t,h,l,s]),x=p.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let S=new Set,k=!1;if(t.forEach(E=>{var R;let N=l.routes[E.route.id];!N||!N.hasLoader||(!v.some(T=>T.route.id===E.route.id)&&E.route.id in m&&((R=c[E.route.id])!=null&&R.shouldRevalidate)||N.hasClientLoader?k=!0:S.add(E.route.id))}),S.size===0)return[];let C=vE(e,d,n.v8_trailingSlashAwareDataRequests,"data");return k&&S.size>0&&C.searchParams.set("_routes",t.filter(E=>S.has(E.route.id)).map(E=>E.route.id).join(",")),[C.pathname+C.search]},[d,n.v8_trailingSlashAwareDataRequests,m,s,l,v,t,e,c]),y=p.useMemo(()=>N4(g,l),[g,l]),w=O4(g);return p.createElement(p.Fragment,null,x.map(S=>p.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...r})),y.map(S=>p.createElement("link",{key:S,rel:"modulepreload",href:S,...r})),w.map(({key:S,link:k})=>p.createElement("link",{key:S,nonce:r.nonce,...k,crossOrigin:k.crossOrigin??r.crossOrigin})))}function I4(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var z4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{z4&&(window.__reactRouterVersion="7.18.1")}catch{}function $4({basename:e,children:t,useTransitions:r,window:s}){let n=p.useRef();n.current==null&&(n.current=xL({window:s,v5Compat:!0}));let l=n.current,[c,d]=p.useState({action:l.action,location:l.location}),m=p.useCallback(h=>{r===!1?d(h):p.startTransition(()=>d(h))},[r]);return p.useLayoutEffect(()=>l.listen(m),[l,m]),p.createElement(p4,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,useTransitions:r})}var _E=p.forwardRef(function({onClick:t,discover:r="render",prefetch:s="none",relative:n,reloadDocument:l,replace:c,mask:d,state:m,target:h,to:v,preventScrollReset:g,viewTransition:x,defaultShouldRevalidate:y,...w},S){let{basename:k,navigator:C,useTransitions:E}=p.useContext(ei),N=typeof v=="string"&&C0.test(v),R=aE(v,k);v=R.to;let T=e4(v,{relative:n}),P=Qr(),z=null;if(d){let W=bm(d,[],P.mask?P.mask.pathname:"/",!0);k!=="/"&&(W.pathname=W.pathname==="/"?k:Vi([k,W.pathname])),z=C.createHref(W)}let[B,F,Y]=D4(s,w),q=F4(v,{replace:c,mask:d,state:m,target:h,preventScrollReset:g,relative:n,viewTransition:x,defaultShouldRevalidate:y,useTransitions:E});function $(W){t&&t(W),W.defaultPrevented||q(W)}let M=!(R.isExternal||l),U=p.createElement("a",{...w,...Y,href:(M?z:void 0)||R.absoluteURL||T,onClick:M?$:t,ref:I4(S,F),target:h,"data-discover":!N&&r==="render"?"true":void 0});return B&&!N?p.createElement(p.Fragment,null,U,p.createElement(L4,{page:T})):U});_E.displayName="Link";var eo=p.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:s="",end:n=!1,style:l,to:c,viewTransition:d,children:m,...h},v){let g=gd(c,{relative:h.relative}),x=Qr(),y=p.useContext(wm),{navigator:w,basename:S}=p.useContext(ei),k=y!=null&&K4(g)&&d===!0,C=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,E=x.pathname,N=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(E=E.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&S&&(N=oa(N,S)||N);const R=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let T=E===C||!n&&E.startsWith(C)&&E.charAt(R)==="/",P=N!=null&&(N===C||!n&&N.startsWith(C)&&N.charAt(C.length)==="/"),z={isActive:T,isPending:P,isTransitioning:k},B=T?t:void 0,F;typeof s=="function"?F=s(z):F=[s,T?"active":null,P?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let Y=typeof l=="function"?l(z):l;return p.createElement(_E,{...h,"aria-current":B,className:F,ref:v,style:Y,to:c,viewTransition:d},typeof m=="function"?m(z):m)});eo.displayName="NavLink";var U4=p.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:s,replace:n,state:l,method:c=Cf,action:d,onSubmit:m,relative:h,preventScrollReset:v,viewTransition:g,defaultShouldRevalidate:x,...y},w)=>{let{useTransitions:S}=p.useContext(ei),k=G4(),C=Y4(d,{relative:h}),E=c.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&C0.test(d),R=T=>{if(m&&m(T),T.defaultPrevented)return;T.preventDefault();let P=T.nativeEvent.submitter,z=(P==null?void 0:P.getAttribute("formmethod"))||c,B=()=>k(P||T.currentTarget,{fetcherKey:t,method:z,navigate:r,replace:n,state:l,relative:h,preventScrollReset:v,viewTransition:g,defaultShouldRevalidate:x});S&&r!==!1?p.startTransition(()=>B()):B()};return p.createElement("form",{ref:w,method:E,action:C,onSubmit:s?m:R,...y,"data-discover":!N&&e==="render"?"true":void 0})});U4.displayName="Form";function H4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xE(e){let t=p.useContext(bc);return Tr(t,H4(e)),t}function F4(e,{target:t,replace:r,mask:s,state:n,preventScrollReset:l,relative:c,viewTransition:d,defaultShouldRevalidate:m,useTransitions:h}={}){let v=mo(),g=Qr(),x=gd(e,{relative:c});return p.useCallback(y=>{if(y4(y,t)){y.preventDefault();let w=r!==void 0?r:ed(g)===ed(x),S=()=>v(e,{replace:w,mask:s,state:n,preventScrollReset:l,relative:c,viewTransition:d,defaultShouldRevalidate:m});h?p.startTransition(()=>S()):S()}},[g,v,x,r,s,n,t,e,l,c,d,m,h])}function q4(e){Ri(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=p.useRef(q_(e)),r=p.useRef(!1),s=Qr(),n=p.useMemo(()=>b4(s.search,r.current?null:t.current),[s.search]),l=mo(),c=p.useCallback((d,m)=>{const h=q_(typeof d=="function"?d(new URLSearchParams(n)):d);r.current=!0,l("?"+h,m)},[l,n]);return[n,c]}var W4=0,V4=()=>`__${String(++W4)}__`;function G4(){let{router:e}=xE("useSubmit"),{basename:t}=p.useContext(ei),r=d4(),s=e.fetch,n=e.navigate;return p.useCallback(async(l,c={})=>{let{action:d,method:m,encType:h,formData:v,body:g}=C4(l,t);if(c.navigate===!1){let x=c.fetcherKey||V4();await s(x,r,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:v,body:g,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await n(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:v,body:g,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:r,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,n,t,r])}function Y4(e,{relative:t}={}){let{basename:r}=p.useContext(ei),s=p.useContext(Ji);Tr(s,"useFormAction must be used inside a RouteContext");let[n]=s.matches.slice(-1),l={...gd(e||".",{relative:t})},c=Qr();if(e==null){l.search=c.search;let d=new URLSearchParams(l.search),m=d.getAll("index");if(m.some(v=>v==="")){d.delete("index"),m.filter(g=>g).forEach(g=>d.append("index",g));let v=d.toString();l.search=v?`?${v}`:""}}return(!e||e===".")&&n.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(l.pathname=l.pathname==="/"?r:Vi([r,l.pathname])),ed(l)}function K4(e,{relative:t}={}){let r=p.useContext(cE);Tr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=xE("useViewTransitionState"),n=gd(e,{relative:t});if(!r.isTransitioning)return!1;let l=oa(r.currentLocation.pathname,s)||r.currentLocation.pathname,c=oa(r.nextLocation.pathname,s)||r.nextLocation.pathname;return Wf(n.pathname,c)!=null||Wf(n.pathname,l)!=null}/**
62
+ * @license lucide-react v0.475.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const X4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yE=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();/**
67
+ * @license lucide-react v0.475.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
+ */var Z4={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"};/**
72
+ * @license lucide-react v0.475.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 Q4=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:n="",children:l,iconNode:c,...d},m)=>p.createElement("svg",{ref:m,...Z4,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:yE("lucide",n),...d},[...c.map(([h,v])=>p.createElement(h,v)),...Array.isArray(l)?l:[l]]));/**
77
+ * @license lucide-react v0.475.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 be=(e,t)=>{const r=p.forwardRef(({className:s,...n},l)=>p.createElement(Q4,{ref:l,iconNode:t,className:yE(`lucide-${X4(e)}`,s),...n}));return r.displayName=`${e}`,r};/**
82
+ * @license lucide-react v0.475.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 J4=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],tl=be("ArrowLeft",J4);/**
87
+ * @license lucide-react v0.475.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
+ */const eO=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],bE=be("ArrowRight",eO);/**
92
+ * @license lucide-react v0.475.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 tO=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Em=be("Bot",tO);/**
97
+ * @license lucide-react v0.475.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 rO=[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]],sO=be("Cable",rO);/**
102
+ * @license lucide-react v0.475.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 iO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ar=be("Check",iO);/**
107
+ * @license lucide-react v0.475.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 nO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vd=be("ChevronDown",nO);/**
112
+ * @license lucide-react v0.475.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 aO=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],wE=be("ChevronLeft",aO);/**
117
+ * @license lucide-react v0.475.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 oO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],po=be("ChevronRight",oO);/**
122
+ * @license lucide-react v0.475.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 lO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],cO=be("ChevronUp",lO);/**
127
+ * @license lucide-react v0.475.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 uO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sc=be("CircleAlert",uO);/**
132
+ * @license lucide-react v0.475.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 dO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Xu=be("CircleArrowUp",dO);/**
137
+ * @license lucide-react v0.475.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 hO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],M0=be("CircleCheck",hO);/**
142
+ * @license lucide-react v0.475.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 fO=[["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"}]],mO=be("CircleHelp",fO);/**
147
+ * @license lucide-react v0.475.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 pO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]],gO=be("CircleSlash",pO);/**
152
+ * @license lucide-react v0.475.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 vO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],SE=be("CircleStop",vO);/**
157
+ * @license lucide-react v0.475.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 _O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],xO=be("CircleX",_O);/**
162
+ * @license lucide-react v0.475.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 yO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],bO=be("Circle",yO);/**
167
+ * @license lucide-react v0.475.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 wO=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],D0=be("Command",wO);/**
172
+ * @license lucide-react v0.475.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 SO=[["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"}]],L0=be("Copy",SO);/**
177
+ * @license lucide-react v0.475.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 CO=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],_d=be("Download",CO);/**
182
+ * @license lucide-react v0.475.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 kO=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],fc=be("Earth",kO);/**
187
+ * @license lucide-react v0.475.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 EO=[["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"}]],RO=be("Ellipsis",EO);/**
192
+ * @license lucide-react v0.475.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 NO=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],jO=be("Eraser",NO);/**
197
+ * @license lucide-react v0.475.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 AO=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16.2V21h-4.8",key:"1hrera"}],["path",{d:"M21 7.8V3h-4.8",key:"ul1q53"}],["path",{d:"M3 16.2V21h4.8",key:"1x04uo"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 7.8V3h4.8",key:"1ijppm"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],TO=be("Expand",AO);/**
202
+ * @license lucide-react v0.475.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 MO=[["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"}]],td=be("ExternalLink",MO);/**
207
+ * @license lucide-react v0.475.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 DO=[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]],CE=be("FileArchive",DO);/**
212
+ * @license lucide-react v0.475.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 LO=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],xd=be("FileText",LO);/**
217
+ * @license lucide-react v0.475.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 OO=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],BO=be("Fingerprint",OO);/**
222
+ * @license lucide-react v0.475.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 PO=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],IO=be("FolderKanban",PO);/**
227
+ * @license lucide-react v0.475.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 zO=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],W_=be("FolderOpen",zO);/**
232
+ * @license lucide-react v0.475.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 $O=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],hC=be("FolderPlus",$O);/**
237
+ * @license lucide-react v0.475.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 UO=[["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"}]],Gf=be("Folder",UO);/**
242
+ * @license lucide-react v0.475.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 HO=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],FO=be("GitBranch",HO);/**
247
+ * @license lucide-react v0.475.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 qO=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],WO=be("GitFork",qO);/**
252
+ * @license lucide-react v0.475.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 VO=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],GO=be("HardDrive",VO);/**
257
+ * @license lucide-react v0.475.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 YO=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],kE=be("House",YO);/**
262
+ * @license lucide-react v0.475.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 KO=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],O0=be("ImageOff",KO);/**
267
+ * @license lucide-react v0.475.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 XO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ZO=be("Image",XO);/**
272
+ * @license lucide-react v0.475.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 QO=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],JO=be("KeyRound",QO);/**
277
+ * @license lucide-react v0.475.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 e6=[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]],EE=be("Laptop",e6);/**
282
+ * @license lucide-react v0.475.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 t6=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],r6=be("LayoutDashboard",t6);/**
287
+ * @license lucide-react v0.475.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 s6=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],i6=be("Link2",s6);/**
292
+ * @license lucide-react v0.475.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 n6=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],a6=be("ListChecks",n6);/**
297
+ * @license lucide-react v0.475.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 o6=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Le=be("LoaderCircle",o6);/**
302
+ * @license lucide-react v0.475.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 l6=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],c6=be("MapPin",l6);/**
307
+ * @license lucide-react v0.475.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 u6=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],d6=be("MessageSquare",u6);/**
312
+ * @license lucide-react v0.475.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 h6=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],Yf=be("MonitorSmartphone",h6);/**
317
+ * @license lucide-react v0.475.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 f6=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],m6=be("MonitorUp",f6);/**
322
+ * @license lucide-react v0.475.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 p6=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],RE=be("Monitor",p6);/**
327
+ * @license lucide-react v0.475.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 g6=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],v6=be("Moon",g6);/**
332
+ * @license lucide-react v0.475.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 _6=[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]],fC=be("MousePointerBan",_6);/**
337
+ * @license lucide-react v0.475.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 x6=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],y6=be("MousePointerClick",x6);/**
342
+ * @license lucide-react v0.475.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 b6=[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],w6=be("PackagePlus",b6);/**
347
+ * @license lucide-react v0.475.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 S6=[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]],mC=be("PackageSearch",S6);/**
352
+ * @license lucide-react v0.475.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 C6=[["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"}]],k6=be("PanelLeftClose",C6);/**
357
+ * @license lucide-react v0.475.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 E6=[["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"}]],NE=be("PanelLeftOpen",E6);/**
362
+ * @license lucide-react v0.475.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 R6=[["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"}]],N6=be("PanelRightClose",R6);/**
367
+ * @license lucide-react v0.475.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 j6=[["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"}]],A6=be("PanelRightOpen",j6);/**
372
+ * @license lucide-react v0.475.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 T6=[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]],M6=be("Paperclip",T6);/**
377
+ * @license lucide-react v0.475.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 D6=[["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"}]],jE=be("Pencil",D6);/**
382
+ * @license lucide-react v0.475.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 L6=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],O6=be("Play",L6);/**
387
+ * @license lucide-react v0.475.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 B6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Zr=be("Plus",B6);/**
392
+ * @license lucide-react v0.475.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 P6=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],V_=be("Power",P6);/**
397
+ * @license lucide-react v0.475.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 I6=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],Rm=be("Puzzle",I6);/**
402
+ * @license lucide-react v0.475.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 z6=[["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"}]],yt=be("RefreshCw",z6);/**
407
+ * @license lucide-react v0.475.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 $6=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],U6=be("RotateCw",$6);/**
412
+ * @license lucide-react v0.475.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 H6=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]],F6=be("ScanEye",H6);/**
417
+ * @license lucide-react v0.475.0 - ISC
418
+ *
419
+ * This source code is licensed under the ISC license.
420
+ * See the LICENSE file in the root directory of this source tree.
421
+ */const q6=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],AE=be("Search",q6);/**
422
+ * @license lucide-react v0.475.0 - ISC
423
+ *
424
+ * This source code is licensed under the ISC license.
425
+ * See the LICENSE file in the root directory of this source tree.
426
+ */const W6=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],TE=be("Send",W6);/**
427
+ * @license lucide-react v0.475.0 - ISC
428
+ *
429
+ * This source code is licensed under the ISC license.
430
+ * See the LICENSE file in the root directory of this source tree.
431
+ */const V6=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Nm=be("Server",V6);/**
432
+ * @license lucide-react v0.475.0 - ISC
433
+ *
434
+ * This source code is licensed under the ISC license.
435
+ * See the LICENSE file in the root directory of this source tree.
436
+ */const G6=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Y6=be("Settings2",G6);/**
437
+ * @license lucide-react v0.475.0 - ISC
438
+ *
439
+ * This source code is licensed under the ISC license.
440
+ * See the LICENSE file in the root directory of this source tree.
441
+ */const K6=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ME=be("Settings",K6);/**
442
+ * @license lucide-react v0.475.0 - ISC
443
+ *
444
+ * This source code is licensed under the ISC license.
445
+ * See the LICENSE file in the root directory of this source tree.
446
+ */const X6=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Z6=be("Share2",X6);/**
447
+ * @license lucide-react v0.475.0 - ISC
448
+ *
449
+ * This source code is licensed under the ISC license.
450
+ * See the LICENSE file in the root directory of this source tree.
451
+ */const Q6=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],J6=be("ShieldAlert",Q6);/**
452
+ * @license lucide-react v0.475.0 - ISC
453
+ *
454
+ * This source code is licensed under the ISC license.
455
+ * See the LICENSE file in the root directory of this source tree.
456
+ */const eB=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Kf=be("ShieldCheck",eB);/**
457
+ * @license lucide-react v0.475.0 - ISC
458
+ *
459
+ * This source code is licensed under the ISC license.
460
+ * See the LICENSE file in the root directory of this source tree.
461
+ */const tB=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],B0=be("ShieldOff",tB);/**
462
+ * @license lucide-react v0.475.0 - ISC
463
+ *
464
+ * This source code is licensed under the ISC license.
465
+ * See the LICENSE file in the root directory of this source tree.
466
+ */const rB=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],sB=be("Shield",rB);/**
467
+ * @license lucide-react v0.475.0 - ISC
468
+ *
469
+ * This source code is licensed under the ISC license.
470
+ * See the LICENSE file in the root directory of this source tree.
471
+ */const iB=[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]],nB=be("Shrink",iB);/**
472
+ * @license lucide-react v0.475.0 - ISC
473
+ *
474
+ * This source code is licensed under the ISC license.
475
+ * See the LICENSE file in the root directory of this source tree.
476
+ */const aB=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],mc=be("Smartphone",aB);/**
477
+ * @license lucide-react v0.475.0 - ISC
478
+ *
479
+ * This source code is licensed under the ISC license.
480
+ * See the LICENSE file in the root directory of this source tree.
481
+ */const oB=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],DE=be("Sparkles",oB);/**
482
+ * @license lucide-react v0.475.0 - ISC
483
+ *
484
+ * This source code is licensed under the ISC license.
485
+ * See the LICENSE file in the root directory of this source tree.
486
+ */const lB=[["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"}]],LE=be("SquareTerminal",lB);/**
487
+ * @license lucide-react v0.475.0 - ISC
488
+ *
489
+ * This source code is licensed under the ISC license.
490
+ * See the LICENSE file in the root directory of this source tree.
491
+ */const cB=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],uB=be("Square",cB);/**
492
+ * @license lucide-react v0.475.0 - ISC
493
+ *
494
+ * This source code is licensed under the ISC license.
495
+ * See the LICENSE file in the root directory of this source tree.
496
+ */const dB=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],OE=be("Star",dB);/**
497
+ * @license lucide-react v0.475.0 - ISC
498
+ *
499
+ * This source code is licensed under the ISC license.
500
+ * See the LICENSE file in the root directory of this source tree.
501
+ */const hB=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],Xf=be("Store",hB);/**
502
+ * @license lucide-react v0.475.0 - ISC
503
+ *
504
+ * This source code is licensed under the ISC license.
505
+ * See the LICENSE file in the root directory of this source tree.
506
+ */const fB=[["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"}]],mB=be("Sun",fB);/**
507
+ * @license lucide-react v0.475.0 - ISC
508
+ *
509
+ * This source code is licensed under the ISC license.
510
+ * See the LICENSE file in the root directory of this source tree.
511
+ */const pB=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],gB=be("Terminal",pB);/**
512
+ * @license lucide-react v0.475.0 - ISC
513
+ *
514
+ * This source code is licensed under the ISC license.
515
+ * See the LICENSE file in the root directory of this source tree.
516
+ */const vB=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],da=be("Trash2",vB);/**
517
+ * @license lucide-react v0.475.0 - ISC
518
+ *
519
+ * This source code is licensed under the ISC license.
520
+ * See the LICENSE file in the root directory of this source tree.
521
+ */const _B=[["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"}]],Ci=be("TriangleAlert",_B);/**
522
+ * @license lucide-react v0.475.0 - ISC
523
+ *
524
+ * This source code is licensed under the ISC license.
525
+ * See the LICENSE file in the root directory of this source tree.
526
+ */const xB=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],yB=be("Unlink",xB);/**
527
+ * @license lucide-react v0.475.0 - ISC
528
+ *
529
+ * This source code is licensed under the ISC license.
530
+ * See the LICENSE file in the root directory of this source tree.
531
+ */const bB=[["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"}]],wB=be("Workflow",bB);/**
532
+ * @license lucide-react v0.475.0 - ISC
533
+ *
534
+ * This source code is licensed under the ISC license.
535
+ * See the LICENSE file in the root directory of this source tree.
536
+ */const SB=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ni=be("X",SB);/**
537
+ * @license lucide-react v0.475.0 - ISC
538
+ *
539
+ * This source code is licensed under the ISC license.
540
+ * See the LICENSE file in the root directory of this source tree.
541
+ */const CB=[["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"}]],kB=be("Zap",CB);var ha=Zk();const EB=Xk(ha);function RB(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const NB=e=>{switch(e){case"success":return TB;case"info":return DB;case"warning":return MB;case"error":return LB;default:return null}},jB=Array(12).fill(0),AB=({visible:e,className:t})=>Ce.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ce.createElement("div",{className:"sonner-spinner"},jB.map((r,s)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),TB=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),MB=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),DB=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),LB=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),OB=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),BB=()=>{const[e,t]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let G_=1;class PB{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:s,...n}=t,l=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:G_++,c=this.toasts.find(m=>m.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),c?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...t,id:l,title:s}),{...m,...t,id:l,dismissible:d,title:s}):m):this.addToast({title:s,...n,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let s;r.loading!==void 0&&(s=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const n=Promise.resolve(t instanceof Function?t():t);let l=s!==void 0,c;const d=n.then(async h=>{if(c=["resolve",h],Ce.isValidElement(h))l=!1,this.create({id:s,type:"default",message:h});else if(zB(h)&&!h.ok){l=!1;const g=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,x=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,w=typeof g=="object"&&!Ce.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:x,...w})}else if(h instanceof Error){l=!1;const g=typeof r.error=="function"?await r.error(h):r.error,x=typeof r.description=="function"?await r.description(h):r.description,w=typeof g=="object"&&!Ce.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:x,...w})}else if(r.success!==void 0){l=!1;const g=typeof r.success=="function"?await r.success(h):r.success,x=typeof r.description=="function"?await r.description(h):r.description,w=typeof g=="object"&&!Ce.isValidElement(g)?g:{message:g};this.create({id:s,type:"success",description:x,...w})}}).catch(async h=>{if(c=["reject",h],r.error!==void 0){l=!1;const v=typeof r.error=="function"?await r.error(h):r.error,g=typeof r.description=="function"?await r.description(h):r.description,y=typeof v=="object"&&!Ce.isValidElement(v)?v:{message:v};this.create({id:s,type:"error",description:g,...y})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((h,v)=>d.then(()=>c[0]==="reject"?v(c[1]):h(c[1])).catch(v));return typeof s!="string"&&typeof s!="number"?{unwrap:m}:Object.assign(s,{unwrap:m})},this.custom=(t,r)=>{const s=(r==null?void 0:r.id)||G_++;return this.create({jsx:t(s),id:s,...r}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Os=new PB,IB=(e,t)=>{const r=(t==null?void 0:t.id)||G_++;return Os.addToast({title:e,...t,id:r}),r},zB=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",$B=IB,UB=()=>Os.toasts,HB=()=>Os.getActiveToasts(),me=Object.assign($B,{success:Os.success,info:Os.info,warning:Os.warning,error:Os.error,custom:Os.custom,message:Os.message,promise:Os.promise,dismiss:Os.dismiss,loading:Os.loading},{getHistory:UB,getToasts:HB});RB("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Gh(e){return e.label!==void 0}const FB=3,qB="24px",WB="16px",pC=4e3,VB=356,GB=14,YB=45,KB=200;function un(...e){return e.filter(Boolean).join(" ")}function XB(e){const[t,r]=e.split("-"),s=[];return t&&s.push(t),r&&s.push(r),s}const ZB=e=>{var t,r,s,n,l,c,d,m,h;const{invert:v,toast:g,unstyled:x,interacting:y,setHeights:w,visibleToasts:S,heights:k,index:C,toasts:E,expanded:N,removeToast:R,defaultRichColors:T,closeButton:P,style:z,cancelButtonStyle:B,actionButtonStyle:F,className:Y="",descriptionClassName:q="",duration:$,position:M,gap:U,expandByDefault:W,classNames:A,icons:O,closeButtonAriaLabel:L="Close toast"}=e,[G,H]=Ce.useState(null),[D,V]=Ce.useState(null),[X,J]=Ce.useState(!1),[se,de]=Ce.useState(!1),[Z,ce]=Ce.useState(!1),[le,we]=Ce.useState(!1),[Ee,Re]=Ce.useState(!1),[te,ie]=Ce.useState(0),[ke,Ke]=Ce.useState(0),_e=Ce.useRef(g.duration||$||pC),ye=Ce.useRef(null),Ie=Ce.useRef(null),ze=C===0,pt=C+1<=S,rt=g.type,$e=g.dismissible!==!1,He=g.className||"",Nt=g.descriptionClassName||"",Ct=Ce.useMemo(()=>k.findIndex(qe=>qe.toastId===g.id)||0,[k,g.id]),gs=Ce.useMemo(()=>{var qe;return(qe=g.closeButton)!=null?qe:P},[g.closeButton,P]),cs=Ce.useMemo(()=>g.duration||$||pC,[g.duration,$]),gr=Ce.useRef(0),kt=Ce.useRef(0),Fe=Ce.useRef(0),jt=Ce.useRef(null),[zs,Mr]=M.split("-"),vs=Ce.useMemo(()=>k.reduce((qe,Et,Ft)=>Ft>=Ct?qe:qe+Et.height,0),[k,Ct]),Ht=BB(),Te=g.invert||v,Ve=rt==="loading";kt.current=Ce.useMemo(()=>Ct*U+vs,[Ct,vs]),Ce.useEffect(()=>{_e.current=cs},[cs]),Ce.useEffect(()=>{J(!0)},[]),Ce.useEffect(()=>{const qe=Ie.current;if(qe){const Et=qe.getBoundingClientRect().height;return Ke(Et),w(Ft=>[{toastId:g.id,height:Et,position:g.position},...Ft]),()=>w(Ft=>Ft.filter(Qt=>Qt.toastId!==g.id))}},[w,g.id]),Ce.useLayoutEffect(()=>{if(!X)return;const qe=Ie.current,Et=qe.style.height;qe.style.height="auto";const Ft=qe.getBoundingClientRect().height;qe.style.height=Et,Ke(Ft),w(Qt=>Qt.find(st=>st.toastId===g.id)?Qt.map(st=>st.toastId===g.id?{...st,height:Ft}:st):[{toastId:g.id,height:Ft,position:g.position},...Qt])},[X,g.title,g.description,w,g.id,g.jsx,g.action,g.cancel]);const Qe=Ce.useCallback(()=>{de(!0),ie(kt.current),w(qe=>qe.filter(Et=>Et.toastId!==g.id)),setTimeout(()=>{R(g)},KB)},[g,R,w,kt]);Ce.useEffect(()=>{if(g.promise&&rt==="loading"||g.duration===1/0||g.type==="loading")return;let qe;return N||y||Ht?(()=>{if(Fe.current<gr.current){const Qt=new Date().getTime()-gr.current;_e.current=_e.current-Qt}Fe.current=new Date().getTime()})():(()=>{_e.current!==1/0&&(gr.current=new Date().getTime(),qe=setTimeout(()=>{g.onAutoClose==null||g.onAutoClose.call(g,g),Qe()},_e.current))})(),()=>clearTimeout(qe)},[N,y,g,rt,Ht,Qe]),Ce.useEffect(()=>{g.delete&&(Qe(),g.onDismiss==null||g.onDismiss.call(g,g))},[Qe,g.delete]);function sr(){var qe;if(O!=null&&O.loading){var Et;return Ce.createElement("div",{className:un(A==null?void 0:A.loader,g==null||(Et=g.classNames)==null?void 0:Et.loader,"sonner-loader"),"data-visible":rt==="loading"},O.loading)}return Ce.createElement(AB,{className:un(A==null?void 0:A.loader,g==null||(qe=g.classNames)==null?void 0:qe.loader),visible:rt==="loading"})}const es=g.icon||(O==null?void 0:O[rt])||NB(rt);var lt,vr;return Ce.createElement("li",{tabIndex:0,ref:Ie,className:un(Y,He,A==null?void 0:A.toast,g==null||(t=g.classNames)==null?void 0:t.toast,A==null?void 0:A.default,A==null?void 0:A[rt],g==null||(r=g.classNames)==null?void 0:r[rt]),"data-sonner-toast":"","data-rich-colors":(lt=g.richColors)!=null?lt:T,"data-styled":!(g.jsx||g.unstyled||x),"data-mounted":X,"data-promise":!!g.promise,"data-swiped":Ee,"data-removed":se,"data-visible":pt,"data-y-position":zs,"data-x-position":Mr,"data-index":C,"data-front":ze,"data-swiping":Z,"data-dismissible":$e,"data-type":rt,"data-invert":Te,"data-swipe-out":le,"data-swipe-direction":D,"data-expanded":!!(N||W&&X),"data-testid":g.testId,style:{"--index":C,"--toasts-before":C,"--z-index":E.length-C,"--offset":`${se?te:kt.current}px`,"--initial-height":W?"auto":`${ke}px`,...z,...g.style},onDragEnd:()=>{ce(!1),H(null),jt.current=null},onPointerDown:qe=>{qe.button!==2&&(Ve||!$e||(ye.current=new Date,ie(kt.current),qe.target.setPointerCapture(qe.pointerId),qe.target.tagName!=="BUTTON"&&(ce(!0),jt.current={x:qe.clientX,y:qe.clientY})))},onPointerUp:()=>{var qe,Et,Ft;if(le||!$e)return;jt.current=null;const Qt=Number(((qe=Ie.current)==null?void 0:qe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Cs=Number(((Et=Ie.current)==null?void 0:Et.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),st=new Date().getTime()-((Ft=ye.current)==null?void 0:Ft.getTime()),ir=G==="x"?Qt:Cs,It=Math.abs(ir)/st;if(Math.abs(ir)>=YB||It>.11){ie(kt.current),g.onDismiss==null||g.onDismiss.call(g,g),V(G==="x"?Qt>0?"right":"left":Cs>0?"down":"up"),Qe(),we(!0);return}else{var zt,nr;(zt=Ie.current)==null||zt.style.setProperty("--swipe-amount-x","0px"),(nr=Ie.current)==null||nr.style.setProperty("--swipe-amount-y","0px")}Re(!1),ce(!1),H(null)},onPointerMove:qe=>{var Et,Ft,Qt;if(!jt.current||!$e||((Et=window.getSelection())==null?void 0:Et.toString().length)>0)return;const st=qe.clientY-jt.current.y,ir=qe.clientX-jt.current.x;var It;const zt=(It=e.swipeDirections)!=null?It:XB(M);!G&&(Math.abs(ir)>1||Math.abs(st)>1)&&H(Math.abs(ir)>Math.abs(st)?"x":"y");let nr={x:0,y:0};const Pi=ar=>1/(1.5+Math.abs(ar)/20);if(G==="y"){if(zt.includes("top")||zt.includes("bottom"))if(zt.includes("top")&&st<0||zt.includes("bottom")&&st>0)nr.y=st;else{const ar=st*Pi(st);nr.y=Math.abs(ar)<Math.abs(st)?ar:st}}else if(G==="x"&&(zt.includes("left")||zt.includes("right")))if(zt.includes("left")&&ir<0||zt.includes("right")&&ir>0)nr.x=ir;else{const ar=ir*Pi(ir);nr.x=Math.abs(ar)<Math.abs(ir)?ar:ir}(Math.abs(nr.x)>0||Math.abs(nr.y)>0)&&Re(!0),(Ft=Ie.current)==null||Ft.style.setProperty("--swipe-amount-x",`${nr.x}px`),(Qt=Ie.current)==null||Qt.style.setProperty("--swipe-amount-y",`${nr.y}px`)}},gs&&!g.jsx&&rt!=="loading"?Ce.createElement("button",{"aria-label":L,"data-disabled":Ve,"data-close-button":!0,onClick:Ve||!$e?()=>{}:()=>{Qe(),g.onDismiss==null||g.onDismiss.call(g,g)},className:un(A==null?void 0:A.closeButton,g==null||(s=g.classNames)==null?void 0:s.closeButton)},(vr=O==null?void 0:O.close)!=null?vr:OB):null,(rt||g.icon||g.promise)&&g.icon!==null&&((O==null?void 0:O[rt])!==null||g.icon)?Ce.createElement("div",{"data-icon":"",className:un(A==null?void 0:A.icon,g==null||(n=g.classNames)==null?void 0:n.icon)},g.promise||g.type==="loading"&&!g.icon?g.icon||sr():null,g.type!=="loading"?es:null):null,Ce.createElement("div",{"data-content":"",className:un(A==null?void 0:A.content,g==null||(l=g.classNames)==null?void 0:l.content)},Ce.createElement("div",{"data-title":"",className:un(A==null?void 0:A.title,g==null||(c=g.classNames)==null?void 0:c.title)},g.jsx?g.jsx:typeof g.title=="function"?g.title():g.title),g.description?Ce.createElement("div",{"data-description":"",className:un(q,Nt,A==null?void 0:A.description,g==null||(d=g.classNames)==null?void 0:d.description)},typeof g.description=="function"?g.description():g.description):null),Ce.isValidElement(g.cancel)?g.cancel:g.cancel&&Gh(g.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:g.cancelButtonStyle||B,onClick:qe=>{Gh(g.cancel)&&$e&&(g.cancel.onClick==null||g.cancel.onClick.call(g.cancel,qe),Qe())},className:un(A==null?void 0:A.cancelButton,g==null||(m=g.classNames)==null?void 0:m.cancelButton)},g.cancel.label):null,Ce.isValidElement(g.action)?g.action:g.action&&Gh(g.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:g.actionButtonStyle||F,onClick:qe=>{Gh(g.action)&&(g.action.onClick==null||g.action.onClick.call(g.action,qe),!qe.defaultPrevented&&Qe())},className:un(A==null?void 0:A.actionButton,g==null||(h=g.classNames)==null?void 0:h.actionButton)},g.action.label):null)};function gC(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function QB(e,t){const r={};return[e,t].forEach((s,n)=>{const l=n===1,c=l?"--mobile-offset":"--offset",d=l?WB:qB;function m(h){["top","right","bottom","left"].forEach(v=>{r[`${c}-${v}`]=typeof h=="number"?`${h}px`:h})}typeof s=="number"||typeof s=="string"?m(s):typeof s=="object"?["top","right","bottom","left"].forEach(h=>{s[h]===void 0?r[`${c}-${h}`]=d:r[`${c}-${h}`]=typeof s[h]=="number"?`${s[h]}px`:s[h]}):m(d)}),r}const JB=Ce.forwardRef(function(t,r){const{id:s,invert:n,position:l="bottom-right",hotkey:c=["altKey","KeyT"],expand:d,closeButton:m,className:h,offset:v,mobileOffset:g,theme:x="light",richColors:y,duration:w,style:S,visibleToasts:k=FB,toastOptions:C,dir:E=gC(),gap:N=GB,icons:R,containerAriaLabel:T="Notifications"}=t,[P,z]=Ce.useState([]),B=Ce.useMemo(()=>s?P.filter(X=>X.toasterId===s):P.filter(X=>!X.toasterId),[P,s]),F=Ce.useMemo(()=>Array.from(new Set([l].concat(B.filter(X=>X.position).map(X=>X.position)))),[B,l]),[Y,q]=Ce.useState([]),[$,M]=Ce.useState(!1),[U,W]=Ce.useState(!1),[A,O]=Ce.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=Ce.useRef(null),G=c.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=Ce.useRef(null),D=Ce.useRef(!1),V=Ce.useCallback(X=>{z(J=>{var se;return(se=J.find(de=>de.id===X.id))!=null&&se.delete||Os.dismiss(X.id),J.filter(({id:de})=>de!==X.id)})},[]);return Ce.useEffect(()=>Os.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{z(J=>J.map(se=>se.id===X.id?{...se,delete:!0}:se))});return}setTimeout(()=>{EB.flushSync(()=>{z(J=>{const se=J.findIndex(de=>de.id===X.id);return se!==-1?[...J.slice(0,se),{...J[se],...X},...J.slice(se+1)]:[X,...J]})})})}),[P]),Ce.useEffect(()=>{if(x!=="system"){O(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:J})=>{O(J?"dark":"light")})}catch{X.addListener(({matches:se})=>{try{O(se?"dark":"light")}catch(de){console.error(de)}})}},[x]),Ce.useEffect(()=>{P.length<=1&&M(!1)},[P]),Ce.useEffect(()=>{const X=J=>{var se;if(c.every(ce=>J[ce]||J.code===ce)){var Z;M(!0),(Z=L.current)==null||Z.focus()}J.code==="Escape"&&(document.activeElement===L.current||(se=L.current)!=null&&se.contains(document.activeElement))&&M(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[c]),Ce.useEffect(()=>{if(L.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,D.current=!1)}},[L.current]),Ce.createElement("section",{ref:r,"aria-label":`${T} ${G}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},F.map((X,J)=>{var se;const[de,Z]=X.split("-");return B.length?Ce.createElement("ol",{key:X,dir:E==="auto"?gC():E,tabIndex:-1,ref:L,className:h,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":de,"data-x-position":Z,style:{"--front-toast-height":`${((se=Y[0])==null?void 0:se.height)||0}px`,"--width":`${VB}px`,"--gap":`${N}px`,...S,...QB(v,g)},onBlur:ce=>{D.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(D.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||D.current||(D.current=!0,H.current=ce.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{U||M(!1)},onDragEnd:()=>M(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||W(!0)},onPointerUp:()=>W(!1)},B.filter(ce=>!ce.position&&J===0||ce.position===X).map((ce,le)=>{var we,Ee;return Ce.createElement(ZB,{key:ce.id,icons:R,index:le,toast:ce,defaultRichColors:y,duration:(we=C==null?void 0:C.duration)!=null?we:w,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:n,visibleToasts:k,closeButton:(Ee=C==null?void 0:C.closeButton)!=null?Ee:m,interacting:U,position:X,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,closeButtonAriaLabel:C==null?void 0:C.closeButtonAriaLabel,removeToast:V,toasts:B.filter(Re=>Re.position==ce.position),heights:Y.filter(Re=>Re.position==ce.position),setHeights:q,expandByDefault:d,gap:N,expanded:$,swipeDirections:t.swipeDirections})})):null}))});function en(e,t=[]){let r=[];function s(l,c){const d=p.createContext(c);d.displayName=l+"Context";const m=r.length;r=[...r,c];const h=g=>{var C;const{scope:x,children:y,...w}=g,S=((C=x==null?void 0:x[e])==null?void 0:C[m])||d,k=p.useMemo(()=>w,Object.values(w));return o.jsx(S.Provider,{value:k,children:y})};h.displayName=l+"Provider";function v(g,x,y={}){var C;const{optional:w=!1}=y,S=((C=x==null?void 0:x[e])==null?void 0:C[m])||d,k=p.useContext(S);if(k)return k;if(c!==void 0)return c;if(!w)throw new Error(`\`${g}\` must be used within \`${l}\``)}return[h,v]}const n=()=>{const l=r.map(c=>p.createContext(c));return function(d){const m=(d==null?void 0:d[e])||l;return p.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return n.scopeName=e,[s,eP(n,...t)]}function eP(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(l){const c=s.reduce((d,{useScope:m,scopeName:h})=>{const g=m(l)[`__scope${h}`];return{...d,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}function vC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function tP(...e){return t=>{let r=!1;const s=e.map(n=>{const l=vC(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<s.length;n++){const l=s[n];typeof l=="function"?l():vC(e[n],null)}}}}function ut(...e){return p.useCallback(tP(...e),e)}function Be(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)}}var mr=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},rP=fo[" useId ".trim().toString()]||(()=>{}),sP=0;function Zs(e){const[t,r]=p.useState(rP());return mr(()=>{r(s=>s??String(sP++))},[e]),t?`radix-${t}`:""}var iP=fo[" useInsertionEffect ".trim().toString()]||mr;function ao({prop:e,defaultProp:t,onChange:r=()=>{},caller:s}){const[n,l,c]=nP({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:n;{const v=p.useRef(e!==void 0);p.useEffect(()=>{const g=v.current;g!==d&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=d},[d,s])}const h=p.useCallback(v=>{var g;if(d){const x=aP(v)?v(e):v;x!==e&&((g=c.current)==null||g.call(c,x))}else l(v)},[d,e,l,c]);return[m,h]}function nP({defaultProp:e,onChange:t}){const[r,s]=p.useState(e),n=p.useRef(r),l=p.useRef(t);return iP(()=>{l.current=t},[t]),p.useEffect(()=>{var c;n.current!==r&&((c=l.current)==null||c.call(l,r),n.current=r)},[r,n]),[r,s,l]}function aP(e){return typeof e=="function"}function rl(e){const t=p.forwardRef((r,s)=>{let{children:n,...l}=r,c=null,d=!1;const m=[];_C(n)&&typeof Yh=="function"&&(n=Yh(n._payload)),p.Children.forEach(n,x=>{var y;if(hP(x)){d=!0;const w=x;let S="child"in w.props?w.props.child:w.props.children;_C(S)&&typeof Yh=="function"&&(S=Yh(S._payload)),c=cP(w,S),m.push((y=c==null?void 0:c.props)==null?void 0:y.children)}else m.push(x)}),c?c=p.cloneElement(c,void 0,m):!d&&p.Children.count(n)===1&&p.isValidElement(n)&&(c=n);const h=c?dP(c):void 0,v=ut(s,h);if(!c){if(n||n===0)throw new Error(d?gP(e):pP(e));return n}const g=uP(l,c.props??{});return c.type!==p.Fragment&&(g.ref=s?v:h),p.cloneElement(c,g)});return t.displayName=`${e}.Slot`,t}var oP=rl("Slot"),lP=Symbol.for("radix.slottable"),cP=(e,t)=>{if("child"in e.props){const r=e.props.child;return p.isValidElement(r)?p.cloneElement(r,void 0,e.props.children(r.props.children)):null}return p.isValidElement(t)?t:null};function uP(e,t){const r={...t};for(const s in t){const n=e[s],l=t[s];/^on[A-Z]/.test(s)?n&&l?r[s]=(...d)=>{const m=l(...d);return n(...d),m}:n&&(r[s]=n):s==="style"?r[s]={...n,...l}:s==="className"&&(r[s]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}function dP(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function hP(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lP}var fP=Symbol.for("react.lazy");function _C(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===fP&&"_payload"in e&&mP(e._payload)}function mP(e){return typeof e=="object"&&e!==null&&"then"in e}var pP=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,gP=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Yh=fo[" use ".trim().toString()],vP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ye=vP.reduce((e,t)=>{const r=rl(`Primitive.${t}`),s=p.forwardRef((n,l)=>{const{asChild:c,...d}=n,m=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function BE(e,t){e&&ha.flushSync(()=>e.dispatchEvent(t))}function jr(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>((...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)}),[])}var _P="DismissableLayer",Y_="dismissableLayer.update",xP="dismissableLayer.pointerDownOutside",yP="dismissableLayer.focusOutside",xC,P0=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),jm=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:n,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:m,...h}=e,v=p.useContext(P0),[g,x]=p.useState(null),y=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=p.useState({}),S=ut(t,x),k=Array.from(v.layers),[C]=[...v.layersWithOutsidePointerEventsDisabled].slice(-1),E=C?k.indexOf(C):-1,N=g?k.indexOf(g):-1,R=v.layersWithOutsidePointerEventsDisabled.size>0,T=N>=E,P=p.useRef(!1),z=kP(q=>{l==null||l(q),d==null||d(q),q.defaultPrevented||m==null||m()},{ownerDocument:y,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:v.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(q=>{if(!(q instanceof Node))return!1;const $=[...v.branches].some(M=>M.contains(q));return T&&!$},[v.branches,T])}),B=EP(q=>{if(s&&P.current)return;const $=q.target;[...v.branches].some(U=>U.contains($))||(c==null||c(q),d==null||d(q),q.defaultPrevented||m==null||m())},y),F=g?N===k.length-1:!1,Y=jr(q=>{q.key==="Escape"&&(n==null||n(q),!q.defaultPrevented&&m&&(q.preventDefault(),m()))});return p.useEffect(()=>{if(F)return y.addEventListener("keydown",Y,{capture:!0}),()=>y.removeEventListener("keydown",Y,{capture:!0})},[y,F,Y]),p.useEffect(()=>{if(g)return r&&(v.layersWithOutsidePointerEventsDisabled.size===0&&(xC=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),v.layersWithOutsidePointerEventsDisabled.add(g)),v.layers.add(g),yC(),()=>{r&&(v.layersWithOutsidePointerEventsDisabled.delete(g),v.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=xC))}},[g,y,r,v]),p.useEffect(()=>()=>{g&&(v.layers.delete(g),v.layersWithOutsidePointerEventsDisabled.delete(g),yC())},[g,v]),p.useEffect(()=>{const q=()=>w({});return document.addEventListener(Y_,q),()=>document.removeEventListener(Y_,q)},[]),o.jsx(Ye.div,{...h,ref:S,style:{pointerEvents:R?T?"auto":"none":void 0,...e.style},onFocusCapture:Be(e.onFocusCapture,B.onFocusCapture),onBlurCapture:Be(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:Be(e.onPointerDownCapture,z.onPointerDownCapture)})});jm.displayName=_P;var bP="DismissableLayerBranch",wP=p.forwardRef((e,t)=>{const r=p.useContext(P0),s=p.useRef(null),n=ut(t,s);return p.useEffect(()=>{const l=s.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),o.jsx(Ye.div,{...e,ref:n})});wP.displayName=bP;function SP(){const e=p.useContext(P0),[t,r]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var CP=()=>!0;function kP(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:n,dismissableSurfaces:l,shouldHandlePointerDownOutside:c=CP}=t,d=jr(e),m=p.useRef(!1),h=p.useRef(!1),v=p.useRef(new Map),g=p.useRef(()=>{});return p.useEffect(()=>{function x(){h.current=!1,n.current=!1,v.current.clear()}function y(){return Array.from(v.current.values()).some(Boolean)}function w(N){if(!h.current)return;const R=N.target;R instanceof Node&&[...l].some(P=>P.contains(R))||v.current.set(N.type,!0),N.type==="click"&&window.setTimeout(()=>{h.current&&g.current()},0)}function S(N){h.current&&v.current.set(N.type,!1)}const k=N=>{if(N.target&&!m.current){let R=function(){r.removeEventListener("click",g.current);const P=y();x(),P||PE(xP,d,T,{discrete:!0})};if(!c(N.target)){r.removeEventListener("click",g.current),x(),m.current=!1;return}const T={originalEvent:N};h.current=!0,n.current=s&&N.button===0,v.current.clear(),!s||N.button!==0?R():(r.removeEventListener("click",g.current),g.current=R,r.addEventListener("click",g.current,{once:!0}))}else r.removeEventListener("click",g.current),x();m.current=!1},C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const N of C)r.addEventListener(N,w,!0),r.addEventListener(N,S);const E=window.setTimeout(()=>{r.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(E),r.removeEventListener("pointerdown",k),r.removeEventListener("click",g.current);for(const N of C)r.removeEventListener(N,w,!0),r.removeEventListener(N,S)}},[r,d,s,n,l,c]),{onPointerDownCapture:()=>m.current=!0}}function EP(e,t=globalThis==null?void 0:globalThis.document){const r=jr(e),s=p.useRef(!1);return p.useEffect(()=>{const n=l=>{l.target&&!s.current&&PE(yP,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function yC(){const e=new CustomEvent(Y_);document.dispatchEvent(e)}function PE(e,t,r,{discrete:s}){const n=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),s?BE(n,l):n.dispatchEvent(l)}var Mv="focusScope.autoFocusOnMount",Dv="focusScope.autoFocusOnUnmount",bC={bubbles:!1,cancelable:!0},RP="FocusScope",Am=p.forwardRef((e,t)=>{const{loop:r=!1,trapped:s=!1,onMountAutoFocus:n,onUnmountAutoFocus:l,...c}=e,[d,m]=p.useState(null),h=jr(n),v=jr(l),g=p.useRef(null),x=ut(t,m),y=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let S=function(N){if(y.paused||!d)return;const R=N.target;d.contains(R)?g.current=R:Ya(g.current,{select:!0})},k=function(N){if(y.paused||!d)return;const R=N.relatedTarget;R!==null&&(d.contains(R)||Ya(g.current,{select:!0}))},C=function(N){if(document.activeElement===document.body)for(const T of N)T.removedNodes.length>0&&Ya(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",k);const E=new MutationObserver(C);return d&&E.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",k),E.disconnect()}}},[s,d,y.paused]),p.useEffect(()=>{if(d){SC.add(y);const S=document.activeElement;if(!d.contains(S)){const C=new CustomEvent(Mv,bC);d.addEventListener(Mv,h),d.dispatchEvent(C),C.defaultPrevented||(NP(DP(IE(d)),{select:!0}),document.activeElement===S&&Ya(d))}return()=>{d.removeEventListener(Mv,h),setTimeout(()=>{const C=new CustomEvent(Dv,bC);d.addEventListener(Dv,v),d.dispatchEvent(C),C.defaultPrevented||Ya(S??document.body,{select:!0}),d.removeEventListener(Dv,v),SC.remove(y)},0)}}},[d,h,v,y]);const w=p.useCallback(S=>{if(!r&&!s||y.paused)return;const k=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,C=document.activeElement;if(k&&C){const E=S.currentTarget,[N,R]=jP(E);N&&R?!S.shiftKey&&C===R?(S.preventDefault(),r&&Ya(N,{select:!0})):S.shiftKey&&C===N&&(S.preventDefault(),r&&Ya(R,{select:!0})):C===E&&S.preventDefault()}},[r,s,y.paused]);return o.jsx(Ye.div,{tabIndex:-1,...c,ref:x,onKeyDown:w})});Am.displayName=RP;function NP(e,{select:t=!1}={}){const r=document.activeElement;for(const s of e)if(Ya(s,{select:t}),document.activeElement!==r)return}function jP(e){const t=IE(e),r=wC(t,e),s=wC(t.reverse(),e);return[r,s]}function IE(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function wC(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const s of e)if(!(r?!s.checkVisibility({checkVisibilityCSS:!0}):AP(s,{upTo:t})))return s}function AP(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function TP(e){return e instanceof HTMLInputElement&&"select"in e}function Ya(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&TP(e)&&t&&e.select()}}var SC=MP();function MP(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=CC(e,t),e.unshift(t)},remove(t){var r;e=CC(e,t),(r=e[0])==null||r.resume()}}}function CC(e,t){const r=[...e],s=r.indexOf(t);return s!==-1&&r.splice(s,1),r}function DP(e){return e.filter(t=>t.tagName!=="A")}var LP="Portal",Tm=p.forwardRef((e,t)=>{var d;const{container:r,...s}=e,[n,l]=p.useState(!1);mr(()=>l(!0),[]);const c=r||n&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?ha.createPortal(o.jsx(Ye.div,{...s,ref:t}),c):null});Tm.displayName=LP;function OP(e,t){return p.useReducer((r,s)=>t[r][s]??r,e)}var tn=e=>{const{present:t,children:r}=e,s=BP(t),n=typeof r=="function"?r({present:s.isPresent}):p.Children.only(r),l=PP(s.ref,IP(n));return typeof r=="function"||s.isPresent?p.cloneElement(n,{ref:l}):null};tn.displayName="Presence";function BP(e){const[t,r]=p.useState(),s=p.useRef(null),n=p.useRef(e),l=p.useRef("none"),c=p.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=OP(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{m==="mounted"?(l.current=c.current??Su(s.current),c.current=void 0):l.current="none"},[m]),mr(()=>{const v=s.current,g=n.current;if(g!==e){const y=l.current,w=Su(v);e?(c.current=w,h("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?h("UNMOUNT"):h(g&&y!==w?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,h]),mr(()=>{if(t){let v;const g=t.ownerDocument.defaultView??window,x=w=>{const k=Su(s.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(h("ANIMATION_END"),!n.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",v=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},y=w=>{w.target===t&&(l.current=Su(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{g.clearTimeout(v),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:p.useCallback(v=>{if(v){const g=getComputedStyle(v);s.current=g,c.current=Su(g)}else s.current=null;r(v)},[])}}function kC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function PP(...e){const t=p.useRef(e);return t.current=e,p.useCallback(r=>{const s=t.current;let n=!1;const l=s.map(c=>{const d=kC(c,r);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let c=0;c<l.length;c++){const d=l[c];typeof d=="function"?d():kC(s[c],null)}}},[])}function Su(e){return(e==null?void 0:e.animationName)||"none"}function IP(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Kh=0,dn=null;function I0(){p.useEffect(()=>{dn||(dn={start:EC(),end:EC()});const{start:e,end:t}=dn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Kh++,()=>{Kh===1&&(dn==null||dn.start.remove(),dn==null||dn.end.remove(),dn=null),Kh=Math.max(0,Kh-1)}},[])}function EC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var yn=function(){return yn=Object.assign||function(t){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(t[l]=r[l])}return t},yn.apply(this,arguments)};function zE(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]]);return r}function zP(e,t,r){if(r||arguments.length===2)for(var s=0,n=t.length,l;s<n;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var Ef="right-scroll-bar-position",Rf="width-before-scroll-bar",$P="with-scroll-bars-hidden",UP="--removed-body-scroll-bar-size";function Lv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function HP(e,t){var r=p.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(s){var n=r.value;n!==s&&(r.value=s,r.callback(s,n))}}}})[0];return r.callback=t,r.facade}var FP=typeof window<"u"?p.useLayoutEffect:p.useEffect,RC=new WeakMap;function qP(e,t){var r=HP(null,function(s){return e.forEach(function(n){return Lv(n,s)})});return FP(function(){var s=RC.get(r);if(s){var n=new Set(s),l=new Set(e),c=r.current;n.forEach(function(d){l.has(d)||Lv(d,null)}),l.forEach(function(d){n.has(d)||Lv(d,c)})}RC.set(r,e)},[e]),r}function WP(e){return e}function VP(e,t){t===void 0&&(t=WP);var r=[],s=!1,n={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(l){var c=t(l,s);return r.push(c),function(){r=r.filter(function(d){return d!==c})}},assignSyncMedium:function(l){for(s=!0;r.length;){var c=r;r=[],c.forEach(l)}r={push:function(d){return l(d)},filter:function(){return r}}},assignMedium:function(l){s=!0;var c=[];if(r.length){var d=r;r=[],d.forEach(l),c=r}var m=function(){var v=c;c=[],v.forEach(l)},h=function(){return Promise.resolve().then(m)};h(),r={push:function(v){c.push(v),h()},filter:function(v){return c=c.filter(v),r}}}};return n}function GP(e){e===void 0&&(e={});var t=VP(null);return t.options=yn({async:!0,ssr:!1},e),t}var $E=function(e){var t=e.sideCar,r=zE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return p.createElement(s,yn({},r))};$E.isSideCarExport=!0;function YP(e,t){return e.useMedium(t),$E}var UE=GP(),Ov=function(){},Mm=p.forwardRef(function(e,t){var r=p.useRef(null),s=p.useState({onScrollCapture:Ov,onWheelCapture:Ov,onTouchMoveCapture:Ov}),n=s[0],l=s[1],c=e.forwardProps,d=e.children,m=e.className,h=e.removeScrollBar,v=e.enabled,g=e.shards,x=e.sideCar,y=e.noRelative,w=e.noIsolation,S=e.inert,k=e.allowPinchZoom,C=e.as,E=C===void 0?"div":C,N=e.gapMode,R=zE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=x,P=qP([r,t]),z=yn(yn({},R),n);return p.createElement(p.Fragment,null,v&&p.createElement(T,{sideCar:UE,removeScrollBar:h,shards:g,noRelative:y,noIsolation:w,inert:S,setCallbacks:l,allowPinchZoom:!!k,lockRef:r,gapMode:N}),c?p.cloneElement(p.Children.only(d),yn(yn({},z),{ref:P})):p.createElement(E,yn({},z,{className:m,ref:P}),d))});Mm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Mm.classNames={fullWidth:Rf,zeroRight:Ef};var KP=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function XP(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=KP();return t&&e.setAttribute("nonce",t),e}function ZP(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function QP(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var JP=function(){var e=0,t=null;return{add:function(r){e==0&&(t=XP())&&(ZP(t,r),QP(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},eI=function(){var e=JP();return function(t,r){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},HE=function(){var e=eI(),t=function(r){var s=r.styles,n=r.dynamic;return e(s,n),null};return t},tI={left:0,top:0,right:0,gap:0},Bv=function(e){return parseInt(e||"",10)||0},rI=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[Bv(r),Bv(s),Bv(n)]},sI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return tI;var t=rI(e),r=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-r+t[2]-t[0])}},iI=HE(),uc="data-scroll-locked",nI=function(e,t,r,s){var n=e.left,l=e.top,c=e.right,d=e.gap;return r===void 0&&(r="margin"),`
542
+ .`.concat($P,` {
543
+ overflow: hidden `).concat(s,`;
544
+ padding-right: `).concat(d,"px ").concat(s,`;
545
+ }
546
+ body[`).concat(uc,`] {
547
+ overflow: hidden `).concat(s,`;
548
+ overscroll-behavior: contain;
549
+ `).concat([t&&"position: relative ".concat(s,";"),r==="margin"&&`
550
+ padding-left: `.concat(n,`px;
551
+ padding-top: `).concat(l,`px;
552
+ padding-right: `).concat(c,`px;
553
+ margin-left:0;
554
+ margin-top:0;
555
+ margin-right: `).concat(d,"px ").concat(s,`;
556
+ `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
557
+ }
558
+
559
+ .`).concat(Ef,` {
560
+ right: `).concat(d,"px ").concat(s,`;
561
+ }
562
+
563
+ .`).concat(Rf,` {
564
+ margin-right: `).concat(d,"px ").concat(s,`;
565
+ }
566
+
567
+ .`).concat(Ef," .").concat(Ef,` {
568
+ right: 0 `).concat(s,`;
569
+ }
570
+
571
+ .`).concat(Rf," .").concat(Rf,` {
572
+ margin-right: 0 `).concat(s,`;
573
+ }
574
+
575
+ body[`).concat(uc,`] {
576
+ `).concat(UP,": ").concat(d,`px;
577
+ }
578
+ `)},NC=function(){var e=parseInt(document.body.getAttribute(uc)||"0",10);return isFinite(e)?e:0},aI=function(){p.useEffect(function(){return document.body.setAttribute(uc,(NC()+1).toString()),function(){var e=NC()-1;e<=0?document.body.removeAttribute(uc):document.body.setAttribute(uc,e.toString())}},[])},oI=function(e){var t=e.noRelative,r=e.noImportant,s=e.gapMode,n=s===void 0?"margin":s;aI();var l=p.useMemo(function(){return sI(n)},[n]);return p.createElement(iI,{styles:nI(l,!t,n,r?"":"!important")})},K_=!1;if(typeof window<"u")try{var Xh=Object.defineProperty({},"passive",{get:function(){return K_=!0,!0}});window.addEventListener("test",Xh,Xh),window.removeEventListener("test",Xh,Xh)}catch{K_=!1}var Xl=K_?{passive:!1}:!1,lI=function(e){return e.tagName==="TEXTAREA"},FE=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!lI(e)&&r[t]==="visible")},cI=function(e){return FE(e,"overflowY")},uI=function(e){return FE(e,"overflowX")},jC=function(e,t){var r=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var n=qE(e,s);if(n){var l=WE(e,s),c=l[1],d=l[2];if(c>d)return!0}s=s.parentNode}while(s&&s!==r.body);return!1},dI=function(e){var t=e.scrollTop,r=e.scrollHeight,s=e.clientHeight;return[t,r,s]},hI=function(e){var t=e.scrollLeft,r=e.scrollWidth,s=e.clientWidth;return[t,r,s]},qE=function(e,t){return e==="v"?cI(t):uI(t)},WE=function(e,t){return e==="v"?dI(t):hI(t)},fI=function(e,t){return e==="h"&&t==="rtl"?-1:1},mI=function(e,t,r,s,n){var l=fI(e,window.getComputedStyle(t).direction),c=l*s,d=r.target,m=t.contains(d),h=!1,v=c>0,g=0,x=0;do{if(!d)break;var y=WE(e,d),w=y[0],S=y[1],k=y[2],C=S-k-l*w;(w||C)&&qE(e,d)&&(g+=C,x+=w);var E=d.parentNode;d=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(v&&Math.abs(g)<1||!v&&Math.abs(x)<1)&&(h=!0),h},Zh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},AC=function(e){return[e.deltaX,e.deltaY]},TC=function(e){return e&&"current"in e?e.current:e},pI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gI=function(e){return`
579
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
580
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
581
+ `)},vI=0,Zl=[];function _I(e){var t=p.useRef([]),r=p.useRef([0,0]),s=p.useRef(),n=p.useState(vI++)[0],l=p.useState(HE)[0],c=p.useRef(e);p.useEffect(function(){c.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var S=zP([e.lockRef.current],(e.shards||[]).map(TC),!0).filter(Boolean);return S.forEach(function(k){return k.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),S.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var d=p.useCallback(function(S,k){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!c.current.allowPinchZoom;var C=Zh(S),E=r.current,N="deltaX"in S?S.deltaX:E[0]-C[0],R="deltaY"in S?S.deltaY:E[1]-C[1],T,P=S.target,z=Math.abs(N)>Math.abs(R)?"h":"v";if("touches"in S&&z==="h"&&P.type==="range")return!1;var B=window.getSelection(),F=B&&B.anchorNode,Y=F?F===P||F.contains(P):!1;if(Y)return!1;var q=jC(z,P);if(!q)return!0;if(q?T=z:(T=z==="v"?"h":"v",q=jC(z,P)),!q)return!1;if(!s.current&&"changedTouches"in S&&(N||R)&&(s.current=T),!T)return!0;var $=s.current||T;return mI($,k,S,$==="h"?N:R)},[]),m=p.useCallback(function(S){var k=S;if(!(!Zl.length||Zl[Zl.length-1]!==l)){var C="deltaY"in k?AC(k):Zh(k),E=t.current.filter(function(T){return T.name===k.type&&(T.target===k.target||k.target===T.shadowParent)&&pI(T.delta,C)})[0];if(E&&E.should){k.cancelable&&k.preventDefault();return}if(!E){var N=(c.current.shards||[]).map(TC).filter(Boolean).filter(function(T){return T.contains(k.target)}),R=N.length>0?d(k,N[0]):!c.current.noIsolation;R&&k.cancelable&&k.preventDefault()}}},[]),h=p.useCallback(function(S,k,C,E){var N={name:S,delta:k,target:C,should:E,shadowParent:xI(C)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(R){return R!==N})},1)},[]),v=p.useCallback(function(S){r.current=Zh(S),s.current=void 0},[]),g=p.useCallback(function(S){h(S.type,AC(S),S.target,d(S,e.lockRef.current))},[]),x=p.useCallback(function(S){h(S.type,Zh(S),S.target,d(S,e.lockRef.current))},[]);p.useEffect(function(){return Zl.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",m,Xl),document.addEventListener("touchmove",m,Xl),document.addEventListener("touchstart",v,Xl),function(){Zl=Zl.filter(function(S){return S!==l}),document.removeEventListener("wheel",m,Xl),document.removeEventListener("touchmove",m,Xl),document.removeEventListener("touchstart",v,Xl)}},[]);var y=e.removeScrollBar,w=e.inert;return p.createElement(p.Fragment,null,w?p.createElement(l,{styles:gI(n)}):null,y?p.createElement(oI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yI=YP(UE,_I);var Dm=p.forwardRef(function(e,t){return p.createElement(Mm,yn({},e,{ref:t,sideCar:yI}))});Dm.classNames=Mm.classNames;var bI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ql=new WeakMap,Qh=new WeakMap,Jh={},Pv=0,VE=function(e){return e&&(e.host||VE(e.parentNode))},wI=function(e,t){return t.map(function(r){if(e.contains(r))return r;var s=VE(r);return s&&e.contains(s)?s:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},SI=function(e,t,r,s){var n=wI(t,Array.isArray(e)?e:[e]);Jh[r]||(Jh[r]=new WeakMap);var l=Jh[r],c=[],d=new Set,m=new Set(n),h=function(g){!g||d.has(g)||(d.add(g),h(g.parentNode))};n.forEach(h);var v=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(x){if(d.has(x))v(x);else try{var y=x.getAttribute(s),w=y!==null&&y!=="false",S=(Ql.get(x)||0)+1,k=(l.get(x)||0)+1;Ql.set(x,S),l.set(x,k),c.push(x),S===1&&w&&Qh.set(x,!0),k===1&&x.setAttribute(r,"true"),w||x.setAttribute(s,"true")}catch(C){console.error("aria-hidden: cannot operate on ",x,C)}})};return v(t),d.clear(),Pv++,function(){c.forEach(function(g){var x=Ql.get(g)-1,y=l.get(g)-1;Ql.set(g,x),l.set(g,y),x||(Qh.has(g)||g.removeAttribute(s),Qh.delete(g)),y||g.removeAttribute(r)}),Pv--,Pv||(Ql=new WeakMap,Ql=new WeakMap,Qh=new WeakMap,Jh={})}},z0=function(e,t,r){r===void 0&&(r="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),n=bI(e);return n?(s.push.apply(s,Array.from(n.querySelectorAll("[aria-live], script"))),SI(s,n,r,"aria-hidden")):function(){return null}},Lm="Dialog",[GE,YE]=en(Lm),[CI,rn]=GE(Lm),$0=e=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:n,onOpenChange:l,modal:c=!0}=e,d=p.useRef(null),m=p.useRef(null),[h,v]=ao({prop:s,defaultProp:n??!1,onChange:l,caller:Lm});return o.jsx(CI,{scope:t,triggerRef:d,contentRef:m,contentId:Zs(),titleId:Zs(),descriptionId:Zs(),open:h,onOpenChange:v,onOpenToggle:p.useCallback(()=>v(g=>!g),[v]),modal:c,children:r})};$0.displayName=Lm;var KE="DialogTrigger",Om=p.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=rn(KE,r),l=ut(t,n.triggerRef);return o.jsx(Ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.open?n.contentId:void 0,"data-state":F0(n.open),...s,ref:l,onClick:Be(e.onClick,n.onOpenToggle)})});Om.displayName=KE;var U0="DialogPortal",[kI,XE]=GE(U0,{forceMount:void 0}),H0=e=>{const{__scopeDialog:t,forceMount:r,children:s,container:n}=e,l=rn(U0,t);return o.jsx(kI,{scope:t,forceMount:r,children:p.Children.map(s,c=>o.jsx(tn,{present:r||l.open,children:o.jsx(Tm,{asChild:!0,container:n,children:c})}))})};H0.displayName=U0;var Zf="DialogOverlay",Bm=p.forwardRef((e,t)=>{const r=XE(Zf,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,l=rn(Zf,e.__scopeDialog);return l.modal?o.jsx(tn,{present:s||l.open,children:o.jsx(RI,{...n,ref:t})}):null});Bm.displayName=Zf;var EI=rl("DialogOverlay.RemoveScroll"),RI=p.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=rn(Zf,r),l=SP(),c=ut(t,l);return o.jsx(Dm,{as:EI,allowPinchZoom:!0,shards:[n.contentRef],children:o.jsx(Ye.div,{"data-state":F0(n.open),...s,ref:c,style:{pointerEvents:"auto",...s.style}})})}),pc="DialogContent",Pm=p.forwardRef((e,t)=>{const r=XE(pc,e.__scopeDialog),{forceMount:s=r.forceMount,...n}=e,l=rn(pc,e.__scopeDialog);return o.jsx(tn,{present:s||l.open,children:l.modal?o.jsx(NI,{...n,ref:t}):o.jsx(jI,{...n,ref:t})})});Pm.displayName=pc;var NI=p.forwardRef((e,t)=>{const r=rn(pc,e.__scopeDialog),s=p.useRef(null),n=ut(t,r.contentRef,s);return p.useEffect(()=>{const l=s.current;if(l)return z0(l)},[]),o.jsx(ZE,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Be(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Be(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&l.preventDefault()}),onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault())})}),jI=p.forwardRef((e,t)=>{const r=rn(pc,e.__scopeDialog),s=p.useRef(!1),n=p.useRef(!1);return o.jsx(ZE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(d=r.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,n.current=!1},onInteractOutside:l=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=l.target;((h=r.triggerRef.current)==null?void 0:h.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&n.current&&l.preventDefault()}})}),ZE=p.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:l,...c}=e,d=rn(pc,r);return I0(),o.jsx(o.Fragment,{children:o.jsx(Am,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:n,onUnmountAutoFocus:l,children:o.jsx(jm,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":F0(d.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),QE="DialogTitle",Im=p.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=rn(QE,r);return o.jsx(Ye.h2,{id:n.titleId,...s,ref:t})});Im.displayName=QE;var JE="DialogDescription",zm=p.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=rn(JE,r);return o.jsx(Ye.p,{id:n.descriptionId,...s,ref:t})});zm.displayName=JE;var eR="DialogClose",ll=p.forwardRef((e,t)=>{const{__scopeDialog:r,...s}=e,n=rn(eR,r);return o.jsx(Ye.button,{type:"button",...s,ref:t,onClick:Be(e.onClick,()=>n.onOpenChange(!1))})});ll.displayName=eR;function F0(e){return e?"open":"closed"}var tR="AlertDialog",[AI]=en(tR,[YE]),fa=YE(),rR=e=>{const{__scopeAlertDialog:t,...r}=e,s=fa(t);return o.jsx($0,{...s,...r,modal:!0})};rR.displayName=tR;var TI="AlertDialogTrigger",sR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=fa(r);return o.jsx(Om,{...n,...s,ref:t})});sR.displayName=TI;var MI="AlertDialogPortal",iR=e=>{const{__scopeAlertDialog:t,...r}=e,s=fa(t);return o.jsx(H0,{...s,...r})};iR.displayName=MI;var DI="AlertDialogOverlay",nR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=fa(r);return o.jsx(Bm,{...n,...s,ref:t})});nR.displayName=DI;var aR="AlertDialogContent",[LI,OI]=AI(aR),oR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:s,...n}=e,l=fa(r),c=p.useRef(null),d=ut(t,c),m=p.useRef(null);return o.jsx(LI,{scope:r,cancelRef:m,children:o.jsx(Pm,{role:"alertdialog",...l,...n,ref:d,onOpenAutoFocus:Be(n.onOpenAutoFocus,h=>{var v;h.preventDefault(),(v=m.current)==null||v.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:s})})});oR.displayName=aR;var BI="AlertDialogTitle",lR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=fa(r);return o.jsx(Im,{...n,...s,ref:t})});lR.displayName=BI;var PI="AlertDialogDescription",cR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=fa(r);return o.jsx(zm,{...n,...s,ref:t})});cR.displayName=PI;var II="AlertDialogAction",uR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,n=fa(r);return o.jsx(ll,{...n,...s,ref:t})});uR.displayName=II;var dR="AlertDialogCancel",hR=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...s}=e,{cancelRef:n}=OI(dR,r),l=fa(r),c=ut(t,n);return o.jsx(ll,{...l,...s,ref:c})});hR.displayName=dR;var zI=rR,fR=sR,$I=iR,mR=nR,pR=oR,gR=uR,vR=hR,_R=lR,xR=cR;function yR(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=yR(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function q0(){for(var e,t,r=0,s="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=yR(e))&&(s&&(s+=" "),s+=t);return s}const UI=(e,t)=>{const r=new Array(e.length+t.length);for(let s=0;s<e.length;s++)r[s]=e[s];for(let s=0;s<t.length;s++)r[e.length+s]=t[s];return r},HI=(e,t)=>({classGroupId:e,validator:t}),bR=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Qf="-",MC=[],FI="arbitrary..",qI=e=>{const t=VI(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return WI(c);const d=c.split(Qf),m=d[0]===""&&d.length>1?1:0;return wR(d,m,t)},getConflictingClassGroupIds:(c,d)=>{if(d){const m=s[c],h=r[c];return m?h?UI(h,m):m:h||MC}return r[c]||MC}}},wR=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],l=r.nextPart.get(n);if(l){const h=wR(e,t+1,l);if(h)return h}const c=r.validators;if(c===null)return;const d=t===0?e.join(Qf):e.slice(t).join(Qf),m=c.length;for(let h=0;h<m;h++){const v=c[h];if(v.validator(d))return v.classGroupId}},WI=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),s=t.slice(0,r);return s?FI+s:void 0})(),VI=e=>{const{theme:t,classGroups:r}=e;return GI(r,t)},GI=(e,t)=>{const r=bR();for(const s in e){const n=e[s];W0(n,r,s,t)}return r},W0=(e,t,r,s)=>{const n=e.length;for(let l=0;l<n;l++){const c=e[l];YI(c,t,r,s)}},YI=(e,t,r,s)=>{if(typeof e=="string"){KI(e,t,r);return}if(typeof e=="function"){XI(e,t,r,s);return}ZI(e,t,r,s)},KI=(e,t,r)=>{const s=e===""?t:SR(t,e);s.classGroupId=r},XI=(e,t,r,s)=>{if(QI(e)){W0(e(s),t,r,s);return}t.validators===null&&(t.validators=[]),t.validators.push(HI(r,e))},ZI=(e,t,r,s)=>{const n=Object.entries(e),l=n.length;for(let c=0;c<l;c++){const[d,m]=n[c];W0(m,SR(t,d),r,s)}},SR=(e,t)=>{let r=e;const s=t.split(Qf),n=s.length;for(let l=0;l<n;l++){const c=s[l];let d=r.nextPart.get(c);d||(d=bR(),r.nextPart.set(c,d)),r=d}return r},QI=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,JI=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),s=Object.create(null);const n=(l,c)=>{r[l]=c,t++,t>e&&(t=0,s=r,r=Object.create(null))};return{get(l){let c=r[l];if(c!==void 0)return c;if((c=s[l])!==void 0)return n(l,c),c},set(l,c){l in r?r[l]=c:n(l,c)}}},X_="!",DC=":",ez=[],LC=(e,t,r,s,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:s,isExternal:n}),tz=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=n=>{const l=[];let c=0,d=0,m=0,h;const v=n.length;for(let S=0;S<v;S++){const k=n[S];if(c===0&&d===0){if(k===DC){l.push(n.slice(m,S)),m=S+1;continue}if(k==="/"){h=S;continue}}k==="["?c++:k==="]"?c--:k==="("?d++:k===")"&&d--}const g=l.length===0?n:n.slice(m);let x=g,y=!1;g.endsWith(X_)?(x=g.slice(0,-1),y=!0):g.startsWith(X_)&&(x=g.slice(1),y=!0);const w=h&&h>m?h-m:void 0;return LC(l,y,x,w)};if(t){const n=t+DC,l=s;s=c=>c.startsWith(n)?l(c.slice(n.length)):LC(ez,!1,c,void 0,!0)}if(r){const n=s;s=l=>r({className:l,parseClassName:n})}return s},rz=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,s)=>{t.set(r,1e6+s)}),r=>{const s=[];let n=[];for(let l=0;l<r.length;l++){const c=r[l],d=c[0]==="[",m=t.has(c);d||m?(n.length>0&&(n.sort(),s.push(...n),n=[]),s.push(c)):n.push(c)}return n.length>0&&(n.sort(),s.push(...n)),s}},sz=e=>({cache:JI(e.cacheSize),parseClassName:tz(e),sortModifiers:rz(e),postfixLookupClassGroupIds:iz(e),...qI(e)}),iz=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let s=0;s<r.length;s++)t[r[s]]=!0;return t},nz=/\s+/,az=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:l,postfixLookupClassGroupIds:c}=t,d=[],m=e.trim().split(nz);let h="";for(let v=m.length-1;v>=0;v-=1){const g=m[v],{isExternal:x,modifiers:y,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:k}=r(g);if(x){h=g+(h.length>0?" "+h:h);continue}let C=!!k,E;if(C){const z=S.substring(0,k);E=s(z);const B=E&&c[E]?s(S):void 0;B&&B!==E&&(E=B,C=!1)}else E=s(S);if(!E){if(!C){h=g+(h.length>0?" "+h:h);continue}if(E=s(S),!E){h=g+(h.length>0?" "+h:h);continue}C=!1}const N=y.length===0?"":y.length===1?y[0]:l(y).join(":"),R=w?N+X_:N,T=R+E;if(d.indexOf(T)>-1)continue;d.push(T);const P=n(E,C);for(let z=0;z<P.length;++z){const B=P[z];d.push(R+B)}h=g+(h.length>0?" "+h:h)}return h},oz=(...e)=>{let t=0,r,s,n="";for(;t<e.length;)(r=e[t++])&&(s=CR(r))&&(n&&(n+=" "),n+=s);return n},CR=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=CR(e[s]))&&(r&&(r+=" "),r+=t);return r},lz=(e,...t)=>{let r,s,n,l;const c=m=>{const h=t.reduce((v,g)=>g(v),e());return r=sz(h),s=r.cache.get,n=r.cache.set,l=d,d(m)},d=m=>{const h=s(m);if(h)return h;const v=az(m,r);return n(m,v),v};return l=c,(...m)=>l(oz(...m))},cz=[],Lr=e=>{const t=r=>r[e]||cz;return t.isThemeGetter=!0,t},kR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ER=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ha=e=>uz.test(e),at=e=>!!e&&!Number.isNaN(Number(e)),hn=e=>!!e&&Number.isInteger(Number(e)),Iv=e=>e.endsWith("%")&&at(e.slice(0,-1)),Qn=e=>dz.test(e),RR=()=>!0,gz=e=>hz.test(e)&&!fz.test(e),V0=()=>!1,vz=e=>mz.test(e),_z=e=>pz.test(e),xz=e=>!je(e)&&!Ae(e),yz=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),bz=e=>go(e,AR,V0),je=e=>kR.test(e),zo=e=>go(e,TR,gz),OC=e=>go(e,jz,at),wz=e=>go(e,DR,RR),Sz=e=>go(e,MR,V0),BC=e=>go(e,NR,V0),Cz=e=>go(e,jR,_z),ef=e=>go(e,LR,vz),Ae=e=>ER.test(e),Cu=e=>cl(e,TR),kz=e=>cl(e,MR),PC=e=>cl(e,NR),Ez=e=>cl(e,AR),Rz=e=>cl(e,jR),tf=e=>cl(e,LR,!0),Nz=e=>cl(e,DR,!0),go=(e,t,r)=>{const s=kR.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},cl=(e,t,r=!1)=>{const s=ER.exec(e);return s?s[1]?t(s[1]):r:!1},NR=e=>e==="position"||e==="percentage",jR=e=>e==="image"||e==="url",AR=e=>e==="length"||e==="size"||e==="bg-size",TR=e=>e==="length",jz=e=>e==="number",MR=e=>e==="family-name",DR=e=>e==="number"||e==="weight",LR=e=>e==="shadow",Az=()=>{const e=Lr("color"),t=Lr("font"),r=Lr("text"),s=Lr("font-weight"),n=Lr("tracking"),l=Lr("leading"),c=Lr("breakpoint"),d=Lr("container"),m=Lr("spacing"),h=Lr("radius"),v=Lr("shadow"),g=Lr("inset-shadow"),x=Lr("text-shadow"),y=Lr("drop-shadow"),w=Lr("blur"),S=Lr("perspective"),k=Lr("aspect"),C=Lr("ease"),E=Lr("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...R(),Ae,je],P=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],B=()=>[Ae,je,m],F=()=>[Ha,"full","auto",...B()],Y=()=>[hn,"none","subgrid",Ae,je],q=()=>["auto",{span:["full",hn,Ae,je]},hn,Ae,je],$=()=>[hn,"auto",Ae,je],M=()=>["auto","min","max","fr",Ae,je],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...B()],O=()=>[Ha,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],L=()=>[Ha,"screen","full","dvw","lvw","svw","min","max","fit",...B()],G=()=>[Ha,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],H=()=>[e,Ae,je],D=()=>[...R(),PC,BC,{position:[Ae,je]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",Ez,bz,{size:[Ae,je]}],J=()=>[Iv,Cu,zo],se=()=>["","none","full",h,Ae,je],de=()=>["",at,Cu,zo],Z=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[at,Iv,PC,BC],we=()=>["","none",w,Ae,je],Ee=()=>["none",at,Ae,je],Re=()=>["none",at,Ae,je],te=()=>[at,Ae,je],ie=()=>[Ha,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qn],breakpoint:[Qn],color:[RR],container:[Qn],"drop-shadow":[Qn],ease:["in","out","in-out"],font:[xz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qn],shadow:[Qn],spacing:["px",at],text:[Qn],"text-shadow":[Qn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ha,je,Ae,k]}],container:["container"],"container-type":[{"@container":["","normal","size",Ae,je]}],"container-named":[yz],columns:[{columns:[at,je,Ae,d]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{"inset-s":F(),start:F()}],end:[{"inset-e":F(),end:F()}],"inset-bs":[{"inset-bs":F()}],"inset-be":[{"inset-be":F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[hn,"auto",Ae,je]}],basis:[{basis:[Ha,"full","auto",d,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[at,Ha,"auto","initial","none",je]}],grow:[{grow:["",at,Ae,je]}],shrink:[{shrink:["",at,Ae,je]}],order:[{order:[hn,"first","last","none",Ae,je]}],"grid-cols":[{"grid-cols":Y()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":Y()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],"inline-size":[{inline:["auto",...L()]}],"min-inline-size":[{"min-inline":["auto",...L()]}],"max-inline-size":[{"max-inline":["none",...L()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[d,"screen",...O()]}],"min-w":[{"min-w":[d,"screen","none",...O()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[c]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",r,Cu,zo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Nz,wz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Iv,je]}],"font-family":[{font:[kz,Sz,t]}],"font-features":[{"font-features":[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,Ae,je]}],"line-clamp":[{"line-clamp":[at,"none",Ae,OC]}],leading:[{leading:[l,...B()]}],"list-image":[{"list-image":["none",Ae,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[at,"from-font","auto",Ae,zo]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[at,"auto",Ae,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"tab-size":[{tab:[hn,Ae,je]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},hn,Ae,je],radial:["",Ae,je],conic:[hn,Ae,je]},Rz,Cz]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[at,Ae,je]}],"outline-w":[{outline:["",at,Cu,zo]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,tf,ef]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",g,tf,ef]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[at,zo]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",x,tf,ef]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[at,Ae,je]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[at]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[Ae,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[at]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,je]}],filter:[{filter:["","none",Ae,je]}],blur:[{blur:we()}],brightness:[{brightness:[at,Ae,je]}],contrast:[{contrast:[at,Ae,je]}],"drop-shadow":[{"drop-shadow":["","none",y,tf,ef]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",at,Ae,je]}],"hue-rotate":[{"hue-rotate":[at,Ae,je]}],invert:[{invert:["",at,Ae,je]}],saturate:[{saturate:[at,Ae,je]}],sepia:[{sepia:["",at,Ae,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,je]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[at,Ae,je]}],"backdrop-contrast":[{"backdrop-contrast":[at,Ae,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",at,Ae,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[at,Ae,je]}],"backdrop-invert":[{"backdrop-invert":["",at,Ae,je]}],"backdrop-opacity":[{"backdrop-opacity":[at,Ae,je]}],"backdrop-saturate":[{"backdrop-saturate":[at,Ae,je]}],"backdrop-sepia":[{"backdrop-sepia":["",at,Ae,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[at,"initial",Ae,je]}],ease:[{ease:["linear","initial",C,Ae,je]}],delay:[{delay:[at,Ae,je]}],animate:[{animate:["none",E,Ae,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ae,je]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Ee()}],"rotate-x":[{"rotate-x":Ee()}],"rotate-y":[{"rotate-y":Ee()}],"rotate-z":[{"rotate-z":Ee()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[Ae,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":["translate-none"],zoom:[{zoom:[hn,Ae,je]}],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":H()}],"scrollbar-track-color":[{"scrollbar-track":H()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae,je]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[at,Cu,zo,OC]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},OR=lz(Az);function Je(...e){return OR(q0(e))}const IC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,zC=q0,BR=(e,t)=>r=>{var s;if((t==null?void 0:t.variants)==null)return zC(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:l}=t,c=Object.keys(n).map(h=>{const v=r==null?void 0:r[h],g=l==null?void 0:l[h];if(v===null)return null;const x=IC(v)||IC(g);return n[h][x]}),d=r&&Object.entries(r).reduce((h,v)=>{let[g,x]=v;return x===void 0||(h[g]=x),h},{}),m=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((h,v)=>{let{class:g,className:x,...y}=v;return Object.entries(y).every(w=>{let[S,k]=w;return Array.isArray(k)?k.includes({...l,...d}[S]):{...l,...d}[S]===k})?[...h,g,x]:h},[]);return zC(e,c,m,r==null?void 0:r.class,r==null?void 0:r.className)},Tz=BR("group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border border-transparent bg-clip-padding text-sm font-medium transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)]","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),re=p.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...n},l)=>{const c=s?oP:"button";return o.jsx(c,{ref:l,"data-slot":"button","data-variant":t??"default","data-size":r??"default",className:Je(Tz({variant:t,size:r,className:e})),...n})});re.displayName="Button";function ji(e){return o.jsx(zI,{"data-slot":"alert-dialog",...e})}const jn=p.forwardRef((e,t)=>o.jsx(fR,{ref:t,"data-slot":"alert-dialog-trigger",...e}));jn.displayName=fR.displayName;function Mz(e){return o.jsx($I,{"data-slot":"alert-dialog-portal",...e})}const PR=p.forwardRef(({className:e,...t},r)=>o.jsx(mR,{ref:r,"data-slot":"alert-dialog-overlay",className:Je("fixed inset-0 z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));PR.displayName=mR.displayName;const ti=p.forwardRef(({className:e,size:t="default",...r},s)=>o.jsxs(Mz,{children:[o.jsx(PR,{}),o.jsx(pR,{ref:s,"data-slot":"alert-dialog-content","data-size":t,className:Je("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] min-w-0 -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...r})]}));ti.displayName=pR.displayName;function Ai({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-header",className:Je("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Ti({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-footer",className:Je("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function IR({className:e,...t}){return o.jsx("div",{"data-slot":"alert-dialog-media",className:Je("mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",e),...t})}const ri=p.forwardRef(({className:e,...t},r)=>o.jsx(_R,{ref:r,"data-slot":"alert-dialog-title",className:Je("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t}));ri.displayName=_R.displayName;const si=p.forwardRef(({className:e,...t},r)=>o.jsx(xR,{ref:r,"data-slot":"alert-dialog-description",className:Je("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));si.displayName=xR.displayName;const Mi=p.forwardRef(({className:e,variant:t="default",size:r="default",...s},n)=>o.jsx(re,{variant:t,size:r,asChild:!0,children:o.jsx(gR,{ref:n,"data-slot":"alert-dialog-action",className:Je(e),...s})}));Mi.displayName=gR.displayName;const ii=p.forwardRef(({className:e,variant:t="outline",size:r="default",...s},n)=>o.jsx(re,{variant:t,size:r,asChild:!0,children:o.jsx(vR,{ref:n,"data-slot":"alert-dialog-cancel",className:Je(e),...s})}));ii.displayName=vR.displayName;function sn(e){return o.jsx($0,{"data-slot":"dialog",...e})}const zR=p.forwardRef((e,t)=>o.jsx(Om,{ref:t,"data-slot":"dialog-trigger",...e}));zR.displayName=Om.displayName;function Dz(e){return o.jsx(H0,{"data-slot":"dialog-portal",...e})}const $m=p.forwardRef((e,t)=>o.jsx(ll,{ref:t,"data-slot":"dialog-close",...e}));$m.displayName=ll.displayName;const $R=p.forwardRef(({className:e,...t},r)=>o.jsx(Bm,{ref:r,"data-slot":"dialog-overlay",className:Je("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-[backdrop-filter]:backdrop-blur-xs data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t}));$R.displayName=Bm.displayName;const Di=p.forwardRef(({className:e,children:t,showCloseButton:r=!0,...s},n)=>o.jsxs(Dz,{children:[o.jsx($R,{}),o.jsxs(Pm,{ref:n,"data-slot":"dialog-content",className:Je("fixed top-1/2 left-1/2 z-50 grid w-full min-w-0 max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-cols-1 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 [&>*]:min-w-0",e),...s,children:[t,r&&o.jsx(ll,{"data-slot":"dialog-close",asChild:!0,children:o.jsxs(re,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",children:[o.jsx(Ni,{"aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:"Close"})]})})]})]}));Di.displayName=Pm.displayName;function An({className:e,...t}){return o.jsx("div",{"data-slot":"dialog-header",className:Je("flex flex-col gap-2",e),...t})}function ma({className:e,showCloseButton:t=!1,children:r,...s}){return o.jsxs("div",{"data-slot":"dialog-footer",className:Je("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...s,children:[r,t&&o.jsx(ll,{asChild:!0,children:o.jsx(re,{variant:"outline",children:"Close"})})]})}const Li=p.forwardRef(({className:e,...t},r)=>o.jsx(Im,{ref:r,"data-slot":"dialog-title",className:Je("text-base leading-none font-medium",e),...t}));Li.displayName=Im.displayName;const vo=p.forwardRef(({className:e,...t},r)=>o.jsx(zm,{ref:r,"data-slot":"dialog-description",className:Je("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t}));vo.displayName=zm.displayName;function G0(e){const t=e+"CollectionProvider",[r,s]=en(t),[n,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),c=S=>{const{scope:k,children:C}=S,E=p.useRef(null),N=p.useRef(new Map).current;return o.jsx(n,{scope:k,itemMap:N,collectionRef:E,children:C})};c.displayName=t;const d=e+"CollectionSlot",m=rl(d),h=p.forwardRef((S,k)=>{const{scope:C,children:E}=S,N=l(d,C),R=ut(k,N.collectionRef);return o.jsx(m,{ref:R,children:E})});h.displayName=d;const v=e+"CollectionItemSlot",g="data-radix-collection-item",x=rl(v),y=p.forwardRef((S,k)=>{const{scope:C,children:E,...N}=S,R=p.useRef(null),T=ut(k,R),P=l(v,C);return p.useEffect(()=>(P.itemMap.set(R,{ref:R,...N}),()=>void P.itemMap.delete(R))),o.jsx(x,{[g]:"",ref:T,children:E})});y.displayName=v;function w(S){const k=l(e+"CollectionConsumer",S);return p.useCallback(()=>{const E=k.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(k.itemMap.values()).sort((P,z)=>N.indexOf(P.ref.current)-N.indexOf(z.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:c,Slot:h,ItemSlot:y},w,s]}var Lz=p.createContext(void 0);function yd(e){const t=p.useContext(Lz);return e||t||"ltr"}const Oz=["top","right","bottom","left"],oo=Math.min,Ks=Math.max,Jf=Math.round,rf=Math.floor,Sn=e=>({x:e,y:e}),Bz={left:"right",right:"left",bottom:"top",top:"bottom"};function Z_(e,t,r){return Ks(e,oo(t,r))}function la(e,t){return typeof e=="function"?e(t):e}function ca(e){return e.split("-")[0]}function Cc(e){return e.split("-")[1]}function Y0(e){return e==="x"?"y":"x"}function K0(e){return e==="y"?"height":"width"}function bn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function X0(e){return Y0(bn(e))}function Pz(e,t,r){r===void 0&&(r=!1);const s=Cc(e),n=X0(e),l=K0(n);let c=n==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=em(c)),[c,em(c)]}function Iz(e){const t=em(e);return[Q_(e),t,Q_(t)]}function Q_(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const $C=["left","right"],UC=["right","left"],zz=["top","bottom"],$z=["bottom","top"];function Uz(e,t,r){switch(e){case"top":case"bottom":return r?t?UC:$C:t?$C:UC;case"left":case"right":return t?zz:$z;default:return[]}}function Hz(e,t,r,s){const n=Cc(e);let l=Uz(ca(e),r==="start",s);return n&&(l=l.map(c=>c+"-"+n),t&&(l=l.concat(l.map(Q_)))),l}function em(e){const t=ca(e);return Bz[t]+e.slice(t.length)}function Fz(e){return{top:0,right:0,bottom:0,left:0,...e}}function UR(e){return typeof e!="number"?Fz(e):{top:e,right:e,bottom:e,left:e}}function tm(e){const{x:t,y:r,width:s,height:n}=e;return{width:s,height:n,top:r,left:t,right:t+s,bottom:r+n,x:t,y:r}}function HC(e,t,r){let{reference:s,floating:n}=e;const l=bn(t),c=X0(t),d=K0(c),m=ca(t),h=l==="y",v=s.x+s.width/2-n.width/2,g=s.y+s.height/2-n.height/2,x=s[d]/2-n[d]/2;let y;switch(m){case"top":y={x:v,y:s.y-n.height};break;case"bottom":y={x:v,y:s.y+s.height};break;case"right":y={x:s.x+s.width,y:g};break;case"left":y={x:s.x-n.width,y:g};break;default:y={x:s.x,y:s.y}}switch(Cc(t)){case"start":y[c]-=x*(r&&h?-1:1);break;case"end":y[c]+=x*(r&&h?-1:1);break}return y}async function qz(e,t){var r;t===void 0&&(t={});const{x:s,y:n,platform:l,rects:c,elements:d,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:v="viewport",elementContext:g="floating",altBoundary:x=!1,padding:y=0}=la(t,e),w=UR(y),k=d[x?g==="floating"?"reference":"floating":g],C=tm(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(k)))==null||r?k:k.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:h,rootBoundary:v,strategy:m})),E=g==="floating"?{x:s,y:n,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),R=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},T=tm(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:E,offsetParent:N,strategy:m}):E);return{top:(C.top-T.top+w.top)/R.y,bottom:(T.bottom-C.bottom+w.bottom)/R.y,left:(C.left-T.left+w.left)/R.x,right:(T.right-C.right+w.right)/R.x}}const Wz=50,Vz=async(e,t,r)=>{const{placement:s="bottom",strategy:n="absolute",middleware:l=[],platform:c}=r,d=c.detectOverflow?c:{...c,detectOverflow:qz},m=await(c.isRTL==null?void 0:c.isRTL(t));let h=await c.getElementRects({reference:e,floating:t,strategy:n}),{x:v,y:g}=HC(h,s,m),x=s,y=0;const w={};for(let S=0;S<l.length;S++){const k=l[S];if(!k)continue;const{name:C,fn:E}=k,{x:N,y:R,data:T,reset:P}=await E({x:v,y:g,initialPlacement:s,placement:x,strategy:n,middlewareData:w,rects:h,platform:d,elements:{reference:e,floating:t}});v=N??v,g=R??g,w[C]={...w[C],...T},P&&y<Wz&&(y++,typeof P=="object"&&(P.placement&&(x=P.placement),P.rects&&(h=P.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:n}):P.rects),{x:v,y:g}=HC(h,x,m)),S=-1)}return{x:v,y:g,placement:x,strategy:n,middlewareData:w}},Gz=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:n,rects:l,platform:c,elements:d,middlewareData:m}=t,{element:h,padding:v=0}=la(e,t)||{};if(h==null)return{};const g=UR(v),x={x:r,y:s},y=X0(n),w=K0(y),S=await c.getDimensions(h),k=y==="y",C=k?"top":"left",E=k?"bottom":"right",N=k?"clientHeight":"clientWidth",R=l.reference[w]+l.reference[y]-x[y]-l.floating[w],T=x[y]-l.reference[y],P=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let z=P?P[N]:0;(!z||!await(c.isElement==null?void 0:c.isElement(P)))&&(z=d.floating[N]||l.floating[w]);const B=R/2-T/2,F=z/2-S[w]/2-1,Y=oo(g[C],F),q=oo(g[E],F),$=Y,M=z-S[w]-q,U=z/2-S[w]/2+B,W=Z_($,U,M),A=!m.arrow&&Cc(n)!=null&&U!==W&&l.reference[w]/2-(U<$?Y:q)-S[w]/2<0,O=A?U<$?U-$:U-M:0;return{[y]:x[y]+O,data:{[y]:W,centerOffset:U-W-O,...A&&{alignmentOffset:O}},reset:A}}}),Yz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:n,middlewareData:l,rects:c,initialPlacement:d,platform:m,elements:h}=t,{mainAxis:v=!0,crossAxis:g=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...k}=la(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const C=ca(n),E=bn(d),N=ca(d)===d,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),T=x||(N||!S?[em(d)]:Iz(d)),P=w!=="none";!x&&P&&T.push(...Hz(d,S,w,R));const z=[d,...T],B=await m.detectOverflow(t,k),F=[];let Y=((s=l.flip)==null?void 0:s.overflows)||[];if(v&&F.push(B[C]),g){const U=Pz(n,c,R);F.push(B[U[0]],B[U[1]])}if(Y=[...Y,{placement:n,overflows:F}],!F.every(U=>U<=0)){var q,$;const U=(((q=l.flip)==null?void 0:q.index)||0)+1,W=z[U];if(W&&(!(g==="alignment"?E!==bn(W):!1)||Y.every(L=>bn(L.placement)===E?L.overflows[0]>0:!0)))return{data:{index:U,overflows:Y},reset:{placement:W}};let A=($=Y.filter(O=>O.overflows[0]<=0).sort((O,L)=>O.overflows[1]-L.overflows[1])[0])==null?void 0:$.placement;if(!A)switch(y){case"bestFit":{var M;const O=(M=Y.filter(L=>{if(P){const G=bn(L.placement);return G===E||G==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(G=>G>0).reduce((G,H)=>G+H,0)]).sort((L,G)=>L[1]-G[1])[0])==null?void 0:M[0];O&&(A=O);break}case"initialPlacement":A=d;break}if(n!==A)return{reset:{placement:A}}}return{}}}};function FC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qC(e){return Oz.some(t=>e[t]>=0)}const Kz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:s}=t,{strategy:n="referenceHidden",...l}=la(e,t);switch(n){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=FC(c,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:qC(d)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),d=FC(c,r.floating);return{data:{escapedOffsets:d,escaped:qC(d)}}}default:return{}}}}},HR=new Set(["left","top"]);async function Xz(e,t){const{placement:r,platform:s,elements:n}=e,l=await(s.isRTL==null?void 0:s.isRTL(n.floating)),c=ca(r),d=Cc(r),m=bn(r)==="y",h=HR.has(c)?-1:1,v=l&&m?-1:1,g=la(t,e);let{mainAxis:x,crossAxis:y,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof w=="number"&&(y=d==="end"?w*-1:w),m?{x:y*v,y:x*h}:{x:x*h,y:y*v}}const Zz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:n,y:l,placement:c,middlewareData:d}=t,m=await Xz(t,e);return c===((r=d.offset)==null?void 0:r.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:n+m.x,y:l+m.y,data:{...m,placement:c}}}}},Qz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:n,platform:l}=t,{mainAxis:c=!0,crossAxis:d=!1,limiter:m={fn:C=>{let{x:E,y:N}=C;return{x:E,y:N}}},...h}=la(e,t),v={x:r,y:s},g=await l.detectOverflow(t,h),x=bn(ca(n)),y=Y0(x);let w=v[y],S=v[x];if(c){const C=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=w+g[C],R=w-g[E];w=Z_(N,w,R)}if(d){const C=x==="y"?"top":"left",E=x==="y"?"bottom":"right",N=S+g[C],R=S-g[E];S=Z_(N,S,R)}const k=m.fn({...t,[y]:w,[x]:S});return{...k,data:{x:k.x-r,y:k.y-s,enabled:{[y]:c,[x]:d}}}}}},Jz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:s,placement:n,rects:l,middlewareData:c}=t,{offset:d=0,mainAxis:m=!0,crossAxis:h=!0}=la(e,t),v={x:r,y:s},g=bn(n),x=Y0(g);let y=v[x],w=v[g];const S=la(d,t),k=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(m){const N=x==="y"?"height":"width",R=l.reference[x]-l.floating[N]+k.mainAxis,T=l.reference[x]+l.reference[N]-k.mainAxis;y<R?y=R:y>T&&(y=T)}if(h){var C,E;const N=x==="y"?"width":"height",R=HR.has(ca(n)),T=l.reference[g]-l.floating[N]+(R&&((C=c.offset)==null?void 0:C[g])||0)+(R?0:k.crossAxis),P=l.reference[g]+l.reference[N]+(R?0:((E=c.offset)==null?void 0:E[g])||0)-(R?k.crossAxis:0);w<T?w=T:w>P&&(w=P)}return{[x]:y,[g]:w}}}},e8=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,s;const{placement:n,rects:l,platform:c,elements:d}=t,{apply:m=()=>{},...h}=la(e,t),v=await c.detectOverflow(t,h),g=ca(n),x=Cc(n),y=bn(n)==="y",{width:w,height:S}=l.floating;let k,C;g==="top"||g==="bottom"?(k=g,C=x===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,k=x==="end"?"top":"bottom");const E=S-v.top-v.bottom,N=w-v.left-v.right,R=oo(S-v[k],E),T=oo(w-v[C],N),P=!t.middlewareData.shift;let z=R,B=T;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(B=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(z=E),P&&!x){const Y=Ks(v.left,0),q=Ks(v.right,0),$=Ks(v.top,0),M=Ks(v.bottom,0);y?B=w-2*(Y!==0||q!==0?Y+q:Ks(v.left,v.right)):z=S-2*($!==0||M!==0?$+M:Ks(v.top,v.bottom))}await m({...t,availableWidth:B,availableHeight:z});const F=await c.getDimensions(d.floating);return w!==F.width||S!==F.height?{reset:{rects:!0}}:{}}}};function Um(){return typeof window<"u"}function kc(e){return FR(e)?(e.nodeName||"").toLowerCase():"#document"}function Qs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Tn(e){var t;return(t=(FR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function FR(e){return Um()?e instanceof Node||e instanceof Qs(e).Node:!1}function Xi(e){return Um()?e instanceof Element||e instanceof Qs(e).Element:!1}function pa(e){return Um()?e instanceof HTMLElement||e instanceof Qs(e).HTMLElement:!1}function WC(e){return!Um()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qs(e).ShadowRoot}function bd(e){const{overflow:t,overflowX:r,overflowY:s,display:n}=Zi(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&n!=="inline"&&n!=="contents"}function t8(e){return/^(table|td|th)$/.test(kc(e))}function Hm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const r8=/transform|translate|scale|rotate|perspective|filter/,s8=/paint|layout|strict|content/,$o=e=>!!e&&e!=="none";let zv;function Z0(e){const t=Xi(e)?Zi(e):e;return $o(t.transform)||$o(t.translate)||$o(t.scale)||$o(t.rotate)||$o(t.perspective)||!Q0()&&($o(t.backdropFilter)||$o(t.filter))||r8.test(t.willChange||"")||s8.test(t.contain||"")}function i8(e){let t=lo(e);for(;pa(t)&&!gc(t);){if(Z0(t))return t;if(Hm(t))return null;t=lo(t)}return null}function Q0(){return zv==null&&(zv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zv}function gc(e){return/^(html|body|#document)$/.test(kc(e))}function Zi(e){return Qs(e).getComputedStyle(e)}function Fm(e){return Xi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lo(e){if(kc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||WC(e)&&e.host||Tn(e);return WC(t)?t.host:t}function qR(e){const t=lo(e);return gc(t)?e.ownerDocument?e.ownerDocument.body:e.body:pa(t)&&bd(t)?t:qR(t)}function rd(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=qR(e),l=n===((s=e.ownerDocument)==null?void 0:s.body),c=Qs(n);if(l){const d=J_(c);return t.concat(c,c.visualViewport||[],bd(n)?n:[],d&&r?rd(d):[])}else return t.concat(n,rd(n,[],r))}function J_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function WR(e){const t=Zi(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const n=pa(e),l=n?e.offsetWidth:r,c=n?e.offsetHeight:s,d=Jf(r)!==l||Jf(s)!==c;return d&&(r=l,s=c),{width:r,height:s,$:d}}function J0(e){return Xi(e)?e:e.contextElement}function dc(e){const t=J0(e);if(!pa(t))return Sn(1);const r=t.getBoundingClientRect(),{width:s,height:n,$:l}=WR(t);let c=(l?Jf(r.width):r.width)/s,d=(l?Jf(r.height):r.height)/n;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const n8=Sn(0);function VR(e){const t=Qs(e);return!Q0()||!t.visualViewport?n8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function a8(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qs(e)?!1:t}function sl(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),l=J0(e);let c=Sn(1);t&&(s?Xi(s)&&(c=dc(s)):c=dc(e));const d=a8(l,r,s)?VR(l):Sn(0);let m=(n.left+d.x)/c.x,h=(n.top+d.y)/c.y,v=n.width/c.x,g=n.height/c.y;if(l){const x=Qs(l),y=s&&Xi(s)?Qs(s):s;let w=x,S=J_(w);for(;S&&s&&y!==w;){const k=dc(S),C=S.getBoundingClientRect(),E=Zi(S),N=C.left+(S.clientLeft+parseFloat(E.paddingLeft))*k.x,R=C.top+(S.clientTop+parseFloat(E.paddingTop))*k.y;m*=k.x,h*=k.y,v*=k.x,g*=k.y,m+=N,h+=R,w=Qs(S),S=J_(w)}}return tm({width:v,height:g,x:m,y:h})}function qm(e,t){const r=Fm(e).scrollLeft;return t?t.left+r:sl(Tn(e)).left+r}function GR(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-qm(e,r),n=r.top+t.scrollTop;return{x:s,y:n}}function o8(e){let{elements:t,rect:r,offsetParent:s,strategy:n}=e;const l=n==="fixed",c=Tn(s),d=t?Hm(t.floating):!1;if(s===c||d&&l)return r;let m={scrollLeft:0,scrollTop:0},h=Sn(1);const v=Sn(0),g=pa(s);if((g||!g&&!l)&&((kc(s)!=="body"||bd(c))&&(m=Fm(s)),g)){const y=sl(s);h=dc(s),v.x=y.x+s.clientLeft,v.y=y.y+s.clientTop}const x=c&&!g&&!l?GR(c,m):Sn(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+v.x+x.x,y:r.y*h.y-m.scrollTop*h.y+v.y+x.y}}function l8(e){return Array.from(e.getClientRects())}function c8(e){const t=Tn(e),r=Fm(e),s=e.ownerDocument.body,n=Ks(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Ks(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-r.scrollLeft+qm(e);const d=-r.scrollTop;return Zi(s).direction==="rtl"&&(c+=Ks(t.clientWidth,s.clientWidth)-n),{width:n,height:l,x:c,y:d}}const VC=25;function u8(e,t){const r=Qs(e),s=Tn(e),n=r.visualViewport;let l=s.clientWidth,c=s.clientHeight,d=0,m=0;if(n){l=n.width,c=n.height;const v=Q0();(!v||v&&t==="fixed")&&(d=n.offsetLeft,m=n.offsetTop)}const h=qm(s);if(h<=0){const v=s.ownerDocument,g=v.body,x=getComputedStyle(g),y=v.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,w=Math.abs(s.clientWidth-g.clientWidth-y);w<=VC&&(l-=w)}else h<=VC&&(l+=h);return{width:l,height:c,x:d,y:m}}function d8(e,t){const r=sl(e,!0,t==="fixed"),s=r.top+e.clientTop,n=r.left+e.clientLeft,l=pa(e)?dc(e):Sn(1),c=e.clientWidth*l.x,d=e.clientHeight*l.y,m=n*l.x,h=s*l.y;return{width:c,height:d,x:m,y:h}}function GC(e,t,r){let s;if(t==="viewport")s=u8(e,r);else if(t==="document")s=c8(Tn(e));else if(Xi(t))s=d8(t,r);else{const n=VR(e);s={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return tm(s)}function YR(e,t){const r=lo(e);return r===t||!Xi(r)||gc(r)?!1:Zi(r).position==="fixed"||YR(r,t)}function h8(e,t){const r=t.get(e);if(r)return r;let s=rd(e,[],!1).filter(d=>Xi(d)&&kc(d)!=="body"),n=null;const l=Zi(e).position==="fixed";let c=l?lo(e):e;for(;Xi(c)&&!gc(c);){const d=Zi(c),m=Z0(c);!m&&d.position==="fixed"&&(n=null),(l?!m&&!n:!m&&d.position==="static"&&!!n&&(n.position==="absolute"||n.position==="fixed")||bd(c)&&!m&&YR(e,c))?s=s.filter(v=>v!==c):n=d,c=lo(c)}return t.set(e,s),s}function f8(e){let{element:t,boundary:r,rootBoundary:s,strategy:n}=e;const c=[...r==="clippingAncestors"?Hm(t)?[]:h8(t,this._c):[].concat(r),s],d=GC(t,c[0],n);let m=d.top,h=d.right,v=d.bottom,g=d.left;for(let x=1;x<c.length;x++){const y=GC(t,c[x],n);m=Ks(y.top,m),h=oo(y.right,h),v=oo(y.bottom,v),g=Ks(y.left,g)}return{width:h-g,height:v-m,x:g,y:m}}function m8(e){const{width:t,height:r}=WR(e);return{width:t,height:r}}function p8(e,t,r){const s=pa(t),n=Tn(t),l=r==="fixed",c=sl(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const m=Sn(0);function h(){m.x=qm(n)}if(s||!s&&!l)if((kc(t)!=="body"||bd(n))&&(d=Fm(t)),s){const y=sl(t,!0,l,t);m.x=y.x+t.clientLeft,m.y=y.y+t.clientTop}else n&&h();l&&!s&&n&&h();const v=n&&!s&&!l?GR(n,d):Sn(0),g=c.left+d.scrollLeft-m.x-v.x,x=c.top+d.scrollTop-m.y-v.y;return{x:g,y:x,width:c.width,height:c.height}}function $v(e){return Zi(e).position==="static"}function YC(e,t){if(!pa(e)||Zi(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Tn(e)===r&&(r=r.ownerDocument.body),r}function KR(e,t){const r=Qs(e);if(Hm(e))return r;if(!pa(e)){let n=lo(e);for(;n&&!gc(n);){if(Xi(n)&&!$v(n))return n;n=lo(n)}return r}let s=YC(e,t);for(;s&&t8(s)&&$v(s);)s=YC(s,t);return s&&gc(s)&&$v(s)&&!Z0(s)?r:s||i8(e)||r}const g8=async function(e){const t=this.getOffsetParent||KR,r=this.getDimensions,s=await r(e.floating);return{reference:p8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function v8(e){return Zi(e).direction==="rtl"}const _8={convertOffsetParentRelativeRectToViewportRelativeRect:o8,getDocumentElement:Tn,getClippingRect:f8,getOffsetParent:KR,getElementRects:g8,getClientRects:l8,getDimensions:m8,getScale:dc,isElement:Xi,isRTL:v8};function XR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function x8(e,t){let r=null,s;const n=Tn(e);function l(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function c(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),l();const h=e.getBoundingClientRect(),{left:v,top:g,width:x,height:y}=h;if(d||t(),!x||!y)return;const w=rf(g),S=rf(n.clientWidth-(v+x)),k=rf(n.clientHeight-(g+y)),C=rf(v),N={rootMargin:-w+"px "+-S+"px "+-k+"px "+-C+"px",threshold:Ks(0,oo(1,m))||1};let R=!0;function T(P){const z=P[0].intersectionRatio;if(z!==m){if(!R)return c();z?c(!1,z):s=setTimeout(()=>{c(!1,1e-7)},1e3)}z===1&&!XR(h,e.getBoundingClientRect())&&c(),R=!1}try{r=new IntersectionObserver(T,{...N,root:n.ownerDocument})}catch{r=new IntersectionObserver(T,N)}r.observe(e)}return c(!0),l}function y8(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:n=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=s,h=J0(e),v=n||l?[...h?rd(h):[],...t?rd(t):[]]:[];v.forEach(C=>{n&&C.addEventListener("scroll",r,{passive:!0}),l&&C.addEventListener("resize",r)});const g=h&&d?x8(h,r):null;let x=-1,y=null;c&&(y=new ResizeObserver(C=>{let[E]=C;E&&E.target===h&&y&&t&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(t)})),r()}),h&&!m&&y.observe(h),t&&y.observe(t));let w,S=m?sl(e):null;m&&k();function k(){const C=sl(e);S&&!XR(S,C)&&r(),S=C,w=requestAnimationFrame(k)}return r(),()=>{var C;v.forEach(E=>{n&&E.removeEventListener("scroll",r),l&&E.removeEventListener("resize",r)}),g==null||g(),(C=y)==null||C.disconnect(),y=null,m&&cancelAnimationFrame(w)}}const b8=Zz,w8=Qz,S8=Yz,C8=e8,k8=Kz,KC=Gz,E8=Jz,R8=(e,t,r)=>{const s=new Map,n={platform:_8,...r},l={...n.platform,_c:s};return Vz(e,t,{...n,platform:l})};var N8=typeof document<"u",j8=function(){},Nf=N8?p.useLayoutEffect:j8;function rm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(s=r;s--!==0;)if(!rm(e[s],t[s]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,n[s]))return!1;for(s=r;s--!==0;){const l=n[s];if(!(l==="_owner"&&e.$$typeof)&&!rm(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function ZR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function XC(e,t){const r=ZR(e);return Math.round(t*r)/r}function Uv(e){const t=p.useRef(e);return Nf(()=>{t.current=e}),t}function A8(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:n,elements:{reference:l,floating:c}={},transform:d=!0,whileElementsMounted:m,open:h}=e,[v,g]=p.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[x,y]=p.useState(s);rm(x,s)||y(s);const[w,S]=p.useState(null),[k,C]=p.useState(null),E=p.useCallback(L=>{L!==P.current&&(P.current=L,S(L))},[]),N=p.useCallback(L=>{L!==z.current&&(z.current=L,C(L))},[]),R=l||w,T=c||k,P=p.useRef(null),z=p.useRef(null),B=p.useRef(v),F=m!=null,Y=Uv(m),q=Uv(n),$=Uv(h),M=p.useCallback(()=>{if(!P.current||!z.current)return;const L={placement:t,strategy:r,middleware:x};q.current&&(L.platform=q.current),R8(P.current,z.current,L).then(G=>{const H={...G,isPositioned:$.current!==!1};U.current&&!rm(B.current,H)&&(B.current=H,ha.flushSync(()=>{g(H)}))})},[x,t,r,q,$]);Nf(()=>{h===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,g(L=>({...L,isPositioned:!1})))},[h]);const U=p.useRef(!1);Nf(()=>(U.current=!0,()=>{U.current=!1}),[]),Nf(()=>{if(R&&(P.current=R),T&&(z.current=T),R&&T){if(Y.current)return Y.current(R,T,M);M()}},[R,T,M,Y,F]);const W=p.useMemo(()=>({reference:P,floating:z,setReference:E,setFloating:N}),[E,N]),A=p.useMemo(()=>({reference:R,floating:T}),[R,T]),O=p.useMemo(()=>{const L={position:r,left:0,top:0};if(!A.floating)return L;const G=XC(A.floating,v.x),H=XC(A.floating,v.y);return d?{...L,transform:"translate("+G+"px, "+H+"px)",...ZR(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:G,top:H}},[r,d,A.floating,v.x,v.y]);return p.useMemo(()=>({...v,update:M,refs:W,elements:A,floatingStyles:O}),[v,M,W,A,O])}const T8=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:n}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?KC({element:s.current,padding:n}).fn(r):{}:s?KC({element:s,padding:n}).fn(r):{}}}},M8=(e,t)=>{const r=b8(e);return{name:r.name,fn:r.fn,options:[e,t]}},D8=(e,t)=>{const r=w8(e);return{name:r.name,fn:r.fn,options:[e,t]}},L8=(e,t)=>({fn:E8(e).fn,options:[e,t]}),O8=(e,t)=>{const r=S8(e);return{name:r.name,fn:r.fn,options:[e,t]}},B8=(e,t)=>{const r=C8(e);return{name:r.name,fn:r.fn,options:[e,t]}},P8=(e,t)=>{const r=k8(e);return{name:r.name,fn:r.fn,options:[e,t]}},I8=(e,t)=>{const r=T8(e);return{name:r.name,fn:r.fn,options:[e,t]}};var z8="Arrow",QR=p.forwardRef((e,t)=>{const{children:r,width:s=10,height:n=5,...l}=e;return o.jsx(Ye.svg,{...l,ref:t,width:s,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});QR.displayName=z8;var $8=QR;function U8(e){const[t,r]=p.useState(void 0);return mr(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const l=n[0];let c,d;if("borderBoxSize"in l){const m=l.borderBoxSize,h=Array.isArray(m)?m[0]:m;c=h.inlineSize,d=h.blockSize}else c=e.offsetWidth,d=e.offsetHeight;r({width:c,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}var ey="Popper",[JR,Wm]=en(ey),[H8,eN]=JR(ey),tN=e=>{const{__scopePopper:t,children:r}=e,[s,n]=p.useState(null),[l,c]=p.useState(void 0);return o.jsx(H8,{scope:t,anchor:s,onAnchorChange:n,placementState:l,setPlacementState:c,children:r})};tN.displayName=ey;var rN="PopperAnchor",sN=p.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:s,...n}=e,l=eN(rN,r),c=p.useRef(null),d=l.onAnchorChange,m=p.useCallback(w=>{c.current=w,w&&d(w)},[d]),h=ut(t,m),v=p.useRef(null);p.useEffect(()=>{if(!s)return;const w=v.current;v.current=s.current,w!==v.current&&d(v.current)});const g=l.placementState&&ry(l.placementState),x=g==null?void 0:g[0],y=g==null?void 0:g[1];return s?null:o.jsx(Ye.div,{"data-radix-popper-side":x,"data-radix-popper-align":y,...n,ref:h})});sN.displayName=rN;var ty="PopperContent",[F8,q8]=JR(ty),iN=p.forwardRef((e,t)=>{var ce,le,we,Ee,Re,te;const{__scopePopper:r,side:s="bottom",sideOffset:n=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:v=0,sticky:g="partial",hideWhenDetached:x=!1,updatePositionStrategy:y="optimized",onPlaced:w,...S}=e,k=eN(ty,r),[C,E]=p.useState(null),N=ut(t,E),[R,T]=p.useState(null),P=U8(R),z=(P==null?void 0:P.width)??0,B=(P==null?void 0:P.height)??0,F=s+(l!=="center"?"-"+l:""),Y=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},q=Array.isArray(h)?h:[h],$=q.length>0,M={padding:Y,boundary:q.filter(V8),altBoundary:$},{refs:U,floatingStyles:W,placement:A,isPositioned:O,middlewareData:L}=A8({strategy:"fixed",placement:F,whileElementsMounted:(...ie)=>y8(...ie,{animationFrame:y==="always"}),elements:{reference:k.anchor},middleware:[M8({mainAxis:n+B,alignmentAxis:c}),m&&D8({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?L8():void 0,...M}),m&&O8({...M}),B8({...M,apply:({elements:ie,rects:ke,availableWidth:Ke,availableHeight:_e})=>{const{width:ye,height:Ie}=ke.reference,ze=ie.floating.style;ze.setProperty("--radix-popper-available-width",`${Ke}px`),ze.setProperty("--radix-popper-available-height",`${_e}px`),ze.setProperty("--radix-popper-anchor-width",`${ye}px`),ze.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),R&&I8({element:R,padding:d}),G8({arrowWidth:z,arrowHeight:B}),x&&P8({strategy:"referenceHidden",...M,boundary:$?M.boundary:void 0})]}),G=k.setPlacementState;mr(()=>(G(A),()=>{G(void 0)}),[A,G]);const[H,D]=ry(A),V=jr(w);mr(()=>{O&&(V==null||V())},[O,V]);const X=(ce=L.arrow)==null?void 0:ce.x,J=(le=L.arrow)==null?void 0:le.y,se=((we=L.arrow)==null?void 0:we.centerOffset)!==0,[de,Z]=p.useState();return mr(()=>{C&&Z(window.getComputedStyle(C).zIndex)},[C]),o.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:O?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(Ee=L.transformOrigin)==null?void 0:Ee.x,(Re=L.transformOrigin)==null?void 0:Re.y].join(" "),...((te=L.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(F8,{scope:r,placedSide:H,placedAlign:D,onArrowChange:T,arrowX:X,arrowY:J,shouldHideArrow:se,children:o.jsx(Ye.div,{"data-side":H,"data-align":D,...S,ref:N,style:{...S.style,animation:O?void 0:"none"}})})})});iN.displayName=ty;var nN="PopperArrow",W8={top:"bottom",right:"left",bottom:"top",left:"right"},aN=p.forwardRef(function(t,r){const{__scopePopper:s,...n}=t,l=q8(nN,s),c=W8[l.placedSide];return o.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:o.jsx($8,{...n,ref:r,style:{...n.style,display:"block"}})})});aN.displayName=nN;function V8(e){return e!==null}var G8=e=>({name:"transformOrigin",options:e,fn(t){var k,C,E;const{placement:r,rects:s,middlewareData:n}=t,c=((k=n.arrow)==null?void 0:k.centerOffset)!==0,d=c?0:e.arrowWidth,m=c?0:e.arrowHeight,[h,v]=ry(r),g={start:"0%",center:"50%",end:"100%"}[v],x=(((C=n.arrow)==null?void 0:C.x)??0)+d/2,y=(((E=n.arrow)==null?void 0:E.y)??0)+m/2;let w="",S="";return h==="bottom"?(w=c?g:`${x}px`,S=`${-m}px`):h==="top"?(w=c?g:`${x}px`,S=`${s.floating.height+m}px`):h==="right"?(w=`${-m}px`,S=c?g:`${y}px`):h==="left"&&(w=`${s.floating.width+m}px`,S=c?g:`${y}px`),{data:{x:w,y:S}}}});function ry(e){const[t,r="center"]=e.split("-");return[t,r]}var sy=tN,oN=sN,lN=iN,cN=aN,Hv=!1;function Y8(){const[e,t]=p.useState(Hv);return p.useEffect(()=>{Hv||(Hv=!0,t(!0))},[]),e}var uN=fo[" useSyncExternalStore ".trim().toString()];function K8(){return()=>{}}function X8(){return uN(K8,()=>!0,()=>!1)}var Z8=typeof uN=="function"?X8:Y8,Fv="rovingFocusGroup.onEntryFocus",Q8={bubbles:!1,cancelable:!0},wd="RovingFocusGroup",[ex,dN,J8]=G0(wd),[e7,Vm]=en(wd,[J8]),[t7,r7]=e7(wd),hN=p.forwardRef((e,t)=>o.jsx(ex.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(ex.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(s7,{...e,ref:t})})}));hN.displayName=wd;var s7=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:s,loop:n=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:v=!1,...g}=e,x=p.useRef(null),y=ut(t,x),w=yd(l),[S,k]=ao({prop:c,defaultProp:d??null,onChange:m,caller:wd}),[C,E]=p.useState(!1),N=jr(h),R=dN(r),T=p.useRef(!1),[P,z]=p.useState(0);return p.useEffect(()=>{const B=x.current;if(B)return B.addEventListener(Fv,N),()=>B.removeEventListener(Fv,N)},[N]),o.jsx(t7,{scope:r,orientation:s,dir:w,loop:n,currentTabStopId:S,onItemFocus:p.useCallback(B=>k(B),[k]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>z(B=>B+1),[]),onFocusableItemRemove:p.useCallback(()=>z(B=>B-1),[]),children:o.jsx(Ye.div,{tabIndex:C||P===0?-1:0,"data-orientation":s,...g,ref:y,style:{outline:"none",...e.style},onMouseDown:Be(e.onMouseDown,()=>{T.current=!0}),onFocus:Be(e.onFocus,B=>{const F=!T.current;if(B.target===B.currentTarget&&F&&!C){const Y=new CustomEvent(Fv,Q8);if(B.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const q=R().filter(A=>A.focusable),$=q.find(A=>A.active),M=q.find(A=>A.id===S),W=[$,M,...q].filter(Boolean).map(A=>A.ref.current);pN(W,v)}}T.current=!1}),onBlur:Be(e.onBlur,()=>E(!1))})})}),fN="RovingFocusGroupItem",mN=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:s=!0,active:n=!1,tabStopId:l,children:c,...d}=e,m=Zs(),h=l||m,v=r7(fN,r),g=v.currentTabStopId===h,x=dN(r),{onFocusableItemAdd:y,onFocusableItemRemove:w,currentTabStopId:S}=v,k=Z8();return mr(()=>{if(!(!k||!s))return y(),()=>w()},[k,s,y,w]),p.useEffect(()=>{if(!(k||!s))return y(),()=>w()},[k,s,y,w]),o.jsx(ex.ItemSlot,{scope:r,id:h,focusable:s,active:n,children:o.jsx(Ye.span,{tabIndex:g?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Be(e.onMouseDown,C=>{s?v.onItemFocus(h):C.preventDefault()}),onFocus:Be(e.onFocus,()=>v.onItemFocus(h)),onKeyDown:Be(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){v.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const E=a7(C,v.orientation,v.dir);if(E!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let R=x().filter(T=>T.focusable).map(T=>T.ref.current);if(E==="last")R.reverse();else if(E==="prev"||E==="next"){E==="prev"&&R.reverse();const T=R.indexOf(C.currentTarget);R=v.loop?o7(R,T+1):R.slice(T+1)}setTimeout(()=>pN(R))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:S!=null}):c})})});mN.displayName=fN;var i7={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function n7(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function a7(e,t,r){const s=n7(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return i7[s]}function pN(e,t=!1){const r=document.activeElement;for(const s of e)if(s===r||(s.focus({preventScroll:t}),document.activeElement!==r))return}function o7(e,t){return e.map((r,s)=>e[(t+s)%e.length])}var gN=hN,vN=mN,tx=["Enter"," "],l7=["ArrowDown","PageUp","Home"],_N=["ArrowUp","PageDown","End"],c7=[...l7,..._N],u7={ltr:[...tx,"ArrowRight"],rtl:[...tx,"ArrowLeft"]},d7={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Sd="Menu",[sd,h7,f7]=G0(Sd),[ul,xN]=en(Sd,[f7,Wm,Vm]),Cd=Wm(),yN=Vm(),[bN,_o]=ul(Sd),[m7,kd]=ul(Sd),wN=e=>{const{__scopeMenu:t,open:r=!1,children:s,dir:n,onOpenChange:l,modal:c=!0}=e,d=Cd(t),[m,h]=p.useState(null),v=p.useRef(!1),g=jr(l),x=yd(n);return p.useEffect(()=>{const y=()=>{v.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>v.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),p.useEffect(()=>{if(!r)return;const y=()=>g(!1);return window.addEventListener("blur",y),()=>window.removeEventListener("blur",y)},[r,g]),o.jsx(sy,{...d,children:o.jsx(bN,{scope:t,open:r,onOpenChange:g,content:m,onContentChange:h,children:o.jsx(m7,{scope:t,onClose:p.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:v,dir:x,modal:c,children:s})})})};wN.displayName=Sd;var p7="MenuAnchor",iy=p.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,n=Cd(r);return o.jsx(oN,{...n,...s,ref:t})});iy.displayName=p7;var ny="MenuPortal",[g7,SN]=ul(ny,{forceMount:void 0}),CN=e=>{const{__scopeMenu:t,forceMount:r,children:s,container:n}=e,l=_o(ny,t);return o.jsx(g7,{scope:t,forceMount:r,children:o.jsx(tn,{present:r||l.open,children:o.jsx(Tm,{asChild:!0,container:n,children:s})})})};CN.displayName=ny;var ki="MenuContent",[v7,ay]=ul(ki),kN=p.forwardRef((e,t)=>{const r=SN(ki,e.__scopeMenu),{forceMount:s=r.forceMount,...n}=e,l=_o(ki,e.__scopeMenu),c=kd(ki,e.__scopeMenu);return o.jsx(sd.Provider,{scope:e.__scopeMenu,children:o.jsx(tn,{present:s||l.open,children:o.jsx(sd.Slot,{scope:e.__scopeMenu,children:c.modal?o.jsx(_7,{...n,ref:t}):o.jsx(x7,{...n,ref:t})})})})}),_7=p.forwardRef((e,t)=>{const r=_o(ki,e.__scopeMenu),s=p.useRef(null),n=ut(t,s);return p.useEffect(()=>{const l=s.current;if(l)return z0(l)},[]),o.jsx(oy,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Be(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),x7=p.forwardRef((e,t)=>{const r=_o(ki,e.__scopeMenu);return o.jsx(oy,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),y7=rl("MenuContent.ScrollLock"),oy=p.forwardRef((e,t)=>{const{__scopeMenu:r,loop:s=!1,trapFocus:n,onOpenAutoFocus:l,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:g,onInteractOutside:x,onDismiss:y,disableOutsideScroll:w,...S}=e,k=_o(ki,r),C=kd(ki,r),E=Cd(r),N=yN(r),R=h7(r),[T,P]=p.useState(null),z=p.useRef(null),B=ut(t,z,k.onContentChange),F=p.useRef(0),Y=p.useRef(""),q=p.useRef(0),$=p.useRef(null),M=p.useRef("right"),U=p.useRef(0),W=w?Dm:p.Fragment,A=w?{as:y7,allowPinchZoom:!0}:void 0,O=G=>{var Z,ce;const H=Y.current+G,D=R().filter(le=>!le.disabled),V=document.activeElement,X=(Z=D.find(le=>le.ref.current===V))==null?void 0:Z.textValue,J=D.map(le=>le.textValue),se=M7(J,H,X),de=(ce=D.find(le=>le.textValue===se))==null?void 0:ce.ref.current;(function le(we){Y.current=we,window.clearTimeout(F.current),we!==""&&(F.current=window.setTimeout(()=>le(""),1e3))})(H),de&&setTimeout(()=>de.focus())};p.useEffect(()=>()=>window.clearTimeout(F.current),[]),I0();const L=p.useCallback(G=>{var D,V;return M.current===((D=$.current)==null?void 0:D.side)&&L7(G,(V=$.current)==null?void 0:V.area)},[]);return o.jsx(v7,{scope:r,searchRef:Y,onItemEnter:p.useCallback(G=>{L(G)&&G.preventDefault()},[L]),onItemLeave:p.useCallback(G=>{var H;L(G)||((H=z.current)==null||H.focus(),P(null))},[L]),onTriggerLeave:p.useCallback(G=>{L(G)&&G.preventDefault()},[L]),pointerGraceTimerRef:q,onPointerGraceIntentChange:p.useCallback(G=>{$.current=G},[]),children:o.jsx(W,{...A,children:o.jsx(Am,{asChild:!0,trapped:n,onMountAutoFocus:Be(l,G=>{var H;G.preventDefault(),(H=z.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:o.jsx(jm,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:g,onInteractOutside:x,onDismiss:y,children:o.jsx(gN,{asChild:!0,...N,dir:C.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:P,onEntryFocus:Be(m,G=>{C.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(lN,{role:"menu","aria-orientation":"vertical","data-state":HN(k.open),"data-radix-menu-content":"",dir:C.dir,...E,...S,ref:B,style:{outline:"none",...S.style},onKeyDown:Be(S.onKeyDown,G=>{const D=G.target.closest("[data-radix-menu-content]")===G.currentTarget,V=G.ctrlKey||G.altKey||G.metaKey,X=G.key.length===1;D&&(G.key==="Tab"&&G.preventDefault(),!V&&X&&O(G.key));const J=z.current;if(G.target!==J||!c7.includes(G.key))return;G.preventDefault();const de=R().filter(Z=>!Z.disabled).map(Z=>Z.ref.current);_N.includes(G.key)&&de.reverse(),A7(de)}),onBlur:Be(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(F.current),Y.current="")}),onPointerMove:Be(e.onPointerMove,id(G=>{const H=G.target,D=U.current!==G.clientX;if(G.currentTarget.contains(H)&&D){const V=G.clientX>U.current?"right":"left";M.current=V,U.current=G.clientX}}))})})})})})})});kN.displayName=ki;var b7="MenuGroup",ly=p.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return o.jsx(Ye.div,{role:"group",...s,ref:t})});ly.displayName=b7;var w7="MenuLabel",EN=p.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return o.jsx(Ye.div,{...s,ref:t})});EN.displayName=w7;var sm="MenuItem",ZC="menu.itemSelect",Gm=p.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:s,...n}=e,l=p.useRef(null),c=kd(sm,e.__scopeMenu),d=ay(sm,e.__scopeMenu),m=ut(t,l),h=p.useRef(!1),v=()=>{const g=l.current;if(!r&&g){const x=new CustomEvent(ZC,{bubbles:!0,cancelable:!0});g.addEventListener(ZC,y=>s==null?void 0:s(y),{once:!0}),BE(g,x),x.defaultPrevented?h.current=!1:c.onClose()}};return o.jsx(RN,{...n,ref:m,disabled:r,onClick:Be(e.onClick,v),onPointerDown:g=>{var x;(x=e.onPointerDown)==null||x.call(e,g),h.current=!0},onPointerUp:Be(e.onPointerUp,g=>{var x;h.current||(x=g.currentTarget)==null||x.click()}),onKeyDown:Be(e.onKeyDown,g=>{r||g.target!==g.currentTarget||d.searchRef.current!==""&&g.key===" "||tx.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});Gm.displayName=sm;var RN=p.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:s=!1,textValue:n,...l}=e,c=ay(sm,r),d=yN(r),m=p.useRef(null),h=ut(t,m),[v,g]=p.useState(!1),[x,y]=p.useState("");return p.useEffect(()=>{const w=m.current;w&&y((w.textContent??"").trim())},[l.children]),o.jsx(sd.ItemSlot,{scope:r,disabled:s,textValue:n??x,children:o.jsx(vN,{asChild:!0,...d,focusable:!s,children:o.jsx(Ye.div,{role:"menuitem","data-highlighted":v?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:h,onPointerMove:Be(e.onPointerMove,id(w=>{s?c.onItemLeave(w):(c.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Be(e.onPointerLeave,id(w=>c.onItemLeave(w))),onFocus:Be(e.onFocus,()=>g(!0)),onBlur:Be(e.onBlur,()=>g(!1))})})})}),S7="MenuCheckboxItem",NN=p.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:s,...n}=e;return o.jsx(DN,{scope:e.__scopeMenu,checked:r,children:o.jsx(Gm,{role:"menuitemcheckbox","aria-checked":im(r)?"mixed":r,...n,ref:t,"data-state":dy(r),onSelect:Be(n.onSelect,()=>s==null?void 0:s(im(r)?!0:!r),{checkForDefaultPrevented:!1})})})});NN.displayName=S7;var jN="MenuRadioGroup",[C7,k7]=ul(jN,{value:void 0,onValueChange:()=>{}}),AN=p.forwardRef((e,t)=>{const{value:r,onValueChange:s,...n}=e,l=jr(s);return o.jsx(C7,{scope:e.__scopeMenu,value:r,onValueChange:l,children:o.jsx(ly,{...n,ref:t})})});AN.displayName=jN;var TN="MenuRadioItem",MN=p.forwardRef((e,t)=>{const{value:r,...s}=e,n=k7(TN,e.__scopeMenu),l=r===n.value;return o.jsx(DN,{scope:e.__scopeMenu,checked:l,children:o.jsx(Gm,{role:"menuitemradio","aria-checked":l,...s,ref:t,"data-state":dy(l),onSelect:Be(s.onSelect,()=>{var c;return(c=n.onValueChange)==null?void 0:c.call(n,r)},{checkForDefaultPrevented:!1})})})});MN.displayName=TN;var cy="MenuItemIndicator",[DN,E7]=ul(cy,{checked:!1}),LN=p.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:s,...n}=e,l=E7(cy,r);return o.jsx(tn,{present:s||im(l.checked)||l.checked===!0,children:o.jsx(Ye.span,{...n,ref:t,"data-state":dy(l.checked)})})});LN.displayName=cy;var R7="MenuSeparator",ON=p.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e;return o.jsx(Ye.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});ON.displayName=R7;var N7="MenuArrow",BN=p.forwardRef((e,t)=>{const{__scopeMenu:r,...s}=e,n=Cd(r);return o.jsx(cN,{...n,...s,ref:t})});BN.displayName=N7;var uy="MenuSub",[j7,PN]=ul(uy),IN=e=>{const{__scopeMenu:t,children:r,open:s=!1,onOpenChange:n}=e,l=_o(uy,t),c=Cd(t),[d,m]=p.useState(null),[h,v]=p.useState(null),g=jr(n);return p.useEffect(()=>(l.open===!1&&g(!1),()=>g(!1)),[l.open,g]),o.jsx(sy,{...c,children:o.jsx(bN,{scope:t,open:s,onOpenChange:g,content:h,onContentChange:v,children:o.jsx(j7,{scope:t,contentId:Zs(),triggerId:Zs(),trigger:d,onTriggerChange:m,children:r})})})};IN.displayName=uy;var $u="MenuSubTrigger",zN=p.forwardRef((e,t)=>{const r=_o($u,e.__scopeMenu),s=kd($u,e.__scopeMenu),n=PN($u,e.__scopeMenu),l=ay($u,e.__scopeMenu),c=p.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=l,h={__scopeMenu:e.__scopeMenu},v=p.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);p.useEffect(()=>v,[v]),p.useEffect(()=>{const x=d.current;return()=>{window.clearTimeout(x),m(null)}},[d,m]);const g=ut(t,n.onTriggerChange);return o.jsx(iy,{asChild:!0,...h,children:o.jsx(RN,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?n.contentId:void 0,"data-state":HN(r.open),...e,ref:g,onClick:x=>{var y;(y=e.onClick)==null||y.call(e,x),!(e.disabled||x.defaultPrevented)&&(x.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Be(e.onPointerMove,id(x=>{l.onItemEnter(x),!x.defaultPrevented&&!e.disabled&&!r.open&&!c.current&&(l.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{r.onOpenChange(!0),v()},100))})),onPointerLeave:Be(e.onPointerLeave,id(x=>{var w,S;v();const y=(w=r.content)==null?void 0:w.getBoundingClientRect();if(y){const k=(S=r.content)==null?void 0:S.dataset.side,C=k==="right",E=C?-5:5,N=y[C?"left":"right"],R=y[C?"right":"left"];l.onPointerGraceIntentChange({area:[{x:x.clientX+E,y:x.clientY},{x:N,y:y.top},{x:R,y:y.top},{x:R,y:y.bottom},{x:N,y:y.bottom}],side:k}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(x),x.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Be(e.onKeyDown,x=>{var w;e.disabled||x.target!==x.currentTarget||l.searchRef.current!==""&&x.key===" "||u7[s.dir].includes(x.key)&&(r.onOpenChange(!0),(w=r.content)==null||w.focus(),x.preventDefault())})})})});zN.displayName=$u;var $N="MenuSubContent",UN=p.forwardRef((e,t)=>{const r=SN(ki,e.__scopeMenu),{forceMount:s=r.forceMount,align:n="start",...l}=e,c=_o(ki,e.__scopeMenu),d=kd(ki,e.__scopeMenu),m=PN($N,e.__scopeMenu),h=p.useRef(null),v=ut(t,h);return o.jsx(sd.Provider,{scope:e.__scopeMenu,children:o.jsx(tn,{present:s||c.open,children:o.jsx(sd.Slot,{scope:e.__scopeMenu,children:o.jsx(oy,{id:m.contentId,"aria-labelledby":m.triggerId,...l,ref:v,align:n,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var x;d.isUsingKeyboardRef.current&&((x=h.current)==null||x.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:Be(e.onFocusOutside,g=>{g.target!==m.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:Be(e.onEscapeKeyDown,g=>{d.onClose(),g.preventDefault()}),onKeyDown:Be(e.onKeyDown,g=>{var w;const x=g.currentTarget.contains(g.target),y=d7[d.dir].includes(g.key);x&&y&&(c.onOpenChange(!1),(w=m.trigger)==null||w.focus(),g.preventDefault())})})})})})});UN.displayName=$N;function HN(e){return e?"open":"closed"}function im(e){return e==="indeterminate"}function dy(e){return im(e)?"indeterminate":e?"checked":"unchecked"}function A7(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function T7(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function M7(e,t,r){const n=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let c=T7(e,Math.max(l,0));n.length===1&&(c=c.filter(h=>h!==r));const m=c.find(h=>h.toLowerCase().startsWith(n.toLowerCase()));return m!==r?m:void 0}function D7(e,t){const{x:r,y:s}=e;let n=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const d=t[l],m=t[c],h=d.x,v=d.y,g=m.x,x=m.y;v>s!=x>s&&r<(g-h)*(s-v)/(x-v)+h&&(n=!n)}return n}function L7(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return D7(r,t)}function id(e){return t=>t.pointerType==="mouse"?e(t):void 0}var O7=wN,B7=iy,P7=CN,I7=kN,z7=ly,$7=EN,U7=Gm,H7=NN,F7=AN,q7=MN,W7=LN,V7=ON,G7=BN,Y7=IN,K7=zN,X7=UN,Ym="DropdownMenu",[Z7]=en(Ym,[xN]),ps=xN(),[Q7,FN]=Z7(Ym),qN=e=>{const{__scopeDropdownMenu:t,children:r,dir:s,open:n,defaultOpen:l,onOpenChange:c,modal:d=!0}=e,m=ps(t),h=p.useRef(null),[v,g]=ao({prop:n,defaultProp:l??!1,onChange:c,caller:Ym});return o.jsx(Q7,{scope:t,triggerId:Zs(),triggerRef:h,contentId:Zs(),open:v,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(x=>!x),[g]),modal:d,children:o.jsx(O7,{...m,open:v,onOpenChange:g,dir:s,modal:d,children:r})})};qN.displayName=Ym;var WN="DropdownMenuTrigger",VN=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:s=!1,...n}=e,l=FN(WN,r),c=ps(r),d=ut(t,l.triggerRef);return o.jsx(B7,{asChild:!0,...c,children:o.jsx(Ye.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...n,ref:d,onPointerDown:Be(e.onPointerDown,m=>{!s&&m.button===0&&m.ctrlKey===!1&&(l.onOpenToggle(),l.open||m.preventDefault())}),onKeyDown:Be(e.onKeyDown,m=>{s||(["Enter"," "].includes(m.key)&&l.onOpenToggle(),m.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});VN.displayName=WN;var J7="DropdownMenuPortal",GN=e=>{const{__scopeDropdownMenu:t,...r}=e,s=ps(t);return o.jsx(P7,{...s,...r})};GN.displayName=J7;var YN="DropdownMenuContent",KN=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=FN(YN,r),l=ps(r),c=p.useRef(!1);return o.jsx(I7,{id:n.contentId,"aria-labelledby":n.triggerId,...l,...s,ref:t,onCloseAutoFocus:Be(e.onCloseAutoFocus,d=>{var m;c.current||(m=n.triggerRef.current)==null||m.focus(),c.current=!1,d.preventDefault()}),onInteractOutside:Be(e.onInteractOutside,d=>{const m=d.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,v=m.button===2||h;(!n.modal||v)&&(c.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});KN.displayName=YN;var e$="DropdownMenuGroup",t$=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(z7,{...n,...s,ref:t})});t$.displayName=e$;var r$="DropdownMenuLabel",XN=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx($7,{...n,...s,ref:t})});XN.displayName=r$;var s$="DropdownMenuItem",ZN=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(U7,{...n,...s,ref:t})});ZN.displayName=s$;var i$="DropdownMenuCheckboxItem",n$=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(H7,{...n,...s,ref:t})});n$.displayName=i$;var a$="DropdownMenuRadioGroup",o$=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(F7,{...n,...s,ref:t})});o$.displayName=a$;var l$="DropdownMenuRadioItem",c$=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(q7,{...n,...s,ref:t})});c$.displayName=l$;var u$="DropdownMenuItemIndicator",d$=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(W7,{...n,...s,ref:t})});d$.displayName=u$;var h$="DropdownMenuSeparator",QN=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(V7,{...n,...s,ref:t})});QN.displayName=h$;var f$="DropdownMenuArrow",m$=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(G7,{...n,...s,ref:t})});m$.displayName=f$;var p$=e=>{const{__scopeDropdownMenu:t,children:r,open:s,onOpenChange:n,defaultOpen:l}=e,c=ps(t),[d,m]=ao({prop:s,defaultProp:l??!1,onChange:n,caller:"DropdownMenuSub"});return o.jsx(Y7,{...c,open:d,onOpenChange:m,children:r})},g$="DropdownMenuSubTrigger",JN=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(K7,{...n,...s,ref:t})});JN.displayName=g$;var v$="DropdownMenuSubContent",ej=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...s}=e,n=ps(r);return o.jsx(X7,{...n,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ej.displayName=v$;var _$=qN,tj=VN,rj=GN,sj=KN,ij=XN,nj=ZN,aj=QN,x$=p$,oj=JN,lj=ej;function nd(e){return o.jsx(_$,{"data-slot":"dropdown-menu",...e})}const vc=p.forwardRef((e,t)=>o.jsx(tj,{ref:t,"data-slot":"dropdown-menu-trigger",...e}));vc.displayName=tj.displayName;const _c=p.forwardRef(({className:e,sideOffset:t=4,collisionPadding:r=8,...s},n)=>o.jsx(rj,{children:o.jsx(sj,{ref:n,"data-slot":"dropdown-menu-content",sideOffset:t,collisionPadding:r,className:Je("cn-menu-translucent z-50 min-w-36 origin-[var(--radix-dropdown-menu-content-transform-origin)] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));_c.displayName=sj.displayName;const Wi=p.forwardRef(({className:e,variant:t="default",...r},s)=>o.jsx(nj,{ref:s,"data-slot":"dropdown-menu-item","data-variant":t,className:Je("relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t==="destructive"&&"text-destructive focus:bg-destructive/10 focus:text-destructive dark:focus:bg-destructive/20",e),...r}));Wi.displayName=nj.displayName;const Yo=p.forwardRef(({className:e,...t},r)=>o.jsx(ij,{ref:r,"data-slot":"dropdown-menu-label",className:Je("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));Yo.displayName=ij.displayName;const cj=p.forwardRef(({className:e,...t},r)=>o.jsx(aj,{ref:r,"data-slot":"dropdown-menu-separator",className:Je("-mx-1 my-1 h-px bg-border",e),...t}));cj.displayName=aj.displayName;function rx(e){return o.jsx(x$,{"data-slot":"dropdown-menu-sub",...e})}const nm=p.forwardRef(({className:e,children:t,...r},s)=>o.jsxs(oj,{ref:s,"data-slot":"dropdown-menu-sub-trigger",className:Je("flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t,o.jsx("span",{className:"ml-auto text-muted-foreground","aria-hidden":"true",children:"›"})]}));nm.displayName=oj.displayName;const am=p.forwardRef(({className:e,sideOffset:t=6,collisionPadding:r=8,...s},n)=>o.jsx(rj,{children:o.jsx(lj,{ref:n,"data-slot":"dropdown-menu-sub-content",sideOffset:t,collisionPadding:r,className:Je("cn-menu-translucent z-50 min-w-48 overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...s})}));am.displayName=lj.displayName;const bt=p.forwardRef(({className:e,type:t,...r},s)=>o.jsx("input",{ref:s,type:t,"data-slot":"input",className:Je("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r}));bt.displayName="Input";function Ec({className:e,...t}){return o.jsx("textarea",{"data-slot":"textarea",className:Je("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function y$({idPrefix:e,fields:t,activeFieldId:r,answers:s,otherValues:n,otherSelections:l,errors:c={},disabled:d=!1,onNavigate:m,onAnswerChange:h,onOtherValueChange:v,onOtherSelectionChange:g}){const x=p.useRef(null),y=p.useRef(void 0),w=p.useRef(void 0),S=t.findIndex(B=>B.id===r),k=S>=0?S:0,C=t[k],E=C?c[C.id]:void 0,N=C?s[C.id]:void 0;if(p.useEffect(()=>{if(!C)return;const B=y.current!==void 0&&y.current!==C.id,F=!!E&&w.current!==E;if(y.current=C.id,w.current=E,!B&&!F)return;const Y=x.current,q=(Y==null?void 0:Y.querySelector('input[aria-invalid="true"]:not([disabled]), textarea[aria-invalid="true"]:not([disabled])'))??(Y==null?void 0:Y.querySelector("input:checked:not([disabled])"))??(Y==null?void 0:Y.querySelector("input:not([disabled]), textarea:not([disabled])"));q==null||q.focus()},[E,C]),!C)return null;const R=`${e}-field-${k}`,T=C.description?`${R}-description`:void 0,P=E?`${R}-error`:void 0,z=[T,P].filter(Boolean).join(" ")||void 0;return o.jsxs("div",{className:"grid gap-3",children:[t.length>1&&o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{"aria-live":"polite",className:"font-mono text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:["Question ",k+1," of ",t.length]}),o.jsx("div",{className:"text-[11px] text-muted-foreground",children:C.required?"Required":"Optional"})]}),o.jsx("div",{role:"progressbar","aria-label":"Question progress","aria-valuemin":1,"aria-valuemax":t.length,"aria-valuenow":k+1,className:"h-1 overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${(k+1)/t.length*100}%`}})})]}),o.jsx("div",{ref:x,children:C.type==="text"?o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs("label",{htmlFor:R,className:"text-xs font-medium text-foreground",children:[C.label,C.required&&o.jsx(e2,{})]}),C.description&&o.jsx("p",{id:T,className:"text-[11px] leading-relaxed text-muted-foreground",children:C.description}),C.multiline&&!C.secret?o.jsx(Ec,{id:R,value:typeof N=="string"?N:"",disabled:d,placeholder:C.placeholder,"aria-invalid":E?!0:void 0,"aria-describedby":z,required:C.required,onChange:B=>h(C.id,B.target.value)}):o.jsx(bt,{id:R,type:C.secret?"password":"text",autoComplete:"off",value:typeof N=="string"?N:"",disabled:d,placeholder:C.placeholder,"aria-invalid":E?!0:void 0,"aria-describedby":z,required:C.required,onChange:B=>h(C.id,B.target.value)}),o.jsx(JC,{id:P,error:E})]}):o.jsxs("fieldset",{disabled:d,role:C.multiple?void 0:"radiogroup","aria-required":!C.multiple&&C.required?!0:void 0,"aria-invalid":E?!0:void 0,"aria-describedby":z,className:"grid gap-1.5",children:[o.jsxs("legend",{className:"text-xs font-medium text-foreground",children:[C.label,C.required&&o.jsx(e2,{})]}),C.description&&o.jsx("p",{id:T,className:"text-[11px] leading-relaxed text-muted-foreground",children:C.description}),o.jsxs("div",{className:"grid gap-1.5",children:[C.options.map((B,F)=>{const Y=`${R}-option-${F}`,q=C.multiple?Array.isArray(N)&&N.includes(B.value):l[C.id]!==!0&&N===B.value;return o.jsx(QC,{id:Y,name:C.multiple?void 0:R,type:C.multiple?"checkbox":"radio",checked:q,label:B.label,description:B.description,onChange:$=>{if(C.multiple){const M=Array.isArray(N)?N:[];h(C.id,$?[...M.filter(U=>U!==B.value),B.value]:M.filter(U=>U!==B.value))}else h(C.id,B.value),g(C.id,!1)}},B.value)}),C.allowOther&&o.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-border bg-background/60 px-2.5 py-2 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5",children:[o.jsx(QC,{id:`${R}-other`,name:C.multiple?void 0:R,type:C.multiple?"checkbox":"radio",checked:l[C.id]===!0,label:"Other",embedded:!0,onChange:B=>{g(C.id,B),B&&!C.multiple&&h(C.id,"")}}),o.jsx(bt,{value:n[C.id]??"",disabled:d||l[C.id]!==!0,"aria-label":`Other answer for ${C.label}`,"aria-invalid":E?!0:void 0,"aria-describedby":z,placeholder:"Enter another answer",onChange:B=>v(C.id,B.target.value)})]}),!C.required&&!C.multiple&&(l[C.id]===!0||typeof N=="string"&&N.length>0)&&o.jsx(re,{type:"button",size:"xs",variant:"ghost",className:"justify-self-start text-muted-foreground",onClick:()=>{h(C.id,""),g(C.id,!1)},children:"Clear selection"})]}),o.jsx(JC,{id:P,error:E})]})}),t.length>1&&o.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border/70 pt-2",children:[o.jsxs(re,{type:"button",size:"xs",variant:"ghost",disabled:d||k===0,onClick:()=>m(t[k-1].id),children:[o.jsx(wE,{}),"Previous"]}),o.jsxs(re,{type:"button",size:"xs",variant:"outline",disabled:d||k===t.length-1,onClick:()=>m(t[k+1].id),children:["Next",o.jsx(po,{})]})]})]})}function QC({id:e,name:t,type:r,checked:s,label:n,description:l,embedded:c=!1,onChange:d}){return o.jsxs("label",{htmlFor:e,className:Je("flex cursor-pointer items-start gap-2 text-xs text-foreground",!c&&"rounded-lg border border-border bg-background/60 px-2.5 py-2 transition-colors hover:bg-muted/60 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"),children:[o.jsxs("span",{className:"relative mt-0.5 size-4 shrink-0",children:[o.jsx("input",{id:e,type:r,name:t,checked:s,className:"peer size-4 appearance-none rounded-sm border border-input bg-background outline-none transition-colors checked:border-primary checked:bg-primary focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-60",onChange:m=>d(m.target.checked)}),o.jsx(Ar,{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-4 stroke-[3] text-primary-foreground opacity-0 peer-checked:opacity-100"})]}),o.jsxs("span",{className:"min-w-0",children:[o.jsx("span",{className:"block",children:n}),l&&o.jsx("span",{className:"mt-0.5 block text-[11px] leading-relaxed text-muted-foreground",children:l})]})]})}function JC({id:e,error:t}){return t?o.jsx("p",{id:e,role:"alert",className:"text-[11px] text-destructive",children:t}):null}function e2(){return o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-destructive",children:"*"}),o.jsx("span",{className:"sr-only",children:" (required)"})]})}function uj({className:e,size:t="default",...r}){return o.jsxs("div",{"data-slot":"native-select-wrapper","data-size":t,className:Je("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),children:[o.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...r}),o.jsx(vd,{"aria-hidden":"true","data-slot":"native-select-icon",className:"pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"})]})}var b$=Object.defineProperty,ua=(e,t)=>b$(e,"name",{value:t,configurable:!0});function dj(e,t){return p.useReducer((r,s)=>t[r][s]??r,e)}ua(dj,"useStateMachine");var Km=ua(e=>{const{present:t,children:r}=e,s=hj(t),n=typeof r=="function"?r({present:s.isPresent}):p.Children.only(r),l=fj(s.ref,mj(n));return typeof r=="function"||s.isPresent?p.cloneElement(n,{ref:l}):null},"Presence");function hj(e){const[t,r]=p.useState(),s=p.useRef(null),n=p.useRef(e),l=p.useRef("none"),c=p.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=dj(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{m==="mounted"?(l.current=c.current??ic(s.current),c.current=void 0):l.current="none"},[m]),mr(()=>{const v=s.current,g=n.current;if(g!==e){const y=l.current,w=ic(v);e?(c.current=w,h("MOUNT")):w==="none"||(v==null?void 0:v.display)==="none"?h("UNMOUNT"):h(g&&y!==w?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,h]),mr(()=>{if(t){let v;const g=t.ownerDocument.defaultView??window,x=ua(w=>{const k=ic(s.current).includes(CSS.escape(w.animationName));if(w.target===t&&k&&(h("ANIMATION_END"),!n.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",v=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},"handleAnimationEnd"),y=ua(w=>{w.target===t&&(l.current=ic(s.current))},"handleAnimationStart");return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{g.clearTimeout(v),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:p.useCallback(v=>{if(v){const g=getComputedStyle(v);s.current=g,c.current=ic(g)}else s.current=null;r(v)},[])}}ua(hj,"usePresence");function sx(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ua(sx,"setRef");function fj(...e){const t=p.useRef(e);return t.current=e,p.useCallback(r=>{const s=t.current;let n=!1;const l=s.map(c=>{const d=sx(c,r);return!n&&typeof d=="function"&&(n=!0),d});if(n)return()=>{for(let c=0;c<l.length;c++){const d=l[c];typeof d=="function"?d():sx(s[c],null)}}},[])}ua(fj,"useStableComposedRefs");function ic(e){return(e==null?void 0:e.animationName)||"none"}ua(ic,"getAnimationName");function mj(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}ua(mj,"getElementRef");function ix(e,[t,r]){return Math.min(r,Math.max(t,e))}var w$=Object.defineProperty,Rc=(e,t)=>w$(e,"name",{value:t,configurable:!0}),pj=!!(typeof window<"u"&&window.document&&window.document.createElement);function io(e,t,{checkForDefaultPrevented:r=!0}={}){return Rc(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}Rc(io,"composeEventHandlers");function S$(e){var t;if(!pj)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Rc(S$,"getOwnerWindow");function nx(e){if(!pj)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Rc(nx,"getOwnerDocument");function gj(e,t=!1){const{activeElement:r}=nx(e);if(!(r!=null&&r.nodeName))return null;if(vj(r)&&r.contentDocument)return gj(r.contentDocument.body,t);if(t){const s=r.getAttribute("aria-activedescendant");if(s){const n=nx(r).getElementById(s);if(n)return n}}return r}Rc(gj,"getActiveElement");function vj(e){return e.tagName==="IFRAME"}Rc(vj,"isFrame");var C$=Object.defineProperty,mt=(e,t)=>C$(e,"name",{value:t,configurable:!0});function _j(e,t){return p.useReducer((r,s)=>t[r][s]??r,e)}mt(_j,"useStateMachine");var xj="ScrollArea",[yj]=en(xj),[k$,Oi]=yj(xj),E$=p.forwardRef(mt(function(t,r){const{__scopeScrollArea:s,type:n="hover",dir:l,scrollHideDelay:c=600,...d}=t,[m,h]=p.useState(null),[v,g]=p.useState(null),[x,y]=p.useState(null),[w,S]=p.useState(null),[k,C]=p.useState(null),[E,N]=p.useState(0),[R,T]=p.useState(0),[P,z]=p.useState(!1),[B,F]=p.useState(!1),Y=ut(r,h),q=yd(l);return o.jsx(k$,{scope:s,type:n,dir:q,scrollHideDelay:c,scrollArea:m,viewport:v,onViewportChange:g,content:x,onContentChange:y,scrollbarX:w,onScrollbarXChange:S,scrollbarXEnabled:P,onScrollbarXEnabledChange:z,scrollbarY:k,onScrollbarYChange:C,scrollbarYEnabled:B,onScrollbarYEnabledChange:F,onCornerWidthChange:N,onCornerHeightChange:T,children:o.jsx(Ye.div,{dir:q,...d,ref:Y,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":R+"px",...t.style}})})},"ScrollArea")),R$="ScrollAreaViewport",N$=p.forwardRef(mt(function(t,r){const{__scopeScrollArea:s,children:n,nonce:l,...c}=t,d=Oi(R$,s),m=p.useRef(null),h=ut(r,m,d.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx(j$,{nonce:l}),o.jsx(Ye.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})},"ScrollAreaViewport")),j$=p.memo(mt(function({nonce:t}){return o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),ga="ScrollAreaScrollbar",bj=p.forwardRef(mt(function(t,r){const{forceMount:s,...n}=t,l=Oi(ga,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=l,m=t.orientation==="horizontal";return p.useEffect(()=>(m?c(!0):d(!0),()=>{m?c(!1):d(!1)}),[m,c,d]),l.type==="hover"?o.jsx(A$,{...n,ref:r,forceMount:s}):l.type==="scroll"?o.jsx(T$,{...n,ref:r,forceMount:s}):l.type==="auto"?o.jsx(wj,{...n,ref:r,forceMount:s}):l.type==="always"?o.jsx(hy,{...n,ref:r,"data-state":"visible"}):null},"ScrollAreaScrollbar")),A$=p.forwardRef(mt(function(t,r){const{forceMount:s,...n}=t,l=Oi(ga,t.__scopeScrollArea),[c,d]=p.useState(!1);return p.useEffect(()=>{const m=l.scrollArea;let h=0;if(m){const v=mt(()=>{window.clearTimeout(h),d(!0)},"handlePointerEnter"),g=mt(()=>{h=window.setTimeout(()=>d(!1),l.scrollHideDelay)},"handlePointerLeave");return m.addEventListener("pointerenter",v),m.addEventListener("pointerleave",g),()=>{window.clearTimeout(h),m.removeEventListener("pointerenter",v),m.removeEventListener("pointerleave",g)}}},[l.scrollArea,l.scrollHideDelay]),o.jsx(Km,{present:s||c,children:o.jsx(wj,{"data-state":c?"visible":"hidden",...n,ref:r})})},"ScrollAreaScrollbarHover")),T$=p.forwardRef(mt(function(t,r){const{forceMount:s,...n}=t,l=Oi(ga,t.__scopeScrollArea),c=t.orientation==="horizontal",d=Rd(()=>h("SCROLL_END"),100),[m,h]=_j("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(m==="idle"){const v=window.setTimeout(()=>h("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(v)}},[m,l.scrollHideDelay,h]),p.useEffect(()=>{const v=l.viewport,g=c?"scrollLeft":"scrollTop";if(v){let x=v[g];const y=mt(()=>{const w=v[g];x!==w&&(h("SCROLL"),d()),x=w},"handleScroll");return v.addEventListener("scroll",y),()=>v.removeEventListener("scroll",y)}},[l.viewport,c,h,d]),o.jsx(Km,{present:s||m!=="hidden",children:o.jsx(hy,{"data-state":m==="hidden"?"hidden":"visible",...n,ref:r,onPointerEnter:io(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:io(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),wj=p.forwardRef(mt(function(t,r){const s=Oi(ga,t.__scopeScrollArea),{forceMount:n,...l}=t,[c,d]=p.useState(!1),m=t.orientation==="horizontal",h=Rd(()=>{if(s.viewport){const v=s.viewport.offsetWidth<s.viewport.scrollWidth,g=s.viewport.offsetHeight<s.viewport.scrollHeight;d(m?v:g)}},10);return il(s.viewport,h),il(s.content,h),o.jsx(Km,{present:n||c,children:o.jsx(hy,{"data-state":c?"visible":"hidden",...l,ref:r})})},"ScrollAreaScrollbarAuto")),hy=p.forwardRef(mt(function(t,r){const{orientation:s="vertical",...n}=t,l=Oi(ga,t.__scopeScrollArea),c=p.useRef(null),d=p.useRef(0),[m,h]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),v=fy(m.viewport,m.content),g={...n,sizes:m,onSizesChange:h,hasThumb:v>0&&v<1,onThumbChange:mt(y=>c.current=y,"onThumbChange"),onThumbPointerUp:mt(()=>d.current=0,"onThumbPointerUp"),onThumbPointerDown:mt(y=>d.current=y,"onThumbPointerDown")};function x(y,w){return Ej(y,d.current,m,w)}return mt(x,"getScrollPosition"),s==="horizontal"?o.jsx(M$,{...g,ref:r,onThumbPositionChange:()=>{if(l.viewport&&c.current){const y=l.viewport.scrollLeft,w=ox(y,m,l.dir);c.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollLeft=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollLeft=x(y,l.dir))}}):s==="vertical"?o.jsx(D$,{...g,ref:r,onThumbPositionChange:()=>{if(l.viewport&&c.current){const y=l.viewport.scrollTop,w=ox(y,m);c.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:y=>{l.viewport&&(l.viewport.scrollTop=y)},onDragScroll:y=>{l.viewport&&(l.viewport.scrollTop=x(y))}}):null},"ScrollAreaScrollbarVisible")),M$=p.forwardRef(mt(function(t,r){const{sizes:s,onSizesChange:n,...l}=t,c=Oi(ga,t.__scopeScrollArea),[d,m]=p.useState(),h=p.useRef(null),v=ut(r,h,c.onScrollbarXChange);return p.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),o.jsx(Cj,{"data-orientation":"horizontal",...l,ref:v,sizes:s,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ed(s)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.x),onDragScroll:g=>t.onDragScroll(g.x),onWheelScroll:(g,x)=>{if(c.viewport){const y=c.viewport.scrollLeft+g.deltaX;t.onWheelScroll(y),py(y,x)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&d&&n({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:ad(d.paddingLeft),paddingEnd:ad(d.paddingRight)}})}})},"ScrollAreaScrollbarX")),D$=p.forwardRef(mt(function(t,r){const{sizes:s,onSizesChange:n,...l}=t,c=Oi(ga,t.__scopeScrollArea),[d,m]=p.useState(),h=p.useRef(null),v=ut(r,h,c.onScrollbarYChange);return p.useEffect(()=>{h.current&&m(getComputedStyle(h.current))},[h]),o.jsx(Cj,{"data-orientation":"vertical",...l,ref:v,sizes:s,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ed(s)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.y),onDragScroll:g=>t.onDragScroll(g.y),onWheelScroll:(g,x)=>{if(c.viewport){const y=c.viewport.scrollTop+g.deltaY;t.onWheelScroll(y),py(y,x)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&d&&n({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:ad(d.paddingTop),paddingEnd:ad(d.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[L$,Sj]=yj(ga),Cj=p.forwardRef(mt(function(t,r){const{__scopeScrollArea:s,sizes:n,hasThumb:l,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:m,onThumbPositionChange:h,onDragScroll:v,onWheelScroll:g,onResize:x,...y}=t,w=Oi(ga,s),[S,k]=p.useState(null),C=ut(r,k),E=p.useRef(null),N=p.useRef(""),R=w.viewport,T=n.content-n.viewport,P=jr(g),z=jr(h),B=Rd(x,10);function F(Y){if(E.current){const q=Y.clientX-E.current.left,$=Y.clientY-E.current.top;v({x:q,y:$})}}return mt(F,"handleDragScroll"),p.useEffect(()=>{const Y=mt(q=>{const $=q.target;(S==null?void 0:S.contains($))&&P(q,T)},"handleWheel");return document.addEventListener("wheel",Y,{passive:!1}),()=>document.removeEventListener("wheel",Y,{passive:!1})},[R,S,T,P]),p.useEffect(z,[n,z]),il(S,B),il(w.content,B),o.jsx(L$,{scope:s,scrollbar:S,hasThumb:l,onThumbChange:jr(c),onThumbPointerUp:jr(d),onThumbPositionChange:z,onThumbPointerDown:jr(m),children:o.jsx(Ye.div,{...y,ref:C,style:{position:"absolute",...y.style},onPointerDown:io(t.onPointerDown,Y=>{Y.button===0&&(Y.target.setPointerCapture(Y.pointerId),E.current=S.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),F(Y))}),onPointerMove:io(t.onPointerMove,F),onPointerUp:io(t.onPointerUp,Y=>{const q=Y.target;q.hasPointerCapture(Y.pointerId)&&q.releasePointerCapture(Y.pointerId),document.body.style.webkitUserSelect=N.current,w.viewport&&(w.viewport.style.scrollBehavior=""),E.current=null})})})},"ScrollAreaScrollbarImpl")),ax="ScrollAreaThumb",O$=p.forwardRef(mt(function(t,r){const{forceMount:s,...n}=t,l=Sj(ax,t.__scopeScrollArea);return o.jsx(Km,{present:s||l.hasThumb,children:o.jsx(B$,{ref:r,...n})})},"ScrollAreaThumb")),B$=p.forwardRef(mt(function(t,r){const{__scopeScrollArea:s,style:n,...l}=t,c=Oi(ax,s),d=Sj(ax,s),{onThumbPositionChange:m}=d,h=ut(r,d.onThumbChange),v=p.useRef(void 0),g=Rd(()=>{v.current&&(v.current(),v.current=void 0)},100);return p.useEffect(()=>{const x=c.viewport;if(x){const y=mt(()=>{if(g(),!v.current){const w=z$(x,m);v.current=w,m()}},"handleScroll");return m(),x.addEventListener("scroll",y),()=>x.removeEventListener("scroll",y)}},[c.viewport,g,m]),o.jsx(Ye.div,{"data-state":d.hasThumb?"visible":"hidden",...l,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:io(t.onPointerDownCapture,x=>{const w=x.target.getBoundingClientRect(),S=x.clientX-w.left,k=x.clientY-w.top;d.onThumbPointerDown({x:S,y:k})}),onPointerUp:io(t.onPointerUp,d.onThumbPointerUp)})},"ScrollAreaThumbImpl")),kj="ScrollAreaCorner",P$=p.forwardRef(mt(function(t,r){const s=Oi(kj,t.__scopeScrollArea),n=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&n?o.jsx(I$,{...t,ref:r}):null},"ScrollAreaCorner")),I$=p.forwardRef(mt(function(t,r){const{__scopeScrollArea:s,...n}=t,l=Oi(kj,s),[c,d]=p.useState(0),[m,h]=p.useState(0),v=!!(c&&m),{onCornerWidthChange:g,onCornerHeightChange:x}=l;return il(l.scrollbarX,()=>{var w;const y=((w=l.scrollbarX)==null?void 0:w.offsetHeight)||0;l.onCornerHeightChange(y),h(y)}),il(l.scrollbarY,()=>{var w;const y=((w=l.scrollbarY)==null?void 0:w.offsetWidth)||0;l.onCornerWidthChange(y),d(y)}),p.useEffect(()=>()=>{g(0),x(0)},[g,x]),v?o.jsx(Ye.div,{...n,ref:r,style:{width:c,height:m,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function ad(e){return e?parseInt(e,10):0}mt(ad,"toInt");function fy(e,t){const r=e/t;return isNaN(r)?0:r}mt(fy,"getThumbRatio");function Ed(e){const t=fy(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-r)*t;return Math.max(s,18)}mt(Ed,"getThumbSize");function Ej(e,t,r,s="ltr"){const n=Ed(r),l=n/2,c=t||l,d=n-c,m=r.scrollbar.paddingStart+c,h=r.scrollbar.size-r.scrollbar.paddingEnd-d,v=r.content-r.viewport,g=s==="ltr"?[0,v]:[v*-1,0];return my([m,h],g)(e)}mt(Ej,"getScrollPositionFromPointer");function ox(e,t,r="ltr"){const s=Ed(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-n,c=t.content-t.viewport,d=l-s,m=r==="ltr"?[0,c]:[c*-1,0],h=ix(e,m);return my([0,c],[0,d])(h)}mt(ox,"getThumbOffsetFromScroll");function my(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(r-e[0])}}mt(my,"linearScale");function py(e,t){return e>0&&e<t}mt(py,"isScrollingWithinScrollbarBounds");var z$=mt((e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},s=0;return mt((function n(){const l={left:e.scrollLeft,top:e.scrollTop},c=r.left!==l.left,d=r.top!==l.top;(c||d)&&t(),r=l,s=window.requestAnimationFrame(n)}),"loop")(),()=>window.cancelAnimationFrame(s)},"addUnlinkedScrollListener");function Rd(e,t){const r=jr(e),s=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),p.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(r,t)},[r,t])}mt(Rd,"useDebounceCallback");function il(e,t){const r=jr(t);mr(()=>{let s=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(s),n.unobserve(e)}}},[e,r])}mt(il,"useResizeObserver");var Rj=E$,$$=N$,U$=P$;const En=p.forwardRef(({className:e,children:t,viewportClassName:r,viewportRef:s,viewportProps:n,scrollbars:l="vertical",type:c="auto",...d},m)=>o.jsxs(Rj,{ref:m,"data-slot":"scroll-area",type:c,className:Je("relative overflow-hidden",e),...d,children:[o.jsx($$,{ref:s,"data-slot":"scroll-area-viewport",className:Je("size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:ring-2 focus-visible:ring-[var(--ring)]/45",l==="vertical"&&"[&>div]:!block [&>div]:min-w-0 [&>div]:w-full",r),...n,children:t}),l!=="horizontal"&&o.jsx(lx,{orientation:"vertical"}),l!=="vertical"&&o.jsx(lx,{orientation:"horizontal"}),o.jsx(U$,{"data-slot":"scroll-area-corner"})]}));En.displayName=Rj.displayName;const lx=p.forwardRef(({className:e,orientation:t="vertical",style:r,...s},n)=>o.jsx(bj,{ref:n,"data-slot":"scroll-area-scrollbar",orientation:t,className:Je("group flex touch-none select-none p-px transition-colors",t==="vertical"&&"h-full w-2",t==="horizontal"&&"h-2 flex-col",e),style:{...t==="vertical"?{right:2}:{bottom:2},...r},...s,children:o.jsx(O$,{"data-slot":"scroll-area-thumb",className:Je("relative flex-1 rounded-full bg-[var(--scrollbar-thumb)] transition-colors group-hover:bg-[var(--scrollbar-thumb-hover)] active:bg-[var(--scrollbar-thumb-active)]",t==="vertical"?"min-h-8 w-full":"h-full min-w-8")})}));lx.displayName=bj.displayName;function H$(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Nj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),F$="VisuallyHidden",q$=p.forwardRef((e,t)=>o.jsx(Ye.span,{...e,ref:t,style:{...Nj,...e.style}}));q$.displayName=F$;var W$=[" ","Enter","ArrowUp","ArrowDown"],V$=[" ","Enter"],nl="Select",[Xm,Zm,G$]=G0(nl),[dl]=en(nl,[G$,Wm]),Qm=Wm(),[Y$,xo]=dl(nl),[K$,X$]=dl(nl),Z$="SelectProvider";function jj(e){const{__scopeSelect:t,children:r,open:s,defaultOpen:n,onOpenChange:l,value:c,defaultValue:d,onValueChange:m,dir:h,name:v,autoComplete:g,disabled:x,required:y,form:w,internal_do_not_use_render:S}=e,k=Qm(t),[C,E]=p.useState(null),[N,R]=p.useState(null),[T,P]=p.useState(!1),z=yd(h),[B,F]=ao({prop:s,defaultProp:n??!1,onChange:l,caller:nl}),[Y,q]=ao({prop:c,defaultProp:d,onChange:m,caller:nl}),$=p.useRef(null),M=p.useRef(Y);p.useEffect(()=>{const V=w?C==null?void 0:C.ownerDocument.getElementById(w):C==null?void 0:C.form;if(V instanceof HTMLFormElement){const X=()=>q(M.current);return V.addEventListener("reset",X),()=>V.removeEventListener("reset",X)}},[w,C,q]);const U=C?!!w||!!C.closest("form"):!0,[W,A]=p.useState(new Set),O=Zs(),L=Array.from(W).map(V=>V.props.value).join(";"),G=p.useCallback(V=>{A(X=>new Set(X).add(V))},[]),H=p.useCallback(V=>{A(X=>{const J=new Set(X);return J.delete(V),J})},[]),D={required:y,trigger:C,onTriggerChange:E,valueNode:N,onValueNodeChange:R,valueNodeHasChildren:T,onValueNodeHasChildrenChange:P,contentId:O,value:Y,onValueChange:q,open:B,onOpenChange:F,dir:z,triggerPointerDownPosRef:$,disabled:x,name:v,autoComplete:g,form:w,nativeOptions:W,nativeSelectKey:L,isFormControl:U};return o.jsx(sy,{...k,children:o.jsx(Y$,{scope:t,...D,children:o.jsx(Xm.Provider,{scope:t,children:o.jsx(K$,{scope:t,onNativeOptionAdd:G,onNativeOptionRemove:H,children:d9(S)?S(D):r})})})})}jj.displayName=Z$;var Aj=e=>{const{__scopeSelect:t,children:r,...s}=e;return o.jsx(jj,{__scopeSelect:t,...s,internal_do_not_use_render:({isFormControl:n})=>o.jsxs(o.Fragment,{children:[r,n?o.jsx(Xj,{__scopeSelect:t}):null]})})};Aj.displayName=nl;var Tj="SelectTrigger",gy=p.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:s=!1,...n}=e,l=Qm(r),c=xo(Tj,r),d=c.disabled||s,m=ut(t,c.onTriggerChange),h=Zm(r),v=p.useRef("touch"),[g,x,y]=Zj(S=>{const k=h().filter(N=>!N.disabled),C=k.find(N=>N.value===c.value),E=Qj(k,S,C);E!==void 0&&c.onValueChange(E.value)}),w=S=>{d||(c.onOpenChange(!0),y()),S&&(c.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return o.jsx(oN,{asChild:!0,...l,children:o.jsx(Ye.button,{type:"button",role:"combobox","aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Jm(c.value)?"":void 0,...n,ref:m,onClick:Be(n.onClick,S=>{S.currentTarget.focus(),v.current!=="mouse"&&w(S)}),onPointerDown:Be(n.onPointerDown,S=>{v.current=S.pointerType;const k=S.target;k.hasPointerCapture(S.pointerId)&&k.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(w(S),S.preventDefault())}),onKeyDown:Be(n.onKeyDown,S=>{const k=g.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(k&&S.key===" ")&&W$.includes(S.key)&&(w(),S.preventDefault())})})})});gy.displayName=Tj;var Mj="SelectValue",vy=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:n,children:l,placeholder:c="",...d}=e,m=xo(Mj,r),{onValueNodeHasChildrenChange:h}=m,v=l!==void 0,g=ut(t,m.onValueNodeChange);mr(()=>{h(v)},[h,v]);const x=Jm(m.value);return o.jsx(Ye.span,{...d,asChild:x?!1:d.asChild,ref:g,style:{pointerEvents:"none"},children:o.jsx(p.Fragment,{children:x?c:l},x?"placeholder":"value")})});vy.displayName=Mj;var Q$="SelectIcon",Dj=p.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,...n}=e;return o.jsx(Ye.span,{"aria-hidden":!0,...n,ref:t,children:s||"▼"})});Dj.displayName=Q$;var Lj="SelectPortal",[J$,e9]=dl(Lj,{forceMount:void 0}),Oj=e=>{const{__scopeSelect:t,forceMount:r,...s}=e;return o.jsx(J$,{scope:e.__scopeSelect,forceMount:r,children:o.jsx(Tm,{asChild:!0,...s})})};Oj.displayName=Lj;var co="SelectContent",_y=p.forwardRef((e,t)=>{const r=e9(co,e.__scopeSelect),{forceMount:s=r.forceMount,...n}=e,l=xo(co,e.__scopeSelect),[c,d]=p.useState();return mr(()=>{d(new DocumentFragment)},[]),o.jsx(tn,{present:s||l.open,children:({present:m})=>m?o.jsx(Ij,{...n,ref:t}):o.jsx(Bj,{...n,fragment:c})})});_y.displayName=co;var Bj=p.forwardRef((e,t)=>{const{__scopeSelect:r,children:s,fragment:n}=e;return n?ha.createPortal(o.jsx(Pj,{scope:r,children:o.jsx(Xm.Slot,{scope:r,children:o.jsx("div",{ref:t,children:s})})}),n):null});Bj.displayName="SelectContentFragment";var qi=10,[Pj,yo]=dl(co),t9="SelectContentImpl",r9=rl("SelectContent.RemoveScroll"),Ij=p.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:s="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:l,onPointerDownOutside:c,side:d,sideOffset:m,align:h,alignOffset:v,arrowPadding:g,collisionBoundary:x,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:k,...C}=e,E=xo(co,r),[N,R]=p.useState(null),[T,P]=p.useState(null),z=ut(t,R),[B,F]=p.useState(null),[Y,q]=p.useState(null),$=Zm(r),[M,U]=p.useState(!1),W=p.useRef(!1);p.useEffect(()=>{if(N)return z0(N)},[N]),I0();const A=p.useCallback(Z=>{const[ce,...le]=$().map(Re=>Re.ref.current),[we]=le.slice(-1),Ee=document.activeElement;for(const Re of Z)if(Re===Ee||(Re==null||Re.scrollIntoView({block:"nearest"}),Re===ce&&T&&(T.scrollTop=0),Re===we&&T&&(T.scrollTop=T.scrollHeight),Re==null||Re.focus(),document.activeElement!==Ee))return},[$,T]),O=p.useCallback(()=>A([B,N]),[A,B,N]);p.useEffect(()=>{M&&O()},[M,O]);const{onOpenChange:L,triggerPointerDownPosRef:G}=E;p.useEffect(()=>{if(N){let Z={x:0,y:0};const ce=we=>{var Ee,Re;Z={x:Math.abs(Math.round(we.pageX)-(((Ee=G.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(we.pageY)-(((Re=G.current)==null?void 0:Re.y)??0))}},le=we=>{Z.x<=10&&Z.y<=10?we.preventDefault():we.composedPath().includes(N)||L(!1),document.removeEventListener("pointermove",ce),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",le,{capture:!0})}}},[N,L,G]),p.useEffect(()=>{const Z=()=>L(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[L]);const[H,D]=Zj(Z=>{const ce=$().filter(Ee=>!Ee.disabled),le=ce.find(Ee=>Ee.ref.current===document.activeElement),we=Qj(ce,Z,le);we&&setTimeout(()=>{var Ee;return(Ee=we.ref.current)==null?void 0:Ee.focus()})}),V=p.useCallback((Z,ce,le)=>{const we=!W.current&&!le;(E.value!==void 0&&E.value===ce||we)&&(F(Z),we&&(W.current=!0))},[E.value]),X=p.useCallback(()=>N==null?void 0:N.focus(),[N]),J=p.useCallback((Z,ce,le)=>{const we=!W.current&&!le;(E.value!==void 0&&E.value===ce||we)&&q(Z)},[E.value]),se=s==="popper"?cx:zj,de=se===cx?{side:d,sideOffset:m,align:h,alignOffset:v,arrowPadding:g,collisionBoundary:x,collisionPadding:y,sticky:w,hideWhenDetached:S,avoidCollisions:k}:{};return o.jsx(Pj,{scope:r,content:N,viewport:T,onViewportChange:P,itemRefCallback:V,selectedItem:B,onItemLeave:X,itemTextRefCallback:J,focusSelectedItem:O,selectedItemText:Y,position:s,isPositioned:M,searchRef:H,children:o.jsx(Dm,{as:r9,allowPinchZoom:!0,children:o.jsx(Am,{asChild:!0,trapped:E.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:Be(n,Z=>{var ce;(ce=E.trigger)==null||ce.focus({preventScroll:!0}),Z.preventDefault()}),children:o.jsx(jm,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:Z=>Z.preventDefault(),...C,...de,onPlaced:()=>U(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:Be(C.onKeyDown,Z=>{const ce=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!ce&&Z.key.length===1&&D(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let we=$().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const Ee=Z.target,Re=we.indexOf(Ee);we=we.slice(Re+1)}setTimeout(()=>A(we)),Z.preventDefault()}})})})})})})});Ij.displayName=t9;var s9="SelectItemAlignedPosition",zj=p.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:s,...n}=e,l=xo(co,r),c=yo(co,r),[d,m]=p.useState(null),[h,v]=p.useState(null),g=ut(t,v),x=Zm(r),y=p.useRef(!1),w=p.useRef(!0),{viewport:S,selectedItem:k,selectedItemText:C,focusSelectedItem:E}=c,N=p.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&h&&S&&k&&C){const z=l.trigger.getBoundingClientRect(),B=h.getBoundingClientRect(),F=l.valueNode.getBoundingClientRect(),Y=C.getBoundingClientRect();if(l.dir!=="rtl"){const Ee=Y.left-B.left,Re=F.left-Ee,te=z.left-Re,ie=z.width+te,ke=Math.max(ie,B.width),Ke=window.innerWidth-qi,_e=ix(Re,[qi,Math.max(qi,Ke-ke)]);d.style.minWidth=ie+"px",d.style.left=_e+"px"}else{const Ee=B.right-Y.right,Re=window.innerWidth-F.right-Ee,te=window.innerWidth-z.right-Re,ie=z.width+te,ke=Math.max(ie,B.width),Ke=window.innerWidth-qi,_e=ix(Re,[qi,Math.max(qi,Ke-ke)]);d.style.minWidth=ie+"px",d.style.right=_e+"px"}const q=x(),$=window.innerHeight-qi*2,M=S.scrollHeight,U=window.getComputedStyle(h),W=parseInt(U.borderTopWidth,10),A=parseInt(U.paddingTop,10),O=parseInt(U.borderBottomWidth,10),L=parseInt(U.paddingBottom,10),G=W+A+M+L+O,H=Math.min(k.offsetHeight*5,G),D=window.getComputedStyle(S),V=parseInt(D.paddingTop,10),X=parseInt(D.paddingBottom,10),J=z.top+z.height/2-qi,se=$-J,de=k.offsetHeight/2,Z=k.offsetTop+de,ce=W+A+Z,le=G-ce;if(ce<=J){const Ee=q.length>0&&k===q[q.length-1].ref.current;d.style.bottom="0px";const Re=h.clientHeight-S.offsetTop-S.offsetHeight,te=Math.max(se,de+(Ee?X:0)+Re+O),ie=ce+te;d.style.height=ie+"px"}else{const Ee=q.length>0&&k===q[0].ref.current;d.style.top="0px";const te=Math.max(J,W+S.offsetTop+(Ee?V:0)+de)+le;d.style.height=te+"px",S.scrollTop=ce-J+S.offsetTop}d.style.margin=`${qi}px 0`,d.style.minHeight=H+"px",d.style.maxHeight=$+"px",s==null||s(),requestAnimationFrame(()=>y.current=!0)}},[x,l.trigger,l.valueNode,d,h,S,k,C,l.dir,s]);mr(()=>N(),[N]);const[R,T]=p.useState();mr(()=>{h&&T(window.getComputedStyle(h).zIndex)},[h]);const P=p.useCallback(z=>{z&&w.current===!0&&(N(),E==null||E(),w.current=!1)},[N,E]);return o.jsx(n9,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:y,onScrollButtonChange:P,children:o.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:o.jsx(Ye.div,{...n,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});zj.displayName=s9;var i9="SelectPopperPosition",cx=p.forwardRef((e,t)=>{const{__scopeSelect:r,align:s="start",collisionPadding:n=qi,...l}=e,c=Qm(r);return o.jsx(lN,{...c,...l,ref:t,align:s,collisionPadding:n,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});cx.displayName=i9;var[n9,xy]=dl(co,{}),ux="SelectViewport",$j=p.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:s,...n}=e,l=yo(ux,r),c=xy(ux,r),d=ut(t,l.onViewportChange),m=p.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(Xm.Slot,{scope:r,children:o.jsx(Ye.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:Be(n.onScroll,h=>{const v=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:x}=c;if(x!=null&&x.current&&g){const y=Math.abs(m.current-v.scrollTop);if(y>0){const w=window.innerHeight-qi*2,S=parseFloat(g.style.minHeight),k=parseFloat(g.style.height),C=Math.max(S,k);if(C<w){const E=C+y,N=Math.min(w,E),R=E-N;g.style.height=N+"px",g.style.bottom==="0px"&&(v.scrollTop=R>0?R:0,g.style.justifyContent="flex-end")}}}m.current=v.scrollTop})})})]})});$j.displayName=ux;var Uj="SelectGroup",[a9,o9]=dl(Uj),yy=p.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,n=Zs();return o.jsx(a9,{scope:r,id:n,children:o.jsx(Ye.div,{role:"group","aria-labelledby":n,...s,ref:t})})});yy.displayName=Uj;var Hj="SelectLabel",by=p.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,n=o9(Hj,r);return o.jsx(Ye.div,{id:n.id,...s,ref:t})});by.displayName=Hj;var om="SelectItem",[l9,Fj]=dl(om),wy=p.forwardRef((e,t)=>{const{__scopeSelect:r,value:s,disabled:n=!1,textValue:l,...c}=e,d=xo(om,r),m=yo(om,r),h=d.value===s,[v,g]=p.useState(l??""),[x,y]=p.useState(!1),w=jr(N=>{var R;return(R=m.itemRefCallback)==null?void 0:R.call(m,N,s,n)}),S=ut(t,w),k=Zs(),C=p.useRef("touch"),E=()=>{n||(d.onValueChange(s),d.onOpenChange(!1))};return o.jsx(l9,{scope:r,value:s,disabled:n,textId:k,isSelected:h,onItemTextChange:p.useCallback(N=>{g(R=>R||((N==null?void 0:N.textContent)??"").trim())},[]),children:o.jsx(Xm.ItemSlot,{scope:r,value:s,disabled:n,textValue:v,children:o.jsx(Ye.div,{role:"option","aria-labelledby":k,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...c,ref:S,onFocus:Be(c.onFocus,()=>y(!0)),onBlur:Be(c.onBlur,()=>y(!1)),onClick:Be(c.onClick,()=>{C.current!=="mouse"&&E()}),onPointerUp:Be(c.onPointerUp,()=>{C.current==="mouse"&&E()}),onPointerDown:Be(c.onPointerDown,N=>{C.current=N.pointerType}),onPointerMove:Be(c.onPointerMove,N=>{var R;C.current=N.pointerType,n?(R=m.onItemLeave)==null||R.call(m):C.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Be(c.onPointerLeave,N=>{var R;N.currentTarget===document.activeElement&&((R=m.onItemLeave)==null||R.call(m))}),onKeyDown:Be(c.onKeyDown,N=>{var T;n||N.target!==N.currentTarget||((T=m.searchRef)==null?void 0:T.current)!==""&&N.key===" "||(V$.includes(N.key)&&E(),N.key===" "&&N.preventDefault())})})})})});wy.displayName=om;var Uu="SelectItemText",qj=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:s,style:n,...l}=e,c=xo(Uu,r),d=yo(Uu,r),m=Fj(Uu,r),h=X$(Uu,r),[v,g]=p.useState(null),x=jr(E=>{var N;return(N=d.itemTextRefCallback)==null?void 0:N.call(d,E,m.value,m.disabled)}),y=ut(t,g,m.onItemTextChange,x),w=v==null?void 0:v.textContent,S=p.useMemo(()=>o.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:k,onNativeOptionRemove:C}=h;return mr(()=>(k(S),()=>C(S)),[k,C,S]),o.jsxs(o.Fragment,{children:[o.jsx(Ye.span,{id:m.textId,...l,ref:y}),m.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!Jm(c.value)?ha.createPortal(l.children,c.valueNode):null]})});qj.displayName=Uu;var Wj="SelectItemIndicator",Vj=p.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return Fj(Wj,r).isSelected?o.jsx(Ye.span,{"aria-hidden":!0,...s,ref:t}):null});Vj.displayName=Wj;var dx="SelectScrollUpButton",Sy=p.forwardRef((e,t)=>{const r=yo(dx,e.__scopeSelect),s=xy(dx,e.__scopeSelect),[n,l]=p.useState(!1),c=ut(t,s.onScrollButtonChange);return mr(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollTop>0;l(h)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),n?o.jsx(Gj,{...e,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});Sy.displayName=dx;var hx="SelectScrollDownButton",Cy=p.forwardRef((e,t)=>{const r=yo(hx,e.__scopeSelect),s=xy(hx,e.__scopeSelect),[n,l]=p.useState(!1),c=ut(t,s.onScrollButtonChange);return mr(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollHeight-m.clientHeight,v=Math.ceil(m.scrollTop)<h;l(v)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),n?o.jsx(Gj,{...e,ref:c,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});Cy.displayName=hx;var Gj=p.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:s,...n}=e,l=yo("SelectScrollButton",r),c=p.useRef(null),d=Zm(r),m=p.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return p.useEffect(()=>()=>m(),[m]),mr(()=>{var v;const h=d().find(g=>g.ref.current===document.activeElement);(v=h==null?void 0:h.ref.current)==null||v.scrollIntoView({block:"nearest"})},[d]),o.jsx(Ye.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:Be(n.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(s,50))}),onPointerMove:Be(n.onPointerMove,()=>{var h;(h=l.onItemLeave)==null||h.call(l),c.current===null&&(c.current=window.setInterval(s,50))}),onPointerLeave:Be(n.onPointerLeave,()=>{m()})})}),c9="SelectSeparator",ky=p.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e;return o.jsx(Ye.div,{"aria-hidden":!0,...s,ref:t})});ky.displayName=c9;var Yj="SelectArrow",u9=p.forwardRef((e,t)=>{const{__scopeSelect:r,...s}=e,n=Qm(r);return yo(Yj,r).position==="popper"?o.jsx(cN,{...n,...s,ref:t}):null});u9.displayName=Yj;var Kj="SelectBubbleInput",Xj=p.forwardRef(({__scopeSelect:e,...t},r)=>{const s=xo(Kj,e),{value:n,onValueChange:l,required:c,disabled:d,name:m,autoComplete:h,form:v}=s,{nativeOptions:g,nativeSelectKey:x}=s,y=p.useRef(null),w=ut(r,y),S=n??"",k=H$(S),C=Array.from(g).some(E=>(E.props.value??"")==="");return p.useEffect(()=>{const E=y.current;if(!E)return;const N=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(N,"value").set;if(k!==S&&T){const P=new Event("change",{bubbles:!0});T.call(E,S),E.dispatchEvent(P)}},[k,S]),o.jsxs(Ye.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:m,autoComplete:h,disabled:d,form:v,onChange:E=>l(E.target.value),...t,style:{...Nj,...t.style},ref:w,defaultValue:S,children:[Jm(n)&&!C?o.jsx("option",{value:""}):null,Array.from(g)]},x)});Xj.displayName=Kj;function d9(e){return typeof e=="function"}function Jm(e){return e===""||e===void 0}function Zj(e){const t=jr(e),r=p.useRef(""),s=p.useRef(0),n=p.useCallback(c=>{const d=r.current+c;t(d),(function m(h){r.current=h,window.clearTimeout(s.current),h!==""&&(s.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),l=p.useCallback(()=>{r.current="",window.clearTimeout(s.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),[r,n,l]}function Qj(e,t,r){const n=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let c=h9(e,Math.max(l,0));n.length===1&&(c=c.filter(h=>h!==r));const m=c.find(h=>h.textValue.toLowerCase().startsWith(n.toLowerCase()));return m!==r?m:void 0}function h9(e,t){return e.map((r,s)=>e[(t+s)%e.length])}function Cn(e){return o.jsx(Aj,{"data-slot":"select",...e})}const Jj=p.forwardRef(({className:e,...t},r)=>o.jsx(yy,{ref:r,"data-slot":"select-group",className:Je("scroll-my-1 p-1",e),...t}));Jj.displayName=yy.displayName;const Gi=p.forwardRef((e,t)=>o.jsx(vy,{ref:t,"data-slot":"select-value",...e}));Gi.displayName=vy.displayName;const Yi=p.forwardRef(({className:e,size:t="default",children:r,...s},n)=>o.jsxs(gy,{ref:n,"data-slot":"select-trigger","data-size":t,className:Je("flex w-full min-w-0 items-center justify-between gap-1.5 whitespace-nowrap rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:min-w-0 [&>span]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...s,children:[r,o.jsx(Dj,{asChild:!0,children:o.jsx(vd,{"aria-hidden":"true",className:"pointer-events-none size-4 shrink-0 text-muted-foreground"})})]}));Yi.displayName=gy.displayName;const eA=p.forwardRef(({className:e,...t},r)=>o.jsx(Sy,{ref:r,"data-slot":"select-scroll-up-button",className:Je("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:o.jsx(cO,{"aria-hidden":"true"})}));eA.displayName=Sy.displayName;const tA=p.forwardRef(({className:e,...t},r)=>o.jsx(Cy,{ref:r,"data-slot":"select-scroll-down-button",className:Je("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:o.jsx(vd,{"aria-hidden":"true"})}));tA.displayName=Cy.displayName;const Ki=p.forwardRef(({className:e,children:t,position:r="popper",align:s="center",sideOffset:n=4,collisionPadding:l=8,...c},d)=>o.jsx(Oj,{children:o.jsxs(_y,{ref:d,"data-slot":"select-content","data-align-trigger":r==="item-aligned",position:r,align:s,sideOffset:n,collisionPadding:l,className:Je("cn-menu-translucent relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 origin-[var(--radix-select-content-transform-origin)] overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"w-[var(--radix-select-trigger-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...c,children:[o.jsx(eA,{}),o.jsx($j,{"data-position":r,className:Je("p-1",r==="popper"&&"min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(tA,{})]})}));Ki.displayName=_y.displayName;const rA=p.forwardRef(({className:e,...t},r)=>o.jsx(by,{ref:r,"data-slot":"select-label",className:Je("px-1.5 py-1 text-xs text-muted-foreground",e),...t}));rA.displayName=by.displayName;const fr=p.forwardRef(({className:e,children:t,...r},s)=>o.jsxs(wy,{ref:s,"data-slot":"select-item",className:Je("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[o.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:o.jsx(Vj,{children:o.jsx(Ar,{"aria-hidden":"true",className:"pointer-events-none"})})}),o.jsx(qj,{children:t})]}));fr.displayName=wy.displayName;const ep=p.forwardRef(({className:e,...t},r)=>o.jsx(ky,{ref:r,"data-slot":"select-separator",className:Je("pointer-events-none -mx-1 my-1 h-px bg-border",e),...t}));ep.displayName=ky.displayName;var f9=Object.defineProperty,Nc=(e,t)=>f9(e,"name",{value:t,configurable:!0}),sA=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ey(e,t,{checkForDefaultPrevented:r=!0}={}){return Nc(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}Nc(Ey,"composeEventHandlers");function m9(e){var t;if(!sA)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Nc(m9,"getOwnerWindow");function fx(e){if(!sA)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Nc(fx,"getOwnerDocument");function iA(e,t=!1){const{activeElement:r}=fx(e);if(!(r!=null&&r.nodeName))return null;if(nA(r)&&r.contentDocument)return iA(r.contentDocument.body,t);if(t){const s=r.getAttribute("aria-activedescendant");if(s){const n=fx(r).getElementById(s);if(n)return n}}return r}Nc(iA,"getActiveElement");function nA(e){return e.tagName==="IFRAME"}Nc(nA,"isFrame");var p9=Object.defineProperty,Ry=(e,t)=>p9(e,"name",{value:t,configurable:!0});function mx(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ry(mx,"setRef");function aA(...e){return t=>{let r=!1;const s=e.map(n=>{const l=mx(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<s.length;n++){const l=s[n];typeof l=="function"?l():mx(e[n],null)}}}}Ry(aA,"composeRefs");function tp(...e){return p.useCallback(aA(...e),e)}Ry(tp,"useComposedRefs");var g9=Object.defineProperty,Si=(e,t)=>g9(e,"name",{value:t,configurable:!0});function v9(e,t){const r=p.createContext(t);r.displayName=e+"Context";const s=Si(l=>{const{children:c,...d}=l,m=p.useMemo(()=>d,Object.values(d));return o.jsx(r.Provider,{value:m,children:c})},"Provider");s.displayName=e+"Provider";function n(l,c={}){const{optional:d=!1}=c,m=p.useContext(r);if(m)return m;if(t!==void 0)return t;if(!d)throw new Error(`\`${l}\` must be used within \`${e}\``)}return Si(n,"useContext"),[s,n]}Si(v9,"createContext");function oA(e,t=[]){let r=[];function s(l,c){const d=p.createContext(c);d.displayName=l+"Context";const m=r.length;r=[...r,c];const h=Si(g=>{var C;const{scope:x,children:y,...w}=g,S=((C=x==null?void 0:x[e])==null?void 0:C[m])||d,k=p.useMemo(()=>w,Object.values(w));return o.jsx(S.Provider,{value:k,children:y})},"Provider");h.displayName=l+"Provider";function v(g,x,y={}){var C;const{optional:w=!1}=y,S=((C=x==null?void 0:x[e])==null?void 0:C[m])||d,k=p.useContext(S);if(k)return k;if(c!==void 0)return c;if(!w)throw new Error(`\`${g}\` must be used within \`${l}\``)}return Si(v,"useContext"),[h,v]}Si(s,"createContext");const n=Si(()=>{const l=r.map(c=>p.createContext(c));return Si(function(d){const m=(d==null?void 0:d[e])||l;return p.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])},"useScope")},"createScope");return n.scopeName=e,[s,lA(n,...t)]}Si(oA,"createContextScope");function lA(...e){const t=e[0];if(e.length===1)return t;const r=Si(()=>{const s=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return Si(function(l){const c=s.reduce((d,{useScope:m,scopeName:h})=>{const g=m(l)[`__scope${h}`];return{...d,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}Si(lA,"composeContextScopes");var Ny=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},_9=Object.defineProperty,x9=(e,t)=>_9(e,"name",{value:t,configurable:!0}),t2=fo[" useEffectEvent ".trim().toString()],r2=fo[" useInsertionEffect ".trim().toString()];function cA(e){if(typeof t2=="function")return t2(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof r2=="function"?r2(()=>{t.current=e}):Ny(()=>{t.current=e}),p.useMemo(()=>((...r)=>{var s;return(s=t.current)==null?void 0:s.call(t,...r)}),[])}x9(cA,"useEffectEvent");var y9=Object.defineProperty,Nd=(e,t)=>y9(e,"name",{value:t,configurable:!0}),b9=fo[" useInsertionEffect ".trim().toString()]||Ny;function uA({prop:e,defaultProp:t,onChange:r=Nd(()=>{},"onChange"),caller:s}){const[n,l,c]=dA({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:n,h=p.useCallback(v=>{var g;if(d){const x=hA(v)?v(e):v;x!==e&&((g=c.current)==null||g.call(c,x))}else l(v)},[d,e,l,c]);return[m,h]}Nd(uA,"useControllableState");function dA({defaultProp:e,onChange:t}){const[r,s]=p.useState(e),n=p.useRef(r),l=p.useRef(t);return b9(()=>{l.current=t},[t]),p.useEffect(()=>{var c;n.current!==r&&((c=l.current)==null||c.call(l,r),n.current=r)},[r,n]),[r,s,l]}Nd(dA,"useUncontrolledState");function hA(e){return typeof e=="function"}Nd(hA,"isFunction");var s2=Symbol("RADIX:SYNC_STATE");function w9(e,t,r,s){const{prop:n,defaultProp:l,onChange:c,caller:d}=t,m=n!==void 0,h=cA(c),v=[{...r,state:l}];s&&v.push(s);const[g,x]=p.useReducer((k,C)=>{if(C.type===s2)return{...k,state:C.state};const E=e(k,C);return m&&!Object.is(E.state,k.state)&&h(E.state),E},...v),y=g.state,w=p.useRef(y);p.useEffect(()=>{w.current!==y&&(w.current=y,m||h(y))},[y,w,m]);const S=p.useMemo(()=>n!==void 0?{...g,state:n}:g,[g,n]);return p.useEffect(()=>{m&&!Object.is(n,g.state)&&x({type:s2,state:n})},[n,g.state,m]),[S,x]}Nd(w9,"useControllableStateReducer");var S9=Object.defineProperty,C9=(e,t)=>S9(e,"name",{value:t,configurable:!0});function fA(e){const[t,r]=p.useState(void 0);return Ny(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const l=n[0];let c,d;if("borderBoxSize"in l){const m=l.borderBoxSize,h=Array.isArray(m)?m[0]:m;c=h.inlineSize,d=h.blockSize}else c=e.offsetWidth,d=e.offsetHeight;r({width:c,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else r(void 0)},[e]),t}C9(fA,"useSize");var k9=Object.defineProperty,Bi=(e,t)=>k9(e,"name",{value:t,configurable:!0}),E9=Bi(((e,t)=>{const r={...t};for(const s in t){const n=e[s],l=t[s];if(/^on[A-Z]/.test(s))if(n&&l){const d=typeof n=="function",m=typeof l=="function";r[s]=(...h)=>{const v=m?l(...h):void 0;return d&&n(...h),v}}else n&&(r[s]=n);else s==="style"?r[s]={...typeof n=="object"?n:null,...typeof l=="object"?l:null}:s==="className"?r[s]=[n,l].filter(Boolean).join(" "):s==="aria-describedby"&&(r[s]=mA(l,n))}return{...e,...r}}),"mergeProps");function mA(...e){const t=new Set;for(const r of e)if(typeof r=="string")for(const s of String(r).trim().split(/\s+/))s&&t.add(s);return t.size>0?Array.from(t).join(" "):void 0}Bi(mA,"concatAriaDescribedby");var pA=p.createContext(E9);pA.displayName="SlotContext";function gA(e){const t=p.forwardRef((r,s)=>{const n=p.useContext(pA);let{children:l,mergeProps:c=n,...d}=r,m=null,h=!1;const v=[];px(l)&&typeof sf=="function"&&(l=sf(l._payload)),p.Children.forEach(l,w=>{var S;if(xA(w)){h=!0;const k=w;let C="child"in k.props?k.props.child:k.props.children;px(C)&&typeof sf=="function"&&(C=sf(C._payload)),m=N9(k,C),v.push((S=m==null?void 0:m.props)==null?void 0:S.children)}else v.push(w)}),m?m=p.cloneElement(m,void 0,v):!h&&p.Children.count(l)===1&&p.isValidElement(l)&&(m=l);const g=m?_A(m):void 0,x=tp(s,g);if(!m){if(l||l===0)throw new Error(h?T9(e):A9(e));return l}const y=c(d,m.props??{});return m.type!==p.Fragment&&(y.ref=s?x:g),p.cloneElement(m,y)});return t.displayName=`${e}.Slot`,t}Bi(gA,"createSlot");var vA=Symbol.for("radix.slottable");function R9(e){const t=Bi(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=vA,t}Bi(R9,"createSlottable");var N9=Bi((e,t)=>{if("child"in e.props){const r=e.props.child;return p.isValidElement(r)?p.cloneElement(r,void 0,e.props.children(r.props.children)):null}return p.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function _A(e){var s,n;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}Bi(_A,"getElementRef");function xA(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vA}Bi(xA,"isSlottable");var j9=Symbol.for("react.lazy");function px(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===j9&&"_payload"in e&&yA(e._payload)}Bi(px,"isLazyComponent");function yA(e){return typeof e=="object"&&e!==null&&"then"in e}Bi(yA,"isPromiseLike");var A9=Bi(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),T9=Bi(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),sf=fo[" use ".trim().toString()],M9=Object.defineProperty,D9=(e,t)=>M9(e,"name",{value:t,configurable:!0}),L9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jy=L9.reduce((e,t)=>{const r=gA(`Primitive.${t}`),s=p.forwardRef((n,l)=>{const{asChild:c,...d}=n,m=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(m,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function O9(e,t){e&&ha.flushSync(()=>e.dispatchEvent(t))}D9(O9,"dispatchDiscreteCustomEvent");var B9=Object.defineProperty,uo=(e,t)=>B9(e,"name",{value:t,configurable:!0}),Ay="Switch",[P9,qQ]=oA(Ay),[I9,Ty]=P9(Ay);function bA(e){const{__scopeSwitch:t,checked:r,children:s,defaultChecked:n,disabled:l,form:c,name:d,onCheckedChange:m,required:h,value:v="on",internal_do_not_use_render:g}=e,[x,y]=uA({prop:r,defaultProp:n??!1,onChange:m,caller:Ay}),[w,S]=p.useState(null),[k,C]=p.useState(null),E=p.useRef(!1),[N,R]=p.useReducer(z=>z+1,0),T=w?!!c||!!w.closest("form"):!0,P={checked:x,setChecked:y,disabled:l,control:w,setControl:S,name:d,form:c,value:v,hasConsumerStoppedPropagationRef:E,userInteractionCount:N,onUserInteraction:R,required:h,defaultChecked:n,isFormControl:T,bubbleInput:k,setBubbleInput:C};return o.jsx(I9,{scope:t,...P,children:SA(g)?g(P):s})}uo(bA,"SwitchProvider");var z9="SwitchTrigger",$9=p.forwardRef(uo(function({__scopeSwitch:t,onClick:r,...s},n){const{control:l,form:c,value:d,disabled:m,checked:h,required:v,setControl:g,setChecked:x,hasConsumerStoppedPropagationRef:y,onUserInteraction:w,isFormControl:S,bubbleInput:k}=Ty(z9,t),C=tp(n,g),E=p.useRef(h);return p.useEffect(()=>{const N=c?l==null?void 0:l.ownerDocument.getElementById(c):l==null?void 0:l.form;if(N instanceof HTMLFormElement){const R=uo(()=>x(E.current),"reset");return N.addEventListener("reset",R),()=>N.removeEventListener("reset",R)}},[l,c,x]),o.jsx(jy.button,{type:"button",role:"switch","aria-checked":h,"aria-required":v,"data-state":My(h),"data-disabled":m?"":void 0,disabled:m,value:d,...s,ref:C,onClick:Ey(r,N=>{w(),x(R=>!R),k&&S&&(y.current=N.isPropagationStopped(),y.current||N.stopPropagation())})})},"SwitchTrigger")),wA=p.forwardRef(uo(function(t,r){const{__scopeSwitch:s,name:n,checked:l,defaultChecked:c,required:d,disabled:m,value:h,onCheckedChange:v,form:g,...x}=t;return o.jsx(bA,{__scopeSwitch:s,checked:l,defaultChecked:c,disabled:m,required:d,onCheckedChange:v,name:n,form:g,value:h,internal_do_not_use_render:({isFormControl:y})=>o.jsxs(o.Fragment,{children:[o.jsx($9,{...x,ref:r,__scopeSwitch:s}),y&&o.jsx(q9,{__scopeSwitch:s})]})})},"Switch")),U9="SwitchThumb",H9=p.forwardRef(uo(function(t,r){const{__scopeSwitch:s,...n}=t,l=Ty(U9,s);return o.jsx(jy.span,{"data-state":My(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:r})},"SwitchThumb")),F9="SwitchBubbleInput",q9=p.forwardRef(uo(function({__scopeSwitch:t,onClick:r,...s},n){const{control:l,hasConsumerStoppedPropagationRef:c,userInteractionCount:d,checked:m,defaultChecked:h,required:v,disabled:g,name:x,value:y,form:w,bubbleInput:S,setBubbleInput:k}=Ty(F9,t),C=tp(n,k),E=fA(l),N=p.useRef(!1),R=p.useRef(m),T=p.useRef(d);p.useEffect(()=>{const z=S;if(!z)return;const B=window.HTMLInputElement.prototype,Y=Object.getOwnPropertyDescriptor(B,"checked").set,q=d!==T.current;T.current=d;const $=R.current!==m;R.current=m;const M=!(q&&c.current);if($&&Y){N.current=!q;const U=new Event("click",{bubbles:M});Y.call(z,m),z.dispatchEvent(U),N.current=!1}},[S,m,c,d]);const P=p.useRef(m);return o.jsx(jy.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??P.current,required:v,disabled:g,name:x,value:y,form:w,...s,tabIndex:-1,ref:C,onClick:Ey(r,z=>{N.current&&z.stopPropagation()}),style:{...s.style,...E,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function SA(e){return typeof e=="function"}uo(SA,"isFunction");function My(e){return e?"checked":"unchecked"}uo(My,"getState");const rp=p.forwardRef(({className:e,size:t="default",...r},s)=>o.jsx(wA,{ref:s,"data-slot":"switch","data-size":t,className:Je("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80",e),...r,children:o.jsx(H9,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"})}));rp.displayName=wA.displayName;var sp="Tabs",[W9]=en(sp,[Vm]),CA=Vm(),[V9,Dy]=W9(sp),kA=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,onValueChange:n,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:m="automatic",...h}=e,v=yd(d),[g,x]=ao({prop:s,onChange:n,defaultProp:l??"",caller:sp});return o.jsx(V9,{scope:r,baseId:Zs(),value:g,onValueChange:x,orientation:c,dir:v,activationMode:m,children:o.jsx(Ye.div,{dir:v,"data-orientation":c,...h,ref:t})})});kA.displayName=sp;var EA="TabsList",RA=p.forwardRef((e,t)=>{const{__scopeTabs:r,loop:s=!0,...n}=e,l=Dy(EA,r),c=CA(r);return o.jsx(gN,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:o.jsx(Ye.div,{role:"tablist","aria-orientation":l.orientation,...n,ref:t})})});RA.displayName=EA;var NA="TabsTrigger",jA=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,disabled:n=!1,...l}=e,c=Dy(NA,r),d=CA(r),m=MA(c.baseId,s),h=DA(c.baseId,s),v=s===c.value;return o.jsx(vN,{asChild:!0,...d,focusable:!n,active:v,children:o.jsx(Ye.button,{type:"button",role:"tab","aria-selected":v,"aria-controls":h,"data-state":v?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:m,...l,ref:t,onMouseDown:Be(e.onMouseDown,g=>{!n&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Be(e.onKeyDown,g=>{n||g.target!==g.currentTarget||[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Be(e.onFocus,()=>{const g=c.activationMode!=="manual";!v&&!n&&g&&c.onValueChange(s)})})})});jA.displayName=NA;var AA="TabsContent",TA=p.forwardRef((e,t)=>{const{__scopeTabs:r,value:s,forceMount:n,children:l,...c}=e,d=Dy(AA,r),m=MA(d.baseId,s),h=DA(d.baseId,s),v=s===d.value,g=p.useRef(v);return p.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),o.jsx(tn,{present:n||v,children:({present:x})=>o.jsx(Ye.div,{"data-state":v?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":m,hidden:!x,id:h,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:x&&l})})});TA.displayName=AA;function MA(e,t){return`${e}-trigger-${t}`}function DA(e,t){return`${e}-content-${t}`}var LA=kA,OA=RA,BA=jA,PA=TA;function G9(e){return o.jsx(LA,{"data-slot":"tabs",...e})}const IA=p.forwardRef(({className:e,...t},r)=>o.jsx(OA,{ref:r,"data-slot":"tabs-list",className:Je("inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));IA.displayName="TabsList";const jf=p.forwardRef(({className:e,...t},r)=>o.jsx(BA,{ref:r,"data-slot":"tabs-trigger",className:Je("inline-flex h-7 items-center justify-center whitespace-nowrap rounded-md border border-transparent px-3 text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-border data-[state=active]:bg-background data-[state=active]:text-foreground",e),...t}));jf.displayName="TabsTrigger";const Af=p.forwardRef(({className:e,...t},r)=>o.jsx(PA,{ref:r,"data-slot":"tabs-content",className:Je("mt-4 outline-none",e),...t}));Af.displayName="TabsContent";const xt={sessions:"/sessions",emulator:"/settings/emulator",overview:"/settings/overview",runtimes:"/settings/runtimes",providers:"/settings/providers",projects:"/settings/projects",agents:"/settings/agents",skills:"/settings/skills",plugins:"/settings/plugins",localRuntime:"/settings/local-runtime",computerUse:"/settings/computer-use"},od="/settings",gx=xt.overview,Y9="/runtimes/:runtimeSelector/sessions",K9="/runtimes/:runtimeSelector/sessions/:sessionId",ld="!invalid-runtime-owner",X9=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,255}$/,Z9={emulator:"/emulator",overview:"/overview",runtimes:"/runtimes",providers:"/providers",projects:"/projects",agents:"/agents",skills:"/skills",plugins:"/plugins"},Q9={"/settings/updates":`${xt.overview}#software-update`,"/settings/daemon":`${xt.localRuntime}#runtime`,"/settings/command":`${xt.localRuntime}#terminal-command`,"/settings/computer":`${xt.computerUse}#permissions`,"/settings/inspection":`${xt.computerUse}#chrome-inspection`},zA=["localRuntime","computerUse"];function J9(e){return zA.includes(e)}function $A(e,t){return!J9(e)||t}function UA(e){const t=e.length>1?e.replace(/\/+$/,""):e;if(vx(t)||t===xt.sessions||t.startsWith(`${xt.sessions}/`))return"sessions";const r=Object.entries(xt).find(([,s])=>s===t);return(r==null?void 0:r[0])??"sessions"}function eU(e,t=!0){const r=UA(e);return r==="sessions"||!$A(r,t)?null:r}function vx(e){const t=/^\/runtimes\/([^/]+)\/sessions(?:\/[^/]+)?\/?$/.exec(e);if(!t)return null;try{return FA(decodeURIComponent(t[1]))}catch{return ld}}function HA(e){const t=new URLSearchParams(e).getAll("runtime");return t.length===0?null:t.length!==1?ld:FA(t[0])}function FA(e){return X9.test(e)?e:ld}function Wo(e,t){return`/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}`}function to(e){return`/runtimes/${encodeURIComponent(e)}/sessions`}function qA(e,t){const r=e==null?void 0:e.returnTo;return typeof r=="string"&&r.startsWith("/")&&!r.startsWith("//")&&r!==od&&!r.startsWith(`${od}/`)?r:t}const WA="/api/plugins/install-preparations",nf="/api/plugin-marketplaces",tU=/^[A-Za-z0-9_-]{32,128}$/;function VA(e){if(!tU.test(e))throw new Error("invalid plugin preparation token");return`${WA}/${encodeURIComponent(e)}`}function rU(e){return`${VA(e)}/commit`}function hl(){return typeof window>"u"?void 0:window.rynxSessionPortal}function Ps(e){const t=hl(),r=t==null?void 0:t.portalId;if(!r)return e;const s=new URL(e,"http://session-portal.local");return s.searchParams.set("portal",r),t.embedOrigin&&s.searchParams.set("embed_origin",t.embedOrigin),`${s.pathname}${s.search}${s.hash}`}function jd(e){const t=new Headers(e),r=hl(),s=r==null?void 0:r.portalId;return s&&t.set("x-rynx-session-portal",s),r!=null&&r.secret&&t.set("x-rynx-session-portal-secret",r.secret),t}function Ly(e){const t=hl(),r=t==null?void 0:t.portalId;r&&e.set("portal",r),t!=null&&t.secret&&e.set("portal_secret",t.secret)}class aa extends Error{constructor(r,s,n,l){super(r);us(this,"status");us(this,"code");us(this,"outcome");this.name="ApiRequestError",this.status=s,this.code=n,this.outcome=l}}function ip(e){return e instanceof aa&&(e.outcome==="not_started"||[400,403,404,409,413].includes(e.status))}const sU="/api/runtimes/capability",iU="x-rynx-runtime-capability";let nc;async function nU(e,t,r){const s=location.protocol==="https:"?"wss":"ws",n=await cd(r.refreshCapability),l=new URLSearchParams({capability:n,role:r.role??"owner",cols:String(r.cols),rows:String(r.rows)});return Ly(l),`${s}://${location.host}/api/runtimes/${encodeURIComponent(e)}/sessions/${encodeURIComponent(t)}/terminal?${l.toString()}`}function aU(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams;e&&r.set("device",e);const s=r.toString();return`${t}://${location.host}/api/emulator/touch${s?`?${s}`:""}`}async function oU(e,t,r,s){const n=s?`${ur(s,e)}/interactions/${encodeURIComponent(t)}/resolve`:`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/resolve`,l={method:"POST",body:JSON.stringify({resolution:r})};return(s?await tt(n,l):await Ze(n,l)).disposition}async function Ze(e,t={}){return GA(e,{},t)}async function GA(e,t,r={}){const s=jd(r.headers);r.body&&!s.has("content-type")&&s.set("content-type","application/json");const n=await fetch(e,{...r,headers:s});if(!n.ok){let c=`${n.status}`,d,m;try{const h=await n.json();typeof h.error=="string"&&(d=h.error,c=h.error),typeof h.code=="string"&&(d=h.code),(h.outcome==="not_started"||h.outcome==="unknown")&&(m=h.outcome)}catch{}throw new aa(c,n.status,d,m)}const l=await n.text();return l?JSON.parse(l):t}async function cd(e=!1){return e&&(nc=void 0),nc||(nc=Ze(sU,{cache:"no-store"}).then(({capability:t})=>{if(typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t))throw new Error("invalid Runtime Web capability");return t}).catch(t=>{throw nc=void 0,t})),nc}async function tt(e,t){const r=async n=>{const l=jd(t.headers);return l.set(iU,n),Ze(e,{...t,headers:l})},s=await cd();try{return await r(s)}catch(n){if(!(n instanceof Error)||n.message!=="invalid_runtime_capability")throw n;return nc=void 0,r(await cd())}}async function qv(e,t={}){const r=jd(t.headers),s=await fetch(e,{...t,headers:r});if(!s.ok){let n=`${s.status}`;try{const l=await s.json();l.error&&(n=l.error)}catch{}throw new Error(n)}return s.blob()}async function lU(e,t,r,s){const n=jd({"content-type":"application/json"}),l=await fetch(e,{method:"POST",headers:n,body:t===void 0?void 0:JSON.stringify(t),signal:s});await YA(l,r)}async function cU(e,t,r){const s=await fetch(e,{signal:r,headers:jd()});await YA(s,t)}async function YA(e,t){if(!e.ok||!e.body){let l=`${e.status}`,c,d;try{const m=await e.json();m.error&&(c=m.error,l=m.error),m.code&&(c=m.code),(m.outcome==="not_started"||m.outcome==="unknown")&&(d=m.outcome)}catch{}throw new aa(l,e.status,c,d)}const r=e.body.getReader(),s=new TextDecoder;let n="";for(;;){const{done:l,value:c}=await r.read();if(l)break;n+=s.decode(c,{stream:!0});let d;for(;(d=n.indexOf(`
582
+
583
+ `))!==-1;){const m=n.slice(0,d);n=n.slice(d+2);const h=uU(m);h&&t(h)}}}function uU(e){let t="message",r="";for(const n of e.split(`
584
+ `))n.startsWith("event:")?t=n.slice(6).trim():n.startsWith("data:")&&(r+=n.slice(5).trim());if(!t&&!r)return null;let s={};try{r&&(s=JSON.parse(r))}catch{}return{event:t,data:s}}function _x(e,t){return e?`/api/runtimes/${encodeURIComponent(e)}/emulator/${t}`:`/api/emulator/${t}`}function ku(e,t,r){const s=_x(e,t);return e?tt(s,r):Ze(s,r)}function ur(e,t,r){const s=`/api/runtimes/${encodeURIComponent(e)}/sessions`;if(t===void 0)return s;const n=`${s}/${encodeURIComponent(t)}`;return r?`${n}/${r}`:n}function af(e,t){const r=`/api/runtimes/${encodeURIComponent(e)}/projects`;return t===void 0?r:`${r}/${encodeURIComponent(t)}`}function Ka(e,t,...r){const s=`${ur(e,t)}/browser`;return r.length===0?s:`${s}/${r.map(n=>encodeURIComponent(n)).join("/")}`}function Uo(e,t,r){const s=`${ur(e,t)}/emulator`;return r?`${s}/${r}`:s}function dU(e,t,r){const s=new URLSearchParams({bindingId:r});return Ps(`${ur(e,t)}/emulator/frame?${s.toString()}`)}function Eu(e,t,r,s,n){return tt(Ka(e,t,"pages",s,n),{method:"POST",body:JSON.stringify({browserGeneration:r})})}function of(e,t,r){return e?ur(e,t,r):`/api/sessions/${encodeURIComponent(t)}/${r}`}const pe={meta:()=>Ze("/api/meta"),listRuntimeShareAddresses:()=>Ze("/api/runtime-server/share-addresses",{cache:"no-store"}).then(e=>e.addresses),shareRuntime:e=>tt("/api/runtime-server/share",{method:"POST",body:JSON.stringify(e)}),listRuntimeAccess:()=>Ze("/api/runtime-server/access").then(e=>e.clients),revokeRuntimeAccess:e=>tt(`/api/runtime-server/access/${encodeURIComponent(e)}`,{method:"DELETE"}),deleteRevokedRuntimeAccess:e=>tt(`/api/runtime-server/access/${encodeURIComponent(e)}/record`,{method:"DELETE"}),listRuntimes:()=>Ze("/api/runtimes").then(e=>e.runtimes),listProviderClis:e=>Ze(`/api/runtimes/${encodeURIComponent(e)}/provider-clis`,{cache:"no-store"}),startProviderCliOperation:(e,t,r)=>tt(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/${encodeURIComponent(t)}/${r}`,{method:"POST",body:JSON.stringify({})}),getProviderCliJob:(e,t)=>Ze(`/api/runtimes/${encodeURIComponent(e)}/provider-clis/jobs/${encodeURIComponent(t)}`,{cache:"no-store"}).then(r=>r.job),pairRuntime:e=>tt("/api/runtimes/pair",{method:"POST",body:JSON.stringify(e)}),testRuntime:e=>tt(`/api/runtimes/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify({})}),forgetRuntime:e=>tt(`/api/runtimes/${encodeURIComponent(e)}`,{method:"DELETE"}),getRuntimeBrowserState:(e,t)=>GA(Ka(e,t),null),getRuntimeBrowserRequestHeaders:(e,t)=>tt(Ka(e,t,"request-headers"),{cache:"no-store"}),updateRuntimeBrowserRequestHeaders:(e,t)=>tt(Ka(e,t.sessionId,"request-headers"),{method:"PUT",body:JSON.stringify({expectedRevision:t.expectedRevision,enabled:t.enabled,headers:t.headers})}),openRuntimeBrowser:(e,t,r)=>tt(Ka(e,t,"open"),{method:"POST",body:JSON.stringify(r===void 0?{}:{url:r})}),closeRuntimeBrowser:(e,t,r)=>tt(Ka(e,t,"close"),{method:"POST",body:JSON.stringify({browserGeneration:r})}),createRuntimeBrowserPage:(e,t,r,s)=>tt(Ka(e,t,"pages"),{method:"POST",body:JSON.stringify({browserGeneration:r,...s===void 0?{}:{url:s}})}),closeRuntimeBrowserPage:(e,t,r,s)=>Eu(e,t,r,s,"close"),activateRuntimeBrowserPage:(e,t,r,s)=>Eu(e,t,r,s,"activate"),navigateRuntimeBrowserPage:(e,t,r,s,n)=>tt(Ka(e,t,"pages",s,"navigate"),{method:"POST",body:JSON.stringify({browserGeneration:r,url:n})}),backRuntimeBrowserPage:(e,t,r,s)=>Eu(e,t,r,s,"back"),forwardRuntimeBrowserPage:(e,t,r,s)=>Eu(e,t,r,s,"forward"),reloadRuntimeBrowserPage:(e,t,r,s)=>Eu(e,t,r,s,"reload"),getSessionEmulator:(e,t)=>Ze(Uo(e,t)).then(r=>r.binding),listSessionEmulatorDevices:(e,t)=>Ze(Uo(e,t,"devices")).then(r=>r.devices),attachSessionEmulator:(e,t,r)=>tt(Uo(e,t,"attach"),{method:"POST",body:JSON.stringify({device:r})}),detachSessionEmulator:(e,t,r)=>tt(Uo(e,t,"detach"),{method:"POST",body:JSON.stringify({bindingId:r})}),tapSessionEmulator:(e,t,r,s,n)=>tt(Uo(e,t,"tap"),{method:"POST",body:JSON.stringify({bindingId:r,x:s,y:n})}),gestureSessionEmulator:(e,t,r,s)=>tt(Uo(e,t,"gesture"),{method:"POST",body:JSON.stringify({bindingId:r,points:s})}),buttonSessionEmulator:(e,t,r,s)=>tt(Uo(e,t,"button"),{method:"POST",body:JSON.stringify({bindingId:r,name:s})}),sessionEmulatorFrameBlob:(e,t,r,s)=>qv(dU(e,t,r),{signal:s,cache:"no-store"}),listPlugins:()=>Ze("/api/plugins").then(e=>e.plugins),listPluginMarketplaces:()=>Ze(nf,{cache:"no-store"}).then(e=>e.marketplaces),addPluginMarketplace:e=>tt(nf,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(e)}),refreshPluginMarketplace:e=>tt(`${nf}/${encodeURIComponent(e)}/refresh`,{method:"POST",headers:{"x-rynx-console":"1"},body:"{}"}),removePluginMarketplace:e=>tt(`${nf}/${encodeURIComponent(e)}`,{method:"DELETE",headers:{"x-rynx-console":"1"}}),preparePluginInstallation:(e,t)=>tt(WA,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(e),signal:t}),commitPluginInstallation:(e,t,r)=>tt(rU(e),{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify(t),signal:r}),cancelPluginInstallation:e=>tt(VA(e),{method:"DELETE",headers:{"x-rynx-console":"1"}}),setPluginEnabled:(e,t)=>tt(`/api/plugins/${encodeURIComponent(e)}/${t?"enable":"disable"}`,{method:"POST",headers:{"x-rynx-console":"1"},body:"{}"}).then(r=>r.plugin),pluginSettingsUi:(e,t)=>Ze(`/api/plugins/${encodeURIComponent(e)}/settings-ui`,{cache:"no-store",signal:t}),pluginSettingsCall:(e,t,r,s,n)=>tt(`/api/plugins/${encodeURIComponent(e)}/settings`,{method:"POST",headers:{"x-rynx-console":"1"},body:JSON.stringify({generation:t,method:r,params:s}),signal:n}).then(l=>l.result),emulatorDevices:e=>Ze(_x(e,"devices")).then(t=>t.devices),activeEmulator:e=>Ze(_x(e,"active")).then(t=>t.active),attachEmulator:(e,t)=>ku(t,"attach",{method:"POST",body:JSON.stringify({device:e})}),tapEmulator:(e,t,r,s)=>ku(s,"tap",{method:"POST",body:JSON.stringify({x:e,y:t,device:r})}),gestureEmulator:(e,t,r)=>ku(r,"gesture",{method:"POST",body:JSON.stringify({points:e,device:t})}),buttonEmulator:(e,t,r)=>ku(r,"button",{method:"POST",body:JSON.stringify({name:e,device:t})}),shutdownEmulator:(e,t)=>ku(t,"shutdown",{method:"POST",body:JSON.stringify({device:e})}),emulatorVideoStreamUrl:e=>`/api/emulator/video${e?`?device=${encodeURIComponent(e)}`:""}`,emulatorFrameBlob:e=>qv(`/api/emulator/frame${e?`?device=${encodeURIComponent(e)}`:""}`),screenshotEmulator:(e,t)=>Ze("/api/emulator/screenshot",{method:"POST",body:JSON.stringify({device:e,out:t})}),emulatorScreenshotBlob:e=>qv(`/api/emulator/screenshot-file?file=${encodeURIComponent(e)}`),listAgents:()=>Ze("/api/agents").then(e=>e.agents),getAgent:e=>Ze(`/api/agents/${encodeURIComponent(e)}`),listAgentRuntimeOptions:(e=!1)=>Ze(`/api/agents/runtime-options${e?"?refresh=1":""}`,{cache:"no-store"}).then(t=>t.runtimes),createAgent:e=>Ze("/api/agents",{method:"POST",body:JSON.stringify(e)}),updateAgent:(e,t)=>Ze(`/api/agents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)}),deleteAgent:e=>Ze(`/api/agents/${encodeURIComponent(e)}`,{method:"DELETE"}),listProjects:e=>Ze(af(e),{cache:"no-store"}).then(t=>t.projects),createProject:(e,t)=>tt(af(e),{method:"POST",body:JSON.stringify(t)}).then(r=>r.project),updateProject:(e,t,r)=>tt(af(e,t),{method:"PUT",body:JSON.stringify(r)}).then(s=>s.project),deleteProject:(e,t)=>tt(af(e,t),{method:"DELETE"}),listSkills:()=>Ze("/api/skills").then(e=>e.skills),getSkill:e=>Ze(`/api/skills/${encodeURIComponent(e)}`),readSkillFile:(e,t)=>Ze(`/api/skills/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`),installSkill:e=>Ze("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(t=>t.skills),scanLocalSkills:e=>Ze("/api/skills/local-scan",{method:"POST",body:JSON.stringify({runtime:e})}).then(t=>t.candidates),importLocalSkills:(e,t)=>Ze("/api/skills/local-import",{method:"POST",body:JSON.stringify({runtime:e,keys:t})}).then(r=>r.results),importSkillArchive:(e,t)=>Ze("/api/skills/import-archive",{method:"POST",body:JSON.stringify({filename:e,contentBase64:t})}).then(r=>r.results),deleteSkill:e=>Ze(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"}),listSessions:e=>Ze(e?ur(e):"/api/sessions").then(t=>t.sessions),listSessionAgentOptions:e=>Ze(`${ur(e)}/agent-options`).then(t=>t.agents),listSessionLaunchOptions:e=>Ze(`${ur(e)}/launch-options`),getSessionExecutionSettings:(e,t)=>Ze(ur(e,t,"execution"),{cache:"no-store"}),updateSessionExecutionSettings:(e,t,r)=>tt(ur(e,t,"execution"),{method:"PUT",body:JSON.stringify(r)}),createSession:(e,t)=>{const r=t?ur(t):"/api/sessions",s={method:"POST",body:JSON.stringify(e)};return t?tt(r,s):Ze(r,s)},forkSession:(e,t,r)=>tt(ur(e,t,"fork"),{method:"POST",body:JSON.stringify(r)}),sendSessionMessage:(e,t,r,s,n)=>n?tt(ur(n,e,"messages"),{method:"POST",body:JSON.stringify(typeof t=="string"?{message:t}:t),signal:s}):lU(`/api/sessions/${encodeURIComponent(e)}/messages`,typeof t=="string"?{message:t}:t,r,s),getSessionResourcePolicy:(e,t)=>Ze(`${ur(e,t,"resources")}/policy`,{cache:"no-store"}),uploadSessionResource:(e,t,r,s,n,l)=>tt(ur(e,t,"resources"),{method:"POST",body:r,signal:l,headers:{"content-type":r.type||"application/octet-stream","x-rynx-resource-type":n,"x-rynx-upload-id":s,"x-rynx-filename":encodeURIComponent(r.name)}}).then(c=>c.resource),deleteSessionResource:(e,t,r)=>tt(`${ur(e,t,"resources")}/${encodeURIComponent(r)}`,{method:"DELETE"}),sessionResourceContentUrl:(e,t,r)=>Ps(`${ur(e,t,"resources")}/${encodeURIComponent(r.resourceId)}/content`),sessionItemFileContentUrl:(e,t,r,s)=>Ps(`${ur(e,t,"items")}/${encodeURIComponent(r)}/files/${s}/content`),sessionWorkspaceFileContentUrl:(e,t,r)=>Ps(`${ur(e,t)}/workspace/files/content?${new URLSearchParams({path:r}).toString()}`),enqueueSessionMessage:(e,t,r)=>tt(ur(e,t,"messages/queue"),{method:"POST",body:JSON.stringify({message:r})}),startSessionTerminal:(e,t)=>tt(ur(e,t,"terminal/start"),{method:"POST",body:"{}"}),streamSession:(e,t,r,s)=>cU(of(s,e,"stream"),t,r),getSessionHistory:e=>Ze(`/api/sessions/${encodeURIComponent(e)}/history`).then(t=>t.items),getSessionSnapshot:(e,t,r)=>Ze(of(r,e,"snapshot"),{signal:t}),getSessionSnapshotPage:(e,t,r,s)=>{const n=new URLSearchParams;t!==void 0&&n.set("afterId",t);const l=n.size>0?`?${n.toString()}`:"";return Ze(`${of(s,e,"snapshot-page")}${l}`,{signal:r})},closeSession:(e,t)=>{const r=t?ur(t,e):`/api/sessions/${encodeURIComponent(e)}`,s={method:"DELETE"};return t?tt(r,s):Ze(r,s)},interruptSession:(e,t)=>{const r=of(t,e,"interrupt"),s={method:"POST"};return t?tt(r,s):Ze(r,s)}},KA="rynx.control.runtime-target.v1",xx={selector:"local",daemonId:"local",displayName:"This device",binding:"local"};function hU(e){var t;if(!e)return"local";try{return((t=e.getItem(KA))==null?void 0:t.trim())||"local"}catch{return"local"}}function i2(e,t){if(e)try{e.setItem(KA,t)}catch{}}function fU(e){const t=new Map;for(const r of e)!r.selector||t.has(r.selector)||t.set(r.selector,r);return t.has("local")||t.set("local",xx),[...t.values()].sort((r,s)=>r.selector==="local"?-1:s.selector==="local"?1:r.displayName.localeCompare(s.displayName))}const XA=p.createContext(null);function mU({children:e}){const t=hl(),r=Qr(),s=mo(),n=vx(r.pathname)??(r.pathname===xt.sessions?HA(r.search):null),[l,c]=p.useState(()=>hU(typeof window>"u"?void 0:window.localStorage)),d=n??l,[m,h]=p.useState([xx]),v=p.useCallback(w=>{h(fU(w))},[]),g=p.useCallback(async()=>{if(t){v([xx]);return}try{v(await pe.listRuntimes())}catch(w){me.error(`Failed to load Runtimes: ${w.message}`)}},[t,v]);p.useEffect(()=>{g()},[g]),p.useEffect(()=>{!n||n===ld||(c(n),i2(typeof window>"u"?void 0:window.localStorage,n))},[n]);const x=p.useCallback(w=>{const S=w.trim();if(!S)return;c(S),i2(typeof window>"u"?void 0:window.localStorage,S),(r.pathname===xt.sessions||r.pathname.startsWith(`${xt.sessions}/`)||vx(r.pathname)!==null)&&n!==S&&s(Ps(to(S)))},[r.pathname,s,n]),y=p.useMemo(()=>{const w=m.find(k=>k.selector===d)??(d===ld?{selector:d,daemonId:d,displayName:"Invalid Runtime URL",binding:"direct"}:{selector:d,daemonId:d,displayName:`${d} (unavailable)`,binding:d==="local"?"local":"direct"}),S=d!=="local";return{runtimes:m,runtimeSelector:d,runtimeRoute:S?d:void 0,selectedRuntime:w,isRemoteRuntime:S,selectRuntime:x,refreshRuntimes:g,updateRuntimes:v}},[g,d,m,x,v]);return o.jsx(XA.Provider,{value:y,children:e})}function jc(){const e=p.useContext(XA);if(!e)throw new Error("useRuntimeTarget must be used inside RuntimeTargetProvider");return e}const n2="!add-runtime";function pU(){const e=Qr(),t=mo(),{runtimes:r,runtimeSelector:s,selectedRuntime:n,selectRuntime:l}=jc(),c=r.some(m=>m.selector===s)?r:[...r,n],d=m=>{if(m===n2){t(xt.runtimes,{state:{returnTo:`${e.pathname}${e.search}${e.hash}`}});return}l(m)};return o.jsx("div",{className:"ml-auto w-44 max-w-full sm:w-60",children:o.jsxs(Cn,{value:s,onValueChange:d,children:[o.jsxs(Yi,{className:"h-10 w-full min-w-0 gap-1.5 border-0 bg-transparent px-2 font-mono text-[10px] shadow-none hover:bg-[var(--accent)] focus-visible:ring-2 sm:h-7","aria-label":"Active Runtime",children:[o.jsx("span",{className:"hidden shrink-0 uppercase tracking-[0.12em] text-[var(--muted-foreground)] sm:inline",children:"Runtime ·"}),o.jsx(Gi,{placeholder:"Select Runtime"})]}),o.jsxs(Ki,{align:"end",children:[c.map(m=>{const h=m.binding==="local"?EE:Nm;return o.jsx(fr,{value:m.selector,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(h,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"truncate",children:m.displayName})]})},m.selector)}),o.jsx(ep,{}),o.jsx(fr,{value:n2,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Zr,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"Add Runtime…"})]})})]})]})})}function fl(){return typeof window>"u"?null:window.rynxDesktopIntegration??null}function ZA(e){return e.globalCli.state==="foreign"||e.globalCli.state==="unwritable"}function Tf(e,t){return!e.runtime.ready||!e.builtinSkill.ready?!1:e.globalCli.state==="installed"&&!e.globalCli.canInstall||e.globalCli.state==="development"||ZA(e)&&t}const QA=p.createContext({status:null,operation:null,error:null,checkForUpdates:async()=>null,installUpdate:async()=>null});function gU({children:e}){const t=fl(),[r,s]=p.useState(null),[n,l]=p.useState(null),[c,d]=p.useState(null);p.useEffect(()=>{if(!t)return;let g=!0;const x=t.onAppUpdateStatus(y=>{g&&(s(y),y.error||d(null))});return t.getAppUpdateStatus().then(y=>{g&&s(y)}).catch(y=>{g&&d(Wv(y))}),()=>{g=!1,x()}},[t]);const m=p.useCallback(async()=>{if(!t)return null;l("check"),d(null);try{const g=await t.checkForAppUpdates();return s(g),g}catch(g){return d(Wv(g)),null}finally{l(null)}},[t]),h=p.useCallback(async()=>{if(!t)return null;l("install"),d(null);try{const g=await t.installAppUpdate();return s(g),g}catch(g){return d(Wv(g)),null}finally{l(null)}},[t]),v=p.useMemo(()=>({status:r,operation:n,error:c,checkForUpdates:m,installUpdate:h}),[m,c,h,n,r]);return o.jsx(QA.Provider,{value:v,children:e})}function Oy(){return p.useContext(QA)}function Wv(e){return e instanceof Error?e.message:String(e)}function vU(){const{status:e,operation:t,error:r,installUpdate:s}=Oy();if(!(e!=null&&e.availableVersion)||e.phase!=="downloading"&&e.phase!=="ready"&&e.phase!=="installing")return null;const n=t==="install"||e.phase==="installing",l=e.phase==="ready"&&!n,c=r??e.error;return o.jsxs("div",{className:"group/update relative flex shrink-0 items-center",children:[o.jsxs(re,{variant:"ghost",size:"icon-xs",className:"relative text-[var(--primary)] hover:text-[var(--primary)]","aria-label":`Rynx ${e.availableVersion} update available`,"aria-haspopup":"dialog",children:[e.phase==="downloading"||n?o.jsx(Le,{className:"animate-spin"}):o.jsx(Xu,{}),o.jsx("span",{className:"absolute right-0.5 top-0.5 size-1.5 rounded-full bg-[var(--primary)] ring-2 ring-[var(--background)]","aria-hidden":"true"})]}),o.jsx("div",{role:"dialog","aria-label":"Rynx update",className:"invisible absolute bottom-full right-0 z-50 w-72 translate-y-1 pb-2 opacity-0 transition-[opacity,transform,visibility] duration-150 group-hover/update:visible group-hover/update:translate-y-0 group-hover/update:opacity-100 group-focus-within/update:visible group-focus-within/update:translate-y-0 group-focus-within/update:opacity-100",children:o.jsxs("div",{className:"rounded-xl border border-[var(--border)] bg-[var(--popover)] p-3 font-sans text-[var(--popover-foreground)] shadow-xl",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]",children:l?o.jsx(Xu,{className:"size-4"}):e.phase==="downloading"?o.jsx(_d,{className:"size-4"}):o.jsx(Le,{className:"size-4 animate-spin"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-[var(--foreground)]",children:l?"Update ready":n?"Preparing update":"Downloading update"}),o.jsx("p",{className:"mt-0.5 text-[11px] leading-4 text-[var(--muted-foreground)]",children:l?`${e.appName} ${e.availableVersion} is ready to install.`:n?"Rynx will restart when the local Runtime is safe to stop.":`${e.appName} ${e.availableVersion} is downloading in the background.`})]})]}),l&&o.jsxs(re,{size:"sm",className:"mt-3 w-full",onClick:()=>void s(),children:[o.jsx(Xu,{}),"Restart to update"]}),c&&o.jsx("p",{className:"mt-2 text-[10px] leading-4 text-[var(--destructive)]",children:c})]})})]})}function Pe(...e){return OR(q0(e))}function _U({children:e,theme:t,onToggleTheme:r}){const s=Qr(),n=hl(),{runtimeSelector:l}=jc(),c=UA(s.pathname),d=s.pathname===od||s.pathname.startsWith(`${od}/`),m=qA(s.state,to(l)),h=d?m:gx,v=d?void 0:{returnTo:`${s.pathname}${s.search}${s.hash}`};return o.jsxs("div",{className:"grid h-dvh min-h-0 grid-rows-[minmax(0,1fr)_2.5rem] overflow-hidden bg-[var(--background)] sm:grid-rows-[minmax(0,1fr)_2rem]",children:[o.jsx("main",{className:"min-h-0 overflow-hidden focus:outline-none",children:e}),o.jsxs("footer",{className:"app-no-drag flex min-w-0 items-center gap-3 border-t border-[var(--border)] bg-[var(--muted)]/24 px-2 font-mono text-[10px] text-[var(--muted-foreground)] sm:px-3",children:[o.jsx("span",{className:"hidden truncate uppercase tracking-[0.12em] min-[480px]:block",children:d?c==="emulator"?"Emulator · local device":"Settings · local configuration":"Session workbench"}),o.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[n?o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[o.jsx("span",{className:"text-[var(--foreground)]",children:"Rynx Sessions"}),n.access==="read_only"&&o.jsx("span",{"aria-hidden":"true",children:"· read only"})]}):d?o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[o.jsx("span",{className:"text-[var(--foreground)]",children:"Control Plane"}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{children:"This device"})]}):o.jsx(pU,{}),o.jsx("span",{className:"h-3.5 w-px bg-[var(--border)]","aria-hidden":"true"}),o.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[!n&&o.jsx(vU,{}),o.jsx(re,{variant:"ghost",size:"icon-xs",className:"shrink-0",onClick:r,"aria-label":t==="dark"?"Use light mode":"Use dark mode",title:t==="dark"?"Light mode":"Dark mode",children:t==="dark"?o.jsx(mB,{}):o.jsx(v6,{})}),!n&&o.jsx(re,{asChild:!0,variant:"ghost",size:"icon-xs",className:Pe("shrink-0",d&&"text-[var(--primary)]"),children:o.jsx(eo,{to:h,state:v,"aria-label":d?"Back to app":"Settings",title:d?"Back to app":"Settings",children:o.jsx(ME,{})})})]})]})]})]})}const lm="/assets/rynx-wordmark-LL1QRYHD.png";function xU({bridge:e,children:t}){const[r,s]=p.useState(null),[n,l]=p.useState(null),[c,d]=p.useState("refresh"),[m,h]=p.useState(!1),v=p.useCallback(async(k=!1)=>{d("refresh"),l(null);try{const C=await e.getStatus(k);Tf(C,!1)?s(await e.completeOnboarding()):s(C)}catch(C){l(C.message)}finally{d(null)}},[e]);p.useEffect(()=>{e.initialOnboardingCompleted||v()},[e.initialOnboardingCompleted,v]);const g=r?Tf(r,m):!1;async function x(){const k=r==null?void 0:r.globalCli.path;if(k){d("install"),l(null);try{const C=await e.installCli(k);h(!1),Tf(C,!1)?s(await e.completeOnboarding()):s(C)}catch(C){l(C.message);try{s(await e.getStatus(!0))}catch{}}finally{d(null)}}}async function y(){d("runtime"),l(null);try{s(await e.restartDaemon())}catch(k){l(k.message)}finally{d(null)}}async function w(){if(!(!r||!g)){d("complete"),l(null);try{s(await e.completeOnboarding())}catch(k){l(k.message)}finally{d(null)}}}if(e.initialOnboardingCompleted||r!=null&&r.onboardingCompleted)return t;const S=!!(r!=null&&r.runtime.ready&&(r!=null&&r.builtinSkill.ready));return o.jsxs("div",{className:"grid h-dvh min-h-0 overflow-hidden bg-[var(--background)] md:grid-cols-[15rem_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] bg-[var(--muted)]/18 p-4 md:border-r md:border-b-0 md:p-5",children:[o.jsx("img",{src:lm,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),o.jsxs("div",{className:"app-no-drag mt-6",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx("p",{className:"label-caps text-[10px] text-[var(--primary)]",children:"Setup"}),o.jsx("span",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:"1/1"})]}),o.jsx("ol",{className:"mt-3","aria-label":"Setup steps",children:o.jsxs("li",{"aria-current":"step",className:"flex items-center gap-2 rounded-lg bg-[var(--muted)] px-3 py-2.5 text-sm font-medium text-[var(--foreground)] ring-1 ring-inset ring-[var(--border)]",children:[o.jsx("span",{className:"grid size-5 shrink-0 place-items-center rounded-full bg-[var(--primary)] text-[10px] font-semibold text-[var(--primary-foreground)]",children:"1"}),o.jsx("span",{className:"truncate",children:"Terminal command"})]})})]})]}),o.jsxs("main",{className:"app-no-drag relative min-h-0 overflow-auto",children:[o.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),o.jsx("div",{className:"grid min-h-full place-items-center px-5 py-12 sm:px-8 md:px-12",children:o.jsxs("section",{className:"w-full max-w-xl","aria-labelledby":"onboarding-command-title",children:[o.jsx(yU,{titleId:"onboarding-command-title",title:"Set up the Terminal command",description:"Install one small command so Rynx is available from any Terminal."}),o.jsx("div",{className:"mt-7 rounded-lg border border-[var(--border)] bg-[var(--card)] p-5 shadow-sm","aria-busy":c!==null,children:r?S?o.jsx(bU,{status:r,pending:c,acknowledged:m,onAcknowledgedChange:h,onInstall:()=>void x(),onRefresh:()=>void v(!0),onContinue:()=>void w()}):o.jsx(wU,{status:r,pending:c,onRetry:()=>void y()}):o.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[c==="refresh"&&o.jsx(Le,{className:"size-4 animate-spin"}),c==="refresh"?"Getting Rynx ready…":"Setup status is unavailable."]})}),n&&o.jsxs("div",{role:"alert",className:"mt-5 flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(Sc,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})})]})]})}function yU({titleId:e,title:t,description:r}){return o.jsxs("div",{children:[o.jsx("h1",{id:e,className:"text-2xl font-semibold tracking-tight",children:t}),o.jsx("p",{className:"mt-2 max-w-lg text-sm leading-6 text-[var(--muted-foreground)]",children:r})]})}function bU({status:e,pending:t,acknowledged:r,onAcknowledgedChange:s,onInstall:n,onRefresh:l,onContinue:c}){const d=e.globalCli.state==="installed",m=e.globalCli.state==="development",h=d&&!e.globalCli.canInstall,v=ZA(e),g=Tf(e,r);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:h?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:h?o.jsx(Ar,{className:"size-4"}):o.jsx(D0,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-sm font-medium",children:"Terminal command"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:SU(e)})]})]}),v&&o.jsxs("label",{className:"mt-5 flex cursor-pointer items-start gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_7%,var(--background))] p-3 text-xs",children:[o.jsx("input",{type:"checkbox",checked:r,onChange:x=>s(x.target.checked),className:"mt-0.5 size-4 shrink-0 accent-[var(--primary)]"}),o.jsxs("span",{children:["Continue without Terminal access. I'll resolve the"," ",o.jsx("code",{className:"font-mono",children:"rynx"})," command later."]})]}),o.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[e.globalCli.canInstall&&o.jsxs(re,{disabled:t!==null,onClick:n,children:[t==="install"&&o.jsx(Le,{className:"animate-spin"}),"Install command"]}),(h||m||v)&&o.jsxs(re,{disabled:t!==null||!g,onClick:c,children:["Continue",o.jsx(bE,{})]}),o.jsxs(re,{variant:"outline",disabled:t!==null,onClick:l,children:[o.jsx(yt,{className:t==="refresh"?"animate-spin":""}),"Check again"]})]})]})}function wU({status:e,pending:t,onRetry:r}){return o.jsxs("div",{role:"alert",className:"flex items-start gap-3",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:o.jsx(Sc,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h2",{className:"text-sm font-medium",children:e.builtinSkill.ready?"Rynx couldn’t finish starting":"Rynx needs to be reinstalled"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:e.builtinSkill.ready?"Try again to continue.":"A required app component is unavailable. Reinstall Rynx, then open it again."}),e.builtinSkill.ready&&o.jsxs(re,{className:"mt-4",variant:"outline",disabled:t!==null,onClick:r,children:[t==="runtime"&&o.jsx(Le,{className:"animate-spin"}),"Try again"]})]})]})}function SU(e){switch(e.globalCli.state){case"installed":return e.globalCli.canInstall?"Install the rynx command to use Rynx from Terminal.":"Rynx is ready to use from Terminal.";case"missing":return"Install the rynx command to use Rynx from Terminal.";case"stale":return"An older rynx command was found. Repair it to continue.";case"foreign":return"Another command named rynx already exists. Resolve it later in Settings.";case"development":return"Terminal command registration is disabled in development builds.";case"unwritable":return"Rynx could not install the command automatically. Resolve it later in Settings.";case"error":return"Rynx could not check the command. Check again before continuing."}}function CU({bridge:e}){const[t,r]=p.useState(null),[s,n]=p.useState(!1),[l,c]=p.useState(null),d=p.useRef(!1),m=p.useRef(0),h=p.useCallback(y=>{y.requestId<=m.current||(m.current=y.requestId,r(y),n(!1),c(null),d.current=!1)},[]);p.useEffect(()=>{let y=!0;const w=e.onQuitPrompt(S=>{y&&h(S)});return e.getPendingQuitPrompt().then(S=>{y&&S&&h(S)}).catch(()=>{}),()=>{y=!1,w()}},[h,e]);const v=p.useCallback(async()=>{if(!(!t||s||d.current)){d.current=!0;try{const y=await e.respondToQuit(t.requestId,"cancel");if(y.outcome==="failed"){c(y.message);return}if(y.outcome==="quitting"){n(!0);return}y.outcome==="cancelled"&&(r(null),c(null))}catch{c("Rynx couldn’t dismiss the quit request. Try again.")}finally{d.current=!1}}},[e,t,s]),g=p.useCallback(async()=>{if(!(!t||t.kind!=="active-work"||d.current)){d.current=!0,n(!0),c(null);try{const y=await e.respondToQuit(t.requestId,"force");y.outcome==="failed"?(c(y.message),n(!1)):y.outcome==="cancelled"&&(r(null),n(!1))}catch{c("Rynx couldn’t stop the running work. Try again."),n(!1)}finally{d.current=!1}}},[e,t]),x=(t==null?void 0:t.kind)==="active-work";return o.jsx(ji,{open:t!==null,onOpenChange:y=>{y||v()},children:o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsx(IR,{className:"bg-destructive/10 text-destructive",children:o.jsx(Ci,{"aria-hidden":"true"})}),o.jsx(ri,{children:x?"Quit Rynx?":"Rynx couldn’t quit"}),o.jsx(si,{children:x?"Work is still running. Quitting now will stop it and close the open workspace.":"Rynx couldn’t stop its local service safely. Keep the app open and try again."})]}),l&&o.jsx("p",{role:"alert",className:"text-sm text-destructive",children:l}),o.jsxs(Ti,{children:[o.jsx(ii,{disabled:s,children:x?"Keep working":"Close"}),x&&o.jsx(re,{type:"button",variant:"destructive",disabled:s,onClick:()=>void g(),children:s?o.jsxs(o.Fragment,{children:[o.jsx(Le,{className:"animate-spin motion-reduce:animate-none"}),"Quitting…"]}):"Quit anyway"})]})]})})}const kU=[{label:"General",items:[{id:"overview",label:"Overview",icon:r6},{id:"projects",label:"Projects",icon:IO}]},{label:"Connections",items:[{id:"localRuntime",label:"Local Runtime",icon:D0},{id:"runtimes",label:"Runtimes",icon:Nm}]},{label:"AI Capabilities",items:[{id:"providers",label:"Providers",icon:LE},{id:"agents",label:"Agents",icon:Em},{id:"skills",label:"Skills",icon:DE}]},{label:"Integrations",items:[{id:"computerUse",label:"Computer Use",icon:RE},{id:"emulator",label:"Emulator",icon:mc},{id:"plugins",label:"Plugins",icon:Rm}]}];function EU({activeView:e,desktopIntegrationAvailable:t,children:r}){const s=mo(),n=Qr(),{runtimeSelector:l}=jc(),c=qA(n.state,to(l)),d={returnTo:c},m=kU.map(v=>({...v,items:v.items.filter(({id:g})=>$A(g,t))})).filter(v=>v.items.length>0),h=m.flatMap(v=>v.items);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-[var(--background)] md:grid md:grid-cols-[14rem_minmax(0,1fr)]",children:[o.jsxs("aside",{className:"hidden min-h-0 flex-col border-r border-[var(--border)] bg-[var(--muted)]/18 md:flex",children:[o.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset border-b border-[var(--border)] p-2.5",children:[o.jsx("div",{className:"mb-2 flex h-7 items-center px-0.5",children:o.jsxs(eo,{to:c,className:"app-no-drag flex w-fit items-center gap-2","aria-label":"Rynx",children:[o.jsx("img",{src:lm,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),o.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]})}),o.jsx(re,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag w-full justify-start gap-2 px-2",children:o.jsxs(eo,{to:c,children:[o.jsx(tl,{className:"size-3.5"}),"Back to app"]})})]}),o.jsx(En,{className:"min-h-0 flex-1",children:o.jsx("nav",{className:"space-y-4 p-3","aria-label":"Settings",children:m.map(v=>o.jsxs("div",{children:[o.jsx("div",{className:"label-caps mb-1 px-2 text-[9px] text-[var(--muted-foreground)]",children:v.label}),o.jsx("div",{className:"grid gap-0.5",children:v.items.map(({id:g,label:x,icon:y})=>o.jsxs(eo,{to:xt[g],state:d,"aria-current":e===g?"page":void 0,className:Pe("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",e===g?"bg-[var(--primary)]/10 text-[var(--primary)]":"text-[var(--muted-foreground)] hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]"),children:[o.jsx(y,{className:"size-3.5 shrink-0"}),x]},g))})]},v.label))})})]}),o.jsxs("div",{className:"app-drag-region flex h-14 shrink-0 items-center gap-2 border-b border-[var(--border)] bg-[var(--muted)]/18 px-3 md:hidden",children:[o.jsx(eo,{to:c,className:"app-no-drag shrink-0","aria-label":"Rynx",children:o.jsx("img",{src:lm,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"})}),o.jsx(re,{asChild:!0,variant:"ghost",size:"sm",className:"app-no-drag shrink-0 gap-1.5 px-2",children:o.jsxs(eo,{to:c,children:[o.jsx(tl,{className:"size-3.5"}),"Back"]})}),o.jsx(uj,{"aria-label":"Settings page",value:e,className:"ml-auto min-w-0 flex-1",onChange:v=>s(xt[v.target.value],{state:d}),children:h.map(({id:v,label:g})=>o.jsx("option",{value:v,children:g},v))})]}),e==="emulator"?o.jsx("section",{className:"min-h-0 flex-1 overflow-hidden",children:r}):o.jsx(En,{className:"min-h-0 flex-1",children:o.jsx("section",{className:"p-4 sm:p-6",children:r})})]})}var RU="Label",JA=p.forwardRef((e,t)=>o.jsx(Ye.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));JA.displayName=RU;var NU=JA;const Xr=p.forwardRef(({className:e,...t},r)=>o.jsx(NU,{ref:r,className:Pe("text-xs font-medium text-[var(--muted-foreground)]",e),...t}));Xr.displayName="Label";function eT({onInstalled:e,triggerLabel:t="Install skill",triggerVariant:r="default"}){const[s,n]=p.useState(!1),[l,c]=p.useState(""),[d,m]=p.useState(""),[h,v]=p.useState(""),[g,x]=p.useState(!1);function y(){c(""),m(""),v("")}const w=(()=>{const E=l.trim();return!E||!d.trim()?E:`${E}#${d.trim()}`})(),S=!!d.trim()&&l.includes("#");async function k(){const E=w;if(E){if(S){me.error("Source already pins a ref with '#' — clear one of the two.");return}x(!0);try{const N=await pe.installSkill({tool:"skills-cli",source:E,...h.trim()?{skill:h.trim()}:{}});me.success(`Installed ${h.trim()||E}`),e(N),y(),n(!1)}catch(N){me.error(`Install failed: ${N.message}`)}finally{x(!1)}}}const C=["npx skills add",w||"<source>",h.trim()&&`--skill ${h.trim()}`].filter(Boolean).join(" ");return o.jsxs(sn,{open:s,onOpenChange:E=>{n(E),E||y()},children:[o.jsx(zR,{asChild:!0,children:o.jsxs(re,{size:"sm",variant:r,children:[o.jsx(Zr,{})," ",t]})}),o.jsxs(Di,{children:[o.jsxs(An,{children:[o.jsx(Li,{children:"Install a skill"}),o.jsxs(vo,{children:["From the open skills ecosystem (skills.sh). Runs ",o.jsx("code",{children:"npx skills add"})," into the global catalog (",o.jsx("code",{children:"~/.rynx/skills"}),")."]})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs(Xr,{children:["Source ",o.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),o.jsx(bt,{value:l,autoFocus:!0,placeholder:"vercel-labs/skills or https://github.com/owner/repo",onChange:E=>c(E.target.value)}),o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["A repo (",o.jsx("code",{children:"owner/repo"}),"), a git URL, or a namespace."]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{children:"Skill"}),o.jsx(bt,{value:h,placeholder:"find-skills",onChange:E=>v(E.target.value)}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Optional — when a repo ships several."})]}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{children:"Branch"}),o.jsx(bt,{value:d,placeholder:"main",onChange:E=>m(E.target.value)}),o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Optional — a git ref, sent as ",o.jsx("code",{children:"#<branch>"}),"."]})]})]}),o.jsx("pre",{className:"overflow-x-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-2.5 font-mono text-xs text-[var(--muted-foreground)]",children:C})]}),o.jsxs(ma,{children:[o.jsx(re,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),o.jsx(re,{onClick:k,disabled:g||!l.trim(),children:g?"Installing…":"Install"})]})]})]})}const jU=["codex","traex","claude"],a2=["none","minimal","low","medium","high","xhigh","max","ultra"],AU=["read-only","workspace-write","danger-full-access"],TU=["never","on-failure","on-request","untrusted"],MU=["acceptEdits","auto","bypassPermissions","manual","dontAsk","plan"];function DU({value:e,onChange:t}){return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(Pr,{label:"Display name",help:"Shown in the UI; the id (left) is the directory name.",children:o.jsx(bt,{value:e.name??"",placeholder:"My agent",onChange:r=>t({...e,name:r.target.value})})}),o.jsx(Pr,{label:"Description",children:o.jsx(bt,{value:e.description??"",placeholder:"What this agent does",onChange:r=>t({...e,description:r.target.value})})}),o.jsx(Pr,{label:"Instructions",help:"Inline system prompt, or a path to a .md under the agent dir.",children:o.jsx(Ec,{value:e.instructions??"",className:"min-h-[14rem]",placeholder:"You are a helpful agent.",onChange:r=>t({...e,instructions:r.target.value})})})]})}function LU({value:e,onChange:t}){const r=e.executor??{},s=r.retry??{},[n,l]=p.useState(null);p.useEffect(()=>{let y=!1;return pe.listAgentRuntimeOptions().then(w=>!y&&l(w)).catch(w=>{y||(l([]),me.error(`Load runtime options failed: ${w.message}`))}),()=>{y=!0}},[]);const c=y=>t({...e,executor:{...r,...y}}),d=y=>t({...e,executor:{...r,retry:{...s,...y}}}),m=n==null?void 0:n.find(y=>y.id===(r.runtime??"codex")),h=(m==null?void 0:m.models)??[],v=h.find(y=>y.id===r.model),g=(v==null?void 0:v.reasoningOptions.map(y=>y.value))??a2,x=y=>{if(!y)return;const w=n==null?void 0:n.find(k=>k.id===y),S=(w==null?void 0:w.models.find(k=>k.isDefault))??(w==null?void 0:w.models[0]);c({runtime:y,model:S==null?void 0:S.id,reasoningEffort:S==null?void 0:S.defaultReasoningEffort})};return o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs(Pr,{label:"Runtime",children:[o.jsx(Zu,{value:r.runtime,options:n!=null&&n.length?n.map(y=>y.id):jU,required:!0,onChange:x}),m&&!m.available&&o.jsxs("p",{className:"text-xs text-[var(--warning)]",children:[m.name," is not installed on this machine."]})]}),o.jsx(Pr,{label:"Reasoning effort",children:o.jsx(Zu,{value:r.reasoningEffort,options:g.length>0?g:a2,onChange:y=>c({reasoningEffort:y})})})]}),o.jsx(Pr,{label:"Model",help:"Blank inherits the runtime default.",children:h.length>0?o.jsxs(Cn,{value:r.model??"",onValueChange:y=>c({model:y,reasoningEffort:void 0}),children:[o.jsx(Yi,{children:o.jsx(Gi,{placeholder:"runtime default"})}),o.jsxs(Ki,{children:[r.model&&!h.some(y=>y.id===r.model)&&o.jsxs(fr,{value:r.model,children:[r.model," · custom"]}),h.map(y=>o.jsxs(fr,{value:y.id,children:[y.label,y.isDefault?" · default":""]},y.id))]})]}):o.jsx(bt,{value:r.model??"",placeholder:"runtime default",onChange:y=>c({model:y.target.value||void 0})})}),o.jsx("div",{className:"label-caps pt-1 text-xs text-[var(--muted-foreground)]",children:"Execution budget"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(Pr,{label:"Timeout (s)",help:"End-to-end wall-clock cap.",children:o.jsx(Ru,{value:r.timeout,onChange:y=>c({timeout:y})})}),o.jsx(Pr,{label:"Max iterations",help:"claude only (→ --max-turns).",children:o.jsx(Ru,{value:r.maxIterations,onChange:y=>c({maxIterations:y})})}),o.jsx(Pr,{label:"Context window",help:"codex/traex token budget.",children:o.jsx(Ru,{value:r.contextWindow,onChange:y=>c({contextWindow:y})})}),o.jsx(Pr,{label:"Retry: max retries",children:o.jsx(Ru,{value:s.maxRetries,onChange:y=>d({maxRetries:y})})}),o.jsx(Pr,{label:"Retry: timeout/req (s)",children:o.jsx(Ru,{value:s.timeoutPerRequestSeconds,onChange:y=>d({timeoutPerRequestSeconds:y})})})]})]})}function OU({value:e,onChange:t}){var l;const r=e.osEnv??{},s=c=>t({...e,osEnv:{...r,...c}}),n=((l=e.executor)==null?void 0:l.runtime)??"codex";return o.jsx("div",{className:"grid gap-4",children:o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n==="claude"?o.jsx(Pr,{label:"Permission mode",help:"Claude's approval axis (--permission-mode).",children:o.jsx(Zu,{value:r.permissionMode,options:MU,onChange:c=>s({permissionMode:c})})}):o.jsxs(o.Fragment,{children:[o.jsx(Pr,{label:"Sandbox",children:o.jsx(Zu,{value:r.sandbox,options:AU,onChange:c=>s({sandbox:c})})}),o.jsx(Pr,{label:"Approval policy",help:"Codex's approval axis.",children:o.jsx(Zu,{value:r.approvalPolicy,options:TU,onChange:c=>s({approvalPolicy:c})})})]}),o.jsx(Pr,{label:"Full auto",children:o.jsxs("label",{className:"flex h-8 items-center gap-2 text-sm",children:[o.jsx("input",{type:"checkbox",className:"size-4",checked:!!r.fullAuto,onChange:c=>s({fullAuto:c.target.checked||void 0})}),o.jsx("span",{className:"text-[var(--muted-foreground)]",children:"enable"})]})})]})})}function BU({value:e,onChange:t}){const r=e.tools??{},s=n=>t({...e,tools:{...r,...n}});return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(Pr,{label:"Allowed tools",help:"claude only; codex/traex ignore.",children:o.jsx(o2,{items:r.allowed??[],placeholder:"ToolName",onChange:n=>s({allowed:n})})}),o.jsx(Pr,{label:"Disallowed tools",children:o.jsx(o2,{items:r.disallowed??[],placeholder:"ToolName",onChange:n=>s({disallowed:n})})}),o.jsx(Pr,{label:"MCP servers",help:"HTTP transport only.",children:o.jsx(IU,{rows:r.mcp??[],onChange:n=>s({mcp:n})})})]})}function PU({value:e,onChange:t}){const r=e.skills??[],[s,n]=p.useState(null);p.useEffect(()=>{pe.listSkills().then(n).catch(v=>{n([]),me.error(`Load skills failed: ${v.message}`)})},[]);const l=new Set(r.map(v=>v.name)),c=v=>{v.ref&&t({...e,skills:[...r,{...v.ref}]})},d=v=>t({...e,skills:r.filter(g=>g.name!==v)}),m=new Set((s??[]).map(v=>v.name)),h=r.map(v=>v.name).filter(v=>!m.has(v));return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(Pr,{label:"Skills",help:"Empty = no skills (hermetic). Each selection copies the skill's install recipe into the spec, so the agent installs its own skills wherever it runs.",children:s===null?o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Loading…"}):s.length===0&&h.length===0?o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"No skills installed yet — install one below."}):o.jsxs("div",{className:"grid gap-0.5 rounded-md border border-[var(--border)] p-1.5",children:[s.map(v=>o.jsxs("label",{className:"flex items-start gap-2 rounded-sm p-1.5 "+(v.ref?"cursor-pointer hover:bg-[var(--muted)]/50":"opacity-60"),children:[o.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",disabled:!v.ref,checked:l.has(v.name),onChange:g=>g.target.checked?c(v):d(v.name)}),o.jsxs("span",{className:"grid",children:[o.jsxs("span",{className:"font-mono text-sm",children:[v.name,!v.ref&&o.jsx("span",{className:"ml-1 text-xs text-[var(--warning)]",children:"(no install recipe — reinstall to make selectable)"})]}),o.jsx("span",{className:"line-clamp-2 text-xs text-[var(--muted-foreground)]",children:v.description})]})]},v.name)),h.map(v=>o.jsxs("label",{className:"flex items-center gap-2 rounded-sm p-1.5",children:[o.jsx("input",{type:"checkbox",className:"size-4 shrink-0",checked:!0,onChange:()=>d(v)}),o.jsxs("span",{className:"font-mono text-sm",children:[v," ",o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"(declared in the spec; installs at run time)"})]})]},v))]})}),o.jsx("div",{children:o.jsx(eT,{onInstalled:n,triggerVariant:"outline"})})]})}function yx(e){const{skills:t,...r}=e,s=bx(r)??{};return Array.isArray(t)&&t.length>0&&(s.skills=t),s}function bx(e){if(Array.isArray(e)){const t=e.map(bx).filter(r=>r!==void 0);return t.length>0?t:void 0}if(e&&typeof e=="object"){const t={};for(const[r,s]of Object.entries(e)){const n=bx(s);n!==void 0&&(t[r]=n)}return Object.keys(t).length>0?t:void 0}if(typeof e=="string"){const t=e.trim();return t===""?void 0:t}return e}function Pr({label:e,help:t,children:r}){return o.jsxs("div",{className:"grid content-start gap-1.5",children:[o.jsx(Xr,{children:e}),r,t&&o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:t})]})}const Vv="__default__";function Zu({value:e,options:t,onChange:r,disabled:s,required:n}){return o.jsxs(Cn,{value:e??(n?t[0]:Vv),disabled:s,onValueChange:l=>r(l===Vv?void 0:l),children:[o.jsx(Yi,{children:o.jsx(Gi,{})}),o.jsxs(Ki,{children:[!n&&o.jsx(fr,{value:Vv,children:o.jsx("span",{className:"text-[var(--muted-foreground)]",children:"Unset"})}),t.map(l=>o.jsx(fr,{value:l,children:l},l))]})]})}function Ru({value:e,onChange:t}){return o.jsx(bt,{type:"number",value:e??"",onChange:r=>{const s=r.target.value;t(s===""?void 0:Number(s))}})}function o2({items:e,placeholder:t,onChange:r}){const s=(l,c)=>r(e.map((d,m)=>m===l?c:d)),n=l=>r(e.filter((c,d)=>d!==l));return o.jsxs("div",{className:"grid gap-1.5",children:[e.map((l,c)=>o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(bt,{value:l,placeholder:t,onChange:d=>s(c,d.target.value)}),o.jsx(re,{variant:"ghost",size:"sm",onClick:()=>n(c),children:o.jsx(Ni,{})})]},c)),o.jsxs(re,{variant:"outline",size:"sm",className:"justify-self-start",onClick:()=>r([...e,""]),children:[o.jsx(Zr,{})," Add"]})]})}function IU({rows:e,onChange:t}){const r=p.useRef(0),[s,n]=p.useState(()=>e.map(()=>r.current++)),l=(m,h)=>t(e.map((v,g)=>g===m?{...v,...h}:v)),c=m=>{t(e.filter((h,v)=>v!==m)),n(s.filter((h,v)=>v!==m))},d=()=>{t([...e,{name:"",url:""}]),n([...s,r.current++])};return o.jsxs("div",{className:"grid gap-2",children:[e.map((m,h)=>o.jsxs("div",{className:"grid gap-2 rounded-md border border-[var(--border)] p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(bt,{className:"w-1/3",value:m.name??"",placeholder:"name",onChange:v=>l(h,{name:v.target.value})}),o.jsx("span",{className:"label-caps rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:"HTTP"}),o.jsx(bt,{value:m.url??"",placeholder:"https://server/mcp",onChange:v=>l(h,{url:v.target.value})}),o.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(h),children:o.jsx(Ni,{})})]}),o.jsx(zU,{headers:m.headers??{},onChange:v=>l(h,{headers:v})})]},s[h]??h)),o.jsxs(re,{variant:"outline",size:"sm",className:"justify-self-start",onClick:d,children:[o.jsx(Zr,{})," Add MCP server"]})]})}function zU({headers:e,onChange:t}){const[r,s]=p.useState(()=>Object.entries(e).map(([d,m])=>({k:d,v:m})));function n(d){s(d);const m={};for(const{k:h,v}of d){const g=h.trim();g&&(m[g]=v)}t(Object.keys(m).length>0?m:void 0)}const l=(d,m)=>n(r.map((h,v)=>v===d?{...h,...m}:h)),c=d=>n(r.filter((m,h)=>h!==d));return o.jsxs("div",{className:"grid gap-1.5",children:[r.map((d,m)=>o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(bt,{className:"w-1/3 font-mono text-xs",value:d.k,placeholder:"Header",onChange:h=>l(m,{k:h.target.value})}),o.jsx(bt,{className:"font-mono text-xs",value:d.v,placeholder:"value",onChange:h=>l(m,{v:h.target.value})}),o.jsx(re,{variant:"ghost",size:"sm",onClick:()=>c(m),children:o.jsx(Ni,{})})]},m)),o.jsxs(re,{variant:"ghost",size:"sm",className:"justify-self-start text-[var(--muted-foreground)]",onClick:()=>n([...r,{k:"",v:""}]),children:[o.jsx(Zr,{})," Add header"]})]})}function Mt({className:e,...t}){return o.jsx("div",{className:Pe("glass rounded-xl border border-[var(--border)] text-[var(--card-foreground)]",e),...t})}function Js({className:e,...t}){return o.jsx("div",{className:Pe("flex items-center justify-between gap-3 px-5 py-4 border-b border-[var(--border)]",e),...t})}function Is({className:e,...t}){return o.jsx("h3",{className:Pe("text-sm font-semibold tracking-tight",e),...t})}function Ir({className:e,...t}){return o.jsx("div",{className:Pe("p-5",e),...t})}const Gv=/^[a-z0-9][a-z0-9-]{0,63}$/,wx=[{id:"identity",label:"Identity",blurb:"Name, description, and system instructions."},{id:"model",label:"Model & Budget",blurb:"Runtime, model, reasoning effort, and execution limits."},{id:"environment",label:"Environment",blurb:"Sandbox and per-runtime approval behavior."},{id:"tools",label:"Tools & MCP",blurb:"Allowed/disallowed tools and MCP servers."},{id:"skills",label:"Skills",blurb:"Which skills this agent can use."},{id:"review",label:"Review",blurb:"Confirm and save."}];function $U({initial:e,onClose:t,onSaved:r}){const s=e.id==="",[n,l]=p.useState(e.id),[c,d]=p.useState(e.spec),[m,h]=p.useState("identity"),[v,g]=p.useState("form"),[x,y]=p.useState(()=>JSON.stringify(e.spec,null,2)),[w,S]=p.useState(!1);function k(E){if(E!==v)if(E==="json")y(JSON.stringify(c,null,2)),g("json");else try{d(JSON.parse(x)),g("form")}catch(N){me.error(`Invalid JSON: ${N.message}`)}}async function C(){const E=n.trim();if(s&&!Gv.test(E))return h("identity"),me.error(E?"Invalid agent id — use lowercase letters, digits, or hyphens":"Agent id is required");let N;if(v==="json")try{N=JSON.parse(x)}catch(R){return me.error(`Invalid JSON: ${R.message}`)}else N=c;S(!0);try{s?await pe.createAgent({...yx(N),id:n.trim()}):await pe.updateAgent(e.id,yx(N)),me.success(`Agent "${n}" saved`),await r()}catch(R){me.error(`Save failed: ${R.message}`)}finally{S(!1)}}return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsxs("button",{type:"button",onClick:t,className:"inline-flex w-fit items-center gap-1 text-xs text-[var(--muted-foreground)] hover:text-[var(--foreground)]",children:[o.jsx(tl,{className:"size-3.5"})," Agents"]}),o.jsx("h1",{className:"text-xl font-semibold",children:s?"New agent":`Edit "${e.id}"`})]}),o.jsx("div",{className:"inline-flex rounded-md border border-[var(--border)] p-0.5",children:["form","json"].map(E=>o.jsx("button",{type:"button",onClick:()=>k(E),className:Pe("rounded-sm px-3 py-1 text-sm capitalize transition-colors",v===E?"bg-[var(--primary)] text-[var(--primary-foreground)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:E},E))})]}),v==="json"?o.jsx(Ec,{value:x,onChange:E=>y(E.target.value),className:"min-h-[28rem] font-mono text-xs"}):o.jsxs("div",{className:"grid grid-cols-[12rem_1fr] gap-6",children:[o.jsx("nav",{className:"sticky top-6 grid h-fit gap-0.5",children:wx.map(E=>o.jsx("button",{type:"button",onClick:()=>h(E.id),className:Pe("rounded-md px-3 py-2 text-left text-sm transition-colors",m===E.id?"bg-[var(--muted)] font-medium text-[var(--foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50"),children:E.label},E.id))}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("h2",{className:"text-base font-semibold",children:l2(m).label}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:l2(m).blurb})]}),o.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-5",children:[m==="identity"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsxs(Xr,{children:["Agent ID ",o.jsx("span",{className:"text-[var(--destructive)]",children:"*"})]}),o.jsx(bt,{value:n,disabled:!s,onChange:E=>l(E.target.value),placeholder:"polly","aria-invalid":s&&n.trim()!==""&&!Gv.test(n.trim())}),s&&n.trim()!==""&&!Gv.test(n.trim())?o.jsx("p",{className:"text-xs text-[var(--destructive)]",children:"Use 1–64 lowercase letters, digits, or hyphens, starting with a letter or digit."}):o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["The config directory name. References (",o.jsx("code",{children:"/agent <id>"}),", bindings) use it; it can't change after creation."]})]}),o.jsx(DU,{value:c,onChange:d})]}),m==="model"&&o.jsx(LU,{value:c,onChange:d}),m==="environment"&&o.jsx(OU,{value:c,onChange:d}),m==="tools"&&o.jsx(BU,{value:c,onChange:d}),m==="skills"&&o.jsx(PU,{value:c,onChange:d}),m==="review"&&o.jsx(UU,{id:n,spec:c})]})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[o.jsx(re,{variant:"outline",onClick:t,children:"Cancel"}),o.jsx(re,{onClick:C,disabled:w,children:w?"Saving…":"Save"})]})]})}function l2(e){return wx.find(t=>t.id===e)??wx[0]}function UU({id:e,spec:t}){var n,l,c,d,m,h;const r=yx(t),s=[["Agent ID",e||"—"],["Display name",((n=t.name)==null?void 0:n.trim())||"—"],["Runtime",((l=t.executor)==null?void 0:l.runtime)??"default"],["Model",((d=(c=t.executor)==null?void 0:c.model)==null?void 0:d.trim())||"runtime default"],["Skills",HU(t.skills)],["MCP servers",String(((h=(m=t.tools)==null?void 0:m.mcp)==null?void 0:h.filter(v=>{var g;return(g=v.url)==null?void 0:g.trim()}).length)??0)]];return o.jsxs("div",{className:"grid gap-4",children:[o.jsx("dl",{className:"grid grid-cols-[10rem_1fr] gap-x-4 gap-y-2 text-sm",children:s.map(([v,g])=>o.jsxs("div",{className:"contents",children:[o.jsx("dt",{className:"text-[var(--muted-foreground)]",children:v}),o.jsx("dd",{className:"font-medium",children:g})]},v))}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{children:"Resulting spec"}),o.jsx("pre",{className:"max-h-72 overflow-auto rounded-md border border-[var(--border)] bg-[var(--muted)]/40 p-3 font-mono text-xs",children:JSON.stringify({id:e||void 0,...r},null,2)})]})]})}function HU(e){return e!=null&&e.length?`${e.length} declared`:"None"}const Yv=/^[a-z0-9][a-z0-9-]{0,63}$/;function FU({agents:e,onChange:t}){var P;const[r,s]=p.useState(((P=e[0])==null?void 0:P.id)??""),[n,l]=p.useState(null),[c,d]=p.useState(!1),[m,h]=p.useState(null),[v,g]=p.useState(!1),[x,y]=p.useState([]),[w,S]=p.useState([]),[k,C]=p.useState(!1);p.useEffect(()=>{var z;r&&e.some(B=>B.id===r)||s(((z=e[0])==null?void 0:z.id)??"")},[e,r]),p.useEffect(()=>{if(!r){l(null);return}let z=!1;return d(!0),pe.getAgent(r).then(B=>{z||l(B)}).catch(B=>!z&&me.error(`Load agent failed: ${B.message}`)).finally(()=>!z&&d(!1)),()=>{z=!0}},[r]);async function E(z=!1){C(!0);try{const[B,F]=await Promise.all([pe.listAgentRuntimeOptions(z),pe.listSkills()]);y(B),S(F)}catch(B){me.error(`Load local options failed: ${B.message}`)}finally{C(!1)}}async function N(z){try{const B=await pe.getAgent(z);delete B.id,h({id:z,spec:B})}catch(B){me.error(`Load failed: ${B.message}`)}}if(m)return o.jsx($U,{initial:m,onClose:()=>h(null),onSaved:async()=>{const z=m.id;h(null),await t(),s(z),l(await pe.getAgent(z))}});const R=new Set(e.map(z=>z.runtime).filter(Boolean)),T=e.reduce((z,B)=>z+(B.skillCount??0),0);return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold",children:"Agents"}),o.jsxs("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:["Local Agent profiles discovered from ",o.jsx("code",{children:"~/.rynx/agents"}),"."]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(re,{variant:"outline",onClick:()=>void t(),children:[o.jsx(yt,{})," Refresh"]}),o.jsxs(re,{onClick:()=>{g(!0),E()},children:[o.jsx(Zr,{})," New agent"]})]})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(Kv,{label:"agents",value:e.length,detail:"Local registered profiles"}),o.jsx(Kv,{label:"runtimes",value:R.size,detail:"Runtimes currently used"}),o.jsx(Kv,{label:"skill bindings",value:T,detail:"Explicit Skill references"})]}),o.jsxs("div",{className:"grid min-h-[620px] gap-4 lg:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs(Mt,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-4 py-3",children:[o.jsx("h2",{className:"text-sm font-semibold",children:"Agent list"}),o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:e.length})]}),o.jsxs("div",{className:"grid gap-2 p-2",children:[e.length===0&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"No local Agents registered yet."}),e.map(z=>o.jsxs("button",{type:"button",onClick:()=>s(z.id),className:Pe("flex w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors",r===z.id?"border-[var(--primary)] bg-[var(--primary)]/10":"border-[var(--border)] hover:bg-[var(--muted)]/45"),children:[o.jsx("span",{className:"mt-0.5 grid size-9 shrink-0 place-items-center rounded-md bg-violet-500/10 text-violet-600",children:o.jsx(Em,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate text-sm font-semibold",children:z.name??z.id}),r===z.id&&o.jsx(po,{className:"size-4 shrink-0 text-[var(--primary)]"})]}),z.description&&o.jsx("span",{className:"mt-1 block line-clamp-2 text-xs text-[var(--muted-foreground)]",children:z.description}),o.jsxs("span",{className:"mt-2 flex flex-wrap gap-1.5 text-[10px] text-[var(--muted-foreground)]",children:[o.jsx("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1",children:z.runtime??"default runtime"}),o.jsxs("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1",children:[z.skillCount??0," skills"]})]})]})]},z.id))]})]}),o.jsx(qU,{id:r,detail:n,loading:c,onEdit:()=>void N(r),onDeleted:t})]}),o.jsx(WU,{open:v,onOpenChange:g,runtimes:x,skills:w,loading:k,onRefresh:()=>E(!0),onCreated:async z=>{g(!1),await t(),s(z)}})]})}function qU({id:e,detail:t,loading:r,onEdit:s,onDeleted:n}){var c,d,m;if(!e)return o.jsx(Mt,{className:"p-6 text-sm text-[var(--muted-foreground)]",children:"Select an Agent to inspect its configuration."});if(r||!t)return o.jsx(Mt,{className:"p-6 text-sm text-[var(--muted-foreground)]",children:"Loading Agent configuration…"});const l=t.skills??[];return o.jsxs(Mt,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-5 py-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h2",{className:"text-lg font-semibold",children:t.name??e}),o.jsx("code",{className:"text-[10px] text-[var(--muted-foreground)]",children:e})]}),t.description&&o.jsx("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:t.description})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(re,{variant:"outline",size:"sm",onClick:s,children:[o.jsx(jE,{})," Edit configuration"]}),o.jsx(VU,{id:e,onChange:n})]})]}),o.jsxs("div",{className:"grid gap-6 p-5",children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(Xv,{label:"Runtime",value:((c=t.executor)==null?void 0:c.runtime)??"default"}),o.jsx(Xv,{label:"Model",value:((d=t.executor)==null?void 0:d.model)??"runtime default"}),o.jsx(Xv,{label:"Reasoning",value:((m=t.executor)==null?void 0:m.reasoningEffort)??"runtime default"})]}),o.jsxs("section",{children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"instructions"}),o.jsx("div",{className:"mt-2 whitespace-pre-wrap rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4 text-sm leading-6",children:t.instructions||"No inline instructions."})]}),o.jsxs("section",{children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:"skills"}),o.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:l.length===0?o.jsx("span",{className:"text-sm text-[var(--muted-foreground)]",children:"No Skills bound."}):l.map(h=>o.jsx("span",{className:"rounded-md bg-[var(--muted)] px-2 py-1 font-mono text-xs",children:h.name},h.name))})]})]})]})}function WU({open:e,onOpenChange:t,runtimes:r,skills:s,loading:n,onRefresh:l,onCreated:c}){const[d,m]=p.useState(""),[h,v]=p.useState(""),[g,x]=p.useState(!1),[y,w]=p.useState(""),[S,k]=p.useState("You are a helpful agent."),[C,E]=p.useState(""),[N,R]=p.useState(""),[T,P]=p.useState(""),[z,B]=p.useState(new Set),[F,Y]=p.useState(!1),q=r.filter(L=>L.available),$=r.find(L=>L.id===C),M=$==null?void 0:$.models.find(L=>L.id===N);p.useEffect(()=>{if(!e||C)return;const L=q[0];if(!L)return;const G=L.models.find(H=>H.isDefault)??L.models[0];E(L.id),R((G==null?void 0:G.id)??""),P((G==null?void 0:G.defaultReasoningEffort)??"")},[q,e,C,r]);function U(){m(""),v(""),x(!1),w(""),k("You are a helpful agent."),E(""),R(""),P(""),B(new Set)}function W(L){const G=r.find(D=>D.id===L),H=(G==null?void 0:G.models.find(D=>D.isDefault))??(G==null?void 0:G.models[0]);E(L),R((H==null?void 0:H.id)??""),P((H==null?void 0:H.defaultReasoningEffort)??"")}async function A(){const L=h.trim();if(!Yv.test(L)||!d.trim()||!S.trim()||!C)return;const G=s.filter(H=>z.has(H.name)&&H.ref).map(H=>({...H.ref}));Y(!0);try{await pe.createAgent({id:L,name:d.trim(),...y.trim()?{description:y.trim()}:{},instructions:S.trim(),executor:{runtime:C,...N?{model:N}:{},...T?{reasoningEffort:T}:{},timeout:1800,retry:{maxRetries:2}},osEnv:{sandbox:"danger-full-access",approvalPolicy:"never"},...G.length?{skills:G}:{}}),me.success(`Agent "${d.trim()}" created`),U(),await c(L)}catch(H){me.error(`Create Agent failed: ${H.message}`)}finally{Y(!1)}}const O=!!(Yv.test(h.trim())&&d.trim()&&S.trim()&&C);return o.jsx(sn,{open:e,onOpenChange:L=>{t(L),L||U()},children:o.jsxs(Di,{className:"max-h-[85vh] overflow-y-auto sm:max-w-2xl",children:[o.jsx(An,{children:o.jsx(Li,{children:"Create local Agent"})}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(Ho,{label:"Name",children:o.jsx(bt,{value:d,autoFocus:!0,onChange:L=>{const G=L.target.value;m(G),g||v(GU(G))}})}),o.jsx(Ho,{label:"Agent ID",children:o.jsx(bt,{value:h,onChange:L=>{x(!0),v(L.target.value)},"aria-invalid":!!h&&!Yv.test(h)})})]}),o.jsx(Ho,{label:"Description",children:o.jsx(bt,{value:y,onChange:L=>w(L.target.value)})}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(Ho,{label:"Runtime",children:o.jsxs(Cn,{value:C,onValueChange:W,disabled:n||r.length===0,children:[o.jsx(Yi,{children:o.jsx(Gi,{placeholder:"No runtime found"})}),o.jsx(Ki,{children:r.map(L=>o.jsxs(fr,{value:L.id,disabled:!L.available,children:[L.name,L.available?"":" · missing"]},L.id))})]})}),o.jsx(Ho,{label:"Model",children:o.jsxs(Cn,{value:N,onValueChange:L=>{var G;R(L),P(((G=$==null?void 0:$.models.find(H=>H.id===L))==null?void 0:G.defaultReasoningEffort)??"")},disabled:!$||$.models.length===0,children:[o.jsx(Yi,{children:o.jsx(Gi,{placeholder:"Runtime default"})}),o.jsx(Ki,{children:$==null?void 0:$.models.map(L=>o.jsxs(fr,{value:L.id,children:[L.label,L.isDefault?" · default":""]},L.id))})]})}),o.jsx(Ho,{label:"Reasoning",children:o.jsxs(Cn,{value:T||"__default__",onValueChange:L=>P(L==="__default__"?"":L),children:[o.jsx(Yi,{children:o.jsx(Gi,{})}),o.jsxs(Ki,{children:[o.jsx(fr,{value:"__default__",children:"Runtime default"}),M==null?void 0:M.reasoningOptions.map(L=>o.jsx(fr,{value:L.value,children:L.label},L.value))]})]})})]}),q.length===0&&!n&&o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-dashed border-[var(--border)] px-3 py-2 text-xs text-[var(--muted-foreground)]",children:["No local coding runtime was discovered.",o.jsxs(re,{size:"sm",variant:"outline",onClick:()=>void l(),children:[o.jsx(yt,{})," Scan"]})]}),o.jsx(Ho,{label:"Instructions",children:o.jsx(Ec,{className:"min-h-32",value:S,onChange:L=>k(L.target.value)})}),o.jsxs("fieldset",{className:"rounded-lg border border-[var(--border)] p-3",children:[o.jsx("legend",{className:"label-caps px-1 text-[10px] text-[var(--muted-foreground)]",children:"skills · optional"}),o.jsxs("div",{className:"grid max-h-40 gap-1 overflow-y-auto",children:[s.filter(L=>L.ref).length===0&&o.jsx("div",{className:"py-2 text-xs text-[var(--muted-foreground)]",children:"No selectable local Skills."}),s.filter(L=>L.ref).map(L=>o.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded-md px-2 py-2 hover:bg-[var(--muted)]/50",children:[o.jsx("input",{type:"checkbox",className:"mt-0.5 size-4",checked:z.has(L.name),onChange:()=>B(G=>{const H=new Set(G);return H.has(L.name)?H.delete(L.name):H.add(L.name),H})}),o.jsxs("span",{children:[o.jsx("span",{className:"block font-mono text-sm",children:L.name}),o.jsx("span",{className:"line-clamp-1 text-xs text-[var(--muted-foreground)]",children:L.description})]})]},L.name))]})]})]}),o.jsxs(ma,{children:[o.jsx(re,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(re,{disabled:!O||F,onClick:()=>void A(),children:F?"Creating…":"Create"})]})]})})}function VU({id:e,onChange:t}){return o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:o.jsx(da,{})})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:['Delete Agent "',e,'"?']}),o.jsx(si,{children:"Removes its local config directory. Existing Session snapshots are unaffected."})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:async()=>{try{await pe.deleteAgent(e),me.success(`Agent "${e}" deleted`),await t()}catch(r){me.error(`Delete failed: ${r.message}`)}},children:"Delete"})]})]})]})}function Kv({label:e,value:t,detail:r}){return o.jsxs(Mt,{className:"p-4",children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),o.jsx("div",{className:"mt-2 text-2xl font-semibold",children:t}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r})]})}function Xv({label:e,value:t}){return o.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/20 px-3 py-2",children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),o.jsx("div",{className:"mt-1 truncate text-sm",children:t})]})}function Ho({label:e,children:t}){return o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{children:e}),t]})}function GU(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,64)}const YU=BR("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",{variants:{variant:{default:"border-transparent bg-[var(--secondary)] text-[var(--secondary-foreground)]",success:"border-transparent bg-[var(--success)]/15 text-[var(--success)]",warning:"border-transparent bg-[var(--warning)]/15 text-[var(--warning)]",destructive:"border-transparent bg-[var(--destructive)]/15 text-[var(--destructive)]",outline:"text-[var(--muted-foreground)]"}},defaultVariants:{variant:"default"}});function Pt({className:e,variant:t,...r}){return o.jsx("span",{className:Pe(YU({variant:t}),e),...r})}async function tT(e,t){var r;if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{return await navigator.clipboard.writeText(e),"clipboard"}catch{}if(!t||typeof document>"u")return"unavailable";t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);try{if(typeof document.execCommand=="function"&&document.execCommand("copy"))return"selection"}catch{}return"selected"}const c2="127.0.0.1:9333";function KU({embedded:e=!1}={}){const t=fl(),r=p.useRef(null),[s,n]=p.useState(null),[l,c]=p.useState(null),[d,m]=p.useState("load"),h=p.useCallback(async()=>{if(!t){m(null),c("Chrome inspection is available only in the Rynx app.");return}m("load"),c(null);try{n(await t.getChromeInspectionStatus())}catch(w){c(w.message)}finally{m(null)}},[t]);p.useEffect(()=>{h()},[h]);async function v(w){if(t){m("save"),c(null);try{n(await t.configureChromeInspection(w))}catch(S){const k=S.message;c(k),me.error(`Could not update Chrome inspection: ${k}`)}finally{m(null)}}}async function g(){const w=await tT(c2,r.current);w==="clipboard"||w==="selection"?me.success("Address copied"):w==="selected"?me.info("Address selected — copy it manually"):me.error("Copy is unavailable")}const x=s==null?void 0:s.settings,y=d!==null;return o.jsxs("div",{id:e?"chrome-inspection":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Chrome inspection"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Inspect Rynx-managed browser pages with Chrome DevTools."})]}),o.jsxs(Mt,{"aria-busy":d!==null,children:[o.jsxs(Js,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(Is,{children:"DevTools discovery"}),s&&o.jsx(XU,{status:s})]}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Chrome connects to one local address and discovers the browsers you choose."})]}),o.jsxs(re,{variant:"outline",size:"sm",disabled:y,onClick:()=>void h(),children:[o.jsx(yt,{className:d==="load"?"animate-spin":""}),"Check"]})]}),o.jsxs(Ir,{className:"grid gap-5",children:[s&&x?o.jsxs(o.Fragment,{children:[o.jsx(ZU,{title:"Enable Chrome inspection",description:"Make the selected browser pages available to Chrome DevTools.",children:o.jsx(rp,{"aria-label":"Enable Chrome inspection",checked:x.enabled,disabled:y,onCheckedChange:w=>void v({...x,enabled:w})})}),o.jsx("div",{className:"h-px bg-[var(--border)]"}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Browsers to include"}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Only selected browser pages appear in Chrome."})]}),o.jsx(u2,{title:"This device",detail:"Browser pages managed by Rynx on this device",checked:x.includeLocal,disabled:y||!x.enabled,onChange:w=>void v({...x,includeLocal:w})}),s.remotes.map(w=>o.jsx(u2,{title:w.displayName,detail:JU(w.status),badge:w.status,checked:x.remoteDaemonIds.includes(w.daemonId),disabled:y||!x.enabled||w.status==="incompatible",onChange:S=>void v({...x,remoteDaemonIds:S?[...x.remoteDaemonIds,w.daemonId]:x.remoteDaemonIds.filter(k=>k!==w.daemonId)})},w.daemonId))]}),o.jsx("div",{className:"h-px bg-[var(--border)]"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Connect Chrome once"}),o.jsxs("p",{className:"mt-0.5 text-xs leading-5 text-[var(--muted-foreground)]",children:["Open ",o.jsx("span",{className:"font-mono",children:"chrome://inspect"}),", choose"," ",o.jsx("strong",{children:"Configure…"}),", then add this address."]})]}),o.jsxs("div",{className:"flex max-w-sm gap-2",children:[o.jsx(bt,{ref:r,value:c2,readOnly:!0,"aria-label":"Chrome inspection address",className:"font-mono"}),o.jsxs(re,{variant:"outline",onClick:()=>void g(),"aria-label":"Copy Chrome inspection address",children:[o.jsx(L0,{}),"Copy"]})]})]}),s.runtime.state==="error"&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] p-3 text-xs text-[var(--warning)]",children:[o.jsx(Ci,{className:"mt-0.5 size-4 shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:"Chrome inspection could not start"}),o.jsx("div",{className:"mt-0.5 text-[var(--foreground)]",children:s.runtime.error})]})]}),o.jsxs("div",{role:"note",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_30%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_6%,var(--background))] p-3 text-xs leading-5",children:[o.jsx(Ci,{className:"mt-0.5 size-4 shrink-0 text-[var(--destructive)]"}),o.jsx("span",{children:"Any process on this device can use this address to fully control every browser exposed here. Enable it only while you need DevTools."})]})]}):o.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[d==="load"&&o.jsx(Le,{className:"size-4 animate-spin"}),d==="load"?"Loading Chrome inspection…":"Chrome inspection settings are unavailable."]}),l&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(Ci,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:l})]})]})]})]})}function XU({status:e}){return e.runtime.state==="listening"?o.jsxs(Pt,{variant:"success",children:[o.jsx(Ar,{className:"size-3"}),"Listening"]}):e.runtime.state==="error"?o.jsx(Pt,{variant:"warning",children:"Needs attention"}):o.jsx(Pt,{variant:"outline",children:"Off"})}function ZU({title:e,description:t,children:r}){return o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:e}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:t})]}),r]})}function u2({title:e,detail:t,badge:r,checked:s,disabled:n,onChange:l}){return o.jsxs("label",{className:Pe("flex items-center gap-3 rounded-lg border border-[var(--border)] px-3 py-2.5",n&&"opacity-55"),children:[o.jsx("input",{type:"checkbox",checked:s,disabled:n,onChange:c=>l(c.target.checked),className:"size-4 accent-[var(--primary)]"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[e,r&&o.jsx(Pt,{variant:r==="ready"?"success":r==="offline"?"warning":"outline",children:QU(r)})]}),o.jsx("span",{className:"block text-xs text-[var(--muted-foreground)]",children:t})]})]})}function QU(e){return e==="ready"?"Ready":e==="offline"?"Offline":"Incompatible"}function JU(e){return e==="ready"?"Available now":e==="offline"?"Currently unavailable":"Update this Runtime before selecting it"}function eH({embedded:e=!1}={}){const t=fl(),[r,s]=p.useState(null),[n,l]=p.useState(null),[c,d]=p.useState("refresh"),m=p.useCallback(async()=>{if(t){d("refresh"),l(null);try{s(await t.getStatus())}catch(v){l(v.message)}finally{d(null)}}},[t]);p.useEffect(()=>{m()},[m]);async function h(v){if(t){d("permission"),l(null);try{await t.openSystemSettings(v),me.message("After granting access, return to Rynx and click Check again.")}catch(g){const x=g.message;l(x),me.error(`Could not open System Settings: ${x}`)}finally{d(null)}}}return o.jsxs("div",{id:e?"permissions":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer integration"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Review the macOS permissions for the separate Computer Use integration. Browser and Emulator automation stay in the bundled rynx-cli Skill."})]}),o.jsxs(Mt,{"aria-busy":c!==null,children:[o.jsxs(Js,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"macOS permissions"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This page checks readiness only. Permissions remain under your control in System Settings."})]}),o.jsxs(re,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void m(),children:[o.jsx(yt,{className:c==="refresh"?"animate-spin":""}),"Check"]})]}),o.jsxs(Ir,{className:"grid gap-3",children:[r?o.jsxs(o.Fragment,{children:[o.jsx(d2,{icon:o.jsx(F6,{className:"size-4"}),ready:r.permissions.accessibility==="granted",title:"Accessibility",description:h2(r.permissions.accessibility,"Granted and ready for a Computer Use provider."),action:r.permissions.accessibility!=="granted"?o.jsxs(re,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void h("accessibility"),children:[o.jsx(td,{}),"Open Settings"]}):void 0}),o.jsx(d2,{icon:o.jsx(m6,{className:"size-4"}),ready:r.permissions.screenRecording==="granted",title:"Screen Recording",description:h2(r.permissions.screenRecording,"Granted and ready for a Computer Use provider."),action:r.permissions.screenRecording!=="granted"?o.jsxs(re,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void h("screen-recording"),children:[o.jsx(td,{}),"Open Settings"]}):void 0})]}):o.jsxs("div",{className:"flex min-h-40 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[c==="refresh"&&o.jsx(Le,{className:"size-4 animate-spin"}),c==="refresh"?"Checking integrations…":"Integration status is unavailable."]}),n&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(Sc,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})]})]})}function d2({icon:e,ready:t,title:r,description:s,action:n}){return o.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[o.jsx("span",{className:t?"grid size-9 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-9 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:t?o.jsx(Ar,{className:"size-4"}):e}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h2",{className:"text-sm font-medium",children:r}),o.jsx(Pt,{variant:t?"success":"warning",children:t?"Ready":"Needs access"})]}),o.jsx("p",{className:"mt-1 break-words text-xs leading-5 text-[var(--muted-foreground)]",children:s})]}),n&&o.jsx("div",{className:"sm:justify-self-end",children:n})]})}function h2(e,t){switch(e){case"granted":return t;case"not-granted":return"Not granted. Open System Settings to allow access.";case"unknown":return"Rynx could not determine this permission. Open System Settings to verify it."}}function tH(){return o.jsxs("div",{className:"grid max-w-3xl gap-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Computer Use"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Configure macOS permissions and Chrome DevTools access for computer automation."})]}),o.jsx(eH,{embedded:!0}),o.jsx(KU,{embedded:!0})]})}const rH=700,sH=250,f2=33333,Mf=new Uint8Array([0,0,0,1]);function iH(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}function Zv(e,t){for(let r=t;r<=e.length-3;r+=1)if(!(e[r]!==0||e[r+1]!==0)){if(e[r+2]===1)return{index:r,length:3};if(r<=e.length-4&&e[r+2]===0&&e[r+3]===1)return{index:r,length:4}}return null}function m2(e,t){const r=iH(e,t),s=Zv(r,0);if(!s)return{nals:[],pending:r.slice(Math.max(0,r.length-4))};const n=[];let l=s.index,c=s.index+s.length,d=Zv(r,c);for(;d;)d.index>c&&n.push(r.slice(c,d.index)),l=d.index,c=d.index+d.length,d=Zv(r,c);return{nals:n,pending:r.slice(l)}}function np(e){return e[0]&31}function nH(e){if(np(e)!==7||e.length<4)return null;const t=r=>r.toString(16).padStart(2,"0").toUpperCase();return`avc1.${t(e[1])}${t(e[2])}${t(e[3])}`}function aH(e){const t=e.reduce((n,l)=>n+Mf.length+l.length,0),r=new Uint8Array(t);let s=0;for(const n of e)r.set(Mf,s),s+=Mf.length,r.set(n,s),s+=n.length;return r}function p2(e){const t=np(e);return t===1||t===5}function oH(e){return e.some(t=>np(t)===5)}function Qv(e,t,r,s){(e.width!==r||e.height!==s)&&(e.width=r,e.height=s);const n=e.getContext("2d");n&&n.drawImage(t,0,0,r,s)}function lH(e,t){return new Promise((r,s)=>{if(t.aborted){s(t.reason);return}const n=window.setTimeout(r,e);t.addEventListener("abort",()=>{window.clearTimeout(n),s(t.reason)},{once:!0})})}function g2(e){return e instanceof Error?e.message:String(e)}function cH(e){return e instanceof DOMException&&e.name==="AbortError"}function uH({device:e,alt:t,mediaRef:r,onFrameSize:s}){const n=p.useRef(null),l=p.useRef(!1),c=p.useRef(!1),d=p.useRef(null),[m,h]=p.useState("video"),[v,g]=p.useState(!1),[x,y]=p.useState("Loading preview..."),w=p.useCallback(C=>{n.current=C,r==null||r(C)},[r]),S=p.useCallback(()=>{l.current||(l.current=!0,g(!0),y(""))},[]),k=p.useCallback((C,E)=>{const N=d.current;(N==null?void 0:N.width)===C&&N.height===E||(d.current={width:C,height:E},s==null||s(C,E))},[s]);return p.useEffect(()=>{l.current=!1,c.current=!1,d.current=null,g(!1),y("Loading preview..."),h("video")},[e]),p.useEffect(()=>{if(m!=="video"||l.current)return;let C=!1;return(async()=>{try{const N=await pe.emulatorFrameBlob(e);if(C||l.current)return;const R=await createImageBitmap(N);try{const T=n.current;T&&!l.current&&(Qv(T,R,R.width,R.height),k(R.width,R.height),S())}finally{R.close()}}catch{}})(),()=>{C=!0}},[e,S,m,k]),p.useEffect(()=>{if(m!=="video")return;if(!("VideoDecoder"in window)||!("EncodedVideoChunk"in window)){y("Video decoder unavailable"),h("fallback");return}const C=new AbortController,E=R=>{const T=n.current;try{if(T){const P=R.displayWidth||R.codedWidth,z=R.displayHeight||R.codedHeight;Qv(T,R,P,z),k(P,z),c.current=!0,S()}}finally{R.close()}};return(async()=>{for(;!C.signal.aborted;){let R=null,T=null,P=new Uint8Array,z=[],B=!1,F=0,Y="avc1.42E01F";const q=async()=>{if(R)return R;const U={codec:Y,optimizeForLatency:!0,avc:{format:"annexb"}};if(!(await VideoDecoder.isConfigSupported(U)).supported)throw new Error(`Unsupported Android video codec: ${Y}`);return R=new VideoDecoder({output:E,error:A=>{y(A.message)}}),R.configure(U),R},$=async()=>{if(!B){z=[];return}const U=await q(),W=oH(z),A=aH(z),O=F;F+=f2,z=[],B=!1,!(U.decodeQueueSize>2&&!W)&&U.decode(new EncodedVideoChunk({type:W?"key":"delta",timestamp:O,duration:f2,data:A}))},M=async U=>{const W=nH(U);W&&(Y=W),(np(U)===9||p2(U))&&B&&await $(),z.push(U),p2(U)&&(B=!0)};try{const U=await fetch(pe.emulatorVideoStreamUrl(e),{cache:"no-store",signal:C.signal});if(!U.ok||!U.body)throw new Error(`Android video stream failed: ${U.status}`);for(T=U.body.getReader();;){const{done:A,value:O}=await T.read();if(A)break;const L=m2(P,O);P=L.pending;for(const G of L.nals)await M(G)}const W=m2(P,Mf);for(const A of W.nals)await M(A);await $(),(R==null?void 0:R.state)==="configured"&&await R.flush()}catch(U){if(C.signal.aborted||cH(U))break;if(y(g2(U)),!c.current){h("fallback");break}}finally{try{T==null||T.releaseLock()}catch{}(R==null?void 0:R.state)!=="closed"&&(R==null||R.close())}C.signal.aborted||await lH(sH,C.signal).catch(()=>{})}})(),()=>{C.abort()}},[e,S,m,k]),p.useEffect(()=>{if(m!=="fallback")return;let C=!1,E;const N=async()=>{try{const R=await pe.emulatorFrameBlob(e);if(C)return;const T=await createImageBitmap(R);try{const P=n.current;P&&(Qv(P,T,T.width,T.height),k(T.width,T.height),S())}finally{T.close()}}catch(R){C||y(g2(R))}finally{C||(E=window.setTimeout(N,rH))}};return N(),()=>{C=!0,E&&window.clearTimeout(E)}},[e,S,m,k]),o.jsxs("div",{className:"relative h-full w-full",children:[o.jsx("canvas",{ref:w,"aria-label":t,width:720,height:1520,className:"pointer-events-none h-full w-full select-none object-contain"}),!v&&o.jsx("div",{className:"pointer-events-none absolute inset-0 grid place-items-center px-5 text-center text-sm text-zinc-400",children:x})]})}const v2=8,dH=.012,hH=1500,fH=35,mH=260,pH=40,gH=3,vH=5e3,_H=750;function _2(e){return[e.backend,e.isDefault?"default":void 0,e.detail].filter(Boolean).join(" · ")}function x2(e,t,r){return Math.max(t,Math.min(r,e))}function y2(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function xH(e){const t=e.getBoundingClientRect();if(t.width<=0||t.height<=0)return null;const r="naturalWidth"in e?e.naturalWidth||t.width:e.width||t.width,s="naturalHeight"in e?e.naturalHeight||t.height:e.height||t.height;if(r<=0||s<=0)return t;const n=r/s;if(t.width/t.height>n){const d=t.height*n;return new DOMRect(t.left+(t.width-d)/2,t.top,d,t.height)}const c=t.width/n;return new DOMRect(t.left,t.top+(t.height-c)/2,t.width,c)}function Jv(e,t,r){if(!e)return null;const s=xH(e);if(!s)return null;const n=(t.clientX-s.left)/s.width,l=(t.clientY-s.top)/s.height;return!r&&(n<0||n>1||l<0||l>1)?null:{x:x2(n,0,1),y:x2(l,0,1)}}function yH(e){return new Promise(t=>setTimeout(t,e))}function bH(e){const t=new TextEncoder().encode(JSON.stringify(e)),r=new Uint8Array(1+t.length);return r[0]=gH,r.set(t,1),r.buffer}function wH(){const[e,t]=p.useState([]),[r,s]=p.useState(null),[n,l]=p.useState(!0),[c,d]=p.useState(null),[m,h]=p.useState(null),[v,g]=p.useState(!1),[x,y]=p.useState(null),[w,S]=p.useState(null),[k,C]=p.useState(!1),[E,N]=p.useState(0),R=p.useRef(null),T=p.useRef(null),P=p.useRef(null),z=p.useRef(null),B=p.useRef(null),F=p.useRef(null),Y=p.useCallback(async()=>{l(!0);try{const[te,ie]=await Promise.all([pe.emulatorDevices(),pe.activeEmulator()]);t(te),s(ie)}catch(te){me.error(`Failed to load emulator: ${te.message}`)}finally{l(!1)}},[]);p.useEffect(()=>{Y()},[Y]),p.useEffect(()=>()=>{P.current!==null&&window.clearTimeout(P.current),T.current!==null&&window.clearTimeout(T.current)},[]),p.useEffect(()=>()=>{var ie;const te=(ie=z.current)==null?void 0:ie.socket;z.current=null,te&&te.readyState!==WebSocket.CLOSED&&te.close()},[r==null?void 0:r.wsUrl]),p.useEffect(()=>{var te;if((r==null?void 0:r.backend)!=="android"){const ie=(te=B.current)==null?void 0:te.socket;B.current=null,ie&&ie.readyState!==WebSocket.CLOSED&&ie.close();return}return se(r.deviceUdid).catch(()=>{}),()=>{var ke;const ie=(ke=B.current)==null?void 0:ke.socket;B.current=null,ie&&ie.readyState!==WebSocket.CLOSED&&ie.close()}},[r==null?void 0:r.backend,r==null?void 0:r.deviceUdid]);const q=(r==null?void 0:r.streamUrl)??null,$=q&&E>0?`${q}${q.includes("?")?"&":"?"}rynx_preview_retry=${E}`:q,M=(r==null?void 0:r.backend)==="android"&&!r.streamUrl,U=!!(q||M),W=w===null?void 0:{aspectRatio:w,width:`min(100%, calc(100cqh * ${w}))`},A=p.useCallback((te,ie)=>{if(!Number.isFinite(te)||!Number.isFinite(ie)||te<=0||ie<=0)return;const ke=te/ie;S(Ke=>Ke!==null&&Math.abs(Ke-ke)<1e-4?Ke:ke)},[]),O=p.useCallback(()=>{T.current!==null&&(window.clearTimeout(T.current),T.current=null)},[]),L=p.useCallback((te,ie)=>{O(),A(te,ie),C(!0)},[O,A]),G=p.useCallback(()=>{C(!1),T.current===null&&(T.current=window.setTimeout(()=>{T.current=null,N(te=>te+1)},_H))},[]);p.useEffect(()=>{if(O(),S(null),C(!1),N(0),!q)return;const te=()=>{const ke=R.current;ke instanceof HTMLImageElement&&ke.naturalWidth>0&&ke.naturalHeight>0&&L(ke.naturalWidth,ke.naturalHeight)};te();const ie=window.setInterval(te,500);return()=>window.clearInterval(ie)},[O,r==null?void 0:r.attachedAt,r==null?void 0:r.deviceUdid,L,q]),p.useEffect(()=>{if(!q||k)return;const te=window.setTimeout(G,vH);return()=>window.clearTimeout(te)},[E,k,q,G]);async function H(te){if(r){y("home");try{await pe.buttonEmulator(te,r.deviceUdid)}catch(ie){me.error(`${te==="appswitch"?"App switcher":"Home"} failed: ${ie.message}`)}finally{y(null)}}}function D(){if(!(!r||x)){if(P.current!==null){window.clearTimeout(P.current),P.current=null,H("appswitch");return}P.current=window.setTimeout(()=>{P.current=null,H("home")},mH)}}async function V(te,ie){const ke=(r==null?void 0:r.deviceUdid)===te;P.current!==null&&(window.clearTimeout(P.current),P.current=null),h(te),ke&&y("shutdown");try{await pe.shutdownEmulator(te),ke&&s(null),me.success(`Shutdown ${ie}`),Y()}catch(Ke){me.error(`Shutdown failed: ${Ke.message}`)}finally{h(null),ke&&y(null)}}async function X(te){d(te.id);try{const ie=await pe.attachEmulator(te.id);s(ie),me.success(`Attached ${ie.deviceName??ie.deviceUdid}`),Y()}catch(ie){me.error(`Attach failed: ${ie.message}`)}finally{d(null)}}function J(te){var _e;const ie=z.current;if((ie==null?void 0:ie.url)===te){if(((_e=ie.socket)==null?void 0:_e.readyState)===WebSocket.OPEN)return Promise.resolve(ie.socket);if(ie.connecting)return ie.connecting}else ie!=null&&ie.socket&&ie.socket.readyState!==WebSocket.CLOSED&&ie.socket.close();const ke={url:te,socket:null,connecting:null},Ke=new Promise((ye,Ie)=>{const ze=new WebSocket(te),pt=window.setTimeout(()=>{ze.close(),Ie(new Error("Timed out connecting to emulator gesture stream."))},1500),rt=()=>window.clearTimeout(pt);ze.binaryType="arraybuffer",ze.addEventListener("open",()=>{rt(),ke.socket=ze,ke.connecting=null,ye(ze)},{once:!0}),ze.addEventListener("error",()=>{rt(),ke.connecting=null,Ie(new Error("Failed to connect to emulator gesture stream."))},{once:!0}),ze.addEventListener("close",()=>{var $e;(($e=z.current)==null?void 0:$e.socket)===ze&&(z.current=null)})});return ke.connecting=Ke,z.current=ke,Ke}function se(te){var _e;const ie=B.current;if((ie==null?void 0:ie.device)===te){if(((_e=ie.socket)==null?void 0:_e.readyState)===WebSocket.OPEN)return Promise.resolve(ie.socket);if(ie.connecting)return ie.connecting}else ie!=null&&ie.socket&&ie.socket.readyState!==WebSocket.CLOSED&&ie.socket.close();const ke={device:te,socket:null,connecting:null},Ke=new Promise((ye,Ie)=>{const ze=new WebSocket(aU(te));let pt=!1;const rt=window.setTimeout(()=>{pt||(pt=!0,ze.close(),Ie(new Error("Timed out connecting to Android touch stream.")))},hH),$e=()=>window.clearTimeout(rt);ze.addEventListener("message",He=>{if(!pt&&typeof He.data=="string")try{const Nt=JSON.parse(He.data);Nt.t==="opened"?(pt=!0,$e(),ke.socket=ze,ke.connecting=null,ye(ze)):Nt.t==="error"&&(pt=!0,$e(),ke.connecting=null,Ie(new Error(Nt.message??"Android touch stream failed.")))}catch{}}),ze.addEventListener("error",()=>{pt||(pt=!0,$e(),ke.connecting=null,Ie(new Error("Failed to connect to Android touch stream.")))},{once:!0}),ze.addEventListener("close",()=>{var He;$e(),ke.connecting=null,pt||(pt=!0,Ie(new Error("Android touch stream closed before it was ready."))),((He=B.current)==null?void 0:He.socket)===ze&&(B.current=null)})});return ke.connecting=Ke,B.current=ke,Ke}async function de(te,ie){if(te.backend==="android"){if(te.liveFailed)return!1;try{return(await se(te.device)).send(JSON.stringify(ie)),te.sentLiveFrames+=1,!0}catch(ke){return te.liveFailed=!0,te.sentLiveFrames>0&&me.error(`Android touch stream failed: ${ke.message}`),!1}}if(!te.wsUrl||te.liveFailed)return!1;try{return(await J(te.wsUrl)).send(bH(ie)),te.sentLiveFrames+=1,!0}catch(ke){return te.liveFailed=!0,te.sentLiveFrames>0&&me.error(`Gesture stream failed: ${ke.message}`),!1}}function Z(te,ie){pe.gestureEmulator([{type:"begin",x:te.x,y:te.y}],ie).catch(ke=>{me.error(`Tap failed: ${ke.message}`)})}function ce(te,ie){pe.gestureEmulator(te,ie).catch(ke=>{me.error(`Gesture failed: ${ke.message}`)})}function le(te){if(!r||!U||!te.isPrimary||te.pointerType==="mouse"&&te.button!==0)return;const ie=Jv(R.current,te,!1);ie&&(te.preventDefault(),te.currentTarget.setPointerCapture(te.pointerId),F.current={backend:r.backend,pointerId:te.pointerId,device:r.deviceUdid,wsUrl:r.backend==="ios"?r.wsUrl:void 0,startClientX:te.clientX,startClientY:te.clientY,lastPoint:ie,moved:!1,liveFailed:!1,sentLiveFrames:0,points:[{type:"begin",x:ie.x,y:ie.y}]},de(F.current,{type:"begin",x:ie.x,y:ie.y}),g(!0))}function we(te){const ie=F.current;if(!ie||ie.pointerId!==te.pointerId)return;const ke=Jv(R.current,te,!0);if(!ke)return;te.preventDefault();const Ke=Math.hypot(te.clientX-ie.startClientX,te.clientY-ie.startClientY)>v2,_e=y2(ke,ie.lastPoint)>dH;if(ie.lastPoint=ke,Ke&&(_e||!ie.moved)){ie.moved=!0;const ye={type:"move",x:ke.x,y:ke.y};ie.points.push(ye),de(ie,ye)}}async function Ee(te){const ie=F.current;if(!ie||ie.pointerId!==te.pointerId)return;te.preventDefault();const ke=Jv(R.current,te,!0)??ie.lastPoint,Ke=Math.hypot(te.clientX-ie.startClientX,te.clientY-ie.startClientY)>v2;F.current=null,g(!1);try{te.currentTarget.releasePointerCapture(te.pointerId)}catch{}const _e={type:"end",x:ke.x,y:ke.y};if((ie.backend==="android"||ie.wsUrl)&&!ie.liveFailed&&(!ie.moved&&!Ke&&await yH(ie.backend==="android"?fH:pH),await de(ie,_e)||ie.sentLiveFrames>0))return;if(!ie.moved&&!Ke){Z(ke,ie.device);return}const ye=[...ie.points],Ie=ye[ye.length-1];Ie&&y2(Ie,ke)<=.001?ye[ye.length-1]=_e:ye.push(_e),ce(ye,ie.device)}function Re(te){const ie=F.current;!ie||ie.pointerId!==te.pointerId||(F.current=null,g(!1),(ie.backend==="android"||ie.wsUrl)&&!ie.liveFailed&&de(ie,{type:"end",x:ie.lastPoint.x,y:ie.lastPoint.y}))}return o.jsxs("div",{className:"grid h-full min-h-0 gap-3 p-3 sm:p-4 lg:grid-cols-[minmax(0,360px)_minmax(360px,1fr)]",children:[o.jsxs(Mt,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[o.jsxs(Js,{className:"px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs(Is,{className:"flex items-center gap-2",children:[o.jsx(RE,{className:"size-4"}),"Preview"]}),o.jsx("div",{className:"label-caps mt-1 truncate text-[10px] text-[var(--muted-foreground)]",children:r?`This device · ${r.backend} · ${r.deviceName??r.deviceUdid}`:"This device · not attached"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[o.jsx(re,{variant:"outline",size:"icon",className:"size-8",onClick:D,disabled:!r||x!==null,"aria-label":"Home or app switcher",title:"Home · double-click for app switcher",children:o.jsx(kE,{className:Pe(x==="home"&&"animate-pulse")})}),o.jsx(re,{variant:"outline",size:"icon",className:"size-8",onClick:()=>{r&&V(r.deviceUdid,r.deviceName??r.deviceUdid)},disabled:!r||x!==null||m!==null,"aria-label":"Shutdown emulator",title:"Shutdown",children:o.jsx(V_,{className:Pe(x==="shutdown"&&"animate-pulse")})}),o.jsx(re,{variant:"outline",size:"icon",className:"size-8",onClick:()=>void Y(),disabled:n,"aria-label":"Refresh emulator",title:"Refresh",children:o.jsx(yt,{className:Pe(n&&"animate-spin")})})]})]}),o.jsxs(Ir,{className:"relative grid min-h-0 flex-1 place-items-center p-2 sm:p-3",style:{containerType:"size"},"aria-busy":U&&!k,children:[U?o.jsx("div",{className:Pe("relative grid touch-none select-none place-items-center overflow-hidden bg-black",k?"max-h-full max-w-full rounded-md border border-[var(--border)] shadow-sm":"pointer-events-none absolute inset-0",k&&(v?"cursor-grabbing":"cursor-crosshair")),style:k?W:void 0,onPointerDown:le,onPointerMove:we,onPointerUp:Ee,onPointerCancel:Re,children:q?o.jsx("img",{ref:te=>{R.current=te},src:$??void 0,alt:(r==null?void 0:r.deviceName)??(r==null?void 0:r.deviceUdid),className:"pointer-events-none absolute inset-0 h-full w-full select-none object-contain",onLoad:te=>{L(te.currentTarget.naturalWidth,te.currentTarget.naturalHeight)},onError:G,draggable:!1},`${r==null?void 0:r.deviceUdid}:${r==null?void 0:r.attachedAt}:${E}`):r&&M?o.jsx(uH,{device:r.deviceUdid,alt:r.deviceName??r.deviceUdid,mediaRef:te=>{R.current=te},onFrameSize:L},r.deviceUdid):null}):o.jsx("div",{className:"grid h-full w-full place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:r?`${r.backend} preview unavailable`:"No active emulator"}),U&&!k&&o.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 grid place-items-center bg-[var(--background)] text-[var(--muted-foreground)]",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"grid place-items-center gap-2 text-xs",children:[o.jsx(yt,{className:"size-4 animate-spin text-[var(--primary)]"}),o.jsx("span",{children:"Loading preview…"})]})})]})]}),o.jsxs(Mt,{className:"flex h-full min-h-0 flex-col overflow-hidden p-0",children:[o.jsxs(Js,{children:[o.jsxs(Is,{className:"flex items-center gap-2",children:[o.jsx(mc,{className:"size-4"}),"Devices"]}),o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e.length})]}),o.jsx(Ir,{className:"min-h-0 flex-1 p-0",children:e.length===0?o.jsx("div",{className:"px-5 py-8 text-sm text-[var(--muted-foreground)]",children:n?"Loading...":"No devices"}):o.jsx(En,{className:"h-full min-h-0",children:o.jsx("ul",{className:"grid grid-cols-1 content-start gap-2 p-3 sm:grid-cols-2 2xl:grid-cols-3",children:e.map(te=>{const ie=(r==null?void 0:r.deviceUdid)===te.id,ke=c===te.id,Ke=m===te.id;return o.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border border-[var(--border)] bg-[var(--background)] px-3 py-2.5",children:[o.jsx(mc,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:te.name}),o.jsxs(Pt,{variant:te.state==="booted"?"success":te.state==="shutdown"?"outline":"warning",className:"h-5 shrink-0 gap-1 px-2 py-0 font-mono text-[9px] uppercase",children:[o.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),te.state]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] uppercase text-[var(--muted-foreground)]",title:_2(te),children:_2(te)})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(re,{size:"xs",variant:ie?"outline":"default",onClick:()=>void X(te),disabled:ke||m!==null,children:ke?"Attaching…":ie?"Reattach":"Attach"}),te.state==="booted"&&o.jsx(re,{size:"icon-xs",variant:"destructive",onClick:()=>void V(te.id,te.name),disabled:c!==null||m!==null,"aria-label":`Shutdown ${te.name}`,title:`Shutdown ${te.name}`,children:o.jsx(V_,{className:Pe(Ke&&"animate-pulse")})})]})]},`${te.backend}:${te.id}`)})})})})]})]})}function SH({embedded:e=!1}={}){const t=fl(),[r,s]=p.useState(null),[n,l]=p.useState(null),[c,d]=p.useState(!1),m=p.useCallback(async()=>{if(t){d(!0),l(null);try{s(await t.getStatus())}catch(g){l(g.message)}finally{d(!1)}}},[t]);p.useEffect(()=>{m()},[m]);async function h(g){if(!(!t||g===(r==null?void 0:r.runtime.lifecycleMode))){d(!0),l(null);try{s(await t.setDaemonLifecycleMode(g)),me.success(g==="resident"?"Runtime will stay available after Rynx quits":"Runtime will now follow the Rynx app lifecycle")}catch(x){const y=x.message;l(y),me.error(`Could not change Runtime mode: ${y}`)}finally{d(!1)}}}async function v(){if(t){d(!0),l(null);try{s(await t.restartDaemon()),me.success("Local Runtime restarted")}catch(g){const x=g.message;l(x),me.error(`Could not restart Runtime: ${x}`)}finally{d(!1)}}}return o.jsxs("div",{id:e?"runtime":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Daemon"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Choose whether the local Runtime follows the Desktop app or stays available in the background."})]}),o.jsxs(Mt,{"aria-busy":c,children:[o.jsxs(Js,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"Runtime lifecycle"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"This setting applies to the Runtime bundled with Rynx."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(re,{variant:"outline",size:"sm",disabled:c,onClick:()=>void m(),children:[o.jsx(yt,{className:c?"animate-spin":""}),"Check"]}),o.jsxs(re,{variant:"outline",size:"sm",disabled:c,onClick:()=>void v(),children:[o.jsx(yt,{}),"Restart"]})]})]}),o.jsxs(Ir,{className:"grid gap-5",children:[r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[o.jsx("span",{className:r.runtime.ready?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:o.jsx(Nm,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"text-sm font-medium",children:"Runtime status"}),o.jsx(Pt,{variant:r.runtime.ready?"success":"warning",children:CH(r.runtime.state)}),o.jsx(Pt,{variant:"outline",children:r.runtime.managedBy==="app"?"Managed by app":r.runtime.managedBy==="external"?"External":"Not managed"})]}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:r.runtime.detail??kH(r)})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(Xr,{htmlFor:"daemon-lifecycle-mode",children:"Lifecycle"}),o.jsxs(uj,{id:"daemon-lifecycle-mode",value:r.runtime.lifecycleMode,disabled:c,className:"max-w-sm",onChange:g=>void h(g.target.value),children:[o.jsx("option",{value:"follow-app",children:"Follow Rynx app"}),o.jsx("option",{value:"resident",children:"Stay available in background"})]}),o.jsx("p",{className:"max-w-2xl text-xs leading-5 text-[var(--muted-foreground)]",children:r.runtime.lifecycleMode==="follow-app"?"The Runtime and its embedded Browser Host start with Rynx and stop when the app fully quits. Closing a window does not quit the app.":"The Runtime and its embedded Browser Host keep running when the app quits, so Terminals, agents, and Session browsers remain available."})]})]}):o.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[c&&o.jsx(Le,{className:"size-4 animate-spin"}),c?"Checking Runtime…":"Runtime status is unavailable."]}),n&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(Sc,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})]})]})}function CH(e){switch(e){case"starting":return"Starting";case"running":return"Running";case"stopped":return"Stopped";case"busy":return"Busy";case"error":return"Error"}}function kH(e){const t=[e.runtime.version?`Version ${e.runtime.version}`:null,e.runtime.pid?`PID ${e.runtime.pid}`:null].filter(Boolean);return t.length>0?t.join(" · "):"No additional Runtime details."}function EH({embedded:e=!1}={}){const t=fl(),[r,s]=p.useState(null),[n,l]=p.useState(null),[c,d]=p.useState("refresh"),m=p.useCallback(async(S=!1)=>{if(t){d("refresh"),l(null);try{s(await t.getStatus(S))}catch(k){l(k.message)}finally{d(null)}}},[t]);p.useEffect(()=>{m()},[m]);async function h(S){if(t){d("install"),l(null);try{s(await t.installCli(S)),me.success("Terminal command installed")}catch(k){const C=k.message;l(C),me.error(`Could not install the Terminal command: ${C}`);try{s(await t.getStatus(!0))}catch{}}finally{d(null)}}}async function v(S){if(t){d("remove"),l(null);try{s(await t.removeCli(S)),me.success("Terminal command removed")}catch(k){const C=k.message;l(C),me.error(`Could not remove the Terminal command: ${C}`);try{s(await t.getStatus(!0))}catch{}}finally{d(null)}}}const g=r==null?void 0:r.globalCli,x=(g==null?void 0:g.state)==="installed",y=(g==null?void 0:g.state)==="development",w=(g==null?void 0:g.state)==="installed"&&g.canInstall&&!!(g.path&&g.target&&g.path!==g.target);return o.jsxs("div",{id:e?"terminal-command":void 0,className:e?"grid scroll-mt-6 gap-5":"grid max-w-3xl gap-5",children:[!e&&o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Terminal command"}),o.jsxs("p",{className:"text-sm text-[var(--muted-foreground)]",children:["Install or remove the ",o.jsx("code",{className:"font-mono",children:"rynx"})," command used in Terminal."]})]}),o.jsxs(Mt,{"aria-busy":c!==null,children:[o.jsxs(Js,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"Shell access"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Removing the command does not uninstall Rynx or delete its data."})]}),o.jsxs(re,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void m(!0),children:[o.jsx(yt,{className:c==="refresh"?"animate-spin":""}),"Check"]})]}),o.jsxs(Ir,{className:"grid gap-3",children:[g?o.jsxs("div",{className:"grid gap-4 rounded-lg border border-[var(--border)] p-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center",children:[o.jsx("span",{className:x?"grid size-10 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]":y?"grid size-10 place-items-center rounded-lg bg-[var(--muted)] text-[var(--muted-foreground)]":"grid size-10 place-items-center rounded-lg bg-[var(--warning)]/12 text-[var(--warning)]",children:x?o.jsx(Ar,{className:"size-5"}):o.jsx(D0,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h2",{className:"font-mono text-sm font-medium",children:"rynx"}),o.jsx(Pt,{variant:x?"success":y?"outline":"warning",children:RH(g.state)})]}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:NH(g)}),g.path&&o.jsx("code",{className:"mt-1 block break-all font-mono text-[11px] text-[var(--muted-foreground)]",children:g.path}),w&&g.target&&o.jsxs("p",{className:"mt-1 break-all text-[11px] text-[var(--muted-foreground)]",children:["Recommended: ",o.jsx("code",{className:"font-mono",children:g.target})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2 sm:justify-self-end",children:[g.canInstall&&o.jsxs(re,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>g.path&&void h(g.path),children:[c==="install"&&o.jsx(Le,{className:"animate-spin"}),w?"Move command":g.state==="stale"?"Repair command":"Install command"]}),g.canRemove&&o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsxs(re,{variant:"outline",size:"sm",disabled:c!==null,children:[o.jsx(da,{}),"Remove command"]})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsx(ri,{children:"Remove the Terminal command?"}),o.jsx(si,{children:"This removes only the shell command link that points to this Rynx app. The app, Runtime, settings, and workspace data remain installed."})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>g.path&&void v(g.path),children:"Remove command"})]})]})]})]})]}):o.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[c==="refresh"&&o.jsx(Le,{className:"size-4 animate-spin"}),c==="refresh"?"Checking command…":"Command status is unavailable."]}),n&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(Sc,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:n})]})]})]})]})}function RH(e){switch(e){case"installed":return"Installed";case"missing":return"Not installed";case"stale":return"Needs repair";case"foreign":return"Managed externally";case"development":return"Development build";case"unwritable":case"error":return"Unavailable"}}function NH(e){switch(e.state){case"installed":return e.canInstall?"The command is ready. You can move it to the recommended location.":"The command is ready to use from Terminal.";case"missing":return"Install the command to use Rynx from Terminal.";case"stale":return"Update the command registration to use this Rynx app.";case"foreign":return"Another program owns the active command. Rynx will not replace or remove it.";case"development":return"Global Terminal command registration is disabled in development builds. Install a packaged Rynx app to manage the rynx command.";case"unwritable":return"Rynx could not find a supported location for the command.";case"error":return"Rynx could not check the command."}}function jH(){return o.jsxs("div",{className:"grid max-w-3xl gap-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Local Runtime"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Manage the Runtime bundled with Rynx and its Terminal command."})]}),o.jsx(SH,{embedded:!0}),o.jsx(EH,{embedded:!0})]})}function AH(){const{status:e,operation:t,error:r,checkForUpdates:s,installUpdate:n}=Oy(),l=t!==null||(e==null?void 0:e.phase)==="checking"||(e==null?void 0:e.phase)==="downloading"||(e==null?void 0:e.phase)==="installing",c=r??(e==null?void 0:e.error);async function d(){const m=await s();m&&(m.error?me.error(`Could not check for updates: ${m.error}`):m.phase==="idle"?me.success(`${m.appName} is up to date`):m.availableVersion&&me.message(`Rynx ${m.availableVersion} is available`))}return o.jsxs(Mt,{id:"software-update",className:"scroll-mt-6","aria-busy":l,children:[o.jsxs(Js,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"Software update"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Review the installed Desktop version and check GitHub Releases for updates."})]}),o.jsxs(re,{variant:"outline",size:"sm",disabled:l||!(e!=null&&e.supported),onClick:()=>void d(),children:[o.jsx(yt,{className:t==="check"||(e==null?void 0:e.phase)==="checking"?"animate-spin":""}),"Check for updates"]})]}),o.jsxs(Ir,{className:"grid gap-4",children:[e?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-[var(--border)] p-4",children:[o.jsx("span",{className:MH(e),children:o.jsx(TH,{status:e})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"text-sm font-medium",children:e.appName}),o.jsxs(Pt,{variant:"outline",children:["Version ",e.currentVersion]}),o.jsx(Pt,{variant:e.channel==="preview"?"warning":"default",children:LH(e.channel)})]}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:DH(e)}),e.lastCheckedAt&&o.jsxs("p",{className:"mt-1 text-[10px] text-[var(--muted-foreground)]",children:["Last checked ",OH(e.lastCheckedAt)]})]}),e.phase==="ready"&&o.jsxs(re,{size:"sm",disabled:t==="install",onClick:()=>void n(),children:[t==="install"?o.jsx(Le,{className:"animate-spin"}):o.jsx(Xu,{}),"Restart to update"]})]}),!e.supported&&o.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3 text-xs leading-5 text-[var(--muted-foreground)]",children:"Automatic updates are available in signed release builds. Local development builds display their version here but do not contact the release feed."})]}):o.jsxs("div",{className:"flex min-h-32 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 animate-spin"}),"Loading version information…"]}),c&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-[color-mix(in_srgb,var(--destructive)_35%,var(--border))] bg-[color-mix(in_srgb,var(--destructive)_7%,var(--background))] p-3 text-xs text-[var(--destructive)]",children:[o.jsx(Sc,{className:"mt-0.5 size-4 shrink-0"}),o.jsx("span",{children:c})]})]})]})}function TH({status:e}){return e.phase==="checking"||e.phase==="installing"?o.jsx(Le,{className:"size-5 animate-spin"}):e.phase==="downloading"?o.jsx(_d,{className:"size-5"}):e.phase==="ready"?o.jsx(Xu,{className:"size-5"}):o.jsx(M0,{className:"size-5"})}function MH(e){return e.phase==="downloading"||e.phase==="ready"||e.phase==="installing"?"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/12 text-[var(--primary)]":"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--success)]/12 text-[var(--success)]"}function DH(e){if(!e.supported)return"This local build does not check for automatic updates.";switch(e.phase){case"disabled":return"Automatic updates are disabled for this build.";case"idle":return e.error?"The last update check did not complete.":e.lastCheckedAt?"This version is up to date.":"Ready to check for updates.";case"checking":return"Checking GitHub Releases for a newer version…";case"downloading":return`Rynx ${e.availableVersion??""} is downloading in the background.`;case"ready":return`Rynx ${e.availableVersion??""} is ready. Restart to finish the update.`;case"installing":return"Preparing the Runtime and restarting Rynx safely…"}}function LH(e){switch(e){case"local":return"Local build";case"preview":return"Preview channel";case"stable":return"Stable channel"}}function OH(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function BH({plugins:e,agents:t,desktopIntegrationAvailable:r}){const s=mo(),n=d=>s(xt[d]),l=e.filter(d=>d.enabled).length,c=e.filter(d=>d.runtimeState==="running").length;return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Overview"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Plugins own integrations and their settings; agents define task behavior."})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsx(b2,{icon:Rm,label:"Plugins",value:e.length,sub:`${l} enabled · ${c} healthy`,onClick:()=>n("plugins")}),o.jsx(b2,{icon:Em,label:"Agents",value:t.length,sub:t.length===1?"1 defined":`${t.length} defined`,onClick:()=>n("agents")})]}),o.jsxs(Mt,{children:[o.jsxs(Js,{children:[o.jsx(Is,{children:"Plugins"}),o.jsx(re,{variant:"outline",size:"sm",onClick:()=>n("plugins"),children:"Manage"})]}),o.jsx(Ir,{className:"p-0",children:e.length===0?o.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:["No plugins installed. Add one from a Market or a Git repository with the Rynx CLI.",o.jsx("div",{className:"mt-3",children:o.jsx(re,{size:"sm",onClick:()=>n("plugins"),children:"View plugins"})})]}):o.jsx("ul",{className:"divide-y divide-[var(--border)]",children:e.map(d=>o.jsxs("li",{className:"flex items-center justify-between gap-3 px-5 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate text-sm font-medium",children:d.pluginId}),o.jsxs("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:[d.id," · v",d.version]})]}),o.jsx("span",{className:"rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:d.enabled?d.runtimeState:"disabled"})]},d.id))})})]}),r&&o.jsx(AH,{})]})}function b2({icon:e,label:t,value:r,sub:s,onClick:n}){return o.jsx(Mt,{children:o.jsxs("button",{onClick:n,className:"flex w-full items-start gap-4 rounded-xl p-5 text-left transition-colors hover:bg-[var(--muted)]/40",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(e,{className:"size-5"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-3xl font-semibold leading-none tabular-nums",children:r}),o.jsx("div",{className:"label-caps mt-1.5 text-[11px] text-[var(--muted-foreground)]",children:t}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:s})]})]})})}function By({description:e="You're about to visit an external website. Review the complete destination before continuing.",onConfirm:t,onOpenChange:r,open:s,url:n}){const[l,c]=p.useState(!1);p.useEffect(()=>{s||c(!1)},[s]);const d=async()=>{try{await navigator.clipboard.writeText(n),c(!0)}catch{}};return o.jsx(ji,{open:s,onOpenChange:r,children:o.jsxs(ti,{className:"sm:max-w-xl",children:[o.jsxs(Ai,{children:[o.jsx(IR,{children:o.jsx(td,{})}),o.jsx(ri,{children:"Open external link?"}),o.jsx(si,{children:e})]}),o.jsxs("div",{className:"relative",children:[o.jsx("code",{className:"block max-h-48 overflow-auto whitespace-pre-wrap break-all rounded-lg border border-[var(--border)] bg-[var(--muted)]/40 py-3 pr-11 pl-3 font-mono text-xs leading-relaxed text-[var(--foreground)]",children:n}),o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2","aria-label":l?"Link copied":"Copy link",title:l?"Link copied":"Copy link",onClick:()=>void d(),children:l?o.jsx(Ar,{}):o.jsx(L0,{})})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{onClick:t,children:"Open link"})]})]})})}function PH(e){const t=IH(e)?e.url:void 0;if(typeof t!="string"||!t.trim())throw new Error("external URL is required");let r;try{r=new URL(t)}catch{throw new Error("external URL is invalid")}if(r.protocol!=="https:")throw new Error("only HTTPS links may be opened");if(r.username||r.password)throw new Error("external URLs must not contain credentials");return r.href}function IH(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const rT=1024*1024,zH=16,$H=3e4,UH=2e3,HH=/^[A-Za-z][A-Za-z0-9._:-]{0,127}$/;function FH({plugins:e,theme:t,onChange:r}){const[s,n]=p.useState(),[l,c]=p.useState(),[d,m]=p.useState("discover"),[h,v]=p.useState(null),[g,x]=p.useState(),[y,w]=p.useState(!0),[S,k]=p.useState(!1),[C,E]=p.useState(),[N,R]=p.useState(),[T,P]=p.useState(),[z,B]=p.useState(!1),F=p.useRef(0),Y=p.useRef(!1),q=p.useRef(!1),$=e.find(D=>D.id===s),M=p.useCallback(async()=>{const D=++F.current;w(!0);try{const V=await pe.listPluginMarketplaces();if(D!==F.current)return!0;const X=Y.current;return Y.current=!1,v(V),x(void 0),X&&r(),!0}catch(V){return D!==F.current?!0:(Y.current=!0,x(V.message),!1)}finally{D===F.current&&w(!1)}},[r]);p.useEffect(()=>{let D=!1,V;const X=async()=>{!await M()&&!D&&(V=window.setTimeout(()=>void X(),UH))};return X(),()=>{D=!0,V!==void 0&&window.clearTimeout(V),F.current+=1}},[M]),p.useEffect(()=>{s&&!$&&n(void 0)},[$,s]);const U=async D=>{c(D.id);try{await pe.setPluginEnabled(D.id,!D.enabled),await r()}catch(V){me.error(`Failed to ${D.enabled?"disable":"enable"} plugin: ${V.message}`)}finally{c(void 0)}},W=async D=>{R(D);try{P(await pe.preparePluginInstallation({operation:"install",marketplacePlugin:D}))}catch(V){me.error(`Could not prepare ${D}: ${V.message}`)}finally{R(void 0)}},A=async D=>{R(D);try{const V=await pe.preparePluginInstallation({operation:"update",pluginId:D});if(V.unchanged){await pe.cancelPluginInstallation(V.token).catch(()=>!1),me.info(`${D} is already up to date.`);return}P(V)}catch(V){me.error(`Could not prepare update for ${D}: ${V.message}`)}finally{R(void 0)}},O=()=>{const D=T;P(void 0),D&&pe.cancelPluginInstallation(D.token).catch(()=>!1)},L=async()=>{if(!T)return;const D=!!T.existing;B(!0);try{const V=await pe.commitPluginInstallation(T.token,{overwrite:!!T.existing,expectedDigest:T.artifact.digest});P(void 0),me.success(`${D?"Updated":"Installed"} ${V.plugin.id} v${V.plugin.version}.`+(D?" No Rynx restart required.":"")),await r(),m("installed")}catch(V){P(void 0),me.error(`${D?"Update":"Installation"} failed: ${V.message}`)}finally{B(!1)}},G=async D=>{if(!q.current){q.current=!0,E(D.id);try{await pe.refreshPluginMarketplace(D.id),await Promise.all([M(),r()]),me.success(`Refreshed ${D.id}`)}catch(V){me.error(`Market refresh failed: ${V.message}`)}finally{q.current=!1,E(void 0)}}},H=async D=>{if(!q.current){q.current=!0,E(D.id);try{await pe.removePluginMarketplace(D.id),await M(),me.success(`Removed ${D.id}`)}catch(V){me.error(`Market removal failed: ${V.message}`)}finally{q.current=!1,E(void 0)}}};return $!=null&&$.hasSettingsUi?o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[o.jsxs(re,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>n(void 0),children:[o.jsx(tl,{}),"Plugins"]}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs("h1",{className:"text-xl font-semibold tracking-tight",children:[$.pluginId," settings"]}),o.jsx(iT,{plugin:$})]}),o.jsxs("div",{className:"truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:["Sandboxed plugin UI · ",$.id," · v",$.version]})]})]}),o.jsx(Mt,{className:"overflow-hidden",children:o.jsx(Ir,{className:"p-0",children:o.jsx(XH,{plugin:$,theme:t,onChange:r})})})]}):o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Plugins"}),o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"Discover plugins from trusted Markets, then review their source and executable entries before installation."})]}),o.jsxs(re,{size:"sm",className:"shrink-0",onClick:()=>k(!0),children:[o.jsx(Zr,{}),"Add Market"]})]}),o.jsxs(G9,{value:d,onValueChange:m,children:[o.jsxs(IA,{"aria-label":"Plugin management views",children:[o.jsxs(jf,{value:"discover",className:"gap-1.5 leading-none",children:["Discover",o.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:(h==null?void 0:h.reduce((D,V)=>D+V.plugins.length,0))??0})]}),o.jsxs(jf,{value:"installed",className:"gap-1.5 leading-none",children:["Installed",o.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:e.length})]}),o.jsxs(jf,{value:"markets",className:"gap-1.5 leading-none",children:["Markets",o.jsx("span",{className:"text-xs font-normal leading-none tabular-nums",children:(h==null?void 0:h.length)??0})]})]}),o.jsx(Af,{value:"discover",children:h===null&&g?o.jsx(w2,{error:g,retrying:y,onRetry:()=>void M()}):o.jsx(qH,{markets:h,installed:e,preparingId:N,onAddMarket:()=>k(!0),onInstall:D=>void W(D)})}),o.jsx(Af,{value:"installed",children:o.jsx(WH,{plugins:e,mutatingId:l,preparingId:N,onBrowse:()=>m("discover"),onConfigure:n,onUpdate:D=>void A(D),onChangeEnabled:D=>void U(D)})}),o.jsx(Af,{value:"markets",children:h===null&&g?o.jsx(w2,{error:g,retrying:y,onRetry:()=>void M()}):o.jsx(VH,{markets:h,mutatingId:C,onAdd:()=>k(!0),onRefresh:D=>void G(D),onRemove:D=>void H(D)})})]}),o.jsx(GH,{open:S,onOpenChange:k,onAdded:async D=>{await M(),m("discover"),me.success(`Added ${D.id}`)}}),o.jsx(YH,{preparation:T,committing:z,onCancel:O,onCommit:()=>void L()})]})}function qH({markets:e,installed:t,preparingId:r,onAddMarket:s,onInstall:n}){const[l,c]=p.useState(""),d=new Set(t.map(g=>g.id)),m=(e??[]).flatMap(g=>g.plugins.map(x=>({id:`${x.id}@${g.id}`,pluginId:x.id,market:g}))),h=l.trim().toLowerCase(),v=h?m.filter(({id:g})=>g.includes(h)):m;return e===null?o.jsx(sT,{label:"Loading plugin catalogs…"}):e.length===0?o.jsx(Py,{icon:Xf,title:"Add a Market to discover plugins",description:"A Market is a Git or local catalog. Adding it downloads metadata only and never installs plugin code.",action:o.jsxs(re,{size:"sm",onClick:s,children:[o.jsx(Zr,{})," Add Market"]})}):o.jsxs(Mt,{children:[o.jsxs(Js,{className:"flex-col items-stretch gap-3 sm:flex-row sm:items-center",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"Available plugins"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Catalog entries stay inert until you review and install one."})]}),o.jsxs("div",{className:"relative w-full sm:w-64",children:[o.jsx(AE,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),o.jsx(bt,{"aria-label":"Search available plugins",className:"pl-8",value:l,placeholder:"Search plugins or Markets",onChange:g=>c(g.target.value)})]})]}),o.jsx(Ir,{className:"p-0",children:v.length===0?o.jsxs("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:["No catalog entries match “",l.trim(),"”."]}):o.jsx("div",{className:"divide-y divide-[var(--border)]",children:v.map(({id:g,pluginId:x,market:y})=>{const w=d.has(g),S=r===g;return o.jsxs("article",{className:"flex flex-col gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 sm:flex-row sm:items-center",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Rm,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{className:"text-sm",children:x}),o.jsx(Pt,{variant:"outline",className:"font-mono",children:y.id})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:g})]}),o.jsx(re,{size:"sm",variant:w?"outline":"default",disabled:w||!!r,onClick:()=>n(g),children:w?o.jsxs(o.Fragment,{children:[o.jsx(Ar,{})," Installed"]}):S?o.jsxs(o.Fragment,{children:[o.jsx(Le,{className:"animate-spin"})," Preparing…"]}):o.jsxs(o.Fragment,{children:[o.jsx(_d,{})," Install"]})})]},g)})})})]})}function WH({plugins:e,mutatingId:t,preparingId:r,onBrowse:s,onConfigure:n,onUpdate:l,onChangeEnabled:c}){return e.length===0?o.jsx(Py,{icon:mC,title:"No plugins installed",description:"Browse your registered Markets and review a plugin before installing it.",action:o.jsxs(re,{size:"sm",onClick:s,children:[o.jsx(mC,{})," Browse plugins"]})}):o.jsx("div",{className:"grid gap-3",children:e.map(d=>o.jsx(Mt,{children:o.jsxs(Ir,{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Rm,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{className:"text-sm",children:d.pluginId}),o.jsx(iT,{plugin:d}),o.jsx(Pt,{variant:"outline",children:d.marketplaceId})]}),o.jsxs("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:["v",d.version]}),d.runtimeError&&o.jsxs("div",{className:"mt-2 flex items-start gap-1.5 text-xs text-[var(--danger)]",children:[o.jsx(Ci,{className:"mt-0.5 size-3.5 shrink-0"}),d.runtimeError]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.hasSettingsUi&&o.jsxs(re,{variant:"outline",size:"sm",onClick:()=>n(d.id),children:[o.jsx(Y6,{}),"Configure"]}),d.updateState!=="current"&&o.jsxs(re,{variant:"outline",size:"sm",disabled:!!r||t!==void 0,onClick:()=>l(d.id),children:[o.jsx(yt,{className:r===d.id?"animate-spin":""}),r===d.id?"Checking…":d.updateState==="available"?"Update":"Check for updates"]}),o.jsx(rp,{"aria-label":`${d.enabled?"Disable":"Enable"} ${d.pluginId}`,checked:d.enabled,disabled:t===d.id,onCheckedChange:()=>c(d)})]})]})},d.id))})}function VH({markets:e,mutatingId:t,onAdd:r,onRefresh:s,onRemove:n}){return e===null?o.jsx(sT,{label:"Loading Markets…"}):e.length===0?o.jsx(Py,{icon:Xf,title:"No Markets registered",description:"Add a trusted Git repository or local catalog to make its plugins discoverable.",action:o.jsxs(re,{size:"sm",onClick:r,children:[o.jsx(Zr,{})," Add Market"]})}):o.jsxs(Mt,{children:[o.jsxs(Js,{children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"Registered Markets"}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Built-in Markets update with Rynx. User-added Markets can be refreshed independently."})]}),o.jsxs(re,{size:"sm",variant:"outline",onClick:r,children:[o.jsx(Zr,{})," Add Market"]})]}),o.jsx(Ir,{className:"p-0",children:o.jsx("div",{className:"divide-y divide-[var(--border)]",children:e.map(l=>o.jsxs("article",{className:"flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Xf,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{className:"font-mono text-sm",children:l.id}),o.jsx(Pt,{variant:"outline",children:l.builtIn?"Built-in":l.source}),o.jsxs(Pt,{variant:"default",children:[l.plugins.length," plugins"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:l.builtIn?`Managed by Rynx · updated ${new Date(l.refreshedAt).toLocaleString()}`:`${l.id} · ${KH(l.resolvedRevision)} · refreshed ${new Date(l.refreshedAt).toLocaleString()}`})]}),!l.builtIn&&o.jsxs("div",{className:"flex shrink-0 gap-2",children:[o.jsxs(re,{size:"sm",variant:"outline",disabled:t!==void 0,onClick:()=>s(l),children:[o.jsx(yt,{className:t===l.id?"animate-spin":""}),"Refresh"]}),o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsx(re,{size:"icon-sm",variant:"ghost",disabled:t!==void 0,"aria-label":`Remove ${l.id}`,children:o.jsx(da,{})})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsx(ri,{children:"Remove this Market?"}),o.jsxs(si,{children:[l.id," will disappear from Discover. A Market with installed plugins cannot be removed until those plugins are uninstalled."]})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>n(l),children:"Remove Market"})]})]})]})]})]},l.id))})})]})}function GH({open:e,onOpenChange:t,onAdded:r}){const[s,n]=p.useState(""),[l,c]=p.useState(!1),d=()=>{n(""),t(!1)},m=async()=>{if(s.trim()){c(!0);try{const h=await pe.addPluginMarketplace({source:s.trim()});d(),await r(h)}catch(h){me.error(`Could not add Market: ${h.message}`)}finally{c(!1)}}};return o.jsx(sn,{open:e,onOpenChange:h=>{l||(h?t(!0):d())},children:o.jsxs(Di,{className:"sm:max-w-lg",showCloseButton:!l,children:[o.jsxs(An,{children:[o.jsx(Li,{children:"Add a Market"}),o.jsxs(vo,{children:["Register a Git repository or local directory containing"," ",o.jsx("code",{children:".rynx-plugin/marketplace.json"}),". This reads the catalog only."]})]}),o.jsx("div",{className:"grid gap-4",children:o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"market-source",children:"Source"}),o.jsx(bt,{id:"market-source",autoFocus:!0,value:s,placeholder:"owner/repo or https://github.com/owner/repo",onChange:h=>n(h.target.value)}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"GitHub shorthand, a credential-free Git URL, or an absolute local path."})]})}),o.jsxs(ma,{children:[o.jsx(re,{variant:"outline",disabled:l,onClick:d,children:"Cancel"}),o.jsxs(re,{disabled:l||!s.trim(),onClick:()=>void m(),children:[l?o.jsx(Le,{className:"animate-spin"}):o.jsx(Xf,{}),l?"Adding…":"Add Market"]})]})]})})}function YH({preparation:e,committing:t,onCancel:r,onCommit:s}){const n=e==null?void 0:e.artifact;return o.jsx(sn,{open:!!e,onOpenChange:l=>{!l&&!t&&r()},children:o.jsx(Di,{className:"max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-2xl",children:e&&n&&o.jsxs(o.Fragment,{children:[o.jsxs(An,{className:"px-5 pb-4 pr-12 pt-5",children:[o.jsxs(Li,{children:["Review ",e.existing?"plugin update":"plugin installation"]}),o.jsx(vo,{children:"Rynx inspected an immutable package snapshot. Confirm its source and executable entries before the active installation changes."})]}),o.jsx(En,{className:"min-h-0",children:o.jsxs("div",{className:"grid gap-3 px-5 pb-5",children:[o.jsxs("div",{className:"grid gap-3 rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("strong",{children:n.pluginId}),o.jsx(Pt,{variant:"outline",children:n.marketplaceId}),o.jsxs(Pt,{variant:"default",children:["v",n.version]})]}),o.jsx("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:n.id}),o.jsx("div",{className:"break-all font-mono text-[10px] leading-relaxed text-[var(--muted-foreground)]",children:n.digest}),o.jsxs("dl",{className:"grid gap-2 border-t border-[var(--border)] pt-3 text-xs",children:[o.jsx(Fa,{label:"Source",children:n.resolvedSource.type==="git"?n.resolvedSource.repository:"Local directory (path hidden)"}),o.jsx(Fa,{label:"Subdirectory",children:n.resolvedSource.subdirectory}),n.resolvedSource.type==="git"&&o.jsx(Fa,{label:"Commit",children:n.resolvedSource.commit})]}),(n.runtimeEntry||n.settingsBackgroundEntry||n.commandsEntry||n.settingsUiEntry||n.skillDirectory)&&o.jsxs("div",{className:"grid gap-2 border-t border-[var(--border)] pt-3",children:[o.jsx("div",{className:"text-xs font-medium",children:"Included components"}),o.jsxs("dl",{className:"grid gap-2 text-xs",children:[n.runtimeEntry&&o.jsx(Fa,{label:n.runtimeEntry.type==="module"?"Runtime module":"Runtime process",children:n.runtimeEntry.type==="module"?n.runtimeEntry.entry:[n.runtimeEntry.command,...n.runtimeEntry.args].join(" ")}),n.commandsEntry&&o.jsx(Fa,{label:"Commands",children:n.commandsEntry}),n.settingsUiEntry&&o.jsx(Fa,{label:"Settings UI",children:n.settingsUiEntry}),n.settingsBackgroundEntry&&o.jsx(Fa,{label:n.settingsBackgroundEntry.type==="module"?"Settings background":"Settings process",children:n.settingsBackgroundEntry.type==="module"?n.settingsBackgroundEntry.entry:[n.settingsBackgroundEntry.command,...n.settingsBackgroundEntry.args].join(" ")}),n.skillDirectory&&o.jsx(Fa,{label:"Skills",children:n.skillDirectory})]})]})]}),e.existing&&o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-[var(--warning)]/35 bg-[var(--warning)]/10 p-3 text-xs",children:[o.jsx(Ci,{className:"mt-0.5 size-4 shrink-0 text-[var(--warning)]"}),"This replaces ",e.existing.id," v",e.existing.version,". Its enabled state and plugin-owned data are retained."]})]})}),o.jsxs(ma,{className:"mx-0 mb-0 rounded-none rounded-b-xl px-5 py-3",children:[o.jsx(re,{variant:"outline",disabled:t,onClick:r,children:"Cancel"}),o.jsxs(re,{disabled:t,onClick:s,children:[t?o.jsx(Le,{className:"animate-spin"}):e.existing?o.jsx(yt,{}):o.jsx(_d,{}),t?e.existing?"Updating…":"Installing…":e.existing?"Update plugin":"Install plugin"]})]})]})})})}function Fa({label:e,children:t}){return o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-[7rem_minmax(0,1fr)] sm:gap-3",children:[o.jsx("dt",{className:"text-[var(--muted-foreground)]",children:e}),o.jsx("dd",{className:"min-w-0",children:o.jsx("code",{className:"break-all text-[11px]",children:t})})]})}function Py({icon:e,title:t,description:r,action:s}){return o.jsx(Mt,{children:o.jsxs(Ir,{className:"grid justify-items-center gap-3 py-12 text-center",children:[o.jsx("span",{className:"grid size-11 place-items-center rounded-xl bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(e,{className:"size-5"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:t}),o.jsx("p",{className:"mt-1 max-w-md text-xs text-[var(--muted-foreground)]",children:r})]}),s]})})}function sT({label:e}){return o.jsx(Mt,{children:o.jsxs(Ir,{className:"flex items-center justify-center gap-2 py-12 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 animate-spin"}),e]})})}function w2({error:e,retrying:t,onRetry:r}){return o.jsx(Mt,{role:"alert",children:o.jsxs(Ir,{className:"grid justify-items-center gap-3 py-12 text-center",children:[o.jsx("span",{className:"grid size-11 place-items-center rounded-xl bg-[var(--danger)]/10 text-[var(--danger)]",children:o.jsx(Ci,{className:"size-5"})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Rynx Runtime is unavailable"}),o.jsx("p",{className:"mt-1 max-w-md text-xs text-[var(--muted-foreground)]",children:"Plugin catalogs could not be loaded. Rynx will retry automatically."}),o.jsx("p",{className:"mt-2 max-w-md break-all font-mono text-[10px] text-[var(--danger)]",children:e})]}),o.jsxs(re,{size:"sm",variant:"outline",disabled:t,onClick:r,children:[o.jsx(yt,{className:t?"animate-spin":""}),t?"Retrying…":"Retry now"]})]})})}function KH(e){return e==="local"||e.length<=12?e:e.slice(0,12)}function iT({plugin:e}){if(!e.enabled)return null;const t=e.runtimeState,r=t==="absent"?"Unavailable":t.charAt(0).toUpperCase()+t.slice(1);return o.jsx("span",{className:Pe("rounded-full border border-[var(--border)] px-2 py-0.5 font-mono text-[10px]",t==="running"&&"text-[var(--success)]",(t==="failed"||t==="degraded")&&"text-[var(--danger)]",(t==="stopped"||t==="absent")&&"text-[var(--muted-foreground)]"),children:r})}function XH({plugin:e,theme:t,onChange:r}){const s=p.useRef(null),n=p.useRef(()=>{}),l=p.useRef(null),c=p.useRef(void 0),d=p.useRef(void 0),[m,h]=p.useState(),[v,g]=p.useState(),[x,y]=p.useState(),w=p.useCallback((C,E)=>{const N=PH(C);return d.current?Promise.reject(new Error("another external link confirmation is already open")):new Promise((R,T)=>{let P=!1,z;const B=()=>{E.removeEventListener("abort",F),d.current===z&&(d.current=void 0,y(void 0))},F=()=>{P||(P=!0,B(),T(new Error("external link request was cancelled")))};z={url:N,settle(Y){P||(P=!0,B(),Y&&window.open(N,"_blank","noopener,noreferrer"),R({opened:Y}))}},d.current=z,y(z),E.aborted?F():E.addEventListener("abort",F,{once:!0})})},[]);p.useEffect(()=>{const C=new AbortController;return n.current(),c.current=void 0,h(void 0),g(void 0),pe.pluginSettingsUi(e.id,C.signal).then(h).catch(E=>{C.signal.aborted||g(E.message)}),()=>{C.abort(),n.current()}},[e.id,e.updatedAt]),p.useEffect(()=>{var C;(C=l.current)==null||C.postMessage(ZH(t))},[t]);const S=p.useCallback(()=>{var z;if(n.current(),!m||!((z=s.current)!=null&&z.contentWindow))return;const C=new MessageChannel,E=new Set,N=new Set;let R=!0,T=0;const P=B=>{if(!R)return;const F=eF(B);C.port1.postMessage(F)};C.port1.onmessage=B=>{const F=JH(B.data);if(!F.ok){P({id:F.id,error:F.error});return}if(N.has(F.id)){P({id:F.id,error:"duplicate request id"});return}if(T>=zH){P({id:F.id,error:"too many requests in flight"});return}N.add(F.id),T+=1;const Y=new AbortController;E.add(Y);const q=window.setTimeout(()=>Y.abort(),$H);QH(e.id,m.generation,w,F.method,F.params,Y.signal).then($=>{P({id:F.id,result:$}),F.method!=="host.openExternal"&&r()}).catch($=>{P({id:F.id,error:Y.signal.aborted?"request timed out":$.message})}).finally(()=>{window.clearTimeout(q),E.delete(Y),N.delete(F.id),T-=1})},C.port1.onmessageerror=()=>{P({id:null,error:"invalid plugin UI message"})},C.port1.start(),l.current=C.port1,s.current.contentWindow.postMessage({type:"rynx-plugin-connect",pluginId:e.id,appearance:{colorScheme:t}},"*",[C.port2]),n.current=()=>{if(R){R=!1;for(const B of E)B.abort();E.clear(),N.clear(),l.current===C.port1&&(l.current=null),C.port1.close(),C.port2.close()}}},[m,r,e.id,w,t]),k=p.useCallback(()=>{if(m){if(c.current===m.generation){n.current();return}c.current=m.generation,S()}},[S,m]);return v?o.jsx("div",{className:"p-5 text-sm text-[var(--danger)]",children:v}):m?o.jsxs(o.Fragment,{children:[o.jsx("iframe",{ref:s,title:`${e.pluginId} settings`,className:"h-[calc(100dvh-10rem)] min-h-[28rem] max-h-[64rem] w-full border-0 bg-[var(--background)]",sandbox:"allow-scripts",referrerPolicy:"no-referrer",srcDoc:m.html,onLoad:k}),o.jsx(By,{open:!!x,url:(x==null?void 0:x.url)??"",onOpenChange:C=>{C||x==null||x.settle(!1)},description:o.jsxs(o.Fragment,{children:["The ",e.pluginId," plugin wants to open this address in a new browser tab. Review the complete destination before continuing."]}),onConfirm:()=>x==null?void 0:x.settle(!0)})]}):o.jsx("div",{className:"p-5 text-sm text-[var(--muted-foreground)]",children:"Loading plugin UI…"})}function ZH(e){return{type:"rynx-host-appearance",appearance:{colorScheme:e}}}async function QH(e,t,r,s,n,l){if(s==="host.openExternal")return r(n,l);if(s.startsWith("host."))throw new Error(`unknown Rynx host settings method "${s}"`);return pe.pluginSettingsCall(e,t,s,n,l)}function JH(e){let t;try{t=nT(e)}catch{return{ok:!1,id:null,error:"request is not serializable"}}if(t>rT)return{ok:!1,id:null,error:"request exceeds 1 MiB"};if(typeof e!="object"||e===null||Array.isArray(e))return{ok:!1,id:null,error:"request must be an object"};const r=e,s=typeof r.id=="string"||typeof r.id=="number"&&Number.isSafeInteger(r.id)?r.id:null;return s===null||typeof r.method!="string"||!HH.test(r.method)?{ok:!1,id:s,error:"request id or method is invalid"}:{ok:!0,id:s,method:r.method,params:r.params}}function eF(e){try{return nT(e)<=rT?e:{id:S2(e),error:"response exceeds 1 MiB"}}catch{return{id:S2(e),error:"response is not serializable"}}}function nT(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength}function S2(e){if(typeof e!="object"||e===null)return null;const t=e.id;return typeof t=="string"||typeof t=="number"?t:null}function aT(e){const t=[...new Set(e.directories.map(s=>s.trim()).filter(Boolean))],r=e.primary.trim();return{name:e.name.trim()||tF(r),directories:t,primary:r}}function tF(e){const t=e.trim().replace(/[\\/]+$/,"");if(!t||/^[A-Za-z]:$/.test(t))return"";const r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return t.slice(r+1)}const rF={name:"",directories:[],primary:""},cm="local";function sF(){const e=Qr(),[t,r]=p.useState([]),[s,n]=p.useState(!0),[l,c]=p.useState(),[d,m]=p.useState(()=>{var g;return((g=e.state)==null?void 0:g.createProject)===!0?"new":null}),h=p.useRef(0);async function v(g=!1){const x=++h.current;g&&n(!0);try{const y=await pe.listProjects(cm);if(x!==h.current)return;r(y),c(void 0)}catch(y){if(x!==h.current)return;r([]),c(`Could not load projects: ${y.message}`)}finally{x===h.current&&n(!1)}}return p.useEffect(()=>(r([]),c(void 0),n(!0),v(),()=>{h.current+=1}),[]),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs(Mt,{children:[o.jsxs(Js,{className:"flex-wrap",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs(Is,{children:["Projects"," ",o.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:t.length})]}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Reusable source directories stored on This device."})]}),o.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none",children:o.jsxs(re,{size:"sm",onClick:()=>m("new"),children:[o.jsx(Zr,{})," New project"]})})]}),o.jsx(Ir,{className:"p-0",children:s?o.jsxs("div",{className:"flex min-h-36 items-center justify-center gap-2 text-sm text-[var(--muted-foreground)]",role:"status",children:[o.jsx(Le,{className:"size-4 animate-spin"})," Loading projects…"]}):l?o.jsxs("div",{className:"grid min-h-36 place-items-center gap-3 px-5 py-8 text-center",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Projects are unavailable"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:l})]}),o.jsx(re,{variant:"outline",size:"sm",onClick:()=>void v(!0),children:"Retry"})]}):t.length===0?o.jsx("div",{className:"grid min-h-44 place-items-center px-5 py-8 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx("span",{className:"mx-auto flex size-10 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(W_,{className:"size-5"})}),o.jsx("p",{className:"mt-3 text-sm font-medium",children:"No projects on this device"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Save one or more directories so a new Session can start in the same workspace."}),o.jsxs(re,{className:"mt-4",size:"sm",onClick:()=>m("new"),children:[o.jsx(Zr,{})," New project"]})]})}):o.jsx("ul",{className:"divide-y divide-[var(--border)]",children:t.map(g=>o.jsx(iF,{project:g,onEdit:()=>m(g),onDeleted:()=>void v()},g.id))})})]}),o.jsx(nF,{open:d!==null,project:d==="new"?void 0:d??void 0,onOpenChange:g=>{g||m(null)},onSaved:async()=>{m(null),await v()}},d==="new"?"new":(d==null?void 0:d.id)??"closed")]})}function iF({project:e,onEdit:t,onDeleted:r}){const[s,n]=p.useState(!1);async function l(){n(!0);try{await pe.deleteProject(cm,e.id),me.success(`Project "${e.name}" removed`),r()}catch(c){me.error(`Delete failed: ${c.message}`)}finally{n(!1)}}return o.jsxs("li",{className:"grid gap-3 px-5 py-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Gf,{className:"size-4 shrink-0 text-[var(--primary)]","aria-hidden":"true"}),o.jsx("span",{className:"truncate text-sm font-medium",children:e.name}),o.jsxs("span",{className:"rounded-md bg-[var(--muted)] px-1.5 py-0.5 font-mono text-[9px] text-[var(--muted-foreground)]",children:[e.directories.length," ",e.directories.length===1?"folder":"folders"]})]}),o.jsxs("div",{className:"mt-1.5 flex min-w-0 items-center gap-1.5 pl-6 font-mono text-[10px] text-[var(--muted-foreground)]",children:[o.jsx(OE,{className:"size-3 shrink-0","aria-hidden":"true"}),o.jsx("span",{className:"truncate",title:e.primary,children:e.primary})]})]}),o.jsxs("div",{className:"flex justify-end gap-1.5",children:[o.jsxs(re,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(jE,{})," Edit"]}),o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"icon-sm",className:"text-[var(--destructive)]","aria-label":`Delete ${e.name}`,disabled:s,children:s?o.jsx(Le,{className:"animate-spin"}):o.jsx(da,{})})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:["Remove project “",e.name,"”?"]}),o.jsx(si,{children:"This removes only the saved project. It does not delete any directories or affect existing Sessions."})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>void l(),children:"Remove project"})]})]})]})]})]})}function nF({open:e,project:t,onOpenChange:r,onSaved:s}){const n=fl(),l=!!(n!=null&&n.chooseDirectory),[c,d]=p.useState(()=>t?{name:t.name,directories:[...t.directories],primary:t.primary}:{...rF}),[m,h]=p.useState(!1),[v,g]=p.useState(!1),x=p.useMemo(()=>aF(c),[c]);function y(){d(E=>({...E,directories:[...E.directories,""]}))}async function w(){var N;const E=await((N=n==null?void 0:n.chooseDirectory)==null?void 0:N.call(n));E&&d(R=>R.directories.includes(E)?R:{...R,directories:[...R.directories,E],primary:R.primary||E})}function S(E,N){d(R=>{const T=R.directories[E]??"",P=R.directories.map((B,F)=>F===E?N:B);let z=R.primary;return z===T&&(z=N),!z&&N&&(z=N),{...R,directories:P,primary:z}})}function k(E){d(N=>{const R=N.directories[E],T=N.directories.filter((P,z)=>z!==E);return{...N,directories:T,primary:N.primary===R?T.find(Boolean)??"":N.primary}})}async function C(){if(g(!0),x)return;const E=aT(c);h(!0);try{t?(await pe.updateProject(cm,t.id,E),me.success(`Project "${E.name}" updated`)):(await pe.createProject(cm,E),me.success(`Project "${E.name}" created`)),await s()}catch(N){me.error(`Save failed: ${N.message}`)}finally{h(!1)}}return o.jsx(sn,{open:e,onOpenChange:r,children:o.jsxs(Di,{className:"sm:max-w-2xl",children:[o.jsxs(An,{children:[o.jsx(Li,{children:t?"Edit project":"Create project"}),o.jsx(vo,{children:"These paths belong to This device. The Primary directory becomes the Session working directory; every listed directory is available to the Session."})]}),o.jsxs("form",{className:"grid gap-4",onSubmit:E=>{E.preventDefault(),C()},children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"project-name",children:"Name"}),o.jsx(bt,{id:"project-name",value:c.name,onChange:E=>d(N=>({...N,name:E.target.value})),placeholder:"Defaults to Primary folder name",maxLength:128,autoFocus:!0})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx(Xr,{children:"Source directories"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Choose local folders or enter absolute paths."})]}),o.jsxs("div",{className:"flex gap-1.5",children:[l&&o.jsxs(re,{type:"button",variant:"outline",size:"sm",onClick:()=>void w(),children:[o.jsx(W_,{})," Choose folder"]}),o.jsxs(re,{type:"button",variant:"outline",size:"sm",onClick:y,children:[o.jsx(Zr,{})," ",l?"Enter path":"Add path"]})]})]}),o.jsx("div",{className:"overflow-hidden rounded-lg border border-[var(--border)]",children:c.directories.length===0?o.jsxs("button",{type:"button",className:"flex min-h-24 w-full items-center justify-center gap-2 text-sm text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]/40 hover:text-[var(--foreground)]",onClick:l?()=>void w():y,children:[o.jsx(W_,{className:"size-4"}),l?"Choose a source folder":"Add an absolute directory path"]}):o.jsx("div",{className:"divide-y divide-[var(--border)]",children:c.directories.map((E,N)=>{const R=E!==""&&E===c.primary;return o.jsxs("div",{className:"grid gap-2 p-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[o.jsxs("div",{className:"relative min-w-0",children:[o.jsx(Gf,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),o.jsx(bt,{value:E,onChange:T=>S(N,T.target.value),placeholder:"/Users/name/Workspace/project",className:"pl-8 font-mono text-xs","aria-label":`Source directory ${N+1}`,autoCapitalize:"none",autoCorrect:"off",spellCheck:!1})]}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[o.jsxs(re,{type:"button",variant:R?"secondary":"ghost",size:"sm",className:Pe(R&&"text-[var(--primary)]"),disabled:!E.trim(),onClick:()=>d(T=>({...T,primary:E})),children:[R?o.jsx(Ar,{}):o.jsx(OE,{}),R?"Primary":"Make primary"]}),o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove source directory ${N+1}`,onClick:()=>k(N),children:o.jsx(Ni,{})})]})]},N)})})}),v&&x&&o.jsx("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:x})]}),o.jsxs(ma,{children:[o.jsx(re,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsxs(re,{type:"submit",disabled:m,children:[m?o.jsx(Le,{className:"animate-spin"}):null,t?"Save changes":"Create project"]})]})]})]})})}function aF(e){const t=aT(e);if(!t.name)return"Enter a project name.";if(t.directories.length===0)return"Add at least one source directory.";if(t.directories.some(r=>!oF(r)))return"Every source directory must be an absolute path.";if(!t.primary||!t.directories.includes(t.primary))return"Choose one listed directory as Primary."}function oF(e){return e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e)}const C2={codex:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAGcklEQVR42s2YbayXZR3HP9efc3g4wEEcgiKSIuQENCnEkUo5ZeUxS4eVtnzR1gpdTzO1CNfDirlc9aJMrfmi1Zo2K2wtQsk0TM6gLWxATUklFQNFoIOcwznA+fSi7023twcQa617++9/77qvh9/j9/f9XfB/9pTXM0ktQCmlDKonAvOBWUAnsBv4C7CmlLI9c1uAzW1KKf7HEucA1AnqEnW9+pK6V92v9qkvZvwW9fgj7NVSh1V7HpOFqkWlFNXZwNeBLqAfWAlsBF4BjgPmARcAB4FfAo/EeqcB+4CtwHpgdSmlX21l78E3YqEp6kr/9SxXL81Yh9oejTvVT6l7PPzznHqPellt72HN89oOI0RbYmAUcD3wLuBe4HOllGcbcztiobnAGGAb8DiwGdgOjIyl5gBXA+eqk4CfAL1q64iWip/b8j5bfVn9q3p6XSt1hHq+ert6IFb4nfrxBP6r3K/OU7+j7lN3qNdUMXXUAM77OPUmdVBdFgFa+Z+mfjZuUN2cgJ5cWz9cHTHEGV9OIqxT5xzOdTQ2eqv6LXWb2pO4aY+mXeqaCLJd/Z46q+5udZK6SH2/Or4K4ig0Sr0v62/Nnm2Hc1W7ekMEqZ5d6twsHKmuyvgKdUHNJdXvktqcgbwvbEDItfn2sHpC0zvUNFim9kage9Q/JXPelu+jY+rd6hV1U6tnqz/IN9Un1A15f1n9fuADdYb6uPqUOu81AmXgg1m4O+Y+TX1QfaUmUIfaHWC8MGOnqF9UN6r9EeJG9Uz1DPXz6gsR7KnE5cxYeJfaNZSFxqu/zaIlMf3ECLSnIdC6WPCqxEh3A2/uUMfU9h6rzle/28jGreom9YKES6nj0PnA2cA64L6g84QhkHxYkHoscAMwExgHLAf6gEuBK4EO9X7gwVLKHqBb3Qw8DFwLvDf7PQ8MpEb+u/6ptwUflsYKJS5bFQudm3mdsZrRtlu9Tj0p6P0JdW2+P5MUn1vPInWq+pmai7+R2GzVXXZvNvlIbezUHN6jnhUhO5MZAwG5aUNk6zT1rhxmYmpxFKzjXJf6fDDpw9V4q/Ffh/BWXNoC2kId9qUU9AA/K6U8HVxpVRhTSnka+CnwJNALvAm4E7gDWBilhpdSVgBLs/9i9bi6IM+lUp+stteYQD/QASxKTB2I0AUYGY33l1IGU4/2Z6wdmAg8ASwGHgUWhgl8NDFWgDXAauDNwCV1gbqBncBFwKmZ/BKwKoIuSeBenYJ74Cjkzli3L0X5CuCrGXsPMDEW/1uoyvEhfYcEeijVeQHw9pp77gYuB34TvnMXcAbwYiwj0F65DGivrbXm7p1x49643PChgWTaMGDqIYFKKbvi50FgmdpVShkopfQAD8Ts10ejDmAGcJU6rZTSV7mslNKXQF8UgrYPGBWLH4wgBxr09rXxGw1HJwX7k5KfVqc2iuZc9SvqlmTQ2qT6lKT+dYGCCgAfUDuz/pxk7OqUjhKIWRrIuW2oWnZeDUdU7w8aT6gTMvXK1K2/qzvVH6s/z5qd6mPh3KvVsbVa16M+Wqtp03PejjqTrKp1S70wcL5V/X0OOJhyML/aPGvGZLz+rEkdXJTysk4d3RBotTo5Zy7JuoeqtG92Fl3R8NfqLPXmFERTIJekYJ6ZIrkh5t4QgjYl+yxIAe5uCLQnAk2PlXenoH/gcK3OeYH89TXKOivIuyOCbQy1qLjS3epZdeJeO2xtVWgj0D/UP4favBCq87V62DQFOkF9JHB+TePbRaEM/XHjr9R31glazTorIvAqdWTG3xJrVM+2kMH2VwnTyKISWmm0GNGgn+PU96mXp3GsE7RZobPba/HUVVFU9eJYaLv6TXWOOvxIXLrqJuaof4g5bxliXnujek9O/Gyu9V83qqc3GoMvpWG4SR03VGMxpFD5fSgx06d+Oy1Macw9Sf1YyFZFR25PazSioeQ09cm4bHbNI62jNYrm94tA/BeATwIXA+vVZ4K+JwLTgXPy/iPgh7lw6D3Up5dyUD0ldWwGcCuwJYL6ulrpRlxcllh6dojWeDD/e4LqndG6PeA5Je3T8sxbWcHCMV/H1C8DYv4FaYVPBkYAW8KJ3pHi2wY8Fgq8Ky31bODdmb8CuLmUsql+iXHM1zCJp9YR5oxPLfpjsqc3VzR7A4zr03VMOGoAv5ELqyHWDqYhmBQ+MzPXMz3AJqC7lLKtIvD/lQur//XzT+4u16KSSLsQAAAAAElFTkSuQmCC",monochrome:!0},claude:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAEYElEQVR4nMVXW4hVVRjedrMii+6FRRRFUQ9iVNAFKipoKAeC1vrXGTUkSn0xGpyz/nVmHjpRYJQvZQ+R0EOXhyQksQsVKFo9WBORdc6sf59RiWlUyCmly5SWJ/69195n7T3nOo31w2Lm/Ovyf+v7b2sHQQcZXbnyVCoVrpsYFGcE/4eQgdcJoU6oDo2PqMubrakOL7uUNGwkLW6ZU+PVtQNXxMbjYTU83x4kfDenALaX7zqFEI54IH6ulMVZMwAgTLr5z+cUAAtp+ZTPQqjVE4En9XL5JEI4FjGE8FqQkxDVUIhqNERYFcxGamv65ocIoQdib12Ik5N5Wlu4IAVnoOjvJVTDqfsQfuO1bY2NG3E1aVkaQ3VbBgTKJZlYQLksnSuJ6xsA5L2pcQOP+XsIYcoH3lRIw2du8V+Mvh4E85I5i/BRaggh5PiI9FrenejHSg+dH4EqijsJ4WjGdaiGOtIdImzKoDawdbcZONe76bGUBSMfjUGr5Y7i76N1eullhHAwaxw2+ZdpKVXOZ4RtOer2WK1uciy84un3VcritMTPoZFbOF4I1a7c/mqzzGkpdY5qLUv+bQnhTzJq0AH8xbvZKkJ4yf1+mlC+nDP+aw0LNwSzETJwc6jh2+yB8j1r5Iue7muL8JZz186c8Xpo1Irg30htTd98i+qZXED97f1/nBB+yBt2pfvtZmfuK684vWbU4lp56dndAzFqMSHsbm5o5uCc52Dcg+KcUBfuCzWMuACnOMOidYfTBlcZFOftLy85sxMbhLDOO6DlCBF+4uDLseUPPuPd6GAaEQsJ4Q83Mc11PfK9gZ0c2YTqDfa7Raldyq3rlglvHOCUJqPKhNBndf+CzO0oimD4wlE06W7Qq5FM6kXtGeGR0Axc1bWvm9HOhYhrOB9ULQ5cw/7sYJzpHSOEHYRyM/ueBzcqi/IFaxSSUdCxLOeFHyOhgTdd5LcDMMW1gTtgh3j5JCnnbYX9ZQ08Swi/JxFOBjZEf1seLjdzlYz3Fu6P9sd1Ytpbd5gzpaVhpohQPh4FUCO6t9eKcCMhVBJDbUB8nA+2OJPEHXxu0mOaitXi2lxNP2KNXM1l2iK843Tb0pZrYEOSctyULMJXMWA1une4cHHQi1gjV2fo1fB+8hi1Gp50+h85fUMtn4vXqHsI1avZHpGyM26HxJVdGa8HwbxGE1KHOO9TYCV5uyvJx0NUD7COiwmv5YZTK4kLXQDGgTgiFvIj1v2e7LopWa0eZmp96uIuKPc7RtYnekI5EencU4vzvtGI5JZIF7tpOr7QLJ7to/xhgupTx8oujm7WV4riEmfsqP/YIC0/zD/dCGGRK3IHegZgG+33oO/LsAgPumifmFEvGpV0anxo+UUxs/0LmN2ejFMUXGlzWZSZi+s6G/lyBmiUMmVBq/6eb50IFxEuq7WSuDXICSF84FJwa34umtewngx8w608OBFCydeQho0nxEDQCQDfkGu9l6r/PYhOXzpdyD/VGsqNWs3dHgAAAABJRU5ErkJggg==",monochrome:!1},traex:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF9SURBVHgB7Zm9SsNQFMf/EYWiVB2KKGLBScHFN9BJurmoa0dn9QGqD1CdHbtWFzd10jfQQdBJqIgKGYw4VCR+nGD0ptqmsSectD0/CKXpbXJ+3HvOyYfVP5B+RxvTgzZHBaRRAWlUQBoVkEYFpOkNGzC0MgtJnPJZw99DBcZ2FiFJmIDmgDSdn8S1PB9d4aFwiDgY2cwhnZuK9J/IAq5TxevNI+Lg7amKqGgO/DrgYIplTNPnAyN9E8OYPF5FZmOu7hgKPrufZ+svkXOgHhR8di/vfWbW5719dvE0MMYPPjUz6m3E3doBWoFlBszgfUjCnAkzeB+6TGl1JuJNYuOJk/W1ccMiQGW1slwKlFe7eAJ7+2cJuZ8lsrJUwsvF/fc+us5JxBIiTIna4H1MCY7gCbYkJij464Xdhg3Jl3D/0bT+gj0HmummXMET2omlCc2By/GtwHeq3dO3BSQFXULSdN8dGdV6p3yOpGDpOzJhVEAaFZBGBaRRAWlUQJoPEeV5RYlN/QYAAAAASUVORK5CYII=",monochrome:!1}},e_="local",lF={starting:"Starting…",installing:"Installing…",updating:"Updating…",verifying:"Verifying installation…",complete:"Complete"};function cF(){const[e,t]=p.useState(null),[r,s]=p.useState(null),[n,l]=p.useState(!1),[c,d]=p.useState({}),m=p.useRef(0),h=p.useCallback(async(g=!1)=>{const x=++m.current;g&&l(!0),s(null);try{const y=await pe.listProviderClis(e_);x===m.current&&t(y)}catch(y){x===m.current&&(t(null),s(y instanceof Error?y.message:String(y)))}finally{x===m.current&&l(!1)}},[]);p.useEffect(()=>{h()},[h]);const v=async(g,x)=>{try{let y=(await pe.startProviderCliOperation(e_,g,x)).job;for(d(w=>({...w,[g]:y}));y.state==="running";)await gF(750),y=await pe.getProviderCliJob(e_,y.id),d(w=>({...w,[g]:y}));y.state==="succeeded"?(me.success(`${k2(g)} ${x} completed`),await h(),d(w=>{const S={...w};return delete S[g],S})):me.error(y.error??`${k2(g)} ${x} failed`)}catch(y){me.error(y.message),d(w=>{const S={...w};return delete S[g],S})}};return o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Providers"}),o.jsx("p",{className:"mt-1 max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Inspect and manage the coding-agent providers installed on this device."})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs(re,{variant:"outline",size:"sm",disabled:n,onClick:()=>void h(!0),children:[o.jsx(yt,{className:n?"animate-spin":""}),"Refresh"]})})]}),r&&o.jsxs("div",{className:"rounded-lg border border-[var(--destructive)]/35 bg-[var(--destructive)]/8 px-4 py-3 text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2 font-medium text-[var(--destructive)]",children:[o.jsx(Ci,{className:"size-4"})," Could not inspect Providers"]}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r}),o.jsxs(re,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void h(!0),children:[o.jsx(yt,{})," Retry"]})]}),e===null&&!r?o.jsx("div",{className:"grid gap-3","aria-label":"Loading Providers",children:[0,1,2].map(g=>o.jsx(dF,{},g))}):o.jsx("div",{className:"grid gap-3",children:e==null?void 0:e.providerClis.map(g=>o.jsx(uF,{provider:g,job:c[g.id],readOnly:e.management==="read_only",onOperation:v},g.id))})]})}function uF({provider:e,job:t,readOnly:r,onOperation:s}){const n=e.availability!=="installed"?e.canInstall?"install":void 0:e.updateState==="available"&&e.canUpdate?"update":void 0,l=(t==null?void 0:t.state)==="running";return o.jsx(Mt,{className:"min-w-0",children:o.jsxs(Ir,{className:"grid gap-3 p-4 text-xs",children:[o.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-3 md:col-span-2 xl:col-span-1",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--background)]",children:o.jsx("img",{src:C2[e.id].src,alt:"","aria-hidden":"true",className:Pe("size-full object-cover",C2[e.id].monochrome&&"brightness-0 dark:invert")})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx(Is,{children:e.name}),o.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--muted-foreground)]",children:e.binary})]})]}),o.jsx(t_,{icon:c6,label:"Executable",value:e.executablePath??"Not found on Runtime PATH",mono:!0}),o.jsx(t_,{icon:yt,label:"Version",value:mF(e),mono:!0,noWrap:!0}),o.jsx(t_,{icon:JO,label:"Authentication",value:pF(e)}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end",children:[o.jsx(hF,{provider:e}),!r&&n&&o.jsx(fF,{provider:e,operation:n,disabled:l,onConfirm:()=>s(e.id,n)})]})]}),e.error&&o.jsx("p",{className:"rounded-md bg-[var(--destructive)]/8 px-2.5 py-2 text-[11px] text-[var(--destructive)]",children:e.error}),t&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--muted)]/45 px-2.5 py-2 text-[11px]",children:[l?o.jsx(yt,{className:"size-3.5 animate-spin text-[var(--primary)]"}):t.state==="succeeded"?o.jsx(M0,{className:"size-3.5 text-[var(--success)]"}):o.jsx(Ci,{className:"size-3.5 text-[var(--destructive)]"}),o.jsx("span",{children:t.error??lF[t.stage]})]})]})})}function dF(){return o.jsxs("div",{"aria-hidden":"true",className:"grid animate-pulse gap-4 rounded-xl border border-[var(--border)] p-4 md:grid-cols-2 xl:grid-cols-[12rem_minmax(14rem,1.5fr)_minmax(8rem,0.65fr)_minmax(13rem,0.9fr)_11rem] xl:items-center",children:[o.jsxs("div",{className:"flex items-center gap-3 md:col-span-2 xl:col-span-1",children:[o.jsx("div",{className:"size-9 rounded-lg bg-[var(--muted)]"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"h-3.5 w-20 rounded bg-[var(--muted)]"}),o.jsx("div",{className:"h-2.5 w-12 rounded bg-[var(--muted)]"})]})]}),["w-full","w-24","w-32"].map((e,t)=>o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"h-2.5 w-16 rounded bg-[var(--muted)]"}),o.jsx("div",{className:`h-3 rounded bg-[var(--muted)] ${e}`})]},t)),o.jsxs("div",{className:"flex items-center gap-2 md:col-span-2 xl:col-span-1 xl:justify-end",children:[o.jsx("div",{className:"h-5 w-24 rounded-full bg-[var(--muted)]"}),o.jsx("div",{className:"h-8 w-24 rounded-md bg-[var(--muted)]"})]})]})}function hF({provider:e}){return e.availability==="missing"?o.jsx(Pt,{variant:"warning",children:"Not installed"}):e.availability==="broken"?o.jsx(Pt,{variant:"destructive",children:"Unavailable"}):e.updateState==="available"?o.jsx(Pt,{variant:"warning",children:"New version"}):o.jsx(Pt,{variant:"success",children:"Installed"})}function t_({icon:e,label:t,value:r,mono:s=!1,noWrap:n=!1}){return o.jsxs("div",{className:"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2",children:[o.jsx(e,{className:"mt-0.5 size-3.5 text-[var(--muted-foreground)]"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-[var(--muted-foreground)]",children:t}),o.jsx("div",{className:Pe("mt-0.5",s&&"font-mono text-[11px]",s&&!n&&"break-all",n&&"whitespace-nowrap"),children:r})]})]})}function fF({provider:e,operation:t,disabled:r,onConfirm:s}){const n=t==="install"?"Install":"Update";return o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsxs(re,{size:"sm",className:"w-full sm:w-auto",disabled:r,children:[r?o.jsx(yt,{className:"animate-spin"}):o.jsx(_d,{}),r?"Working…":n]})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:[n," ",e.name,"?"]}),o.jsxs(si,{children:["Rynx will run ",e.name,"'s official ",t," mechanism on this Runtime. The daemon will verify the executable and version when it finishes."]})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{onClick:()=>void s(),children:n})]})]})]})}function mF(e){return e.currentVersion?e.latestVersion?e.updateState==="available"?`${e.currentVersion} → ${e.latestVersion}`:`${e.currentVersion} · latest`:`${e.currentVersion} · latest unknown`:e.availability==="missing"?"—":"Unknown"}function pF(e){const t=e.authMode?` · ${e.authMode}`:"";return e.authState==="ready"?`Authenticated${t}`:e.authState==="required"?`Sign-in required${t}`:`Unknown${t}`}function k2(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"Traex"}function gF(e){return new Promise(t=>window.setTimeout(t,e))}function vF(e,t){if(e instanceof aa)switch(e.code){case"offer_expired":return"This Share Link has expired. Generate a new link on the remote Host and try again.";case"offer_rejected":return"The remote Host rejected this Share Link. It may already have been used, expired, or revoked. Generate a new link and use it once.";case"invalid_offer":return"This is not a valid Rynx Share Link. Copy and paste the complete link from the remote Host."}return`${t} failed: ${e instanceof Error?e.message:String(e)}`}function _F(){const{runtimeSelector:e,selectRuntime:t,updateRuntimes:r}=jc(),[s,n]=p.useState(null),[l,c]=p.useState(!1),[d,m]=p.useState(null),[h,v]=p.useState(null),[g,x]=p.useState({}),[y,w]=p.useState({});async function S(){try{const E=await pe.listRuntimes();n(E),r(E)}catch(E){n([]),me.error(`Failed to load Runtimes: ${E.message}`)}}p.useEffect(()=>{S()},[]);async function k(E){v(E.selector);try{const N=await pe.testRuntime(E.selector);x(R=>({...R,[E.selector]:N})),w(R=>{const T={...R};return delete T[E.selector],T}),me.success(`${E.displayName} is reachable`)}catch(N){x(T=>{const P={...T};return delete P[E.selector],P});const R={code:N instanceof aa?N.code:void 0,message:N.message};w(T=>({...T,[E.selector]:R})),me.error(R.code==="authentication_failed"?"Authorization is no longer valid. Generate a new Share Link on the remote host, then reauthorize this Runtime.":`Connection test failed: ${R.message}`)}finally{v(null)}}async function C(E){try{await pe.forgetRuntime(E.daemonId),x(N=>{const R={...N};return delete R[E.selector],R}),w(N=>{const R={...N};return delete R[E.selector],R}),me.success(`Forgot ${E.displayName}`),e===E.selector&&t("local"),await S()}catch(N){me.error(`Forget failed: ${N.message}`)}}return o.jsxs("div",{className:"grid gap-4",children:[o.jsx(xF,{}),o.jsxs(Mt,{children:[o.jsxs(Js,{className:"items-start",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsxs(Is,{children:["Runtimes"," ",o.jsx("span",{className:"ml-1 text-[var(--muted-foreground)]",children:(s==null?void 0:s.length)??0})]}),o.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Pair this Control Plane with remote Rynx daemons. Client keys stay in the local backend and never enter the browser."})]}),o.jsxs(re,{size:"sm",onClick:()=>c(!0),children:[o.jsx(Zr,{})," Add Runtime"]})]}),o.jsx(Ir,{className:"p-0",children:o.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[s===null&&o.jsx("div",{className:"px-5 py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Loading Runtimes…"}),s==null?void 0:s.map(E=>{const N=g[E.selector],R=y[E.selector],T=(R==null?void 0:R.code)==="authentication_failed";return o.jsxs("article",{className:"grid gap-3 px-5 py-4 transition-colors hover:bg-[var(--muted)]/35 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[o.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[o.jsx("div",{className:"mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:E.binding==="local"?o.jsx(EE,{className:"size-4"}):o.jsx(Nm,{className:"size-4"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h2",{className:"font-medium",children:E.displayName}),o.jsx(Pt,{variant:E.binding==="local"?"default":"outline",children:E.binding}),N&&o.jsxs(Pt,{variant:"success",children:[o.jsx(M0,{className:"mr-1 size-3"})," reachable"]}),T&&o.jsxs(Pt,{variant:"warning",children:[o.jsx(B0,{className:"size-3"})," authorization required"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-[var(--muted-foreground)]",children:E.daemonId}),E.endpoint&&o.jsx("div",{className:"mt-1 truncate text-xs text-[var(--muted-foreground)]",children:E.endpoint}),E.identityKeyFingerprint&&o.jsxs("div",{className:"mt-1 flex items-center gap-1.5 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:[o.jsx(Kf,{className:"size-3 shrink-0"}),E.identityKeyFingerprint]}),N&&o.jsxs("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:["Instance ",N.status.daemonInstanceId]})]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[E.binding==="direct"&&o.jsxs(re,{variant:"outline",size:"sm",onClick:()=>m(E),children:[o.jsx(Kf,{}),"Reauthorize"]}),o.jsxs(re,{variant:"outline",size:"sm",disabled:h===E.selector,onClick:()=>void k(E),children:[o.jsx(yt,{className:h===E.selector?"animate-spin":""}),"Test"]}),E.binding==="direct"&&o.jsx(CF,{target:E,onForget:()=>C(E)})]})]},E.selector)})]})})]}),o.jsx("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-4 py-3 text-xs text-[var(--muted-foreground)]",children:"Sessions, terminals, and Session-scoped resources follow the selected Runtime. The standalone Emulator manager in Settings controls This device only. A remote failure never falls back to this device."}),o.jsx(N2,{open:l,onOpenChange:c,onAdded:async E=>{x(N=>({...N,[E.target.selector]:E})),await S()}}),o.jsx(N2,{open:d!==null,target:d,onOpenChange:E=>{E||m(null)},onAdded:async E=>{x(N=>({...N,[E.target.selector]:E})),w(N=>{const R={...N};return delete R[E.target.selector],R}),await S()}})]})}const E2="__rynx_custom_share_address__";function xF(){const[e,t]=p.useState(null),[r,s]=p.useState(null),[n,l]=p.useState(null),[c,d]=p.useState(!1),[m,h]=p.useState(!1),[v,g]=p.useState(""),[x,y]=p.useState(!1),[w,S]=p.useState(""),[k,C]=p.useState(!1),[E,N]=p.useState(null),R=p.useRef(null),[T,P]=p.useState(null),[z,B]=p.useState(null),[F,Y]=p.useState(!1),[q,$]=p.useState(null),[M,U]=p.useState(null),W=p.useCallback(async(Z=!1)=>{Y(!0);try{P(await pe.listRuntimeAccess()),B(null),Z&&me.success("Shared access refreshed")}catch(ce){const le=ce.message;B(le),Z&&me.error(`Failed to refresh shared access: ${le}`)}finally{Y(!1)}},[]),A=p.useCallback(async(Z=!1)=>{d(!0);try{const ce=await pe.listRuntimeShareAddresses();t(ce),l(null),s(le=>(le==null?void 0:le.kind)==="custom"||le&&ce.some(we=>we.address===le.address)?le:ce[0]?{kind:"detected",address:ce[0].address}:null),Z&&me.success("Network addresses refreshed")}catch(ce){const le=ce.message;t(we=>we??[]),l(le),Z&&me.error(`Failed to refresh network addresses: ${le}`)}finally{d(!1)}},[]);p.useEffect(()=>{W(),A()},[W,A]);const O=(r==null?void 0:r.address)??"",L=w.trim(),G=E&&E.address===O.trim()&&E.clientLabel===L?E.code:"";function H(Z){if(Z===E2){g((r==null?void 0:r.kind)==="custom"?r.address:""),y(!1),h(!0);return}Z!==r_(r)&&e!=null&&e.some(ce=>ce.address===Z)&&s({kind:"detected",address:Z})}function D(){const Z=v.trim();if(!bF(Z)){y(!0);return}s({kind:"custom",address:Z}),h(!1),y(!1)}async function V(){const Z=O.trim();if(!Z){me.error("Choose an address that the other device can reach");return}C(!0);try{const ce=await pe.shareRuntime({address:Z,...L?{clientLabel:L}:{}});N({code:ce.pairingCode,address:Z,clientLabel:L}),me.success("Pairing link generated"),await W()}catch(ce){me.error(`Failed to generate pairing link: ${ce.message}`)}finally{C(!1)}}async function X(){if(!G)return;const Z=await tT(G,R.current);Z==="clipboard"||Z==="selection"?me.success("Pairing link copied"):Z==="selected"?me.info("Pairing link selected — press Ctrl+C or ⌘C to copy"):me.error("Copy is unavailable — select the pairing link and copy it manually")}async function J(Z){$(Z.grantId);try{const ce=await pe.revokeRuntimeAccess(Z.grantId);me.success(`Revoked ${Qu(Z)}${ce.closedConnections>0?` and closed ${ce.closedConnections} active connection${ce.closedConnections===1?"":"s"}`:""}`),await W()}catch(ce){me.error(`Revoke failed: ${ce.message}`)}finally{$(null)}}async function se(Z){U(Z.grantId);try{await pe.deleteRevokedRuntimeAccess(Z.grantId),me.success(`Removed revoked access record for ${Qu(Z)}`),await W()}catch(ce){me.error(`Remove failed: ${ce.message}`)}finally{U(null)}}const de=(T==null?void 0:T.filter(Z=>Z.revokedAt===null).length)??0;return o.jsxs(Mt,{children:[o.jsx(Js,{className:"items-start",children:o.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[o.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(Z6,{className:"size-4"})}),o.jsxs("div",{className:"grid gap-1",children:[o.jsx(Is,{children:"Share this device"}),o.jsx("p",{className:"max-w-2xl text-xs text-[var(--muted-foreground)]",children:"Generate a revocable pairing link so another Rynx Control Plane can connect to this Runtime. Use a LAN, Tailscale, or tunnel address reachable from that device."})]})]})}),o.jsxs(Ir,{className:"grid gap-6",children:[o.jsxs("form",{className:"grid gap-3",onSubmit:Z=>{Z.preventDefault(),V()},children:[o.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] md:items-end",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"runtime-share-address",children:"Connection address"}),o.jsxs("div",{className:"flex min-w-0 gap-1.5",children:[o.jsxs(Cn,{value:(r==null?void 0:r.kind)==="custom"?r_(r):r==null?void 0:r.address,onValueChange:H,disabled:e===null,children:[o.jsx(Yi,{id:"runtime-share-address",className:"min-w-0 flex-1","aria-describedby":"runtime-share-address-help",children:o.jsx(Gi,{placeholder:e===null?"Detecting addresses…":"No address detected",children:(r==null?void 0:r.kind)==="custom"?r.address:r?yF(e??[],r.address):void 0})}),o.jsxs(Ki,{align:"start",children:[(r==null?void 0:r.kind)==="custom"&&o.jsxs(fr,{value:r_(r),children:["Custom (",r.address,")"]}),e==null?void 0:e.map(Z=>o.jsx(fr,{value:Z.address,children:oT(Z)},Z.address)),((r==null?void 0:r.kind)==="custom"||!!(e!=null&&e.length))&&o.jsx(ep,{}),o.jsx(fr,{value:E2,children:"Enter custom address…"})]})]}),o.jsx(re,{type:"button",variant:"outline",size:"icon",disabled:c,"aria-label":"Refresh network addresses",title:"Refresh network addresses",onClick:()=>void A(!0),children:o.jsx(yt,{className:c?"animate-spin":""})})]})]}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"runtime-share-label",children:"Client label"}),o.jsx(bt,{id:"runtime-share-label",value:w,onChange:Z=>S(Z.target.value),placeholder:"Alice’s laptop (optional)",maxLength:128})]}),o.jsxs(re,{type:"submit",disabled:k||!r,children:[k?o.jsx(yt,{className:"animate-spin"}):o.jsx(i6,{}),"Generate Link"]})]}),o.jsx("p",{id:"runtime-share-address-help",className:n?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",role:n?"alert":void 0,children:n?`Could not refresh network addresses: ${n}`:(r==null?void 0:r.kind)==="custom"?"Using a custom host or ws(s) endpoint. Make sure the other device can reach it.":e!=null&&e.length?"Detected from this device. Tailnet addresses are listed first.":e===null?"Looking for reachable IPv4 interfaces on this device…":"No reachable IPv4 interface was found. Check the Runtime listener or enter a custom address."}),G&&o.jsxs("div",{className:"grid gap-1.5 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 p-3",children:[o.jsx(Xr,{htmlFor:"runtime-pairing-code",children:"Pairing link"}),o.jsxs("div",{className:"flex min-w-0 gap-2",children:[o.jsx(bt,{id:"runtime-pairing-code",ref:R,value:G,readOnly:!0,className:"font-mono text-xs",spellCheck:!1}),o.jsxs(re,{type:"button",variant:"outline",onClick:()=>void X(),children:[o.jsx(L0,{})," Copy"]})]}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Treat this link as a credential. After it is used, the client appears below and can be revoked."})]})]}),o.jsxs("section",{className:"grid gap-3 border-t border-[var(--border)] pt-4","aria-labelledby":"runtime-access-title",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("h2",{id:"runtime-access-title",className:"text-sm font-medium",children:["Shared access ",o.jsx("span",{className:"text-[var(--muted-foreground)]",children:de})]}),o.jsx("p",{className:"mt-0.5 text-xs text-[var(--muted-foreground)]",children:"Active clients can reconnect until their grant is revoked."})]}),o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",disabled:F,"aria-label":"Refresh shared access",onClick:()=>void W(!0),children:o.jsx(yt,{className:F?"animate-spin":""})})]}),T===null&&!z&&o.jsx("div",{className:"py-4 text-center text-xs text-[var(--muted-foreground)]",role:"status",children:"Loading shared access…"}),z&&o.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2",children:[o.jsxs("p",{className:"text-xs text-[var(--destructive)]",role:"alert",children:["Could not load shared access: ",z]}),o.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:()=>void W(),children:"Retry"})]}),(T==null?void 0:T.length)===0&&!z&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-center text-xs text-[var(--muted-foreground)]",children:"No shared Runtime access yet."}),T&&T.length>0&&o.jsx("ul",{className:"divide-y divide-[var(--border)] overflow-hidden rounded-lg border border-[var(--border)]",children:T.map(Z=>o.jsxs("li",{className:"grid gap-3 px-3 py-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium",children:Qu(Z)}),o.jsxs(Pt,{variant:Z.revokedAt?"destructive":"success",children:[Z.revokedAt?o.jsx(B0,{className:"size-3"}):o.jsx(Kf,{className:"size-3"}),Z.revokedAt?"revoked":"active"]})]}),o.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:Z.grantId}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:Z.lastUsedAt?`Last used ${R2(Z.lastUsedAt)}`:`Created ${R2(Z.createdAt)} · never connected`})]}),Z.revokedAt?o.jsx(SF,{client:Z,disabled:M===Z.grantId,onRemove:()=>se(Z)}):o.jsx(wF,{client:Z,disabled:q===Z.grantId,onRevoke:()=>J(Z)})]},Z.grantId))})]})]}),o.jsx(sn,{open:m,onOpenChange:Z=>{h(Z),Z||y(!1)},children:o.jsxs(Di,{className:"sm:max-w-md",children:[o.jsxs(An,{children:[o.jsx(Li,{children:"Enter custom address"}),o.jsx(vo,{children:"Use a DNS name, custom port, reverse proxy, or tunnel when the detected interfaces are not the route the other device should dial."})]}),o.jsxs("form",{className:"grid gap-4",onSubmit:Z=>{Z.preventDefault(),D()},children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"runtime-custom-share-address",children:"Host or WebSocket URL"}),o.jsx(bt,{id:"runtime-custom-share-address",value:v,onChange:Z=>{g(Z.target.value),Z.target.value.trim()&&y(!1)},placeholder:"runtime.example.com or wss://runtime.example.com",maxLength:2048,"aria-invalid":x,"aria-describedby":"runtime-custom-share-address-help",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,autoFocus:!0}),o.jsx("p",{id:"runtime-custom-share-address-help",className:x?"text-xs text-[var(--destructive)]":"text-xs text-[var(--muted-foreground)]",children:x?"Enter a host or a complete ws:// or wss:// URL without spaces.":"Rynx adds the listener port for a host and supplies the Runtime path."})]}),o.jsxs(ma,{children:[o.jsx($m,{asChild:!0,children:o.jsx(re,{type:"button",variant:"outline",children:"Cancel"})}),o.jsx(re,{type:"submit",disabled:!v.trim(),children:"Use Address"})]})]})]})})]})}function oT(e){return`${e.interfaceName} (${e.address})`}function yF(e,t){const r=e.find(s=>s.address===t);return r?oT(r):t}function r_(e){return(e==null?void 0:e.kind)==="custom"?`__rynx_custom_share_address_current__:${e.address}`:void 0}function bF(e){return e.length>0&&e.length<=2048&&!/[\s\u0000-\u001f\u007f]/.test(e)}function wF({client:e,disabled:t,onRevoke:r}){return o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"destructive",size:"sm",disabled:t,children:[t?o.jsx(yt,{className:"animate-spin"}):o.jsx(B0,{}),"Revoke"]})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:["Revoke access for “",Qu(e),"”?"]}),o.jsx(si,{children:"This client will no longer be able to reconnect. Any active Runtime connections using this grant are closed immediately."})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>void r(),children:"Revoke Access"})]})]})]})}function SF({client:e,disabled:t,onRemove:r}){return o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"outline",size:"sm",disabled:t,children:[t?o.jsx(yt,{className:"animate-spin"}):o.jsx(da,{}),"Remove Record"]})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:["Remove revoked record for “",Qu(e),"”?"]}),o.jsx(si,{children:"This removes the revoked authorization record from this Host. It does not restore access or delete the credential stored on the client device."})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>void r(),children:"Remove Record"})]})]})]})}function Qu(e){return e.clientLabel??e.clientId}function R2(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function N2({open:e,target:t=null,onOpenChange:r,onAdded:s}){const[n,l]=p.useState(""),[c,d]=p.useState(""),[m,h]=p.useState(!1),v=t!==null;p.useEffect(()=>{e&&(l((t==null?void 0:t.displayName)??""),d(""))},[e,t]);async function g(){const x=c.trim();if(x){h(!0);try{const y=await pe.pairRuntime({offer:x,...n.trim()?{displayName:n.trim()}:{},...t?{replaceExisting:!0,expectedDaemonId:t.daemonId}:{}});me.success(v?`Reauthorized ${y.target.displayName}`:`Paired ${y.target.displayName}`),await s(y),l(""),d(""),r(!1)}catch(y){me.error(vF(y,v?"Reauthorization":"Pairing"))}finally{h(!1)}}}return o.jsx(sn,{open:e,onOpenChange:r,children:o.jsxs(Di,{className:"sm:max-w-lg",children:[o.jsxs(An,{children:[o.jsx(Li,{children:v?"Reauthorize Runtime":"Add Runtime"}),o.jsx(vo,{children:v?"Generate a fresh Share Link on the remote Host and paste it here. The old local credential is replaced only after the new connection is authenticated.":"On the remote host, share the Runtime and paste its pairing link here. The local backend keeps the resulting client credential out of the browser."})]}),o.jsxs("form",{className:"grid gap-4",onSubmit:x=>{x.preventDefault(),g()},children:[o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"runtime-name",children:"Display name"}),o.jsx(bt,{id:"runtime-name",value:n,onChange:x=>l(x.target.value),placeholder:"Remote lab",maxLength:128})]}),o.jsxs("div",{className:"grid gap-1.5",children:[o.jsx(Xr,{htmlFor:"runtime-offer",children:"Pairing link"}),o.jsx(bt,{id:"runtime-offer",value:c,onChange:x=>d(x.target.value),placeholder:"rynx://pair?code=...",className:"font-mono text-xs",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),o.jsxs("p",{className:"text-xs text-[var(--muted-foreground)]",children:["Generate one from"," ",o.jsx("span",{className:"font-medium text-[var(--foreground)]",children:"Share this device"})," on the remote Control Plane."]})]})]}),o.jsxs(ma,{children:[o.jsx($m,{asChild:!0,children:o.jsx(re,{type:"button",variant:"outline",children:"Cancel"})}),o.jsxs(re,{type:"submit",disabled:m||!c.trim(),children:[m?o.jsx(yt,{className:"animate-spin"}):o.jsx(Kf,{}),v?"Reauthorize":"Add Runtime"]})]})]})]})})}function CF({target:e,onForget:t}){return o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsxs(re,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[o.jsx(da,{}),o.jsxs("span",{className:"sr-only",children:["Forget ",e.displayName]})]})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:["Forget “",e.displayName,"”?"]}),o.jsxs(si,{children:["Removes this route and its protected client credential from the local Control Plane. The remote grant remains until an operator runs ",o.jsx("code",{children:"rynx runtime clients revoke"}),"on that daemon."]})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>void t(),children:"Forget Runtime"})]})]})]})}function kF(e,t){return t==="install"||(e==null?void 0:e.phase)==="installing"}const EF="rynx.control.session-launch-selection.v2",lT="default";function RF(e){return`${e.kind}:${e.id}`}function NF(e){return e==="provider:claude"?{kind:"provider",id:"claude"}:e==="provider:codex"?{kind:"provider",id:"codex"}:e==="provider:traex"?{kind:"provider",id:"traex"}:e.startsWith("agent:")&&e.length>6?{kind:"agent",id:e.slice(6)}:null}function jF(e,t){return e.kind==="provider"?t.providers.some(r=>r.id===e.id):t.agents.some(r=>r.id===e.id)}function AF(e,t){const r=t?NF(t):null;if(r&&jF(r,e)&&(r.kind==="agent"&&e.agents.some(l=>l.id===r.id&&l.ready)||r.kind==="provider"&&e.providers.some(l=>l.id===r.id&&l.ready)))return r;for(const l of["claude","codex","traex"])if(e.providers.some(c=>c.id===l&&c.ready))return{kind:"provider",id:l};const s=e.providers.find(l=>l.ready);if(s)return{kind:"provider",id:s.id};const n=e.agents.find(l=>l.ready);return n?{kind:"agent",id:n.id}:e.providers[0]?{kind:"provider",id:e.providers[0].id}:e.agents[0]?{kind:"agent",id:e.agents[0].id}:null}function TF(e,t){if(!t)return null;try{return t.getItem(cT(e))}catch{return null}}function MF(e,t,r){if(t)try{t.setItem(cT(e),RF(r))}catch{}}function cT(e){return`${EF}:${encodeURIComponent(e)}`}function DF(e,t,r,s){const n=r?{projectId:r}:{},l=s!=null&&s.permissionPreset&&s.permissionPreset!==lT?{permissionPreset:s.permissionPreset}:{};return e.kind==="provider"?{provider:e.id,title:t,...n,...s!=null&&s.model?{model:s.model}:{},...s!=null&&s.reasoningEffort?{reasoningEffort:s.reasoningEffort}:{},...l}:{agent:e.id,title:t,...n,...l}}function j2(e,t,r=lT){var c,d,m,h;if(!e||e.kind!=="provider")return{permissionPreset:r};const s=t.providers.find(v=>v.id===e.id),n=((c=s==null?void 0:s.models)==null?void 0:c.find(v=>v.isDefault))??((d=s==null?void 0:s.models)==null?void 0:d[0]),l=n!=null&&n.defaultReasoningEffort&&n.reasoningOptions.some(v=>v.value===n.defaultReasoningEffort)?n.defaultReasoningEffort:((m=n==null?void 0:n.reasoningOptions.find(v=>v.value==="medium"))==null?void 0:m.value)??((h=n==null?void 0:n.reasoningOptions[0])==null?void 0:h.value);return{permissionPreset:r,...n?{model:n.id}:{},...l?{reasoningEffort:l}:{}}}function LF(e){const t=e.replace(/\s+/g," ").trim(),r=Array.from(t);return r.length<=64?t:`${r.slice(0,61).join("").trimEnd()}…`}function OF(e){return{providers:[],agents:e.map(t=>({...t,ready:!0,readiness:"unverified"}))}}function lf(e){return e.readiness==="unverified"?"unverified":e.ready?"ready":"needs_setup"}function ud(e){return e==="claude"?"Claude Code":e==="traex"?"Traex":"Codex"}function Sx(e,t){if(!e)return null;if(e.kind==="provider")return t.providers.find(s=>s.id===e.id)??null;const r=t.agents.find(s=>s.id===e.id);return r?{name:r.name??r.id,ready:r.ready,...r.reason?{reason:r.reason}:{},...r.readiness?{readiness:r.readiness}:{}}:null}const BF=LA,PF=p.forwardRef(({className:e,...t},r)=>o.jsx(OA,{ref:r,className:Pe("inline-flex h-9 items-center gap-1 rounded-lg bg-[var(--muted)] p-1 text-[var(--muted-foreground)]",e),...t}));PF.displayName="TabsList";const IF=p.forwardRef(({className:e,...t},r)=>o.jsx(BA,{ref:r,className:Pe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none data-[state=active]:bg-[var(--background)] data-[state=active]:text-[var(--foreground)] data-[state=active]:shadow-sm",e),...t}));IF.displayName="TabsTrigger";const Cx=p.forwardRef(({className:e,...t},r)=>o.jsx(PA,{ref:r,className:Pe("mt-4 focus-visible:outline-none",e),...t}));Cx.displayName="TabsContent";function ap(){return{items:[],byId:{},callIndex:{},interactionIndex:{},pendingOutputs:{},pendingInteractionResolutions:{},childStates:{},turns:{},runStatus:"idle",backgroundTaskCount:0,waitingForInteraction:!1,todos:[],historyLoaded:!1}}function zF(e,t){return e==="startup"&&t!==void 0&&(/^Starting MCP servers?:/i.test(t)||/^MCP startup /i.test(t))}function uT(e){return e.filter(t=>"text"in t).map(t=>t.text).join("")}function $F(e){var s;const t=e.data.content.flatMap((n,l)=>"text"in n?[l]:[]);return t.length!==1?!1:((s=e.truncations)==null?void 0:s.some(({field:n})=>n===`data.content[${t[0]}].text`))===!0}function dT(e){return e.flatMap((t,r)=>t.type==="input_image"?[{...t,partIndex:r}]:[])}function hT(e){return e.flatMap((t,r)=>t.type==="input_file"?[{...t,partIndex:r}]:[])}function kx(e){const t=e.slice();for(let r=1;r<t.length;r+=1){const s=t[r],n=t[r-1];s.type!=="reasoning"||s.data.model!=="traex"||n.type!=="message"||n.data.role!=="assistant"||n.data.model!=="traex"||n.responseId!==s.responseId||s.createdAt<n.createdAt||s.createdAt-n.createdAt>500||(t[r]=n,t[r-1]=s)}return t}function xn(e){return{...e,items:e.items.slice(),byId:{...e.byId},callIndex:{...e.callIndex},interactionIndex:{...e.interactionIndex},pendingOutputs:{...e.pendingOutputs},pendingInteractionResolutions:{...e.pendingInteractionResolutions},childStates:{...e.childStates},turns:{...e.turns}}}function fs(e,t,r){e.items[t]=r}function Xs(e,t){const r=e.items.length;return e.items.push(t),r}function A2(e,t){const r=ap();for(const s of kx(t))ro(r,s);for(const s of e.items){if(s.kind!=="message"||s.role!=="user"||!s.optimistic)continue;const n={...s,images:s.images.slice()};r.byId[n.id]=Xs(r,n)}return r}function T2(e,t,r){if(!r)return;const s=e.turns[t];e.turns[t]=s?{...s,model:s.model??r}:{status:"completed",model:r}}function fT(e){let t=0;for(const r of e)r.kind==="interaction"&&r.status==="pending"&&(t+=1),r.kind==="tool"&&r.children&&(t+=fT(r.children));return t}function Zo(e){e.waitingForInteraction=fT(e.items)>0||Object.values(e.childStates).some(t=>t.waitingForInteraction)}function mT(e){const t={...e,status:"pending"};return delete t.resolution,delete t.reason,delete t.resolvedAt,t}function Ex(e,t){return e.map(r=>r.kind==="interaction"?t.has(r.id)?mT(r):r.status==="pending"?{...r,status:"inactive"}:r:r.kind==="tool"&&r.children?{...r,children:Ex(r.children,t)}:r)}function Rx(e,t=new Set){for(const r of e)r.kind==="interaction"&&t.add(r.id),r.kind==="tool"&&r.children&&Rx(r.children,t);return t}function M2(e,t){const r=new Set(t.pendingInteractions.map(({interaction:l})=>l.interactionId));for(const[l,c]of Object.entries(e.childStates)){const d=xn(c);d.items=Ex(d.items,r),Zo(d),e.childStates[l]=d;const m=e.callIndex[l];if(m!==void 0){const h=e.items[m];fs(e,m,{...h,children:d.items})}}e.items=Ex(e.items,r);const s=Rx(e.items);for(const l of Object.values(e.childStates))Rx(l.items,s);for(const{responseId:l,interaction:c}of t.pendingInteractions){if(s.has(c.interactionId))continue;const d={kind:"interaction",id:c.interactionId,responseId:l,request:c,status:"pending"};e.interactionIndex[c.interactionId]=Xs(e,d),s.add(c.interactionId)}const n=new Set(t.activeResponseIds);for(const[l,c]of Object.entries(e.turns))n.has(l)||c.status==="running"&&(e.turns[l]={...c,status:"completed"},Df(e,l));FF(e,n);for(const l of n)e.turns[l]={...e.turns[l],status:"running"};e.runStatus=t.status,e.statusKind=t.statusKind,e.backgroundTaskCount=t.backgroundTaskCount??0,e.waitingForInteraction=r.size>0}function D2(e,t){return{...e,status:t.status,...t.resolution?{resolution:t.resolution}:{},...t.reason?{reason:t.reason}:{},resolvedAt:t.resolvedAt}}function L2(e,t,r,s){const n=e.byId[t];if(n!==void 0)return n;const l=Xs(e,s());return e.byId[t]=l,l}function ho(e,t){e.items.splice(t,1);for(const r of[e.byId,e.callIndex,e.interactionIndex])for(const[s,n]of Object.entries(r))n===t?delete r[s]:n>t&&(r[s]=n-1)}function O2(e,t){var r;if(t){const s=e.byId[t];if(s!==void 0&&((r=e.items[s])==null?void 0:r.kind)==="message"&&e.items[s].role==="user"&&e.items[s].optimistic)return s}return e.items.findIndex(s=>s.kind==="message"&&s.role==="user"&&s.optimistic)}function pT(e,t,r){var l;const s={kind:"message",id:t,responseId:t,role:"user",text:uT(r),images:dT(r),files:hT(r),streaming:!1,optimistic:!0,pendingContent:r.map(c=>({...c}))},n=e.byId[t];if(n!==void 0){((l=e.items[n])==null?void 0:l.kind)==="message"&&e.items[n].optimistic&&fs(e,n,s);return}e.byId[t]=Xs(e,s)}function UF(e,t,r){var c;const s=e.byId[t];if(s===void 0||((c=e.items[s])==null?void 0:c.kind)!=="message"||!e.items[s].optimistic)return!1;const n=e.byId[r];if(n!==void 0&&n!==s)return ho(e,s),!0;const l=e.items[s];return delete e.byId[t],fs(e,s,{...l,id:r,responseId:r}),e.byId[r]=s,!0}function B2(e){const t=r=>{if(Array.isArray(r))return r.map(t);if(r!==null&&typeof r=="object"){const s=r;return Object.fromEntries(Object.keys(s).sort().map(n=>[n,t(s[n])]))}return r};return JSON.stringify(t(e))}function P2(e,t,r=!1){const s=new Set(t.map(n=>n.pendingId));for(const n of t){if(e.byId[n.pendingId]===void 0){const l=B2(n.content),c=e.items.find(d=>d.kind==="message"&&d.role==="user"&&d.optimistic===!0&&!s.has(d.id)&&d.pendingContent!==void 0&&B2(d.pendingContent)===l);c&&UF(e,c.id,n.pendingId)}pT(e,n.pendingId,n.content)}if(r)for(let n=e.items.length-1;n>=0;n-=1){const l=e.items[n];(l==null?void 0:l.kind)==="message"&&l.role==="user"&&l.optimistic&&!s.has(l.id)&&ho(e,n)}}function HF(e,t,r){const s=xn(e.childStates[t]??ap());ro(s,{...r,parentToolCallId:void 0}),Zo(s),e.childStates[t]=s;const n=e.callIndex[t];if(n!==void 0){const l=e.items[n];fs(e,n,{...l,children:s.items})}}function ro(e,t,r,s=!1){var n;if(t.parentToolCallId){HF(e,t.parentToolCallId,t);return}switch(t.type){case"message":{T2(e,t.responseId,t.data.model);const l={kind:"message",id:t.id,responseId:t.responseId,role:t.data.role,text:uT(t.data.content),images:dT(t.data.content),files:hT(t.data.content),model:t.data.model,isMeta:t.data.isMeta,interrupted:t.data.interrupted,streaming:!1,...$F(t)?{textPrefixTruncated:!0}:{}},c=e.byId[t.id];if(c!==void 0){if(fs(e,c,l),s&&t.data.role==="user"){const d=O2(e,r);d!==-1&&d!==c&&ho(e,d)}return}if(s&&t.data.role==="user"){const d=O2(e,r);if(d!==-1){const m=e.items[d];delete e.byId[m.id],fs(e,d,l),e.byId[t.id]=d;return}}e.byId[t.id]=Xs(e,l);return}case"reasoning":{T2(e,t.responseId,t.data.model);const l={kind:"reasoning",id:t.id,responseId:t.responseId,summary:t.data.summary.map(d=>d.text),model:t.data.model,streaming:!1},c=e.byId[t.id];c!==void 0?fs(e,c,l):e.byId[t.id]=Xs(e,l);return}case"function_call":{const l=t.data.callId,c=e.pendingOutputs[l],d=(n=e.childStates[l])==null?void 0:n.items,m={kind:"tool",id:l,responseId:t.responseId,name:t.data.name,arguments:t.data.arguments,status:c?c.status??"completed":t.status,output:c==null?void 0:c.output,exitCode:c==null?void 0:c.exitCode,generatedImage:c==null?void 0:c.generatedImage,generatedImageItemId:c==null?void 0:c.generatedImageItemId,...d&&d.length?{children:d}:{}};c&&delete e.pendingOutputs[l];const h=e.callIndex[l];h!==void 0?fs(e,h,m):e.callIndex[l]=Xs(e,m);return}case"function_call_output":{const l=t.data.callId,c=e.callIndex[l];if(c===void 0){e.pendingOutputs[l]={output:t.data.output,status:t.data.status,exitCode:t.data.exitCode,generatedImage:t.data.generatedImage,generatedImageItemId:t.id};return}const d=e.items[c];fs(e,c,{...d,output:t.data.output,status:t.data.status??"completed",exitCode:t.data.exitCode,generatedImage:t.data.generatedImage,generatedImageItemId:t.id});return}case"terminal_command":{const l={kind:"terminal_command",id:t.id,responseId:t.responseId,command:t.data.command,...t.data.stdout?{stdout:t.data.stdout}:{},...t.data.stderr?{stderr:t.data.stderr}:{}},c=e.byId[t.id];c!==void 0?fs(e,c,l):e.byId[t.id]=Xs(e,l);return}case"interaction_request":{const l=t.data.interaction,c=l.interactionId,d=e.interactionIndex[c],m=e.pendingInteractionResolutions[c],h=d===void 0?void 0:e.items[d];let v={kind:"interaction",id:c,responseId:t.responseId,request:l,status:(h==null?void 0:h.status)??"pending",...h!=null&&h.resolution?{resolution:h.resolution}:{},...h!=null&&h.reason?{reason:h.reason}:{},...(h==null?void 0:h.resolvedAt)!==void 0?{resolvedAt:h.resolvedAt}:{}};m&&(v=D2(v,m),delete e.pendingInteractionResolutions[c]),d===void 0?e.interactionIndex[c]=Xs(e,v):fs(e,d,v),e.byId[t.id]=e.interactionIndex[c];return}case"interaction_resolution":{const l=t.data,c=e.interactionIndex[l.interactionId];if(c===void 0){e.pendingInteractionResolutions[l.interactionId]={...l,responseId:t.responseId,itemId:t.id};return}const d=e.items[c];fs(e,c,D2(d,l)),e.byId[t.id]=c;return}case"error":{const l={kind:"error",id:t.id,responseId:t.responseId,source:t.data.source,code:t.data.code,message:t.data.message},c=e.byId[t.id];c!==void 0?fs(e,c,l):e.byId[t.id]=Xs(e,l);return}}}function Df(e,t){const r=s=>s===t;um(e,r),e.items=Nx(e.items,t);for(const[s,n]of Object.entries(e.childStates)){const l=xn(n);um(l,r),l.items=Nx(l.items,t),Zo(l),e.childStates[s]=l;const c=e.callIndex[s];if(c!==void 0){const d=e.items[c];fs(e,c,{...d,children:l.items})}}}function FF(e,t){const r=s=>!t.has(s);um(e,r);for(const[s,n]of Object.entries(e.childStates)){const l=xn(n);um(l,r),Zo(l),e.childStates[s]=l;const c=e.callIndex[s];if(c!==void 0){const d=e.items[c];fs(e,c,{...d,children:l.items})}}}function um(e,t){for(let r=e.items.length-1;r>=0;r-=1){const s=e.items[r];(s==null?void 0:s.kind)==="message"&&t(s.responseId)&&s.role==="assistant"&&s.liveDraft===!0&&ho(e,r)}}function qF(e,t){const r=e.items.filter(s=>s.kind==="message"&&s.responseId===t&&s.role==="assistant"&&s.liveDraft!==!0);if(r.length!==0)for(let s=e.items.length-1;s>=0;s-=1){const n=e.items[s];(n==null?void 0:n.kind)==="message"&&n.responseId===t&&n.role==="assistant"&&n.liveDraft===!0&&r.some(l=>l.text===n.text||l.textPrefixTruncated===!0&&l.text.length>0&&n.text.startsWith(l.text))&&ho(e,s)}}function Nx(e,t){return e.map(r=>{const s=r.kind==="tool"&&r.children?{...r,children:Nx(r.children,t)}:r;return s.responseId!==t?s:s.kind==="tool"&&s.status==="in_progress"?{...s,status:"incomplete"}:(s.kind==="message"||s.kind==="reasoning")&&s.streaming?{...s,streaming:!1}:s.kind==="interaction"&&s.status==="pending"?{...s,status:"inactive",reason:"Turn ended before this interaction was resolved"}:s})}function s_(e){return Object.values(e.turns).some(t=>t.status==="running")}function gi(e){e.note=void 0,e.statusKind=void 0}function WF(e,t){var r,s;switch(t.type){case"session.status":{e.runStatus=t.status,t.runtimeSessionId&&(e.runtimeSessionId=t.runtimeSessionId),e.note=t.note,e.statusKind=t.statusKind,t.backgroundTaskCount!==void 0?e.backgroundTaskCount=t.backgroundTaskCount:(t.status==="running"||t.status==="failed")&&(e.backgroundTaskCount=0);return}case"session.collaboration_mode":e.collaborationMode=t.mode;return;case"response.created":{e.turns[t.responseId]={status:"running",model:t.model},e.runStatus="running",e.backgroundTaskCount=0,gi(e);return}case"response.output_text.delta":{gi(e);const n=e.byId[t.itemId],l=n===void 0?void 0:e.items[n];if(t.discard===!0){n!==void 0&&(l==null?void 0:l.kind)==="message"&&l.role==="assistant"&&l.responseId===t.responseId&&l.liveDraft===!0&&ho(e,n);return}const c=(r=e.turns[t.responseId])==null?void 0:r.status;if(c==="completed"||c==="failed"||c==="cancelled"||(l==null?void 0:l.kind)==="message"&&l.role==="assistant"&&l.liveDraft!==!0)return;const d=L2(e,t.itemId,t.responseId,()=>({kind:"message",id:t.itemId,responseId:t.responseId,role:"assistant",text:"",images:[],files:[],streaming:!0,liveDraft:!0})),m=e.items[d];e.items[d]={...m,text:m.text+t.delta,streaming:!0},t.final&&qF(e,t.responseId);return}case"response.reasoning_summary_text.delta":{gi(e);const n=L2(e,t.itemId,t.responseId,()=>({kind:"reasoning",id:t.itemId,responseId:t.responseId,summary:[],streaming:!0})),l=e.items[n],c=l.summary.slice();c[t.summaryIndex]=(c[t.summaryIndex]??"")+t.delta,e.items[n]={...l,summary:c,streaming:!0};return}case"response.function_call_output.delta":{gi(e);const n=e.callIndex[t.callId];if(n===void 0){const c=e.pendingOutputs[t.callId]??{output:""};e.pendingOutputs[t.callId]={...c,output:(c.output??"")+t.delta};return}const l=e.items[n];e.items[n]={...l,output:(l.output??"")+t.delta};return}case"session.interaction.requested":{gi(e),ro(e,t.item);const n=e.interactionIndex[t.interaction.interactionId];if(n!==void 0){const l=e.items[n];(l.status==="pending"||l.status==="inactive")&&fs(e,n,mT(l))}return}case"session.interaction.resolved":case"session.interaction.cancelled":{gi(e),ro(e,t.item);return}case"session.interrupted":{gi(e);const n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:"cancelled"};let l=!1;for(let c=e.items.length-1;c>=0;c-=1){const d=e.items[c];if((d==null?void 0:d.kind)==="message"&&d.role==="assistant"&&d.responseId===t.responseId){e.items[c]={...d,interrupted:!0,streaming:!1,liveDraft:!1},l=!0;break}}if(!l){const c=`interrupted_${t.responseId}`;e.byId[c]===void 0&&(e.byId[c]=Xs(e,{kind:"error",id:c,responseId:t.responseId,source:"execution",code:"response_stopped",message:"Response stopped"}))}Df(e,t.responseId),e.runStatus=s_(e)?"running":"idle";return}case"response.output_item.done":{gi(e);let n=t.item;if(n.type==="message"&&n.data.role==="assistant"&&((s=e.turns[t.responseId])==null?void 0:s.status)==="cancelled"){const l=e.byId[`interrupted_${t.responseId}`];l!==void 0&&ho(e,l),n={...n,data:{...n.data,interrupted:!0}}}ro(e,n);return}case"response.completed":{gi(e);const n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:(n==null?void 0:n.status)==="cancelled"?"cancelled":"completed",usage:t.usage},Df(e,t.responseId),!s_(e)&&e.runStatus!=="failed"&&(e.runStatus="idle");return}case"response.failed":{gi(e);const n=e.turns[t.responseId];e.turns[t.responseId]={...n,status:"failed"},e.items.some(c=>c.kind==="error"&&c.responseId===t.responseId&&c.code===t.error.code)||Xs(e,{kind:"error",id:`failed_${t.responseId}_${t.error.code}`,responseId:t.responseId,source:t.error.source,code:t.error.code,message:t.error.message}),Df(e,t.responseId),e.runStatus=s_(e)?"running":"idle";return}case"session.input.consumed":{gi(e),ro(e,t.item,t.clearedPendingId,!0);return}case"session.todos":{e.todos=t.todos;return}case"session.rotated":{Xs(e,{kind:"divider",id:`rotate_${t.newSessionId}`,responseId:`rotate_${t.newSessionId}`,label:t.kind==="fork"?"forked to a new session":"context cleared — new session",newSessionId:t.newSessionId,rotateKind:t.kind}),e.runStatus="idle",e.backgroundTaskCount=0,gi(e);return}}}function VF(e,t){var r;switch(t.kind){case"reset":return ap();case"snapshot":{const s=A2(e,t.items);return P2(s,t.pendingInputs??[]),M2(s,t.runtime),s.historyLoaded=!0,s}case"reconcile_snapshot":{const s=xn(e);for(const n of kx(t.items))ro(s,n);return P2(s,t.pendingInputs??[],t.pruneMissingPending),M2(s,t.runtime),s.historyLoaded=!0,s.error=void 0,s}case"history":{const s=A2(e,t.items);return Zo(s),s.historyLoaded=!0,s}case"reconcile_history":{const s=xn(e);for(const n of kx(t.items))ro(s,n);return Zo(s),s.historyLoaded=!0,s.error=void 0,s}case"event":{const s=xn(e);return WF(s,t.event),Zo(s),s}case"optimistic_user":{const s=xn(e);return pT(s,t.id,[...t.attachments??[],...t.text?[{type:"input_text",text:t.text}]:[]]),s}case"discard_optimistic_user":{const s=e.byId[t.id];if(s===void 0||((r=e.items[s])==null?void 0:r.kind)!=="message"||!e.items[s].optimistic)return e;const n=xn(e);return ho(n,s),n}case"stream_error":{const s=xn(e);return s.error=t.message,s}case"stream_done":return e}}function GF(e){let t;for(const r of e.items){const s=e.turns[r.responseId];s&&(t=s)}return t}function YF(e){let t=!1;const r=e.map(s=>s.kind!=="error"?s:s.code==="codex_error"&&s.message==="Codex turn was interrupted"||s.code==="traex_error"&&s.message==="Traex turn was interrupted"?(t=!0,{...s,code:"response_stopped",message:"Response stopped"}):s.code==="codex_error"&&s.message==="Codex turn failed"||s.code==="traex_error"&&s.message==="Traex turn failed"||s.code==="claude_error"&&s.message==="claude turn failed"?(t=!0,{...s,code:"agent_error",message:"Agent turn failed"}):s);return t?r:e}const jx="browser:",Ax="emulator:",I2=.44,Hu=360,KF=420;function XF(e){return e?e==="browser"?{type:"browser",pageId:null}:e.startsWith(jx)?{type:"browser",pageId:e.slice(jx.length).trim()||null}:e==="emulator"?{type:"emulator",bindingId:null}:e.startsWith(Ax)?{type:"emulator",bindingId:e.slice(Ax.length).trim()||null}:null:null}function gn(e){return e?`${jx}${e}`:"browser"}function vn(e){return e?`${Ax}${e}`:"emulator"}function z2(e,t){const r=new Set(t),s=new Set,n=[];for(const l of e)!r.has(l)||s.has(l)||(s.add(l),n.push(l));for(const l of t)s.has(l)||(s.add(l),n.push(l));return n}function cf(e,t){const r=Math.max(0,e),s=Math.max(0,r-KF),n=Math.min(Hu,s);return Math.min(s,Math.max(n,t))}function ZF(e,t,r){var s;return!e||e.pages.length===0?null:t&&e.pages.some(n=>n.pageId===t)?t:r&&e.pages.some(n=>n.pageId===r)?r:e.activePageId&&e.pages.some(n=>n.pageId===e.activePageId)?e.activePageId:((s=e.pages[0])==null?void 0:s.pageId)??null}function QF(e,t){return!e||!(t!=null&&t.activePageId)||e.includes(t.activePageId)?null:t.pages.some(r=>r.pageId===t.activePageId)?t.activePageId:null}const JF=512,Tx=32,eq=128,tq=8*1024,rq=24*1024,Iy="desktop-direct-view",sq=/^[A-Za-z0-9][A-Za-z0-9._~-]*$/,iq=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,nq=/^[\x20-\x7e]*$/,aq=new Set(["accept-encoding","authorization","connection","content-length","cookie","host","keep-alive","origin","proxy-authenticate","proxy-authorization","proxy-connection","referer","set-cookie","te","trailer","transfer-encoding","upgrade","user-agent"]);function oq(e){const t=gT(e,["sessionId","expectedRevision","enabled","headers"],"browser.request-headers.set params");return{sessionId:$2(t.sessionId,"browser.request-headers.set sessionId"),expectedRevision:$2(t.expectedRevision,"browser.request-headers.set expectedRevision"),...lq(t,"browser.request-headers.set params")}}function lq(e,t){const r=uq(e.enabled,`${t} enabled`);if(!Array.isArray(e.headers))throw Bs(`${t} headers must be an array`);if(e.headers.length>Tx)throw Bs(`${t} headers exceeds ${Tx} entries`);const s=new Set,n=e.headers.map((c,d)=>{const m=gT(c,["name","value"],`${t} headers[${d}]`),h=vT(m.name,`${t} headers[${d}] name`,eq);if(!iq.test(h))throw Bs(`${t} headers[${d}] name is not an HTTP header token`);const v=h.toLowerCase();if(aq.has(v)||v.startsWith("proxy-")||v.startsWith("sec-"))throw Bs(`${t} headers[${d}] name is controlled by the Browser`);if(s.has(v))throw Bs(`${t} headers contains duplicate names`);if(s.add(v),typeof m.value!="string")throw Bs(`${t} headers[${d}] value must be a string`);if(m.value.length>tq)throw Bs(`${t} headers[${d}] value is too long`);if(!nq.test(m.value))throw Bs(`${t} headers[${d}] value must be printable ASCII`);return{name:h,value:m.value}}),l={enabled:r,headers:n};if(new TextEncoder().encode(JSON.stringify(l)).byteLength>rq)throw Bs(`${t} exceeds its serialized byte limit`);return l}function gT(e,t,r){const s=cq(e,r),n=new Set(t);for(const l of Object.keys(s))if(!n.has(l))throw Bs(`${r} contains unknown field ${l}`);return s}function cq(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw Bs(`${t} must be an object`);return e}function $2(e,t){const r=vT(e,t,JF);if(!sq.test(r))throw Bs(`${t} must be an opaque ASCII token`);return r}function vT(e,t,r){if(typeof e!="string"||e.length===0||e.length>r)throw Bs(`${t} must be a non-empty string of at most ${r} characters`);return e}function uq(e,t){if(typeof e!="boolean")throw Bs(`${t} must be a boolean`);return e}function Bs(e){return new TypeError(`Invalid Runtime Browser protocol: ${e}`)}const dq=4,hq=5*1024*1024,fq=20*1024*1024,mq=8192,pq=4e7,gq=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml"];function vq(){return{enabled:!0,mediaTypes:[...gq],maxImagesPerMessage:dq,maxImageBytes:hq,maxMessageBytes:fq,maxImageSide:mq,maxImagePixels:pq}}new TextEncoder;new TextEncoder;function _q(e,t){const r=new Map;for(const s of t)s.type==="interaction_request"&&r.set(s.data.interaction.interactionId,s);return{status:e.status,...e.statusKind===void 0?{}:{statusKind:e.statusKind},...e.backgroundTaskCount===void 0?{}:{backgroundTaskCount:e.backgroundTaskCount},activeResponseIds:[...e.activeResponseIds],pendingInteractions:e.pendingInteractions.flatMap(s=>{const n=r.get(s.interactionId);return!n||n.responseId!==s.responseId?[]:[{responseId:s.responseId,interaction:n.data.interaction}]})}}const xq={"status.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:null},"provider.cli.status.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.provider-cli.status.v1"},"project.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.update":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"project.delete":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.project.manage.v1"},"emulator.devices.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.active.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.attach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.tap":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.type":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.button":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.rotate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.launch":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.gesture":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.kill":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"emulator.shutdown":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.emulator.unary.v1"},"session.emulator.state.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.devices.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.attach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.detach":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.tap":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.type":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.button":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.rotate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.launch":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.emulator.gesture":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.emulator.v1"},"session.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.list.v1"},"session.agentOptions.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.agent-options.v1"},"session.launchOptions.list":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.launch-options.v2"},"session.execution.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.execution-settings.v1"},"session.execution.update":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.execution-settings.v1"},"session.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.create.v1"},"session.fork":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.fork.v1"},"session.message.send":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.message.v1"},"session.resource.policy.get":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.resource.upload.begin":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.resource.upload.chunk":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.resource.upload.commit":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.resource.get":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.resource.read":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.resource.delete":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.resources.v2"},"session.file.get":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.files.v1"},"session.file.read":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.files.v1"},"session.workspace.file.get":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.workspace-files.v1"},"session.workspace.file.read":{retryPolicy:"safe",introducedCoreVersion:2,requiredSemanticCapability:"semantic.session.workspace-files.v1"},"session.message.enqueue":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.message-queue.v1"},"session.terminal.start":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.terminal-start.v1"},"session.delete":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.delete.v1"},"session.snapshot.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.snapshot.v1"},"session.interrupt":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.interrupt.v1"},"session.interaction.resolve":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.session.interaction.v1"},"browser.state.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.request-headers.get":{retryPolicy:"safe",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.request-headers.v1"},"browser.request-headers.set":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.request-headers.v1"},"browser.open":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.close":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.create":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.close":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.activate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.navigate":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.back":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.forward":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"},"browser.page.reload":{retryPolicy:"never",introducedCoreVersion:1,requiredSemanticCapability:"semantic.browser.v1"}};new Set(Object.keys(xq));new TextEncoder;let i_=0;function xc(e){const t=globalThis.crypto;if(typeof(t==null?void 0:t.randomUUID)=="function")return`${e}_${t.randomUUID()}`;if(typeof(t==null?void 0:t.getRandomValues)=="function"){const r=t.getRandomValues(new Uint8Array(16));return`${e}_${Array.from(r,s=>s.toString(16).padStart(2,"0")).join("")}`}return i_=i_+1>>>0,`${e}_${Date.now().toString(36)}_${i_.toString(36)}`}const yq=256,bq=4*1024*1024;function wq(e,t,r,s){return e||(r?t:s)}function Sq(e){return e.type==="response.created"||e.type==="session.input.consumed"}function U2(e,t,r){return r&&e!==null&&t===e}function Cq(e,t){return e&&t}function kq(e){const t=Object.entries(e);for(let r=t.length-1;r>=0;r-=1){const s=t[r];if((s==null?void 0:s[1].status)==="running")return s[0]}}function Eq(e,{runtimeSelector:t,allowSend:r=!0}={}){const[s,n]=p.useReducer(VF,void 0,ap),[l,c]=p.useState(!1),[d,m]=p.useState(!1),h=p.useRef(null),v=p.useRef(0),g=p.useRef(null),x=p.useRef(null);p.useEffect(()=>{if(n({kind:"reset"}),g.current=null,x.current=null,c(!1),m(!1),!e)return;const S=new AbortController;let k=!1,C=!0,E;return(async()=>{let R=500;for(;!S.signal.aborted;){const T=new AbortController,P=()=>T.abort();S.signal.addEventListener("abort",P,{once:!0});let z=!1,B=!1,F=!1;const Y={events:[],utf8Bytes:0};let q,$;const M=new Promise((A,O)=>{q=A,$=O}),U=pe.streamSession(e,A=>{if(!(k||T.signal.aborted))if(A.event==="ready"){const O=Nq(E,A.data);E=O.daemonInstanceId,O.changed&&(C=!0,n({kind:"reset"}),m(!1)),q()}else if(A.event==="event"){const O=A.data,L=g.current;L!==null&&Sq(O)&&(x.current=L,U2(g.current,x.current,z)&&(g.current=null,x.current=null,c(!1))),z?n({kind:"event",event:O}):Rq(Y,O)||(F=!0,T.abort())}else A.event==="error"&&n({kind:"stream_error",message:String(A.data.message??"stream error")})},T.signal,t).then(()=>($(new Error("session stream closed before ready")),{error:void 0})).catch(A=>($(A),{error:A}));try{await M,R=500;let A=500,O,L=0;const G=[];let H=[];for(;;){const D=new AbortController,V=()=>D.abort();T.signal.addEventListener("abort",V,{once:!0}),T.signal.aborted&&D.abort();const X=t?pe.getSessionSnapshotPage(e,O,D.signal,t).then(Z=>({kind:"snapshot_page",page:Z})).catch(Z=>({kind:"snapshot_error",error:Z})):pe.getSessionSnapshot(e,D.signal).then(Z=>({kind:"snapshot",snapshot:Z})).catch(Z=>({kind:"snapshot_error",error:Z})),J=await Promise.race([X,U.then(()=>({kind:"stream_ended"}))]);if(T.signal.removeEventListener("abort",V),J.kind==="stream_ended"){D.abort();break}if(k||S.signal.aborted)return;if(F)break;if(J.kind==="snapshot_page"){const{page:Z}=J;if(Z.sessionId!==e||Z.hasMore&&(!Z.nextAfterId||Z.nextAfterId===O)){n({kind:"stream_error",message:"Session snapshot page did not advance"}),T.abort();break}if(G.push(...Z.items),H=Z.pendingInputs??[],n({kind:C&&L===0?"history":"reconcile_history",items:Z.items}),L+=1,A=500,Z.hasMore){O=Z.nextAfterId;continue}n({kind:"reconcile_snapshot",items:[],pendingInputs:H,pruneMissingPending:!C,runtime:_q(Z.runtime,G)}),B=!0,C=!1;break}if(J.kind==="snapshot"){const{snapshot:Z}=J;n({kind:C?"snapshot":"reconcile_snapshot",items:Z.items,pendingInputs:Z.pendingInputs??[],...C?{}:{pruneMissingPending:!0},runtime:Z.runtime}),B=!0,C=!1;break}const{error:se}=J;n({kind:"stream_error",message:se instanceof Error?se.message:String(se)});const de=await Promise.race([U.then(()=>"stream_ended"),H2(A,S.signal).then(()=>"retry")]);if(S.signal.aborted)return;if(de==="stream_ended")break;A=Math.min(A*2,8e3)}}catch(A){!k&&!S.signal.aborted&&!F&&n({kind:"stream_error",message:A instanceof Error?A.message:String(A)})}finally{if(F||(z=!0),!k&&!S.signal.aborted&&!F){for(const A of Y.events.splice(0))n({kind:"event",event:A});Y.utf8Bytes=0,B&&(m(!0),U2(g.current,x.current,!0)&&(g.current=null,x.current=null,c(!1)))}}const W=await U;if(k||m(!1),S.signal.removeEventListener("abort",P),T.abort(),S.signal.aborted)return;W.error,await H2(R,S.signal),R=Math.min(R*2,8e3)}})(),()=>{k=!0,S.abort()}},[t,e]);const y=p.useCallback(async S=>{if(!e||!r)return;const k=typeof S=="string"?S:S.text,C=typeof S=="string"?[]:S.attachments,E=typeof S=="string"?xc("msg"):S.clientMessageId??xc("msg"),N=new AbortController,R=++v.current;h.current=N,g.current=R,x.current=null,c(!0);const T=E;n({kind:"optimistic_user",id:T,text:k,attachments:C});try{await pe.sendSessionMessage(e,{content:[...C,...k?[{type:"input_text",text:k}]:[]],clientMessageId:E},()=>{},N.signal,t)}catch(P){throw N.signal.aborted||(ip(P)&&n({kind:"discard_optimistic_user",id:T}),n({kind:"stream_error",message:P.message})),g.current===R&&(g.current=null,x.current=null,c(!1)),P}finally{h.current===N&&(h.current=null)}},[r,t,e]),w=p.useCallback(async()=>{var k;if((k=h.current)==null||k.abort(),g.current=null,x.current=null,c(!1),!e)return;const S=kq(s.turns);S&&n({kind:"event",event:{type:"session.interrupted",sessionId:e,responseId:S}});try{await pe.interruptSession(e,t)}catch{}},[t,e,s.turns]);return p.useEffect(()=>{if(!l)return;if(Cq(d,s.runStatus==="running"||s.waitingForInteraction)){g.current=null,x.current=null,c(!1);return}const S=g.current,k=window.setTimeout(()=>{g.current===S&&(g.current=null,x.current=null,c(!1))},15e3);return()=>window.clearTimeout(k)},[d,l,s.runStatus,s.waitingForInteraction]),{state:s,pendingSend:l,current:d,send:y,stop:w}}function Rq(e,t,r={}){const s=r.events??yq,n=r.utf8Bytes??bq;let l;try{l=new TextEncoder().encode(JSON.stringify(t)).byteLength}catch{return!1}return e.events.length>=s||l>n||e.utf8Bytes+l>n?!1:(e.events.push(t),e.utf8Bytes+=l,!0)}function Nq(e,t){const r=t&&typeof t=="object"&&!Array.isArray(t)?t.daemonInstanceId:void 0;return typeof r!="string"||r.length===0?{daemonInstanceId:e,changed:!1}:{daemonInstanceId:r,changed:e!==void 0&&e!==r}}function H2(e,t){return t.aborted?Promise.resolve():new Promise(r=>{const s=window.setTimeout(n,e);t.addEventListener("abort",n,{once:!0});function n(){window.clearTimeout(s),t.removeEventListener("abort",n),r()}})}const jq=1,F2=32*1024,q2=4*1024*1024,Aq=4096,Tq=4096,Mq=8847360,Dq=4*1024,Mx=512,Lq=1024,W2=new Uint8Array([82,66,83,70]),Jl=38,Oq=1,Bq=2,dm=new TextEncoder,Pq=new TextDecoder("utf-8",{fatal:!0});function Iq(e){const t=$q(e);switch(t.type){case"browser.surface.ready":{n_(t,["type","subscriptionId","browserGeneration","viewportRevision","sourceWidth","sourceHeight","deviceScaleFactor","format","grantedRole"],"Browser Surface ready frame");const r=hm(t.sourceWidth,"sourceWidth"),s=hm(t.sourceHeight,"sourceHeight");return _T(r,s),{type:"browser.surface.ready",subscriptionId:Fu(t.subscriptionId,"subscriptionId"),browserGeneration:V2(t.browserGeneration,"browserGeneration"),viewportRevision:Fq(t.viewportRevision,"viewportRevision"),sourceWidth:r,sourceHeight:s,deviceScaleFactor:Wq(t.deviceScaleFactor,.25,8,"deviceScaleFactor"),format:Vq(t.format),grantedRole:Lf(t.grantedRole,["view","control"],"grantedRole")}}case"browser.surface.driver.changed":{n_(t,["type","subscriptionId","browserGeneration","driver","driverSubscriptionId"],"driver changed frame",!0);const r=Lf(t.driver,["none","desktop","stream"],"driver"),s=t.driverSubscriptionId===void 0?void 0:Fu(t.driverSubscriptionId,"driverSubscriptionId");if(r==="stream"!=(s!==void 0))throw rr("driverSubscriptionId is required only when driver is stream");return{type:"browser.surface.driver.changed",subscriptionId:Fu(t.subscriptionId,"subscriptionId"),browserGeneration:V2(t.browserGeneration,"browserGeneration"),driver:r,...s===void 0?{}:{driverSubscriptionId:s}}}case"browser.surface.closed":{n_(t,["type","subscriptionId","reason","message"],"Browser Surface closed frame",!0);const r=t.message===void 0?void 0:Hq(t.message,"message",Lq);return{type:"browser.surface.closed",subscriptionId:Fu(t.subscriptionId,"subscriptionId"),reason:Lf(t.reason,["browser_closed","page_closed","generation_changed","replaced","cancelled","unauthorized","unsupported","capacity","idle_timeout","protocol_error","internal_error"],"reason"),...r===void 0?{}:{message:r}}}default:throw rr("unknown Browser Surface server frame type")}}function zq(e){if(!(e instanceof Uint8Array)||e.byteLength<Jl+1||e.byteLength>Jl+Mx+q2)throw rr("Browser Surface image frame has an invalid byte length");for(let x=0;x<W2.length;x+=1)if(e[x]!==W2[x])throw rr("Browser Surface image frame has invalid magic");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint8(4)!==jq||t.getUint16(6,!1)!==0)throw rr("Browser Surface image frame header is unsupported");const r=t.getUint8(5),s=r===Oq?"jpeg":r===Bq?"png":void 0;if(s===void 0)throw rr("Browser Surface image frame format is unsupported");const n=t.getUint16(32,!1),l=t.getUint32(34,!1);if(n===0||n>Mx||l===0||l>q2||Jl+n+l!==e.byteLength)throw rr("Browser Surface image frame lengths are invalid");let c;try{c=Pq.decode(e.subarray(Jl,Jl+n))}catch{throw rr("subscriptionId must be valid UTF-8")}c=Fu(c,"subscriptionId");const d=G2(t.getBigUint64(8,!1),"frameSequence"),m=t.getUint32(16,!1),h=G2(t.getBigUint64(20,!1),"timestampMilliseconds"),v=hm(t.getUint16(28,!1),"width"),g=hm(t.getUint16(30,!1),"height");return _T(v,g),{subscriptionId:c,frameSequence:d,viewportRevision:m,timestampMilliseconds:h,width:v,height:g,format:s,encodedBytes:new Uint8Array(e.subarray(Jl+n))}}function $q(e){let t=e;if(typeof e=="string"){if(dm.encode(e).byteLength>F2)throw rr("Browser Surface control frame exceeds its byte limit");try{t=JSON.parse(e)}catch{throw rr("Browser Surface control frame must be valid JSON")}}const r=Uq(t,"Browser Surface control frame");let s;try{s=JSON.stringify(r)}catch{throw rr("Browser Surface control frame must be serializable")}if(dm.encode(s).byteLength>F2)throw rr("Browser Surface control frame exceeds its byte limit");return r}function Uq(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw rr(`${t} must be an object`);return e}function n_(e,t,r,s=!1){const n=Object.keys(e),l=s?t.length-1:t.length;if(n.length<l||n.length>t.length||n.some(c=>!t.includes(c))||t.slice(0,l).some(c=>!Object.hasOwn(e,c)))throw rr(`${r} contains unknown or missing fields`)}function Fu(e,t){if(typeof e!="string"||e.length===0||dm.encode(e).byteLength>Mx||!/^[\x21-\x7e]+$/.test(e))throw rr(`${t} must be a bounded opaque identifier`);return e}function Hq(e,t,r){if(typeof e!="string"||e.includes("\0")||dm.encode(e).byteLength>r)throw rr(`${t} exceeds its text byte limit`);return e}function V2(e,t){if(!Number.isSafeInteger(e)||e<1)throw rr(`${t} must be a positive safe integer`);return e}function Fq(e,t){if(!Number.isSafeInteger(e)||e<0)throw rr(`${t} must be a nonnegative safe integer`);return e}function qq(e,t,r,s){if(!Number.isInteger(e)||e<t||e>r)throw rr(`${s} must be an integer from ${t} to ${r}`);return e}function Wq(e,t,r,s){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>r)throw rr(`${s} must be a finite number from ${t} to ${r}`);return e}function hm(e,t){const r=t.toLowerCase().includes("height")?Tq:Aq;return qq(e,1,r,t)}function _T(e,t){if(e*t>Mq)throw rr("Browser Surface viewport exceeds its maximum pixels")}function Vq(e){return Lf(e,["jpeg","png"],"format")}function Lf(e,t,r){if(typeof e!="string"||!t.includes(e))throw rr(`${r} is unsupported`);return e}function G2(e,t){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw rr(`${t} exceeds a safe integer`);return Number(e)}function rr(e){return new TypeError(`Invalid Runtime Browser Surface: ${e}`)}const Y2=1e4,Gq=16,a_=1,K2=[500,1e3,2e3,4e3,8e3,15e3];function Yq(e){const t=Math.max(0,Math.min(Math.trunc(e),K2.length-1));return K2[t]}function Kq(e){return e===1e3||e===1001||e===1006||e===1012||e===4408}function Xq(e){return e==="browser_closed"||e==="generation_changed"||e==="cancelled"||e==="capacity"||e==="idle_timeout"||e==="internal_error"}function xT(e){const t=e.trim();if(t)return/^[A-Za-z][A-Za-z\d+.-]*:/.test(t)?t:`https://${t}`}function uf(e){return!(e instanceof Error)||!e.message?"Browser operation failed":e.message==="failed_precondition"?"Browser Host is unavailable. On a headless Runtime, run `rynx browser install` on that host.":e.message.replaceAll("_"," ")}function Zq(e,t,r){return r&&e==="local"&&t.executionBackend==="embedded-electron"&&t.capabilities.includes(Iy)}function Qq(e,t,r){return!r||e!=="local"?!1:t.status==="unavailable"?!0:t.status==="ready"&&t.executionBackend==="headless-chromium"}function Jq(e,t,r){return r&&e==="local"&&t.status==="ready"&&t.executionBackend==="embedded-electron"&&!t.capabilities.includes(Iy)}async function eW(e,t){var l,c,d,m;const r=e.pages.findIndex(h=>h.pageId===e.activePageId);await t.close(e.browserGeneration);let s=await t.open((l=e.pages[0])==null?void 0:l.url);(c=t.onProgress)==null||c.call(t,s);for(const h of e.pages.slice(1))s=await t.createPage(s.browserGeneration,h.url),(d=t.onProgress)==null||d.call(t,s);const n=r>=0?s.pages[r]:void 0;return n&&s.activePageId!==n.pageId&&(s=await t.activatePage(s.browserGeneration,n.pageId),(m=t.onProgress)==null||m.call(t,s)),s}function tW({scrollLeft:e,viewportWidth:t,contentWidth:r,availableWidth:s=t}){const n=Math.max(0,r-t),l=r-s>a_;return{hasOverflow:l,canScrollLeft:l&&e>a_,canScrollRight:l&&e<n-a_}}function rW(e){return Math.max(120,e*.75)}function sW({scrollLeft:e,viewportWidth:t,tabLeft:r,tabWidth:s,inset:n=4}){const l=e,c=e+t,d=Math.max(0,r-n),m=r+s+n;return d<l?d-l:m>c?m-c:0}function iW(e,t,r,s){return{deltaX:X2(e+r),deltaY:X2(t+s)}}function X2(e){return Number.isFinite(e)?Math.max(-Y2,Math.min(Y2,e)):0}function nW(e){if(!e)return[];const t=new TextEncoder,r=[];let s="",n=0;for(const l of e){const c=t.encode(l).byteLength;if(n+c>Dq){if(r.push(s),r.length>=Gq)throw new RangeError("Browser text input is too large");s="",n=0}s+=l,n+=c}return s&&r.push(s),r}function aW(e,t){if(t.type==="pointerdown"){const s=Z2(t.button);return s&&e.set(t.pointerId,s),s}const r=e.get(t.pointerId);return e.delete(t.pointerId),r??Z2(t.button)}function Z2(e){if(e===0)return"left";if(e===1)return"middle";if(e===2)return"right";if(e===3)return"back";if(e===4)return"forward"}const oW=1,lW=2;function cW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:s,toolbarHost:n,readOnly:l=!1}){const c=p.useRef(null),d=p.useRef(null),m=p.useRef(void 0),h=p.useRef(void 0),v=p.useRef(0),g=p.useRef(0),x=p.useRef(0),y=p.useRef(0),w=p.useRef(void 0),S=p.useRef(!1),k=p.useRef(!1),C=p.useRef(!1),E=p.useRef(void 0),N=p.useRef(void 0),R=p.useRef(void 0),T=p.useRef(new Map),[P,z]=p.useState("connecting"),[B,F]=p.useState(),[Y,q]=p.useState(),[$,M]=p.useState("none"),[U,W]=p.useState(),[A,O]=p.useState(!1),[L,G]=p.useState(!1),H=$==="stream"&&U===(Y==null?void 0:Y.subscriptionId),D=p.useCallback(()=>{R.current!==void 0&&(window.cancelAnimationFrame(R.current),R.current=void 0),E.current=void 0,N.current=void 0,T.current.clear()},[]),V=p.useCallback(()=>{w.current!==void 0&&(window.clearTimeout(w.current),w.current=void 0)},[]),X=p.useCallback(async({refreshCapability:_e=!1,preserveFrame:ye=!1}={})=>{var pt;V();const Ie=++x.current;(pt=m.current)==null||pt.close(1e3,"Browser Surface reconnecting"),m.current=void 0,h.current=void 0,v.current=0,g.current=0,C.current=!1,k.current=!1,D(),z("connecting"),F(void 0),q(void 0),M("none"),W(void 0),G(!1),ye||(S.current=!1,O(!1));const ze=rt=>{if(x.current!==Ie)return;F(rt),z("connecting");const $e=Yq(y.current++);w.current=window.setTimeout(()=>{w.current=void 0,X({preserveFrame:!0})},$e)};try{const rt=await cd(_e);if(x.current!==Ie)return;const $e=new WebSocket(hW({runtimeSelector:e,sessionId:t,pageId:s,browserGeneration:r,capability:rt,readOnly:l}));$e.binaryType="arraybuffer",m.current=$e;let He=_e,Nt=!1;$e.onmessage=Ct=>{var cs;if(x.current!==Ie||m.current!==$e)return;if(typeof Ct.data=="string"){try{const gr=JSON.parse(Ct.data);if(gr&&typeof gr=="object"&&"type"in gr&&gr.type==="error"){const jt="message"in gr&&typeof gr.message=="string"?gr.message:"Browser Surface failed";F(jt);return}const kt=Iq(gr);if(kt.type==="browser.surface.ready"){h.current=kt,v.current=kt.viewportRevision,V(),q(kt),z("ready");return}if(kt.type==="browser.surface.driver.changed"){const jt=kt.driver==="stream"&&kt.driverSubscriptionId===((cs=h.current)==null?void 0:cs.subscriptionId);C.current=jt,jt||D(),M(kt.driver),W(kt.driverSubscriptionId);return}C.current=!1,D();const Fe=kt.message??fW(kt.reason);Nt=!0,Xq(kt.reason)?(ze(Fe),$e.close(1e3,"recovering Browser Surface")):(F(Fe),z("closed"))}catch{Nt=!0,F("Browser Surface sent an invalid control frame"),z("closed"),$e.close(4400,"invalid Browser Surface control")}return}if(!(Ct.data instanceof ArrayBuffer)){F("Browser Surface sent an invalid image frame"),$e.close(4400,"invalid Browser Surface image");return}const gs=()=>x.current===Ie&&m.current===$e;uW(Ct.data,$e,c.current,h.current,gs).then(gr=>{gr===void 0||!gs()||(v.current=gr,S.current=!0,k.current=!0,y.current=0,O(!0),G(!0))}).catch(()=>{gs()&&(Nt=!0,F("Browser preview could not be decoded"),z("closed"),$e.close(4400,"Browser Surface image decode failed"))})},$e.onclose=Ct=>{if(!(x.current!==Ie||m.current!==$e)&&(m.current=void 0,C.current=!1,D(),!Nt)){if((Ct.code===4403||Ct.code===1006)&&!He){He=!0,X({refreshCapability:!0,preserveFrame:!0});return}if(Kq(Ct.code)){ze(e5(Ct.code));return}z("closed"),F(gs=>gs??e5(Ct.code))}},$e.onerror=()=>{m.current===$e&&F("Browser preview transport failed")}}catch(rt){if(x.current!==Ie)return;ze(rt instanceof Error?rt.message:"Browser preview could not connect")}},[e,t,s,r,l,D,V]);p.useEffect(()=>(X(),()=>{var _e;x.current+=1,V(),D(),(_e=m.current)==null||_e.close(1e3,"Browser Surface view unmounted"),m.current=void 0}),[X,D,V]);const J=p.useCallback(()=>{y.current=0,X({preserveFrame:!0})},[X]),se=p.useCallback(_e=>{const ye=m.current;return!ye||ye.readyState!==WebSocket.OPEN?!1:(ye.send(JSON.stringify(_e)),!0)},[]),de=p.useCallback(()=>{var ye;const _e=h.current;!_e||!k.current||(se({type:"browser.surface.driver.take",subscriptionId:_e.subscriptionId,browserGeneration:_e.browserGeneration,viewportRevision:v.current}),(ye=d.current)==null||ye.focus())},[se]),Z=p.useCallback(()=>{const _e=h.current;_e&&(D(),d.current&&(d.current.value=""),se({type:"browser.surface.driver.release",subscriptionId:_e.subscriptionId,browserGeneration:_e.browserGeneration}))},[se,D]),ce=p.useCallback(_e=>{const ye=h.current;return!ye||!k.current||!C.current?!1:se({type:"browser.surface.input",subscriptionId:ye.subscriptionId,browserGeneration:ye.browserGeneration,viewportRevision:v.current,inputSequence:g.current++,event:_e})},[se]),le=p.useCallback(_e=>{let ye;try{ye=nW(_e)}catch{return F("Text input is limited to 64 KiB at a time."),!1}let Ie=!1;for(const ze of ye){if(!ce({type:"text.insert",text:ze}))return Ie;Ie=!0}return Ie},[ce]),we=p.useCallback(()=>{R.current!==void 0&&(window.cancelAnimationFrame(R.current),R.current=void 0);const _e=E.current,ye=N.current;E.current=void 0,N.current=void 0,C.current&&(_e&&ce({..._e}),ye&&ce({...ye}))},[ce]),Ee=p.useCallback(()=>{R.current===void 0&&(R.current=window.requestAnimationFrame(we))},[we]);p.useEffect(()=>{C.current=H,H||(D(),d.current&&(d.current.value="",d.current.blur()))},[H,D]);const Re=p.useCallback(_e=>{var rt;if(!H)return;const ye=Q2(_e.currentTarget,_e.clientX,_e.clientY);if(!ye)return;if(_e.type==="pointermove"){E.current={type:"pointer.move",...ye,modifiers:df(_e)},Ee(),_e.preventDefault();return}we(),_e.type==="pointerdown"&&((rt=d.current)==null||rt.focus(),_e.currentTarget.setPointerCapture(_e.pointerId));const Ie=_e.type==="pointerdown"?"pointer.down":"pointer.up",ze=aW(T.current,_e);if(!ze)return;const pt={type:Ie,...ye,button:ze,modifiers:df(_e)};ce(pt)&&_e.preventDefault()},[H,ce,we,Ee]),te=p.useCallback(_e=>{if(!H)return;const ye=Q2(_e.currentTarget,_e.clientX,_e.clientY);if(!ye)return;const Ie=_e.deltaMode===oW?16:_e.deltaMode===lW?Math.max(1,_e.currentTarget.clientHeight):1,ze=N.current,pt=iW((ze==null?void 0:ze.deltaX)??0,(ze==null?void 0:ze.deltaY)??0,_e.deltaX*Ie,_e.deltaY*Ie);N.current={type:"wheel",...ye,...pt,modifiers:df(_e)},Ee(),_e.preventDefault()},[H,Ee]),ie=p.useCallback(_e=>{if(_e.nativeEvent.isComposing||_e.key==="Process"||_e.key==="Dead")return;we();const ye=ce({type:_e.type==="keydown"?"key.down":"key.up",key:_e.key,code:_e.code,repeat:_e.repeat,modifiers:df(_e)}),Ie=dW({type:_e.type,key:_e.key,altKey:_e.altKey,ctrlKey:_e.ctrlKey,metaKey:_e.metaKey,isComposing:_e.nativeEvent.isComposing}),ze=Ie===void 0?!1:le(Ie);(ye||ze)&&_e.preventDefault()},[ce,le,we]),ke=p.useCallback(_e=>{we();const ye=_e.clipboardData.getData("text/plain");ye&&le(ye)&&_e.preventDefault()},[le,we]),Ke=p.useCallback(_e=>{const ye=_e.data||_e.currentTarget.value;_e.currentTarget.value="",ye&&le(ye)},[le]);return o.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-[#111318]",children:[o.jsx("canvas",{ref:c,className:"max-h-full max-w-full outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-label":H?"Interactive browser preview":"Browser preview",tabIndex:-1,onPointerMove:Re,onPointerDown:Re,onPointerUp:Re,onPointerCancel:Re,onWheel:te}),o.jsx("textarea",{ref:d,"aria-label":"Browser keyboard input",className:"pointer-events-none absolute left-0 top-0 size-px resize-none opacity-0",tabIndex:H?0:-1,autoComplete:"off",spellCheck:!1,onKeyDown:ie,onKeyUp:ie,onPaste:ke,onCompositionEnd:Ke}),P==="connecting"&&o.jsx(J2,{preserveFrame:A,icon:o.jsx(Le,{className:"size-5 animate-spin"}),label:A?"Reconnecting preview…":"Connecting preview…"}),P==="ready"&&!L&&o.jsx(J2,{icon:o.jsx(Le,{className:"size-5 animate-spin"}),label:"Waiting for first frame…"}),P==="closed"&&o.jsx("div",{className:"absolute inset-0 grid place-items-center bg-[#111318]/90 px-6 text-center",children:o.jsxs("div",{className:"max-w-sm",children:[o.jsx("p",{className:"text-sm font-medium text-white",children:"Preview disconnected"}),o.jsx("p",{role:"alert",className:"mt-1 text-xs leading-5 text-white/60",children:B??"The Browser Surface ended."})]})}),n&&ha.createPortal(o.jsx("div",{className:"flex items-center",children:P==="closed"?o.jsx(re,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Reconnect browser preview",title:"Reconnect browser preview",onClick:J,children:o.jsx(yt,{className:"size-4"})}):P!=="ready"||!L?o.jsx(re,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":S.current?"Reconnecting browser preview":"Connecting browser preview",title:S.current?"Reconnecting browser preview":"Connecting browser preview",disabled:!0,children:o.jsx(Le,{className:"size-4 animate-spin"})}):l?o.jsx(re,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Browser preview is read only",title:"Browser preview is read only",disabled:!0,children:o.jsx(fC,{className:"size-4"})}):H?o.jsx(re,{size:"icon-sm",variant:"outline",className:"size-8","aria-label":"Release browser control",title:"Release browser control",onClick:Z,children:o.jsx(fC,{className:"size-4"})}):o.jsx(re,{size:"icon-sm",className:"size-8","aria-label":"Take browser control",title:"Take browser control",onClick:de,children:o.jsx(y6,{className:"size-4"})})}),n),o.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:B??(H?"Browser control active":`Browser preview ${P}`)})]})}async function uW(e,t,r,s,n){const l=zq(new Uint8Array(e));if(!s||l.subscriptionId!==s.subscriptionId||l.format!==s.format)throw new Error("Browser Surface image does not match the active subscription");const c=await createImageBitmap(new Blob([l.encodedBytes],{type:l.format==="jpeg"?"image/jpeg":"image/png"}));try{if(!n()||!r||t.readyState!==WebSocket.OPEN)return;r.width=l.width,r.height=l.height;const d=r.getContext("2d",{alpha:!1});if(!d)throw new Error("Browser preview canvas is unavailable");return d.drawImage(c,0,0,l.width,l.height),t.send(JSON.stringify({type:"browser.surface.frame.ack",subscriptionId:s.subscriptionId,frameSequence:l.frameSequence})),l.viewportRevision}finally{c.close()}}function dW(e){if(!(e.type!=="keydown"||e.isComposing||e.key==="Process"||e.key==="Dead"||e.altKey||e.ctrlKey||e.metaKey||Array.from(e.key).length!==1))return e.key}function hW(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({generation:String(e.browserGeneration),role:e.readOnly?"view":"control",format:"jpeg",quality:"75",maximumFrameRate:"15",capability:e.capability});return Ly(r),`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/browser/pages/${encodeURIComponent(e.pageId)}/surface?${r.toString()}`}function Q2(e,t,r){const s=e.getBoundingClientRect();if(!(s.width<=0||s.height<=0||e.width<=0||e.height<=0))return{x:Math.max(0,Math.min(e.width,(t-s.left)*e.width/s.width)),y:Math.max(0,Math.min(e.height,(r-s.top)*e.height/s.height))}}function df(e){const t=[];return e.altKey&&t.push("alt"),e.ctrlKey&&t.push("control"),e.metaKey&&t.push("meta"),e.shiftKey&&t.push("shift"),t}function J2({icon:e,label:t,preserveFrame:r=!1}){return o.jsx("div",{className:r?"absolute inset-0 grid place-items-center bg-[#111318]/55 text-white":"absolute inset-0 grid place-items-center bg-[#111318] text-white/70",children:o.jsxs("div",{role:"status",className:"flex flex-col items-center gap-3 text-sm",children:[e,t]})})}function fW(e){return e==="replaced"?"This preview was opened somewhere else.":e==="generation_changed"?"The Browser was restarted.":e==="page_closed"?"This Browser page was closed.":e==="idle_timeout"?"The Browser preview timed out.":e==="unauthorized"?"Browser preview authorization expired.":"The Browser preview ended."}function e5(e){return e===4403?"Browser preview authorization failed.":e===4406?"The selected Runtime cannot provide this Browser preview.":e===4408?"The Browser preview client was too slow.":e===1012?"The selected Runtime disconnected.":"The Browser preview connection closed."}const mW=400;function pW({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:s}){const n=p.useRef(null),[l,c]=p.useState(0),[d,m]=p.useState("mounting"),[h,v]=p.useState("unavailable"),[g,x]=p.useState(!1),[y,w]=p.useState(),S=p.useMemo(()=>({runtimeSelector:e,sessionId:t,browserGeneration:r,pageId:s}),[e,t,r,s]);p.useEffect(()=>{const C=window.rynxDesktopBrowser,E=n.current;if(!C||!E){m("unavailable");return}let N=!1,R=0,T;const P=o_(S),z=async()=>{if(N)return;const $=gW(E.getBoundingClientRect());if(!$){C.park(S);return}try{const M=await C.mount(S,$);if(N)return;if(M==="mounted"){m("mounted"),T!==void 0&&window.clearTimeout(T),T=void 0;return}}catch{}N||(m("mounting"),T=window.setTimeout(()=>void z(),mW))},B=()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>void z())},F=new ResizeObserver(B);F.observe(E),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0);const Y=C.onState($=>{if(o_($.resource)===P){if($.state==="closed"){m("unavailable");return}B()}}),q=C.onDriver($=>{o_($.resource)===P&&(v($.driver),$.driver==="desktop"&&(x(!1),w(void 0)))});return v(C.getDriver(S)),m("mounting"),B(),()=>{N=!0,F.disconnect(),Y(),q(),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0),window.cancelAnimationFrame(R),T!==void 0&&window.clearTimeout(T),C.park(S)}},[S,l]);const k=async()=>{const C=window.rynxDesktopBrowser;if(!(!C||g)){x(!0),w(void 0);try{if(await C.takeBack(S)!=="taken")throw new Error("The remote controller is no longer available.")}catch(E){x(!1),w(E instanceof Error?E.message:"Could not take back browser control.")}}};return o.jsxs("div",{ref:n,className:"relative flex min-h-0 flex-1 overflow-hidden bg-white","aria-label":"Embedded session browser page",children:[d!=="mounted"&&o.jsx("div",{className:"absolute inset-0 z-0 grid place-items-center bg-[var(--muted)]/20 p-4 text-center",children:d==="mounting"?o.jsxs("div",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 animate-spin"}),"Attaching the local browser…"]}):o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-[var(--muted-foreground)]",children:"The local desktop browser is unavailable."}),o.jsxs(re,{size:"sm",variant:"outline",onClick:()=>c(C=>C+1),children:[o.jsx(yt,{}),"Retry"]})]})}),d==="mounted"&&h==="stream"&&o.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center bg-black/45 p-4 text-center backdrop-blur-[1px]",children:o.jsxs("div",{className:"max-w-sm rounded-lg border border-white/20 bg-[var(--card)] p-4 shadow-lg",children:[o.jsx("p",{className:"text-sm font-medium text-[var(--foreground)]",children:"Controlled from a remote viewer"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Local mouse and keyboard input are paused to prevent two controllers from acting at once."}),o.jsxs(re,{className:"mt-3",size:"sm",disabled:g,onClick:()=>void k(),children:[g?o.jsx(Le,{className:"animate-spin"}):null,"Take back control"]}),y?o.jsx("p",{role:"alert",className:"mt-2 text-xs text-[var(--destructive)]",children:y}):null]})})]})}function gW(e){const t=Math.max(0,Math.ceil(e.left)),r=Math.max(0,Math.ceil(e.top)),s=Math.min(window.innerWidth,Math.floor(e.right)),n=Math.min(window.innerHeight,Math.floor(e.bottom));return s<=t||n<=r?null:{x:t,y:r,width:s-t,height:n-r}}function o_(e){return JSON.stringify([e.runtimeSelector,e.sessionId,e.browserGeneration,e.pageId])}const vW="size-11 sm:size-8";function _W({sessionId:e,runtimeSelector:t,pageId:r,browserResource:s,readOnly:n=!1}){const{browser:l,loading:c,pendingAction:d,error:m,disabled:h,load:v,openBrowser:g,closeBrowser:x,recreateForDesktop:y,navigatePage:w,backPage:S,forwardPage:k,reloadPage:C}=s,E=p.useMemo(()=>l==null?void 0:l.pages.find(F=>F.pageId===r),[l,r]),N=l!==null&&Zq(t,l,typeof window.rynxDesktopBrowser<"u"),R=l!==null&&l.sessionId===e&&Qq(t,l,typeof window.rynxDesktopBrowser<"u"),T=l!==null&&l.sessionId===e&&Jq(t,l,typeof window.rynxDesktopBrowser<"u"),P=p.useRef(null),[z,B]=p.useState(null);return p.useEffect(()=>{const F=`${t}
585
+ ${e}`;n||!R||P.current===F||(P.current=F,y())},[R,n,y,t,e]),c&&l===null?o.jsx(l_,{label:"Loading browser…"}):l===null?n?o.jsx(t5,{label:"Browser is not running for this Session."}):o.jsx(xW,{error:m,pending:d!==null,onOpen:F=>void g(F),onRetry:()=>void v(!0)}):o.jsxs("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]","aria-label":"Session browser page",children:[o.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-[var(--border)] px-2 py-2 sm:flex-nowrap sm:px-3",children:[o.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[o.jsx(hf,{label:"Go back",disabled:h||!(E!=null&&E.canGoBack),onClick:()=>E&&void S(E.pageId),children:o.jsx(tl,{})}),o.jsx(hf,{label:"Go forward",disabled:h||!(E!=null&&E.canGoForward),onClick:()=>E&&void k(E.pageId),children:o.jsx(bE,{})}),o.jsx(hf,{label:"Reload page",disabled:h||!E,onClick:()=>E&&void C(E.pageId),children:o.jsx(U6,{className:E!=null&&E.loading?"animate-spin":void 0})})]}),E?o.jsx(yW,{page:E,disabled:h,onNavigate:F=>void w(E.pageId,F)},`${E.pageId}
586
+ ${E.url}`):o.jsx("div",{className:"h-11 min-w-0 flex-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 sm:h-8"}),!N&&o.jsx("div",{ref:B,className:"flex shrink-0 items-center"}),!n&&T&&o.jsx(re,{type:"button",variant:"outline",size:"sm",disabled:d!==null,onClick:()=>void y(),children:"Open in app"}),!n&&o.jsx(hf,{label:"Stop browser",disabled:d!==null,onClick:()=>void x(),children:o.jsx(V_,{})})]}),o.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[R?o.jsx(l_,{label:"Opening in Desktop…"}):l.status==="ready"&&E?N?o.jsx(pW,{runtimeSelector:t,sessionId:e,browserGeneration:l.browserGeneration,pageId:E.pageId}):o.jsx(cW,{runtimeSelector:t,sessionId:e,browserGeneration:l.browserGeneration,pageId:E.pageId,readOnly:n,toolbarHost:z}):l.status==="ready"?o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center text-sm text-[var(--muted-foreground)]",children:"No browser page is open."}):l.status==="unavailable"&&n?o.jsx(t5,{label:"Browser is unavailable."}):l.status==="unavailable"?o.jsx(bW,{error:m,pending:d!==null,onRestart:()=>void g()}):o.jsx(l_,{label:l.status==="closing"?"Closing browser…":"Starting browser…"}),m&&l.status!=="unavailable"&&o.jsx("div",{role:"alert",className:"absolute bottom-3 left-1/2 max-w-[calc(100%-1.5rem)] -translate-x-1/2 rounded-md border border-[var(--destructive)]/30 bg-[var(--card)] px-3 py-2 text-xs text-[var(--destructive)] shadow-sm",children:m})]}),o.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:d??m??(l.status==="ready"?"Browser ready":`Browser ${l.status}`)})]})}function xW({error:e,pending:t,onOpen:r,onRetry:s}){const[n,l]=p.useState(""),c=d=>{d.preventDefault(),r(xT(n))};return o.jsx(En,{className:"min-h-0 flex-1 bg-[var(--muted)]/20",children:o.jsx("main",{className:"flex min-h-full items-center justify-center p-4 sm:p-6",children:o.jsxs("form",{onSubmit:c,className:"w-full max-w-xl rounded-lg border border-[var(--border)] bg-[var(--card)] p-4 shadow-sm sm:p-6",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-[var(--primary)]/10 text-[var(--primary)]",children:o.jsx(fc,{className:"size-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"text-base font-semibold",children:"Open a browser for this session"}),o.jsx("p",{className:"mt-1 text-sm leading-5 text-[var(--muted-foreground)]",children:"The browser runs on the selected Runtime, beside the agent using it."})]})]}),o.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[o.jsx(bt,{value:n,onChange:d=>l(d.target.value),"aria-label":"Initial browser address",placeholder:"https://example.com (optional)",className:"h-11 flex-1 sm:h-9",disabled:t,autoFocus:!0}),o.jsxs(re,{type:"submit",className:"h-11 sm:h-9",disabled:t,children:[t?o.jsx(Le,{className:"animate-spin"}):o.jsx(fc,{}),t?"Opening…":"Open browser"]})]}),e&&o.jsxs("div",{role:"alert",className:"mt-3 flex items-center justify-between gap-3 rounded-md bg-[var(--destructive)]/10 px-3 py-2 text-xs text-[var(--destructive)]",children:[o.jsx("span",{children:e}),o.jsx(re,{type:"button",variant:"ghost",size:"sm",onClick:s,children:"Retry"})]}),o.jsx("p",{className:"sr-only","aria-live":"polite",children:t?"Starting browser":""})]})})})}function yW({page:e,disabled:t,onNavigate:r}){const[s,n]=p.useState(e.url),l=c=>{c.preventDefault();const d=xT(s);d&&r(d)};return o.jsx("form",{onSubmit:l,className:"order-last flex min-w-full flex-1 sm:order-none sm:min-w-0",children:o.jsx(bt,{value:s,onChange:c=>n(c.target.value),"aria-label":"Browser address",className:"h-11 rounded-lg bg-[var(--muted)]/35 font-mono text-xs sm:h-8",disabled:t,spellCheck:!1})})}function hf({label:e,disabled:t,onClick:r,children:s}){return o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:vW,"aria-label":e,title:e,disabled:t,onClick:r,children:s})}function l_({label:e}){return o.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center gap-2 bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]","aria-live":"polite",children:[o.jsx(Le,{className:"size-4 animate-spin"}),e]})}function t5({label:e}){return o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center bg-[var(--muted)]/20 text-sm text-[var(--muted-foreground)]","aria-live":"polite",children:e})}function bW({error:e,pending:t,onRestart:r}){return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center",role:"status",children:[o.jsx(yt,{className:"size-5 text-[var(--muted-foreground)]"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Browser is unavailable"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:e??"The selected Runtime cannot provide this browser right now."})]}),o.jsxs(re,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:r,children:[t&&o.jsx(Le,{className:"animate-spin"}),t?"Restarting…":"Restart browser"]})]})}function wW({open:e,onClose:t,runtimeSelector:r,sessionId:s}){const[n,l]=p.useState(null),[c,d]=p.useState(!1),[m,h]=p.useState([]),[v,g]=p.useState(!1),[x,y]=p.useState(!1),[w,S]=p.useState(null);p.useEffect(()=>{if(!e)return;let E=!1;return g(!0),S(null),pe.getRuntimeBrowserRequestHeaders(r,s).then(N=>{E||(l(N.revision),d(N.enabled),h(N.headers.map(R=>({...R}))))}).catch(N=>{E||S(c_(N))}).finally(()=>{E||g(!1)}),()=>{E=!0}},[e,r,s]);const k=(E,N,R)=>{h(T=>T.map((P,z)=>z===E?{...P,[N]:R}:P))},C=async()=>{if(!(n===null||x)){y(!0),S(null);try{const E=oq({sessionId:s,expectedRevision:n,enabled:c,headers:m}),N=await pe.updateRuntimeBrowserRequestHeaders(r,E);l(N.revision),me.success("Browser request headers updated"),t()}catch(E){if(E instanceof aa&&E.status===409)try{const N=await pe.getRuntimeBrowserRequestHeaders(r,s);l(N.revision),S("These settings changed elsewhere. Your draft was preserved; review it and Save again to replace the latest version.")}catch(N){S(c_(N))}else S(c_(E))}finally{y(!1)}}};return o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-base font-semibold",children:"Browser request headers"}),o.jsx("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:"Apply request headers to all requests, including subresources, from every Browser page in this Session. Changes affect existing and future pages."})]}),v?o.jsxs("div",{className:"flex min-h-44 items-center justify-center text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"mr-2 size-4 animate-spin"})," Loading settings…"]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-[var(--border)] p-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium",children:"Enable request headers"}),o.jsx("div",{className:"text-xs text-[var(--muted-foreground)]",children:"Turning this off keeps the rows below without sending them."})]}),o.jsx(rp,{checked:c,onCheckedChange:d,disabled:n===null||x,"aria-label":"Enable Browser request headers"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)_2rem] gap-2 px-1 text-xs font-medium text-[var(--muted-foreground)]",children:[o.jsx("span",{children:"Name"}),o.jsx("span",{children:"Value"}),o.jsx("span",{className:"sr-only",children:"Actions"})]}),m.length===0&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-3 py-6 text-center text-sm text-[var(--muted-foreground)]",children:"No request headers configured."}),m.map((E,N)=>o.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_minmax(0,2fr)_2rem] gap-2",children:[o.jsx(bt,{value:E.name,onChange:R=>k(N,"name",R.target.value),placeholder:"X-Example",disabled:x,autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"aria-label":`Header ${N+1} name`}),o.jsx(bt,{value:E.value,onChange:R=>k(N,"value",R.target.value),placeholder:"value",disabled:x,autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1,"aria-label":`Header ${N+1} value`}),o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",disabled:x,onClick:()=>h(R=>R.filter((T,P)=>P!==N)),"aria-label":`Remove header ${N+1}`,title:"Remove header",children:o.jsx(da,{})})]},N)),o.jsxs(re,{type:"button",variant:"outline",size:"sm",disabled:x||m.length>=Tx,onClick:()=>h(E=>[...E,{name:"",value:""}]),children:[o.jsx(Zr,{})," Add header"]}),o.jsx("p",{className:"text-xs text-[var(--muted-foreground)]",children:"Values are sent to every origin requested by the Session Browser. Treat them as sensitive and avoid unrelated third-party pages while enabled."})]}),w&&o.jsx("p",{role:"alert",className:"text-sm text-[var(--destructive)]",children:w})]}),o.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] pt-4",children:[o.jsx(re,{type:"button",variant:"outline",onClick:t,disabled:x,children:"Cancel"}),o.jsxs(re,{type:"button",onClick:()=>void C(),disabled:n===null||v||x,children:[x&&o.jsx(Le,{className:"animate-spin"})," Save"]})]})]})}function c_(e){return e instanceof Error?e.message:"Browser settings are unavailable"}const SW=[{id:"browser-request-headers",label:"Browser headers",icon:fc}];function CW({open:e,onOpenChange:t,runtimeSelector:r,sessionId:s}){const[n,l]=p.useState("browser-request-headers");return o.jsx(sn,{open:e,onOpenChange:t,children:o.jsxs(Di,{className:"max-h-[calc(100dvh-2rem)] gap-0 overflow-hidden p-0 sm:max-w-5xl",children:[o.jsxs(An,{className:"border-b border-[var(--border)] p-5 pr-12",children:[o.jsx(Li,{children:"Session settings"}),o.jsx(vo,{children:"Manage shared behavior for this Session."})]}),o.jsxs("div",{className:"grid min-h-0 grid-cols-1 sm:grid-cols-[13rem_minmax(0,1fr)]",children:[o.jsx("nav",{"aria-label":"Session settings sections",className:"flex gap-1 overflow-x-auto border-b border-[var(--border)] bg-[var(--muted)]/30 p-2 sm:flex-col sm:border-r sm:border-b-0",children:SW.map(c=>{const d=c.icon,m=n===c.id;return o.jsxs("button",{type:"button","aria-current":m?"page":void 0,onClick:()=>l(c.id),className:"flex shrink-0 items-center gap-2 rounded-md px-3 py-2 text-left text-sm font-medium sm:w-full "+(m?"bg-[var(--accent)] text-[var(--accent-foreground)]":"text-[var(--muted-foreground)] hover:bg-[var(--accent)]/60 hover:text-[var(--foreground)]"),children:[o.jsx(d,{className:"size-4"}),o.jsx("span",{children:c.label})]},c.id)})}),o.jsx("div",{className:"min-h-0 overflow-y-auto p-5",children:n==="browser-request-headers"&&o.jsx(wW,{open:e,onClose:()=>t(!1),runtimeSelector:r,sessionId:s})})]})]})})}function kW(e,t,r,s){return r===s?t:e}function EW(e,t){return e.key!==t.key||t.streamCurrent===!0&&e.streamCurrent!==!0}function RW(e){return e?e.tool==="skills-cli"?{source:e.source}:{source:e.command}:{}}const Dx=vq(),r5={...Dx,enabled:!1};function yT({policy:e,upload:t,deleteResource:r,onChange:s}){const[n,l]=p.useState([]),c=p.useRef([]),d=p.useRef(new Map),m=p.useCallback(y=>{l(w=>{const S=y(w);return c.current=S,S})},[]);p.useEffect(()=>()=>{for(const y of d.current.values())y.abort();for(const y of c.current)y.previewUrl&&URL.revokeObjectURL(y.previewUrl)},[]);const h=p.useCallback(y=>{if(!e.enabled||y.length===0)return;s==null||s();let w=c.current.filter(S=>S.type==="input_image").length;for(const S of y){const k=S.type.startsWith("image/")?"input_image":"input_file",C=xc("attachment"),E=xc("upl"),N=k==="input_image"?URL.createObjectURL(S):void 0;let R;if(k==="input_image"?(w+=1,w>e.maxImagesPerMessage?R=`Attach up to ${e.maxImagesPerMessage} images`:e.mediaTypes.includes(S.type)?(S.size<=0||S.size>e.maxImageBytes)&&(R=`Image must be smaller than ${NW(e.maxImageBytes)}`):R="Unsupported image type"):(S.size<=0||!Number.isSafeInteger(S.size))&&(R="File is empty or too large for this browser"),R){m(z=>[...z,{id:C,file:S,clientUploadId:E,type:k,previewUrl:N,state:"failed",error:R}]);continue}const T={id:C,file:S,clientUploadId:E,type:k,previewUrl:N,state:t?"uploading":"ready"};if(m(z=>[...z,T]),!t)continue;const P=new AbortController;d.current.set(C,P),t(S,E,k,P.signal).then(z=>{if(d.current.delete(C),!c.current.some(B=>B.id===C)){r==null||r(z).catch(()=>{});return}m(B=>B.map(F=>F.id===C?{...F,state:"ready",resource:z}:F))}).catch(z=>{d.current.delete(C),!P.signal.aborted&&m(B=>B.map(F=>F.id===C?{...F,state:"failed",error:z instanceof Error?z.message:"Upload failed"}:F))})}},[r,s,e,m,t]),v=p.useCallback(y=>{const w=Array.from(y.clipboardData.files).filter(S=>S.type.startsWith("image/"));w.length!==0&&(y.preventDefault(),h(w))},[h]),g=p.useCallback(y=>{var w;s==null||s(),(w=d.current.get(y.id))==null||w.abort(),d.current.delete(y.id),m(S=>S.filter(k=>k.id!==y.id)),y.previewUrl&&URL.revokeObjectURL(y.previewUrl),y.resource&&(r==null||r(y.resource).catch(()=>{}))},[r,s,m]),x=p.useCallback(()=>{for(const y of d.current.values())y.abort();d.current.clear();for(const y of c.current)y.previewUrl&&URL.revokeObjectURL(y.previewUrl);c.current=[],l([])},[]);return{items:n,addFiles:h,onPaste:v,remove:g,clear:x,hasPending:n.some(y=>y.state==="uploading"),hasFailed:n.some(y=>y.state==="failed"),readyResources:n.flatMap(y=>y.state==="ready"&&y.resource?[y.resource]:[]),readyUploads:n.flatMap(y=>y.state==="ready"?[{file:y.file,clientUploadId:y.clientUploadId,type:y.type}]:[])}}function bT({items:e,disabled:t,onRemove:r,className:s}){return e.length===0?null:o.jsx("div",{className:Pe("flex gap-2 overflow-x-auto px-2 pb-2",s),"aria-label":"Attachments",children:e.map(n=>o.jsxs("div",{className:Pe("group relative h-20 shrink-0 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]",n.type==="input_image"?"w-20":"w-52"),title:n.error??n.file.name,children:[n.previewUrl?o.jsx("img",{src:n.previewUrl,alt:n.file.name,className:"size-full object-cover"}):o.jsxs("div",{className:"flex size-full items-center gap-2 px-3 pr-8",children:[o.jsx(xd,{className:"size-5 shrink-0 text-[var(--primary)]"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"truncate text-xs font-medium",children:n.file.name}),o.jsx("div",{className:"text-[10px] text-[var(--muted-foreground)]",children:jW(n.file.size)})]})]}),n.state==="uploading"&&o.jsx("div",{className:"absolute inset-0 grid place-items-center bg-black/45 text-white",children:o.jsx(Le,{className:"size-5 animate-spin"})}),n.state==="failed"&&o.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-[var(--destructive)] px-1 py-0.5 text-center text-[9px] text-white",children:"Upload failed"}),o.jsx("button",{type:"button",className:"absolute right-1 top-1 grid size-5 place-items-center rounded-full bg-black/65 text-white opacity-90 transition-opacity hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-45","aria-label":`Remove ${n.file.name}`,disabled:t,onClick:()=>r(n),children:o.jsx(Ni,{className:"size-3"})})]},n.id))})}function wT({policy:e,disabled:t,onFiles:r,className:s}){const n=p.useRef(null);function l(c){r(Array.from(c.target.files??[])),c.target.value=""}return o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:n,type:"file",multiple:!0,className:"hidden",onChange:l}),o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:Pe("size-8 shrink-0",s),disabled:t||!e.enabled,"aria-label":"Attach files",title:"Attach images or files",onClick:()=>{var c;return(c=n.current)==null?void 0:c.click()},children:e.enabled?o.jsx(M6,{}):o.jsx(ZO,{})})]})}function NW(e){return`${Math.round(e/(1024*1024))} MB`}function jW(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const u_=200;function AW({initialDraft:e,model:t,running:r,collaborationMode:s,streamCurrent:n,disabled:l,sessionId:c,runtimeSelector:d,onSend:m,onStop:h}){const[v,g]=p.useState(e??""),[x,y]=p.useState(r5),[w,S]=p.useState(!1),k=p.useRef(null),C=p.useRef(!1),E=p.useRef(void 0),N=p.useRef(0),R=p.useRef(!1),T=yT({policy:x,upload:(B,F,Y,q)=>pe.uploadSessionResource(d,c,B,F,Y,q),deleteResource:B=>pe.deleteSessionResource(d,c,B.resourceId),onChange:()=>{E.current=void 0}});p.useEffect(()=>{let B=!1;return pe.getSessionResourcePolicy(d,c).then(F=>{B||y(F)}).catch(()=>{B||y(r5)}),()=>{B=!0}},[d,c]),p.useEffect(()=>{e!==void 0&&g(B=>B||e)},[e]),p.useLayoutEffect(()=>{const B=k.current;if(!B)return;B.style.height="auto";const F=B.scrollHeight;B.style.height=`${Math.min(F,u_)}px`,B.style.overflowY=F>u_?"auto":"hidden"},[v]);async function P(){if(R.current)return;const B=v,F=N.current,Y=v.trim(),q=T.readyResources;if(!Y&&q.length===0||T.hasPending||T.hasFailed)return;const $=q.length>0?E.current??xc("msg"):void 0;$&&(E.current=$),R.current=!0,S(!0),g("");try{await m({text:Y,attachments:q,clientMessageId:$}),T.clear(),E.current=void 0}catch(M){me.error(`Could not send message: ${M instanceof Error?M.message:"unknown error"}`),ip(M)?g(U=>kW(U,B,N.current,F)):(T.clear(),E.current=void 0)}finally{R.current=!1,S(!1)}}const z=!l&&!w&&!T.hasPending&&!T.hasFailed&&(!!v.trim()||T.items.length>0);return o.jsx("div",{className:"px-4 pb-3 pt-1",children:o.jsxs("div",{className:"mx-auto w-full max-w-3xl rounded-xl border border-[var(--border)] bg-[var(--card)] p-2 shadow-[var(--shadow-sm)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),var(--shadow-sm)]",children:[o.jsx(bT,{items:T.items,disabled:w,onRemove:T.remove}),o.jsx("textarea",{ref:k,value:v,rows:1,placeholder:"Message… (Enter to send · Shift+Enter for newline)",disabled:l,onChange:B=>{N.current+=1,E.current=void 0,g(B.target.value)},onPaste:B=>{w||T.onPaste(B)},onCompositionStart:()=>{C.current=!0},onCompositionEnd:()=>{C.current=!1},onKeyDown:B=>{B.key==="Enter"&&!B.shiftKey&&!C.current&&!B.nativeEvent.isComposing&&B.keyCode!==229&&(B.preventDefault(),z&&P())},className:Pe("block min-h-[52px] w-full resize-none overflow-hidden border-0 bg-transparent px-2 py-1.5","text-sm leading-relaxed placeholder:text-[var(--muted-foreground)]","focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"),style:{maxHeight:u_}}),o.jsxs("div",{className:"flex min-h-8 items-center gap-2 pt-1",children:[o.jsx(wT,{policy:x,disabled:l||w,onFiles:T.addFiles}),o.jsx(TW,{fallbackModel:t,running:r,collaborationMode:s,streamCurrent:n,sessionId:c,runtimeSelector:d}),r?o.jsxs(re,{variant:"outline",className:"ml-auto h-8 shrink-0",onClick:h,title:"Stop the running turn",children:[o.jsx(uB,{})," Stop"]}):o.jsxs(re,{className:"ml-auto h-8 shrink-0",onClick:P,disabled:!z,children:[o.jsx(TE,{})," Send"]})]})]})})}function TW({fallbackModel:e,running:t,collaborationMode:r,streamCurrent:s,sessionId:n,runtimeSelector:l}){const[c,d]=p.useState(null),[m,h]=p.useState([]),[v,g]=p.useState(!0),[x,y]=p.useState(!1),[w,S]=p.useState(!1),k=p.useRef({key:null,streamCurrent:void 0});p.useEffect(()=>{const q=`${l}\0${n}`,$=k.current,M={key:q,streamCurrent:s};if(k.current=M,!EW($,M))return;let U=!1;const W=$.key!==q;return W&&(g(!0),d(null),h([])),Promise.all([pe.getSessionExecutionSettings(l,n),pe.listSessionLaunchOptions(l)]).then(([A,O])=>{var L;U||(d(A),h(((L=O.providers.find(G=>G.id===A.provider))==null?void 0:L.models)??[]))}).catch(()=>{}).finally(()=>{!U&&W&&g(!1)}),()=>{U=!0}},[l,n,s]),p.useEffect(()=>{r&&d(q=>q&&{...q,collaborationMode:r})},[r]);const C=m.find(q=>q.id===(c==null?void 0:c.model)),E=C==null?void 0:C.reasoningOptions.find(q=>q.value===(c==null?void 0:c.reasoningEffort)),N=C?`${C.label}${E?` / ${E.label}`:""}`:(c==null?void 0:c.model)??e,R=t||x||v||!c||m.length===0;async function T(q,$){if(!(x||t)){y(!0);try{const M=await pe.updateSessionExecutionSettings(l,n,{model:q,reasoningEffort:$});d(M)}catch(M){me.error(`Could not change model: ${M instanceof Error?M.message:"unknown error"}`)}finally{y(!1)}}}async function P(){if(!c||w)return;const q=c,$=c.collaborationMode==="plan"?"default":"plan";S(!0),d({...c,collaborationMode:$});try{const M=await pe.updateSessionExecutionSettings(l,n,{model:c.model,reasoningEffort:c.reasoningEffort,collaborationMode:$});d(M)}catch(M){d(q);const U=$==="plan"?"enter":"exit";me.error(`Could not ${U} Plan mode: ${M instanceof Error?M.message:"unknown error"}`)}finally{S(!1)}}const z=(c==null?void 0:c.provider)==="codex"||(c==null?void 0:c.provider)==="traex",B=(c==null?void 0:c.collaborationMode)==="plan",F=B?"Exit Plan mode":"Enter Plan mode",Y=z?o.jsxs(re,{type:"button",variant:"ghost",size:"sm",className:Pe("h-7 shrink-0 gap-1 px-2 text-[11px] font-medium",B?"bg-[color-mix(in_srgb,var(--primary)_10%,transparent)] text-[var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_14%,transparent)]":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),"aria-label":F,"aria-pressed":B,"data-testid":"session-plan-mode-toggle","data-active":B?"true":void 0,title:F,disabled:w,onClick:()=>void P(),children:[w?o.jsx(Le,{className:"size-3 animate-spin"}):o.jsx(xd,{className:"size-3",strokeWidth:1.8}),o.jsx("span",{children:"Plan"})]}):null;return!N&&!Y?null:m.length===0||!c?o.jsxs(o.Fragment,{children:[N?o.jsx("span",{className:"min-w-0 max-w-52 truncate px-2 font-mono text-[10px] text-[var(--muted-foreground)]",children:N}):null,Y]}):o.jsxs(o.Fragment,{children:[o.jsxs(nd,{children:[o.jsx(vc,{asChild:!0,children:o.jsxs(re,{type:"button",variant:"ghost",size:"sm",disabled:R,className:"h-7 min-w-0 max-w-52 justify-start gap-1.5 px-2 font-normal text-[11px] text-[var(--muted-foreground)]","aria-label":"Model and thinking effort",title:t?"Model settings can be changed after the current turn finishes":"Change model and thinking effort for the next turn",children:[x?o.jsx(Le,{className:"size-3 animate-spin"}):null,o.jsx("span",{className:"min-w-0 truncate",children:N}),o.jsx(vd,{className:"size-3 shrink-0 opacity-55"})]})}),o.jsxs(_c,{align:"start",className:"min-w-56",children:[o.jsx(Yo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Model → Thinking effort"}),m.map(q=>{const $=c.model===q.id;return q.reasoningOptions.length===0?o.jsxs(Wi,{onSelect:()=>void T(q.id,null),children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:q.label}),$&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]},q.id):o.jsxs(rx,{children:[o.jsxs(nm,{children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:q.label}),$&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]}),o.jsxs(am,{children:[o.jsx(Yo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Thinking effort"}),q.reasoningOptions.map(M=>{const U=$&&c.reasoningEffort===M.value;return o.jsxs(Wi,{onSelect:()=>void T(q.id,M.value),children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:M.label}),U&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]},M.value)})]})]},q.id)})]})]}),Y]})}const ST=24,MW={hasOverflow:!1,canScrollLeft:!1,canScrollRight:!1};function DW({pages:e,order:t,selectedPageId:r,selectionDisabled:s,mutationDisabled:n,createDisabled:l,createPending:c,emulatorAttached:d,emulator:m,onSelectPage:h,onClosePage:v,onCreatePage:g,onSelectEmulator:x,onCloseEmulator:y,onAddEmulator:w,headerLeadingAction:S,settingsAction:k,leadingAction:C,trailingAction:E}){const N=p.useRef(null),R=p.useRef(null),T=p.useRef(null),P=p.useRef(null),z=p.useRef(null),B=p.useRef(null),[F,Y]=p.useState(MW),q=t.flatMap(H=>{if(H===vn())return m?[{type:"emulator",key:H,emulator:m}]:[];const D=e.find(V=>gn(V.pageId)===H);return D?[{type:"browser",key:H,page:D}]:[]}),$=q.map(H=>H.key).join(`
587
+ `),M=q.length,U=p.useCallback(()=>{const H=N.current,D=R.current,V=T.current;if(!(!H||!D||!V))return tW({scrollLeft:D.scrollLeft,viewportWidth:D.clientWidth,contentWidth:V.scrollWidth,availableWidth:H.clientWidth})},[]),W=p.useCallback(()=>{const H=U();H&&Y(D=>LW(D,H)?D:H)},[U]),A=p.useCallback(()=>{z.current===null&&(z.current=window.requestAnimationFrame(()=>{z.current=null,W()}))},[W]),O=p.useCallback(H=>{const D=R.current,V=P.current;if(!D||!V)return;const X=D.getBoundingClientRect(),J=V.getBoundingClientRect(),se=sW({scrollLeft:D.scrollLeft,viewportWidth:D.clientWidth,tabLeft:D.scrollLeft+J.left-X.left,tabWidth:J.width,inset:ST});se!==0&&D.scrollBy({left:se,behavior:H})},[]),L=p.useCallback(H=>{const D=R.current;if(!D)return;const V=rW(D.clientWidth);D.scrollBy({left:H==="left"?-V:V,behavior:i5()})},[]);p.useEffect(()=>()=>{z.current!==null&&window.cancelAnimationFrame(z.current)},[]),p.useLayoutEffect(()=>{const H=N.current,D=R.current,V=T.current;if(!H||!D||!V)return;const X=()=>{const se=D.clientWidth,de=B.current===null||Math.abs(se-B.current)>1;B.current=se,A(),de&&O("auto")},J=typeof ResizeObserver>"u"?void 0:new ResizeObserver(X);return J==null||J.observe(H),J==null||J.observe(D),J==null||J.observe(V),window.addEventListener("resize",X),W(),()=>{J==null||J.disconnect(),window.removeEventListener("resize",X)}},[O,A,W]),p.useEffect(()=>{const H=R.current;if(!H)return;const D=V=>{if(V.ctrlKey||V.deltaY===0||Math.abs(V.deltaY)<=Math.abs(V.deltaX))return;const X=U();(V.deltaY<0?X!=null&&X.canScrollLeft:X!=null&&X.canScrollRight)&&(V.preventDefault(),H.scrollLeft+=V.deltaY,A())};return H.addEventListener("wheel",D,{passive:!1}),()=>H.removeEventListener("wheel",D)},[U,A]),p.useLayoutEffect(()=>{O(i5()),A()},[$,O,A,F.hasOverflow,r]);function G(H,D){var J;let V;if(H.key==="ArrowLeft"?V=(D-1+M)%M:H.key==="ArrowRight"?V=(D+1)%M:H.key==="Home"?V=0:H.key==="End"&&(V=M-1),V===void 0||V===D)return;H.preventDefault();const X=(J=T.current)==null?void 0:J.querySelectorAll('[role="tab"]').item(V);X==null||X.focus(),X==null||X.click()}return o.jsxs("div",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-end gap-1 border-b border-[var(--border)] bg-[var(--muted)]/30 pl-2 pr-3 pt-1 sm:pr-4",children:[S&&o.jsx("div",{className:"mb-1 flex h-8 shrink-0 items-center",children:S}),o.jsxs("div",{ref:N,className:"flex min-w-0 flex-1 items-end gap-1",children:[F.hasOverflow&&o.jsx(s5,{direction:"left",disabled:!F.canScrollLeft,onClick:()=>L("left")}),o.jsx("div",{ref:R,className:"min-w-0 flex-1 overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:OW(F),onScroll:A,children:o.jsx("div",{ref:T,className:"flex w-max items-end gap-1",role:"tablist","aria-label":"Session resources",children:q.map((H,D)=>{if(H.type==="emulator"){const se=H.emulator;return o.jsxs("div",{ref:se.selected?P:void 0,role:"presentation",className:se.selected?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":se.selected,"aria-label":se.label,title:se.label,tabIndex:se.selected?0:-1,onClick:x,onKeyDown:de=>G(de,D),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[se.busy?o.jsx(Le,{className:"size-3 shrink-0 animate-spin"}):o.jsx(mc,{className:"size-3 shrink-0"}),o.jsx("span",{className:"truncate",children:se.label})]}),o.jsx(re,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Close emulator tab",title:"Close emulator tab",onClick:y,className:"ml-1",children:o.jsx(Ni,{className:"size-3"})})]},H.key)}const V=H.page,X=V.pageId===r,J=V.title||V.url||"New page";return o.jsxs("div",{ref:X?P:void 0,role:"presentation",className:X?"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-b-[var(--card)] border-[var(--border)] bg-[var(--card)] px-2":"group flex h-8 w-44 shrink-0 items-center rounded-t-md border border-transparent px-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)]",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":X,"aria-label":J,title:J,tabIndex:X?0:-1,disabled:s,onClick:()=>h(V.pageId),onKeyDown:se=>G(se,D),className:"flex min-w-0 flex-1 items-center gap-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",children:[V.loading?o.jsx(Le,{className:"size-3 shrink-0 animate-spin"}):o.jsx(fc,{className:"size-3 shrink-0"}),o.jsx("span",{className:"truncate",children:J})]}),o.jsx(re,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`Close ${J}`,title:`Close ${J}`,disabled:n,onClick:()=>v(V.pageId),className:"ml-1",children:o.jsx(Ni,{className:"size-3"})})]},H.key)})})}),F.hasOverflow&&o.jsx(s5,{direction:"right",disabled:!F.canScrollRight,onClick:()=>L("right")})]}),o.jsxs(nd,{children:[o.jsx(vc,{asChild:!0,children:o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-8","aria-label":"Add Session resource",title:"Add Session resource",children:o.jsx(Zr,{})})}),o.jsxs(_c,{align:"end",children:[o.jsxs(Wi,{disabled:l,"aria-busy":c,onSelect:g,children:[c?o.jsx(Le,{className:"animate-spin"}):o.jsx(fc,{}),c?"Creating browser tab…":"New browser tab"]}),o.jsxs(Wi,{onSelect:w,children:[o.jsx(mc,{}),m||d?"Show emulator":"Attach emulator"]})]})]}),k&&o.jsx("div",{className:"mb-1 shrink-0",children:k}),C&&o.jsx("div",{className:"mb-1 shrink-0",children:C}),E&&o.jsx("div",{className:"mb-1 ml-0.5 shrink-0",children:E})]})}function s5({direction:e,disabled:t,onClick:r}){const s=e==="left"?wE:po;return o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",className:"mb-1 size-7","aria-label":`Scroll resource tabs ${e}`,title:`Scroll resource tabs ${e}`,disabled:t,onClick:r,children:o.jsx(s,{})})}function i5(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function LW(e,t){return e.hasOverflow===t.hasOverflow&&e.canScrollLeft===t.canScrollLeft&&e.canScrollRight===t.canScrollRight}function OW(e){const t=`${ST}px`;let r;return e.canScrollLeft&&e.canScrollRight?r=`linear-gradient(to right, transparent, #000 ${t}, #000 calc(100% - ${t}), transparent)`:e.canScrollLeft?r=`linear-gradient(to right, transparent, #000 ${t}, #000 100%)`:e.canScrollRight&&(r=`linear-gradient(to right, #000 0, #000 calc(100% - ${t}), transparent)`),r?{WebkitMaskImage:r,maskImage:r}:void 0}const BW=8,PW=256,IW=4e3;function zW({sessionId:e,runtimeSelector:t,controller:r,readOnly:s=!1}){return r.binding?o.jsx(UW,{sessionId:e,runtimeSelector:t,binding:r.binding,controller:r,readOnly:s}):s?o.jsx(zy,{icon:o.jsx(Yf,{className:"size-5"}),label:"No Emulator is attached."}):o.jsx($W,{controller:r})}function $W({controller:e}){const[t,r]=p.useState(null),s=async n=>{r(n);try{await e.attach(n)}catch(l){me.error(`Could not attach Emulator: ${l.message}`)}finally{r(null)}};return o.jsx(En,{className:"min-h-0 flex-1",children:o.jsx("div",{className:"p-4 sm:p-5",children:o.jsxs("div",{className:"mx-auto max-w-2xl",children:[o.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold",children:"Attach an Emulator"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:"Only devices available to this Session are shown. Attaching does not affect another Session."})]}),o.jsx(re,{variant:"ghost",size:"icon-sm",onClick:()=>void e.reloadDevices(),title:"Refresh devices","aria-label":"Refresh devices",children:o.jsx(yt,{className:Pe("size-4",e.devicesLoading&&"animate-spin")})})]}),e.error&&o.jsx("div",{className:"mb-3 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:e.error.message}),e.devicesLoading&&e.devices.length===0?o.jsx("div",{className:"grid min-h-40 place-items-center","aria-live":"polite",children:o.jsx(zy,{icon:o.jsx(Le,{className:"size-5 animate-spin"}),label:"Loading devices…"})}):e.devices.length===0?o.jsxs("div",{className:"rounded-md border border-dashed border-[var(--border)] px-5 py-10 text-center",children:[o.jsx(Yf,{className:"mx-auto mb-3 size-6 text-[var(--muted-foreground)]"}),o.jsx("p",{className:"text-sm font-medium",children:"No Emulator is available"}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Boot a simulator on this Runtime, or release one from another Session."})]}):o.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:e.devices.map(n=>o.jsxs("button",{type:"button",disabled:e.mutating,onClick:()=>void s(n.id),className:"group flex min-h-20 items-center gap-3 rounded-md border border-[var(--border)] bg-[var(--card)] p-3 text-left transition-colors hover:border-[var(--primary)]/50 hover:bg-[var(--primary)]/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:opacity-60",children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-[var(--primary)]/10 text-[var(--primary)]",children:t===n.id?o.jsx(Le,{className:"size-4 animate-spin"}):o.jsx(Yf,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium",children:n.name}),o.jsxs("span",{className:"mt-1 flex items-center gap-2",children:[o.jsx(CT,{state:n.state}),o.jsx("span",{className:"font-mono text-[9px] uppercase text-[var(--muted-foreground)]",children:n.backend})]})]})]},`${n.backend}:${n.id}`))})]})})})}function UW({sessionId:e,runtimeSelector:t,binding:r,controller:s,readOnly:n}){const[l,c]=p.useState(null),[d,m]=p.useState(!1),[h,v]=p.useState(null),[g,x]=p.useState(null),y=p.useRef(null),w=p.useRef(null),S=p.useRef(null),k=p.useRef(null),C=p.useRef(null);p.useEffect(()=>{c(null),m(!1),x(null),v(null);let F=!1,Y,q,$=0,M=0,U=!1,W=null,A,O="png";const L=()=>{q!==void 0&&window.clearTimeout(q),q=void 0,v(null)},G=(X,J=!1)=>{if(q!==void 0&&window.clearTimeout(q),J||W===null){v(X);return}q=window.setTimeout(()=>{q=void 0,F||v(X)},IW)},H=X=>{if(F)return;const J=URL.createObjectURL(X),se=W;W=J,c(J),L(),$=0,U=!1,se&&window.setTimeout(()=>URL.revokeObjectURL(se),1e3)},D=(X,J=!1)=>{if(F)return;Y!==void 0&&window.clearTimeout(Y);const se=J?0:Math.min(8e3,500*2**$++);Y=window.setTimeout(()=>void X(J),se)},V=async(X=!1)=>{const J=++M;try{const se=await cd(X);if(F||J!==M)return;const de=new WebSocket(HW({runtimeSelector:t,sessionId:e,bindingId:r.bindingId,maximumFrameRate:r.backend==="ios"?30:5,capability:se}));A=de,de.binaryType="arraybuffer",de.onmessage=Z=>{if(F||J!==M||A!==de)return;if(typeof Z.data=="string"){try{const we=JSON.parse(Z.data);if(we.type!=="emulator.surface.ready"||typeof we.surfaceId!="string"||we.format!=="png"&&we.format!=="jpeg")throw new Error("invalid Emulator Surface ready frame");O=we.format,w.current={socket:de,surfaceId:we.surfaceId,inputSequence:0}}catch{de.close(4400,"invalid Emulator Surface ready frame")}return}const ce=Z.data instanceof ArrayBuffer||Z.data instanceof Blob?Z.data:null,le=O==="jpeg"?"image/jpeg":"image/png";ce instanceof Blob?H(new Blob([ce],{type:le})):ce&&H(new Blob([ce],{type:le}))},de.onclose=Z=>{var le;if(F||J!==M||A!==de)return;((le=w.current)==null?void 0:le.socket)===de&&(w.current=null);const ce=new Error(Z.code===4406?"emulator_surface_upgrade_required":Z.reason||"Remote Emulator Surface disconnected");G(ce,Z.code===4406),Z.code!==4406&&((Z.code===4403||Z.code===1006)&&!U?(U=!0,D(V,!0)):D(V))},de.onerror=()=>{}}catch(se){if(F||J!==M)return;G(se instanceof Error?se:new Error(String(se))),D(V)}};return V(),()=>{F=!0,M+=1,w.current=null,A==null||A.close(1e3,"Session Emulator pane closed"),Y!==void 0&&window.clearTimeout(Y),q!==void 0&&window.clearTimeout(q),W&&URL.revokeObjectURL(W)}},[r.backend,r.bindingId,t,e]);const E=p.useCallback((F,Y,q)=>{const $=w.current;if(!$||$.socket.readyState!==WebSocket.OPEN||q!==void 0&&$.surfaceId!==q)return!1;try{return $.socket.send(JSON.stringify({type:"emulator.surface.touch",surfaceId:$.surfaceId,inputSequence:$.inputSequence++,phase:F,...Y})),!0}catch{return!1}},[]),N=p.useCallback(()=>{k.current!==null&&window.cancelAnimationFrame(k.current),k.current=null;const F=S.current;S.current=null,F&&E("move",F,F.surfaceId)},[E]),R=p.useCallback(F=>{const Y=y.current;if(!Y)return null;const q=Y.getBoundingClientRect();return q.width<=0||q.height<=0?null:{x:Math.max(0,Math.min(1,(F.clientX-q.left)/q.width)),y:Math.max(0,Math.min(1,(F.clientY-q.top)/q.height))}},[]),T=F=>{var M;if(s.mutating)return;const Y=R(F.nativeEvent);if(!Y)return;F.currentTarget.setPointerCapture(F.pointerId);const q=((M=w.current)==null?void 0:M.surfaceId)??null,$=q!==null&&E("begin",Y,q);C.current={pointerId:F.pointerId,startX:F.clientX,startY:F.clientY,lastPoint:Y,points:[{type:"begin",...Y}],live:$,surfaceId:$?q:null}},P=F=>{const Y=C.current;if(!Y||Y.pointerId!==F.pointerId)return;const q=R(F.nativeEvent);q&&Y.live?(Y.lastPoint=q,S.current=Y.surfaceId?{...q,surfaceId:Y.surfaceId}:null,k.current===null&&(k.current=window.requestAnimationFrame(()=>N()))):q&&Y.points.length<PW-1&&(Y.lastPoint=q,Y.points.push({type:"move",...q}))},z=F=>{const Y=C.current;if(C.current=null,!Y||Y.pointerId!==F.pointerId)return;const q=R(F.nativeEvent);if(!q)return;if(Y.live){N(),Y.surfaceId&&E("end",q,Y.surfaceId);return}(Math.hypot(F.clientX-Y.startX,F.clientY-Y.startY)>BW?s.gesture([...Y.points,{type:"end",...q}]):s.tap(q.x,q.y)).catch(U=>me.error(`Emulator input failed: ${U.message}`))},B=async()=>{try{await s.detach()}catch(F){me.error(`Could not detach Emulator: ${F.message}`)}};return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-[var(--background)]",children:[o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("span",{className:"truncate text-xs font-medium",children:r.deviceName??r.deviceId}),o.jsx(CT,{state:r.deviceState}),!r.available&&o.jsx(Pt,{variant:"outline",children:"Unavailable"}),h&&l&&o.jsxs(Pt,{variant:"outline",className:"gap-1 border-[var(--warning)]/30 font-mono text-[8px] uppercase text-[var(--warning)]",children:[o.jsx(Le,{className:"size-2.5 animate-spin"}),"Reconnecting"]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(re,{variant:"ghost",size:"icon-sm",disabled:!r.available||s.mutating,title:"Home","aria-label":"Home",onClick:()=>void s.button("home").catch(F=>me.error(`Home failed: ${F.message}`)),children:o.jsx(kE,{})}),o.jsxs(re,{variant:"ghost",size:"sm",disabled:s.mutating,title:"Detach from this session",onClick:()=>void B(),children:[s.mutating?o.jsx(Le,{className:"animate-spin"}):o.jsx(yB,{}),"Detach"]})]})]}),o.jsxs("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden p-3",children:[!d&&!h&&o.jsx("div",{className:"absolute inset-0 z-10 grid place-items-center bg-[var(--background)]",children:o.jsx(zy,{icon:o.jsx(Le,{className:"size-5 animate-spin"}),label:"Connecting to Emulator…"})}),h&&!l&&o.jsxs("div",{className:"max-w-sm text-center",children:[o.jsx(Yf,{className:"mx-auto mb-3 size-7 text-[var(--muted-foreground)]"}),o.jsx("p",{className:"text-sm font-medium",children:t==="local"?"Preview is unavailable":"Remote Emulator Surface is unavailable"}),o.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--muted-foreground)]",children:h.message==="emulator_surface_upgrade_required"?"Upgrade the selected Runtime daemon to a version with Emulator Surface support.":h.message})]}),l&&o.jsx("img",{ref:y,src:l,alt:r.deviceName??r.deviceId,draggable:!1,onLoad:F=>{x({width:F.currentTarget.naturalWidth,height:F.currentTarget.naturalHeight}),m(!0)},onPointerDown:n?void 0:T,onPointerMove:n?void 0:P,onPointerUp:n?void 0:z,onPointerCancel:n?void 0:()=>{const F=C.current;C.current=null,F!=null&&F.live&&(N(),F.surfaceId&&E("end",F.lastPoint,F.surfaceId))},className:"max-h-full max-w-full touch-none select-none rounded-md bg-black object-contain shadow-[var(--shadow-md)]",style:g?{aspectRatio:`${g.width} / ${g.height}`}:void 0})]})]})}function HW(e){const t=location.protocol==="https:"?"wss":"ws",r=new URLSearchParams({bindingId:e.bindingId,maximumFrameRate:String(e.maximumFrameRate),capability:e.capability});return Ly(r),`${t}://${location.host}/api/runtimes/${encodeURIComponent(e.runtimeSelector)}/sessions/${encodeURIComponent(e.sessionId)}/emulator/surface?${r.toString()}`}function CT({state:e}){return o.jsxs(Pt,{variant:"outline",className:Pe("gap-1 px-1.5 py-0 font-mono text-[8px] uppercase",e==="booted"&&"border-[var(--success)]/30 text-[var(--success)]",e==="shutdown"&&"text-[var(--muted-foreground)]"),children:[o.jsx("span",{className:Pe("size-1 rounded-full bg-current",e==="booted"&&"animate-pulse")}),e]})}function zy({icon:e,label:t}){return o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 text-[var(--muted-foreground)]",children:[e,o.jsx("span",{className:"text-xs",children:t})]})}var op="Collapsible",[FW]=en(op),[qW,$y]=FW(op),kT=p.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:s,defaultOpen:n,disabled:l,onOpenChange:c,...d}=e,[m,h]=ao({prop:s,defaultProp:n??!1,onChange:c,caller:op});return o.jsx(qW,{scope:r,disabled:l,contentId:Zs(),open:m,onOpenToggle:p.useCallback(()=>h(v=>!v),[h]),children:o.jsx(Ye.div,{"data-state":Hy(m),"data-disabled":l?"":void 0,...d,ref:t})})});kT.displayName=op;var ET="CollapsibleTrigger",RT=p.forwardRef((e,t)=>{const{__scopeCollapsible:r,...s}=e,n=$y(ET,r);return o.jsx(Ye.button,{type:"button","aria-controls":n.open?n.contentId:void 0,"aria-expanded":n.open||!1,"data-state":Hy(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...s,ref:t,onClick:Be(e.onClick,n.onOpenToggle)})});RT.displayName=ET;var Uy="CollapsibleContent",NT=p.forwardRef((e,t)=>{const{forceMount:r,...s}=e,n=$y(Uy,e.__scopeCollapsible);return o.jsx(tn,{present:r||n.open,children:({present:l})=>o.jsx(WW,{...s,ref:t,present:l})})});NT.displayName=Uy;var WW=p.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:s,children:n,...l}=e,c=$y(Uy,r),[d,m]=p.useState(s),h=p.useRef(null),v=ut(t,h),g=p.useRef(0),x=g.current,y=p.useRef(0),w=y.current,S=c.open||d,k=p.useRef(S),C=p.useRef(void 0);return p.useEffect(()=>{const E=requestAnimationFrame(()=>k.current=!1);return()=>cancelAnimationFrame(E)},[]),mr(()=>{const E=h.current;if(E){C.current=C.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const N=E.getBoundingClientRect();g.current=N.height,y.current=N.width,k.current||(E.style.transitionDuration=C.current.transitionDuration,E.style.animationName=C.current.animationName),m(s)}},[c.open,s]),o.jsx(Ye.div,{"data-state":Hy(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!S,...l,ref:v,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...e.style},children:S&&n})});function Hy(e){return e?"open":"closed"}var VW=kT,GW=RT,YW=NT;const lp=VW,cp=GW,up=YW;function KW({status:e}){return e==="completed"?o.jsx(Ar,{className:"size-3 shrink-0 text-[var(--success)]"}):e==="in_progress"?o.jsx(Le,{className:"size-3 shrink-0 animate-spin text-[var(--primary)]"}):o.jsx(bO,{className:"size-3 shrink-0 text-[var(--muted-foreground)]"})}function XW({todos:e}){const[t,r]=p.useState(!0);if(e.length===0)return null;const s=e.filter(n=>n.status==="completed").length;return o.jsxs(lp,{open:t,onOpenChange:r,className:"mx-auto mt-2 w-[calc(100%-2rem)] max-w-3xl rounded-md border border-[var(--border)] bg-[var(--muted)]/30",children:[o.jsxs(cp,{className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[o.jsx(po,{className:Pe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),o.jsx("span",{className:"label-caps text-[var(--muted-foreground)]",children:"Tasks"}),o.jsxs("span",{className:"font-mono text-[var(--muted-foreground)]",children:[s,"/",e.length]})]}),o.jsx(up,{className:"overflow-hidden px-3 pb-2",children:o.jsx("ul",{className:"space-y-1",children:e.map(n=>o.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[o.jsx(KW,{status:n.status}),o.jsx("span",{className:Pe("truncate",n.status==="completed"&&"text-[var(--muted-foreground)] line-through"),children:n.subject})]},n.id))})})]})}const ZW="modulepreload",QW=function(e){return"/"+e},n5={},JW=function(t,r,s){let n=Promise.resolve();if(r&&r.length>0){let c=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));n=c(r.map(h=>{if(h=QW(h),h in n5)return;n5[h]=!0;const v=h.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":ZW,v||(x.as="script"),x.crossOrigin="",x.href=h,m&&x.setAttribute("nonce",m),document.head.appendChild(x),v)return new Promise((y,w)=>{x.addEventListener("load",y),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return n.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})};function Fy({open:e,src:t,alt:r,onOpenChange:s}){return o.jsx(sn,{open:e,onOpenChange:s,children:o.jsxs(Di,{showCloseButton:!1,"aria-describedby":void 0,className:"inset-0 left-0 top-0 h-dvh max-h-none w-screen max-w-none translate-x-0 translate-y-0 place-items-center gap-0 rounded-none bg-black/80 p-4 text-white ring-0 sm:max-w-none",onClick:()=>s(!1),children:[o.jsx(Li,{className:"sr-only",children:r}),o.jsxs("div",{className:"absolute right-4 top-4 z-10 flex items-center gap-2",onClick:n=>n.stopPropagation(),children:[o.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"grid size-9 place-items-center rounded-full bg-black/60 text-white transition-colors hover:bg-black/75 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white","aria-label":"Open original image",children:o.jsx(td,{className:"size-4"})}),o.jsx($m,{asChild:!0,children:o.jsx("button",{type:"button",className:"grid size-9 place-items-center rounded-full bg-black/60 text-white transition-colors hover:bg-black/75 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white","aria-label":"Close image preview",children:o.jsx(Ni,{className:"size-5"})})})]}),o.jsx("img",{src:t,alt:r,className:"block h-auto max-h-[calc(100dvh-2rem)] min-h-0 w-auto max-w-[calc(100vw-2rem)] min-w-0 rounded-md object-contain shadow-2xl",onClick:n=>n.stopPropagation()})]})})}function eV(e,t,r){const[s,n]=p.useState(e),l=p.useRef(0),c=p.useRef(0),d=p.useRef(e);return d.current=e,p.useEffect(()=>{if(!r){window.clearTimeout(c.current),c.current=0,l.current=0,n(e);return}if(Object.is(s,e))return;const m=Date.now()-l.current;if(l.current===0||m>=t){window.clearTimeout(c.current),c.current=0,l.current=Date.now(),n(e);return}c.current===0&&(c.current=window.setTimeout(()=>{c.current=0,l.current=Date.now(),n(d.current)},t-m))},[r,t,s,e]),p.useEffect(()=>()=>{window.clearTimeout(c.current)},[]),r?s:e}const tV=/^\$(?:\{[A-Z_][A-Z0-9_]*\}|[A-Z_][A-Z0-9_]+(?![A-Za-z0-9_]))/,rV=/^ {0,3}(`{3,}|~{3,})/;function sV(e){let t="",r="",s=0,n=!1;for(let l=0;l<e.length;l+=1){const c=e[l],d=l===0||e[l-1]===`
588
+ `;if(!s&&d){const m=e.slice(l).match(rV);if(m){const h=m[1];r?h[0]===r[0]&&h.length>=r.length&&(r=""):r=h,t+=m[0],l+=m[0].length-1;continue}}if(r){t+=c;continue}if(c==="`"){let m=1;for(;e[l+m]==="`";)m+=1;s===0?s=m:m===s&&(s=0),t+=e.slice(l,l+m),l+=m-1;continue}if(s){t+=c;continue}if(c==="\\"&&(e[l+1]==="\\"||e[l+1]==="$")){t+=e.slice(l,l+2),l+=1;continue}if(c==="$"){let m=1;for(;e[l+m]==="$";)m+=1;if(m===1&&!n&&(/\d/.test(e[l+1]??"")||tV.test(e.slice(l)))){t+="\\$";continue}n=!n,t+=e.slice(l,l+m),l+=m-1;continue}if(!n){const m=e.slice(l,l+2);if(m==="\\("||m==="\\)"){t+="$",l+=1;continue}if(m==="\\["||m==="\\]"){t+="$$",l+=1;continue}}t+=c}return t}const iV=/:\d+(?::\d+)?$/,nV=/^[a-z][a-z\d+.-]*:/i;function qy(e,t){let r;try{r=decodeURI(e).replace(iV,"")}catch{return null}if(!r||r.includes("\0")||r.includes(`
589
+ `)||r.includes("\r")||r.includes("?")||r.includes("#")||nV.test(r)||r.startsWith("//"))return null;if(r.startsWith("/")||t)return r;const s=r.indexOf("/");return s>0&&!/\s/.test(r.slice(0,s))?r:null}const a5="data-rynx-workspace-image",WQ="/__rynx_workspace_image__",aV=p.lazy(()=>JW(()=>import("./mermaid-GHXKKRXX-C_lUqoOB.js").then(e=>e.bB),__vite__mapDeps([0,1])).then(e=>({default:e.MarkdownStreamdown}))),oV=100,lV=5e4,cV=5e3,d_=2e5,uV=Pe("min-w-0 wrap-anywhere text-sm leading-relaxed","[&_p]:my-1.5 [&_ul]:my-1.5 [&_ol]:my-1.5 [&_li]:my-0.5","[&_pre]:my-2 [&_pre]:rounded-md [&_pre]:text-xs","[&_code]:font-mono [&_h1]:mt-3 [&_h2]:mt-3 [&_h3]:mt-2","[&_a]:text-[var(--primary)] [&_a]:underline [&_a]:underline-offset-2");function dV(e){let t=0,r=0;for(let s=0;s<e.length;s+=1){const n=e.charCodeAt(s);n===32||n>=9&&n<=13?r=0:(r+=1,r>t&&(t=r))}return t}function hV(e){return e.length>lV||dV(e)>cV}function fV({text:e,className:t}){const r=e.length>d_,s=r?e.slice(0,d_):e;return o.jsxs("div",{className:Pe("whitespace-pre-wrap break-all font-mono text-sm",t),children:[s,r&&o.jsx("span",{className:"text-[var(--muted-foreground)]",children:`
590
+ … [${e.length-d_} more characters not shown]`})]})}const jT=p.createContext(null),mV="wrap-anywhere font-medium text-[var(--primary)] underline";function Wy(e){const t=p.useContext(jT),r=p.useMemo(()=>t&&e?pe.sessionWorkspaceFileContentUrl(t.runtimeSelector,t.sessionId,e):null,[e,t]),[s,n]=p.useState(null);return p.useEffect(()=>{if(n(null),!r)return;const l=new AbortController;return fetch(r,{method:"HEAD",signal:l.signal}).then(c=>{c.ok&&n(r)}).catch(()=>{}),()=>l.abort()},[r]),s}function pV({href:e,children:t,className:r,title:s,node:n,...l}){const c=typeof e=="string"?qy(e,!0):null,d=Wy(c),[m,h]=p.useState(!1);return c?d?o.jsx("a",{...l,href:d,target:"_blank",rel:"noreferrer",title:s??c,"data-streamdown":"link",className:Pe(mV,"decoration-dotted underline-offset-2",r),children:t}):o.jsx("span",{title:s??c,children:t}):e?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:Pe("wrap-anywhere appearance-none text-left font-medium text-[var(--primary)] underline",r),"data-streamdown":"link",onClick:()=>h(!0),children:t}),o.jsx(By,{open:m,url:e,onOpenChange:h,onConfirm:()=>window.open(e,"_blank","noreferrer")})]}):o.jsx("span",{className:r,children:t})}function gV({children:e,className:t,node:r,...s}){const l=qy(typeof e=="string"?e:"",!1),c=Wy(l);if(!c)return o.jsx("code",{...s,className:Pe("rounded bg-[var(--muted)] px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",children:e});const d=()=>window.open(c,"_blank","noreferrer");return o.jsx("code",{...s,role:"link",tabIndex:0,className:Pe("cursor-pointer font-mono underline decoration-dotted underline-offset-2 transition-colors hover:text-[var(--foreground)]",t),"data-streamdown":"inline-code",onClick:d,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),d())},children:e})}function vV({src:e,alt:t="",className:r,node:s,...n}){const l=n[a5],c=typeof l=="string"?qy(l,!0):null,d=Wy(c),[m,h]=p.useState(!1),[v,g]=p.useState(!1);if(p.useEffect(()=>g(!1),[d]),!c||!d)return o.jsx("span",{className:"text-[var(--muted-foreground)]",children:t||"Image unavailable"});if(v)return o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[var(--muted-foreground)]",children:[o.jsx(O0,{className:"size-4","aria-hidden":"true"}),t||"Image unavailable"]});const x={...n};return delete x[a5],o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"group my-2 block max-w-full overflow-hidden rounded-md text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ring)]","aria-label":`Open ${t||"image"}`,onClick:()=>h(!0),children:o.jsx("img",{...x,src:d,alt:t,loading:"lazy",className:Pe("block h-auto max-h-80 max-w-full rounded-md object-contain transition-opacity group-hover:opacity-90",r),onError:()=>g(!0)})}),o.jsx(Fy,{open:m,src:d,alt:t||"Markdown image",onOpenChange:h})]})}const _V={a:pV,inlineCode:gV,img:vV};function xV({isOpen:e,onClose:t,onConfirm:r,url:s}){return o.jsx(By,{open:e,url:s,onOpenChange:n=>{n||t()},onConfirm:r})}function fm({children:e,className:t,workspaceFiles:r,breaks:s=!1,streaming:n=!1}){const l=p.useMemo(()=>r?{runtimeSelector:r.runtimeSelector,sessionId:r.sessionId}:null,[r==null?void 0:r.runtimeSelector,r==null?void 0:r.sessionId]),c=p.useMemo(()=>hV(e),[e]),d=p.useMemo(()=>c?e:sV(e),[e,c]),m=eV(d,oV,n);return c?o.jsx(fV,{text:e,className:t}):o.jsx(p.Suspense,{fallback:o.jsx("div",{className:Pe("whitespace-pre-wrap break-words text-sm",t),children:m}),children:o.jsx(jT.Provider,{value:l,children:o.jsx(aV,{breaks:s,shikiTheme:["github-light","github-dark"],linkSafety:{enabled:!0,renderModal:xV},components:_V,className:Pe(uV,t),children:m})})})}function o5(e,t,r={},s={},n=!0){const l={},c={};for(const d of e){if(d.type==="text"){const y=typeof t[d.id]=="string"?t[d.id]:"";n&&d.required&&!y.trim()?c[d.id]=`${d.label} is required`:y.length>0&&(l[d.id]=y);continue}const m=new Set(d.options.map(y=>y.value)),h=d.allowOther===!0&&s[d.id]===!0,v=h?(r[d.id]??"").trim():"";if(d.multiple){const y=Array.isArray(t[d.id])?t[d.id]:[],w=d.options.map(S=>S.value).filter(S=>y.includes(S));v&&!w.includes(v)&&w.push(v),n&&h&&!v?c[d.id]=`${d.label}: enter a value for Other`:n&&d.required&&w.length===0?c[d.id]=`${d.label} is required`:w.length>0&&(l[d.id]=w);continue}const g=typeof t[d.id]=="string"?t[d.id]:"",x=h?v:m.has(g)?g:"";n&&h&&!v?c[d.id]=`${d.label}: enter a value for Other`:n&&d.required&&!x?c[d.id]=`${d.label} is required`:x&&(l[d.id]=x)}return Object.keys(c).length>0?{ok:!1,errors:c}:{ok:!0,answers:l}}function yV({sessionId:e,item:t,canResolve:r=!0}){var U,W;const{runtimeSelector:s}=jc(),n=p.useId().replaceAll(":",""),[l,c]=p.useState({}),[d,m]=p.useState({}),[h,v]=p.useState({}),[g,x]=p.useState({}),[y,w]=p.useState(()=>{var A;return(A=t.request.fields[0])==null?void 0:A.id}),[S,k]=p.useState(),[C,E]=p.useState(),N=t.status==="pending";function R(A){x(O=>{if(!O[A])return O;const L={...O};return delete L[A],L})}function T(A,O){c(L=>({...L,[A]:O})),R(A)}function P(A,O){v(L=>({...L,[A]:O})),R(A)}function z(A){const O=t.request.fields,L=Math.max(O.findIndex(H=>H.id===y),0),G=O.findIndex(H=>H.id===A);if(!(G<0)){if(G>L){const H=O[L];if(H){const D=o5([H],l,d,h);if(!D.ok){x(V=>({...V,...D.errors}));return}R(H.id)}}w(A)}}async function B(A){if(!r)return;const O=o5(t.request.fields,l,d,h,A.requiresAnswers);if(!O.ok){x(O.errors);const L=t.request.fields.find(G=>O.errors[G.id]);L&&w(L.id);return}x({}),k(void 0),E(A.id);try{await oU(e,t.id,{actionId:A.id,...Object.keys(O.answers).length>0?{answers:O.answers}:{}},s)}catch(L){E(void 0),k(L instanceof Error?L.message:String(L))}}const F=t.request.kind==="permission"?J6:t.request.kind==="form"?a6:mO,Y=Math.max(t.request.fields.findIndex(A=>A.id===y),0),q=t.request.fields.length===0||Y===t.request.fields.length-1,$=t.request.actions.filter(A=>!A.requiresAnswers||q),M=((U=t.request.context)==null?void 0:U.toolName)==="ExitPlanMode"&&!!t.request.context.summary;return o.jsxs("section",{"aria-labelledby":`${n}-title`,"aria-busy":C!==void 0,className:Pe("min-w-0 max-w-full overflow-hidden rounded-lg border p-3 text-xs shadow-sm",t.request.kind==="permission"?"border-[var(--warning)]/40 bg-[var(--warning)]/5":"border-[var(--primary)]/30 bg-[var(--primary)]/5"),children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(F,{"aria-hidden":"true",className:Pe("mt-0.5 size-4 shrink-0",t.request.kind==="permission"?"text-[var(--warning)]":"text-[var(--primary)]")}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{id:`${n}-title`,className:"font-medium text-[var(--foreground)]",children:t.request.title}),t.request.description&&o.jsx("p",{className:"mt-1 leading-relaxed text-[var(--muted-foreground)]",children:t.request.description})]})]}),o.jsx(wV,{item:t}),N&&!r?o.jsx("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:"Pending interaction · resolve it on the owning Runtime."}):N?o.jsxs("div",{className:"mt-3 grid min-w-0 gap-3",children:[M?o.jsx(bV,{plan:t.request.context.summary,actions:t.request.actions,feedback:typeof l.feedback=="string"?l.feedback:"",busyActionId:C,onFeedback:A=>T("feedback",A),onSubmit:A=>void B(A)}):o.jsx(y$,{idPrefix:n,fields:t.request.fields,activeFieldId:y,answers:l,otherValues:d,otherSelections:h,errors:g,disabled:C!==void 0,onNavigate:z,onAnswerChange:T,onOtherSelectionChange:P,onOtherValueChange:(A,O)=>{m(L=>({...L,[A]:O})),R(A)}}),S&&o.jsxs("p",{role:"alert",className:"text-[var(--destructive)]",children:["Could not submit: ",S]}),!M&&o.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[$.map(A=>o.jsxs(re,{type:"button",size:"sm",variant:CV(A),className:"h-auto max-w-full whitespace-normal break-words py-1.5 text-left",disabled:C!==void 0,title:A.description,"aria-label":A.description?`${A.label}. ${A.description}`:void 0,onClick:()=>void B(A),children:[C===A.id&&o.jsx(Le,{"aria-hidden":"true",className:"animate-spin"}),A.label]},A.id)),C&&o.jsxs("span",{role:"status",className:"text-[var(--muted-foreground)]",children:["Submitting ",(W=t.request.actions.find(A=>A.id===C))==null?void 0:W.label,"…"]})]})]}):o.jsx(SV,{item:t})]})}function bV({plan:e,actions:t,feedback:r,busyActionId:s,onFeedback:n,onSubmit:l}){const[c,d]=p.useState(!1),m=v=>t.find(g=>g.id===v),h=v=>{const g=m(v);g&&l(g)};return o.jsxs("div",{className:"grid min-w-0 gap-3","data-testid":"exit-plan-mode-review",children:[o.jsx("p",{className:"text-[var(--muted-foreground)]",children:"Claude finished planning and wants to proceed."}),o.jsx("div",{className:"rounded-md border bg-[var(--background)]/60 p-3",children:o.jsx(fm,{className:"[&>:first-child]:mt-0 [&>:last-child]:mb-0",children:e})}),c?o.jsxs("div",{className:"grid gap-2","data-testid":"exit-plan-mode-feedback",children:[o.jsx(Ec,{autoFocus:!0,className:"min-h-20 text-xs",placeholder:"What should change about the plan? (optional)",value:r,disabled:s!==void 0,onChange:v=>n(v.target.value)}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs(re,{size:"sm",disabled:s!==void 0,onClick:()=>h("deny_feedback"),children:[s==="deny_feedback"?o.jsx(Le,{className:"animate-spin"}):o.jsx(Ni,{}),"Reject plan"]}),o.jsx(re,{size:"sm",variant:"ghost",disabled:s!==void 0,onClick:()=>d(!1),children:"Cancel"})]})]}):o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs(re,{size:"sm",disabled:s!==void 0,onClick:()=>h("allow_auto"),children:[s==="allow_auto"?o.jsx(Le,{className:"animate-spin"}):o.jsx(kB,{}),"Yes, and use auto mode"]}),o.jsxs(re,{size:"sm",variant:"outline",disabled:s!==void 0,onClick:()=>h("allow_manual"),children:[s==="allow_manual"?o.jsx(Le,{className:"animate-spin"}):o.jsx(Ar,{}),"Yes, manually approve edits"]}),o.jsxs(re,{size:"sm",variant:"outline",disabled:s!==void 0,onClick:()=>d(!0),children:[o.jsx(Ni,{})," Reject with feedback"]})]})]})}function wV({item:e}){const t=e.request.context;return!t||t.toolName==="ExitPlanMode"?null:o.jsxs("div",{className:"mt-3 grid min-w-0 gap-1.5",children:[t.summary&&o.jsx("p",{className:"break-words leading-relaxed text-[var(--muted-foreground)]",children:t.summary}),t.toolName&&o.jsxs("div",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["tool · ",t.toolName]}),t.command&&o.jsx(l5,{value:t.command}),t.cwd&&o.jsx("div",{className:"min-w-0 whitespace-pre-wrap break-all font-mono text-[10px] text-[var(--muted-foreground)]",children:t.cwd}),t.diff&&o.jsx(l5,{value:t.diff,tall:!0})]})}function l5({value:e,tall:t=!1}){return o.jsx("pre",{className:Pe("min-w-0 max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] rounded-md bg-[var(--muted)] p-2 font-mono text-[11px] leading-relaxed",t?"max-h-56":"max-h-32"),children:o.jsx("code",{className:"block min-w-0",children:e})})}function SV({item:e}){var s;if(e.status!=="resolved"){const n=e.status==="expired"?"Expired":e.status==="inactive"?"No longer active":"Cancelled";return o.jsxs("div",{role:"status",className:"mt-3 text-[var(--muted-foreground)]",children:[n,e.reason?` · ${e.reason}`:""]})}const t=e.request.actions.find(n=>{var l;return n.id===((l=e.resolution)==null?void 0:l.actionId)}),r=e.request.fields.flatMap(n=>{var d,m;const l=(m=(d=e.resolution)==null?void 0:d.answers)==null?void 0:m[n.id];if(l===void 0)return[];const c=n.type==="text"&&n.secret?"••••••••":Array.isArray(l)?l.join(", "):l;return[{id:n.id,label:n.label,value:c}]});return o.jsxs("div",{"aria-live":"polite",className:"mt-3 grid gap-1.5 text-[var(--muted-foreground)]",children:[o.jsxs("div",{children:["Resolved · ",(t==null?void 0:t.label)??((s=e.resolution)==null?void 0:s.actionId)??"answered"]}),r.map(n=>o.jsxs("div",{className:"grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-2 text-[11px]",children:[o.jsx("span",{children:n.label}),o.jsx("span",{className:"break-words text-[var(--foreground)]",children:n.value})]},n.id))]})}function CV(e){return e.style==="primary"?"default":e.style==="danger"?"destructive":"outline"}function kV({item:e}){const t=e.rotateKind==="fork"?FO:jO;return o.jsxs("div",{className:"my-2 flex items-center gap-2 text-[10px] text-[var(--muted-foreground)]",children:[o.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"}),o.jsx(t,{className:"size-3 shrink-0 text-[var(--primary)]"}),o.jsx("span",{className:"label-caps",children:e.label}),o.jsx("span",{className:"font-mono opacity-70",children:e.newSessionId.slice(0,12)}),o.jsx("div",{className:"h-px flex-1 bg-[var(--border)]"})]})}function EV({item:e}){return e.code==="response_stopped"?o.jsxs("div",{className:"my-1 flex items-center gap-2 px-1 py-1 text-xs text-[var(--muted-foreground)]",children:[o.jsx(SE,{className:"size-3.5 shrink-0"}),o.jsx("span",{children:"Response stopped"})]}):o.jsxs("div",{className:"my-1 flex gap-2 rounded-md border border-[var(--destructive)]/40 bg-[var(--destructive)]/5 px-3 py-2 text-sm",children:[o.jsx(Ci,{className:"size-4 shrink-0 text-[var(--destructive)]"}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"label-caps text-[10px] text-[var(--destructive)]",children:[e.source," error · ",e.code]}),o.jsx("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[var(--foreground)]/80",children:e.message})]})]})}function RV({item:e,sessionId:t,runtimeSelector:r}){const[s,n]=p.useState(null),[l,c]=p.useState(()=>new Set),[d,m]=p.useState({}),h=e.images??[],v=e.files??[],g=h.find(x=>h_(x)===s);return e.role==="user"?o.jsx("div",{className:"flex justify-end",children:o.jsxs("div",{className:"max-w-[85%] rounded-md rounded-br-sm bg-[var(--primary)]/10 p-2 text-sm dark:bg-[var(--primary)]/25 dark:ring-1 dark:ring-inset dark:ring-[var(--primary)]/35",children:[h.length>0&&o.jsx("div",{className:`grid gap-1.5 ${h.length===1?"grid-cols-1":"grid-cols-2"}`,children:h.map(x=>{const y=h_(x),w=jV(f_(r,t,e.id,x),d[y]??0),S=l.has(y);return o.jsx("button",{type:"button",className:"group relative size-28 overflow-hidden rounded-md border border-black/10 bg-[var(--muted)] text-[var(--muted-foreground)] sm:size-36",onClick:()=>{S?(c(k=>{const C=new Set(k);return C.delete(y),C}),m(k=>({...k,[y]:(k[y]??0)+1}))):n(y)},"aria-label":`${S?"Retry":"Open"} ${x.filename??"attached image"}`,children:S?o.jsxs("span",{className:"flex size-full items-center justify-center gap-2 px-3 text-xs",children:[o.jsx(O0,{className:"size-4"}),"Image unavailable"]}):o.jsx("img",{src:w,alt:x.filename??"Attached image",loading:"lazy",className:"size-full object-cover transition-transform group-hover:scale-[1.02]",onError:()=>c(k=>new Set(k).add(y))})},y)})}),v.length>0&&o.jsx("div",{className:h.length>0?"mt-2 space-y-1.5":"space-y-1.5",children:v.map(x=>o.jsxs("a",{href:f_(r,t,e.id,x),target:"_blank",rel:"noreferrer",className:"flex min-w-0 items-center gap-2 rounded-md border border-black/10 bg-[var(--card)]/80 px-2.5 py-2 text-left text-[var(--foreground)] transition-colors hover:bg-[var(--card)]",children:[o.jsx(xd,{className:"size-4 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-xs font-medium",children:x.filename??"Attached file"}),o.jsxs("span",{className:"block truncate text-[10px] text-[var(--muted-foreground)]",children:[x.mediaType,x.byteLength?` · ${NV(x.byteLength)}`:""]})]}),o.jsx(td,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"})]},h_(x)))}),e.text&&o.jsx(fm,{breaks:!0,className:`px-1 [&>:first-child]:mt-0 [&>:last-child]:mb-0 ${h.length||v.length?"pt-2":""}`,workspaceFiles:{runtimeSelector:r,sessionId:t},children:e.text}),g&&o.jsx(Fy,{open:!0,src:f_(r,t,e.id,g),alt:g.filename??"Attached image",onOpenChange:x=>{x||n(null)}})]})}):o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"flex min-w-0 max-w-[90%] flex-col items-start",children:[o.jsxs("div",{className:"rounded-md rounded-bl-sm bg-[var(--muted)] px-3.5 py-2.5",children:[e.text&&o.jsx(fm,{className:"[&>:first-child]:mt-0 [&>:last-child]:mb-0",streaming:e.streaming,workspaceFiles:{runtimeSelector:r,sessionId:t},children:e.text}),e.streaming&&o.jsx("span",{className:"ml-0.5 inline-block h-4 w-[3px] translate-y-0.5 animate-pulse rounded-full bg-[var(--primary)] align-middle"})]}),e.interrupted&&o.jsxs("div",{className:"mt-1 flex items-center gap-1 px-1 text-xs text-[var(--muted-foreground)]","data-testid":"assistant-interrupted-indicator",children:[o.jsx(SE,{className:"size-3.5 shrink-0","aria-hidden":"true"}),o.jsx("span",{children:"Response stopped"})]})]})})}function h_(e){return"resourceId"in e&&e.resourceId?`resource:${e.resourceId}`:`path:${e.partIndex}`}function f_(e,t,r,s){return"resourceId"in s&&s.resourceId?pe.sessionResourceContentUrl(e,t,s):pe.sessionItemFileContentUrl(e,t,r,s.partIndex)}function NV(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function jV(e,t){return t===0?e:`${e}${e.includes("?")?"&":"?"}retry=${t}`}function AV({item:e}){const t=e.summary.filter(Boolean).join(`
591
+
592
+ `).trim(),[r,s]=p.useState(e.streaming??!1);return p.useEffect(()=>{s(e.streaming??!1)},[e.streaming]),!t&&!e.streaming?null:o.jsxs(lp,{open:r,onOpenChange:s,className:"my-0.5",children:[o.jsxs(cp,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs text-[var(--muted-foreground)] hover:bg-[var(--muted)]/50",children:[o.jsx(po,{className:Pe("size-3 shrink-0 transition-transform",r&&"rotate-90")}),o.jsx(DE,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:Pe("label-caps text-[10px]",e.streaming&&"animate-pulse"),children:e.streaming?"Thinking…":"Thought"})]}),o.jsx(up,{className:"overflow-hidden pl-7",children:o.jsx("div",{className:"mt-1 border-l-2 border-[var(--border)] pl-3 text-[var(--muted-foreground)]",children:t?o.jsx(fm,{children:t}):o.jsx("span",{className:"animate-pulse text-xs",children:"…"})})})]})}const c5=12e3;function u5(e){return e.length<=c5?{text:e,truncated:!1}:{text:e.slice(0,c5),truncated:!0}}function TV({item:e}){const[t,r]=p.useState(!1),s=e.stdout?u5(e.stdout):null,n=e.stderr?u5(e.stderr):null,l=!!(s||n);return o.jsxs(lp,{open:t,onOpenChange:r,className:"my-0.5",children:[o.jsxs(cp,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[o.jsx(po,{className:Pe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",t&&"rotate-90")}),o.jsx(LE,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"truncate font-mono",children:[o.jsx("span",{className:"text-[var(--muted-foreground)]",children:"$ "}),e.command]})]}),o.jsxs(up,{className:"overflow-hidden pl-7",children:[s&&o.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[o.jsx("code",{children:s.text}),s.truncated&&o.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),n&&o.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--destructive)]/40 p-2 text-[11px] leading-relaxed text-[var(--destructive)]",children:[o.jsx("code",{children:n.text}),n.truncated&&o.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),!l&&o.jsx("div",{className:"mt-1 text-[11px] text-[var(--muted-foreground)]",children:"(no output)"})]})]})}const d5=80,h5=12e3;function MV(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function DV(e){try{const t=JSON.parse(e);for(const s of["command","cmd","path","file","file_path","query","url","pattern","description"]){const n=t[s];if(typeof n=="string"&&n)return n}const r=JSON.stringify(t);return r==="{}"?"":r}catch{return e}}function LV(e,t){if(e==="apply_patch")try{const r=JSON.parse(t);if(Array.isArray(r.changes)&&r.changes.length>0){if(r.changes.length===1){const s=r.changes[0];if(s&&typeof s=="object"){const n=Reflect.get(s,"path");if(typeof n=="string"&&n)return{name:"Edit",summary:n}}}return{name:"Edit",summary:`${r.changes.length} files`}}}catch{}return{name:e,summary:DV(t)}}function OV(e){let t=e,r=!1;const s=t.split(`
593
+ `);return s.length>d5&&(t=s.slice(0,d5).join(`
594
+ `),r=!0),t.length>h5&&(t=t.slice(0,h5),r=!0),{text:t,truncated:r}}function BV({status:e}){return e==="in_progress"?o.jsx(Le,{className:"size-3.5 shrink-0 animate-spin text-[var(--primary)]"}):e==="failed"?o.jsx(xO,{className:"size-3.5 shrink-0 text-[var(--destructive)]"}):e==="incomplete"?o.jsx(gO,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}):o.jsx(Ar,{className:"size-3.5 shrink-0 text-[var(--success)]"})}function PV({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:s=!0}){var S,k,C;const[n,l]=p.useState(!1),c=LV(e.name,e.arguments),d=e.output?OV(e.output):null,m=!!e.arguments&&e.arguments!=="{}",h=e.children??[],v=e.generatedImage?"resourceId"in e.generatedImage&&e.generatedImage.resourceId?pe.sessionResourceContentUrl(r,t,e.generatedImage):e.generatedImageItemId?pe.sessionItemFileContentUrl(r,t,e.generatedImageItemId,0):void 0:void 0,[g,x]=p.useState(!1),[y,w]=p.useState(!1);return o.jsxs(lp,{open:n,onOpenChange:l,className:"my-0.5",children:[o.jsxs(cp,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-[var(--muted)]/50",children:[o.jsx(po,{className:Pe("size-3 shrink-0 text-[var(--muted-foreground)] transition-transform",n&&"rotate-90")}),o.jsx(BV,{status:e.status}),o.jsx("span",{className:"shrink-0 font-mono font-medium",children:c.name}),c.summary&&o.jsx("span",{className:"truncate text-[var(--muted-foreground)]",children:c.summary})]}),v&&o.jsx("button",{type:"button",disabled:g,onClick:()=>w(!0),className:"ml-7 mt-1 block w-fit max-w-[min(28rem,calc(100%-1.75rem))] overflow-hidden rounded-md border border-[var(--border)] bg-[var(--muted)]","aria-label":`Preview ${((S=e.generatedImage)==null?void 0:S.filename)??"generated image"}`,children:g?o.jsxs("span",{className:"flex h-24 items-center justify-center gap-2 px-5 text-xs text-[var(--muted-foreground)]",children:[o.jsx(O0,{className:"size-4"})," Image unavailable"]}):o.jsx("img",{src:v,alt:((k=e.generatedImage)==null?void 0:k.filename)??"Generated image",loading:"lazy",className:"block max-h-80 w-auto max-w-full object-contain",onError:()=>x(!0)})}),v&&!g&&o.jsx(Fy,{open:y,src:v,alt:((C=e.generatedImage)==null?void 0:C.filename)??"Generated image",onOpenChange:w}),o.jsxs(up,{className:"overflow-hidden pl-7",children:[m&&o.jsx("pre",{className:"mt-1 overflow-auto rounded-md bg-[var(--muted)] p-2 text-[11px] leading-relaxed",children:o.jsx("code",{children:MV(e.arguments)})}),d&&o.jsxs("pre",{className:"mt-1 overflow-auto rounded-md border border-[var(--border)] p-2 text-[11px] leading-relaxed",children:[o.jsx("code",{children:d.text}),d.truncated&&o.jsx("div",{className:"mt-1 text-[var(--muted-foreground)]",children:"… output truncated"})]}),e.exitCode!=null&&e.exitCode!==0&&o.jsxs("div",{className:"mt-1 text-[11px] text-[var(--destructive)]",children:["exit code ",e.exitCode]}),h.length>0&&o.jsxs("div",{className:"mt-1 border-l border-[var(--primary)]/30 pl-2",children:[o.jsxs("div",{className:"mb-0.5 flex items-center gap-1.5 text-[11px] text-[var(--muted-foreground)]",children:[o.jsx(wB,{className:"size-3 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"font-mono",children:[h.length," sub-agent step",h.length===1?"":"s"]})]}),h.map(E=>o.jsx(AT,{item:E,sessionId:t,runtimeSelector:r,canResolveInteractions:s},E.id))]})]})]})}function AT({item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:s=!0}){switch(e.kind){case"message":return e.isMeta?null:o.jsx(RV,{item:e,sessionId:t,runtimeSelector:r});case"tool":return o.jsx(PV,{item:e,sessionId:t,runtimeSelector:r,canResolveInteractions:s});case"reasoning":return o.jsx(AV,{item:e});case"terminal_command":return o.jsx(TV,{item:e});case"divider":return o.jsx(kV,{item:e});case"error":return o.jsx(EV,{item:e});case"interaction":return o.jsx(yV,{sessionId:t,item:e,canResolve:s})}}function IV(){return o.jsx("div",{className:"flex items-center gap-1.5 py-2 pl-1",children:[0,1,2].map(e=>o.jsx("span",{className:"size-1.5 rounded-full bg-[var(--primary)]",style:{animation:"typing-dot 1.3s ease-in-out infinite",animationDelay:`${e*.18}s`}},e))})}function zV({count:e}){return o.jsxs("div",{"data-testid":"background-task-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true"}),o.jsxs("span",{children:[e," background ",e===1?"task":"tasks"," still running"]})]})}function $V({message:e}){return o.jsxs("div",{"data-testid":"runner-starting-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 shrink-0 animate-spin text-[var(--muted-foreground)]","aria-hidden":"true"}),o.jsx("span",{children:e??"Starting up… getting your terminal ready."})]})}function UV({message:e}){const t=/^MCP startup (?:failed|cancelled|incomplete)/i.test(e),r=t?Ci:Le;return o.jsxs("div",{"data-testid":"mcp-startup-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-2 py-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(r,{className:`size-4 shrink-0 ${t?"":"animate-spin"}`,"aria-hidden":"true"}),o.jsx("span",{children:e})]})}function HV(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),r=e%60;return`${t}m ${r}s`}function FV({message:e}){const t=p.useRef(Date.now()),[r,s]=p.useState(0);return p.useEffect(()=>{const n=()=>s(Math.floor((Date.now()-t.current)/1e3));n();const l=window.setInterval(n,1e3);return()=>window.clearInterval(l)},[]),o.jsxs("div",{role:"status","aria-live":"polite",className:"flex gap-3 rounded-lg border border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--card))] px-3 py-2.5",children:[o.jsx(Le,{className:"mt-0.5 size-4 shrink-0 animate-spin text-[var(--warning)]","aria-hidden":"true"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[o.jsx("span",{className:"text-sm font-medium text-[var(--foreground)]",children:"Queued for capacity"}),o.jsxs("span",{className:"font-mono text-[10px] text-[var(--muted-foreground)]",children:["Waiting ",HV(r)]})]}),o.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-[var(--muted-foreground)]",children:e}),o.jsx("p",{className:"mt-1 font-mono text-[10px] text-[var(--muted-foreground)]",children:"Use Stop below to interrupt."})]})]})}function qV({items:e,historyLoaded:t,running:r,backgroundTaskCount:s=0,startingUp:n=!1,startupStatus:l,mcpStatus:c,waitingForInteraction:d,queueStatus:m,sessionId:h,runtimeSelector:v,canResolveInteractions:g=!0}){const x=p.useRef(null),[y,w]=p.useState(!0),S=e[e.length-1],k=(S==null?void 0:S.kind)==="message"&&S.role==="assistant"&&!!S.streaming,C=(n||!!l)&&!m,E=r&&!C&&!k&&!d&&!m;return p.useEffect(()=>{y&&x.current&&(x.current.scrollTop=x.current.scrollHeight)},[e,r,s,n,l,c,m,y]),o.jsx(En,{className:"min-w-0 flex-1",viewportRef:x,viewportProps:{onScroll:N=>{const R=N.currentTarget;w(R.scrollHeight-R.scrollTop-R.clientHeight<40)},"aria-busy":!t},children:o.jsx("div",{className:"mx-auto w-full max-w-3xl space-y-3 px-4 py-3",children:!t&&e.length===0&&!m&&!C?o.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center justify-center gap-2 py-10 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 animate-spin text-[var(--primary)]","aria-hidden":"true"}),o.jsx("span",{children:"Loading conversation…"})]}):e.length===0&&!r&&s===0&&!m&&!C?o.jsx("p",{className:"py-10 text-center text-sm text-[var(--muted-foreground)]",children:"Send a message to start a turn."}):o.jsxs(o.Fragment,{children:[e.map(N=>o.jsx(AT,{item:N,sessionId:h,runtimeSelector:v,canResolveInteractions:g},N.id)),C&&o.jsx($V,{message:l}),c&&o.jsx(UV,{message:c}),m&&o.jsx(FV,{message:m}),E&&o.jsx(IV,{}),s>0&&o.jsx(zV,{count:s})]})})})}const WV=2500,Nu=new Map;function VV({sessionId:e,runtimeSelector:t,active:r,polling:s=r,readOnly:n=!1}){const l=`${t}
595
+ ${e}`,c=p.useRef(l);c.current=l;const d=p.useRef(r);d.current=r;const m=p.useRef(0),h=p.useRef(0),v=p.useRef(!1),g=p.useRef(null),x=p.useRef(null),[y,w]=p.useState(()=>Nu.get(l)??null),[S,k]=p.useState(()=>!Nu.has(l)),[C,E]=p.useState(null),[N,R]=p.useState(null),T=p.useCallback(M=>{x.current=M,R(M)},[]),P=p.useCallback(M=>{g.current=M,Nu.set(l,M),w(M)},[l]),z=p.useCallback(async M=>{if(!d.current||v.current)return;const U=l,W=m.current,A=h.current;M&&k(!0);try{const O=await pe.getRuntimeBrowserState(t,e);return!d.current||m.current!==W||h.current!==A||c.current!==U||v.current?void 0:(P(O),M&&T(null),O)}catch(O){if(!d.current||m.current!==W||h.current!==A||c.current!==U)return;M&&T(uf(O));return}finally{d.current&&m.current===W&&h.current===A&&c.current===U&&M&&k(!1)}},[l,t,e,P,T]);p.useEffect(()=>{const M=++m.current,U=Nu.has(l);return P(Nu.get(l)??null),T(null),k(!U),E(null),v.current=!1,z(!U),()=>{m.current===M&&(m.current+=1)}},[l,r,z,P,T]),p.useEffect(()=>{if(!s)return;const M=window.setInterval(()=>void z(!1),WV);return()=>window.clearInterval(M)},[r,z,s]);const B=p.useCallback(async(M,U)=>{if(n||!d.current||v.current)return;const W=l,A=m.current;h.current+=1,v.current=!0,E(M),T(null);try{const O=await U();return d.current&&m.current===A&&c.current===W?(P(O),O):void 0}catch(O){d.current&&m.current===A&&c.current===W&&T(uf(O));return}finally{d.current&&m.current===A&&c.current===W&&(v.current=!1,E(null),k(!1))}},[n,l,P,T]),F=p.useCallback((M,U)=>{const W=g.current;return W?B(M,()=>U(W.browserGeneration)):Promise.resolve(void 0)},[B]),Y=p.useCallback(M=>B("Starting browser",()=>pe.openRuntimeBrowser(t,e,M)),[t,e,B]),q=p.useCallback(async()=>{if(n)return;const M=g.current;if(!d.current||!M||v.current)return;const U=l,W=m.current;h.current+=1,v.current=!0,E("Closing browser"),T(null);try{await pe.closeRuntimeBrowser(t,e,M.browserGeneration),d.current&&m.current===W&&c.current===U&&P(null)}catch(A){d.current&&m.current===W&&c.current===U&&T(uf(A))}finally{d.current&&m.current===W&&c.current===U&&(v.current=!1,E(null))}},[n,l,t,e,P,T]),$=p.useCallback(async()=>{if(n)return;const M=g.current;if(!d.current||!M||v.current)return;const U=l,W=m.current;h.current+=1,v.current=!0,E("Opening in Desktop"),T(null);try{const A=await eW(M,{close:O=>pe.closeRuntimeBrowser(t,e,O).then(()=>{}),open:O=>pe.openRuntimeBrowser(t,e,O),createPage:(O,L)=>pe.createRuntimeBrowserPage(t,e,O,L),activatePage:(O,L)=>pe.activateRuntimeBrowserPage(t,e,O,L),onProgress:O=>{d.current&&m.current===W&&c.current===U&&(P(O),E("Restoring browser tabs"))}});return d.current&&m.current===W&&c.current===U?(P(A),(A.executionBackend!=="embedded-electron"||!A.capabilities.includes(Iy))&&T("Desktop Browser Host is unavailable; using streamed browser"),A):void 0}catch(A){const O=await pe.getRuntimeBrowserState(t,e).catch(()=>{});d.current&&m.current===W&&c.current===U&&(O!==void 0&&P(O),T(uf(A)));return}finally{d.current&&m.current===W&&c.current===U&&(v.current=!1,E(null),k(!1))}},[n,l,t,e,P,T]);return{browser:y,loading:S,pendingAction:C,error:N,currentError:()=>x.current,disabled:n||C!==null||(y==null?void 0:y.status)!=="ready",createDisabled:n||C!==null,load:z,openBrowser:Y,closeBrowser:q,recreateForDesktop:$,createPage:()=>F("Creating page",M=>pe.createRuntimeBrowserPage(t,e,M)),closePage:M=>F("Closing page",U=>pe.closeRuntimeBrowserPage(t,e,U,M)),activatePage:M=>F("Switching page",U=>pe.activateRuntimeBrowserPage(t,e,U,M)),navigatePage:(M,U)=>F("Navigating",W=>pe.navigateRuntimeBrowserPage(t,e,W,M,U)),backPage:M=>F("Going back",U=>pe.backRuntimeBrowserPage(t,e,U,M)),forwardPage:M=>F("Going forward",U=>pe.forwardRuntimeBrowserPage(t,e,U,M)),reloadPage:M=>F("Reloading page",U=>pe.reloadRuntimeBrowserPage(t,e,U,M))}}const GV=2500,ju=new Map;function YV({sessionId:e,runtimeSelector:t,active:r,polling:s=r,devicesActive:n=!1,readOnly:l=!1}){const c=`${t}
596
+ ${e}`,[d,m]=p.useState(()=>ju.get(c)??null),[h,v]=p.useState([]),[g,x]=p.useState(()=>!ju.has(c)),[y,w]=p.useState(!1),[S,k]=p.useState(!1),[C,E]=p.useState(null),N=p.useRef(0),R=p.useRef(0),T=p.useRef(!1),P=p.useRef(!1),z=p.useRef(!1),B=p.useRef(null);B.current=d;const F=p.useCallback(A=>{B.current=A,ju.set(c,A),m(A)},[c]),Y=p.useCallback(async()=>{if(T.current)return;const A=N.current,O=R.current;P.current||x(!0);try{const L=await pe.getSessionEmulator(t,e);if(N.current!==A||R.current!==O||T.current)return;F(L),E(null)}catch(L){if(N.current!==A||R.current!==O||T.current)return;E(m_(L))}finally{N.current===A&&R.current===O&&!T.current&&(P.current=!0,x(!1))}},[t,e,F]),q=p.useCallback(async()=>{if(T.current)return;const A=N.current,O=R.current;w(!0);try{const L=await pe.listSessionEmulatorDevices(t,e);if(N.current!==A||R.current!==O||T.current)return;v(L),E(null)}catch(L){if(N.current!==A||R.current!==O||T.current)return;E(m_(L))}finally{N.current===A&&R.current===O&&!T.current&&(z.current=!0,w(!1))}},[t,e]);p.useEffect(()=>{N.current+=1;const A=ju.has(c);F(ju.get(c)??null),v([]),E(null),x(!A),w(!1),k(!1),T.current=!1,P.current=A,z.current=!1,Y()},[r,Y,c,F]),p.useEffect(()=>{if(!s)return;const A=window.setInterval(()=>void Y(),GV);return()=>window.clearInterval(A)},[r,s,Y]),p.useEffect(()=>{!n||g||S||d||z.current||q()},[r,d,n,g,S,q]);const $=p.useCallback(async(A,O)=>{if(l)throw new Error("Session Portal is read only");const L=N.current,G=++R.current;T.current=!0,k(!0),E(null);try{const H=await A();return N.current!==L||R.current!==G?null:(O==null||O(H),H)}catch(H){throw N.current===L&&R.current===G&&E(m_(H)),H}finally{N.current===L&&R.current===G&&(T.current=!1,k(!1))}},[l]),M=p.useCallback(A=>$(()=>pe.attachSessionEmulator(t,e,A),O=>F(O)),[$,t,e]),U=p.useCallback(async()=>{const A=B.current;return A?await $(()=>pe.detachSessionEmulator(t,e,A.bindingId),()=>F(null))!==null:!1},[$,t,e]),W=p.useCallback(async A=>{const O=B.current;if(!O)throw new Error("This Session has no Emulator attached");await $(()=>A(O))},[$]);return{binding:d,devices:h,loading:g,devicesLoading:y,mutating:l||S,error:C,reload:Y,reloadDevices:q,attach:M,detach:U,tap:(A,O)=>W(L=>pe.tapSessionEmulator(t,e,L.bindingId,A,O)),gesture:A=>W(O=>pe.gestureSessionEmulator(t,e,O.bindingId,A)),button:A=>W(O=>pe.buttonSessionEmulator(t,e,O.bindingId,A))}}function m_(e){return e instanceof Error?e:new Error(String(e))}const TT="rynx.session-resource-dock-width";function KV({session:e,runtimeSelector:t,leadingControls:r,initialDraft:s,initialMessage:n,sendInitialMessage:l=!1,onInitialMessageStarted:c,onInitialMessageConsumed:d,onInitialMessageFailed:m,terminalSlotRef:h,onTerminalActiveChange:v,readOnly:g=!1}){var _r,$t,ct,Ii,nn,pl;const[x,y]=q4(),w=x.get("view"),S=w==="terminal"?"terminal":"chat";p.useEffect(()=>(v==null||v(e.id,S==="terminal"),()=>v==null?void 0:v(e.id,!1)),[v,e.id,S]);const k=XF(x.get("surface")),C=x.get("panel")==="resources",E=w==="browser"||k!==null||C,N=(k==null?void 0:k.type)==="browser"?k.pageId:null,R=p.useRef(null),T=p.useRef(null),P=p.useRef("browser"),z=p.useRef(null),B=p.useRef(0),F=p.useRef(null),[Y]=p.useState(XV),q=p.useRef(Y),$=p.useRef(null),M=p.useRef(null),U=p.useRef(null),W=p.useRef(null),A=p.useRef(null),O=p.useRef(null),L=p.useRef(!1),[G,H]=p.useState(!1),[D,V]=p.useState(!1),[X,J]=p.useState(null),[se,de]=p.useState(Hu),[Z,ce]=p.useState(!1),[le,we]=p.useState(!1),[Ee,Re]=p.useState([]),[te,ie]=p.useState(!!n),[ke,Ke]=p.useState(!1),_e=p.useRef(null),{state:ye,pendingSend:Ie,current:ze,send:pt,stop:rt}=Eq(e.id,{runtimeSelector:t,allowSend:!g}),$e=VV({sessionId:e.id,runtimeSelector:t,active:!0,polling:E,readOnly:g}),He=YV({sessionId:e.id,runtimeSelector:t,active:!0,polling:E,devicesActive:(k==null?void 0:k.type)==="emulator",readOnly:g}),Nt=p.useMemo(()=>ZF($e.browser,N,R.current),[$e.browser,N]),Ct=wq(Ie,ye.runStatus==="running"||ye.waitingForInteraction,ze,e.status==="running"),gs=ze?ye.backgroundTaskCount:0,cs=e.agent??(e.provider?ud(e.provider):void 0),gr=(_r=GF(ye))==null?void 0:_r.model,kt=p.useMemo(()=>YF(ye.items),[ye.items]),Fe=p.useMemo(()=>!n||kt.length>0?kt:[{kind:"message",id:"optimistic_initial",responseId:"optimistic_initial",role:"user",text:n,images:[],files:[],streaming:!1,optimistic:!0}],[n,kt]),jt=zF(ye.statusKind,ye.note)?ye.note:void 0,zs=ye.statusKind==="startup"&&jt===void 0,Mr=ye.waitingForInteraction||ye.runStatus==="running"&&!zs,vs=zs||!Mr&&(Ie||te),Ht=(($t=$e.browser)==null?void 0:$t.pages)??[],Te=(k==null?void 0:k.type)==="emulator"||G,Ve=$e.loading||He.loading,Qe=Ht.length>0||Te,sr=p.useMemo(()=>[...Ht.map(xe=>gn(xe.pageId)),...Te?[vn()]:[]],[Ht,Te]),es=p.useMemo(()=>z2(Ee,sr),[sr,Ee]);p.useEffect(()=>{Re(xe=>{const De=z2(xe,sr);return ZV(xe,De)?xe:De})},[sr]),p.useEffect(()=>{const xe=F.current;if(!xe)return;const De=()=>{const Jt=xe.getBoundingClientRect().width,Kt=cf(Jt,Number.POSITIVE_INFINITY);de(Kt);const ks=q.current,ni=cf(Jt,ks??Jt*I2);ks!==null&&xe.style.setProperty("--session-resource-dock-width",`${ni}px`),$.current=ni,J(ni)};De();const dt=new ResizeObserver(De);return dt.observe(xe),()=>dt.disconnect()},[]),p.useEffect(()=>()=>{var xe;U.current!==null&&window.cancelAnimationFrame(U.current),(xe=A.current)==null||xe.call(A),f5(O)},[]),p.useEffect(()=>{R.current=null,T.current=null,P.current="browser",z.current=null,H(!1),we(!1),Re([]),B.current+=1},[t,e.id]),p.useEffect(()=>{if(!n||!l||_e.current===n)return;_e.current=n,ie(!0),c==null||c(),pt(n).catch(De=>{ie(!1),ip(De)&&(m==null||m(n))})},[n,m,c,pt,l]),p.useEffect(()=>{!n||!kt.some(De=>De.kind==="message"&&De.role==="user"&&De.optimistic!==!0&&De.text===n)||(ie(!1),d==null||d())},[n,d,kt]);const lt=(xe,De=!0)=>{De&&(B.current+=1);const dt=new URLSearchParams(x);xe?(dt.set("surface",xe),dt.delete("panel")):(dt.delete("surface"),dt.set("panel","resources")),dt.get("view")==="browser"&&dt.set("view","chat"),y(dt,{replace:!0})},vr=()=>{B.current+=1,we(!1);const xe=new URLSearchParams(x);xe.delete("surface"),xe.delete("panel"),xe.get("view")==="browser"&&xe.set("view","chat"),y(xe,{replace:!0})},qe=()=>{if(P.current==="emulator"&&G){lt(vn(z.current));return}if(R.current){lt(gn(R.current));return}if(G){lt(vn(z.current));return}lt(null)};p.useEffect(()=>{k&&(P.current=k.type,k.type==="emulator"&&H(!0))},[k==null?void 0:k.type]),p.useEffect(()=>{var De;const xe=((De=He.binding)==null?void 0:De.bindingId)??null;xe&&(z.current&&xe!==z.current?H(!0):z.current||H(!0),z.current=xe)},[(ct=He.binding)==null?void 0:ct.bindingId]),p.useEffect(()=>{if(w!=="browser")return;const xe=new URLSearchParams(x);xe.set("view","chat"),xe.set("surface",gn(Nt)),xe.delete("panel"),y(xe,{replace:!0})},[w,x,Nt,y]),p.useEffect(()=>{if((k==null?void 0:k.type)!=="browser")return;Nt&&(R.current=Nt);const xe=gn(Nt);if(x.get("surface")===xe)return;const De=new URLSearchParams(x);De.set("surface",xe),y(De,{replace:!0})},[k==null?void 0:k.type,x,Nt,y]),p.useEffect(()=>{const xe=Ht.map(dt=>dt.pageId),De=QF(T.current,$e.browser);T.current=xe,!(!De||(k==null?void 0:k.type)!=="browser")&&(R.current=De,lt(gn(De),!1))},[Ht,$e.browser,k==null?void 0:k.type]),p.useEffect(()=>{var dt;if((k==null?void 0:k.type)!=="emulator")return;const xe=vn((dt=He.binding)==null?void 0:dt.bindingId);if(x.get("surface")===xe)return;const De=new URLSearchParams(x);De.set("surface",xe),y(De,{replace:!0})},[(Ii=He.binding)==null?void 0:Ii.bindingId,k==null?void 0:k.type,x,y]),p.useEffect(()=>{var xe,De;if(!(!E||Ve)){if(!Qe){k&&lt(null,!1);return}(k==null?void 0:k.type)==="browser"&&Nt||(k==null?void 0:k.type)==="emulator"&&Te||(P.current==="emulator"&&Te?lt(vn((xe=He.binding)==null?void 0:xe.bindingId),!1):Nt?lt(gn(Nt),!1):Te&&lt(vn((De=He.binding)==null?void 0:De.bindingId),!1))}},[(nn=He.binding)==null?void 0:nn.bindingId,Te,Qe,k==null?void 0:k.type,E,Ve,Nt]);const Et=async()=>{var De,dt;if(L.current)return;L.current=!0,V(!0);const xe=B.current;try{const Jt=((De=$e.browser)==null?void 0:De.status)==="ready"?await $e.createPage():await $e.openBrowser(),Kt=(Jt==null?void 0:Jt.activePageId)??((dt=Jt==null?void 0:Jt.pages.at(-1))==null?void 0:dt.pageId);if(!Jt){me.error(`Could not create Browser tab: ${$e.currentError()??"Browser is unavailable"}`);return}Kt&&B.current===xe&&lt(gn(Kt),!1)}finally{L.current=!1,V(!1)}},Ft=xe=>{const De=F.current;if(!De)return null;const dt=cf(De.getBoundingClientRect().width,xe);return De.style.setProperty("--session-resource-dock-width",`${dt}px`),$.current=dt,dt},Qt=xe=>{const De=F.current;return De?Ft(De.getBoundingClientRect().right-xe):null},Cs=xe=>{if(xe!==null){q.current=xe,J(xe);try{window.localStorage.setItem(TT,String(Math.round(xe)))}catch{}}},st=xe=>{W.current=xe,U.current===null&&(U.current=window.requestAnimationFrame(()=>{U.current=null;const De=W.current;W.current=null,De!==null&&Qt(De)}))},ir=(xe,De,dt)=>{var Kt;if(M.current!==De)return;U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null),W.current=null;const Jt=dt===void 0?$.current:Qt(dt);Cs(Jt),M.current=null,(Kt=A.current)==null||Kt.call(A),A.current=null,xe.hasPointerCapture(De)&&xe.releasePointerCapture(De),f5(O),ce(!1)},It=xe=>{var ni;if(xe.button!==0)return;xe.preventDefault(),(ni=A.current)==null||ni.call(A),M.current=xe.pointerId;const De=xe.currentTarget;De.setPointerCapture(xe.pointerId);const dt=Es=>{M.current===Es.pointerId&&st(Es.clientX)},Jt=Es=>{ir(De,Es.pointerId,Es.clientX)},Kt=Es=>{ir(De,Es.pointerId)};window.addEventListener("pointermove",dt,!0),window.addEventListener("pointerup",Jt,!0),window.addEventListener("pointercancel",Kt,!0),A.current=()=>{window.removeEventListener("pointermove",dt,!0),window.removeEventListener("pointerup",Jt,!0),window.removeEventListener("pointercancel",Kt,!0)};const ks=document.documentElement.style;O.current={cursor:ks.cursor,userSelect:ks.userSelect},ks.cursor="col-resize",ks.userSelect="none",ce(!0),Qt(xe.clientX)},zt=xe=>{const De=F.current;if(!De)return;const dt=$.current??cf(De.getBoundingClientRect().width,De.getBoundingClientRect().width*I2),Jt=xe.shiftKey?32:16;let Kt=null;xe.key==="ArrowLeft"&&(Kt=dt+Jt),xe.key==="ArrowRight"&&(Kt=dt-Jt),xe.key==="Home"&&(Kt=0),xe.key==="End"&&(Kt=Number.POSITIVE_INFINITY),Kt!==null&&(xe.preventDefault(),Cs(Ft(Kt)))},nr=xe=>{B.current+=1;const De=new URLSearchParams(x);De.set("view",xe),y(De,{replace:!0})},Pi=o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":S==="chat"?"Open terminal":"Open chat",title:S==="chat"?"Open terminal":"Open chat",onClick:()=>nr(S==="chat"?"terminal":"chat"),children:S==="chat"?o.jsx(gB,{}):o.jsx(d6,{})}),ar=o.jsx(re,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0","aria-label":E?"Hide Session resources":"Show Session resources",title:E?"Hide Session resources":"Show Session resources",onClick:E?vr:qe,children:E?o.jsx(N6,{}):o.jsx(A6,{})}),Dn=o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",className:"hidden size-8 shrink-0 lg:inline-flex","aria-label":le?"Restore split view":"Expand resource pane","aria-pressed":le,title:le?"Restore split view":"Expand resource pane",onClick:()=>we(xe=>!xe),children:le?o.jsx(nB,{}):o.jsx(TO,{})}),bo=g?void 0:o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",className:"size-8 shrink-0","aria-label":"Session settings",title:"Session settings",onClick:()=>Ke(!0),children:o.jsx(ME,{})});return o.jsxs("div",{className:"flex h-full min-h-0 min-w-0 flex-col overflow-hidden",children:[o.jsxs("div",{ref:F,className:"relative flex min-h-0 min-w-0 flex-1 overflow-hidden [--session-resource-dock-width:44%]",children:[o.jsxs("section",{"aria-hidden":le,className:Pe("min-h-0 min-w-0 flex-1 flex-col overflow-hidden",le?"hidden":"flex"),children:[o.jsxs("header",{className:"desktop-macos-titlebar-header app-drag-region flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--border)] px-3 sm:px-4",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r,o.jsx("h2",{className:"min-w-0 truncate text-sm font-medium",children:e.title??cs??"session"})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Pi,!E&&ar]})]}),o.jsxs(BF,{value:S,className:"relative flex min-h-0 min-w-0 flex-1 flex-col gap-0",children:[o.jsxs(Cx,{value:"chat",forceMount:!0,className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden",children:[o.jsx(XW,{todos:ye.todos}),o.jsx(qV,{items:Fe,historyLoaded:ye.historyLoaded,running:Ct,backgroundTaskCount:gs,startingUp:vs,startupStatus:zs?ye.note:void 0,mcpStatus:jt,waitingForInteraction:ye.waitingForInteraction,queueStatus:ye.statusKind==="queue"?ye.note:void 0,sessionId:e.id,runtimeSelector:t,canResolveInteractions:!g}),!g&&o.jsx(AW,{initialDraft:s,model:gr,running:Ct,collaborationMode:ye.collaborationMode,streamCurrent:ze,sessionId:e.id,runtimeSelector:t,onSend:pt,onStop:rt})]}),o.jsx(Cx,{value:"terminal",forceMount:!0,"aria-hidden":S!=="terminal",className:"mt-0 flex min-h-0 flex-1 flex-col data-[state=inactive]:invisible data-[state=inactive]:absolute data-[state=inactive]:inset-0",children:o.jsx("div",{ref:h,className:"flex min-h-0 flex-1 flex-col"})})]})]}),E&&o.jsxs(o.Fragment,{children:[!le&&o.jsx("div",{role:"separator","aria-label":"Resize Session resources","aria-orientation":"vertical","aria-valuemin":Math.min(Hu,se),"aria-valuemax":se,"aria-valuenow":Math.round(X??Hu),"aria-valuetext":`${Math.round(X??Hu)} pixels wide`,tabIndex:0,title:"Drag to resize Session resources",className:"group relative z-30 -mx-1 hidden w-2 shrink-0 cursor-col-resize touch-none outline-none lg:block",onPointerDown:It,onKeyDown:zt,children:o.jsx("span",{"aria-hidden":"true",className:`pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 bg-[var(--border)] transition-[width,background-color] duration-150 group-hover:w-0.5 group-hover:bg-[var(--primary)] group-focus-visible:w-0.5 group-focus-visible:bg-[var(--primary)] ${Z?"w-0.5 bg-[var(--primary)]":"w-px"}`})}),o.jsxs("aside",{className:Pe("flex min-h-0 min-w-0 flex-col overflow-hidden bg-[var(--card)]",le?"h-full w-full":"absolute inset-0 z-20 lg:static lg:z-auto lg:w-[var(--session-resource-dock-width)] lg:min-w-[22.5rem] lg:max-w-[calc(100%_-_26.25rem)]"),"aria-label":"Session resources",children:[Qe&&o.jsx(DW,{pages:Ht,order:es,selectedPageId:(k==null?void 0:k.type)==="browser"?Nt:null,selectionDisabled:$e.pendingAction!==null,mutationDisabled:$e.disabled,createDisabled:g||$e.createDisabled||D,createPending:D,emulatorAttached:!!He.binding,emulator:Te?{selected:(k==null?void 0:k.type)==="emulator",label:((pl=He.binding)==null?void 0:pl.deviceName)??"Emulator",busy:He.loading||He.mutating}:null,onSelectPage:xe=>{var De;R.current=xe,lt(gn(xe)),((De=$e.browser)==null?void 0:De.status)==="ready"&&$e.activatePage(xe)},onClosePage:xe=>{B.current+=1,R.current===xe&&(R.current=null),$e.closePage(xe)},onCreatePage:()=>{g||Et()},onSelectEmulator:()=>{var xe;H(!0),lt(vn((xe=He.binding)==null?void 0:xe.bindingId))},onCloseEmulator:()=>{H(!1),P.current="browser",lt(Nt?gn(Nt):null)},onAddEmulator:()=>{var xe;H(!0),lt(vn((xe=He.binding)==null?void 0:xe.bindingId))},headerLeadingAction:le?r:void 0,settingsAction:bo,leadingAction:Dn,trailingAction:ar}),!Qe&&o.jsxs(o.Fragment,{children:[le&&r&&o.jsx("div",{className:"absolute left-3 top-1.5 z-10 flex h-8 items-center",children:r}),o.jsxs("div",{className:"absolute right-3 top-1.5 z-10 flex items-center gap-1 sm:right-4",children:[bo,Dn,ar]})]}),Qe?(k==null?void 0:k.type)==="emulator"?o.jsx(zW,{sessionId:e.id,runtimeSelector:t,controller:He,readOnly:g}):(k==null?void 0:k.type)==="browser"?o.jsx(_W,{sessionId:e.id,runtimeSelector:t,pageId:Nt,browserResource:$e,readOnly:g}):o.jsxs("div",{className:"grid min-h-0 flex-1 place-items-center","aria-live":"polite",children:[o.jsx(Le,{className:"size-5 animate-spin text-[var(--muted-foreground)]"}),o.jsx("span",{className:"sr-only",children:"Selecting Session resource"})]}):o.jsx(QV,{browserBusy:g||$e.createDisabled||D,emulatorBusy:g||He.mutating,onOpenBrowser:()=>{g||Et()},onOpenEmulator:()=>{var xe;H(!0),lt(vn((xe=He.binding)==null?void 0:xe.bindingId))}})]})]})]}),o.jsx(CW,{open:ke,onOpenChange:Ke,runtimeSelector:t,sessionId:e.id})]})}function XV(){if(typeof window>"u")return null;try{const e=Number(window.localStorage.getItem(TT));return Number.isFinite(e)&&e>0?e:null}catch{return null}}function f5(e){const t=e.current;!t||typeof document>"u"||(document.documentElement.style.cursor=t.cursor,document.documentElement.style.userSelect=t.userSelect,e.current=null)}function ZV(e,t){return e.length===t.length&&e.every((r,s)=>r===t[s])}function QV({browserBusy:e,emulatorBusy:t,onOpenBrowser:r,onOpenEmulator:s}){return o.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:o.jsxs("div",{className:"w-full max-w-64 space-y-1","aria-label":"Session resource choices",children:[o.jsxs("button",{type:"button",disabled:e,onClick:r,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[e?o.jsx(Le,{className:"size-4 shrink-0 animate-spin"}):o.jsx(fc,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"Browser"})]}),o.jsxs("button",{type:"button",disabled:t,onClick:s,className:"flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm outline-none transition-colors hover:bg-[var(--muted)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none disabled:opacity-50",children:[t?o.jsx(Le,{className:"size-4 shrink-0 animate-spin"}):o.jsx(mc,{className:"size-4 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"Emulator"})]})]})})}const JV=400,eG=160;function tG({sessions:e,runtimeSelector:t,runtimeLabel:r,listError:s,loading:n,selectedId:l,onCollapsedChange:c,onSelect:d,onNew:m,onRetry:h,onFork:v,onDeleted:g,readOnly:x=!1}){const[y,w]=p.useState(""),S=y.trim().toLocaleLowerCase(),k=p.useMemo(()=>S?e.filter(E=>[E.title,E.id,E.provider,E.provider?ud(E.provider):void 0,E.agent,E.source].some(N=>N==null?void 0:N.toLocaleLowerCase().includes(S))):e,[S,e]);async function C(E){try{await pe.closeSession(E,t)}catch(N){me.error(`Delete session failed: ${N instanceof Error?N.message:String(N)}`);return}g(E)}return o.jsxs("aside",{className:"flex h-full min-h-0 min-w-0 flex-col bg-[var(--card)]/35","aria-label":"Sessions",children:[o.jsxs("div",{className:"app-drag-region desktop-macos-titlebar-inset shrink-0 border-b border-[var(--border)] p-2.5",children:[o.jsxs("div",{className:"mb-2 flex h-7 items-center gap-2 px-0.5",children:[o.jsxs(eo,{to:Ps(to(t)),className:"app-no-drag flex items-center gap-2","aria-label":"Rynx Sessions",children:[o.jsx("img",{src:lm,alt:"rynx",className:"h-5 w-auto dark:brightness-0 dark:invert"}),o.jsx("span",{className:"label-caps text-[8px] text-[var(--muted-foreground)]",children:"control"})]}),o.jsx(re,{variant:"ghost",size:"icon-sm",className:"app-no-drag ml-auto hidden md:inline-flex",onClick:()=>c(!0),title:"Collapse session list","aria-label":"Collapse session list","aria-expanded":"true",children:o.jsx(k6,{className:"size-3.5"})})]}),o.jsxs("div",{className:"app-no-drag flex items-center gap-2",children:[o.jsxs("label",{className:"relative min-w-0 flex-1",children:[o.jsx("span",{className:"sr-only",children:"Search sessions"}),o.jsx(AE,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-[var(--muted-foreground)]"}),o.jsx(bt,{value:y,onChange:E=>w(E.target.value),placeholder:"Search sessions",className:"h-11 rounded-md pl-8 text-xs md:h-8"})]}),!x&&o.jsx(re,{size:"icon",className:"size-11 shrink-0 md:size-8",onClick:m,title:"New session","aria-label":"New session",children:o.jsx(Zr,{})})]})]}),s&&o.jsxs("div",{role:"alert",className:"flex items-start gap-2 border-b border-[var(--border)] bg-[var(--warning)]/8 px-3 py-2 text-xs",children:[o.jsx("span",{className:"min-w-0 flex-1 text-[var(--warning)]",children:s}),o.jsx(re,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-2 text-[10px]",onClick:h,children:"Retry"})]}),o.jsx(En,{className:"min-h-0 flex-1",children:n&&e.length===0?o.jsx(sG,{}):e.length===0?o.jsxs("div",{className:"grid place-items-center gap-3 px-5 py-10 text-center",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-medium",children:["No sessions on ",r]}),o.jsx("p",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:"Create one to start a conversation and terminal."})]}),!x&&o.jsxs(re,{size:"sm",className:"h-11 md:h-8",onClick:m,children:[o.jsx(Zr,{})," New session"]})]}):k.length===0?o.jsxs("div",{className:"px-5 py-10 text-center text-xs text-[var(--muted-foreground)]",children:["No sessions match “",y.trim(),"”."]}):o.jsx("ul",{className:"space-y-0.5 px-1.5 py-1.5",children:k.map(E=>o.jsx(rG,{session:E,runtimeLabel:r,selected:l===E.id,onSelect:()=>d(E.id),onFork:()=>v(E.id),onDelete:()=>C(E.id),readOnly:x},E.id))})})]})}function rG({session:e,runtimeLabel:t,selected:r,onSelect:s,onFork:n,onDelete:l,readOnly:c}){const[d,m]=p.useState(!1),[h,v]=p.useState(!1),[g,x]=p.useState(!1),[y,w]=p.useState(!1),S=p.useRef(null),k=p.useRef(null),C=iG(e.updatedAt??e.createdAt),E=e.agent??(e.provider?ud(e.provider):void 0),N=e.title??E??e.source??"Untitled session";p.useEffect(()=>()=>{S.current!==null&&window.clearTimeout(S.current),k.current!==null&&window.clearTimeout(k.current)},[]);const R=()=>{S.current!==null&&(window.clearTimeout(S.current),S.current=null)},T=()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)},P=()=>{R(),T(),!g&&v(!0)},z=()=>{T(),!(g||h||S.current!==null)&&(S.current=window.setTimeout(()=>{S.current=null,v(!0)},JV))},B=()=>{R(),T(),v(!1)},F=()=>{R(),T(),h&&(k.current=window.setTimeout(()=>{k.current=null,v(!1)},eG))};return o.jsxs("li",{className:Pe("group relative flex min-h-9 items-center rounded-md transition-colors",r?"bg-[var(--muted)]/70":"hover:bg-[var(--muted)]/40"),onMouseEnter:z,onMouseLeave:F,children:[o.jsxs(nd,{modal:!1,open:h,onOpenChange:Y=>{Y?P():B()},children:[o.jsx(vc,{asChild:!0,children:o.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 top-2 size-px"})}),o.jsxs(_c,{side:"right",align:"start",sideOffset:8,className:"w-72 p-3","aria-label":`Details for ${N}`,onMouseEnter:P,onMouseLeave:F,onOpenAutoFocus:Y=>Y.preventDefault(),onCloseAutoFocus:Y=>Y.preventDefault(),children:[o.jsxs("div",{className:"mb-2.5 flex min-w-0 items-center justify-between gap-3",children:[o.jsx("p",{className:"min-w-0 truncate text-xs font-medium",children:N}),o.jsx("span",{className:"shrink-0 text-[10px] text-[var(--muted-foreground)]",children:C})]}),o.jsxs("div",{className:"space-y-2 font-mono text-[11px] leading-4",children:[E&&o.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Target: ${E}`,children:[o.jsx(Em,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"min-w-0 truncate",children:E})]}),o.jsxs("div",{className:"flex min-w-0 items-center gap-2","aria-label":`Source: ${e.source}`,children:[o.jsx(sO,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"min-w-0 truncate",children:e.source})]}),o.jsxs("div",{className:"flex min-w-0 items-start gap-2","aria-label":`Session: ${e.id}`,children:[o.jsx(BO,{"aria-hidden":"true",className:"mt-px size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"min-w-0 select-text break-all",children:e.id})]})]})]})]}),o.jsx("button",{type:"button",className:"min-w-0 flex-1 px-2.5 py-2 text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]","aria-current":r?"page":void 0,onClick:s,onFocus:P,onBlur:F,children:o.jsx("span",{className:"block truncate text-sm font-medium",children:N})}),!c&&o.jsxs("div",{className:"group/actions relative mr-2 size-8 shrink-0",onMouseEnter:B,onMouseLeave:z,children:[e.status==="running"&&o.jsx("span",{role:"status","aria-label":"Running",title:"Running",className:"pointer-events-none absolute inset-0 grid place-items-center text-[var(--muted-foreground)] transition-opacity duration-150 group-hover:opacity-0 group-focus-within/actions:opacity-0 group-has-data-[state=open]/actions:opacity-0 [@media(hover:none)]:opacity-0",children:o.jsx(Le,{className:"size-3.5 animate-spin motion-reduce:animate-none"})}),o.jsxs(nd,{open:g,onOpenChange:Y=>{x(Y),Y&&B()},children:[o.jsx(vc,{asChild:!0,children:o.jsx(re,{variant:"ghost",size:"icon",className:"absolute inset-0 size-8 text-[var(--muted-foreground)] opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",title:`Session actions for ${N}`,"aria-label":`Session actions for ${N}`,children:o.jsx(RO,{})})}),o.jsxs(_c,{align:"end",children:[o.jsxs(Wi,{disabled:y||e.status==="running",onSelect:()=>{w(!0),n().finally(()=>w(!1))},children:[y?o.jsx(Le,{className:"animate-spin motion-reduce:animate-none"}):o.jsx(WO,{}),"Fork session"]}),o.jsxs(Wi,{variant:"destructive",onSelect:()=>m(!0),children:[o.jsx(da,{}),"Delete session"]})]})]}),o.jsx(ji,{open:d,onOpenChange:m,children:o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsx(ri,{children:"Delete this session?"}),o.jsxs(si,{children:["“",N,"” will be deleted from ",t,". This cannot be undone."]})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:()=>void l(),children:"Delete"})]})]})})]})]})}function sG(){return o.jsx("div",{"aria-label":"Loading sessions",className:"space-y-0.5 px-1.5 py-1.5",children:Array.from({length:6},(e,t)=>o.jsx("div",{className:"grid min-h-9 content-center rounded-md px-2.5",children:o.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-[var(--muted)]"})},t))})}function iG(e){const t=Date.parse(e);if(!Number.isFinite(t))return"unknown";const r=Math.max(0,Math.round((Date.now()-t)/1e3));return r<60?"now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(t)}const p_="!no-project",m5="!new-project";function nG({runtimeLabel:e,options:t,selection:r,configuration:s,projects:n,projectId:l,loading:c,projectsLoading:d,submitting:m,error:h,projectError:v,listCollapsed:g,onShowSessions:x,onRetryOptions:y,onSelectionChange:w,onConfigurationChange:S,onProjectChange:k,onNewProject:C,onSubmit:E}){const[N,R]=p.useState(""),T=p.useRef(null),P=p.useRef(!1),z=p.useRef(void 0),B=yT({policy:Dx,onChange:()=>{z.current=void 0}}),F=Sx(r,t),Y=l?n.find(M=>M.id===l):void 0,q=!!((N.trim()||B.items.length>0)&&r&&!c&&!m&&!B.hasPending&&!B.hasFailed);async function $(){const M=N.trim();if(!M&&B.items.length===0||!r||c||m||B.hasPending||B.hasFailed)return;const U=B.items.length>0?z.current??xc("msg"):void 0;U&&(z.current=U),await E({text:M,attachments:B.readyUploads,...U?{clientMessageId:U}:{}})&&(B.clear(),R(""),z.current=void 0)}return o.jsxs("main",{className:"relative h-full min-h-0 min-w-0 flex-1 overflow-hidden bg-[radial-gradient(circle_at_50%_-10%,color-mix(in_srgb,var(--primary)_9%,transparent),transparent_38%)]",children:[g&&o.jsx(re,{type:"button",variant:"ghost",size:"icon-sm",className:"desktop-macos-titlebar-leading-control absolute left-3 top-2.5 z-10 hidden md:inline-flex",onClick:x,title:"Show session list","aria-label":"Show session list",children:o.jsx(NE,{className:"size-3.5"})}),o.jsx("div",{className:"desktop-macos-home-titlebar","aria-hidden":"true"}),o.jsx(En,{className:"h-full",viewportClassName:"[&>div]:!flex [&>div]:min-h-full [&>div]:flex-col",children:o.jsxs("div",{className:"mx-auto grid w-full max-w-3xl flex-1 content-center px-4 py-8 sm:px-6 lg:py-12",children:[o.jsx("div",{className:"mb-6 flex items-center gap-2 md:hidden",children:o.jsxs(re,{type:"button",variant:"ghost",size:"sm",className:"h-11 px-2",onClick:x,children:[o.jsx(tl,{})," Sessions"]})}),o.jsxs("div",{className:"mb-7",children:[o.jsx("p",{className:"label-caps mb-3 text-[10px] text-[var(--primary)]",children:"New session"}),o.jsx("h1",{className:"text-3xl font-semibold tracking-[-0.035em] sm:text-4xl",children:"What should we work on?"}),o.jsxs("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-[var(--muted-foreground)] sm:text-base",children:["Describe the outcome you want. The session and terminal will run on"," ",o.jsx("span",{className:"font-medium text-[var(--foreground)]",children:e}),"."]})]}),o.jsxs("form",{ref:T,onSubmit:M=>{M.preventDefault(),$()},children:[o.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-[0_12px_34px_rgba(24,24,27,0.08)] transition-[border-color,box-shadow] focus-within:border-[color-mix(in_srgb,var(--primary)_55%,var(--border))] focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--primary)_9%,transparent),0_12px_34px_rgba(24,24,27,0.08)]","aria-busy":m,children:[o.jsx("label",{htmlFor:"session-initial-prompt",className:"sr-only",children:"Initial task"}),o.jsx(bT,{items:B.items,disabled:m,onRemove:B.remove,className:"px-5 pt-4"}),o.jsx(Ec,{id:"session-initial-prompt",value:N,disabled:m,rows:7,className:"min-h-40 max-h-[min(45dvh,24rem)] resize-none overflow-y-auto rounded-none border-0 bg-transparent px-5 py-5 text-base leading-7 shadow-none focus-visible:border-0 focus-visible:ring-0 md:text-base",placeholder:"Fix a bug, build a feature, or investigate the codebase…",onChange:M=>{z.current=void 0,R(M.target.value)},onPaste:B.onPaste,onCompositionStart:()=>{P.current=!0},onCompositionEnd:()=>{P.current=!1},onKeyDown:M=>{var U;M.key!=="Enter"||M.shiftKey||P.current||M.nativeEvent.isComposing||M.keyCode===229||(M.preventDefault(),(U=T.current)==null||U.requestSubmit())}}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[var(--border)] bg-[var(--muted)]/15 p-2.5 sm:flex-nowrap sm:pl-4",children:[o.jsx(wT,{policy:Dx,disabled:m,onFiles:B.addFiles}),o.jsx("label",{htmlFor:"session-project",className:"sr-only",children:"Project"}),o.jsxs(Cn,{value:l?`project:${l}`:p_,disabled:d||m,onValueChange:M=>{if(M===m5){C();return}k(M===p_?null:M.startsWith("project:")?M.slice(8):null)},children:[o.jsx(Yi,{id:"session-project",className:"w-36 bg-[var(--background)] sm:w-40","aria-label":"Project",children:o.jsx(Gi,{placeholder:d?"Loading projects…":"Choose project",children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[Y?o.jsx(Gf,{className:"size-3.5 shrink-0 text-[var(--primary)]"}):o.jsx(hC,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"truncate",children:(Y==null?void 0:Y.name)??"No project"})]})})}),o.jsxs(Ki,{align:"start",children:[n.length>0&&o.jsxs(Jj,{children:[o.jsxs(rA,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:["Projects on ",e]}),n.map(M=>o.jsx(fr,{value:`project:${M.id}`,textValue:M.name,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Gf,{className:"size-3.5 shrink-0 text-[var(--primary)]"}),o.jsx("span",{className:"truncate",children:M.name})]})},M.id))]}),n.length>0&&o.jsx(ep,{}),o.jsx(fr,{value:m5,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(hC,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"New project"})]})}),o.jsx(fr,{value:p_,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(Ni,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{children:"No project"})]})})]})]}),o.jsx(aG,{options:t,selection:r,configuration:s,selectedOption:F,disabled:c||m,loading:c,onSelectionChange:w,onConfigurationChange:S}),o.jsx("label",{htmlFor:"session-permission",className:"sr-only",children:"Permissions"}),o.jsxs(Cn,{value:s.permissionPreset,disabled:m,onValueChange:M=>S({...s,permissionPreset:M}),children:[o.jsx(Yi,{id:"session-permission",className:"w-36 bg-[var(--background)] sm:w-40","aria-label":"Permissions",children:o.jsx(Gi,{children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o.jsx(sB,{className:"size-3.5 shrink-0 text-[var(--muted-foreground)]"}),o.jsx("span",{className:"truncate",children:oG(s.permissionPreset)})]})})}),o.jsxs(Ki,{align:"end",children:[o.jsx(fr,{value:"default",children:"Default permissions"}),o.jsx(fr,{value:"read-only",children:"Read only"}),o.jsx(fr,{value:"workspace-write",children:"Workspace write"}),o.jsx(fr,{value:"full-access",children:"Full access"})]})]}),o.jsx(re,{type:"submit",size:"icon",className:"size-11 shrink-0 rounded-full md:size-10",disabled:!q,"aria-label":m?"Starting session":"Start session",children:m?o.jsx(Le,{className:"animate-spin"}):o.jsx(TE,{})})]})]}),o.jsxs("div",{className:"mt-2 flex min-h-6 flex-wrap items-start justify-between gap-x-4 gap-y-1 px-1 text-xs text-[var(--muted-foreground)]",children:[o.jsxs("span",{className:"flex items-center gap-2",role:h||v?"alert":"status","aria-live":h||v?"assertive":"polite",children:[o.jsx("span",{children:h??v??(F&&!F.ready?`${F.reason??`${F.name} needs setup on ${e}.`} Start to open its login terminal; your task will wait safely.`:"")}),h&&t.providers.length===0&&t.agents.length===0&&!c&&o.jsx(re,{type:"button",variant:"link",size:"sm",className:"h-auto px-0 text-xs",onClick:y,children:"Retry"})]}),o.jsx("span",{className:"hidden font-mono text-[10px] sm:inline",children:"Enter to start · Shift+Enter for newline"})]})]})]})})]})}function aG({options:e,selection:t,configuration:r,selectedOption:s,disabled:n,loading:l,onSelectionChange:c,onConfigurationChange:d}){var x;const m=(t==null?void 0:t.kind)==="provider"?e.providers.find(y=>y.id===t.id):void 0,h=(x=m==null?void 0:m.models)==null?void 0:x.find(y=>y.id===r.model),v=h==null?void 0:h.reasoningOptions.find(y=>y.value===r.reasoningEffort),g=(y,w,S)=>{c({kind:"provider",id:y}),d({permissionPreset:r.permissionPreset,...w?{model:w}:{},...S?{reasoningEffort:S}:{}})};return o.jsxs(nd,{children:[o.jsx(vc,{asChild:!0,children:o.jsxs(re,{id:"session-launch-target",type:"button",variant:"outline",disabled:n,className:"w-44 justify-start bg-[var(--background)] font-normal sm:w-48 md:ml-auto","aria-label":"Run with",children:[s?o.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[o.jsx(ff,{status:lf(s)}),o.jsxs("span",{className:"truncate",children:[s.name,h?` / ${h.label}`:"",v?` / ${v.label}`:""]})]}):o.jsx("span",{className:"min-w-0 flex-1 truncate text-[var(--muted-foreground)]",children:l?"Loading…":"Choose runtime / model / thinking"}),o.jsx(vd,{className:"ml-auto size-3.5 shrink-0 opacity-55"})]})}),o.jsxs(_c,{align:"end",className:"min-w-56",children:[e.providers.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Yo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Providers · Runtime → Model → Thinking"}),e.providers.map(y=>{const w=y.models??[],S=(t==null?void 0:t.kind)==="provider"&&t.id===y.id;return w.length===0?o.jsxs(Wi,{onSelect:()=>g(y.id),children:[o.jsx(ff,{status:lf(y)}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.name}),S&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]},`provider:${y.id}`):o.jsxs(rx,{children:[o.jsxs(nm,{children:[o.jsx(ff,{status:lf(y)}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.name})]}),o.jsxs(am,{children:[o.jsx(Yo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Model"}),w.map(k=>{const C=S&&r.model===k.id;return k.reasoningOptions.length===0?o.jsxs(Wi,{onSelect:()=>g(y.id,k.id),children:[o.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[k.label,k.isDefault?" · default":""]}),C&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]},k.id):o.jsxs(rx,{children:[o.jsx(nm,{children:o.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[k.label,k.isDefault?" · default":""]})}),o.jsxs(am,{children:[o.jsx(Yo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Thinking effort"}),k.reasoningOptions.map(E=>{const N=C&&r.reasoningEffort===E.value;return o.jsxs(Wi,{onSelect:()=>g(y.id,k.id,E.value),children:[o.jsx("span",{className:"min-w-0 flex-1 truncate",children:E.label}),N&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]},E.value)})]})]},k.id)})]})]},`provider:${y.id}`)})]}),e.providers.length>0&&e.agents.length>0&&o.jsx(cj,{}),e.agents.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Yo,{className:"font-mono text-[9px] uppercase tracking-[0.12em]",children:"Agents"}),e.agents.map(y=>{const w=(t==null?void 0:t.kind)==="agent"&&t.id===y.id;return o.jsxs(Wi,{onSelect:()=>c({kind:"agent",id:y.id}),children:[o.jsx(ff,{status:lf(y)}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.name??y.id}),w&&o.jsx(Ar,{className:"size-3.5 text-[var(--primary)]"})]},`agent:${y.id}`)})]})]})]})}function oG(e){return{default:"Default","read-only":"Read only","workspace-write":"Workspace write","full-access":"Full access"}[e]}function ff({status:e}){const t=e==="ready"?"Ready":e==="needs_setup"?"Needs setup":"Readiness not reported",r=e==="ready"?"bg-[var(--success)]":e==="needs_setup"?"bg-[var(--warning)]":"bg-[var(--muted-foreground)]/55";return o.jsxs("span",{className:"inline-flex size-3.5 shrink-0 items-center justify-center",title:t,children:[o.jsx("span",{className:`size-2 rounded-full ${r}`,"aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:t})]})}const MT="rynx.control.theme";function lG(){const e=localStorage.getItem(MT);return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Vy(){const[e,t]=p.useState(lG);return p.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem(MT,e)},[e]),{theme:e,toggle:()=>t(r=>r==="dark"?"light":"dark")}}/**
597
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
598
+ * @license MIT
599
+ *
600
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
601
+ * @license MIT
602
+ *
603
+ * Originally forked from (with the author's permission):
604
+ * Fabrice Bellard's javascript vt100 for jslinux:
605
+ * http://bellard.org/jslinux/
606
+ * Copyright (c) 2011 Fabrice Bellard
607
+ */var cG=2,uG=1,dG=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var g;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((g=this._terminal.options.overviewRuler)==null?void 0:g.width)||14,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),c={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},d=c.top+c.bottom,m=c.right+c.left,h=s-d,v=n-m-t;return{cols:Math.max(cG,Math.floor(v/e.css.cell.width)),rows:Math.max(uG,Math.floor(h/e.css.cell.height))}}};/**
608
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
609
+ * @license MIT
610
+ *
611
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
612
+ * @license MIT
613
+ *
614
+ * Originally forked from (with the author's permission):
615
+ * Fabrice Bellard's javascript vt100 for jslinux:
616
+ * http://bellard.org/jslinux/
617
+ * Copyright (c) 2011 Fabrice Bellard
618
+ */var hG=class{constructor(t,r,s,n={}){this._terminal=t,this._regex=r,this._handler=s,this._options=n}provideLinks(t,r){let s=mG.computeLink(t,this._regex,this._terminal,this._handler);r(this._addCallbacks(s))}_addCallbacks(t){return t.map(r=>(r.leave=this._options.leave,r.hover=(s,n)=>{if(this._options.hover){let{range:l}=r;this._options.hover(s,n,l)}},r))}};function fG(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var mG=class Of{static computeLink(t,r,s,n){let l=new RegExp(r.source,(r.flags||"")+"g"),[c,d]=Of._getWindowedLineStrings(t-1,s),m=c.join(""),h,v=[];for(;h=l.exec(m);){let g=h[0];if(!fG(g))continue;let[x,y]=Of._mapStrIdx(s,d,0,h.index),[w,S]=Of._mapStrIdx(s,x,y,g.length);if(x===-1||y===-1||w===-1||S===-1)continue;let k={start:{x:y+1,y:x+1},end:{x:S,y:w+1}};v.push({range:k,text:g,activate:n})}return v}static _getWindowedLineStrings(t,r){let s,n=t,l=t,c=0,d="",m=[];if(s=r.buffer.active.getLine(t)){let h=s.translateToString(!0);if(s.isWrapped&&h[0]!==" "){for(c=0;(s=r.buffer.active.getLine(--n))&&c<2048&&(d=s.translateToString(!0),c+=d.length,m.push(d),!(!s.isWrapped||d.indexOf(" ")!==-1)););m.reverse()}for(m.push(h),c=0;(s=r.buffer.active.getLine(++l))&&s.isWrapped&&c<2048&&(d=s.translateToString(!0),c+=d.length,m.push(d),d.indexOf(" ")===-1););}return[m,n]}static _mapStrIdx(t,r,s,n){let l=t.buffer.active,c=l.getNullCell(),d=s;for(;n;){let m=l.getLine(r);if(!m)return[-1,-1];for(let h=d;h<m.length;++h){m.getCell(h,c);let v=c.getChars();if(c.getWidth()&&(n-=v.length||1,h===m.length-1&&v==="")){let g=l.getLine(r+1);g&&g.isWrapped&&(g.getCell(0,c),c.getWidth()===2&&(n+=1))}if(n<0)return[r,h]}r++,d=0}return[r,d]}},pG=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function gG(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var vG=class{constructor(t=gG,r={}){this._handler=t,this._options=r}activate(t){this._terminal=t;let r=this._options,s=r.urlRegex||pG;this._linkProvider=this._terminal.registerLinkProvider(new hG(this._terminal,s,this._handler,r))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
619
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
620
+ * @license MIT
621
+ *
622
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
623
+ * @license MIT
624
+ *
625
+ * Originally forked from (with the author's permission):
626
+ * Fabrice Bellard's javascript vt100 for jslinux:
627
+ * http://bellard.org/jslinux/
628
+ * Copyright (c) 2011 Fabrice Bellard
629
+ */var _G=(e,t,r,s)=>{for(var n=t,l=e.length-1,c;l>=0;l--)(c=e[l])&&(n=c(n)||n);return n},xG=(e,t)=>(r,s)=>t(r,s,e),yG=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?p5.isErrorNoTelemetry(e)?new p5(e.message+`
630
+
631
+ `+e.stack):new Error(e.message+`
632
+
633
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},bG=new yG;function g_(e){wG(e)||bG.onUnexpectedError(e)}var Lx="Canceled";function wG(e){return e instanceof SG?!0:e instanceof Error&&e.name===Lx&&e.message===Lx}var SG=class extends Error{constructor(){super(Lx),this.name=this.message}},p5=class Ox extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ox)return t;let r=new Ox;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},CG;(e=>{function t(l){return l<0}e.isLessThan=t;function r(l){return l<=0}e.isLessThanOrEqual=r;function s(l){return l>0}e.isGreaterThan=s;function n(l){return l===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(CG||(CG={}));function kG(e,t){let r=this,s=!1,n;return function(){return s||(s=!0,t||(n=e.apply(r,arguments))),n}}var DT;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*n(R){yield R}e.single=n;function l(R){return t(R)?R:n(R)}e.wrap=l;function c(R){return R||r}e.from=c;function*d(R){for(let T=R.length-1;T>=0;T--)yield R[T]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function h(R){return R[Symbol.iterator]().next().value}e.first=h;function v(R,T){let P=0;for(let z of R)if(T(z,P++))return!0;return!1}e.some=v;function g(R,T){for(let P of R)if(T(P))return P}e.find=g;function*x(R,T){for(let P of R)T(P)&&(yield P)}e.filter=x;function*y(R,T){let P=0;for(let z of R)yield T(z,P++)}e.map=y;function*w(R,T){let P=0;for(let z of R)yield*T(z,P++)}e.flatMap=w;function*S(...R){for(let T of R)yield*T}e.concat=S;function k(R,T,P){let z=P;for(let B of R)z=T(z,B);return z}e.reduce=k;function*C(R,T,P=R.length){for(T<0&&(T+=R.length),P<0?P+=R.length:P>R.length&&(P=R.length);T<P;T++)yield R[T]}e.slice=C;function E(R,T=Number.POSITIVE_INFINITY){let P=[];if(T===0)return[P,R];let z=R[Symbol.iterator]();for(let B=0;B<T;B++){let F=z.next();if(F.done)return[P,e.empty()];P.push(F.value)}return[P,{[Symbol.iterator](){return z}}]}e.consume=E;async function N(R){let T=[];for await(let P of R)T.push(P);return Promise.resolve(T)}e.asyncToArray=N})(DT||(DT={}));function LT(e){if(DT.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function OT(...e){return ms(()=>LT(e))}function ms(e){return{dispose:kG(()=>{e()})}}var BT=class PT{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{LT(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?PT.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};BT.DISABLE_DISPOSED_WARNING=!1;var hc=BT,Qi=class{constructor(){this._store=new hc,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Qi.None=Object.freeze({dispose(){}});var Au=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var r;this._isDisposed||t===this._value||((r=this._value)==null||r.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Gy=typeof process<"u"&&"title"in process,dp=Gy?"node":navigator.userAgent,EG=Gy?"node":navigator.platform,RG=dp.includes("Firefox"),NG=dp.includes("Edge"),IT=/^((?!chrome|android).)*safari/i.test(dp);function jG(){if(!IT)return 0;let e=dp.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}EG.indexOf("Linux")>=0;var AG="",qr=0,Wr=0,Vr=0,dr=0,_i={css:"#00000000",rgba:0},bs;(e=>{function t(n,l,c,d){return d!==void 0?`#${Fo(n)}${Fo(l)}${Fo(c)}${Fo(d)}`:`#${Fo(n)}${Fo(l)}${Fo(c)}`}e.toCss=t;function r(n,l,c,d=255){return(n<<24|l<<16|c<<8|d)>>>0}e.toRgba=r;function s(n,l,c,d){return{css:e.toCss(n,l,c,d),rgba:e.toRgba(n,l,c,d)}}e.toColor=s})(bs||(bs={}));var qu;(e=>{function t(m,h){if(dr=(h.rgba&255)/255,dr===1)return{css:h.css,rgba:h.rgba};let v=h.rgba>>24&255,g=h.rgba>>16&255,x=h.rgba>>8&255,y=m.rgba>>24&255,w=m.rgba>>16&255,S=m.rgba>>8&255;qr=y+Math.round((v-y)*dr),Wr=w+Math.round((g-w)*dr),Vr=S+Math.round((x-S)*dr);let k=bs.toCss(qr,Wr,Vr),C=bs.toRgba(qr,Wr,Vr);return{css:k,rgba:C}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function s(m,h,v){let g=Qo.ensureContrastRatio(m.rgba,h.rgba,v);if(g)return bs.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=s;function n(m){let h=(m.rgba|255)>>>0;return[qr,Wr,Vr]=Qo.toChannels(h),{css:bs.toCss(qr,Wr,Vr),rgba:h}}e.opaque=n;function l(m,h){return dr=Math.round(h*255),[qr,Wr,Vr]=Qo.toChannels(m.rgba),{css:bs.toCss(qr,Wr,Vr,dr),rgba:bs.toRgba(qr,Wr,Vr,dr)}}e.opacity=l;function c(m,h){return dr=m.rgba&255,l(m,dr*h/255)}e.multiplyOpacity=c;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(qu||(qu={}));var TG;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let l=n.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return qr=parseInt(n.slice(1,2).repeat(2),16),Wr=parseInt(n.slice(2,3).repeat(2),16),Vr=parseInt(n.slice(3,4).repeat(2),16),bs.toColor(qr,Wr,Vr);case 5:return qr=parseInt(n.slice(1,2).repeat(2),16),Wr=parseInt(n.slice(2,3).repeat(2),16),Vr=parseInt(n.slice(3,4).repeat(2),16),dr=parseInt(n.slice(4,5).repeat(2),16),bs.toColor(qr,Wr,Vr,dr);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let l=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return qr=parseInt(l[1]),Wr=parseInt(l[2]),Vr=parseInt(l[3]),dr=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),bs.toColor(qr,Wr,Vr,dr);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[qr,Wr,Vr,dr]=t.getImageData(0,0,1,1).data,dr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:bs.toRgba(qr,Wr,Vr,dr),css:n}}e.toColor=s})(TG||(TG={}));var xs;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,n,l){let c=s/255,d=n/255,m=l/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return h*.2126+v*.7152+g*.0722}e.relativeLuminance2=r})(xs||(xs={}));var Qo;(e=>{function t(c,d){if(dr=(d&255)/255,dr===1)return d;let m=d>>24&255,h=d>>16&255,v=d>>8&255,g=c>>24&255,x=c>>16&255,y=c>>8&255;return qr=g+Math.round((m-g)*dr),Wr=x+Math.round((h-x)*dr),Vr=y+Math.round((v-y)*dr),bs.toRgba(qr,Wr,Vr)}e.blend=t;function r(c,d,m){let h=xs.relativeLuminance(c>>8),v=xs.relativeLuminance(d>>8);if(Jn(h,v)<m){if(v<h){let y=s(c,d,m),w=Jn(h,xs.relativeLuminance(y>>8));if(w<m){let S=n(c,d,m),k=Jn(h,xs.relativeLuminance(S>>8));return w>k?y:S}return y}let g=n(c,d,m),x=Jn(h,xs.relativeLuminance(g>>8));if(x<m){let y=s(c,d,m),w=Jn(h,xs.relativeLuminance(y>>8));return x>w?g:y}return g}}e.ensureContrastRatio=r;function s(c,d,m){let h=c>>24&255,v=c>>16&255,g=c>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,S=Jn(xs.relativeLuminance2(x,y,w),xs.relativeLuminance2(h,v,g));for(;S<m&&(x>0||y>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=Jn(xs.relativeLuminance2(x,y,w),xs.relativeLuminance2(h,v,g));return(x<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=s;function n(c,d,m){let h=c>>24&255,v=c>>16&255,g=c>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,S=Jn(xs.relativeLuminance2(x,y,w),xs.relativeLuminance2(h,v,g));for(;S<m&&(x<255||y<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Jn(xs.relativeLuminance2(x,y,w),xs.relativeLuminance2(h,v,g));return(x<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=n;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(Qo||(Qo={}));function Fo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Jn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Rr(e){if(!e)throw new Error("value must not be falsy");return e}function Yy(e){return 57508<=e&&e<=57558}function MG(e){return 57520<=e&&e<=57527}function DG(e){return 57344<=e&&e<=63743}function LG(e){return 9472<=e&&e<=9631}function OG(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function BG(e,t,r,s){return t===1&&r>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!OG(e)&&!Yy(e)&&!DG(e)}function zT(e){return Yy(e)||LG(e)}function PG(){return{css:{canvas:mf(),cell:mf()},device:{canvas:mf(),cell:mf(),char:{width:0,height:0,left:0,top:0}}}}function mf(){return{width:0,height:0}}function IG(e,t,r=0){return(e-(Math.round(t)*2-r))%(Math.round(t)*2)}var ns=0,Hr=0,fn=!1,ea=!1,pf=!1,Ds,v_=0,zG=class{constructor(e,t,r,s,n,l){this._terminal=e,this._optionService=t,this._selectionRenderModel=r,this._decorationService=s,this._coreBrowserService=n,this._themeService=l,this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Hr=0,ns=0,ea=!1,fn=!1,pf=!1,Ds=this._themeService.colors,v_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));v_=t*s%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(Hr=n.backgroundColorRGB.rgba>>8&16777215,ea=!0),n.foregroundColorRGB&&(ns=n.foregroundColorRGB.rgba>>8&16777215,fn=!0)}),pf=this._selectionRenderModel.isCellSelected(this._terminal,t,r),pf){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Hr=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Hr=(this.result.fg&16777215)<<8|255;break;case 0:default:Hr=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Hr=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Hr=(this.result.bg&16777215)<<8|255;break}Hr=Qo.blend(Hr,(this._coreBrowserService.isFocused?Ds.selectionBackgroundOpaque:Ds.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Hr=(this._coreBrowserService.isFocused?Ds.selectionBackgroundOpaque:Ds.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(ea=!0,Ds.selectionForeground&&(ns=Ds.selectionForeground.rgba>>8&16777215,fn=!0),zT(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)ns=(this._coreBrowserService.isFocused?Ds.selectionBackgroundOpaque:Ds.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:ns=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ns=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:ns=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ns=(this.result.fg&16777215)<<8|255;break;case 0:default:ns=this._themeService.colors.foreground.rgba}ns=Qo.blend(ns,(this._coreBrowserService.isFocused?Ds.selectionBackgroundOpaque:Ds.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}fn=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(Hr=n.backgroundColorRGB.rgba>>8&16777215,ea=!0),n.foregroundColorRGB&&(ns=n.foregroundColorRGB.rgba>>8&16777215,fn=!0)}),ea&&(pf?Hr=e.bg&-16777216&-134217729|Hr|50331648:Hr=e.bg&-16777216|Hr|50331648),fn&&(ns=e.fg&-16777216&-67108865|ns|50331648),this.result.fg&67108864&&(ea&&!fn&&((this.result.bg&50331648)===0?ns=this.result.fg&-134217728|Ds.background.rgba>>8&16777215&16777215|50331648:ns=this.result.fg&-134217728|this.result.bg&67108863,fn=!0),!ea&&fn&&((this.result.fg&50331648)===0?Hr=this.result.bg&-67108864|Ds.foreground.rgba>>8&16777215&16777215|50331648:Hr=this.result.bg&-67108864|this.result.fg&67108863,ea=!0)),Ds=void 0,this.result.bg=ea?Hr:this.result.bg,this.result.fg=fn?ns:this.result.fg,this.result.ext&=536870911,this.result.ext|=v_<<29&3758096384}},$G=.5,$T=RG||NG?"bottom":"ideographic",UG={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},HG={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},FG={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},dd={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};dd[""]=dd[""];dd[""]=dd[""];function qG(e,t,r,s,n,l,c,d){let m=UG[t];if(m)return WG(e,m,r,s,n,l),!0;let h=HG[t];if(h)return VG(e,h,r,s,n,l),!0;let v=FG[t];if(v)return GG(e,v,r,s,n,l,d),!0;let g=dd[t];return g?(YG(e,g,r,s,n,l,c,d),!0):!1}function WG(e,t,r,s,n,l){for(let c=0;c<t.length;c++){let d=t[c],m=n/8,h=l/8;e.fillRect(r+d.x*m,s+d.y*h,d.w*m,d.h*h)}}var g5=new Map;function VG(e,t,r,s,n,l){let c=g5.get(t);c||(c=new Map,g5.set(t,c));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let m=c.get(d);if(!m){let h=t[0].length,v=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=h,g.height=v;let x=Rr(g.getContext("2d")),y=new ImageData(h,v),w,S,k,C;if(d.startsWith("#"))w=parseInt(d.slice(1,3),16),S=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),C=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[w,S,k,C]=d.substring(5,d.length-1).split(",").map(E=>parseFloat(E));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let E=0;E<v;E++)for(let N=0;N<h;N++)y.data[(E*h+N)*4]=w,y.data[(E*h+N)*4+1]=S,y.data[(E*h+N)*4+2]=k,y.data[(E*h+N)*4+3]=t[E][N]*(C*255);x.putImageData(y,0,0),m=Rr(e.createPattern(g,null)),c.set(d,m)}e.fillStyle=m,e.fillRect(r,s,n,l)}function GG(e,t,r,s,n,l,c){e.strokeStyle=e.fillStyle;for(let[d,m]of Object.entries(t)){e.beginPath(),e.lineWidth=c*Number.parseInt(d);let h;if(typeof m=="function"){let v=.15/l*n;h=m(.15,v)}else h=m;for(let v of h.split(" ")){let g=v[0],x=UT[g];if(!x){console.error(`Could not find drawing instructions for "${g}"`);continue}let y=v.substring(1).split(",");!y[0]||!y[1]||x(e,HT(y,n,l,r,s,!0,c))}e.stroke(),e.closePath()}}function YG(e,t,r,s,n,l,c,d){let m=new Path2D;m.rect(r,s,n,l),e.clip(m),e.beginPath();let h=c/12;e.lineWidth=d*h;for(let v of t.d.split(" ")){let g=v[0],x=UT[g];if(!x){console.error(`Could not find drawing instructions for "${g}"`);continue}let y=v.substring(1).split(",");!y[0]||!y[1]||x(e,HT(y,n,l,r,s,!1,d,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function v5(e,t,r=0){return Math.max(Math.min(e,t),r)}var UT={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function HT(e,t,r,s,n,l,c,d=0,m=0){let h=e.map(v=>parseFloat(v)||parseInt(v));if(h.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<h.length;v+=2)h[v]*=t-d*c-m*c,l&&h[v]!==0&&(h[v]=v5(Math.round(h[v]+.5)-.5,t,0)),h[v]+=s+d*c;for(let v=1;v<h.length;v+=2)h[v]*=r,l&&h[v]!==0&&(h[v]=v5(Math.round(h[v]+.5)-.5,r,0)),h[v]+=n;return h}var _5=class{constructor(){this._data={}}set(t,r,s){this._data[t]||(this._data[t]={}),this._data[t][r]=s}get(t,r){return this._data[t]?this._data[t][r]:void 0}clear(){this._data={}}},x5=class{constructor(){this._data=new _5}set(e,t,r,s,n){this._data.get(e,t)||this._data.set(e,t,new _5),this._data.get(e,t).set(r,s,n)}get(e,t,r,s){var n;return(n=this._data.get(e,t))==null?void 0:n.get(r,s)}clear(){this._data.clear()}},FT=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,r=0,s=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=n}this.clear()}},KG=class extends FT{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let r=performance.now()+t;return{timeRemaining:()=>Math.max(0,r-performance.now())}}},XG=class extends FT{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ZG=!Gy&&"requestIdleCallback"in window?XG:KG,oc=class qT{constructor(){this.fg=0,this.bg=0,this.extended=new WT}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new qT;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},WT=class VT{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new VT(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},QG=globalThis.performance&&typeof globalThis.performance.now=="function",JG=class GT{static create(t){return new GT(t)}constructor(t){this._now=QG&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ia;(e=>{e.None=()=>Qi.None;function t($,M){return g($,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function r($){return(M,U=null,W)=>{let A=!1,O;return O=$(L=>{if(!A)return O?O.dispose():A=!0,M.call(U,L)},null,W),A&&O.dispose(),O}}e.once=r;function s($,M,U){return h((W,A=null,O)=>$(L=>W.call(A,M(L)),null,O),U)}e.map=s;function n($,M,U){return h((W,A=null,O)=>$(L=>{M(L),W.call(A,L)},null,O),U)}e.forEach=n;function l($,M,U){return h((W,A=null,O)=>$(L=>M(L)&&W.call(A,L),null,O),U)}e.filter=l;function c($){return $}e.signal=c;function d(...$){return(M,U=null,W)=>{let A=OT(...$.map(O=>O(L=>M.call(U,L))));return v(A,W)}}e.any=d;function m($,M,U,W){let A=U;return s($,O=>(A=M(A,O),A),W)}e.reduce=m;function h($,M){let U,W={onWillAddFirstListener(){U=$(A.fire,A)},onDidRemoveLastListener(){U==null||U.dispose()}},A=new Yt(W);return M==null||M.add(A),A.event}function v($,M){return M instanceof Array?M.push($):M&&M.add($),$}function g($,M,U=100,W=!1,A=!1,O,L){let G,H,D,V=0,X,J={leakWarningThreshold:O,onWillAddFirstListener(){G=$(de=>{V++,H=M(H,de),W&&!D&&(se.fire(H),H=void 0),X=()=>{let Z=H;H=void 0,D=void 0,(!W||V>1)&&se.fire(Z),V=0},typeof U=="number"?(clearTimeout(D),D=setTimeout(X,U)):D===void 0&&(D=0,queueMicrotask(X))})},onWillRemoveListener(){A&&V>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,G.dispose()}},se=new Yt(J);return L==null||L.add(se),se.event}e.debounce=g;function x($,M=0,U){return e.debounce($,(W,A)=>W?(W.push(A),W):[A],M,void 0,!0,void 0,U)}e.accumulate=x;function y($,M=(W,A)=>W===A,U){let W=!0,A;return l($,O=>{let L=W||!M(O,A);return W=!1,A=O,L},U)}e.latch=y;function w($,M,U){return[e.filter($,M,U),e.filter($,W=>!M(W),U)]}e.split=w;function S($,M=!1,U=[],W){let A=U.slice(),O=$(H=>{A?A.push(H):G.fire(H)});W&&W.add(O);let L=()=>{A==null||A.forEach(H=>G.fire(H)),A=null},G=new Yt({onWillAddFirstListener(){O||(O=$(H=>G.fire(H)),W&&W.add(O))},onDidAddFirstListener(){A&&(M?setTimeout(L):L())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return W&&W.add(G),G.event}e.buffer=S;function k($,M){return(U,W,A)=>{let O=M(new E);return $(function(L){let G=O.evaluate(L);G!==C&&U.call(W,G)},void 0,A)}}e.chain=k;let C=Symbol("HaltChainable");class E{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(U=>(M(U),U)),this}filter(M){return this.steps.push(U=>M(U)?U:C),this}reduce(M,U){let W=U;return this.steps.push(A=>(W=M(W,A),W)),this}latch(M=(U,W)=>U===W){let U=!0,W;return this.steps.push(A=>{let O=U||!M(A,W);return U=!1,W=A,O?A:C}),this}evaluate(M){for(let U of this.steps)if(M=U(M),M===C)break;return M}}function N($,M,U=W=>W){let W=(...G)=>L.fire(U(...G)),A=()=>$.on(M,W),O=()=>$.removeListener(M,W),L=new Yt({onWillAddFirstListener:A,onDidRemoveLastListener:O});return L.event}e.fromNodeEventEmitter=N;function R($,M,U=W=>W){let W=(...G)=>L.fire(U(...G)),A=()=>$.addEventListener(M,W),O=()=>$.removeEventListener(M,W),L=new Yt({onWillAddFirstListener:A,onDidRemoveLastListener:O});return L.event}e.fromDOMEventEmitter=R;function T($){return new Promise(M=>r($)(M))}e.toPromise=T;function P($){let M=new Yt;return $.then(U=>{M.fire(U)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=P;function z($,M){return $(U=>M.fire(U))}e.forward=z;function B($,M,U){return M(U),$(W=>M(W))}e.runAndSubscribe=B;class F{constructor(M,U){this._observable=M,this._counter=0,this._hasChanged=!1;let W={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new Yt(W),U&&U.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,U){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y($,M){return new F($,M).emitter.event}e.fromObservable=Y;function q($){return(M,U,W)=>{let A=0,O=!1,L={beginUpdate(){A++},endUpdate(){A--,A===0&&($.reportChanges(),O&&(O=!1,M.call(U)))},handlePossibleChange(){},handleChange(){O=!0}};$.addObserver(L),$.reportChanges();let G={dispose(){$.removeObserver(L)}};return W instanceof hc?W.add(G):Array.isArray(W)&&W.push(G),G}}e.fromObservableLight=q})(ia||(ia={}));var Bx=class Px{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Px._idPool++}`,Px.all.add(this)}start(t){this._stopWatch=new JG,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Bx.all=new Set,Bx._idPool=0;var eY=Bx,tY=-1,YT=class KT{constructor(t,r,s=(KT._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[l,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(l);let m=new iY(d,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,n]of this._stacks)(!t||r<n)&&(t=[s,n],r=n);return t}};YT._idPool=1;var rY=YT,sY=class XT{constructor(t){this.value=t}static create(){let t=new Error;return new XT(t.stack??"")}print(){console.warn(this.value.split(`
634
+ `).slice(2).join(`
635
+ `))}},iY=class extends Error{constructor(t,r){super(t),this.name="ListenerLeakError",this.stack=r}},nY=class extends Error{constructor(t,r){super(t),this.name="ListenerRefusalError",this.stack=r}},aY=0,__=class{constructor(e){this.value=e,this.id=aY++}},oY=2,lY,Yt=class{constructor(t){var r,s,n,l;this._size=0,this._options=t,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new rY((t==null?void 0:t.onListenerError)??g_,((s=this._options)==null?void 0:s.leakWarningThreshold)??tY):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new eY(this._options._profName):void 0,this._deliveryQueue=(l=this._options)==null?void 0:l.deliveryQueue}dispose(){var t,r,s,n;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||s.call(r),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(t,r,s)=>{var d,m,h,v,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let x=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(x);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],w=new nY(`${x}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((d=this._options)==null?void 0:d.onListenerError)||g_)(w),Qi.None}if(this._disposed)return Qi.None;r&&(t=t.bind(r));let n=new __(t),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=sY.create(),l=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof __?(this._deliveryQueue??(this._deliveryQueue=new cY),this._listeners=[this._listeners,n]):this._listeners.push(n):((h=(m=this._options)==null?void 0:m.onWillAddFirstListener)==null||h.call(m,this),this._listeners=n,(g=(v=this._options)==null?void 0:v.onDidAddFirstListener)==null||g.call(v,this)),this._size++;let c=ms(()=>{l==null||l(),this._removeListener(n)});return s instanceof hc?s.add(c):Array.isArray(s)&&s.push(c),c}),this._event}_removeListener(t){var l,c,d,m;if((c=(l=this._options)==null?void 0:l.onWillRemoveListener)==null||c.call(l,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(m=(d=this._options)==null?void 0:d.onDidRemoveLastListener)==null||m.call(d,this),this._size=0;return}let r=this._listeners,s=r.indexOf(t);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[s]=void 0;let n=this._deliveryQueue.current===this;if(this._size*oY<=r.length){let h=0;for(let v=0;v<r.length;v++)r[v]?r[h++]=r[v]:n&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=h}}_deliver(t,r){var n;if(!t)return;let s=((n=this._options)==null?void 0:n.onListenerError)||g_;if(!s){t.value(r);return}try{t.value(r)}catch(l){s(l)}}_deliverQueue(t){let r=t.current._listeners;for(;t.i<t.end;)this._deliver(r[t.i++],t.value);t.reset()}fire(t){var r,s,n,l;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof __)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(l=this._perfMon)==null||l.stop()}hasListeners(){return this._size>0}},cY=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},y5={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Tu=2,Mu,Xa=class ac{constructor(t,r,s){this._document=t,this._config=r,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new x5,this._cacheMapCombined=new x5,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new oc,this._textureSize=512,this._onAddTextureAtlasCanvas=new Yt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Yt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=ZT(t,this._config.deviceCellWidth*4+Tu*2,this._config.deviceCellHeight+Tu*2),this._tmpCtx=Rr(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new ZG;for(let r=33;r<126;r++)t.enqueue(()=>{if(!this._cacheMap.get(r,0,0,0)){let s=this._drawToCache(r,0,0,0,!1,void 0);this._cacheMap.set(r,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(ac.maxAtlasPages&&this._pages.length>=Math.max(4,ac.maxAtlasPages)){let r=this._pages.filter(h=>h.canvas.width*2<=(ac.maxTextureSize||4096)).sort((h,v)=>v.canvas.width!==h.canvas.width?v.canvas.width-h.canvas.width:v.percentageUsed-h.percentageUsed),s=-1,n=0;for(let h=0;h<r.length;h++)if(r[h].canvas.width!==n)s=h,n=r[h].canvas.width;else if(h-s===3)break;let l=r.slice(s,s+4),c=l.map(h=>h.glyphs[0].texturePage).sort((h,v)=>h>v?1:-1),d=this.pages.length-l.length,m=this._mergePages(l,d);m.version++;for(let h=c.length-1;h>=0;h--)this._deletePage(c[h]);this.pages.push(m),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(m.canvas)}let t=new x_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,r){let s=t[0].canvas.width*2,n=new x_(this._document,s,t);for(let[l,c]of t.entries()){let d=l*c.canvas.width%s,m=Math.floor(l/2)*c.canvas.height;n.ctx.drawImage(c.canvas,d,m);for(let v of c.glyphs)v.texturePage=r,v.sizeClipSpace.x=v.size.x/s,v.sizeClipSpace.y=v.size.y/s,v.texturePosition.x+=d,v.texturePosition.y+=m,v.texturePositionClipSpace.x=v.texturePosition.x/s,v.texturePositionClipSpace.y=v.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(c.canvas);let h=this._activePages.indexOf(c);h!==-1&&this._activePages.splice(h,1)}return n}_deletePage(t){this._pages.splice(t,1);for(let r=t;r<this._pages.length;r++){let s=this._pages[r];for(let n of s.glyphs)n.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,r,s,n,l,c){return this._getFromCacheMap(this._cacheMapCombined,t,r,s,n,l,c)}getRasterizedGlyph(t,r,s,n,l,c){return this._getFromCacheMap(this._cacheMap,t,r,s,n,l,c)}_getFromCacheMap(t,r,s,n,l,c,d){return Mu=t.get(r,s,n,l),Mu||(Mu=this._drawToCache(r,s,n,l,c,d),t.set(r,s,n,l,Mu)),Mu}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,r,s,n){if(this._config.allowTransparency)return _i;let l;switch(t){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(r);break;case 50331648:let c=oc.toColorRGB(r);l=bs.toColor(c[0],c[1],c[2]);break;case 0:default:s?l=qu.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=qu.opaque(l)),l}_getForegroundColor(t,r,s,n,l,c,d,m,h,v){let g=this._getMinimumContrastColor(t,r,s,n,l,c,d,h,m,v);if(g)return g;let x;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&c<8&&(c+=8),x=this._getColorFromAnsiIndex(c);break;case 50331648:let y=oc.toColorRGB(c);x=bs.toColor(y[0],y[1],y[2]);break;case 0:default:d?x=this._config.colors.background:x=this._config.colors.foreground}return this._config.allowTransparency&&(x=qu.opaque(x)),m&&(x=qu.multiplyOpacity(x,$G)),x}_resolveBackgroundRgba(t,r,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,r,s,n){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&n&&r<8&&(r+=8),this._getColorFromAnsiIndex(r).rgba;case 50331648:return r<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,r,s,n,l,c,d,m,h,v){if(this._config.minimumContrastRatio===1||v)return;let g=this._getContrastCache(h),x=g.getColor(t,n);if(x!==void 0)return x||void 0;let y=this._resolveBackgroundRgba(r,s,d),w=this._resolveForegroundRgba(l,c,d,m),S=Qo.ensureContrastRatio(y,w,this._config.minimumContrastRatio/(h?2:1));if(!S){g.setColor(t,n,null);return}let k=bs.toColor(S>>24&255,S>>16&255,S>>8&255);return g.setColor(t,n,k),k}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,r,s,n,l,c){let d=typeof t=="number"?String.fromCharCode(t):t;c&&this._tmpCanvas.parentElement!==c&&(this._tmpCanvas.style.display="none",c.append(this._tmpCanvas));let m=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+Tu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<m&&(this._tmpCanvas.width=m);let h=Math.min(this._config.deviceCellHeight+Tu*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=r,this._workAttributeData.extended.ext=n,!!this._workAttributeData.isInvisible())return y5;let v=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),x=!!this._workAttributeData.isDim(),y=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),S=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),C=this._workAttributeData.getFgColor(),E=this._workAttributeData.getFgColorMode(),N=this._workAttributeData.getBgColor(),R=this._workAttributeData.getBgColorMode();if(g){let H=C;C=N,N=H;let D=E;E=R,R=D}let T=this._getBackgroundColor(R,N,g,x);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=T.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let P=v?this._config.fontWeightBold:this._config.fontWeight,z=y?"italic":"";this._tmpCtx.font=`${z} ${P} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=$T;let B=d.length===1&&Yy(d.charCodeAt(0)),F=d.length===1&&MG(d.charCodeAt(0)),Y=this._getForegroundColor(r,R,N,s,E,C,g,x,v,zT(d.charCodeAt(0)));this._tmpCtx.fillStyle=Y.css;let q=F?0:Tu*2,$=!1;this._config.customGlyphs!==!1&&($=qG(this._tmpCtx,d,q,q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let M=!B,U;if(typeof t=="number"?U=this._unicodeService.wcwidth(t):U=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=H%2===1?.5:0;if(this._tmpCtx.lineWidth=H,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())M=!1,this._tmpCtx.strokeStyle=`rgb(${oc.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{M=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let V=q,X=Math.ceil(q+this._config.deviceCharHeight)-D-(l?H*2:0),J=X+H,se=X+H*2,de=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<U;Z++){this._tmpCtx.save();let ce=V+Z*this._config.deviceCellWidth,le=V+(Z+1)*this._config.deviceCellWidth,we=ce+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(le,X),this._tmpCtx.moveTo(ce,se),this._tmpCtx.lineTo(le,se);break;case 3:let Ee=H<=1?se:Math.ceil(q+this._config.deviceCharHeight-H/2)-D,Re=H<=1?X:Math.ceil(q+this._config.deviceCharHeight+H/2)-D,te=new Path2D;te.rect(ce,X,this._config.deviceCellWidth,se-X),this._tmpCtx.clip(te),this._tmpCtx.moveTo(ce-this._config.deviceCellWidth/2,J),this._tmpCtx.bezierCurveTo(ce-this._config.deviceCellWidth/2,Re,ce,Re,ce,J),this._tmpCtx.bezierCurveTo(ce,Ee,we,Ee,we,J),this._tmpCtx.bezierCurveTo(we,Re,le,Re,le,J),this._tmpCtx.bezierCurveTo(le,Ee,le+this._config.deviceCellWidth/2,Ee,le+this._config.deviceCellWidth/2,J);break;case 4:let ie=de===0?0:de>=H?H*2-de:H-de;de>=H||ie===0?(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo(ce+ie,X),this._tmpCtx.lineTo(le,X)):(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(ce+ie,X),this._tmpCtx.moveTo(ce+ie+H,X),this._tmpCtx.lineTo(le,X)),de=IG(le-ce,H,de);break;case 5:let ke=.6,Ke=.3,_e=le-ce,ye=Math.floor(ke*_e),Ie=Math.floor(Ke*_e),ze=_e-ye-Ie;this._tmpCtx.setLineDash([ye,Ie,ze]),this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(le,X);break;case 1:default:this._tmpCtx.moveTo(ce,X),this._tmpCtx.lineTo(le,X);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!$&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let ce=new Path2D;ce.rect(V,X-Math.ceil(H/2),this._config.deviceCellWidth*U,se-X+Math.ceil(H/2)),this._tmpCtx.clip(ce),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=T.css,this._tmpCtx.strokeText(d,q,q+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=H%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+D),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*U,q+D),this._tmpCtx.stroke()}if($||this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let H=y_(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),T,Y,M);if(H)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=T.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,q,q+this._config.deviceCharHeight-D),H=y_(this._tmpCtx.getImageData(q,q,this._config.deviceCellWidth,this._config.deviceCellHeight),T,Y,M),!!H);D++);}if(S){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(q,q+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(q+this._config.deviceCharWidth*U,q+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let W=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),A;if(this._config.allowTransparency?A=uY(W):A=y_(W,T,Y,M),A)return y5;let O=this._findGlyphBoundingBox(W,this._workBoundingBox,m,F,$,q),L,G;for(;;){if(this._activePages.length===0){let H=this._createNewPage();L=H,G=H.currentRow,G.height=O.size.y;break}L=this._activePages[this._activePages.length-1],G=L.currentRow;for(let H of this._activePages)O.size.y<=H.currentRow.height&&(L=H,G=H.currentRow);for(let H=this._activePages.length-1;H>=0;H--)for(let D of this._activePages[H].fixedRows)D.height<=G.height&&O.size.y<=D.height&&(L=this._activePages[H],G=D);if(O.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new x_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,G=this._overflowSizePage.currentRow,G.x+O.size.x>=L.canvas.width&&(G.x=0,G.y+=G.height,G.height=0);break}if(G.y+O.size.y>=L.canvas.height||G.height>O.size.y+2){let H=!1;if(L.currentRow.y+L.currentRow.height+O.size.y>=L.canvas.height){let D;for(let V of this._activePages)if(V.currentRow.y+V.currentRow.height+O.size.y<V.canvas.height){D=V;break}if(D)L=D;else if(ac.maxAtlasPages&&this._pages.length>=ac.maxAtlasPages&&G.y+O.size.y<=L.canvas.height&&G.height>=O.size.y&&G.x+O.size.x<=L.canvas.width)H=!0;else{let V=this._createNewPage();L=V,G=V.currentRow,G.height=O.size.y,H=!0}}H||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),G={x:0,y:L.currentRow.y+L.currentRow.height,height:O.size.y},L.fixedRows.push(G),L.currentRow={x:0,y:G.y+G.height,height:0})}if(G.x+O.size.x<=L.canvas.width)break;G===L.currentRow?(G.x=0,G.y+=G.height,G.height=0):L.fixedRows.splice(L.fixedRows.indexOf(G),1)}return O.texturePage=this._pages.indexOf(L),O.texturePosition.x=G.x,O.texturePosition.y=G.y,O.texturePositionClipSpace.x=G.x/L.canvas.width,O.texturePositionClipSpace.y=G.y/L.canvas.height,O.sizeClipSpace.x/=L.canvas.width,O.sizeClipSpace.y/=L.canvas.height,G.height=Math.max(G.height,O.size.y),G.x+=O.size.x,L.ctx.putImageData(W,O.texturePosition.x-this._workBoundingBox.left,O.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,O.size.x,O.size.y),L.addGlyph(O),L.version++,O}_findGlyphBoundingBox(t,r,s,n,l,c){r.top=0;let d=n?this._config.deviceCellHeight:this._tmpCanvas.height,m=n?this._config.deviceCellWidth:s,h=!1;for(let v=0;v<d;v++){for(let g=0;g<m;g++){let x=v*this._tmpCanvas.width*4+g*4+3;if(t.data[x]!==0){r.top=v,h=!0;break}}if(h)break}r.left=0,h=!1;for(let v=0;v<c+m;v++){for(let g=0;g<d;g++){let x=g*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.left=v,h=!0;break}}if(h)break}r.right=m,h=!1;for(let v=c+m-1;v>=c;v--){for(let g=0;g<d;g++){let x=g*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){r.right=v,h=!0;break}}if(h)break}r.bottom=d,h=!1;for(let v=d-1;v>=0;v--){for(let g=0;g<m;g++){let x=v*this._tmpCanvas.width*4+g*4+3;if(t.data[x]!==0){r.bottom=v,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:r.right-r.left+1,y:r.bottom-r.top+1},sizeClipSpace:{x:r.right-r.left+1,y:r.bottom-r.top+1},offset:{x:-r.left+c+(n||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-r.top+c+(n||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},x_=class{constructor(t,r,s){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],s)for(let n of s)this._glyphs.push(...n.glyphs),this._usedPixels+=n._usedPixels;this.canvas=ZT(t,r,r),this.ctx=Rr(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function y_(e,t,r,s){let n=t.rgba>>>24,l=t.rgba>>>16&255,c=t.rgba>>>8&255,d=r.rgba>>>24,m=r.rgba>>>16&255,h=r.rgba>>>8&255,v=Math.floor((Math.abs(n-d)+Math.abs(l-m)+Math.abs(c-h))/12),g=!0;for(let x=0;x<e.data.length;x+=4)e.data[x]===n&&e.data[x+1]===l&&e.data[x+2]===c||s&&Math.abs(e.data[x]-n)+Math.abs(e.data[x+1]-l)+Math.abs(e.data[x+2]-c)<v?e.data[x+3]=0:g=!1;return g}function uY(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function ZT(e,t,r){let s=e.createElement("canvas");return s.width=t,s.height=r,s}function dY(e,t,r,s,n,l,c,d){let m={foreground:l.foreground,background:l.background,cursor:_i,cursorAccent:_i,selectionForeground:_i,selectionBackgroundTransparent:_i,selectionBackgroundOpaque:_i,selectionInactiveBackgroundTransparent:_i,selectionInactiveBackgroundOpaque:_i,overviewRulerBorder:_i,scrollbarSliderBackground:_i,scrollbarSliderHoverBackground:_i,scrollbarSliderActiveBackground:_i,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:n.customGlyphs,devicePixelRatio:c,deviceMaxTextureSize:d,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:r,deviceCharHeight:s,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontWeightBold:n.fontWeightBold,allowTransparency:n.allowTransparency,drawBoldTextInBrightColors:n.drawBoldTextInBrightColors,minimumContrastRatio:n.minimumContrastRatio,colors:m}}function b5(e,t){for(let r=0;r<e.colors.ansi.length;r++)if(e.colors.ansi[r].rgba!==t.colors.ansi[r].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function hY(e){return(e&50331648)===16777216||(e&50331648)===33554432}var wi=[];function QT(e,t,r,s,n,l,c,d,m){let h=dY(s,n,l,c,t,r,d,m);for(let x=0;x<wi.length;x++){let y=wi[x],w=y.ownedBy.indexOf(e);if(w>=0){if(b5(y.config,h))return y.atlas;y.ownedBy.length===1?(y.atlas.dispose(),wi.splice(x,1)):y.ownedBy.splice(w,1);break}}for(let x=0;x<wi.length;x++){let y=wi[x];if(b5(y.config,h))return y.ownedBy.push(e),y.atlas}let v=e._core,g={atlas:new Xa(document,h,v.unicodeService),config:h,ownedBy:[e]};return wi.push(g),g.atlas}function w5(e){for(let t=0;t<wi.length;t++){let r=wi[t].ownedBy.indexOf(e);if(r!==-1){wi[t].ownedBy.length===1?(wi[t].atlas.dispose(),wi.splice(t,1)):wi[t].ownedBy.splice(r,1);break}}}var gf=600,fY=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=gf){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=gf-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=gf-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},gf)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function S5(e,t,r){let s=new t.ResizeObserver(n=>{let l=n.find(m=>m.target===e);if(!l)return;if(!("devicePixelContentBoxSize"in l)){s==null||s.disconnect(),s=void 0;return}let c=l.devicePixelContentBoxSize[0].inlineSize,d=l.devicePixelContentBoxSize[0].blockSize;c>0&&d>0&&r(c,d)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return ms(()=>s==null?void 0:s.disconnect())}function mY(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var C5=class JT extends oc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new WT,this.combinedData=""}static fromCharData(t){let r=new JT;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?mY(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(s-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},eM=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function tM(e,t,r){let s=Rr(e.createProgram());if(e.attachShader(s,Rr(k5(e,e.VERTEX_SHADER,t))),e.attachShader(s,Rr(k5(e,e.FRAGMENT_SHADER,r))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function k5(e,t,r){let s=Rr(e.createShader(t));if(e.shaderSource(s,r),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function pY(e,t){let r=Math.min(e.length*2,t),s=new Float32Array(r);for(let n=0;n<e.length;n++)s[n]=e[n];return s}var gY=class{constructor(t){this.texture=t,this.version=-1}},vY=`#version 300 es
636
+ layout (location = 0) in vec2 a_unitquad;
637
+ layout (location = 1) in vec2 a_cellpos;
638
+ layout (location = 2) in vec2 a_offset;
639
+ layout (location = 3) in vec2 a_size;
640
+ layout (location = 4) in float a_texpage;
641
+ layout (location = 5) in vec2 a_texcoord;
642
+ layout (location = 6) in vec2 a_texsize;
643
+
644
+ uniform mat4 u_projection;
645
+ uniform vec2 u_resolution;
646
+
647
+ out vec2 v_texcoord;
648
+ flat out int v_texpage;
649
+
650
+ void main() {
651
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
652
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
653
+ v_texpage = int(a_texpage);
654
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
655
+ }`;function _Y(e){let t="";for(let r=1;r<e;r++)t+=` else if (v_texpage == ${r}) { outColor = texture(u_texture[${r}], v_texcoord); }`;return`#version 300 es
656
+ precision lowp float;
657
+
658
+ in vec2 v_texcoord;
659
+ flat in int v_texpage;
660
+
661
+ uniform sampler2D u_texture[${e}];
662
+
663
+ out vec4 outColor;
664
+
665
+ void main() {
666
+ if (v_texpage == 0) {
667
+ outColor = texture(u_texture[0], v_texcoord);
668
+ } ${t}
669
+ }`}var Za=11,ec=Za*Float32Array.BYTES_PER_ELEMENT,xY=2,cr=0,Vt,b_=0,Du=0,yY=class extends Qi{constructor(t,r,s,n){super(),this._terminal=t,this._gl=r,this._dimensions=s,this._optionsService=n,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let l=this._gl;Xa.maxAtlasPages===void 0&&(Xa.maxAtlasPages=Math.min(32,Rr(l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS))),Xa.maxTextureSize=Rr(l.getParameter(l.MAX_TEXTURE_SIZE))),this._program=Rr(tM(l,vY,_Y(Xa.maxAtlasPages))),this._register(ms(()=>l.deleteProgram(this._program))),this._projectionLocation=Rr(l.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Rr(l.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Rr(l.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let c=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this._register(ms(()=>l.deleteBuffer(d))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,c,l.STATIC_DRAW),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let m=new Uint8Array([0,1,2,3]),h=l.createBuffer();this._register(ms(()=>l.deleteBuffer(h))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,h),l.bufferData(l.ELEMENT_ARRAY_BUFFER,m,l.STATIC_DRAW),this._attributesBuffer=Rr(l.createBuffer()),this._register(ms(()=>l.deleteBuffer(this._attributesBuffer))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,2,l.FLOAT,!1,ec,0),l.vertexAttribDivisor(2,1),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,l.FLOAT,!1,ec,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(3,1),l.enableVertexAttribArray(4),l.vertexAttribPointer(4,1,l.FLOAT,!1,ec,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(4,1),l.enableVertexAttribArray(5),l.vertexAttribPointer(5,2,l.FLOAT,!1,ec,5*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(5,1),l.enableVertexAttribArray(6),l.vertexAttribPointer(6,2,l.FLOAT,!1,ec,7*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(6,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,ec,9*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.useProgram(this._program);let v=new Int32Array(Xa.maxAtlasPages);for(let g=0;g<Xa.maxAtlasPages;g++)v[g]=g;l.uniform1iv(this._textureLocation,v),l.uniformMatrix4fv(this._projectionLocation,!1,eM),this._atlasTextures=[];for(let g=0;g<Xa.maxAtlasPages;g++){let x=new gY(Rr(l.createTexture()));this._register(ms(()=>l.deleteTexture(x.texture))),l.activeTexture(l.TEXTURE0+g),l.bindTexture(l.TEXTURE_2D,x.texture),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[g]=x}l.enable(l.BLEND),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,n,l,c,d,m,h){this._updateCell(this._vertices.attributes,t,r,s,n,l,c,d,m,h)}_updateCell(t,r,s,n,l,c,d,m,h,v){if(cr=(s*this._terminal.cols+r)*Za,n===0||n===void 0){t.fill(0,cr,cr+Za-1-xY);return}this._atlas&&(m&&m.length>1?Vt=this._atlas.getRasterizedGlyphCombinedChar(m,l,c,d,!1,this._terminal.element):Vt=this._atlas.getRasterizedGlyph(n,l,c,d,!1,this._terminal.element),b_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),l!==v&&Vt.offset.x>b_?(Du=Vt.offset.x-b_,t[cr]=-(Vt.offset.x-Du)+this._dimensions.device.char.left,t[cr+1]=-Vt.offset.y+this._dimensions.device.char.top,t[cr+2]=(Vt.size.x-Du)/this._dimensions.device.canvas.width,t[cr+3]=Vt.size.y/this._dimensions.device.canvas.height,t[cr+4]=Vt.texturePage,t[cr+5]=Vt.texturePositionClipSpace.x+Du/this._atlas.pages[Vt.texturePage].canvas.width,t[cr+6]=Vt.texturePositionClipSpace.y,t[cr+7]=Vt.sizeClipSpace.x-Du/this._atlas.pages[Vt.texturePage].canvas.width,t[cr+8]=Vt.sizeClipSpace.y):(t[cr]=-Vt.offset.x+this._dimensions.device.char.left,t[cr+1]=-Vt.offset.y+this._dimensions.device.char.top,t[cr+2]=Vt.size.x/this._dimensions.device.canvas.width,t[cr+3]=Vt.size.y/this._dimensions.device.canvas.height,t[cr+4]=Vt.texturePage,t[cr+5]=Vt.texturePositionClipSpace.x,t[cr+6]=Vt.texturePositionClipSpace.y,t[cr+7]=Vt.sizeClipSpace.x,t[cr+8]=Vt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&BG(n,h,Vt.size.x,this._dimensions.device.cell.width)&&(t[cr+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*Za;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let n=0;n<t.rows;n++)for(let l=0;l<t.cols;l++)this._vertices.attributes[s+9]=l/t.cols,this._vertices.attributes[s+10]=n/t.rows,s+=Za}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let s=this._vertices.attributesBuffers[this._activeBuffer],n=0;for(let l=0;l<t.lineLengths.length;l++){let c=l*this._terminal.cols*Za,d=this._vertices.attributes.subarray(c,c+t.lineLengths[l]*Za);s.set(d,n),n+=d.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,n),r.STREAM_DRAW);for(let l=0;l<this._atlas.pages.length;l++)this._atlas.pages[l].version!==this._atlasTextures[l].version&&this._bindAtlasPageTexture(r,this._atlas,l);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,n/Za)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[s].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}},bY=class{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(t,r,s,n=!1){if(this.selectionStart=r,this.selectionEnd=s,!r||!s||r[0]===s[0]&&r[1]===s[1]){this.clear();return}let l=t.buffers.active.ydisp,c=r[1]-l,d=s[1]-l,m=Math.max(c,0),h=Math.min(d,t.rows-1);if(m>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=h,this.startCol=r[0],this.endCol=s[0]}isCellSelected(t,r,s){return this.hasSelection?(s-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?r>=this.startCol&&s>=this.viewportCappedStartRow&&r<this.endCol&&s<=this.viewportCappedEndRow:r<this.startCol&&s>=this.viewportCappedStartRow&&r>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&r<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&r>=this.startCol):!1}};function wY(){return new bY}var mm=4,Bf=1,Pf=2,w_=3,SY=2147483648,CY=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=wY()}resize(t,r){let s=t*r*mm;s!==this.cells.length&&(this.cells=new Uint32Array(s),this.lineLengths=new Uint32Array(r))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},kY=`#version 300 es
670
+ layout (location = 0) in vec2 a_position;
671
+ layout (location = 1) in vec2 a_size;
672
+ layout (location = 2) in vec4 a_color;
673
+ layout (location = 3) in vec2 a_unitquad;
674
+
675
+ uniform mat4 u_projection;
676
+
677
+ out vec4 v_color;
678
+
679
+ void main() {
680
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
681
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
682
+ v_color = a_color;
683
+ }`,EY=`#version 300 es
684
+ precision lowp float;
685
+
686
+ in vec4 v_color;
687
+
688
+ out vec4 outColor;
689
+
690
+ void main() {
691
+ outColor = v_color;
692
+ }`,sa=8,S_=sa*Float32Array.BYTES_PER_ELEMENT,RY=20*sa,E5=class{constructor(){this.attributes=new Float32Array(RY),this.count=0}},ta=0,R5=0,N5=0,j5=0,A5=0,T5=0,M5=0,NY=class extends Qi{constructor(e,t,r,s){super(),this._terminal=e,this._gl=t,this._dimensions=r,this._themeService=s,this._vertices=new E5,this._verticesCursor=new E5;let n=this._gl;this._program=Rr(tM(n,kY,EY)),this._register(ms(()=>n.deleteProgram(this._program))),this._projectionLocation=Rr(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),c=n.createBuffer();this._register(ms(()=>n.deleteBuffer(c))),n.bindBuffer(n.ARRAY_BUFFER,c),n.bufferData(n.ARRAY_BUFFER,l,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),m=n.createBuffer();this._register(ms(()=>n.deleteBuffer(m))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m),n.bufferData(n.ELEMENT_ARRAY_BUFFER,d,n.STATIC_DRAW),this._attributesBuffer=Rr(n.createBuffer()),this._register(ms(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,S_,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,S_,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,S_,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(h=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,eM),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,r=this._vertices,s=1,n,l,c,d,m,h,v,g,x,y,w;for(n=0;n<t.rows;n++){for(c=-1,d=0,m=0,h=!1,l=0;l<t.cols;l++)v=(n*t.cols+l)*mm,g=e.cells[v+Bf],x=e.cells[v+Pf],y=!!(x&67108864),(g!==d||x!==m&&(h||y))&&((d!==0||h&&m!==0)&&(w=s++*sa,this._updateRectangle(r,w,m,d,c,l,n)),c=l,d=g,m=x,h=y);(d!==0||h&&m!==0)&&(w=s++*sa,this._updateRectangle(r,w,m,d,c,t.cols,n))}r.count=s}updateCursor(e){let t=this._verticesCursor,r=e.cursor;if(!r||r.style==="block"){t.count=0;return}let s,n=0;(r.style==="bar"||r.style==="outline")&&(s=n++*sa,this._addRectangleFloat(t.attributes,s,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.style==="bar"?r.dpr*r.cursorWidth:r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(r.style==="underline"||r.style==="outline")&&(s=n++*sa,this._addRectangleFloat(t.attributes,s,r.x*this._dimensions.device.cell.width,(r.y+1)*this._dimensions.device.cell.height-r.dpr,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat)),r.style==="outline"&&(s=n++*sa,this._addRectangleFloat(t.attributes,s,r.x*this._dimensions.device.cell.width,r.y*this._dimensions.device.cell.height,r.width*this._dimensions.device.cell.width,r.dpr,this._cursorFloat),s=n++*sa,this._addRectangleFloat(t.attributes,s,(r.x+r.width)*this._dimensions.device.cell.width-r.dpr,r.y*this._dimensions.device.cell.height,r.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=n}_updateRectangle(e,t,r,s,n,l,c){if(r&67108864)switch(r&50331648){case 16777216:case 33554432:ta=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:ta=(r&16777215)<<8;break;case 0:default:ta=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:ta=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:ta=(s&16777215)<<8;break;case 0:default:ta=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=pY(e.attributes,this._terminal.rows*this._terminal.cols*sa)),R5=n*this._dimensions.device.cell.width,N5=c*this._dimensions.device.cell.height,j5=(ta>>24&255)/255,A5=(ta>>16&255)/255,T5=(ta>>8&255)/255,M5=1,this._addRectangle(e.attributes,t,R5,N5,(l-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,j5,A5,T5,M5)}_addRectangle(e,t,r,s,n,l,c,d,m,h){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=l/this._dimensions.device.canvas.height,e[t+4]=c,e[t+5]=d,e[t+6]=m,e[t+7]=h}_addRectangleFloat(e,t,r,s,n,l,c){e[t]=r/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=n/this._dimensions.device.canvas.width,e[t+3]=l/this._dimensions.device.canvas.height,e[t+4]=c[0],e[t+5]=c[1],e[t+6]=c[2],e[t+7]=c[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},jY=class extends Qi{constructor(t,r,s,n,l,c,d,m){super(),this._container=r,this._alpha=l,this._coreBrowserService=c,this._optionsService=d,this._themeService=m,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(ms(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Rr(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,s){}handleSelectionChanged(t,r,s,n=!1){}_setTransparency(t,r){if(r===this._alpha)return;let s=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=QT(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,r,s,n){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(t,r,s,n){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=$T,this._clipCell(s,n,r.getWidth()),this._ctx.fillText(r.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,s){let n=r?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${n} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},AY=class extends jY{constructor(t,r,s,n,l,c,d){super(s,t,"link",r,!0,l,c,d),this._register(n.onShowLinkUnderline(m=>this._handleShowLinkUnderline(m))),this._register(n.onHideLinkUnderline(m=>this._handleHideLinkUnderline(m)))}resize(t,r){super.resize(t,r),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&hY(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let r=t.y1+1;r<t.y2;r++)this._fillBottomLineAtCells(0,r,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Ko=typeof window=="object"?window:globalThis,Ix=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Yt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Yt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ix.INSTANCE=new Ix;var rM=Ix;function TY(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}rM.INSTANCE.onDidChangeZoomLevel;rM.INSTANCE.onDidChangeFullscreen;var Ac=typeof navigator=="object"?navigator.userAgent:"";Ac.indexOf("Firefox")>=0;Ac.indexOf("AppleWebKit")>=0;var MY=Ac.indexOf("Chrome")>=0;!MY&&Ac.indexOf("Safari")>=0;Ac.indexOf("Electron/")>=0;Ac.indexOf("Android")>=0;var C_=!1;if(typeof Ko.matchMedia=="function"){let e=Ko.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ko.matchMedia("(display-mode: fullscreen)");C_=e.matches,TY(Ko,e,({matches:r})=>{C_&&t.matches||(C_=r)})}var lc="en",k_=!1,sM=!1,vf,If=lc,D5=lc,DY,Hi,Jo=globalThis,as,Fk;typeof Jo.vscode<"u"&&typeof Jo.vscode.process<"u"?as=Jo.vscode.process:typeof process<"u"&&typeof((Fk=process==null?void 0:process.versions)==null?void 0:Fk.node)=="string"&&(as=process);var qk,LY=typeof((qk=as==null?void 0:as.versions)==null?void 0:qk.electron)=="string",OY=LY&&(as==null?void 0:as.type)==="renderer",Wk;if(typeof as=="object"){as.platform,as.platform,k_=as.platform==="linux",k_&&as.env.SNAP&&as.env.SNAP_REVISION,as.env.CI||as.env.BUILD_ARTIFACTSTAGINGDIRECTORY,vf=lc,If=lc;let e=as.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);vf=t.userLocale,D5=t.osLocale,If=t.resolvedLanguage||lc,DY=(Wk=t.languagePack)==null?void 0:Wk.translationsConfigFile}catch{}sM=!0}else typeof navigator=="object"&&!OY?(Hi=navigator.userAgent,Hi.indexOf("Windows")>=0,Hi.indexOf("Macintosh")>=0,(Hi.indexOf("Macintosh")>=0||Hi.indexOf("iPad")>=0||Hi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,k_=Hi.indexOf("Linux")>=0,(Hi==null?void 0:Hi.indexOf("Mobi"))>=0,If=globalThis._VSCODE_NLS_LANGUAGE||lc,vf=navigator.language.toLowerCase(),D5=vf):console.error("Unable to resolve platform.");var L5=sM,Rn=Hi,qa=If,BY;(e=>{function t(){return qa}e.value=t;function r(){return qa.length===2?qa==="en":qa.length>=3?qa[0]==="e"&&qa[1]==="n"&&qa[2]==="-":!1}e.isDefaultVariant=r;function s(){return qa==="en"}e.isDefault=s})(BY||(BY={}));var PY=typeof Jo.postMessage=="function"&&!Jo.importScripts;(()=>{if(PY){let e=[];Jo.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,n=e.length;s<n;s++){let l=e[s];if(l.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),l.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),Jo.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var IY=!!(Rn&&Rn.indexOf("Chrome")>=0);Rn&&Rn.indexOf("Firefox")>=0;!IY&&Rn&&Rn.indexOf("Safari")>=0;Rn&&Rn.indexOf("Edg/")>=0;Rn&&Rn.indexOf("Android")>=0;var tc=typeof navigator=="object"?navigator:{};L5||document.queryCommandSupported&&document.queryCommandSupported("copy")||tc&&tc.clipboard&&tc.clipboard.writeText,L5||tc&&tc.clipboard&&tc.clipboard.readText;var Ky=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},E_=new Ky,O5=new Ky,B5=new Ky;new Array(230);var zY;(e=>{function t(d){return E_.keyCodeToStr(d)}e.toString=t;function r(d){return E_.strToKeyCode(d)}e.fromString=r;function s(d){return O5.keyCodeToStr(d)}e.toUserSettingsUS=s;function n(d){return B5.keyCodeToStr(d)}e.toUserSettingsGeneral=n;function l(d){return O5.strToKeyCode(d)||B5.strToKeyCode(d)}e.fromUserSettings=l;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return E_.keyCodeToStr(d)}e.toElectronAccelerator=c})(zY||(zY={}));var iM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),$Y;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof UY?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ia.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:iM})})($Y||($Y={}));var UY=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?iM:(this._emitter||(this._emitter=new Yt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},HY;(e=>{async function t(s){let n,l=await Promise.all(s.map(c=>c.then(d=>d,d=>{n||(n=d)})));if(typeof n<"u")throw n;return l}e.settled=t;function r(s){return new Promise(async(n,l)=>{try{await s(n,l)}catch(c){l(c)}})}e.withAsyncBody=r})(HY||(HY={}));var P5=class xi{static fromArray(t){return new xi(r=>{r.emitMany(t)})}static fromPromise(t){return new xi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new xi(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new xi(async r=>{await Promise.all(t.map(async s=>{for await(let n of s)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Yt,queueMicrotask(async()=>{let s={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(s)),this.resolve()}catch(n){this.reject(n)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ia.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new xi(async s=>{for await(let n of t)s.emitOne(r(n))})}map(t){return xi.map(this,t)}static filter(t,r){return new xi(async s=>{for await(let n of t)r(n)&&s.emitOne(n)})}filter(t){return xi.filter(this,t)}static coalesce(t){return xi.filter(t,r=>!!r)}coalesce(){return xi.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return xi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};P5.EMPTY=P5.fromArray([]);var{getWindow:FY}=(function(){let e=new Map,t={window:Ko,disposables:new hc};e.set(Ko.vscodeWindowId,t);let r=new Yt,s=new Yt,n=new Yt;function l(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return Qi.None;let d=new hc,m={window:c,disposables:d.add(new hc)};return e.set(c.vscodeWindowId,m),d.add(ms(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),d.add(zx(c,WY.BEFORE_UNLOAD,()=>{n.fire(c)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:l,getWindow(c){var h;let d=c;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=c;return m!=null&&m.view?m.view.window:Ko},getDocument(c){return FY(c).document}}})(),qY=class{constructor(t,r,s,n){this._node=t,this._type=r,this._handler=s,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function zx(e,t,r,s){return new qY(e,t,r,s)}var WY={BEFORE_UNLOAD:"beforeunload"},VY=class extends Qi{constructor(t,r,s,n,l,c,d,m,h){super(),this._terminal=t,this._characterJoinerService=r,this._charSizeService=s,this._coreBrowserService=n,this._coreService=l,this._decorationService=c,this._optionsService=d,this._themeService=m,this._cursorBlinkStateManager=new Au,this._charAtlasDisposable=this._register(new Au),this._observerDisposable=this._register(new Au),this._model=new CY,this._workCell=new C5,this._workCell2=new C5,this._rectangleRenderer=this._register(new Au),this._glyphRenderer=this._register(new Au),this._onChangeTextureAtlas=this._register(new Yt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Yt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Yt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Yt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Yt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let v={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",v),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new zG(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new AY(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=PG(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(d.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(zx(this._canvas,"webglcontextlost",g=>{console.log("webglcontextlost event received"),g.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(g)},3e3)})),this._register(zx(this._canvas,"webglcontextrestored",g=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,w5(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=S5(this._canvas,this._coreBrowserService.window,(g,x)=>this._setCanvasDevicePixelDimensions(g,x)),this._register(this._coreBrowserService.onWindowChange(g=>{this._observerDisposable.value=S5(this._canvas,g,(x,y)=>this._setCanvasDevicePixelDimensions(x,y))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ms(()=>{var g;for(let x of this._renderLayers)x.dispose();(g=this._canvas.parentElement)==null||g.removeChild(this._canvas),w5(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,r){var s,n,l,c;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let d of this._renderLayers)d.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(s=this._rectangleRenderer.value)==null||s.setDimensions(this.dimensions),(n=this._rectangleRenderer.value)==null||n.handleResize(),(l=this._glyphRenderer.value)==null||l.setDimensions(this.dimensions),(c=this._glyphRenderer.value)==null||c.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let r of this._renderLayers)r.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let r of this._renderLayers)r.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,s){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,t,r,s);this._model.selection.update(this._core,t,r,s),this._requestRedrawViewport()}handleCursorMove(){var t;for(let r of this._renderLayers)r.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new NY(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new yY(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var r;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=QT(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=OT(ia.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ia.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(r=this._glyphRenderer.value)==null||r.setAtlas(this._charAtlas)}_clearModel(t){var r;this._model.clear(),t&&((r=this._glyphRenderer.value)==null||r.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let r of this._renderLayers)r.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,r){var s;if(!this._isAttached)if((s=this._core.screenElement)!=null&&s.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let n of this._renderLayers)n.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new fY(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let s=this._core,n=this._workCell,l,c,d,m,h,v,g=0,x=!0,y,w,S,k,C,E,N,R,T;t=I5(t,s.rows-1,0),r=I5(r,s.rows-1,0);let P=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,B=z-s.buffer.ydisp,F=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),Y=-1,q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let $=!1;for(c=t;c<=r;c++)for(d=c+s.buffer.ydisp,m=s.buffer.lines.get(d),this._model.lineLengths[c]=0,S=z===d,g=0,h=this._characterJoinerService.getJoinedCharacters(d),R=0;R<s.cols;R++){if(l=this._cellColorResolver.result.bg,m.loadCell(R,n),R===0&&(l=this._cellColorResolver.result.bg),v=!1,x=R>=g,y=R,h.length>0&&R===h[0][0]&&x){w=h.shift();let M=this._model.selection.isCellSelected(this._terminal,w[0],d);for(N=w[0]+1;N<w[1];N++)x&&(x=M===this._model.selection.isCellSelected(this._terminal,N,d));x&&(x=!S||F<w[0]||F>=w[1]),x?(v=!0,n=new GY(n,m.translateToString(!0,w[0],w[1]),w[1]-w[0]),y=w[1]-1):g=w[1]}if(k=n.getChars(),C=n.getCode(),N=(c*s.cols+R)*mm,this._cellColorResolver.resolve(n,R,d,this.dimensions.device.cell.width),q&&d===z&&(R===F&&(this._model.cursor={x:F,y:B,width:n.getWidth(),style:this._coreBrowserService.isFocused?P:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},Y=F+n.getWidth()-1),R>=F&&R<=Y&&(this._coreBrowserService.isFocused&&P==="block"||this._coreBrowserService.isFocused===!1&&s.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),C!==0&&(this._model.lineLengths[c]=R+1),!(this._model.cells[N]===C&&this._model.cells[N+Bf]===this._cellColorResolver.result.bg&&this._model.cells[N+Pf]===this._cellColorResolver.result.fg&&this._model.cells[N+w_]===this._cellColorResolver.result.ext)&&($=!0,k.length>1&&(C|=SY),this._model.cells[N]=C,this._model.cells[N+Bf]=this._cellColorResolver.result.bg,this._model.cells[N+Pf]=this._cellColorResolver.result.fg,this._model.cells[N+w_]=this._cellColorResolver.result.ext,E=n.getWidth(),this._glyphRenderer.value.updateCell(R,c,C,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,E,l),v)){for(n=this._workCell,R++;R<=y;R++)T=(c*s.cols+R)*mm,this._glyphRenderer.value.updateCell(R,c,0,0,0,0,AG,0,0),this._model.cells[T]=0,this._model.cells[T+Bf]=this._cellColorResolver.result.bg,this._model.cells[T+Pf]=this._cellColorResolver.result.fg,this._model.cells[T+w_]=this._cellColorResolver.result.ext;R--}}$&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},GY=class extends oc{constructor(t,r,s){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function I5(e,t,r=0){return Math.max(Math.min(e,t),r)}var z5="di$target",$5="di$dependencies",R_=new Map;function Mn(e){if(R_.has(e))return R_.get(e);let t=function(r,s,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");YY(t,r,n)};return t._id=e,R_.set(e,t),t}function YY(e,t,r){t[z5]===t?t[$5].push({id:e,index:r}):(t[$5]=[{id:e,index:r}],t[z5]=t)}Mn("BufferService");Mn("CoreMouseService");Mn("CoreService");Mn("CharsetService");Mn("InstantiationService");Mn("LogService");var KY=Mn("OptionsService");Mn("OscLinkService");Mn("UnicodeService");Mn("DecorationService");var XY={trace:0,debug:1,info:2,warn:3,error:4,off:5},ZY="xterm.js: ",U5=class extends Qi{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=XY[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":ZY)+r,...s)}trace(t,...r){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,t,r)}debug(t,...r){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,t,r)}info(t,...r){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,t,r)}warn(t,...r){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,t,r)}error(t,...r){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,t,r)}};U5=_G([xG(0,KY)],U5);var QY=class extends Qi{constructor(t){if(IT&&jG()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new Yt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Yt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Yt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Yt),this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this._register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=r.coreService,n=r.optionsService,l=r,c=l._renderService,d=l._characterJoinerService,m=l._charSizeService,h=l._coreBrowserService,v=l._decorationService;l._logService;let g=l._themeService;this._renderer=this._register(new VY(t,d,m,h,s,v,n,g,this._preserveDrawingBuffer)),this._register(ia.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ia.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ia.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ia.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),c.setRenderer(this._renderer),this._register(ms(()=>{if(this._terminal._core._store._isDisposed)return;let x=this._terminal._core._renderService;x.setRenderer(this._terminal._core._createRenderer()),x.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};/**
693
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
694
+ * @license MIT
695
+ *
696
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
697
+ * @license MIT
698
+ *
699
+ * Originally forked from (with the author's permission):
700
+ * Fabrice Bellard's javascript vt100 for jslinux:
701
+ * http://bellard.org/jslinux/
702
+ * Copyright (c) 2011 Fabrice Bellard
703
+ */var nM=Object.defineProperty,JY=Object.getOwnPropertyDescriptor,eK=(e,t)=>{for(var r in t)nM(e,r,{get:t[r],enumerable:!0})},pr=(e,t,r,s)=>{for(var n=s>1?void 0:s?JY(t,r):t,l=e.length-1,c;l>=0;l--)(c=e[l])&&(n=(s?c(t,r,n):c(n))||n);return s&&n&&nM(t,r,n),n},Ne=(e,t)=>(r,s)=>t(r,s,e),H5="Terminal input",$x={get:()=>H5,set:e=>H5=e},F5="Too much output to announce, navigate to rows manually to read",Ux={get:()=>F5,set:e=>F5=e};function tK(e){return e.replace(/\r?\n/g,"\r")}function rK(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function sK(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function iK(e,t,r,s){if(e.stopPropagation(),e.clipboardData){let n=e.clipboardData.getData("text/plain");aM(n,t,r,s)}}function aM(e,t,r,s){e=tK(e),e=rK(e,r.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),t.value=""}function oM(e,t,r){let s=r.getBoundingClientRect(),n=e.clientX-s.left-10,l=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${n}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function q5(e,t,r,s,n){oM(e,t,r),n&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Ja(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function hp(e,t=0,r=e.length){let s="";for(let n=t;n<r;++n){let l=e[n];l>65535?(l-=65536,s+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):s+=String.fromCharCode(l)}return s}var nK=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let r=e.length;if(!r)return 0;let s=0,n=0;if(this._interim){let l=e.charCodeAt(n++);56320<=l&&l<=57343?t[s++]=(this._interim-55296)*1024+l-56320+65536:(t[s++]=this._interim,t[s++]=l),this._interim=0}for(let l=n;l<r;++l){let c=e.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=r)return this._interim=c,s;let d=e.charCodeAt(l);56320<=d&&d<=57343?t[s++]=(c-55296)*1024+d-56320+65536:(t[s++]=c,t[s++]=d);continue}c!==65279&&(t[s++]=c)}return s}},aK=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let r=e.length;if(!r)return 0;let s=0,n,l,c,d,m=0,h=0;if(this.interim[0]){let x=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let w=0,S;for(;(S=this.interim[++w]&63)&&w<4;)y<<=6,y|=S;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=k-w;for(;h<C;){if(h>=r)return 0;if(S=e[h++],(S&192)!==128){h--,x=!0;break}else this.interim[w++]=S,y<<=6,y|=S&63}x||(k===2?y<128?h--:t[s++]=y:k===3?y<2048||y>=55296&&y<=57343||y===65279||(t[s++]=y):y<65536||y>1114111||(t[s++]=y)),this.interim.fill(0)}let v=r-4,g=h;for(;g<r;){for(;g<v&&!((n=e[g])&128)&&!((l=e[g+1])&128)&&!((c=e[g+2])&128)&&!((d=e[g+3])&128);)t[s++]=n,t[s++]=l,t[s++]=c,t[s++]=d,g+=4;if(n=e[g++],n<128)t[s++]=n;else if((n&224)===192){if(g>=r)return this.interim[0]=n,s;if(l=e[g++],(l&192)!==128){g--;continue}if(m=(n&31)<<6|l&63,m<128){g--;continue}t[s++]=m}else if((n&240)===224){if(g>=r)return this.interim[0]=n,s;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=r)return this.interim[0]=n,this.interim[1]=l,s;if(c=e[g++],(c&192)!==128){g--;continue}if(m=(n&15)<<12|(l&63)<<6|c&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[s++]=m}else if((n&248)===240){if(g>=r)return this.interim[0]=n,s;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=r)return this.interim[0]=n,this.interim[1]=l,s;if(c=e[g++],(c&192)!==128){g--;continue}if(g>=r)return this.interim[0]=n,this.interim[1]=l,this.interim[2]=c,s;if(d=e[g++],(d&192)!==128){g--;continue}if(m=(n&7)<<18|(l&63)<<12|(c&63)<<6|d&63,m<65536||m>1114111)continue;t[s++]=m}}return s}},lM="",so=" ",Ad=class cM{constructor(){this.fg=0,this.bg=0,this.extended=new pm}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new cM;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},pm=class uM{constructor(t=0,r=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new uM(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ei=class dM extends Ad{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pm,this.combinedData=""}static fromCharData(t){let r=new dM;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ja(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let n=t[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(s-55296)*1024+n-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},W5="di$target",Hx="di$dependencies",N_=new Map;function oK(e){return e[Hx]||[]}function Jr(e){if(N_.has(e))return N_.get(e);let t=function(r,s,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");lK(t,r,n)};return t._id=e,N_.set(e,t),t}function lK(e,t,r){t[W5]===t?t[Hx].push({id:e,index:r}):(t[Hx]=[{id:e,index:r}],t[W5]=t)}var ws=Jr("BufferService"),hM=Jr("CoreMouseService"),ml=Jr("CoreService"),cK=Jr("CharsetService"),Xy=Jr("InstantiationService"),fM=Jr("LogService"),Ss=Jr("OptionsService"),mM=Jr("OscLinkService"),uK=Jr("UnicodeService"),Td=Jr("DecorationService"),Fx=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var v;let r=this._bufferService.buffer.lines.get(e-1);if(!r){t(void 0);return}let s=[],n=this._optionsService.rawOptions.linkHandler,l=new Ei,c=r.getTrimmedLength(),d=-1,m=-1,h=!1;for(let g=0;g<c;g++)if(!(m===-1&&!r.hasContent(g))){if(r.loadCell(g,l),l.hasExtendedAttrs()&&l.extended.urlId)if(m===-1){m=g,d=l.extended.urlId;continue}else h=l.extended.urlId!==d;else m!==-1&&(h=!0);if(h||m!==-1&&g===c-1){let x=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(x){let y={start:{x:m+1,y:e},end:{x:g+(!h&&g===c-1?1:0),y:e}},w=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let S=new URL(x);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||s.push({text:x,range:y,activate:(S,k)=>n?n.activate(S,k,y):dK(S,k),hover:(S,k)=>{var C;return(C=n==null?void 0:n.hover)==null?void 0:C.call(n,S,k,y)},leave:(S,k)=>{var C;return(C=n==null?void 0:n.leave)==null?void 0:C.call(n,S,k,y)}})}h=!1,l.hasExtendedAttrs()&&l.extended.urlId?(m=g,d=l.extended.urlId):(m=-1,d=-1)}}t(s)}};Fx=pr([Ne(0,ws),Ne(1,Ss),Ne(2,mM)],Fx);function dK(e,t){if(confirm(`Do you want to navigate to ${t}?
704
+
705
+ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var fp=Jr("CharSizeService"),va=Jr("CoreBrowserService"),Zy=Jr("MouseService"),_a=Jr("RenderService"),hK=Jr("SelectionService"),pM=Jr("CharacterJoinerService"),Tc=Jr("ThemeService"),gM=Jr("LinkProviderService"),fK=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?V5.isErrorNoTelemetry(e)?new V5(e.message+`
706
+
707
+ `+e.stack):new Error(e.message+`
708
+
709
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},mK=new fK;function zf(e){pK(e)||mK.onUnexpectedError(e)}var qx="Canceled";function pK(e){return e instanceof gK?!0:e instanceof Error&&e.name===qx&&e.message===qx}var gK=class extends Error{constructor(){super(qx),this.name=this.message}};function vK(e){return new Error(`Illegal argument: ${e}`)}var V5=class Wx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Wx)return t;let r=new Wx;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Vx=class vM extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,vM.prototype)}};function Gs(e,t=0){return e[e.length-(1+t)]}var _K;(e=>{function t(l){return l<0}e.isLessThan=t;function r(l){return l<=0}e.isLessThanOrEqual=r;function s(l){return l>0}e.isGreaterThan=s;function n(l){return l===0}e.isNeitherLessOrGreaterThan=n,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(_K||(_K={}));function xK(e,t){let r=this,s=!1,n;return function(){return s||(s=!0,t||(n=e.apply(r,arguments))),n}}var _M;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let r=Object.freeze([]);function s(){return r}e.empty=s;function*n(R){yield R}e.single=n;function l(R){return t(R)?R:n(R)}e.wrap=l;function c(R){return R||r}e.from=c;function*d(R){for(let T=R.length-1;T>=0;T--)yield R[T]}e.reverse=d;function m(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=m;function h(R){return R[Symbol.iterator]().next().value}e.first=h;function v(R,T){let P=0;for(let z of R)if(T(z,P++))return!0;return!1}e.some=v;function g(R,T){for(let P of R)if(T(P))return P}e.find=g;function*x(R,T){for(let P of R)T(P)&&(yield P)}e.filter=x;function*y(R,T){let P=0;for(let z of R)yield T(z,P++)}e.map=y;function*w(R,T){let P=0;for(let z of R)yield*T(z,P++)}e.flatMap=w;function*S(...R){for(let T of R)yield*T}e.concat=S;function k(R,T,P){let z=P;for(let B of R)z=T(z,B);return z}e.reduce=k;function*C(R,T,P=R.length){for(T<0&&(T+=R.length),P<0?P+=R.length:P>R.length&&(P=R.length);T<P;T++)yield R[T]}e.slice=C;function E(R,T=Number.POSITIVE_INFINITY){let P=[];if(T===0)return[P,R];let z=R[Symbol.iterator]();for(let B=0;B<T;B++){let F=z.next();if(F.done)return[P,e.empty()];P.push(F.value)}return[P,{[Symbol.iterator](){return z}}]}e.consume=E;async function N(R){let T=[];for await(let P of R)T.push(P);return Promise.resolve(T)}e.asyncToArray=N})(_M||(_M={}));function al(e){if(_M.is(e)){let t=[];for(let r of e)if(r)try{r.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function yK(...e){return Zt(()=>al(e))}function Zt(e){return{dispose:xK(()=>{e()})}}var xM=class yM{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{al(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?yM.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};xM.DISABLE_DISPOSED_WARNING=!1;var no=xM,ot=class{constructor(){this._store=new no,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};ot.None=Object.freeze({dispose(){}});var yc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},na=typeof window=="object"?window:globalThis,Gx=class Yx{constructor(t){this.element=t,this.next=Yx.Undefined,this.prev=Yx.Undefined}};Gx.Undefined=new Gx(void 0);var er=Gx,G5=class{constructor(){this._first=er.Undefined,this._last=er.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===er.Undefined}clear(){let e=this._first;for(;e!==er.Undefined;){let t=e.next;e.prev=er.Undefined,e.next=er.Undefined,e=t}this._first=er.Undefined,this._last=er.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new er(e);if(this._first===er.Undefined)this._first=r,this._last=r;else if(t){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==er.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==er.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==er.Undefined&&e.next!==er.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===er.Undefined&&e.next===er.Undefined?(this._first=er.Undefined,this._last=er.Undefined):e.next===er.Undefined?(this._last=this._last.prev,this._last.next=er.Undefined):e.prev===er.Undefined&&(this._first=this._first.next,this._first.prev=er.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==er.Undefined;)yield e.element,e=e.next}},bK=globalThis.performance&&typeof globalThis.performance.now=="function",wK=class bM{static create(t){return new bM(t)}constructor(t){this._now=bK&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ls;(e=>{e.None=()=>ot.None;function t($,M){return g($,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function r($){return(M,U=null,W)=>{let A=!1,O;return O=$(L=>{if(!A)return O?O.dispose():A=!0,M.call(U,L)},null,W),A&&O.dispose(),O}}e.once=r;function s($,M,U){return h((W,A=null,O)=>$(L=>W.call(A,M(L)),null,O),U)}e.map=s;function n($,M,U){return h((W,A=null,O)=>$(L=>{M(L),W.call(A,L)},null,O),U)}e.forEach=n;function l($,M,U){return h((W,A=null,O)=>$(L=>M(L)&&W.call(A,L),null,O),U)}e.filter=l;function c($){return $}e.signal=c;function d(...$){return(M,U=null,W)=>{let A=yK(...$.map(O=>O(L=>M.call(U,L))));return v(A,W)}}e.any=d;function m($,M,U,W){let A=U;return s($,O=>(A=M(A,O),A),W)}e.reduce=m;function h($,M){let U,W={onWillAddFirstListener(){U=$(A.fire,A)},onDidRemoveLastListener(){U==null||U.dispose()}},A=new Se(W);return M==null||M.add(A),A.event}function v($,M){return M instanceof Array?M.push($):M&&M.add($),$}function g($,M,U=100,W=!1,A=!1,O,L){let G,H,D,V=0,X,J={leakWarningThreshold:O,onWillAddFirstListener(){G=$(de=>{V++,H=M(H,de),W&&!D&&(se.fire(H),H=void 0),X=()=>{let Z=H;H=void 0,D=void 0,(!W||V>1)&&se.fire(Z),V=0},typeof U=="number"?(clearTimeout(D),D=setTimeout(X,U)):D===void 0&&(D=0,queueMicrotask(X))})},onWillRemoveListener(){A&&V>0&&(X==null||X())},onDidRemoveLastListener(){X=void 0,G.dispose()}},se=new Se(J);return L==null||L.add(se),se.event}e.debounce=g;function x($,M=0,U){return e.debounce($,(W,A)=>W?(W.push(A),W):[A],M,void 0,!0,void 0,U)}e.accumulate=x;function y($,M=(W,A)=>W===A,U){let W=!0,A;return l($,O=>{let L=W||!M(O,A);return W=!1,A=O,L},U)}e.latch=y;function w($,M,U){return[e.filter($,M,U),e.filter($,W=>!M(W),U)]}e.split=w;function S($,M=!1,U=[],W){let A=U.slice(),O=$(H=>{A?A.push(H):G.fire(H)});W&&W.add(O);let L=()=>{A==null||A.forEach(H=>G.fire(H)),A=null},G=new Se({onWillAddFirstListener(){O||(O=$(H=>G.fire(H)),W&&W.add(O))},onDidAddFirstListener(){A&&(M?setTimeout(L):L())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return W&&W.add(G),G.event}e.buffer=S;function k($,M){return(U,W,A)=>{let O=M(new E);return $(function(L){let G=O.evaluate(L);G!==C&&U.call(W,G)},void 0,A)}}e.chain=k;let C=Symbol("HaltChainable");class E{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(U=>(M(U),U)),this}filter(M){return this.steps.push(U=>M(U)?U:C),this}reduce(M,U){let W=U;return this.steps.push(A=>(W=M(W,A),W)),this}latch(M=(U,W)=>U===W){let U=!0,W;return this.steps.push(A=>{let O=U||!M(A,W);return U=!1,W=A,O?A:C}),this}evaluate(M){for(let U of this.steps)if(M=U(M),M===C)break;return M}}function N($,M,U=W=>W){let W=(...G)=>L.fire(U(...G)),A=()=>$.on(M,W),O=()=>$.removeListener(M,W),L=new Se({onWillAddFirstListener:A,onDidRemoveLastListener:O});return L.event}e.fromNodeEventEmitter=N;function R($,M,U=W=>W){let W=(...G)=>L.fire(U(...G)),A=()=>$.addEventListener(M,W),O=()=>$.removeEventListener(M,W),L=new Se({onWillAddFirstListener:A,onDidRemoveLastListener:O});return L.event}e.fromDOMEventEmitter=R;function T($){return new Promise(M=>r($)(M))}e.toPromise=T;function P($){let M=new Se;return $.then(U=>{M.fire(U)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=P;function z($,M){return $(U=>M.fire(U))}e.forward=z;function B($,M,U){return M(U),$(W=>M(W))}e.runAndSubscribe=B;class F{constructor(M,U){this._observable=M,this._counter=0,this._hasChanged=!1;let W={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new Se(W),U&&U.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,U){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y($,M){return new F($,M).emitter.event}e.fromObservable=Y;function q($){return(M,U,W)=>{let A=0,O=!1,L={beginUpdate(){A++},endUpdate(){A--,A===0&&($.reportChanges(),O&&(O=!1,M.call(U)))},handlePossibleChange(){},handleChange(){O=!0}};$.addObserver(L),$.reportChanges();let G={dispose(){$.removeObserver(L)}};return W instanceof no?W.add(G):Array.isArray(W)&&W.push(G),G}}e.fromObservableLight=q})(ls||(ls={}));var Kx=class Xx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Xx._idPool++}`,Xx.all.add(this)}start(t){this._stopWatch=new wK,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Kx.all=new Set,Kx._idPool=0;var SK=Kx,CK=-1,wM=class SM{constructor(t,r,s=(SM._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=r,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,r){let s=this.threshold;if(s<=0||r<s)return;this._stacks||(this._stacks=new Map);let n=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[l,c]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${c}):`;console.warn(d),console.warn(l);let m=new RK(d,l);this._errorHandler(m)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,r=0;for(let[s,n]of this._stacks)(!t||r<n)&&(t=[s,n],r=n);return t}};wM._idPool=1;var kK=wM,EK=class CM{constructor(t){this.value=t}static create(){let t=new Error;return new CM(t.stack??"")}print(){console.warn(this.value.split(`
710
+ `).slice(2).join(`
711
+ `))}},RK=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},NK=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},jK=0,j_=class{constructor(e){this.value=e,this.id=jK++}},AK=2,TK,Se=class{constructor(e){var t,r,s,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new kK((e==null?void 0:e.onListenerError)??zf,((r=this._options)==null?void 0:r.leakWarningThreshold)??CK):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new SK(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,r)=>{var c,d,m,h,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let x=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new NK(`${g}. HINT: Stack shows most frequent listener (${x[1]}-times)`,x[0]);return(((c=this._options)==null?void 0:c.onListenerError)||zf)(y),ot.None}if(this._disposed)return ot.None;t&&(e=e.bind(t));let s=new j_(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=EK.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof j_?(this._deliveryQueue??(this._deliveryQueue=new MK),this._listeners=[this._listeners,s]):this._listeners.push(s):((m=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||m.call(d,this),this._listeners=s,(v=(h=this._options)==null?void 0:h.onDidAddFirstListener)==null||v.call(h,this)),this._size++;let l=Zt(()=>{n==null||n(),this._removeListener(s)});return r instanceof no?r.add(l):Array.isArray(r)&&r.push(l),l}),this._event}_removeListener(e){var n,l,c,d;if((l=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||l.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(c=this._options)==null?void 0:c.onDidRemoveLastListener)==null||d.call(c,this),this._size=0;return}let t=this._listeners,r=t.indexOf(e);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*AK<=t.length){let m=0;for(let h=0;h<t.length;h++)t[h]?t[m++]=t[h]:s&&(this._deliveryQueue.end--,m<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=m}}_deliver(e,t){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||zf;if(!r){e.value(t);return}try{e.value(t)}catch(n){r(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,r,s,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof j_)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},MK=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,r){this.i=0,this.end=r,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Zx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,r){if(this.getZoomLevel(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),t)}setFullscreen(t,r){if(this.isFullscreen(r)===t)return;let s=this.getWindowId(r);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Zx.INSTANCE=new Zx;var Qy=Zx;function DK(e,t,r){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",r)}Qy.INSTANCE.onDidChangeZoomLevel;function LK(e){return Qy.INSTANCE.getZoomFactor(e)}Qy.INSTANCE.onDidChangeFullscreen;var Mc=typeof navigator=="object"?navigator.userAgent:"",Qx=Mc.indexOf("Firefox")>=0,OK=Mc.indexOf("AppleWebKit")>=0,Jy=Mc.indexOf("Chrome")>=0,BK=!Jy&&Mc.indexOf("Safari")>=0;Mc.indexOf("Electron/")>=0;Mc.indexOf("Android")>=0;var A_=!1;if(typeof na.matchMedia=="function"){let e=na.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=na.matchMedia("(display-mode: fullscreen)");A_=e.matches,DK(na,e,({matches:r})=>{A_&&t.matches||(A_=r)})}var cc="en",Jx=!1,e0=!1,$f=!1,kM=!1,_f,Uf=cc,Y5=cc,PK,Fi,el=globalThis,os,Vk;typeof el.vscode<"u"&&typeof el.vscode.process<"u"?os=el.vscode.process:typeof process<"u"&&typeof((Vk=process==null?void 0:process.versions)==null?void 0:Vk.node)=="string"&&(os=process);var Gk,IK=typeof((Gk=os==null?void 0:os.versions)==null?void 0:Gk.electron)=="string",zK=IK&&(os==null?void 0:os.type)==="renderer",Yk;if(typeof os=="object"){Jx=os.platform==="win32",e0=os.platform==="darwin",$f=os.platform==="linux",$f&&os.env.SNAP&&os.env.SNAP_REVISION,os.env.CI||os.env.BUILD_ARTIFACTSTAGINGDIRECTORY,_f=cc,Uf=cc;let e=os.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);_f=t.userLocale,Y5=t.osLocale,Uf=t.resolvedLanguage||cc,PK=(Yk=t.languagePack)==null?void 0:Yk.translationsConfigFile}catch{}kM=!0}else typeof navigator=="object"&&!zK?(Fi=navigator.userAgent,Jx=Fi.indexOf("Windows")>=0,e0=Fi.indexOf("Macintosh")>=0,(Fi.indexOf("Macintosh")>=0||Fi.indexOf("iPad")>=0||Fi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,$f=Fi.indexOf("Linux")>=0,(Fi==null?void 0:Fi.indexOf("Mobi"))>=0,Uf=globalThis._VSCODE_NLS_LANGUAGE||cc,_f=navigator.language.toLowerCase(),Y5=_f):console.error("Unable to resolve platform.");var EM=Jx,kn=e0,$K=$f,K5=kM,Nn=Fi,Wa=Uf,UK;(e=>{function t(){return Wa}e.value=t;function r(){return Wa.length===2?Wa==="en":Wa.length>=3?Wa[0]==="e"&&Wa[1]==="n"&&Wa[2]==="-":!1}e.isDefaultVariant=r;function s(){return Wa==="en"}e.isDefault=s})(UK||(UK={}));var HK=typeof el.postMessage=="function"&&!el.importScripts;(()=>{if(HK){let e=[];el.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let s=0,n=e.length;s<n;s++){let l=e[s];if(l.id===r.data.vscodeScheduleAsyncWork){e.splice(s,1),l.callback();return}}});let t=0;return r=>{let s=++t;e.push({id:s,callback:r}),el.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var FK=!!(Nn&&Nn.indexOf("Chrome")>=0);Nn&&Nn.indexOf("Firefox")>=0;!FK&&Nn&&Nn.indexOf("Safari")>=0;Nn&&Nn.indexOf("Edg/")>=0;Nn&&Nn.indexOf("Android")>=0;var rc=typeof navigator=="object"?navigator:{};K5||document.queryCommandSupported&&document.queryCommandSupported("copy")||rc&&rc.clipboard&&rc.clipboard.writeText,K5||rc&&rc.clipboard&&rc.clipboard.readText;var eb=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},T_=new eb,X5=new eb,Z5=new eb,qK=new Array(230),RM;(e=>{function t(d){return T_.keyCodeToStr(d)}e.toString=t;function r(d){return T_.strToKeyCode(d)}e.fromString=r;function s(d){return X5.keyCodeToStr(d)}e.toUserSettingsUS=s;function n(d){return Z5.keyCodeToStr(d)}e.toUserSettingsGeneral=n;function l(d){return X5.strToKeyCode(d)||Z5.strToKeyCode(d)}e.fromUserSettings=l;function c(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return T_.keyCodeToStr(d)}e.toElectronAccelerator=c})(RM||(RM={}));var WK=class NM{constructor(t,r,s,n,l){this.ctrlKey=t,this.shiftKey=r,this.altKey=s,this.metaKey=n,this.keyCode=l}equals(t){return t instanceof NM&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",s=this.altKey?"1":"0",n=this.metaKey?"1":"0";return`K${t}${r}${s}${n}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new VK([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},VK=class{constructor(e){if(e.length===0)throw vK("chords");this.chords=e}getHashCode(){let e="";for(let t=0,r=this.chords.length;t<r;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function GK(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return RM.fromString(r)}let t=e.keyCode;if(t===3)return 7;if(Qx)switch(t){case 59:return 85;case 60:if($K)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(kn)return 57;break}else if(OK&&(kn&&t===93||!kn&&t===92))return 57;return qK[t]||0}var YK=kn?256:2048,KK=512,XK=1024,ZK=kn?2048:256,Q5=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(r=t.getModifierState)==null?void 0:r.call(t,"AltGraph"),this.keyCode=GK(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=YK),this.altKey&&(t|=KK),this.shiftKey&&(t|=XK),this.metaKey&&(t|=ZK),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new WK(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},J5=new WeakMap;function QK(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,r=e.parent.location;if(t.origin!=="null"&&r.origin!=="null"&&t.origin!==r.origin)return null}catch{return null}return e.parent}var JK=class{static getSameOriginWindowChain(e){let t=J5.get(e);if(!t){t=[],J5.set(e,t);let r=e,s;do s=QK(r),s?t.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):t.push({window:new WeakRef(r),iframeElement:null}),r=s;while(r)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let r=0,s=0,n=this.getSameOriginWindowChain(e);for(let l of n){let c=l.window.deref();if(r+=(c==null?void 0:c.scrollY)??0,s+=(c==null?void 0:c.scrollX)??0,c===t||!l.iframeElement)break;let d=l.iframeElement.getBoundingClientRect();r+=d.top,s+=d.left}return{top:r,left:s}}},xf=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=JK.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},ek=class{constructor(e,t=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=t;let s=!1;if(Jy){let l=navigator.userAgent.match(/Chrome\/(\d+)/);s=(l?parseInt(l[1]):123)<=122}if(e){let l=e,c=e,d=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")s?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Qx&&!kn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")BK&&EM?this.deltaX=-(l.wheelDeltaX/120):s?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let m=e;m.deltaMode===m.DOM_DELTA_LINE?Qx&&!kn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},jM=Object.freeze(function(e,t){let r=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(r)}}}),eX;(e=>{function t(r){return r===e.None||r===e.Cancelled||r instanceof tX?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ls.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:jM})})(eX||(eX={}));var tX=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?jM:(this._emitter||(this._emitter=new Se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},tb=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Vx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Vx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},rX=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,r=globalThis){if(this.isDisposed)throw new Vx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},t);this.disposable=Zt(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},sX;(e=>{async function t(s){let n,l=await Promise.all(s.map(c=>c.then(d=>d,d=>{n||(n=d)})));if(typeof n<"u")throw n;return l}e.settled=t;function r(s){return new Promise(async(n,l)=>{try{await s(n,l)}catch(c){l(c)}})}e.withAsyncBody=r})(sX||(sX={}));var tk=class yi{static fromArray(t){return new yi(r=>{r.emitMany(t)})}static fromPromise(t){return new yi(async r=>{r.emitMany(await t)})}static fromPromises(t){return new yi(async r=>{await Promise.all(t.map(async s=>r.emitOne(await s)))})}static merge(t){return new yi(async r=>{await Promise.all(t.map(async s=>{for await(let n of s)r.emitOne(n)}))})}constructor(t,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new Se,queueMicrotask(async()=>{let s={emitOne:n=>this.emitOne(n),emitMany:n=>this.emitMany(n),reject:n=>this.reject(n)};try{await Promise.resolve(t(s)),this.resolve()}catch(n){this.reject(n)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ls.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(t,r){return new yi(async s=>{for await(let n of t)s.emitOne(r(n))})}map(t){return yi.map(this,t)}static filter(t,r){return new yi(async s=>{for await(let n of t)r(n)&&s.emitOne(n)})}filter(t){return yi.filter(this,t)}static coalesce(t){return yi.filter(t,r=>!!r)}coalesce(){return yi.coalesce(this)}static async toPromise(t){let r=[];for await(let s of t)r.push(s);return r}toPromise(){return yi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};tk.EMPTY=tk.fromArray([]);var{getWindow:wn,getWindowId:iX,onDidRegisterWindow:nX}=(function(){let e=new Map,t={window:na,disposables:new no};e.set(na.vscodeWindowId,t);let r=new Se,s=new Se,n=new Se;function l(c,d){return(typeof c=="number"?e.get(c):void 0)??(d?t:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:s.event,registerWindow(c){if(e.has(c.vscodeWindowId))return ot.None;let d=new no,m={window:c,disposables:d.add(new no)};return e.set(c.vscodeWindowId,m),d.add(Zt(()=>{e.delete(c.vscodeWindowId),s.fire(c)})),d.add(Ge(c,Fr.BEFORE_UNLOAD,()=>{n.fire(c)})),r.fire(m),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:l,getWindow(c){var h;let d=c;if((h=d==null?void 0:d.ownerDocument)!=null&&h.defaultView)return d.ownerDocument.defaultView.window;let m=c;return m!=null&&m.view?m.view.window:na},getDocument(c){return wn(c).document}}})(),aX=class{constructor(e,t,r,s){this._node=e,this._type=t,this._handler=r,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ge(e,t,r,s){return new aX(e,t,r,s)}var rk=function(e,t,r,s){return Ge(e,t,r,s)},rb,oX=class extends rX{constructor(e){super(),this.defaultTarget=e&&wn(e)}cancelAndSet(e,t,r){return super.cancelAndSet(e,t,r??this.defaultTarget)}},sk=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){zf(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,r=new Map,s=new Map,n=l=>{r.set(l,!1);let c=e.get(l)??[];for(t.set(l,c),e.set(l,[]),s.set(l,!0);c.length>0;)c.sort(sk.sort),c.shift().execute();s.set(l,!1)};rb=(l,c,d=0)=>{let m=iX(l),h=new sk(c,d),v=e.get(m);return v||(v=[],e.set(m,v)),v.push(h),r.get(m)||(r.set(m,!0),l.requestAnimationFrame(()=>n(m))),h}})();function lX(e){let t=e.getBoundingClientRect(),r=wn(e);return{left:t.left+r.scrollX,top:t.top+r.scrollY,width:t.width,height:t.height}}var Fr={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},cX=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ls(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ls(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ls(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ls(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ls(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ls(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ls(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ls(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ls(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ls(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ls(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ls(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ls(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ls(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ls(e){return typeof e=="number"?`${e}px`:e}function Ju(e){return new cX(e)}var AM=class{constructor(){this._hooks=new no,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let l=e;try{e.setPointerCapture(t),this._hooks.add(Zt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=wn(e)}this._hooks.add(Ge(l,Fr.POINTER_MOVE,c=>{if(c.buttons!==r){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Ge(l,Fr.POINTER_UP,c=>this.stopMonitoring(!0)))}};function uX(e,t,r){let s=null,n=null;if(typeof r.value=="function"?(s="value",n=r.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(s="get",n=r.get),!n)throw new Error("not supported");let l=`$memoize$${t}`;r[s]=function(...c){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,c)}),this[l]}}var _n;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(_n||(_n={}));var Wu=class hs extends ot{constructor(){super(),this.dispatched=!1,this.targets=new G5,this.ignoreTargets=new G5,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ls.runAndSubscribe(nX,({window:t,disposables:r})=>{r.add(Ge(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),r.add(Ge(t.document,"touchend",s=>this.onTouchEnd(t,s))),r.add(Ge(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:na,disposables:this._store}))}static addTarget(t){if(!hs.isTouchDevice())return ot.None;hs.INSTANCE||(hs.INSTANCE=new hs);let r=hs.INSTANCE.targets.push(t);return Zt(r)}static ignoreTarget(t){if(!hs.isTouchDevice())return ot.None;hs.INSTANCE||(hs.INSTANCE=new hs);let r=hs.INSTANCE.ignoreTargets.push(t);return Zt(r)}static isTouchDevice(){return"ontouchstart"in na||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,n=t.targetTouches.length;s<n;s++){let l=t.targetTouches.item(s);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:r,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[r],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let c=this.newGestureEvent(_n.Start,l.target);c.pageX=l.pageX,c.pageY=l.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,r){let s=Date.now(),n=Object.keys(this.activeTouches).length;for(let l=0,c=r.changedTouches.length;l<c;l++){let d=r.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let m=this.activeTouches[d.identifier],h=Date.now()-m.initialTimeStamp;if(h<hs.HOLD_DELAY&&Math.abs(m.initialPageX-Gs(m.rollingPageX))<30&&Math.abs(m.initialPageY-Gs(m.rollingPageY))<30){let v=this.newGestureEvent(_n.Tap,m.initialTarget);v.pageX=Gs(m.rollingPageX),v.pageY=Gs(m.rollingPageY),this.dispatchEvent(v)}else if(h>=hs.HOLD_DELAY&&Math.abs(m.initialPageX-Gs(m.rollingPageX))<30&&Math.abs(m.initialPageY-Gs(m.rollingPageY))<30){let v=this.newGestureEvent(_n.Contextmenu,m.initialTarget);v.pageX=Gs(m.rollingPageX),v.pageY=Gs(m.rollingPageY),this.dispatchEvent(v)}else if(n===1){let v=Gs(m.rollingPageX),g=Gs(m.rollingPageY),x=Gs(m.rollingTimestamps)-m.rollingTimestamps[0],y=v-m.rollingPageX[0],w=g-m.rollingPageY[0],S=[...this.targets].filter(k=>m.initialTarget instanceof Node&&k.contains(m.initialTarget));this.inertia(t,S,s,Math.abs(y)/x,y>0?1:-1,v,Math.abs(w)/x,w>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(_n.End,m.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,r){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=r,s.tapCount=0,s}dispatchEvent(t){if(t.type===_n.Tap){let r=new Date().getTime(),s=0;r-this._lastSetTapCountTime>hs.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=r,t.tapCount=s}else(t.type===_n.Change||t.type===_n.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let r=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let n=0,l=t.initialTarget;for(;l&&l!==s;)n++,l=l.parentElement;r.push([n,s])}r.sort((s,n)=>s[0]-n[0]);for(let[s,n]of r)n.dispatchEvent(t),this.dispatched=!0}}inertia(t,r,s,n,l,c,d,m,h){this.handle=rb(t,()=>{let v=Date.now(),g=v-s,x=0,y=0,w=!0;n+=hs.SCROLL_FRICTION*g,d+=hs.SCROLL_FRICTION*g,n>0&&(w=!1,x=l*n*g),d>0&&(w=!1,y=m*d*g);let S=this.newGestureEvent(_n.Change);S.translationX=x,S.translationY=y,r.forEach(k=>k.dispatchEvent(S)),w||this.inertia(t,r,v,n,l,c+x,d,m,h+y)})}onTouchMove(t){let r=Date.now();for(let s=0,n=t.changedTouches.length;s<n;s++){let l=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],d=this.newGestureEvent(_n.Change,c.initialTarget);d.translationX=l.pageX-Gs(c.rollingPageX),d.translationY=l.pageY-Gs(c.rollingPageY),d.pageX=l.pageX,d.pageY=l.pageY,this.dispatchEvent(d),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(l.pageX),c.rollingPageY.push(l.pageY),c.rollingTimestamps.push(r)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Wu.SCROLL_FRICTION=-.005,Wu.HOLD_DELAY=700,Wu.CLEAR_TAP_COUNT_TIME=400,pr([uX],Wu,"isTouchDevice",1);var dX=Wu,sb=class extends ot{onclick(e,t){this._register(Ge(e,Fr.CLICK,r=>t(new xf(wn(e),r))))}onmousedown(e,t){this._register(Ge(e,Fr.MOUSE_DOWN,r=>t(new xf(wn(e),r))))}onmouseover(e,t){this._register(Ge(e,Fr.MOUSE_OVER,r=>t(new xf(wn(e),r))))}onmouseleave(e,t){this._register(Ge(e,Fr.MOUSE_LEAVE,r=>t(new xf(wn(e),r))))}onkeydown(e,t){this._register(Ge(e,Fr.KEY_DOWN,r=>t(new Q5(r))))}onkeyup(e,t){this._register(Ge(e,Fr.KEY_UP,r=>t(new Q5(r))))}oninput(e,t){this._register(Ge(e,Fr.INPUT,t))}onblur(e,t){this._register(Ge(e,Fr.BLUR,t))}onfocus(e,t){this._register(Ge(e,Fr.FOCUS,t))}onchange(e,t){this._register(Ge(e,Fr.CHANGE,t))}ignoreGesture(e){return dX.ignoreTarget(e)}},ik=11,hX=class extends sb{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=ik+"px",this.domNode.style.height=ik+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new AM),this._register(rk(this.bgDomNode,Fr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(rk(this.domNode,Fr.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new oX),this._pointerdownScheduleRepeatTimer=this._register(new tb)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,wn(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},fX=class t0{constructor(t,r,s,n,l,c,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,s=s|0,n=n|0,l=l|0,c=c|0,d=d|0),this.rawScrollLeft=n,this.rawScrollTop=d,r<0&&(r=0),n+r>s&&(n=s-r),n<0&&(n=0),l<0&&(l=0),d+l>c&&(d=c-l),d<0&&(d=0),this.width=r,this.scrollWidth=s,this.scrollLeft=n,this.height=l,this.scrollHeight=c,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,r){return new t0(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new t0(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,r){let s=this.width!==t.width,n=this.scrollWidth!==t.scrollWidth,l=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:r,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:n,scrollLeftChanged:l,heightChanged:c,scrollHeightChanged:d,scrollTopChanged:m}}},mX=class extends ot{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new fX(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var s;let r=this._state.withScrollDimensions(e,t);this._setState(r,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let s;t?s=new ak(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=ak.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,t)))}},nk=class{constructor(e,t,r){this.scrollLeft=e,this.scrollTop=t,this.isDone=r}};function M_(e,t){let r=t-e;return function(s){return e+r*vX(s)}}function pX(e,t,r){return function(s){return s<r?e(s/r):t((s-r)/(1-r))}}var ak=class r0{constructor(t,r,s,n){this.from=t,this.to=r,this.duration=n,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,r,s){if(Math.abs(t-r)>2.5*s){let n,l;return t<r?(n=t+.75*s,l=r-.75*s):(n=t-.75*s,l=r+.75*s),pX(M_(t,n),M_(l,r),.33)}return M_(t,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let r=(t-this.startTime)/this.duration;if(r<1){let s=this.scrollLeft(r),n=this.scrollTop(r);return new nk(s,n,!1)}return new nk(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,r,s){return r0.start(t,r,s)}static start(t,r,s){s=s+10;let n=Date.now()-10;return new r0(t,r,n,s)}};function gX(e){return Math.pow(e,3)}function vX(e){return 1-gX(1-e)}var _X=class extends ot{constructor(e,t,r){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new tb)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},xX=140,TM=class extends sb{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new _X(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new AM),this._shouldRender=!0,this.domNode=Ju(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ge(this.domNode.domNode,Fr.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new hX(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,r,s){this.slider=Ju(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof r=="number"&&this.slider.setWidth(r),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ge(this.slider.domNode,Fr.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,r=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,r=e.offsetY;else{let n=lX(this.domNode.domNode);t=e.pageX-n.left,r=e.pageY-n.top}let s=this._pointerDownRelativePosition(t,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let l=this._sliderOrthogonalPointerPosition(n),c=Math.abs(l-r);if(EM&&c>xX){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let d=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(d))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},MM=class s0{constructor(t,r,s,n,l,c){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=n,this._scrollSize=l,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new s0(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let r=Math.round(t);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(t){let r=Math.round(t);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let r=Math.round(t);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,r,s,n,l){let c=Math.max(0,s-t),d=Math.max(0,c-2*r),m=n>0&&n>s;if(!m)return{computedAvailableSize:Math.round(c),computedIsNeeded:m,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*d/n))),v=(d-h)/(n-s),g=l*v;return{computedAvailableSize:Math.round(c),computedIsNeeded:m,computedSliderSize:Math.round(h),computedSliderRatio:v,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=s0._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let r=t-this._arrowSize,s=this._scrollPosition;return r<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+t;return Math.round(r/this._computedSliderRatio)}},yX=class extends TM{constructor(e,t,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new MM(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,n.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},bX=class extends TM{constructor(e,t,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:r,scrollbarState:new MM(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,n.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},wX=500,ok=50,SX=class{constructor(e,t,r){this.timestamp=e,this.deltaX=t,this.deltaY=r,this.score=0}},i0=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,r=0,s=1,n=this._rear;do{let l=n===this._front?t:Math.pow(2,-s);if(t-=l,r+=this._memory[n].score*l,n===this._front)break;n=(this._capacity+n-1)%this._capacity,s++}while(!0);return r<=.5}acceptStandardWheelEvent(t){if(Jy){let r=wn(t.browserEvent),s=LK(r);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,r,s){let n=null,l=new SX(t,r,s);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(n=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,n)}_computeScore(t,r){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),r){let n=Math.abs(t.deltaX),l=Math.abs(t.deltaY),c=Math.abs(r.deltaX),d=Math.abs(r.deltaY),m=Math.max(Math.min(n,c),1),h=Math.max(Math.min(l,d),1),v=Math.max(n,c),g=Math.max(l,d);v%m===0&&g%h===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};i0.INSTANCE=new i0;var CX=i0,kX=class extends sb{constructor(e,t,r){super(),this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Se),this.onWillScroll=this._onWillScroll.event,this._options=RX(t),this._scrollable=r,this._register(this._scrollable.onScroll(n=>{this._onWillScroll.fire(n),this._onDidScroll(n),this._onScroll.fire(n)}));let s={onMouseWheel:n=>this._onMouseWheel(n),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new bX(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new yX(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ju(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ju(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ju(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,n=>this._onMouseOver(n)),this.onmouseleave(this._listenOnDomNode,n=>this._onMouseLeave(n)),this._hideTimeout=this._register(new tb),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=al(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,kn&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new ek(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=al(this._mouseWheelToDispose),e)){let t=r=>{this._onMouseWheel(new ek(r))};this._mouseWheelToDispose.push(Ge(this._listenOnDomNode,Fr.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var n;if((n=e.browserEvent)!=null&&n.defaultPrevented)return;let t=CX.INSTANCE;t.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+l===0?c=l=0:Math.abs(l)>=Math.abs(c)?c=0:l=0),this._options.flipAxes&&([l,c]=[c,l]);let d=!kn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let m=this._scrollable.getFutureScrollPosition(),h={};if(l){let v=ok*l,g=m.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(h,g)}if(c){let v=ok*c,g=m.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(h,g)}h=this._scrollable.validateScrollPosition(h),(m.scrollLeft!==h.scrollLeft||m.scrollTop!==h.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),r=!0)}let s=r;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,r=e.scrollLeft>0,s=r?" left":"",n=t?" top":"",l=r||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${n}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${n}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),wX)}},EX=class extends kX{constructor(e,t,r){super(e,t,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function RX(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,kn&&(t.className+=" mac"),t}var n0=class extends ot{constructor(e,t,r,s,n,l,c,d){super(),this._bufferService=r,this._optionsService=c,this._renderService=d,this._onRequestScrollLines=this._register(new Se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new mX({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>rb(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new EX(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ls.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Zt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Zt(()=>this._styleElement.remove())),this._register(ls.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
712
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(h=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=t-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};n0=pr([Ne(2,ws),Ne(3,va),Ne(4,hM),Ne(5,Tc),Ne(6,Ss),Ne(7,_a)],n0);var a0=class extends ot{constructor(e,t,r,s,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=r,this._decorationService=s,this._renderService=n,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(l=>this._removeDecoration(l))),this._register(Zt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){if(!t)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};a0=pr([Ne(1,ws),Ne(2,va),Ne(3,Td),Ne(4,_a)],a0);var NX=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},mn={full:0,left:0,center:0,right:0},Va={full:0,left:0,center:0,right:0},Lu={full:0,left:0,center:0,right:0},gm=class extends ot{constructor(e,t,r,s,n,l,c,d){var h;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=l,this._themeService=c,this._coreBrowserService=d,this._colorZoneStore=new NX,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(),(h=this._viewportElement.parentElement)==null||h.insertBefore(this._canvas,this._viewportElement),this._register(Zt(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let m=this._canvas.getContext("2d");if(m)this._ctx=m;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Va.full=this._canvas.width,Va.left=e,Va.center=t,Va.right=e,this._refreshDrawHeightConstants(),Lu.full=1,Lu.left=1,Lu.center=1+Va.left,Lu.right=1+Va.left+Va.center}_refreshDrawHeightConstants(){mn.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);mn.left=t,mn.center=t,mn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*mn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*mn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*mn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*mn.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Lu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-mn[e.position||"full"]/2),Va[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+mn[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};gm=pr([Ne(2,ws),Ne(3,Td),Ne(4,_a),Ne(5,Ss),Ne(6,Tc),Ne(7,va)],gm);var ve;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
713
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ve||(ve={}));var Hf;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Hf||(Hf={}));var DM;(e=>e.ST=`${ve.ESC}\\`)(DM||(DM={}));var o0=class{constructor(e,t,r,s,n,l){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=l,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;t.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(t.start,this._compositionPosition.start):r=this._textarea.value.substring(t.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ve.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let l=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};o0=pr([Ne(2,ws),Ne(3,Ss),Ne(4,ml),Ne(5,_a)],o0);var Gr=0,Yr=0,Kr=0,hr=0,lk={css:"#00000000",rgba:0},Nr;(e=>{function t(n,l,c,d){return d!==void 0?`#${qo(n)}${qo(l)}${qo(c)}${qo(d)}`:`#${qo(n)}${qo(l)}${qo(c)}`}e.toCss=t;function r(n,l,c,d=255){return(n<<24|l<<16|c<<8|d)>>>0}e.toRgba=r;function s(n,l,c,d){return{css:e.toCss(n,l,c,d),rgba:e.toRgba(n,l,c,d)}}e.toColor=s})(Nr||(Nr={}));var Gt;(e=>{function t(m,h){if(hr=(h.rgba&255)/255,hr===1)return{css:h.css,rgba:h.rgba};let v=h.rgba>>24&255,g=h.rgba>>16&255,x=h.rgba>>8&255,y=m.rgba>>24&255,w=m.rgba>>16&255,S=m.rgba>>8&255;Gr=y+Math.round((v-y)*hr),Yr=w+Math.round((g-w)*hr),Kr=S+Math.round((x-S)*hr);let k=Nr.toCss(Gr,Yr,Kr),C=Nr.toRgba(Gr,Yr,Kr);return{css:k,rgba:C}}e.blend=t;function r(m){return(m.rgba&255)===255}e.isOpaque=r;function s(m,h,v){let g=Ff.ensureContrastRatio(m.rgba,h.rgba,v);if(g)return Nr.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=s;function n(m){let h=(m.rgba|255)>>>0;return[Gr,Yr,Kr]=Ff.toChannels(h),{css:Nr.toCss(Gr,Yr,Kr),rgba:h}}e.opaque=n;function l(m,h){return hr=Math.round(h*255),[Gr,Yr,Kr]=Ff.toChannels(m.rgba),{css:Nr.toCss(Gr,Yr,Kr,hr),rgba:Nr.toRgba(Gr,Yr,Kr,hr)}}e.opacity=l;function c(m,h){return hr=m.rgba&255,l(m,hr*h/255)}e.multiplyOpacity=c;function d(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=d})(Gt||(Gt={}));var tr;(e=>{let t,r;try{let n=document.createElement("canvas");n.width=1,n.height=1;let l=n.getContext("2d",{willReadFrequently:!0});l&&(t=l,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}catch{}function s(n){if(n.match(/#[\da-f]{3,8}/i))switch(n.length){case 4:return Gr=parseInt(n.slice(1,2).repeat(2),16),Yr=parseInt(n.slice(2,3).repeat(2),16),Kr=parseInt(n.slice(3,4).repeat(2),16),Nr.toColor(Gr,Yr,Kr);case 5:return Gr=parseInt(n.slice(1,2).repeat(2),16),Yr=parseInt(n.slice(2,3).repeat(2),16),Kr=parseInt(n.slice(3,4).repeat(2),16),hr=parseInt(n.slice(4,5).repeat(2),16),Nr.toColor(Gr,Yr,Kr,hr);case 7:return{css:n,rgba:(parseInt(n.slice(1),16)<<8|255)>>>0};case 9:return{css:n,rgba:parseInt(n.slice(1),16)>>>0}}let l=n.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Gr=parseInt(l[1]),Yr=parseInt(l[2]),Kr=parseInt(l[3]),hr=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),Nr.toColor(Gr,Yr,Kr,hr);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=n,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Gr,Yr,Kr,hr]=t.getImageData(0,0,1,1).data,hr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Nr.toRgba(Gr,Yr,Kr,hr),css:n}}e.toColor=s})(tr||(tr={}));var ys;(e=>{function t(s){return r(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function r(s,n,l){let c=s/255,d=n/255,m=l/255,h=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return h*.2126+v*.7152+g*.0722}e.relativeLuminance2=r})(ys||(ys={}));var Ff;(e=>{function t(c,d){if(hr=(d&255)/255,hr===1)return d;let m=d>>24&255,h=d>>16&255,v=d>>8&255,g=c>>24&255,x=c>>16&255,y=c>>8&255;return Gr=g+Math.round((m-g)*hr),Yr=x+Math.round((h-x)*hr),Kr=y+Math.round((v-y)*hr),Nr.toRgba(Gr,Yr,Kr)}e.blend=t;function r(c,d,m){let h=ys.relativeLuminance(c>>8),v=ys.relativeLuminance(d>>8);if(ra(h,v)<m){if(v<h){let y=s(c,d,m),w=ra(h,ys.relativeLuminance(y>>8));if(w<m){let S=n(c,d,m),k=ra(h,ys.relativeLuminance(S>>8));return w>k?y:S}return y}let g=n(c,d,m),x=ra(h,ys.relativeLuminance(g>>8));if(x<m){let y=s(c,d,m),w=ra(h,ys.relativeLuminance(y>>8));return x>w?g:y}return g}}e.ensureContrastRatio=r;function s(c,d,m){let h=c>>24&255,v=c>>16&255,g=c>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,S=ra(ys.relativeLuminance2(x,y,w),ys.relativeLuminance2(h,v,g));for(;S<m&&(x>0||y>0||w>0);)x-=Math.max(0,Math.ceil(x*.1)),y-=Math.max(0,Math.ceil(y*.1)),w-=Math.max(0,Math.ceil(w*.1)),S=ra(ys.relativeLuminance2(x,y,w),ys.relativeLuminance2(h,v,g));return(x<<24|y<<16|w<<8|255)>>>0}e.reduceLuminance=s;function n(c,d,m){let h=c>>24&255,v=c>>16&255,g=c>>8&255,x=d>>24&255,y=d>>16&255,w=d>>8&255,S=ra(ys.relativeLuminance2(x,y,w),ys.relativeLuminance2(h,v,g));for(;S<m&&(x<255||y<255||w<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=ra(ys.relativeLuminance2(x,y,w),ys.relativeLuminance2(h,v,g));return(x<<24|y<<16|w<<8|255)>>>0}e.increaseLuminance=n;function l(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=l})(Ff||(Ff={}));function qo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ra(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var jX=class extends Ad{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},vm=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ei}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let r=[],s=t.translateToString(!0),n=0,l=0,c=0,d=t.getFg(0),m=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==m){if(h-n>1){let v=this._getJoinedRanges(s,c,l,t,n);for(let g=0;g<v.length;g++)r.push(v[g])}n=h,c=l,d=this._workCell.fg,m=this._workCell.bg}l+=this._workCell.getChars().length||so.length}if(this._bufferService.cols-n>1){let h=this._getJoinedRanges(s,c,l,t,n);for(let v=0;v<h.length;v++)r.push(h[v])}return r}_getJoinedRanges(e,t,r,s,n){let l=e.substring(t,r),c=[];try{c=this._characterJoiners[0].handler(l)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let m=this._characterJoiners[d].handler(l);for(let h=0;h<m.length;h++)vm._mergeRanges(c,m[h])}catch(m){console.error(m)}return this._stringRangesToCellRanges(c,s,n),c}_stringRangesToCellRanges(e,t,r){let s=0,n=!1,l=0,c=e[s];if(c){for(let d=r;d<this._bufferService.cols;d++){let m=t.getWidth(d),h=t.getString(d).length||so.length;if(m!==0){if(!n&&c[0]<=l&&(c[0]=d,n=!0),c[1]<=l){if(c[1]=d,c=e[++s],!c)break;c[0]<=l?(c[0]=d,n=!0):n=!1}l+=h}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let s=0;s<e.length;s++){let n=e[s];if(r){if(t[1]<=n[0])return e[s-1][1]=t[1],e;if(t[1]<=n[1])return e[s-1][1]=Math.max(t[1],n[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=n[0])return e.splice(s,0,t),e;if(t[1]<=n[1])return n[0]=Math.min(t[0],n[0]),e;t[0]<n[1]&&(n[0]=Math.min(t[0],n[0]),r=!0);continue}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};vm=pr([Ne(0,ws)],vm);function AX(e){return 57508<=e&&e<=57558}function TX(e){return 9472<=e&&e<=9631}function MX(e){return AX(e)||TX(e)}function DX(){return{css:{canvas:yf(),cell:yf()},device:{canvas:yf(),cell:yf(),char:{width:0,height:0,left:0,top:0}}}}function yf(){return{width:0,height:0}}var l0=class{constructor(e,t,r,s,n,l,c){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=l,this._themeService=c,this._workCell=new Ei,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,s,n,l,c,d,m,h,v){let g=[],x=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,w=e.getNoBgTrimmedLength();r&&w<l+1&&(w=l+1);let S,k=0,C="",E=0,N=0,R=0,T=0,P=!1,z=0,B=!1,F=0,Y=0,q=[],$=h!==-1&&v!==-1;for(let M=0;M<w;M++){e.loadCell(M,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let W=!1,A=M>=Y,O=M,L=this._workCell;if(x.length>0&&M===x[0][0]&&A){let te=x.shift(),ie=this._isCellInSelection(te[0],t);for(E=te[0]+1;E<te[1];E++)A&&(A=ie===this._isCellInSelection(E,t));A&&(A=!r||l<te[0]||l>=te[1]),A?(W=!0,L=new jX(this._workCell,e.translateToString(!0,te[0],te[1]),te[1]-te[0]),O=te[1]-1,U=L.getWidth()):Y=te[1]}let G=this._isCellInSelection(M,t),H=r&&M===l,D=$&&M>=h&&M<=v,V=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,te=>{V=!0});let X=L.getChars()||so;if(X===" "&&(L.isUnderline()||L.isOverline())&&(X=" "),F=U*d-m.get(X,L.isBold(),L.isItalic()),!S)S=this._document.createElement("span");else if(k&&(G&&B||!G&&!B&&L.bg===N)&&(G&&B&&y.selectionForeground||L.fg===R)&&L.extended.ext===T&&D===P&&F===z&&!H&&!W&&!V&&A){L.isInvisible()?C+=so:C+=X,k++;continue}else k&&(S.textContent=C),S=this._document.createElement("span"),k=0,C="";if(N=L.bg,R=L.fg,T=L.extended.ext,P=D,z=F,B=G,W&&l>=M&&l<=O&&(l=M),!this._coreService.isCursorHidden&&H&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&q.push("xterm-cursor-blink"),q.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(L.isBold()&&q.push("xterm-bold"),L.isItalic()&&q.push("xterm-italic"),L.isDim()&&q.push("xterm-dim"),L.isInvisible()?C=so:C=L.getChars()||so,L.isUnderline()&&(q.push(`xterm-underline-${L.extended.underlineStyle}`),C===" "&&(C=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${Ad.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let te=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&te<8&&(te+=8),S.style.textDecorationColor=y.ansi[te].css}L.isOverline()&&(q.push("xterm-overline"),C===" "&&(C=" ")),L.isStrikethrough()&&q.push("xterm-strikethrough"),D&&(S.style.textDecoration="underline");let J=L.getFgColor(),se=L.getFgColorMode(),de=L.getBgColor(),Z=L.getBgColorMode(),ce=!!L.isInverse();if(ce){let te=J;J=de,de=te;let ie=se;se=Z,Z=ie}let le,we,Ee=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,te=>{te.options.layer!=="top"&&Ee||(te.backgroundColorRGB&&(Z=50331648,de=te.backgroundColorRGB.rgba>>8&16777215,le=te.backgroundColorRGB),te.foregroundColorRGB&&(se=50331648,J=te.foregroundColorRGB.rgba>>8&16777215,we=te.foregroundColorRGB),Ee=te.options.layer==="top")}),!Ee&&G&&(le=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,de=le.rgba>>8&16777215,Z=50331648,Ee=!0,y.selectionForeground&&(se=50331648,J=y.selectionForeground.rgba>>8&16777215,we=y.selectionForeground)),Ee&&q.push("xterm-decoration-top");let Re;switch(Z){case 16777216:case 33554432:Re=y.ansi[de],q.push(`xterm-bg-${de}`);break;case 50331648:Re=Nr.toColor(de>>16,de>>8&255,de&255),this._addStyle(S,`background-color:#${ck((de>>>0).toString(16),"0",6)}`);break;case 0:default:ce?(Re=y.foreground,q.push("xterm-bg-257")):Re=y.background}switch(le||L.isDim()&&(le=Gt.multiplyOpacity(Re,.5)),se){case 16777216:case 33554432:L.isBold()&&J<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(J+=8),this._applyMinimumContrast(S,Re,y.ansi[J],L,le,void 0)||q.push(`xterm-fg-${J}`);break;case 50331648:let te=Nr.toColor(J>>16&255,J>>8&255,J&255);this._applyMinimumContrast(S,Re,te,L,le,we)||this._addStyle(S,`color:#${ck(J.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(S,Re,y.foreground,L,le,we)||ce&&q.push("xterm-fg-257")}q.length&&(S.className=q.join(" "),q.length=0),!H&&!W&&!V&&A?k++:S.textContent=C,F!==this.defaultSpacing&&(S.style.letterSpacing=`${F}px`),g.push(S),M=O}return S&&k&&(S.textContent=C),g}_applyMinimumContrast(e,t,r,s,n,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||MX(s.getCode()))return!1;let c=this._getContrastCache(s),d;if(!n&&!l&&(d=c.getColor(t.rgba,r.rgba)),d===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);d=Gt.ensureContrastRatio(n||t,l||r,m),c.setColor((n||t).rgba,(l||r).rgba,d??null)}return d?(this._addStyle(e,`color:${d.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&t>=r[1]&&e<s[0]&&t<=s[1]:e<r[0]&&t>=r[1]&&e>=s[0]&&t<=s[1]:t>r[1]&&t<s[1]||r[1]===s[1]&&t===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&t===s[1]&&e<s[0]||r[1]<s[1]&&t===r[1]&&e>=r[0]}};l0=pr([Ne(1,pM),Ne(2,Ss),Ne(3,va),Ne(4,ml),Ne(5,Td),Ne(6,Tc)],l0);function ck(e,t,r){for(;e.length<r;)e=t+e;return e}var LX=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[r,s,n,l],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(l),t.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(e,t,r,s){e===this._font&&t===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,r){let s=0;if(!t&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let c=this._measure(e,0);return c>0&&(this._flat[s]=c),c}let n=e;t&&(n+="B"),r&&(n+="I");let l=this._holey.get(n);if(l===void 0){let c=0;t&&(c|=1),r&&(c|=2),l=this._measure(e,c),l>0&&this._holey.set(n,l)}return l}_measure(e,t){let r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}},OX=class{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(e,t,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,l=t[1]-n,c=r[1]-n,d=Math.max(l,0),m=Math.min(c,e.rows-1);if(d>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=l,this.viewportEndRow=c,this.viewportCappedStartRow=d,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function BX(){return new OX}var D_="xterm-dom-renderer-owner-",vi="xterm-rows",bf="xterm-fg-",uk="xterm-bg-",Ou="xterm-focus",wf="xterm-selection",PX=1,c0=class extends ot{constructor(e,t,r,s,n,l,c,d,m,h,v,g,x,y){super(),this._terminal=e,this._document=t,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=l,this._linkifier2=c,this._charSizeService=m,this._optionsService=h,this._bufferService=v,this._coreService=g,this._coreBrowserService=x,this._themeService=y,this._terminalClass=PX++,this._rowElements=[],this._selectionRenderModel=BX(),this.onRequestRedraw=this._register(new Se).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(vi),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(wf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=DX(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(l0,document),this._element.classList.add(D_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(Zt(()=>{this._element.classList.remove(D_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new LX(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${vi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${vi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${vi} .xterm-dim { color: ${Gt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${vi}.${Ou} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${vi}.${Ou} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${vi}.${Ou} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${vi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${vi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${vi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${vi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${vi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${wf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${wf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${wf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,c]of e.ansi.entries())t+=`${this._terminalSelector} .${bf}${l} { color: ${c.css}; }${this._terminalSelector} .${bf}${l}.xterm-dim { color: ${Gt.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${uk}${l} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${bf}257 { color: ${Gt.opaque(e.background).css}; }${this._terminalSelector} .${bf}257.xterm-dim { color: ${Gt.multiplyOpacity(Gt.opaque(e.background),.5).css}; }${this._terminalSelector} .${uk}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let r=this._rowElements.length;r<=t;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Ou),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ou),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,l=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(r){let m=e[0]>t[0];d.appendChild(this._createSelectionElement(l,m?t[0]:e[0],m?e[0]:t[0],c-l+1))}else{let m=s===l?e[0]:0,h=l===n?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(l,m,h));let v=c-l-1;if(d.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,v)),l!==c){let g=n===c?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,0,g))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,r,s=1){let n=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(r-t);return l+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-l),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${l}px`,n.style.width=`${c}px`,n}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let h=m+r.ydisp,v=this._rowElements[m],g=r.lines.get(h);if(!v||!g)break;v.replaceChildren(...this._rowFactory.createRow(g,h,h===s,c,d,n,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,r,s,n,l){r<0&&(e=0),s<0&&(t=0);let c=this._bufferService.rows-1;r=Math.max(Math.min(r,c),0),s=Math.max(Math.min(s,c),0),n=Math.min(n,this._bufferService.cols);let d=this._bufferService.buffer,m=d.ybase+d.y,h=Math.min(d.x,n-1),v=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=r;y<=s;++y){let w=y+d.ydisp,S=this._rowElements[y],k=d.lines.get(w);if(!S||!k)break;S.replaceChildren(...this._rowFactory.createRow(k,w,w===m,g,x,h,v,this.dimensions.css.cell.width,this._widthCache,l?y===r?e:0:-1,l?(y===s?t:n)-1:-1))}}};c0=pr([Ne(7,Xy),Ne(8,fp),Ne(9,Ss),Ne(10,ws),Ne(11,ml),Ne(12,va),Ne(13,Tc)],c0);var u0=class extends ot{constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Se),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new zX(this._optionsService))}catch{this._measureStrategy=this._register(new IX(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};u0=pr([Ne(2,Ss)],u0);var LM=class extends ot{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},IX=class extends LM{constructor(e,t,r){super(),this._document=e,this._parentElement=t,this._optionsService=r,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}},zX=class extends LM{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},$X=class extends ot{constructor(e,t,r){super(),this._textarea=e,this._window=t,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new UX(this._window)),this._onDprChange=this._register(new Se),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Se),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ls.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ge(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ge(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},UX=class extends ot{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new yc),this._onDprChange=this._register(new Se),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Zt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ge(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},HX=class extends ot{constructor(){super(),this.linkProviders=[],this._register(Zt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function ib(e,t,r){let s=r.getBoundingClientRect(),n=e.getComputedStyle(r),l=parseInt(n.getPropertyValue("padding-left")),c=parseInt(n.getPropertyValue("padding-top"));return[t.clientX-s.left-l,t.clientY-s.top-c]}function FX(e,t,r,s,n,l,c,d,m){if(!l)return;let h=ib(e,t,r);if(h)return h[0]=Math.ceil((h[0]+(m?c/2:0))/c),h[1]=Math.ceil(h[1]/d),h[0]=Math.min(Math.max(h[0],1),s+(m?1:0)),h[1]=Math.min(Math.max(h[1],1),n),h}var d0=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,s,n){return FX(window,e,t,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let r=ib(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};d0=pr([Ne(0,_a),Ne(1,fp)],d0);var qX=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},OM={};eK(OM,{getSafariVersion:()=>VX,isChromeOS:()=>zM,isFirefox:()=>BM,isIpad:()=>GX,isIphone:()=>YX,isLegacyEdge:()=>WX,isLinux:()=>nb,isMac:()=>_m,isNode:()=>mp,isSafari:()=>PM,isWindows:()=>IM});var mp=typeof process<"u"&&"title"in process,Md=mp?"node":navigator.userAgent,Dd=mp?"node":navigator.platform,BM=Md.includes("Firefox"),WX=Md.includes("Edge"),PM=/^((?!chrome|android).)*safari/i.test(Md);function VX(){if(!PM)return 0;let e=Md.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var _m=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Dd),GX=Dd==="iPad",YX=Dd==="iPhone",IM=["Windows","Win16","Win32","WinCE"].includes(Dd),nb=Dd.indexOf("Linux")>=0,zM=/\bCrOS\b/.test(Md),$M=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,r=0,s=e.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),r=Math.max(t,r),n=e.timeRemaining(),r*1.5>n){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=n}this.clear()}},KX=class extends $M{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},XX=class extends $M{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},xm=!mp&&"requestIdleCallback"in window?XX:KX,ZX=class{constructor(){this._queue=new xm}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},h0=class extends ot{constructor(e,t,r,s,n,l,c,d,m){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=d,this._renderer=this._register(new yc),this._pausedResizeTask=new ZX,this._observerDisposable=this._register(new yc),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 Se),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Se),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Se),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Se),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new qX((h,v)=>this._renderRows(h,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new QX(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Zt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var h;return(h=this._renderer.value)==null?void 0:h.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(c.cols,c.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(c.buffer.y,c.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(t),this._observerDisposable.value=Zt(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,r){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};h0=pr([Ne(2,Ss),Ne(3,fp),Ne(4,ml),Ne(5,Td),Ne(6,ws),Ne(7,va),Ne(8,Tc)],h0);var QX=class{constructor(e,t,r){this._coreBrowserService=e,this._coreService=t,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function JX(e,t,r,s){let n=r.buffer.x,l=r.buffer.y;if(!r.buffer.hasScrollback)return rZ(n,l,e,t,r,s)+pp(l,t,r,s)+sZ(n,l,e,t,r,s);let c;if(l===t)return c=n>e?"D":"C",fd(Math.abs(n-e),hd(c,s));c=l>t?"D":"C";let d=Math.abs(l-t),m=tZ(l>t?e:n,r)+(d-1)*r.cols+1+eZ(l>t?n:e);return fd(m,hd(c,s))}function eZ(e,t){return e-1}function tZ(e,t){return t.cols-e}function rZ(e,t,r,s,n,l){return pp(t,s,n,l).length===0?"":fd(HM(e,t,e,t-ol(t,n),!1,n).length,hd("D",l))}function pp(e,t,r,s){let n=e-ol(e,r),l=t-ol(t,r),c=Math.abs(n-l)-iZ(e,t,r);return fd(c,hd(UM(e,t),s))}function sZ(e,t,r,s,n,l){let c;pp(t,s,n,l).length>0?c=s-ol(s,n):c=t;let d=s,m=nZ(e,t,r,s,n,l);return fd(HM(e,c,r,d,m==="C",n).length,hd(m,l))}function iZ(e,t,r){var c;let s=0,n=e-ol(e,r),l=t-ol(t,r);for(let d=0;d<Math.abs(n-l);d++){let m=UM(e,t)==="A"?-1:1;(c=r.buffer.lines.get(n+m*d))!=null&&c.isWrapped&&s++}return s}function ol(e,t){let r=0,s=t.buffer.lines.get(e),n=s==null?void 0:s.isWrapped;for(;n&&e>=0&&e<t.rows;)r++,s=t.buffer.lines.get(--e),n=s==null?void 0:s.isWrapped;return r}function nZ(e,t,r,s,n,l){let c;return pp(r,s,n,l).length>0?c=s-ol(s,n):c=t,e<r&&c<=s||e>=r&&c<s?"C":"D"}function UM(e,t){return e>t?"A":"B"}function HM(e,t,r,s,n,l){let c=e,d=t,m="";for(;(c!==r||d!==s)&&d>=0&&d<l.buffer.lines.length;)c+=n?1:-1,n&&c>l.cols-1?(m+=l.buffer.translateBufferLineToString(d,!1,e,c),c=0,e=0,d++):!n&&c<0&&(m+=l.buffer.translateBufferLineToString(d,!1,0,e+1),c=l.cols-1,e=c,d--);return m+l.buffer.translateBufferLineToString(d,!1,e,c)}function hd(e,t){let r=t?"O":"[";return ve.ESC+r+e}function fd(e,t){e=Math.floor(e);let r="";for(let s=0;s<e;s++)r+=t;return r}var aZ=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function dk(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var L_=50,oZ=15,lZ=50,cZ=500,uZ=" ",dZ=new RegExp(uZ,"g"),f0=class extends ot{constructor(e,t,r,s,n,l,c,d,m){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=l,this._optionsService=c,this._renderService=d,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ei,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Se),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Se),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Se),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Se),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new aZ(this._bufferService),this._activeSelectionMode=0,this._register(Zt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let d=r.translateBufferLineToString(c,!0,n,l);s.push(d)}}else{let n=e[1]===t[1]?t[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let l=e[1]+1;l<=t[1]-1;l++){let c=r.lines.get(l),d=r.translateBufferLineToString(l,!0);c!=null&&c.isWrapped?s[s.length-1]+=d:s.push(d)}if(e[1]!==t[1]){let l=r.lines.get(t[1]),c=r.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?s[s.length-1]+=c:s.push(c)}}return s.map(n=>n.replace(dZ," ")).join(IM?`\r
714
+ `:`
715
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),nb&&e&&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(e){let t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!t?!1:this._areCoordsInSelection(t,r,s)}isCellInSelection(e,t){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,t],r,s)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,l;let r=(l=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:l.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=dk(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=ib(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-L_),L_),t/=L_,t/Math.abs(t)+Math.round(t*(oZ-1)))}shouldForceSelection(e){return _m?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),lZ)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let 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(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(_m&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let s=r.lines.get(this._model.selectionEnd[1]);s&&s.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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<cZ&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let s=JX(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,t,r);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let s=0;t>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&t!==s&&(r+=n-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,l=n.lines.get(e[1]);if(!l)return;let c=n.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(l,e[0]),m=d,h=e[0]-d,v=0,g=0,x=0,y=0;if(c.charAt(d)===" "){for(;d>0&&c.charAt(d-1)===" ";)d--;for(;m<c.length&&c.charAt(m+1)===" ";)m++}else{let k=e[0],C=e[0];l.getWidth(k)===0&&(v++,k--),l.getWidth(C)===2&&(g++,C++);let E=l.getString(C).length;for(E>1&&(y+=E-1,m+=E-1);k>0&&d>0&&!this._isCharWordSeparator(l.loadCell(k-1,this._workCell));){l.loadCell(k-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,k--):N>1&&(x+=N-1,d-=N-1),d--,k--}for(;C<l.length&&m+1<c.length&&!this._isCharWordSeparator(l.loadCell(C+1,this._workCell));){l.loadCell(C+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,C++):N>1&&(y+=N-1,m+=N-1),m++,C++}}m++;let w=d+h-v+x,S=Math.min(this._bufferService.cols,m-d+v+g-x-y);if(!(!t&&c.slice(d,m).trim()==="")){if(r&&w===0&&l.getCodePoint(0)!==32){let k=n.lines.get(e[1]-1);if(k&&l.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let E=this._bufferService.cols-C.start;w-=E,S+=E}}}if(s&&w+S===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let k=n.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(S+=C.length)}}return{start:w,length:S}}}_selectWordAt(e,t){let r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),r={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=dk(r,this._bufferService.cols)}};f0=pr([Ne(3,ws),Ne(4,ml),Ne(5,Zy),Ne(6,Ss),Ne(7,_a),Ne(8,va)],f0);var hk=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},fk=class{constructor(){this._color=new hk,this._css=new hk}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Or=Object.freeze((()=>{let e=[tr.toColor("#2e3436"),tr.toColor("#cc0000"),tr.toColor("#4e9a06"),tr.toColor("#c4a000"),tr.toColor("#3465a4"),tr.toColor("#75507b"),tr.toColor("#06989a"),tr.toColor("#d3d7cf"),tr.toColor("#555753"),tr.toColor("#ef2929"),tr.toColor("#8ae234"),tr.toColor("#fce94f"),tr.toColor("#729fcf"),tr.toColor("#ad7fa8"),tr.toColor("#34e2e2"),tr.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){let s=t[r/36%6|0],n=t[r/6%6|0],l=t[r%6];e.push({css:Nr.toCss(s,n,l),rgba:Nr.toRgba(s,n,l)})}for(let r=0;r<24;r++){let s=8+r*10;e.push({css:Nr.toCss(s,s,s),rgba:Nr.toRgba(s,s,s)})}return e})()),Vo=tr.toColor("#ffffff"),Vu=tr.toColor("#000000"),mk=tr.toColor("#ffffff"),pk=Vu,Bu={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},hZ=Vo,m0=class extends ot{constructor(e){super(),this._optionsService=e,this._contrastCache=new fk,this._halfContrastCache=new fk,this._onChangeColors=this._register(new Se),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Vo,background:Vu,cursor:mk,cursorAccent:pk,selectionForeground:void 0,selectionBackgroundTransparent:Bu,selectionBackgroundOpaque:Gt.blend(Vu,Bu),selectionInactiveBackgroundTransparent:Bu,selectionInactiveBackgroundOpaque:Gt.blend(Vu,Bu),scrollbarSliderBackground:Gt.opacity(Vo,.2),scrollbarSliderHoverBackground:Gt.opacity(Vo,.4),scrollbarSliderActiveBackground:Gt.opacity(Vo,.5),overviewRulerBorder:Vo,ansi:Or.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Bt(e.foreground,Vo),t.background=Bt(e.background,Vu),t.cursor=Gt.blend(t.background,Bt(e.cursor,mk)),t.cursorAccent=Gt.blend(t.background,Bt(e.cursorAccent,pk)),t.selectionBackgroundTransparent=Bt(e.selectionBackground,Bu),t.selectionBackgroundOpaque=Gt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Bt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Gt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Bt(e.selectionForeground,lk):void 0,t.selectionForeground===lk&&(t.selectionForeground=void 0),Gt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Gt.opacity(t.selectionBackgroundTransparent,.3)),Gt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Gt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Bt(e.scrollbarSliderBackground,Gt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Bt(e.scrollbarSliderHoverBackground,Gt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Bt(e.scrollbarSliderActiveBackground,Gt.opacity(t.foreground,.5)),t.overviewRulerBorder=Bt(e.overviewRulerBorder,hZ),t.ansi=Or.slice(),t.ansi[0]=Bt(e.black,Or[0]),t.ansi[1]=Bt(e.red,Or[1]),t.ansi[2]=Bt(e.green,Or[2]),t.ansi[3]=Bt(e.yellow,Or[3]),t.ansi[4]=Bt(e.blue,Or[4]),t.ansi[5]=Bt(e.magenta,Or[5]),t.ansi[6]=Bt(e.cyan,Or[6]),t.ansi[7]=Bt(e.white,Or[7]),t.ansi[8]=Bt(e.brightBlack,Or[8]),t.ansi[9]=Bt(e.brightRed,Or[9]),t.ansi[10]=Bt(e.brightGreen,Or[10]),t.ansi[11]=Bt(e.brightYellow,Or[11]),t.ansi[12]=Bt(e.brightBlue,Or[12]),t.ansi[13]=Bt(e.brightMagenta,Or[13]),t.ansi[14]=Bt(e.brightCyan,Or[14]),t.ansi[15]=Bt(e.brightWhite,Or[15]),e.extendedAnsi){let r=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)t.ansi[s+16]=Bt(e.extendedAnsi[s],Or[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};m0=pr([Ne(0,Ss)],m0);function Bt(e,t){if(e!==void 0)try{return tr.toColor(e)}catch{}return t}var fZ=class{constructor(...e){this._entries=new Map;for(let[t,r]of e)this.set(t,r)}set(e,t){let r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(let[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},mZ=class{constructor(){this._services=new fZ,this._services.set(Xy,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let r=oK(e).sort((l,c)=>l.index-c.index),s=[];for(let l of r){let c=this._services.get(l.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.id._id}.`);s.push(c)}let n=r.length>0?r[0].index:t.length;if(t.length!==n)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},pZ={trace:0,debug:1,info:2,warn:3,error:4,off:5},gZ="xterm.js: ",p0=class extends ot{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=pZ[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":gZ)+t,...r)}trace(e,...t){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,t)}};p0=pr([Ne(0,Ss)],p0);var gk=class extends ot{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Se),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Se),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Se),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,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(e,t,...r){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=t-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let s=e+t+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},nt=3,Er=Object.freeze(new Ad),Sf=0,O_=2,Gu=class FM{constructor(t,r,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*nt);let n=r||Ei.fromCharData([0,lM,1,0]);for(let l=0;l<t;++l)this.setCell(l,n);this.length=t}get(t){let r=this._data[t*nt+0],s=r&2097151;return[this._data[t*nt+1],r&2097152?this._combined[t]:s?Ja(s):"",r>>22,r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,r){this._data[t*nt+1]=r[0],r[1].length>1?(this._combined[t]=r[1],this._data[t*nt+0]=t|2097152|r[2]<<22):this._data[t*nt+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(t){return this._data[t*nt+0]>>22}hasWidth(t){return this._data[t*nt+0]&12582912}getFg(t){return this._data[t*nt+1]}getBg(t){return this._data[t*nt+2]}hasContent(t){return this._data[t*nt+0]&4194303}getCodePoint(t){let r=this._data[t*nt+0];return r&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r&2097151}isCombined(t){return this._data[t*nt+0]&2097152}getString(t){let r=this._data[t*nt+0];return r&2097152?this._combined[t]:r&2097151?Ja(r&2097151):""}isProtected(t){return this._data[t*nt+2]&536870912}loadCell(t,r){return Sf=t*nt,r.content=this._data[Sf+0],r.fg=this._data[Sf+1],r.bg=this._data[Sf+2],r.content&2097152&&(r.combinedData=this._combined[t]),r.bg&268435456&&(r.extended=this._extendedAttrs[t]),r}setCell(t,r){r.content&2097152&&(this._combined[t]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*nt+0]=r.content,this._data[t*nt+1]=r.fg,this._data[t*nt+2]=r.bg}setCellFromCodepoint(t,r,s,n){n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*nt+0]=r|s<<22,this._data[t*nt+1]=n.fg,this._data[t*nt+2]=n.bg}addCodepointToCell(t,r,s){let n=this._data[t*nt+0];n&2097152?this._combined[t]+=Ja(r):n&2097151?(this._combined[t]=Ja(n&2097151)+Ja(r),n&=-2097152,n|=2097152):n=r|1<<22,s&&(n&=-12582913,n|=s<<22),this._data[t*nt+0]=n}insertCells(t,r,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length-t){let n=new Ei;for(let l=this.length-t-r-1;l>=0;--l)this.setCell(t+r+l,this.loadCell(t+l,n));for(let l=0;l<r;++l)this.setCell(t+l,s)}else for(let n=t;n<this.length;++n)this.setCell(n,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,r,s){if(t%=this.length,r<this.length-t){let n=new Ei;for(let l=0;l<this.length-t-r;++l)this.setCell(t+l,this.loadCell(t+r+l,n));for(let l=this.length-r;l<this.length;++l)this.setCell(l,s)}else for(let n=t;n<this.length;++n)this.setCell(n,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,r,s,n=!1){if(n){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,s);t<r&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,s);t<r&&t<this.length;)this.setCell(t++,s)}resize(t,r){if(t===this.length)return this._data.length*4*O_<this._data.buffer.byteLength;let s=t*nt;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let n=new Uint32Array(s);n.set(this._data),this._data=n}for(let n=this.length;n<t;++n)this.setCell(n,r)}else{this._data=this._data.subarray(0,s);let n=Object.keys(this._combined);for(let c=0;c<n.length;c++){let d=parseInt(n[c],10);d>=t&&delete this._combined[d]}let l=Object.keys(this._extendedAttrs);for(let c=0;c<l.length;c++){let d=parseInt(l[c],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,s*4*O_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*O_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,r=!1){if(r){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let r in t._combined)this._combined[r]=t._combined[r];this._extendedAttrs={};for(let r in t._extendedAttrs)this._extendedAttrs[r]=t._extendedAttrs[r];this.isWrapped=t.isWrapped}clone(){let t=new FM(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let r in this._combined)t._combined[r]=this._combined[r];for(let r in this._extendedAttrs)t._extendedAttrs[r]=this._extendedAttrs[r];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*nt+0]&4194303)return t+(this._data[t*nt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*nt+0]&4194303||this._data[t*nt+2]&50331648)return t+(this._data[t*nt+0]>>22);return 0}copyCellsFrom(t,r,s,n,l){let c=t._data;if(l)for(let m=n-1;m>=0;m--){for(let h=0;h<nt;h++)this._data[(s+m)*nt+h]=c[(r+m)*nt+h];c[(r+m)*nt+2]&268435456&&(this._extendedAttrs[s+m]=t._extendedAttrs[r+m])}else for(let m=0;m<n;m++){for(let h=0;h<nt;h++)this._data[(s+m)*nt+h]=c[(r+m)*nt+h];c[(r+m)*nt+2]&268435456&&(this._extendedAttrs[s+m]=t._extendedAttrs[r+m])}let d=Object.keys(t._combined);for(let m=0;m<d.length;m++){let h=parseInt(d[m],10);h>=r&&(this._combined[h-r+s]=t._combined[h])}}translateToString(t,r,s,n){r=r??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),n&&(n.length=0);let l="";for(;r<s;){let c=this._data[r*nt+0],d=c&2097151,m=c&2097152?this._combined[r]:d?Ja(d):so;if(l+=m,n)for(let h=0;h<m.length;++h)n.push(r);r+=c>>22||1}return n&&n.push(r),l}};function vZ(e,t,r,s,n,l){let c=[];for(let d=0;d<e.length-1;d++){let m=d,h=e.get(++m);if(!h.isWrapped)continue;let v=[e.get(d)];for(;m<e.length&&h.isWrapped;)v.push(h),h=e.get(++m);if(!l&&s>=d&&s<m){d+=v.length-1;continue}let g=0,x=md(v,g,t),y=1,w=0;for(;y<v.length;){let k=md(v,y,t),C=k-w,E=r-x,N=Math.min(C,E);v[g].copyCellsFrom(v[y],w,x,N,!1),x+=N,x===r&&(g++,x=0),w+=N,w===k&&(y++,w=0),x===0&&g!==0&&v[g-1].getWidth(r-1)===2&&(v[g].copyCellsFrom(v[g-1],r-1,x++,1,!1),v[g-1].setCell(r-1,n))}v[g].replaceCells(x,r,n);let S=0;for(let k=v.length-1;k>0&&(k>g||v[k].getTrimmedLength()===0);k--)S++;S>0&&(c.push(d+v.length-S),c.push(S)),d+=v.length-1}return c}function _Z(e,t){let r=[],s=0,n=t[s],l=0;for(let c=0;c<e.length;c++)if(n===c){let d=t[++s];e.onDeleteEmitter.fire({index:c-l,amount:d}),c+=d-1,l+=d,n=t[++s]}else r.push(c);return{layout:r,countRemoved:l}}function xZ(e,t){let r=[];for(let s=0;s<t.length;s++)r.push(e.get(t[s]));for(let s=0;s<r.length;s++)e.set(s,r[s]);e.length=t.length}function yZ(e,t,r){let s=[],n=e.map((m,h)=>md(e,h,t)).reduce((m,h)=>m+h),l=0,c=0,d=0;for(;d<n;){if(n-d<r){s.push(n-d);break}l+=r;let m=md(e,c,t);l>m&&(l-=m,c++);let h=e[c].getWidth(l-1)===2;h&&l--;let v=h?r-1:r;s.push(v),d+=v}return s}function md(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(r-1)&&e[t].getWidth(r-1)===1,n=e[t+1].getWidth(0)===2;return s&&n?r-1:r}var qM=class WM{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=WM._nextId++,this._onDispose=this.register(new Se),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),al(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};qM._nextId=1;var bZ=qM,zr={},Go=zr.B;zr[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:"≥","{":"π","|":"≠","}":"£","~":"·"};zr.A={"#":"£"};zr.B=void 0;zr[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};zr.C=zr[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};zr.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};zr.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};zr.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};zr.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};zr.E=zr[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};zr.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};zr.H=zr[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};zr["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var vk=4294967295,_k=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Er.clone(),this.savedCharset=Go,this.markers=[],this._nullCell=Ei.fromCharData([0,lM,1,0]),this._whitespaceCell=Ei.fromCharData([0,so,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new xm,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new gk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new pm),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new pm),this._whitespaceCell}getBlankLine(e,t){return new Gu(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>vk?vk:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Er);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new gk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let r=this.getNullCell(Er),s=0,n=this._getCorrectBufferLength(t);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)s+=+this.lines.get(c).resize(e,r);let l=0;if(this._rows<t)for(let c=this._rows;c<t;c++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Gu(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Gu(e,r)));else for(let c=this._rows;c>t;c--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let c=this.lines.length-n;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=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let l=0;l<this.lines.length;l++)s+=+this.lines.get(l).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,s=vZ(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Er),r);if(s.length>0){let n=_Z(this.lines,s);xZ(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){let s=this.getNullCell(Er),n=r;for(;n-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Gu(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){let r=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(Er),n=[],l=0;for(let c=this.lines.length-1;c>=0;c--){let d=this.lines.get(c);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let m=[d];for(;d.isWrapped&&c>0;)d=this.lines.get(--c),m.unshift(d);if(!r){let N=this.ybase+this.y;if(N>=c&&N<c+m.length)continue}let h=m[m.length-1].getTrimmedLength(),v=yZ(m,this._cols,e),g=v.length-m.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+g):x=Math.max(0,this.lines.length-this.lines.maxLength+g);let y=[];for(let N=0;N<g;N++){let R=this.getBlankLine(Er,!0);y.push(R)}y.length>0&&(n.push({start:c+m.length+l,newLines:y}),l+=y.length),m.push(...y);let w=v.length-1,S=v[w];S===0&&(w--,S=v[w]);let k=m.length-g-1,C=h;for(;k>=0;){let N=Math.min(C,S);if(m[w]===void 0)break;if(m[w].copyCellsFrom(m[k],C-N,S-N,N,!0),S-=N,S===0&&(w--,S=v[w]),C-=N,C===0){k--;let R=Math.max(k,0);C=md(m,R,this._cols)}}for(let N=0;N<m.length;N++)v[N]<e&&m[N].setCell(v[N],s);let E=g-x;for(;E-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(n.length>0){let c=[],d=[];for(let S=0;S<this.lines.length;S++)d.push(this.lines.get(S));let m=this.lines.length,h=m-1,v=0,g=n[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let x=0;for(let S=Math.min(this.lines.maxLength-1,m+l-1);S>=0;S--)if(g&&g.start>h+x){for(let k=g.newLines.length-1;k>=0;k--)this.lines.set(S--,g.newLines[k]);S++,c.push({index:h+1,amount:g.newLines.length}),x+=g.newLines.length,g=n[++v]}else this.lines.set(S,d[h--]);let y=0;for(let S=c.length-1;S>=0;S--)c[S].index+=y,this.lines.onInsertEmitter.fire(c[S]),y+=c[S].amount;let w=Math.max(0,m+l-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,r=0,s){let n=this.lines.get(e);return n?n.translateToString(t,r,s):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new bZ(e);return this.markers.push(t),t.register(this.lines.onTrim(r=>{t.line-=r,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(r=>{t.line>=r.index&&(t.line+=r.amount)})),t.register(this.lines.onDelete(r=>{t.line>=r.index&&t.line<r.index+r.amount&&t.dispose(),t.line>r.index&&(t.line-=r.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},wZ=class extends ot{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Se),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 _k(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new _k(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},VM=2,GM=1,g0=class extends ot{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Se),this.onResize=this._onResize.event,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,VM),this.rows=Math.max(e.rawOptions.rows||0,GM),this.buffers=this._register(new wZ(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let r=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:r,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=r.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let n=r.ybase+r.scrollTop,l=r.ybase+r.scrollBottom;if(r.scrollTop===0){let c=r.lines.isFull;l===r.lines.length-1?c?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(l+1,0,s.clone()),c?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let c=l-n+1;r.lines.shiftElements(n+1,c-1,-1),r.lines.set(l,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let s=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),s!==r.ydisp&&(t||this._onScroll.fire(r.ydisp))}};g0=pr([Ne(0,Ss)],g0);var sc={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:_m,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},SZ=["normal","bold","100","200","300","400","500","600","700","800","900"],CZ=class extends ot{constructor(e){super(),this._onOptionChange=this._register(new Se),this.onOptionChange=this._onOptionChange.event;let t={...sc};for(let r in e)if(r in t)try{let s=e[r];t[r]=this._sanitizeAndValidateOption(r,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Zt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&t()})}_setupOptions(){let e=r=>{if(!(r in sc))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},t=(r,s)=>{if(!(r in sc))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=sc[e]),!kZ(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=sc[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=SZ.includes(t)?t:sc[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function kZ(e){return e==="block"||e==="underline"||e==="bar"}function Yu(e,t=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let s in e)r[s]=t<=1?e[s]:e[s]&&Yu(e[s],t-1);return r}var xk=Object.freeze({insertMode:!1}),yk=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),v0=class extends ot{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Se),this.onData=this._onData.event,this._onUserInput=this._register(new Se),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Se),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Se),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Yu(xk),this.decPrivateModes=Yu(yk)}reset(){this.modes=Yu(xk),this.decPrivateModes=Yu(yk)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};v0=pr([Ne(0,ws),Ne(1,fM),Ne(2,Ss)],v0);var bk={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function B_(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!t&&(r|=3)),r}var P_=String.fromCharCode,wk={DEFAULT:e=>{let t=[B_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${P_(t[0])}${P_(t[1])}${P_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${B_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${B_(e,!0)};${e.x};${e.y}${t}`}},_0=class extends ot{constructor(e,t,r){super(),this._bufferService=e,this._coreService=t,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Se),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(bk))this.addProtocol(s,bk[s]);for(let s of Object.keys(wk))this.addEncoding(s,wk[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,r){if(e.deltaY===0||e.shiftKey||t===void 0||r===void 0)return 0;let s=t/r,n=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=s+0,Math.abs(e.deltaY)<50&&(n*=.3),this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};_0=pr([Ne(0,ws),Ne(1,ml),Ne(2,Ss)],_0);var I_=[[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]],EZ=[[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]],Br;function RZ(e,t){let r=0,s=t.length-1,n;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=r;)if(n=r+s>>1,e>t[n][1])r=n+1;else if(e<t[n][0])s=n-1;else return!0;return!1}var NZ=class{constructor(){if(this.version="6",!Br){Br=new Uint8Array(65536),Br.fill(1),Br[0]=0,Br.fill(0,1,32),Br.fill(0,127,160),Br.fill(2,4352,4448),Br[9001]=2,Br[9002]=2,Br.fill(2,11904,42192),Br[12351]=1,Br.fill(2,44032,55204),Br.fill(2,63744,64256),Br.fill(2,65040,65050),Br.fill(2,65072,65136),Br.fill(2,65280,65377),Br.fill(2,65504,65511);for(let e=0;e<I_.length;++e)Br.fill(0,I_[e][0],I_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Br[e]:RZ(e,EZ)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let r=this.wcwidth(e),s=r===0&&t!==0;if(s){let n=Xo.extractWidth(t);n===0?s=!1:n>r&&(r=n)}return Xo.createPropertyValue(0,r,s)}},Xo=class qf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Se,this.onChange=this._onChange.event;let t=new NZ;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,r,s=!1){return(t&16777215)<<3|(r&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let r=0,s=0,n=t.length;for(let l=0;l<n;++l){let c=t.charCodeAt(l);if(55296<=c&&c<=56319){if(++l>=n)return r+this.wcwidth(c);let h=t.charCodeAt(l);56320<=h&&h<=57343?c=(c-55296)*1024+h-56320+65536:r+=this.wcwidth(h)}let d=this.charProperties(c,s),m=qf.extractWidth(d);qf.extractShouldJoin(d)&&(m-=qf.extractWidth(s)),r+=m,s=d}return r}charProperties(t,r){return this._activeProvider.charProperties(t,r)}},jZ=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Sk(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&t&&(r.isWrapped=t[3]!==0&&t[3]!==32)}var Pu=2147483647,AZ=256,YM=class x0{constructor(t=32,r=32){if(this.maxLength=t,this.maxSubParamsLength=r,r>AZ)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let r=new x0;if(!t.length)return r;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let n=t[s];if(Array.isArray(n))for(let l=0;l<n.length;++l)r.addSubParam(n[l]);else r.addParam(n)}return r}clone(){let t=new x0(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let r=0;r<this.length;++r){t.push(this.params[r]);let s=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,n))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Pu?Pu:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Pu?Pu:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let r=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-r>0?this._subParams.subarray(r,s):null}getSubParamsAll(){let t={};for(let r=0;r<this.length;++r){let s=this._subParamsIdx[r]>>8,n=this._subParamsIdx[r]&255;n-s>0&&(t[r]=this._subParams.slice(s,n))}return t}addDigit(t){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,n=s[r-1];s[r-1]=~n?Math.min(n*10+t,Pu):t}},Iu=[],TZ=class{constructor(){this._state=0,this._active=Iu,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Iu}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Iu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Iu,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,r){if(!this._active.length)this._handlerFb(this._id,"PUT",hp(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}start(){this.reset(),this._state=1}put(e,t,r){if(this._state!==3){if(this._state===1)for(;t<r;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=Iu,this._id=-1,this._state=0}}},Ys=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=hp(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,t}},zu=[],MZ=class{constructor(){this._handlers=Object.create(null),this._active=zu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=zu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(t),{dispose:()=>{let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=zu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||zu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t)}put(e,t,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",hp(e,t,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,r)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=zu,this._ident=0}},Ku=new YM;Ku.addParam(0);var Ck=class{constructor(e){this._handler=e,this._data="",this._params=Ku,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ku,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=hp(e,t,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(r=>(this._params=Ku,this._data="",this._hitLimit=!1,r));return this._params=Ku,this._data="",this._hitLimit=!1,t}},DZ=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,s){this.table[t<<8|e]=r<<4|s}addMany(e,t,r,s){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=r<<4|s}},bi=160,LZ=(function(){let e=new DZ(4095),t=Array.apply(null,Array(256)).map((d,m)=>m),r=(d,m)=>t.slice(d,m),s=r(32,127),n=r(0,24);n.push(25),n.push.apply(n,r(28,32));let l=r(0,14),c;e.setDefault(1,0),e.addMany(s,0,2,0);for(c in l)e.addMany([24,26,153,154],c,3,0),e.addMany(r(128,144),c,3,0),e.addMany(r(144,152),c,3,0),e.add(156,c,0,0),e.add(27,c,11,1),e.add(157,c,4,8),e.addMany([152,158,159],c,0,7),e.add(155,c,11,3),e.add(144,c,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(bi,0,2,0),e.add(bi,8,5,8),e.add(bi,6,0,6),e.add(bi,11,0,11),e.add(bi,13,13,13),e})(),OZ=class extends ot{constructor(e=LZ){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new YM,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,r,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,r)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Zt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new TZ),this._dcsParser=this._register(new MZ),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let n=0;n<e.intermediates.length;++n){let l=e.intermediates.charCodeAt(n);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=l}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=s,r}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(t),{dispose:()=>{let n=s.indexOf(t);n!==-1&&s.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,r,s,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,t,r){let s=0,n=0,l=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&m>-1){for(;m>=0&&(c=d[m](this._params),c!==!0);m--)if(c instanceof Promise)return this._parseStack.handlerPos=m,c}this._parseStack.handlers=[];break;case 4:if(r===!1&&m>-1){for(;m>=0&&(c=d[m](),c!==!0);m--)if(c instanceof Promise)return this._parseStack.handlerPos=m,c}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(s!==24&&s!==26,r),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],c=this._oscParser.end(s!==24&&s!==26,r),c)return c;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=l;d<t;++d){switch(s=e[d],n=this._transitions.table[this.currentState<<8|(s<160?s:bi)],n>>4){case 2:for(let x=d+1;;++x){if(x>=t||(s=e[x])<32||s>126&&s<bi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(s=e[x])<32||s>126&&s<bi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(s=e[x])<32||s>126&&s<bi){this._printHandler(e,d,x),d=x-1;break}if(++x>=t||(s=e[x])<32||s>126&&s<bi){this._printHandler(e,d,x),d=x-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|s],h=m?m.length-1:-1;for(;h>=0&&(c=m[h](this._params),c!==!0);h--)if(c instanceof Promise)return this._preserveStack(3,m,h,n,d),c;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++d<t&&(s=e[d])>47&&s<60);d--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let v=this._escHandlers[this._collect<<8|s],g=v?v.length-1:-1;for(;g>=0&&(c=v[g](),c!==!0);g--)if(c instanceof Promise)return this._preserveStack(4,v,g,n,d),c;g<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let x=d+1;;++x)if(x>=t||(s=e[x])===24||s===26||s===27||s>127&&s<bi){this._dcsParser.put(e,d,x),d=x-1;break}break;case 14:if(c=this._dcsParser.unhook(s!==24&&s!==26),c)return this._preserveStack(6,[],0,n,d),c;s===27&&(n|=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 x=d+1;;x++)if(x>=t||(s=e[x])<32||s>127&&s<bi){this._oscParser.put(e,d,x),d=x-1;break}break;case 6:if(c=this._oscParser.end(s!==24&&s!==26),c)return this._preserveStack(5,[],0,n,d),c;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},BZ=/^([\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})$/,PZ=/^[\da-f]+$/;function kk(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let r=BZ.exec(t);if(r){let s=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/s*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/s*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),PZ.exec(t)&&[3,6,9,12].includes(t.length))){let r=t.length/3,s=[0,0,0];for(let n=0;n<3;++n){let l=parseInt(t.slice(r*n,r*n+r),16);s[n]=r===1?l<<4:r===2?l:r===3?l>>4:l>>8}return s}}function z_(e,t){let r=e.toString(16),s=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function IZ(e,t=16){let[r,s,n]=e;return`rgb:${z_(r,t)}/${z_(s,t)}/${z_(n,t)}`}var zZ={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ga=131072,Ek=10;function Rk(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Nk=5e3,jk=0,$Z=class extends ot{constructor(e,t,r,s,n,l,c,d,m=new OZ){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=s,this._optionsService=n,this._oscLinkService=l,this._coreMouseService=c,this._unicodeService=d,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new nK,this._utf8Decoder=new aK,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Er.clone(),this._eraseAttrDataInternal=Er.clone(),this._onRequestBell=this._register(new Se),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Se),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Se),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Se),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Se),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Se),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Se),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Se),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Se),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Se),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Se),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Se),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Se),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 y0(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:v.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,v,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:v,data:g})}),this._parser.setDcsHandlerFallback((h,v,g)=>{v==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:v,payload:g})}),this._parser.setPrintHandler((h,v,g)=>this.print(h,v,g)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Hf.IND,()=>this.index()),this._parser.setExecuteHandler(Hf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Hf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ys(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Ys(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Ys(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Ys(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Ys(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Ys(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Ys(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Ys(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Ys(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Ys(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Ys(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Ys(h=>this.restoreCursorColor(h))),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(let h in zr)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Ck((h,v)=>this.requestStatusString(h,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,r,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),Nk))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Nk} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,s=this._activeBuffer.x,n=this._activeBuffer.y,l=0,c=this._parseStack.paused;if(c){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;s=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ga&&(l=this._parseStack.position+Ga)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ga&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ga))),c||this._dirtyRowTracker.clearRange(),e.length>Ga)for(let h=l;h<e.length;h+=Ga){let v=h+Ga<e.length?h+Ga:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(h,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,v),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,g))return this._preserveStack(s,n,g,h),this._logSlowResolvingAsync(r),r}else if(!c){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,n,h,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==s||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,r){let s,n,l=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,v=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let x=this._parser.precedingJoinState;for(let y=t;y<r;++y){if(s=e[y],s<127&&l){let C=l[String.fromCharCode(s)];C&&(s=C.charCodeAt(0))}let w=this._unicodeService.charProperties(s,x);n=Xo.extractWidth(w);let S=Xo.extractShouldJoin(w),k=S?Xo.extractWidth(x):0;if(x=w,c&&this._onA11yChar.fire(Ja(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-k>d){if(m){let C=g,E=this._activeBuffer.x-k;for(this._activeBuffer.x=k,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&g instanceof Gu&&g.copyCellsFrom(C,E,0,k,!1);E<d;)C.setCellFromCodepoint(E++,0,1,v)}else if(this._activeBuffer.x=d-1,n===2)continue}if(S&&this._activeBuffer.x){let C=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-C,s,n);for(let E=n-k;--E>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(h&&(g.insertCells(this._activeBuffer.x,n-k,this._activeBuffer.getNullCell(v)),g.getWidth(d-1)===2&&g.setCellFromCodepoint(d-1,0,1,v)),g.setCellFromCodepoint(this._activeBuffer.x++,s,n,v),n>0)for(;--n;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=x,this._activeBuffer.x<d&&r-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>Rk(r.params[0],this._optionsService.rawOptions.windowOptions)?t(r):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Ck(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ys(t))}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 e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,s=!1,n=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),n),s&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&s.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(Er));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let r=e.params[0]||1,s=Xo.extractWidth(t),n=this._activeBuffer.x-s,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),c=new Uint32Array(l.length*r),d=0;for(let h=0;h<l.length;){let v=l.codePointAt(h)||0;c[d++]=v,h+=v>65535?2:1}let m=d;for(let h=1;h<r;++h)c.copyWithin(m,0,d),m+=d;return this.print(c,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Go),this._charsetService.setgCharset(1,Go),this._charsetService.setgCharset(2,Go),this._charsetService.setgCharset(3,Go);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let s=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:l}=this._coreMouseService,c=this._coreService,{buffers:d,cols:m}=this._bufferService,{active:h,alt:v}=d,g=this._optionsService.rawOptions,x=(S,k)=>(c.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${S};${k}$y`),!0),y=S=>S?1:2,w=e.params[0];return t?w===2?x(w,4):w===4?x(w,y(c.modes.insertMode)):w===12?x(w,3):w===20?x(w,y(g.convertEol)):x(w,0):w===1?x(w,y(s.applicationCursorKeys)):w===3?x(w,g.windowOptions.setWinLines?m===80?2:m===132?1:0:0):w===6?x(w,y(s.origin)):w===7?x(w,y(s.wraparound)):w===8?x(w,3):w===9?x(w,y(n==="X10")):w===12?x(w,y(g.cursorBlink)):w===25?x(w,y(!c.isCursorHidden)):w===45?x(w,y(s.reverseWraparound)):w===66?x(w,y(s.applicationKeypad)):w===67?x(w,4):w===1e3?x(w,y(n==="VT200")):w===1002?x(w,y(n==="DRAG")):w===1003?x(w,y(n==="ANY")):w===1004?x(w,y(s.sendFocus)):w===1005?x(w,4):w===1006?x(w,y(l==="SGR")):w===1015?x(w,4):w===1016?x(w,y(l==="SGR_PIXELS")):w===1048?x(w,1):w===47||w===1047||w===1049?x(w,y(h===v)):w===2004?x(w,y(s.bracketedPasteMode)):w===2026?x(w,y(s.synchronizedOutput)):x(w,0)}_updateAttrColor(e,t,r,s,n){return t===2?(e|=50331648,e&=-16777216,e|=Ad.fromColorRGB([r,s,n])):t===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,t,r){let s=[0,0,-1,0,0,0],n=0,l=0;do{if(s[l+n]=e.params[t+l],e.hasSubParams(t+l)){let c=e.getSubParams(t+l),d=0;do s[1]===5&&(n=1),s[l+d+1+n]=c[d];while(++d<c.length&&d+l+1+n<s.length);break}if(s[1]===5&&l+n>=2||s[1]===2&&l+n>=5)break;s[1]&&(n=1)}while(++l+t<e.length&&l+n<s.length);for(let c=2;c<s.length;++c)s[c]===-1&&(s[c]=0);switch(s[0]){case 38:r.fg=this._updateAttrColor(r.fg,s[1],s[3],s[4],s[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,s[1],s[3],s[4],s[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,s[1],s[3],s[4],s[5])}return l}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Er.fg,e.bg=Er.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,r,s=this._curAttrData;for(let n=0;n<t;n++)r=e.params[n],r>=30&&r<=37?(s.fg&=-50331904,s.fg|=16777216|r-30):r>=40&&r<=47?(s.bg&=-50331904,s.bg|=16777216|r-40):r>=90&&r<=97?(s.fg&=-50331904,s.fg|=16777216|r-90|8):r>=100&&r<=107?(s.bg&=-50331904,s.bg|=16777216|r-100|8):r===0?this._processSGR0(s):r===1?s.fg|=134217728:r===3?s.bg|=67108864:r===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,s)):r===5?s.fg|=536870912:r===7?s.fg|=67108864:r===8?s.fg|=1073741824:r===9?s.fg|=2147483648:r===2?s.bg|=134217728:r===21?this._processUnderline(2,s):r===22?(s.fg&=-134217729,s.bg&=-134217729):r===23?s.bg&=-67108865:r===24?(s.fg&=-268435457,this._processUnderline(0,s)):r===25?s.fg&=-536870913:r===27?s.fg&=-67108865:r===28?s.fg&=-1073741825:r===29?s.fg&=2147483647:r===39?(s.fg&=-67108864,s.fg|=Er.fg&16777215):r===49?(s.bg&=-67108864,s.bg|=Er.bg&16777215):r===38||r===48||r===58?n+=this._extractColor(e,n,s):r===53?s.bg|=1073741824:r===55?s.bg&=-1073741825:r===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):r===100?(s.fg&=-67108864,s.fg|=Er.fg&16777215,s.bg&=-67108864,s.bg|=Er.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[${t};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[?${t};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Er.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=t%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let t=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Rk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ek&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ek&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],r=e.split(";");for(;r.length>1;){let s=r.shift(),n=r.shift();if(/^\d+$/.exec(s)){let l=parseInt(s);if(Ak(l))if(n==="?")t.push({type:0,index:l});else{let c=kk(n);c&&t.push({type:1,index:l,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let r=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(r,s):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),s,n=r.findIndex(l=>l.startsWith("id="));return n!==-1&&(s=r[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let r=e.split(";");for(let s=0;s<r.length&&!(t>=this._specialColors.length);++s,++t)if(r[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let n=kk(r[s]);n&&this._onColor.fire([{type:1,index:this._specialColors[t],color:n}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],r=e.split(";");for(let s=0;s<r.length;++s)if(/^\d+$/.exec(r[s])){let n=parseInt(r[s]);Ak(n)&&t.push({type:2,index:n})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,Go),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(zZ[e[0]],zr[e[1]]||Go),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=Er.clone(),this._eraseAttrDataInternal=Er.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ei;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let r=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(r);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let r=c=>(this._coreService.triggerDataEvent(`${ve.ESC}${c}${ve.ESC}\\`),!0),s=this._bufferService.buffer,n=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},y0=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(jk=e,e=t,t=jk),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};y0=pr([Ne(0,ws)],y0);function Ak(e){return 0<=e&&e<256}var UZ=5e7,Tk=12,HZ=50,FZ=class extends ot{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Se),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>UZ)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],n=this._action(s,t);if(n){let c=d=>performance.now()-r>=Tk?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(r,d);n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(c);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=Tk)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>HZ&&(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()}},b0=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let d=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(m,d)),this._dataByLinkId.set(m.id,m),m.id}let r=e,s=this._getEntryIdKey(r),n=this._entriesWithId.get(s);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let l=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(c,l)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let r=e.lines.indexOf(t);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};b0=pr([Ne(0,ws)],b0);var Mk=!1,qZ=class extends ot{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new yc),this._onBinary=this._register(new Se),this.onBinary=this._onBinary.event,this._onData=this._register(new Se),this.onData=this._onData.event,this._onLineFeed=this._register(new Se),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Se),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Se),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Se),this._instantiationService=new mZ,this.optionsService=this._register(new CZ(e)),this._instantiationService.setService(Ss,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(g0)),this._instantiationService.setService(ws,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(p0)),this._instantiationService.setService(fM,this._logService),this.coreService=this._register(this._instantiationService.createInstance(v0)),this._instantiationService.setService(ml,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(_0)),this._instantiationService.setService(hM,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Xo)),this._instantiationService.setService(uK,this.unicodeService),this._charsetService=this._instantiationService.createInstance(jZ),this._instantiationService.setService(cK,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b0),this._instantiationService.setService(mM,this._oscLinkService),this._inputHandler=this._register(new $Z(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ls.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ls.forward(this._bufferService.onResize,this._onResize)),this._register(ls.forward(this.coreService.onData,this._onData)),this._register(ls.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new FZ((t,r)=>this._inputHandler.parse(t,r))),this._register(ls.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Se),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Mk&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Mk=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,VM),t=Math.max(t,GM),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Sk.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Sk(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Zt(()=>{for(let t of e)t.dispose()})}}},WZ={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:["'",'"']};function VZ(e,t,r,s){var c;let n={type:0,cancel:!1,key:void 0},l=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?n.key=ve.ESC+"OA":n.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?n.key=ve.ESC+"OD":n.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?n.key=ve.ESC+"OC":n.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?n.key=ve.ESC+"OB":n.key=ve.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(n.key=ve.ESC+n.key);break;case 9:if(e.shiftKey){n.key=ve.ESC+"[Z";break}n.key=ve.HT,n.cancel=!0;break;case 13:n.key=e.altKey?ve.ESC+ve.CR:ve.CR,n.cancel=!0;break;case 27:n.key=ve.ESC,e.altKey&&(n.key=ve.ESC+ve.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"D":t?n.key=ve.ESC+"OD":n.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"C":t?n.key=ve.ESC+"OC":n.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"A":t?n.key=ve.ESC+"OA":n.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;l?n.key=ve.ESC+"[1;"+(l+1)+"B":t?n.key=ve.ESC+"OB":n.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(n.key=ve.ESC+"[2~");break;case 46:l?n.key=ve.ESC+"[3;"+(l+1)+"~":n.key=ve.ESC+"[3~";break;case 36:l?n.key=ve.ESC+"[1;"+(l+1)+"H":t?n.key=ve.ESC+"OH":n.key=ve.ESC+"[H";break;case 35:l?n.key=ve.ESC+"[1;"+(l+1)+"F":t?n.key=ve.ESC+"OF":n.key=ve.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=ve.ESC+"[5;"+(l+1)+"~":n.key=ve.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=ve.ESC+"[6;"+(l+1)+"~":n.key=ve.ESC+"[6~";break;case 112:l?n.key=ve.ESC+"[1;"+(l+1)+"P":n.key=ve.ESC+"OP";break;case 113:l?n.key=ve.ESC+"[1;"+(l+1)+"Q":n.key=ve.ESC+"OQ";break;case 114:l?n.key=ve.ESC+"[1;"+(l+1)+"R":n.key=ve.ESC+"OR";break;case 115:l?n.key=ve.ESC+"[1;"+(l+1)+"S":n.key=ve.ESC+"OS";break;case 116:l?n.key=ve.ESC+"[15;"+(l+1)+"~":n.key=ve.ESC+"[15~";break;case 117:l?n.key=ve.ESC+"[17;"+(l+1)+"~":n.key=ve.ESC+"[17~";break;case 118:l?n.key=ve.ESC+"[18;"+(l+1)+"~":n.key=ve.ESC+"[18~";break;case 119:l?n.key=ve.ESC+"[19;"+(l+1)+"~":n.key=ve.ESC+"[19~";break;case 120:l?n.key=ve.ESC+"[20;"+(l+1)+"~":n.key=ve.ESC+"[20~";break;case 121:l?n.key=ve.ESC+"[21;"+(l+1)+"~":n.key=ve.ESC+"[21~";break;case 122:l?n.key=ve.ESC+"[23;"+(l+1)+"~":n.key=ve.ESC+"[23~";break;case 123:l?n.key=ve.ESC+"[24;"+(l+1)+"~":n.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?n.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?n.key=ve.DEL:e.keyCode===219?n.key=ve.ESC:e.keyCode===220?n.key=ve.FS:e.keyCode===221&&(n.key=ve.GS);else if((!r||s)&&e.altKey&&!e.metaKey){let d=(c=WZ[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(d)n.key=ve.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let m=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(m);e.shiftKey&&(h=h.toUpperCase()),n.key=ve.ESC+h}else if(e.keyCode===32)n.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let m=e.code.slice(3,4);e.shiftKey||(m=m.toLowerCase()),n.key=ve.ESC+m,n.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(n.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?n.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(n.key=ve.US),e.key==="@"&&(n.key=ve.NUL));break}return n}var br=0,GZ=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new xm,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new xm,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((n,l)=>this._getKey(n)-this._getKey(l)),t=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[r])?(s[n]=e[t],t++):s[n]=this._array[r++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(br=this._search(t),br===-1)||this._getKey(this._array[br])!==t)return!1;do if(this._array[br]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(br),!0;while(++br<this._array.length&&this._getKey(this._array[br])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,l)=>n-l),t=0,r=new Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:r[s++]=this._array[n];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(br=this._search(e),!(br<0||br>=this._array.length)&&this._getKey(this._array[br])===e))do yield this._array[br];while(++br<this._array.length&&this._getKey(this._array[br])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(br=this._search(e),!(br<0||br>=this._array.length)&&this._getKey(this._array[br])===e))do t(this._array[br]);while(++br<this._array.length&&this._getKey(this._array[br])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let s=t+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},$_=0,Dk=0,YZ=class extends ot{constructor(){super(),this._decorations=new GZ(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new Se),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Se),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Zt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new KZ(e);if(t){let r=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let s=0,n=0;for(let l of this._decorations.getKeyIterator(t))s=l.options.x??0,n=s+(l.options.width??1),e>=s&&e<n&&(!r||(l.options.layer??"bottom")===r)&&(yield l)}forEachDecorationAtCell(e,t,r,s){this._decorations.forEachByKey(t,n=>{$_=n.options.x??0,Dk=$_+(n.options.width??1),e>=$_&&e<Dk&&(!r||(n.options.layer??"bottom")===r)&&s(n)})}},KZ=class extends no{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Se),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Se),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=tr.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=tr.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},XZ=1e3,ZZ=class{constructor(e,t=XZ){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=s-this._lastRefreshMs,l=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Lk=20,ym=class extends ot{constructor(e,t,r,s){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ZZ(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
716
+ `))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ge(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Zt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Lk+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
717
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Lk+1&&(this._liveRegion.textContent+=Ux.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let r=this._terminal.buffer,s=r.lines.length.toString();for(let n=e;n<=t;n++){let l=r.lines.get(r.ydisp+n),c=[],d=(l==null?void 0:l.translateToString(!0,void 0,void 0,c))||"",m=(r.ydisp+n+1).toString(),h=this._rowElements[n];h&&(d.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=d,this._rowColumns.set(h,c)),h.setAttribute("aria-posinset",m),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let r=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],n=r.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(n===l||e.relatedTarget!==s)return;let c,d;if(t===0?(c=r,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=r,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var d;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===r.node&&t.offset>r.offset)&&([t,r]=[r,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:((d=s.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(r.node))return;let n=({node:m,offset:h})=>{let v=m instanceof Text?m.parentNode:m,g=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let x=this._rowColumns.get(v);if(!x)return console.warn("columns is null. Race condition?"),null;let y=h<x.length?x[h]:x.slice(-1)[0]+1;return y>=this._terminal.cols&&(++g,y=0),{row:g,column:y}},l=n(t),c=n(r);if(!(!l||!c)){if(l.row>c.row||l.row===c.row&&l.column>=c.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(c.row-l.row)*this._terminal.cols-l.column+c.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var n,l;e.style.transform="";let t=e.getBoundingClientRect().width,r=(l=(n=this._rowColumns.get(e))==null?void 0:n.slice(-1))==null?void 0:l[0];if(!r)return;let s=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};ym=pr([Ne(1,Xy),Ne(2,va),Ne(3,_a)],ym);var w0=class extends ot{constructor(e,t,r,s,n){super(),this._element=e,this._mouseService=t,this._renderService=r,this._bufferService=s,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Se),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Se),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Zt(()=>{var l;al(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ge(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ge(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ge(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ge(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let r=e.composedPath();for(let s=0;s<r.length;s++){let n=r[s];if(n.classList.contains("xterm"))break;if(n.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var s,n;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(l=>{l==null||l.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[l,c]of this._linkProviderService.linkProviders.entries())t?(n=this._activeProviderReplies)!=null&&n.get(l)&&(r=this._checkLinkProviderResult(l,e,r)):c.provideLinks(e.y,d=>{var h,v;if(this._isMouseOut)return;let m=d==null?void 0:d.map(g=>({link:g}));(h=this._activeProviderReplies)==null||h.set(l,m),r=this._checkLinkProviderResult(l,e,r),((v=this._activeProviderReplies)==null?void 0:v.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let r=new Set;for(let s=0;s<t.size;s++){let n=t.get(s);if(n)for(let l=0;l<n.length;l++){let c=n[l],d=c.link.range.start.y<e?0:c.link.range.start.x,m=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let h=d;h<=m;h++){if(r.has(h)){n.splice(l--,1);break}r.add(h)}}}}_checkLinkProviderResult(e,t,r){var l;if(!this._activeProviderReplies)return r;let s=this._activeProviderReplies.get(e),n=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(n=!0);if(!n&&s){let c=s.find(d=>this._linkAtPosition(d.link,t));c&&(r=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let c=0;c<this._activeProviderReplies.size;c++){let d=(l=this._activeProviderReplies.get(c))==null?void 0:l.find(m=>this._linkAtPosition(m.link,t));if(d){r=!0,this._handleNewLink(d);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&QZ(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,al(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,s;return(s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.pointerCursor},set:r=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,s;return(s=(r=this._currentLink)==null?void 0:r.state)==null?void 0:s.decorations.underline},set:r=>{var s,n,l;(s=this._currentLink)!=null&&s.state&&((l=(n=this._currentLink)==null?void 0:n.state)==null?void 0:l.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let s=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(s,n),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(e,t,r){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(r,t.text)}_fireUnderlineEvent(e,t){let r=e.range,s=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-s-1,r.end.x,r.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,t,r){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(r,t.text)}_linkAtPosition(e,t){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,n=t.y*this._bufferService.cols+t.x;return r<=n&&n<=s}_positionFromMouseEvent(e,t,r){let s=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,s,n){return{x1:e,y1:t,x2:r,y2:s,cols:this._bufferService.cols,fg:n}}};w0=pr([Ne(1,Zy),Ne(2,_a),Ne(3,ws),Ne(4,gM)],w0);function QZ(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var JZ=class extends qZ{constructor(e={}){super(e),this._linkifier=this._register(new yc),this.browser=OM,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new yc),this._onCursorMove=this._register(new Se),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Se),this.onKey=this._onKey.event,this._onRender=this._register(new Se),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Se),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Se),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Se),this.onBell=this._onBell.event,this._onFocus=this._register(new Se),this._onBlur=this._register(new Se),this._onA11yCharEmitter=this._register(new Se),this._onA11yTabEmitter=this._register(new Se),this._onWillOpen=this._register(new Se),this._setup(),this._decorationService=this._instantiationService.createInstance(YZ),this._instantiationService.setService(Td,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(HX),this._instantiationService.setService(gM,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Fx)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(ls.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ls.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ls.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ls.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Zt(()=>{var t,r;this._customKeyEventHandler=void 0,(r=(t=this.element)==null?void 0:t.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let r,s="";switch(t.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+t.index}switch(t.type){case 0:let n=Gt.toColorRGB(r==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${ve.ESC}]${s};${IZ(n)}${DM.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=Nr.toColor(...t.color));else{let l=r;this._themeService.modifyColors(c=>c[l]=Nr.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ym,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=t.getWidth(r),l=this._renderService.dimensions.css.cell.width*n,c=this.buffer.y*this._renderService.dimensions.css.cell.height,d=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=c+"px",this.textarea.style.width=l+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ge(this.element,"copy",t=>{this.hasSelection()&&sK(t,this._selectionService)}));let e=t=>iK(t,this.textarea,this.coreService,this.optionsService);this._register(Ge(this.textarea,"paste",e)),this._register(Ge(this.element,"paste",e)),BM?this._register(Ge(this.element,"mousedown",t=>{t.button===2&&q5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ge(this.element,"contextmenu",t=>{q5(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),nb&&this._register(Ge(this.element,"auxclick",t=>{t.button===1&&oM(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ge(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ge(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ge(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ge(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ge(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ge(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ge(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((n=this.element)==null?void 0:n.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ge(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",$x.get()),zM||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance($X,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(va,this._coreBrowserService),this._register(Ge(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ge(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(u0,this._document,this._helperContainer),this._instantiationService.setService(fp,this._charSizeService),this._themeService=this._instantiationService.createInstance(m0),this._instantiationService.setService(Tc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(vm),this._instantiationService.setService(pM,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(h0,this.rows,this.screenElement)),this._instantiationService.setService(_a,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o0,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(d0),this._instantiationService.setService(Zy,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(w0,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(n0,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(f0,this.element,this.screenElement,s)),this._instantiationService.setService(hK,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(ls.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(a0,this.screenElement)),this._register(Ge(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(ym,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(gm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c0,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function r(l){var h,v,g,x,y;let c=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!c)return!1;let d,m;switch(l.overrideType||l.type){case"mousemove":m=32,l.buttons===void 0?(d=3,l.button!==void 0&&(d=l.button<3?l.button:3)):d=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":m=0,d=l.button<3?l.button:3;break;case"mousedown":m=1,d=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let w=l.deltaY;if(w===0||e.coreMouseService.consumeWheelEvent(l,(x=(g=(v=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:v.device)==null?void 0:g.cell)==null?void 0:x.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;m=w<0?0:1,d=4;break;default:return!1}return m===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:d,action:m,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:l=>(r(l),l.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(l)),wheel:l=>(r(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&r(l)},mousemove:l=>{l.buttons||r(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?s.mousemove||(t.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),l&16?s.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),l&2?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),l&4?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ge(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return r(l),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(l)})),this._register(Ge(t,"wheel",l=>{var c,d,m,h,v;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(h=(m=(d=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:d.device)==null?void 0:m.cell)==null?void 0:h.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(l,!0);let g=ve.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(l,!0)}}},{passive:!1}))}refresh(e,t){var r;(r=this._renderService)==null||r.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){aM(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,r){this._selectionService.setSelection(e,t,r)}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 e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var r;(r=this._selectionService)==null||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=VZ(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===ve.ETX||r.key===ve.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let r=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(eQ(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var r;(r=this._charSizeService)==null||r.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Er));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[4;${r};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${n};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function eQ(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var tQ=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},rQ=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ei)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}},Ok=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new rQ(t)}getNullCell(){return new Ei}},sQ=class extends ot{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Se),this.onBufferChange=this._onBufferChange.event,this._normal=new Ok(this._core.buffers.normal,"normal"),this._alternate=new Ok(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)}},iQ=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,r=>t(r.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(r,s)=>t(r,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},nQ=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},aQ=["cols","rows"],pn=0,oQ=class extends ot{constructor(e){super(),this._core=this._register(new JZ(e)),this._addonManager=this._register(new tQ),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],r=(s,n)=>{this._checkReadonlyOptions(s),this._core.options[s]=n};for(let s in this._core.options){let n={get:t.bind(this,s),set:r.bind(this,s)};Object.defineProperty(this._publicOptions,s,n)}}_checkReadonlyOptions(e){if(aQ.includes(e))throw new Error(`Option "${e}" 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 iQ(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nQ(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 sQ(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
718
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return $x.get()},set promptLabel(e){$x.set(e)},get tooMuchOutput(){return Ux.get()},set tooMuchOutput(e){Ux.set(e)}}}_verifyIntegers(...e){for(pn of e)if(pn===1/0||isNaN(pn)||pn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(pn of e)if(pn&&(pn===1/0||isNaN(pn)||pn%1!==0||pn<0))throw new Error("This API only accepts positive integers")}};function Bk(e,t){if(typeof document>"u")return t;try{const r=document.createElement("span");r.style.color=`var(${e})`,r.style.position="absolute",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r);const s=getComputedStyle(r).color;return r.remove(),s||t}catch{return t}}function Pk(){const e=Bk("--card","#0b0b12"),t=Bk("--foreground","#e5e5ef"),r=typeof document<"u"&&document.documentElement.classList.contains("dark");return{background:e,foreground:t,cursor:"#a855f7",cursorAccent:e,selectionBackground:"#9333ea55",...r?{}:{black:t,white:"#3f3f46",brightWhite:t,brightBlack:"#a1a1aa"}}}function lQ(e,t){e.preventDefault(),window.open(t,"_blank","noopener,noreferrer")}function cQ(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;const r=t;return r.t==="opened"?{kind:"opened"}:r.t==="error"?{kind:"error",message:typeof r.message=="string"&&r.message.trim()?r.message:"Terminal bridge error"}:null}function KM(e){return e===1001||e===1006||e===1012||e===1013}function uQ(e,t,r){return!e&&t&&r.kind==="closed"&&(r.code===4404||KM(r.code))}function dQ(e){if(typeof e=="object"&&e!==null){const r=e.status;if(typeof r=="number"&&r>=500)return!0}const t=e instanceof Error?e.message:String(e);return/failed to fetch|fetch failed|load failed|network\s*error/i.test(t)}const hQ="\x1B[13;2u";function fQ(e){return e.key==="Enter"&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?hQ:null}const Ik=new TextEncoder,mQ=750,pQ=2048;function gQ(e,t){return t<mQ&&e<=pQ}function vQ(e){let t;try{t=new QY}catch{return null}t.onContextLoss(()=>t.dispose());try{e.loadAddon(t)}catch{return t.dispose(),null}return t}function _Q(e,t){var r;return t?((r=e.clipboardData)==null||r.setData("text/plain",t),e.preventDefault(),!0):!1}class xQ{constructor(t,r,s,n=!1){us(this,"term");us(this,"fit");us(this,"webgl");us(this,"listenerCtl");us(this,"resizeObserver");us(this,"ws",null);us(this,"dataDispose",null);us(this,"lastUserInputAt",0);us(this,"disposed",!1);us(this,"connectedOnce",!1);us(this,"connectionGeneration",0);us(this,"layoutVisible",!1);this.url=r,this.onState=s,this.readOnly=n,this.term=new oQ({fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,scrollback:2e4,cursorBlink:!0,theme:Pk(),minimumContrastRatio:4.5,macOptionClickForcesSelection:!0,allowProposedApi:!0,disableStdin:n}),this.fit=new dG,this.term.loadAddon(this.fit),this.term.loadAddon(new vG(lQ)),this.term.open(t),this.webgl=vQ(this.term),this.listenerCtl=new AbortController;const{signal:l}=this.listenerCtl;t.addEventListener("copy",c=>_Q(c,this.term.getSelection()),{capture:!0,signal:l}),this.onState({kind:"connecting"}),this.resizeObserver=new ResizeObserver(c=>{var h;if(this.disposed)return;const d=(h=c[0])==null?void 0:h.contentRect,m=!!d&&d.width>0&&d.height>0;if(this.layoutVisible=m,!this.connectedOnce&&!this.ws){m&&this.connect();return}m&&this.sendResize()}),this.resizeObserver.observe(t)}async connect(){var l;if(this.disposed)return;const t=++this.connectionGeneration;this.connectedOnce=!0;try{this.fit.fit()}catch{this.term.resize(80,24)}let r;try{if(r=typeof this.url=="function"?await this.url({cols:this.term.cols,rows:this.term.rows}):this.url,this.disposed||t!==this.connectionGeneration)return;const c=new URL(r);c.searchParams.set("cols",String(this.term.cols)),c.searchParams.set("rows",String(this.term.rows)),r=c.toString()}catch(c){if(this.disposed||t!==this.connectionGeneration)return;dQ(c)?this.onState({kind:"closed",code:1006,reason:"Terminal connection temporarily unavailable"}):this.onState({kind:"error",message:c instanceof Error?c.message:"Could not prepare terminal connection"});return}let s;try{s=new WebSocket(r)}catch(c){if(this.disposed||t!==this.connectionGeneration)return;this.onState({kind:"error",message:c instanceof Error?c.message:"Could not open terminal connection"});return}s.binaryType="arraybuffer",this.ws=s;let n=null;s.addEventListener("open",()=>{this.sendResize(),this.term.focus()},{signal:this.listenerCtl.signal}),s.addEventListener("message",c=>{if(c.data instanceof ArrayBuffer){this.writeOutput(new Uint8Array(c.data));return}if(typeof c.data!="string")return;const d=cQ(c.data);(d==null?void 0:d.kind)==="opened"?this.onState({kind:"connected"}):(d==null?void 0:d.kind)==="error"&&(n=d.message,this.onState({kind:"error",message:d.message}))},{signal:this.listenerCtl.signal}),s.addEventListener("close",c=>{var d;this.ws===s&&(this.ws=null,(d=this.dataDispose)==null||d.dispose(),this.dataDispose=null,!(n!==null&&c.code===4500)&&this.onState({kind:"closed",reason:c.reason||`code ${c.code}`,code:c.code}))},{signal:this.listenerCtl.signal}),s.addEventListener("error",()=>{this.ws===s&&this.onState({kind:"error",message:"Terminal WebSocket error"})},{signal:this.listenerCtl.signal}),(l=this.dataDispose)==null||l.dispose(),this.readOnly||(this.dataDispose=this.term.onData(c=>{this.lastUserInputAt=performance.now(),s.readyState===WebSocket.OPEN&&s.send(Ik.encode(c))}),this.term.attachCustomKeyEventHandler(c=>{const d=fQ(c);return d===null?!0:(c.type==="keydown"&&(c.preventDefault(),this.lastUserInputAt=performance.now(),s.readyState===WebSocket.OPEN&&s.send(Ik.encode(d))),!1)}))}setTheme(){this.term.options.theme=Pk()}focus(){this.term.focus()}reconnect({silent:t=!1}={}){var s;if(this.disposed)return;const r=this.ws;this.ws=null,(s=this.dataDispose)==null||s.dispose(),this.dataDispose=null;try{r==null||r.close()}catch{}this.onState({kind:t?"probing":"connecting"}),this.connect()}dispose(){var r,s;if(this.disposed)return;this.disposed=!0,this.connectionGeneration+=1,this.listenerCtl.abort(),this.resizeObserver.disconnect(),(r=this.dataDispose)==null||r.dispose();const t=this.ws;this.ws=null;try{t==null||t.close()}catch{}(s=this.webgl)==null||s.dispose(),this.term.dispose()}writeOutput(t){if(gQ(t.length,performance.now()-this.lastUserInputAt)){const r=this.term._core;if(typeof(r==null?void 0:r.writeSync)=="function")try{r.writeSync(t,1);return}catch{}}this.term.write(t)}sendResize(){if(!(this.readOnly||!this.layoutVisible||!this.ws||this.ws.readyState!==WebSocket.OPEN)){try{this.fit.fit()}catch{return}this.ws.send(JSON.stringify({t:"resize",cols:this.term.cols,rows:this.term.rows}))}}}const zk=[500,1e3,2e3,4e3,8e3],yQ=3e4;function bQ({sessionId:e,runtimeSelector:t,active:r,role:s="owner",setup:n}){const[l,c]=p.useState({kind:"connecting"}),[d,m]=p.useState(0),[h,v]=p.useState(!1),[g,x]=p.useState(!1),[y,w]=p.useState(null),S=p.useRef(0),k=p.useRef(null),C=p.useRef(null),E=p.useRef(r),N=`${t}\0${e}`,R=p.useRef(N);R.current=N;const{theme:T}=Vy(),P=p.useCallback(Y=>c(Y),[]);p.useEffect(()=>{var Y;(Y=C.current)==null||Y.setTheme()},[T]),p.useEffect(()=>{w(null),x(!1)},[N]);const z=p.useCallback(Y=>{if(Y===null)return;P({kind:"connecting"});let q=null,$=!1;return queueMicrotask(()=>{$||(q=new xQ(Y,({cols:M,rows:U})=>nU(t,e,{role:s,cols:M,rows:U,refreshCapability:!0}),P,s==="read-only"),C.current=q)}),()=>{$=!0,q==null||q.dispose(),C.current=null}},[e,t,s,P]);p.useEffect(()=>{if(l.kind==="connected"){k.current=Date.now(),v(!1);return}if(l.kind!=="closed")return;if(!KM(l.code)){v(!1);return}if(k.current!==null&&Date.now()-k.current>=yQ&&(S.current=0),k.current=null,S.current>=zk.length){v(!1);return}const Y=zk[S.current];S.current+=1,v(!0);let q=!1;const $=()=>{q||(q=!0,C.current?C.current.reconnect():m(W=>W+1))},M=window.setTimeout($,Y),U=()=>{document.visibilityState==="visible"&&$()};return document.addEventListener("visibilitychange",U),()=>{window.clearTimeout(M),document.removeEventListener("visibilitychange",U)}},[l]);const B=p.useCallback(()=>{S.current=0,k.current=null,v(!1),C.current?C.current.reconnect():m(Y=>Y+1)},[]);p.useEffect(()=>{var q,$;const Y=E.current;E.current=r,!Y&&r&&((q=C.current)==null||q.focus()),uQ(Y,r,l)&&(S.current=0,k.current=null,v(!1),($=C.current)==null||$.reconnect({silent:l.kind==="closed"&&l.code===4404}))},[r,l]);const F=p.useCallback(async()=>{if(g)return;const Y=N;x(!0),w(null);try{if(await pe.startSessionTerminal(t,e),R.current!==Y)return;B()}catch(q){if(R.current!==Y)return;w(q instanceof Error?q.message:"Could not start terminal")}finally{R.current===Y&&x(!1)}},[B,t,e,g,N]);return o.jsxs("div",{"data-state":l.kind,className:"flex min-h-0 flex-1 flex-col overflow-hidden bg-[var(--card)]",children:[o.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden p-1",children:[o.jsx("div",{ref:z,className:"h-full w-full overflow-hidden"},d),l.kind!=="connected"&&o.jsx(CQ,{state:l,reconnectPending:h,startingTerminal:g,startError:y,onRetry:B,onStartTerminal:()=>void F(),setup:n,readOnly:s==="read-only"})]}),o.jsx("div",{className:"flex min-h-8 shrink-0 select-none items-center gap-2 px-2 font-mono text-[10px] text-[var(--muted-foreground)]/70",children:o.jsx("span",{className:"min-w-0 flex-1 truncate px-2",children:SQ(wQ())})})]})}function wQ(){if(typeof navigator>"u")return!1;const e=navigator.userAgentData,t=(e==null?void 0:e.platform)??navigator.platform??"";return/mac/i.test(t)}function SQ(e){return e?"Hold ⌥ and drag to select · ⌘C to copy":"Hold Shift and drag to select · right-click to copy"}function CQ({state:e,reconnectPending:t,startingTerminal:r,startError:s,onRetry:n,onStartTerminal:l,setup:c,readOnly:d}){return o.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[var(--background)]/85 text-sm text-[var(--foreground)] backdrop-blur-[1px]",children:[e.kind==="connecting"&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Le,{className:"size-4 animate-spin"}),"Connecting…"]}),e.kind==="closed"&&t&&o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(Le,{className:"size-4 animate-spin"}),"Reconnecting…"]}),e.kind==="closed"&&!t&&(e.code===4404?o.jsx(kQ,{starting:r,error:s,onStart:l,setup:c,readOnly:d}):o.jsx($k,{message:e.reason||"Terminal connection closed",onRetry:n})),e.kind==="probing"&&o.jsxs("span",{className:"flex items-center gap-2 text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 animate-spin"}),"Checking terminal…"]}),e.kind==="error"&&o.jsx($k,{message:e.message,onRetry:n})]})}function kQ({starting:e,error:t,onStart:r,setup:s,readOnly:n}){const l=(s==null?void 0:s.target)??"Provider",c=(s==null?void 0:s.kind)==="delivery_unknown"?"Task delivery needs confirmation":(s==null?void 0:s.kind)==="required"?`${l} needs setup`:"Terminal is not running",d=(s==null?void 0:s.kind)==="delivery_unknown"?"Rynx could not confirm whether the queued task was accepted. Open the terminal and check its history before retrying.":(s==null?void 0:s.kind)==="required"?s.taskQueued?`Complete login or first-run setup. The queued task will start automatically when ${l} is ready.`:s.reason??`Complete ${l} login or first-run setup before starting this Session.`:"Start it when you need terminal access for this Session.",m=(s==null?void 0:s.kind)==="required"?`Open ${l} setup`:"Start terminal";return o.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[o.jsxs("div",{className:"grid gap-1",children:[o.jsx("span",{className:"font-medium",children:c}),o.jsx("span",{className:"text-[var(--muted-foreground)]",children:d})]}),t&&o.jsx("span",{className:"text-[var(--destructive)]",children:t}),!n&&o.jsxs(re,{variant:"outline",size:"sm",disabled:e,onClick:r,children:[e?o.jsx(Le,{className:"animate-spin"}):o.jsx(O6,{}),e?"Opening…":m]})]})}function $k({message:e,onRetry:t}){return o.jsxs("div",{className:"grid max-w-sm place-items-center gap-3 px-6 text-center",children:[o.jsx("span",{className:"text-[var(--muted-foreground)]",children:e}),o.jsxs(re,{variant:"outline",size:"sm",onClick:t,children:[o.jsx(yt,{})," Retry"]})]})}function EQ(e,t){return`${e}\0${t}`}function Uk(e,t){return[...e.filter(s=>s.runtimeSelector===t.runtimeSelector&&s.key!==t.key),t].slice(-8)}function RQ({selected:e,slot:t,visible:r}){const[s,n]=p.useState([]),[l,c]=p.useState(null);p.useEffect(()=>{e&&n(m=>{const h=m[m.length-1];return h&&NQ(h,e)?m:Uk(m,e)})},[e]);const d=e?Uk(s,e):s;return o.jsxs(o.Fragment,{children:[o.jsx("div",{ref:c,className:"pointer-events-none invisible absolute inset-0 min-h-0 min-w-0 overflow-hidden","aria-hidden":"true"}),d.map(m=>o.jsx(jQ,{entry:m,parkingHost:l,slot:(e==null?void 0:e.key)===m.key?t:null,visible:(e==null?void 0:e.key)===m.key&&r},m.key))]})}function NQ(e,t){var r,s,n,l,c,d;return e.key===t.key&&e.runtimeSelector===t.runtimeSelector&&e.sessionId===t.sessionId&&e.readOnly===t.readOnly&&((r=e.setup)==null?void 0:r.kind)===((s=t.setup)==null?void 0:s.kind)&&((n=e.setup)==null?void 0:n.target)===((l=t.setup)==null?void 0:l.target)&&(((c=e.setup)==null?void 0:c.kind)!=="required"||((d=t.setup)==null?void 0:d.kind)!=="required"||e.setup.taskQueued===t.setup.taskQueued&&e.setup.reason===t.setup.reason)}function jQ({entry:e,parkingHost:t,slot:r,visible:s}){const n=p.useRef(null);if(n.current===null&&typeof document<"u"){const c=document.createElement("div");c.className="flex h-full min-h-0 w-full min-w-0 flex-col",c.dataset.warmTerminal=e.key,n.current=c}p.useLayoutEffect(()=>{const c=n.current,d=r??t;if(!(!c||!d))return d.appendChild(c),()=>c.remove()},[t,r]);const l=n.current;return l?ha.createPortal(o.jsx(bQ,{sessionId:e.sessionId,runtimeSelector:e.runtimeSelector,active:s,role:e.readOnly?"read-only":"owner",setup:e.setup}),l,e.key):null}function U_(){const e=hl(),t=(e==null?void 0:e.access)==="read_only",r=(e==null?void 0:e.scope)==="single_session"?e.sessionId:void 0,s=!!r,n=mo(),{sessionId:l}=fE(),{runtimeSelector:c,selectedRuntime:d}=jc(),{status:m,operation:h}=Oy(),v=kF(m,h),[g,x]=p.useState([]),[y,w]=p.useState({providers:[],agents:[]}),[S,k]=p.useState(null),[C,E]=p.useState({permissionPreset:"default"}),[N,R]=p.useState([]),[T,P]=p.useState(null),[z,B]=p.useState(!0),[F,Y]=p.useState(!0),[q,$]=p.useState(),[M,U]=p.useState(),[W,A]=p.useState(),[O,L]=p.useState(!0),[G,H]=p.useState(!1),[D,V]=p.useState(!1),[X,J]=p.useState(null),[se,de]=p.useState(null),[Z,ce]=p.useState(!1),[le,we]=p.useState(),[Ee,Re]=p.useState(),te=p.useRef(!1),ie=p.useRef(0),ke=p.useRef(0),Ke=p.useRef(0),_e=p.useRef(0),ye=p.useRef(void 0),Ie=p.useRef(c),ze=p.useRef(c),pt=p.useRef(v);pt.current=v;const rt=p.useRef({selector:c});rt.current.selector!==c&&(rt.current={selector:c});const $e=rt.current,He=r??l??null,Nt=p.useRef(He);p.useEffect(()=>{!r||l===r||n(Ps(Wo(c,r)),{replace:!0})},[n,c,l,r]),p.useEffect(()=>()=>{_e.current+=1},[]),p.useEffect(()=>{Nt.current!==He&&(Nt.current=He,_e.current+=1)},[He]);const Ct=p.useCallback(async(Te=!1)=>{if(pt.current)return;const Ve=++ie.current;Te&&L(!0);try{const Qe=await pe.listSessions(c);if(ie.current!==Ve)return;Ie.current=c,x(Qe),A(void 0)}catch(Qe){if(ie.current!==Ve||pt.current)return;A(`Could not load sessions: ${Qe.message}`)}finally{ie.current===Ve&&L(!1)}},[c]);p.useEffect(()=>{ze.current!==c&&(ze.current=c,ye.current=void 0,Ke.current+=1,ie.current+=1,x([]),R([]),P(null),U(void 0),Y(!0),A(void 0),L(!0))},[c]);const gs=p.useCallback(async()=>{if(e){R([]),P(null),U(void 0),Y(!1);return}if(pt.current)return;const Te=++Ke.current;Y(!0),U(void 0);try{const Ve=await pe.listProjects(c);if(Ke.current!==Te)return;R(Ve),P(Qe=>Qe&&Ve.some(sr=>sr.id===Qe)?Qe:null)}catch(Ve){if(Ke.current!==Te||pt.current)return;R([]),P(null),U(`Could not load projects: ${Ve.message}`)}finally{Ke.current===Te&&Y(!1)}},[e,t,c]);p.useEffect(()=>{if(v){ie.current+=1,A(void 0),L(!1);return}Ct(!0);const Te=setInterval(()=>void Ct(),4e3);return()=>clearInterval(Te)},[Ct,v]);const cs=p.useCallback(async()=>{if(e){w({providers:[],agents:[]}),k(null),$(void 0),B(!1);return}if(pt.current)return;const Te=++ke.current;B(!0),$(void 0);try{let Ve;try{Ve=await pe.listSessionLaunchOptions(c)}catch(es){if(!(es instanceof aa)||es.code!=="incompatible"&&es.code!=="method_not_found")throw es;Ve=OF(await pe.listSessionAgentOptions(c))}if(ke.current!==Te)return;const Qe=TF(c,typeof window>"u"?void 0:window.localStorage),sr=AF(Ve,Qe);w(Ve),k(sr),E(j2(sr,Ve))}catch(Ve){if(ke.current!==Te||pt.current)return;w({providers:[],agents:[]}),k(null),E({permissionPreset:"default"}),$(`Could not load launch options: ${Ve.message}`)}finally{ke.current===Te&&B(!1)}},[e,t,c]);p.useEffect(()=>{if(v){ke.current+=1,$(void 0),B(!1);return}return w({providers:[],agents:[]}),k(null),E({permissionPreset:"default"}),B(!0),$(void 0),V(!1),we(void 0),Re(void 0),cs(),()=>{ke.current+=1}},[cs,v]),p.useEffect(()=>{if(v){Ke.current+=1,U(void 0),Y(!1);return}return R([]),P(null),Y(!0),U(void 0),gs(),()=>{Ke.current+=1}},[gs,v]);const gr=p.useCallback(async Te=>{var Qt,Cs;if(te.current)return!1;const Ve=Te.text,Qe=S;if(!Qe)return $("Choose a provider or Agent before starting."),!1;const sr=Sx(Qe,y);if(!sr)return $("Choose a provider or Agent before starting."),!1;const es=!sr.ready&&sr.readiness!=="unverified";if(es&&Te.attachments.length>0)return $(`${sr.name} must finish login or first-run setup before starting with files.`),!1;const lt=rt.current,vr=d.displayName,qe=++_e.current,Et=LF(Ve||((Qt=Te.attachments[0])==null?void 0:Qt.file.name)||"File");let Ft;te.current=!0,ce(!0),$(void 0);try{const st=ye.current,It=st&&st.selector===lt.selector&&st.selection.kind===Qe.kind&&st.selection.id===Qe.id&&st.projectId===T&&st.configuration.model===C.model&&st.configuration.reasoningEffort===C.reasoningEffort&&st.configuration.permissionPreset===C.permissionPreset?st.sessionId:(await pe.createSession(DF(Qe,Et,T??void 0,C),lt.selector)).sessionId;if(Ft=It,ye.current={selector:lt.selector,selection:Qe,projectId:T,configuration:{...C},sessionId:It},!es&&Te.attachments.length===0){const _r=new Date().toISOString(),$t=Qe.kind==="agent"?(Cs=y.agents.find(nn=>nn.id===Qe.id))==null?void 0:Cs.runtime:void 0,ct=Qe.kind==="provider"?Qe.id:AQ($t)?$t:void 0,Ii={id:It,...ct?{provider:ct}:{},title:Et,status:"running",createdAt:_r,updatedAt:_r,source:"console"};return Ie.current=lt.selector,x(nn=>[Ii,...nn.filter(pl=>pl.id!==It)]),Re({sessionId:It,message:Ve,started:!1}),V(!1),ye.current=void 0,n(Ps(Wo(lt.selector,It))),!0}let zt,nr=!1,Pi=!1;if(es)try{await pe.enqueueSessionMessage(lt.selector,It,Ve),nr=!0}catch(_r){zt=_r}else try{if(!(await pe.getSessionResourcePolicy(lt.selector,It)).enabled)throw new aa("Session file resources are unavailable on this Runtime",409,"failed_precondition","not_started");const $t=await Promise.all(Te.attachments.map(ct=>pe.uploadSessionResource(lt.selector,It,ct.file,ct.clientUploadId,ct.type)));Pi=!0,await pe.sendSessionMessage(It,{content:[...$t.map(ct=>ct.type==="input_image"?{type:ct.type,resourceId:ct.resourceId,mediaType:ct.mediaType,filename:ct.filename,byteLength:ct.byteLength,width:ct.width,height:ct.height}:{type:ct.type,resourceId:ct.resourceId,mediaType:ct.mediaType,filename:ct.filename,byteLength:ct.byteLength}),...Ve?[{type:"input_text",text:Ve}]:[]],clientMessageId:Te.clientMessageId},()=>{},void 0,lt.selector)}catch(_r){zt=_r}const ar=!!(!nr&&(Te.attachments.length>0&&!Pi&&zt||ip(zt)));if(rt.current!==lt)return ye.current=void 0,zt?ar?me.error(`Session created on ${vr}, but the first message was not sent: ${zt.message}`):me.warning(`Session created on ${vr}, but message delivery is unknown. Check its history before retrying.`):me.success(`Session started on ${vr}; switch back to view it.`),!0;if(_e.current!==qe)return ye.current=void 0,zt?ar?me.error(`Session created on ${vr}, but the first message was not sent. Open it to retry.`):me.warning(`Session created on ${vr}, but message delivery is unknown. Check its history before retrying.`):me.success(`Session started on ${vr} in the background.`),!0;if(Te.attachments.length>0&&ar)return $(`Session created, but the first file message was not sent: ${zt.message}. Retry will reuse this Session.`),Ct(),!1;const Dn=new Date().toISOString(),bo={id:It,...Qe.kind==="provider"?{provider:Qe.id}:{agent:Qe.id},title:Et,status:ar?"idle":"running",createdAt:Dn,updatedAt:Dn,source:"console",...nr?{setupStatus:"waiting_for_provider"}:{}};return Ie.current=lt.selector,x(_r=>[bo,..._r.filter($t=>$t.id!==It)]),we(ar?{sessionId:It,message:Ve}:void 0),V(!1),ye.current=void 0,n(Ps(nr?`${Wo(lt.selector,It)}?view=terminal`:Wo(lt.selector,It))),Ct(),nr?me.info(`${sr.name} needs setup. The task is queued and will start automatically when the Provider is ready.`):zt&&(ar?me.error(`Session created, but the first message was not sent: ${zt.message}`):me.warning("Session created, but message delivery is unknown. Check its history before retrying.")),!0}catch(st){const ir=st instanceof aa&&st.outcome==="unknown",It=Ft?`Session created, but its first message was not sent: ${st.message}. Retry will reuse this Session.`:ir?"Session creation outcome is unknown. Check the Session list before retrying.":`Could not start session: ${st.message}`;return rt.current===lt&&_e.current===qe?$(It):ir?me.warning(`Session creation on ${vr} may have succeeded. Check its Session list before retrying.`):me.error(`Could not start Session on ${vr}: ${st.message}`),!Ft&&ir?(ye.current=void 0,!0):!1}finally{te.current=!1,ce(!1)}},[y,C,S,n,T,Ct,d.displayName]),kt=Ie.current===c?g:[],Fe=kt.find(Te=>Te.id===He)??null,jt=Fe?Sx(Fe.provider?{kind:"provider",id:Fe.provider}:Fe.agent?{kind:"agent",id:Fe.agent}:null,y):null,zs=(Fe==null?void 0:Fe.setupStatus)==="delivery_unknown"?{kind:"delivery_unknown",target:(jt==null?void 0:jt.name)??(Fe.provider?ud(Fe.provider):Fe.agent)}:Fe&&(Fe.setupStatus==="waiting_for_provider"||(jt==null?void 0:jt.ready)===!1)?{kind:"required",target:(jt==null?void 0:jt.name)??(Fe.provider?ud(Fe.provider):Fe.agent),taskQueued:Fe.setupStatus==="waiting_for_provider",...jt!=null&&jt.reason?{reason:jt.reason}:{}}:void 0;p.useEffect(()=>{(le==null?void 0:le.sessionId)===(Fe==null?void 0:Fe.id)&&we(void 0)},[le,Fe==null?void 0:Fe.id]);const Mr=Fe&&!s?o.jsxs("div",{className:Pe("flex shrink-0 items-center gap-1",G&&"desktop-macos-titlebar-leading-inset"),children:[o.jsx(re,{variant:"ghost",size:"icon",className:"size-10 md:hidden",title:"Back to sessions","aria-label":"Back to sessions",onClick:()=>{V(!0),n(Ps(to(c)),{replace:!0})},children:o.jsx(tl,{})}),G&&o.jsx(re,{variant:"ghost",size:"icon-sm",className:"-ml-1 hidden md:inline-flex",title:"Show session list","aria-label":"Show session list",onClick:()=>H(!1),children:o.jsx(NE,{className:"size-3.5"})})]}):void 0,vs=p.useCallback((Te,Ve)=>{de(Qe=>Ve?Te:Qe===Te?null:Qe)},[]),Ht=Fe?{key:EQ(c,Fe.id),runtimeSelector:c,sessionId:Fe.id,readOnly:!!t,setup:zs}:null;return o.jsxs("div",{className:Pe("grid h-full min-h-0 min-w-0 bg-[var(--background)]",s||G?"grid-cols-[minmax(0,1fr)]":"md:grid-cols-[14rem_minmax(0,1fr)]"),children:[!s&&!G&&o.jsx("div",{className:Pe("min-h-0 min-w-0 border-r border-[var(--border)]",(!D||Fe)&&"hidden md:block"),children:o.jsx(tG,{sessions:kt,runtimeSelector:c,runtimeLabel:d.displayName,listError:W,loading:O,selectedId:He,readOnly:!!e,onCollapsedChange:H,onSelect:Te=>{_e.current+=1,ye.current=void 0,V(!1),we(void 0),n(Ps(Wo(c,Te)))},onNew:()=>{_e.current+=1,ye.current=void 0,V(!1),we(void 0),Re(void 0),n(Ps(to(c)))},onRetry:()=>void Ct(!0),onFork:async Te=>{try{const Ve=await pe.forkSession(c,Te,{operationId:`web_${crypto.randomUUID()}`});if(rt.current!==$e)return;await Ct(),V(!1),n(Ps(Wo(c,Ve.sessionId))),me.success("Session forked")}catch(Ve){me.error(`Fork session failed: ${Ve instanceof Error?Ve.message:String(Ve)}`)}},onDeleted:Te=>{rt.current===$e&&(He===Te&&n(Ps(to(c)),{replace:!0}),Ct())}},c)}),o.jsxs("div",{className:"relative min-h-0 min-w-0 overflow-hidden",children:[Fe?o.jsx(KV,{session:Fe,runtimeSelector:c,readOnly:t,leadingControls:Mr,initialDraft:(le==null?void 0:le.sessionId)===Fe.id?le.message:void 0,initialMessage:(Ee==null?void 0:Ee.sessionId)===Fe.id?Ee.message:void 0,sendInitialMessage:(Ee==null?void 0:Ee.sessionId)===Fe.id&&!Ee.started,onInitialMessageStarted:()=>{Re(Te=>(Te==null?void 0:Te.sessionId)===Fe.id?{...Te,started:!0}:Te)},onInitialMessageConsumed:()=>{Re(Te=>(Te==null?void 0:Te.sessionId)===Fe.id?void 0:Te)},onInitialMessageFailed:Te=>{Re(Ve=>(Ve==null?void 0:Ve.sessionId)===Fe.id?void 0:Ve),we({sessionId:Fe.id,message:Te})},terminalSlotRef:J,onTerminalActiveChange:vs},`${c}:${Fe.id}`):He&&O?o.jsx("div",{className:"grid h-full min-h-0 min-w-0 place-items-center",role:"status","aria-live":"polite",children:o.jsxs("span",{className:"flex items-center gap-2 text-sm text-[var(--muted-foreground)]",children:[o.jsx(Le,{className:"size-4 animate-spin"})," Loading session…"]})}):e?o.jsx("div",{className:"grid h-full min-h-0 min-w-0 place-items-center px-6 text-center text-sm text-[var(--muted-foreground)]",children:He?"Session not found.":"Choose a Session from the list."}):o.jsx("div",{className:Pe("h-full min-h-0 min-w-0",D&&!G&&"hidden md:block"),children:o.jsx(nG,{runtimeLabel:d.displayName,options:y,selection:S,configuration:C,projects:N,projectId:T,loading:z,projectsLoading:F,submitting:Z,error:q??W??(He?"Session not found. Start a new session or choose another from the list.":void 0),projectError:M,listCollapsed:G,onShowSessions:()=>{_e.current+=1,H(!1),V(!0)},onRetryOptions:()=>{cs()},onSelectionChange:Te=>{ye.current=void 0,k(Te),E(Ve=>j2(Te,y,Ve.permissionPreset)),$(void 0),MF(c,typeof window>"u"?void 0:window.localStorage,Te)},onConfigurationChange:Te=>{ye.current=void 0,E(Te),$(void 0)},onProjectChange:Te=>{ye.current=void 0,P(Te),$(void 0)},onNewProject:()=>{n(xt.projects,{state:{returnTo:to(c),createProject:!0}})},onSubmit:gr},c)}),o.jsx(RQ,{selected:Ht,slot:X,visible:se===(Fe==null?void 0:Fe.id)})]})]})}function AQ(e){return e==="codex"||e==="claude"||e==="traex"}function TQ(){const[e,t]=p.useState(null),[r,s]=p.useState(""),[n,l]=p.useState(null),[c,d]=p.useState(!1),[m,h]=p.useState(""),[v,g]=p.useState(""),[x,y]=p.useState(!1),[w,S]=p.useState(!1),[k,C]=p.useState(!1);async function E(){try{const R=await pe.listSkills();t(R),s(T=>{var P;return R.some(z=>z.name===T)?T:((P=R[0])==null?void 0:P.name)??""})}catch(R){t([]),me.error(`Failed to load Skills: ${R.message}`)}}p.useEffect(()=>{E()},[]),p.useEffect(()=>{if(!r){l(null);return}let R=!1;return d(!0),pe.getSkill(r).then(T=>{var P;R||(l(T),h(((P=T.files.find(z=>z.path==="SKILL.md")??T.files[0])==null?void 0:P.path)??""))}).catch(T=>!R&&me.error(`Load Skill failed: ${T.message}`)).finally(()=>!R&&d(!1)),()=>{R=!0}},[r]),p.useEffect(()=>{if(!r||!m){g("");return}let R=!1;return y(!0),pe.readSkillFile(r,m).then(T=>!R&&g(T.content)).catch(T=>!R&&g(`⚠ ${T.message}`)).finally(()=>!R&&y(!1)),()=>{R=!0}},[m,r]);const N=(e==null?void 0:e.filter(R=>{var P;const T=((P=R.ref)==null?void 0:P.install.tool)==="skills-cli"?R.ref.install.source:"";return T.includes("/artifacts/skills/")||T.includes("\\artifacts\\skills\\")}).length)??0;return o.jsxs("div",{className:"grid gap-5",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-semibold",children:"Skills"}),o.jsxs("p",{className:"mt-1 text-sm text-[var(--muted-foreground)]",children:["Local catalog discovered from ",o.jsx("code",{children:"~/.rynx/skills"}),"."]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(re,{variant:"outline",onClick:()=>void E(),children:[o.jsx(yt,{})," Refresh"]}),o.jsx(eT,{onInstalled:R=>{var T;t(R),s(((T=R[0])==null?void 0:T.name)??"")},triggerLabel:"From URL",triggerVariant:"outline"}),o.jsxs(re,{variant:"outline",onClick:()=>C(!0),children:[o.jsx(CE,{})," From ZIP"]}),o.jsxs(re,{onClick:()=>S(!0),children:[o.jsx(w6,{})," From runtime"]})]})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[o.jsx(H_,{label:"skills",value:(e==null?void 0:e.length)??0,detail:"Registered catalog entries"}),o.jsx(H_,{label:"local imports",value:N,detail:"Immutable runtime copies"}),o.jsx(H_,{label:"selectable",value:(e==null?void 0:e.filter(R=>R.ref).length)??0,detail:"Skills with a valid receipt"})]}),o.jsxs("div",{className:"grid min-h-[640px] gap-4 lg:grid-cols-[320px_minmax(0,1fr)]",children:[o.jsxs(Mt,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-4 py-3",children:[o.jsx("h2",{className:"text-sm font-semibold",children:"Skill list"}),o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:(e==null?void 0:e.length)??0})]}),o.jsxs("div",{className:"grid gap-2 p-2",children:[e===null&&o.jsx("div",{className:"px-3 py-6 text-sm text-[var(--muted-foreground)]",children:"Loading Skills…"}),(e==null?void 0:e.length)===0&&o.jsx("div",{className:"rounded-lg border border-dashed border-[var(--border)] px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"No local Skills registered yet."}),e==null?void 0:e.map(R=>o.jsxs("button",{type:"button",onClick:()=>s(R.name),className:Pe("flex w-full items-start gap-3 rounded-lg border px-3 py-3 text-left transition-colors",r===R.name?"border-[var(--primary)] bg-[var(--primary)]/10":"border-[var(--border)] hover:bg-[var(--muted)]/45"),children:[o.jsx("span",{className:"grid size-9 shrink-0 place-items-center rounded-md bg-amber-500/10 text-amber-600",children:o.jsx(xd,{className:"size-4"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"truncate font-mono text-sm font-semibold",children:R.name}),r===R.name&&o.jsx(po,{className:"size-4 shrink-0 text-[var(--primary)]"})]}),o.jsx("span",{className:"mt-1 block line-clamp-2 text-xs text-[var(--muted-foreground)]",children:R.description}),o.jsx("span",{className:"mt-2 inline-block rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:R.ref?XM(R):"receipt-less"})]})]},R.name))]})]}),o.jsx(DQ,{detail:n,loading:c,activeFile:m,onSelectFile:h,fileContent:v,fileLoading:x,onDeleted:E})]}),o.jsx(LQ,{open:w,onOpenChange:S,onImported:async R=>{await E(),R&&s(R)}}),o.jsx(MQ,{open:k,onOpenChange:C,onImported:async R=>{await E(),R&&s(R)}})]})}function MQ({open:e,onOpenChange:t,onImported:r}){const[s,n]=p.useState(null),[l,c]=p.useState(!1),[d,m]=p.useState([]),h=s&&(!s.name.toLowerCase().endsWith(".zip")||s.size>20*1024*1024);async function v(){var g;if(!(!s||h)){c(!0),m([]);try{const x=await pe.importSkillArchive(s.name,await PQ(s));m(x);const y=(g=x.find(w=>w.status==="created"||w.status==="updated"))==null?void 0:g.name;await r(y)}catch(x){me.error(`Import ZIP failed: ${x.message}`)}finally{c(!1)}}}return o.jsx(sn,{open:e,onOpenChange:g=>{t(g),g||(n(null),m([]))},children:o.jsxs(Di,{className:"sm:max-w-xl",children:[o.jsx(An,{children:o.jsx(Li,{children:"Import Skills from ZIP"})}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("label",{className:"grid cursor-pointer place-items-center gap-2 rounded-lg border border-dashed border-[var(--border)] px-4 py-8 text-center hover:bg-[var(--muted)]/30",children:[o.jsx("input",{type:"file",accept:".zip,application/zip",className:"sr-only",onChange:g=>{var x;n(((x=g.target.files)==null?void 0:x[0])??null),m([])}}),o.jsx(CE,{className:"size-6 text-[var(--primary)]"}),o.jsx("span",{className:"text-sm font-medium",children:(s==null?void 0:s.name)??"Choose a .zip archive"}),o.jsx("span",{className:"text-xs text-[var(--muted-foreground)]",children:"One Skill at the root or multiple Skill directories, up to 20 MB."})]}),h&&o.jsx("div",{className:"text-xs text-[var(--destructive)]",children:"Choose a .zip archive no larger than 20 MB."}),d.length>0&&o.jsx(BQ,{results:d})]}),o.jsxs(ma,{children:[o.jsx(re,{variant:"outline",onClick:()=>t(!1),children:"Done"}),o.jsx(re,{disabled:!s||!!h||l,onClick:()=>void v(),children:l?"Importing…":"Import"})]})]})})}function DQ({detail:e,loading:t,activeFile:r,onSelectFile:s,fileContent:n,fileLoading:l,onDeleted:c}){var m;if(t||!e)return o.jsx(Mt,{className:"p-6 text-sm text-[var(--muted-foreground)]",children:t?"Loading Skill…":"Select a Skill to inspect its files."});const d=RW((m=e.ref)==null?void 0:m.install);return o.jsxs(Mt,{className:"overflow-hidden",children:[o.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-5 py-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h2",{className:"font-mono text-lg font-semibold",children:e.name}),o.jsx("span",{className:"rounded bg-[var(--muted)] px-2 py-1 text-[10px] text-[var(--muted-foreground)]",children:XM(e)})]}),o.jsx("p",{className:"mt-2 text-sm text-[var(--muted-foreground)]",children:e.description}),d.source&&o.jsx("div",{className:"mt-2 max-w-2xl truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:d.source})]}),o.jsx(OQ,{name:e.name,onDeleted:c})]}),o.jsxs("div",{className:"grid min-h-[500px] lg:grid-cols-[240px_minmax(0,1fr)]",children:[o.jsxs("div",{className:"border-b border-[var(--border)] p-3 lg:border-b-0 lg:border-r",children:[o.jsxs("div",{className:"label-caps mb-2 px-1 text-[10px] text-[var(--muted-foreground)]",children:["files · ",e.files.length]}),o.jsx("div",{className:"grid gap-1",children:e.files.map(h=>o.jsxs("button",{onClick:()=>s(h.path),className:Pe("flex items-center gap-2 rounded-md px-2 py-2 text-left text-xs",r===h.path?"bg-[var(--primary)]/10 text-[var(--primary)]":"hover:bg-[var(--muted)]/50"),children:[o.jsx(xd,{className:"size-3.5 shrink-0"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:h.path}),o.jsx("span",{className:"text-[10px] text-[var(--muted-foreground)]",children:IQ(h.size)})]},h.path))})]}),o.jsxs("div",{className:"min-w-0 p-4",children:[o.jsx("div",{className:"mb-3 truncate font-mono text-xs text-[var(--muted-foreground)]",children:r||"No file selected"}),o.jsx("pre",{className:"min-h-[440px] overflow-auto whitespace-pre-wrap break-words rounded-lg border border-[var(--border)] bg-[var(--muted)]/25 p-4 font-mono text-xs leading-5",children:l?"Loading…":n})]})]})]})}function LQ({open:e,onOpenChange:t,onImported:r}){const[s,n]=p.useState([]),[l,c]=p.useState(""),[d,m]=p.useState([]),[h,v]=p.useState(new Set),[g,x]=p.useState(!1),[y,w]=p.useState(!1),[S,k]=p.useState([]);p.useEffect(()=>{if(!e)return;let T=!1;return pe.listAgentRuntimeOptions().then(P=>{if(T)return;n(P);const z=P.find(B=>B.available)??P[0];c((z==null?void 0:z.id)??"")}).catch(P=>!T&&me.error(`Load runtimes failed: ${P.message}`)),()=>{T=!0}},[e]);function C(){m([]),v(new Set),k([]),x(!1),w(!1)}async function E(){if(l){x(!0),m([]),v(new Set),k([]);try{const T=await pe.scanLocalSkills(l);m(T)}catch(T){me.error(`Scan local Skills failed: ${T.message}`)}finally{x(!1)}}}async function N(){var T;if(!(!l||h.size===0)){w(!0);try{const P=await pe.importLocalSkills(l,[...h]);k(P);const z=(T=P.find(B=>B.status==="created"||B.status==="updated"))==null?void 0:T.name;await r(z),me.success(`Local Skill import finished: ${P.filter(B=>B.status==="created"||B.status==="updated").length} changed`)}catch(P){me.error(`Import local Skills failed: ${P.message}`)}finally{w(!1)}}}const R=d.length>0&&d.every(T=>h.has(T.key));return o.jsx(sn,{open:e,onOpenChange:T=>{t(T),T||C()},children:o.jsxs(Di,{className:"sm:max-w-3xl",children:[o.jsx(An,{children:o.jsx(Li,{children:"Import Skills from a local runtime"})}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]",children:[o.jsxs(Cn,{value:l,onValueChange:T=>{c(T),C()},disabled:s.length===0,children:[o.jsx(Yi,{children:o.jsx(Gi,{placeholder:"No local runtime found"})}),o.jsx(Ki,{children:s.map(T=>o.jsxs(fr,{value:T.id,children:[T.name,T.version?` · ${T.version}`:"",T.available?"":" · CLI missing"]},T.id))})]}),o.jsxs(re,{variant:"outline",disabled:!l||g,onClick:()=>void E(),children:[o.jsx(yt,{className:g?"animate-spin":""})," Scan"]}),o.jsxs(re,{variant:"outline",disabled:d.length===0,onClick:()=>v(R?new Set:new Set(d.map(T=>T.key))),children:[o.jsx(Ar,{})," ",R?"Clear":"All"]})]}),o.jsxs("div",{className:"max-h-80 overflow-y-auto rounded-lg border border-[var(--border)]",children:[g&&o.jsx("div",{className:"px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"Scanning local runtime Skill roots…"}),!g&&d.length===0&&o.jsx("div",{className:"px-4 py-6 text-sm text-[var(--muted-foreground)]",children:"Choose a runtime family and click Scan. The local Skill directory can be scanned even when its CLI is missing."}),!g&&d.map(T=>o.jsxs("label",{className:"flex cursor-pointer items-start gap-3 border-b border-[var(--border)] px-4 py-3 last:border-0 hover:bg-[var(--muted)]/40",children:[o.jsx("input",{type:"checkbox",className:"mt-1 size-4",checked:h.has(T.key),onChange:()=>v(P=>{const z=new Set(P);return z.has(T.key)?z.delete(T.key):z.add(T.key),z})}),o.jsx(GO,{className:"mt-0.5 size-4 shrink-0 text-[var(--primary)]"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"font-mono text-sm font-medium",children:T.name}),o.jsx("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:T.root}),o.jsxs("span",{className:"rounded bg-[var(--muted)] px-1.5 py-1 text-[10px] text-[var(--muted-foreground)]",children:[T.fileCount," files"]})]}),o.jsx("span",{className:"mt-1 block text-xs text-[var(--muted-foreground)]",children:T.description}),o.jsx("span",{className:"mt-1 block truncate font-mono text-[10px] text-[var(--muted-foreground)]",children:T.sourcePath})]})]},T.key))]}),S.length>0&&o.jsx("div",{className:"max-h-44 overflow-y-auto rounded-lg border border-[var(--border)]",children:S.map((T,P)=>o.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-[var(--border)] px-4 py-3 text-sm last:border-0",children:[o.jsxs("div",{children:[o.jsx("div",{className:"font-mono font-medium",children:T.name}),T.message&&o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:T.message})]}),o.jsx("span",{className:Pe("rounded px-2 py-1 text-xs",T.status==="failed"||T.status==="conflict"?"bg-red-500/10 text-red-600":T.status==="skipped"?"bg-[var(--muted)] text-[var(--muted-foreground)]":"bg-emerald-500/10 text-emerald-600"),children:T.status})]},`${T.name}-${P}`))})]}),o.jsxs(ma,{children:[o.jsx(re,{variant:"outline",onClick:()=>t(!1),children:"Done"}),o.jsx(re,{disabled:h.size===0||y,onClick:()=>void N(),children:y?"Importing…":`Import ${h.size||""}`})]})]})})}function OQ({name:e,onDeleted:t}){return o.jsxs(ji,{children:[o.jsx(jn,{asChild:!0,children:o.jsxs(re,{variant:"ghost",size:"sm",className:"text-[var(--destructive)]",children:[o.jsx(da,{})," Remove"]})}),o.jsxs(ti,{children:[o.jsxs(Ai,{children:[o.jsxs(ri,{children:['Remove Skill "',e,'"?']}),o.jsx(si,{children:"Removes the current catalog registration. Immutable artifacts referenced by existing Agents are preserved."})]}),o.jsxs(Ti,{children:[o.jsx(ii,{children:"Cancel"}),o.jsx(Mi,{variant:"destructive",onClick:async()=>{try{await pe.deleteSkill(e),me.success(`Skill "${e}" removed`),await t()}catch(r){me.error(`Remove failed: ${r.message}`)}},children:"Remove"})]})]})]})}function XM(e){var r,s;const t=((r=e.ref)==null?void 0:r.install.tool)==="skills-cli"?e.ref.install.source:"";return t.includes("/artifacts/skills/")||t.includes("\\artifacts\\skills\\")?"local runtime":((s=e.ref)==null?void 0:s.install.tool)==="command"?e.ref.install.command:t?"URL / repository":"receipt-less"}function BQ({results:e}){return o.jsx("div",{className:"max-h-44 overflow-y-auto rounded-lg border border-[var(--border)]",children:e.map((t,r)=>o.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-[var(--border)] px-4 py-3 text-sm last:border-0",children:[o.jsxs("div",{children:[o.jsx("div",{className:"font-mono font-medium",children:t.name}),t.message&&o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:t.message})]}),o.jsx("span",{className:Pe("rounded px-2 py-1 text-xs",t.status==="failed"||t.status==="conflict"?"bg-red-500/10 text-red-600":t.status==="skipped"?"bg-[var(--muted)] text-[var(--muted-foreground)]":"bg-emerald-500/10 text-emerald-600"),children:t.status})]},`${t.name}-${r}`))})}function PQ(e){return new Promise((t,r)=>{const s=new FileReader;s.onerror=()=>r(s.error??new Error("File read failed")),s.onload=()=>{const n=String(s.result??"");t(n.includes(",")?n.slice(n.indexOf(",")+1):n)},s.readAsDataURL(e)})}function H_({label:e,value:t,detail:r}){return o.jsxs(Mt,{className:"p-4",children:[o.jsx("div",{className:"label-caps text-[10px] text-[var(--muted-foreground)]",children:e}),o.jsx("div",{className:"mt-2 text-2xl font-semibold",children:t}),o.jsx("div",{className:"mt-1 text-xs text-[var(--muted-foreground)]",children:r})]})}function IQ(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function zQ(e){var t;return((t=e.daemonBuild)==null?void 0:t.restartRequired)??!0}function $Q(){const e=fl();return e?o.jsxs(o.Fragment,{children:[o.jsx(xU,{bridge:e,children:o.jsx(Hk,{desktopIntegrationAvailable:!0})}),o.jsx(CU,{bridge:e})]}):o.jsx(Hk,{desktopIntegrationAvailable:!1})}function Hk({desktopIntegrationAvailable:e}){const t=hl(),{theme:r,toggle:s}=Vy(),n=Qr(),l=eU(n.pathname,e),c=p.useRef(null),[d,m]=p.useState([]),[h,v]=p.useState([]),[g,x]=p.useState(!1),y=p.useCallback(async()=>{try{m(await pe.listAgents())}catch(C){me.error(`Failed to load agents: ${C.message}`)}},[]),w=p.useCallback(async()=>{const C=await Promise.allSettled([pe.listPlugins(),pe.listAgents()]);C[0].status==="fulfilled"&&v(C[0].value),C[1].status==="fulfilled"&&m(C[1].value)},[]);p.useEffect(()=>{l&&l!=="emulator"&&w()},[w,l]),p.useEffect(()=>{if(t)return;let C=!0;const E=async()=>{try{const R=await pe.meta();C&&x(zQ(R))}catch{}};E();const N=window.setInterval(()=>void E(),15e3);return()=>{C=!1,window.clearInterval(N)}},[t]),p.useEffect(()=>{const C=window.requestAnimationFrame(()=>{var E;return(E=c.current)==null?void 0:E.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(C)},[n.pathname]);const S=r4([{path:"/",element:o.jsx(Qa,{replace:!0,to:xt.sessions})},{path:od,element:o.jsx(Qa,{replace:!0,to:gx})},{path:xt.overview,element:o.jsx(BH,{plugins:h,agents:d,desktopIntegrationAvailable:e})},{path:xt.runtimes,element:o.jsx(_F,{})},{path:xt.providers,element:o.jsx(cF,{})},{path:xt.projects,element:o.jsx(sF,{})},{path:xt.plugins,element:o.jsx(FH,{plugins:h,theme:r,onChange:w})},{path:xt.agents,element:o.jsx(FU,{agents:d,onChange:y})},{path:xt.skills,element:o.jsx(TQ,{})},{path:Y9,element:o.jsx(U_,{})},{path:K9,element:o.jsx(U_,{})},{path:xt.sessions,element:o.jsx(U_,{})},{path:`${xt.sessions}/:sessionId`,element:o.jsx(UQ,{})},{path:xt.emulator,element:o.jsx(wH,{})},...e?[{path:xt.localRuntime,element:o.jsx(jH,{})},{path:xt.computerUse,element:o.jsx(tH,{})}]:zA.map(C=>({path:xt[C],element:o.jsx(Qa,{replace:!0,to:gx})})),...Object.entries(Z9).map(([C,E])=>({path:E,element:o.jsx(Qa,{replace:!0,to:xt[C]})})),...Object.entries(Q9).map(([C,E])=>({path:C,element:o.jsx(Qa,{replace:!0,to:E})})),{path:"*",element:o.jsx(Qa,{replace:!0,to:xt.sessions})}]),k=l?o.jsx(EU,{activeView:l,desktopIntegrationAvailable:e,children:S}):S;return o.jsx(_U,{theme:r,onToggleTheme:s,children:o.jsxs("div",{ref:c,id:"main-content",tabIndex:-1,className:"flex h-full min-h-0 flex-col overflow-hidden focus:outline-none",children:[g&&o.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-[color-mix(in_srgb,var(--warning)_35%,var(--border))] bg-[color-mix(in_srgb,var(--warning)_8%,var(--background))] px-4 py-2 text-xs text-[var(--warning)]",children:[o.jsx(Ci,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e?o.jsxs("span",{children:["The local Runtime is running an older build. Restart it from"," ",o.jsx("strong",{children:"Settings → Local Runtime"}),", then reload this page."]}):o.jsxs("span",{children:["The resident daemon is running an older build. Run"," ",o.jsx("code",{className:"font-mono font-semibold",children:"rynx restart"}),", then reload this page."]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:k})]})})}function UQ(){const{sessionId:e}=fE(),t=Qr();if(!e)return o.jsx(Qa,{replace:!0,to:xt.sessions});const r=HA(t.search)??"local";return o.jsx(Qa,{replace:!0,to:Wo(r,e)})}function HQ(e){const{theme:t}=Vy();return o.jsx(JB,{theme:t,...e})}var Kk;((Kk=window.rynxDesktopIntegration)==null?void 0:Kk.platform)==="darwin"&&(document.documentElement.dataset.rynxDesktopPlatform="macos");vL.createRoot(document.getElementById("root")).render(o.jsx(p.StrictMode,{children:o.jsx($4,{children:o.jsx(mU,{children:o.jsxs(gU,{children:[o.jsx($Q,{}),o.jsx(HQ,{richColors:!0,position:"top-right"})]})})})}));export{WQ as W,JW as _,q0 as a,ha as b,be as c,Pe as d,a5 as e,Xk as g,o as j,p as r,OR as t,qy as w};