0pflow 0.1.0-dev.582d64d → 0.1.0-dev.66722f0

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 (107) hide show
  1. package/dist/__tests__/factory.test.js +6 -0
  2. package/dist/__tests__/factory.test.js.map +1 -1
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +16 -1
  5. package/dist/agent.js.map +1 -1
  6. package/dist/cli/app.d.ts.map +1 -1
  7. package/dist/cli/app.js +4 -0
  8. package/dist/cli/app.js.map +1 -1
  9. package/dist/cli/cloud-dev.d.ts +7 -0
  10. package/dist/cli/cloud-dev.d.ts.map +1 -0
  11. package/dist/cli/cloud-dev.js +571 -0
  12. package/dist/cli/cloud-dev.js.map +1 -0
  13. package/dist/cli/deploy.d.ts +27 -0
  14. package/dist/cli/deploy.d.ts.map +1 -0
  15. package/dist/cli/deploy.js +332 -0
  16. package/dist/cli/deploy.js.map +1 -0
  17. package/dist/cli/env.d.ts +3 -1
  18. package/dist/cli/env.d.ts.map +1 -1
  19. package/dist/cli/env.js +8 -3
  20. package/dist/cli/env.js.map +1 -1
  21. package/dist/cli/index.js +84 -0
  22. package/dist/cli/index.js.map +1 -1
  23. package/dist/cli/install.d.ts +4 -0
  24. package/dist/cli/install.d.ts.map +1 -1
  25. package/dist/cli/install.js +25 -24
  26. package/dist/cli/install.js.map +1 -1
  27. package/dist/cli/mcp/lib/scaffolding.d.ts.map +1 -1
  28. package/dist/cli/mcp/lib/scaffolding.js +36 -21
  29. package/dist/cli/mcp/lib/scaffolding.js.map +1 -1
  30. package/dist/cli/run.d.ts.map +1 -1
  31. package/dist/cli/run.js +270 -101
  32. package/dist/cli/run.js.map +1 -1
  33. package/dist/connections/cloud-auth.d.ts.map +1 -1
  34. package/dist/connections/cloud-auth.js +5 -1
  35. package/dist/connections/cloud-auth.js.map +1 -1
  36. package/dist/connections/cloud-client.d.ts.map +1 -1
  37. package/dist/connections/cloud-client.js +10 -3
  38. package/dist/connections/cloud-client.js.map +1 -1
  39. package/dist/connections/cloud-integration-provider.d.ts +2 -1
  40. package/dist/connections/cloud-integration-provider.d.ts.map +1 -1
  41. package/dist/connections/cloud-integration-provider.js +18 -2
  42. package/dist/connections/cloud-integration-provider.js.map +1 -1
  43. package/dist/connections/connection-labels.d.ts +14 -0
  44. package/dist/connections/connection-labels.d.ts.map +1 -0
  45. package/dist/connections/connection-labels.js +46 -0
  46. package/dist/connections/connection-labels.js.map +1 -0
  47. package/dist/connections/index.d.ts +1 -0
  48. package/dist/connections/index.d.ts.map +1 -1
  49. package/dist/connections/index.js +1 -0
  50. package/dist/connections/index.js.map +1 -1
  51. package/dist/connections/integration-provider.d.ts +1 -0
  52. package/dist/connections/integration-provider.d.ts.map +1 -1
  53. package/dist/connections/local-integration-provider.d.ts +2 -1
  54. package/dist/connections/local-integration-provider.d.ts.map +1 -1
  55. package/dist/connections/local-integration-provider.js +20 -3
  56. package/dist/connections/local-integration-provider.js.map +1 -1
  57. package/dist/connections/nango-client.d.ts +1 -1
  58. package/dist/connections/nango-client.d.ts.map +1 -1
  59. package/dist/connections/nango-client.js +3 -2
  60. package/dist/connections/nango-client.js.map +1 -1
  61. package/dist/dev-ui/api.d.ts +2 -0
  62. package/dist/dev-ui/api.d.ts.map +1 -1
  63. package/dist/dev-ui/api.js +36 -0
  64. package/dist/dev-ui/api.js.map +1 -1
  65. package/dist/dev-ui/deploy-api.d.ts +14 -0
  66. package/dist/dev-ui/deploy-api.d.ts.map +1 -0
  67. package/dist/dev-ui/deploy-api.js +112 -0
  68. package/dist/dev-ui/deploy-api.js.map +1 -0
  69. package/dist/dev-ui/dev-server.d.ts.map +1 -1
  70. package/dist/dev-ui/dev-server.js +55 -2
  71. package/dist/dev-ui/dev-server.js.map +1 -1
  72. package/dist/dev-ui/watcher.d.ts.map +1 -1
  73. package/dist/dev-ui/watcher.js +6 -2
  74. package/dist/dev-ui/watcher.js.map +1 -1
  75. package/dist/dev-ui-client/assets/index-Cc0tmhKa.css +32 -0
  76. package/dist/dev-ui-client/assets/index-D-K6SYLo.js +172 -0
  77. package/dist/dev-ui-client/index.html +3 -3
  78. package/dist/discover.d.ts.map +1 -1
  79. package/dist/discover.js +5 -2
  80. package/dist/discover.js.map +1 -1
  81. package/dist/factory.d.ts.map +1 -1
  82. package/dist/factory.js +12 -1
  83. package/dist/factory.js.map +1 -1
  84. package/dist/index.d.ts +3 -1
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +4 -1
  87. package/dist/index.js.map +1 -1
  88. package/dist/registry-gen.d.ts +6 -0
  89. package/dist/registry-gen.d.ts.map +1 -0
  90. package/dist/registry-gen.js +146 -0
  91. package/dist/registry-gen.js.map +1 -0
  92. package/dist/types.d.ts +12 -5
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/types.js +18 -1
  95. package/dist/types.js.map +1 -1
  96. package/dist/workflow.d.ts.map +1 -1
  97. package/dist/workflow.js +16 -1
  98. package/dist/workflow.js.map +1 -1
  99. package/package.json +3 -1
  100. package/templates/app/.dockerignore +6 -0
  101. package/templates/app/Dockerfile +34 -0
  102. package/templates/app/generated/registry.ts +8 -0
  103. package/templates/app/next.config.js +4 -1
  104. package/templates/app/package.json +3 -0
  105. package/templates/app/src/lib/pflow.ts +5 -6
  106. package/dist/dev-ui-client/assets/index-C-LxzUII.css +0 -32
  107. package/dist/dev-ui-client/assets/index-aAIwXl4O.js +0 -127
@@ -0,0 +1,172 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function i(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(l){if(l.ep)return;l.ep=!0;const a=i(l);fetch(l.href,a)}})();function rh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jd={exports:{}},Ho={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var oy;function LE(){if(oy)return Ho;oy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(r,l,a){var c=null;if(a!==void 0&&(c=""+a),l.key!==void 0&&(c=""+l.key),"key"in l){a={};for(var h in l)h!=="key"&&(a[h]=l[h])}else a=l;return l=a.ref,{$$typeof:e,type:r,key:c,ref:l!==void 0?l:null,props:a}}return Ho.Fragment=t,Ho.jsx=i,Ho.jsxs=i,Ho}var ay;function zE(){return ay||(ay=1,jd.exports=LE()),jd.exports}var w=zE(),Pd={exports:{}},De={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var cy;function OE(){if(cy)return De;cy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=v&&z[v]||z["@@iterator"],typeof z=="function"?z:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,E={};function C(z,W,N){this.props=z,this.context=W,this.refs=E,this.updater=N||S}C.prototype.isReactComponent={},C.prototype.setState=function(z,W){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,W,"setState")},C.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function L(){}L.prototype=C.prototype;function k(z,W,N){this.props=z,this.context=W,this.refs=E,this.updater=N||S}var D=k.prototype=new L;D.constructor=k,b(D,C.prototype),D.isPureReactComponent=!0;var I=Array.isArray;function B(){}var U={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function G(z,W,N){var ee=N.ref;return{$$typeof:e,type:z,key:W,ref:ee!==void 0?ee:null,props:N}}function ne(z,W){return G(z.type,W,z.props)}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function P(z){var W={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(N){return W[N]})}var V=/\/+/g;function R(z,W){return typeof z=="object"&&z!==null&&z.key!=null?P(""+z.key):W.toString(36)}function O(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(B,B):(z.status="pending",z.then(function(W){z.status==="pending"&&(z.status="fulfilled",z.value=W)},function(W){z.status==="pending"&&(z.status="rejected",z.reason=W)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function M(z,W,N,ee,ce){var oe=typeof z;(oe==="undefined"||oe==="boolean")&&(z=null);var fe=!1;if(z===null)fe=!0;else switch(oe){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(z.$$typeof){case e:case t:fe=!0;break;case m:return fe=z._init,M(fe(z._payload),W,N,ee,ce)}}if(fe)return ce=ce(z),fe=ee===""?"."+R(z,0):ee,I(ce)?(N="",fe!=null&&(N=fe.replace(V,"$&/")+"/"),M(ce,W,N,"",function(Ce){return Ce})):ce!=null&&(q(ce)&&(ce=ne(ce,N+(ce.key==null||z&&z.key===ce.key?"":(""+ce.key).replace(V,"$&/")+"/")+fe)),W.push(ce)),1;fe=0;var he=ee===""?".":ee+":";if(I(z))for(var pe=0;pe<z.length;pe++)ee=z[pe],oe=he+R(ee,pe),fe+=M(ee,W,N,oe,ce);else if(pe=y(z),typeof pe=="function")for(z=pe.call(z),pe=0;!(ee=z.next()).done;)ee=ee.value,oe=he+R(ee,pe++),fe+=M(ee,W,N,oe,ce);else if(oe==="object"){if(typeof z.then=="function")return M(O(z),W,N,ee,ce);throw W=String(z),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return fe}function j(z,W,N){if(z==null)return z;var ee=[],ce=0;return M(z,ee,"","",function(oe){return W.call(N,oe,ce++)}),ee}function H(z){if(z._status===-1){var W=z._result;W=W(),W.then(function(N){(z._status===0||z._status===-1)&&(z._status=1,z._result=N)},function(N){(z._status===0||z._status===-1)&&(z._status=2,z._result=N)}),z._status===-1&&(z._status=0,z._result=W)}if(z._status===1)return z._result.default;throw z._result}var F=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},T={map:j,forEach:function(z,W,N){j(z,function(){W.apply(this,arguments)},N)},count:function(z){var W=0;return j(z,function(){W++}),W},toArray:function(z){return j(z,function(W){return W})||[]},only:function(z){if(!q(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return De.Activity=g,De.Children=T,De.Component=C,De.Fragment=i,De.Profiler=l,De.PureComponent=k,De.StrictMode=r,De.Suspense=d,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,De.__COMPILER_RUNTIME={__proto__:null,c:function(z){return U.H.useMemoCache(z)}},De.cache=function(z){return function(){return z.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(z,W,N){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ee=b({},z.props),ce=z.key;if(W!=null)for(oe in W.key!==void 0&&(ce=""+W.key),W)!X.call(W,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&W.ref===void 0||(ee[oe]=W[oe]);var oe=arguments.length-2;if(oe===1)ee.children=N;else if(1<oe){for(var fe=Array(oe),he=0;he<oe;he++)fe[he]=arguments[he+2];ee.children=fe}return G(z.type,ce,ee)},De.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:a,_context:z},z},De.createElement=function(z,W,N){var ee,ce={},oe=null;if(W!=null)for(ee in W.key!==void 0&&(oe=""+W.key),W)X.call(W,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(ce[ee]=W[ee]);var fe=arguments.length-2;if(fe===1)ce.children=N;else if(1<fe){for(var he=Array(fe),pe=0;pe<fe;pe++)he[pe]=arguments[pe+2];ce.children=he}if(z&&z.defaultProps)for(ee in fe=z.defaultProps,fe)ce[ee]===void 0&&(ce[ee]=fe[ee]);return G(z,oe,ce)},De.createRef=function(){return{current:null}},De.forwardRef=function(z){return{$$typeof:h,render:z}},De.isValidElement=q,De.lazy=function(z){return{$$typeof:m,_payload:{_status:-1,_result:z},_init:H}},De.memo=function(z,W){return{$$typeof:f,type:z,compare:W===void 0?null:W}},De.startTransition=function(z){var W=U.T,N={};U.T=N;try{var ee=z(),ce=U.S;ce!==null&&ce(N,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(B,F)}catch(oe){F(oe)}finally{W!==null&&N.types!==null&&(W.types=N.types),U.T=W}},De.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},De.use=function(z){return U.H.use(z)},De.useActionState=function(z,W,N){return U.H.useActionState(z,W,N)},De.useCallback=function(z,W){return U.H.useCallback(z,W)},De.useContext=function(z){return U.H.useContext(z)},De.useDebugValue=function(){},De.useDeferredValue=function(z,W){return U.H.useDeferredValue(z,W)},De.useEffect=function(z,W){return U.H.useEffect(z,W)},De.useEffectEvent=function(z){return U.H.useEffectEvent(z)},De.useId=function(){return U.H.useId()},De.useImperativeHandle=function(z,W,N){return U.H.useImperativeHandle(z,W,N)},De.useInsertionEffect=function(z,W){return U.H.useInsertionEffect(z,W)},De.useLayoutEffect=function(z,W){return U.H.useLayoutEffect(z,W)},De.useMemo=function(z,W){return U.H.useMemo(z,W)},De.useOptimistic=function(z,W){return U.H.useOptimistic(z,W)},De.useReducer=function(z,W,N){return U.H.useReducer(z,W,N)},De.useRef=function(z){return U.H.useRef(z)},De.useState=function(z){return U.H.useState(z)},De.useSyncExternalStore=function(z,W,N){return U.H.useSyncExternalStore(z,W,N)},De.useTransition=function(){return U.H.useTransition()},De.version="19.2.4",De}var uy;function Ea(){return uy||(uy=1,Pd.exports=OE()),Pd.exports}var Y=Ea();const HE=rh(Y);var Id={exports:{}},jo={},Ud={exports:{}},qd={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var hy;function jE(){return hy||(hy=1,(function(e){function t(M,j){var H=M.length;M.push(j);e:for(;0<H;){var F=H-1>>>1,T=M[F];if(0<l(T,j))M[F]=j,M[H]=T,H=F;else break e}}function i(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var j=M[0],H=M.pop();if(H!==j){M[0]=H;e:for(var F=0,T=M.length,z=T>>>1;F<z;){var W=2*(F+1)-1,N=M[W],ee=W+1,ce=M[ee];if(0>l(N,H))ee<T&&0>l(ce,N)?(M[F]=ce,M[ee]=H,F=ee):(M[F]=N,M[W]=H,F=W);else if(ee<T&&0>l(ce,H))M[F]=ce,M[ee]=H,F=ee;else break e}}return j}function l(M,j){var H=M.sortIndex-j.sortIndex;return H!==0?H:M.id-j.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var c=Date,h=c.now();e.unstable_now=function(){return c.now()-h}}var d=[],f=[],m=1,g=null,v=3,y=!1,S=!1,b=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function D(M){for(var j=i(f);j!==null;){if(j.callback===null)r(f);else if(j.startTime<=M)r(f),j.sortIndex=j.expirationTime,t(d,j);else break;j=i(f)}}function I(M){if(b=!1,D(M),!S)if(i(d)!==null)S=!0,B||(B=!0,P());else{var j=i(f);j!==null&&O(I,j.startTime-M)}}var B=!1,U=-1,X=5,G=-1;function ne(){return E?!0:!(e.unstable_now()-G<X)}function q(){if(E=!1,B){var M=e.unstable_now();G=M;var j=!0;try{e:{S=!1,b&&(b=!1,L(U),U=-1),y=!0;var H=v;try{t:{for(D(M),g=i(d);g!==null&&!(g.expirationTime>M&&ne());){var F=g.callback;if(typeof F=="function"){g.callback=null,v=g.priorityLevel;var T=F(g.expirationTime<=M);if(M=e.unstable_now(),typeof T=="function"){g.callback=T,D(M),j=!0;break t}g===i(d)&&r(d),D(M)}else r(d);g=i(d)}if(g!==null)j=!0;else{var z=i(f);z!==null&&O(I,z.startTime-M),j=!1}}break e}finally{g=null,v=H,y=!1}j=void 0}}finally{j?P():B=!1}}}var P;if(typeof k=="function")P=function(){k(q)};else if(typeof MessageChannel<"u"){var V=new MessageChannel,R=V.port2;V.port1.onmessage=q,P=function(){R.postMessage(null)}}else P=function(){C(q,0)};function O(M,j){U=C(function(){M(e.unstable_now())},j)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(M){switch(v){case 1:case 2:case 3:var j=3;break;default:j=v}var H=v;v=j;try{return M()}finally{v=H}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(M,j){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var H=v;v=M;try{return j()}finally{v=H}},e.unstable_scheduleCallback=function(M,j,H){var F=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?F+H:F):H=F,M){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=H+T,M={id:m++,callback:j,priorityLevel:M,startTime:H,expirationTime:T,sortIndex:-1},H>F?(M.sortIndex=H,t(f,M),i(d)===null&&M===i(f)&&(b?(L(U),U=-1):b=!0,O(I,H-F))):(M.sortIndex=T,t(d,M),S||y||(S=!0,B||(B=!0,P()))),M},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(M){var j=v;return function(){var H=v;v=j;try{return M.apply(this,arguments)}finally{v=H}}}})(qd)),qd}var fy;function PE(){return fy||(fy=1,Ud.exports=jE()),Ud.exports}var Vd={exports:{}},ii={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var dy;function IE(){if(dy)return ii;dy=1;var e=Ea();function t(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)f+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},l=Symbol.for("react.portal");function a(d,f,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:d,containerInfo:f,implementation:m}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return ii.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ii.createPortal=function(d,f){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return a(d,f,null,m)},ii.flushSync=function(d){var f=c.T,m=r.p;try{if(c.T=null,r.p=2,d)return d()}finally{c.T=f,r.p=m,r.d.f()}},ii.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},ii.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},ii.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var m=f.as,g=h(m,f.crossOrigin),v=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;m==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:y}):m==="script"&&r.d.X(d,{crossOrigin:g,integrity:v,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},ii.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var m=h(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},ii.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var m=f.as,g=h(m,f.crossOrigin);r.d.L(d,m,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},ii.preloadModule=function(d,f){if(typeof d=="string")if(f){var m=h(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},ii.requestFormReset=function(d){r.d.r(d)},ii.unstable_batchedUpdates=function(d,f){return d(f)},ii.useFormState=function(d,f,m){return c.H.useFormState(d,f,m)},ii.useFormStatus=function(){return c.H.useHostTransitionStatus()},ii.version="19.2.4",ii}var py;function pb(){if(py)return Vd.exports;py=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(),Vd.exports=IE(),Vd.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var gy;function UE(){if(gy)return jo;gy=1;var e=PE(),t=Ea(),i=pb();function r(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function a(n){var s=n,o=n;if(n.alternate)for(;s.return;)s=s.return;else{n=s;do s=n,(s.flags&4098)!==0&&(o=s.return),n=s.return;while(n)}return s.tag===3?o:null}function c(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function h(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function d(n){if(a(n)!==n)throw Error(r(188))}function f(n){var s=n.alternate;if(!s){if(s=a(n),s===null)throw Error(r(188));return s!==n?null:n}for(var o=n,u=s;;){var p=o.return;if(p===null)break;var _=p.alternate;if(_===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===_.child){for(_=p.child;_;){if(_===o)return d(p),n;if(_===u)return d(p),s;_=_.sibling}throw Error(r(188))}if(o.return!==u.return)o=p,u=_;else{for(var x=!1,A=p.child;A;){if(A===o){x=!0,o=p,u=_;break}if(A===u){x=!0,u=p,o=_;break}A=A.sibling}if(!x){for(A=_.child;A;){if(A===o){x=!0,o=_,u=p;break}if(A===u){x=!0,u=_,o=p;break}A=A.sibling}if(!x)throw Error(r(189))}}if(o.alternate!==u)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?n:s}function m(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=m(n),s!==null)return s;n=n.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),k=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function P(n){return n===null||typeof n!="object"?null:(n=q&&n[q]||n["@@iterator"],typeof n=="function"?n:null)}var V=Symbol.for("react.client.reference");function R(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===V?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case b:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case I:return"Suspense";case B:return"SuspenseList";case G:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case k:return n.displayName||"Context";case L:return(n._context.displayName||"Context")+".Consumer";case D:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case U:return s=n.displayName||null,s!==null?s:R(n.type)||"Memo";case X:s=n._payload,n=n._init;try{return R(n(s))}catch{}}return null}var O=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},F=[],T=-1;function z(n){return{current:n}}function W(n){0>T||(n.current=F[T],F[T]=null,T--)}function N(n,s){T++,F[T]=n.current,n.current=s}var ee=z(null),ce=z(null),oe=z(null),fe=z(null);function he(n,s){switch(N(oe,s),N(ce,n),N(ee,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?Av(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=Av(s),n=Dv(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}W(ee),N(ee,n)}function pe(){W(ee),W(ce),W(oe)}function Ce(n){n.memoizedState!==null&&N(fe,n);var s=ee.current,o=Dv(s,n.type);s!==o&&(N(ce,n),N(ee,o))}function xe(n){ce.current===n&&(W(ee),W(ce)),fe.current===n&&(W(fe),Bo._currentValue=H)}var Se,me;function Ae(n){if(Se===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Se=s&&s[1]||"",me=-1<o.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Se+n+me}var We=!1;function ze(n,s){if(!n||We)return"";We=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(ie){var te=ie}Reflect.construct(n,[],ae)}else{try{ae.call()}catch(ie){te=ie}n.call(ae.prototype)}}else{try{throw Error()}catch(ie){te=ie}(ae=n())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(ie){if(ie&&te&&typeof ie.stack=="string")return[ie.stack,te.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=u.DetermineComponentFrameRoot(),x=_[0],A=_[1];if(x&&A){var $=x.split(`
44
+ `),J=A.split(`
45
+ `);for(p=u=0;u<$.length&&!$[u].includes("DetermineComponentFrameRoot");)u++;for(;p<J.length&&!J[p].includes("DetermineComponentFrameRoot");)p++;if(u===$.length||p===J.length)for(u=$.length-1,p=J.length-1;1<=u&&0<=p&&$[u]!==J[p];)p--;for(;1<=u&&0<=p;u--,p--)if($[u]!==J[p]){if(u!==1||p!==1)do if(u--,p--,0>p||$[u]!==J[p]){var se=`
46
+ `+$[u].replace(" at new "," at ");return n.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",n.displayName)),se}while(1<=u&&0<=p);break}}}finally{We=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Ae(o):""}function St(n,s){switch(n.tag){case 26:case 27:case 5:return Ae(n.type);case 16:return Ae("Lazy");case 13:return n.child!==s&&s!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return ze(n.type,!1);case 11:return ze(n.type.render,!1);case 1:return ze(n.type,!0);case 31:return Ae("Activity");default:return""}}function Ci(n){try{var s="",o=null;do s+=St(n,o),o=n,n=n.return;while(n);return s}catch(u){return`
47
+ Error generating stack: `+u.message+`
48
+ `+u.stack}}var Jt=Object.prototype.hasOwnProperty,ui=e.unstable_scheduleCallback,Qi=e.unstable_cancelCallback,An=e.unstable_shouldYield,Dn=e.unstable_requestPaint,Lt=e.unstable_now,ar=e.unstable_getCurrentPriorityLevel,re=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,ke=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,si=e.log,Ji=e.unstable_setDisableYieldValue,Wt=null,bt=null;function ei(n){if(typeof si=="function"&&Ji(n),bt&&typeof bt.setStrictMode=="function")try{bt.setStrictMode(Wt,n)}catch{}}var Ze=Math.clz32?Math.clz32:Eh,hn=Math.log,Ei=Math.LN2;function Eh(n){return n>>>=0,n===0?32:31-(hn(n)/Ei|0)|0}var Ls=256,zs=262144,Os=4194304;function Rn(n){var s=n&42;if(s!==0)return s;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Hs(n,s,o){var u=n.pendingLanes;if(u===0)return 0;var p=0,_=n.suspendedLanes,x=n.pingedLanes;n=n.warmLanes;var A=u&134217727;return A!==0?(u=A&~_,u!==0?p=Rn(u):(x&=A,x!==0?p=Rn(x):o||(o=A&~n,o!==0&&(p=Rn(o))))):(A=u&~_,A!==0?p=Rn(A):x!==0?p=Rn(x):o||(o=u&~n,o!==0&&(p=Rn(o)))),p===0?0:s!==0&&s!==p&&(s&_)===0&&(_=p&-p,o=s&-s,_>=o||_===32&&(o&4194048)!==0)?s:p}function Gr(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function kh(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 ja(){var n=Os;return Os<<=1,(Os&62914560)===0&&(Os=4194304),n}function Vl(n){for(var s=[],o=0;31>o;o++)s.push(n);return s}function Zr(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Mh(n,s,o,u,p,_){var x=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var A=n.entanglements,$=n.expirationTimes,J=n.hiddenUpdates;for(o=x&~o;0<o;){var se=31-Ze(o),ae=1<<se;A[se]=0,$[se]=-1;var te=J[se];if(te!==null)for(J[se]=null,se=0;se<te.length;se++){var ie=te[se];ie!==null&&(ie.lane&=-536870913)}o&=~ae}u!==0&&Pa(n,u,0),_!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=_&~(x&~s))}function Pa(n,s,o){n.pendingLanes|=s,n.suspendedLanes&=~s;var u=31-Ze(s);n.entangledLanes|=s,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function Ia(n,s){var o=n.entangledLanes|=s;for(n=n.entanglements;o;){var u=31-Ze(o),p=1<<u;p&s|n[u]&s&&(n[u]|=s),o&=~p}}function Ua(n,s){var o=s&-s;return o=(o&42)!==0?1:Fl(o),(o&(n.suspendedLanes|s))!==0?0:o}function Fl(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Yl(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function qa(){var n=j.p;return n!==0?n:(n=window.event,n===void 0?32:ey(n.type))}function Va(n,s){var o=j.p;try{return j.p=n,s()}finally{j.p=o}}var fn=Math.random().toString(36).slice(2),zt="__reactFiber$"+fn,ti="__reactProps$"+fn,Bn="__reactContainer$"+fn,js="__reactEvents$"+fn,Fa="__reactListeners$"+fn,Th="__reactHandles$"+fn,Ya="__reactResources$"+fn,Qr="__reactMarker$"+fn;function Wl(n){delete n[zt],delete n[ti],delete n[js],delete n[Fa],delete n[Th]}function cr(n){var s=n[zt];if(s)return s;for(var o=n.parentNode;o;){if(s=o[Bn]||o[zt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(n=jv(n);n!==null;){if(o=n[zt])return o;n=jv(n)}return s}n=o,o=n.parentNode}return null}function ur(n){if(n=n[zt]||n[Bn]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function hr(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(r(33))}function fr(n){var s=n[Ya];return s||(s=n[Ya]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Et(n){n[Qr]=!0}var Wa=new Set,$a={};function Ln(n,s){dr(n,s),dr(n+"Capture",s)}function dr(n,s){for($a[n]=s,n=0;n<s.length;n++)Wa.add(s[n])}var Nh=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]*$"),$l={},Xa={};function Ah(n){return Jt.call(Xa,n)?!0:Jt.call($l,n)?!1:Nh.test(n)?Xa[n]=!0:($l[n]=!0,!1)}function Ps(n,s,o){if(Ah(s))if(o===null)n.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,""+o)}}function Is(n,s,o){if(o===null)n.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,""+o)}}function en(n,s,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(s,o,""+u)}}function hi(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Ka(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Dh(n,s,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,_=u.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return p.call(this)},set:function(x){o=""+x,_.call(this,x)}}),Object.defineProperty(n,s,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(x){o=""+x},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function pr(n){if(!n._valueTracker){var s=Ka(n)?"checked":"value";n._valueTracker=Dh(n,s,""+n[s])}}function Ga(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var o=s.getValue(),u="";return n&&(u=Ka(n)?n.checked?"true":"false":n.value),n=u,n!==o?(s.setValue(n),!0):!1}function Jr(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Rh=/[\n"\\]/g;function fi(n){return n.replace(Rh,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function es(n,s,o,u,p,_,x,A){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),s!=null?x==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+hi(s)):n.value!==""+hi(s)&&(n.value=""+hi(s)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),s!=null?Xl(n,x,hi(s)):o!=null?Xl(n,x,hi(o)):u!=null&&n.removeAttribute("value"),p==null&&_!=null&&(n.defaultChecked=!!_),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.name=""+hi(A):n.removeAttribute("name")}function Za(n,s,o,u,p,_,x,A){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(n.type=_),s!=null||o!=null){if(!(_!=="submit"&&_!=="reset"||s!=null)){pr(n);return}o=o!=null?""+hi(o):"",s=s!=null?""+hi(s):o,A||s===n.value||(n.value=s),n.defaultValue=s}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=A?n.checked:!!u,n.defaultChecked=!!u,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),pr(n)}function Xl(n,s,o){s==="number"&&Jr(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function zn(n,s,o,u){if(n=n.options,s){s={};for(var p=0;p<o.length;p++)s["$"+o[p]]=!0;for(o=0;o<n.length;o++)p=s.hasOwnProperty("$"+n[o].value),n[o].selected!==p&&(n[o].selected=p),p&&u&&(n[o].defaultSelected=!0)}else{for(o=""+hi(o),s=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,u&&(n[p].defaultSelected=!0);return}s!==null||n[p].disabled||(s=n[p])}s!==null&&(s.selected=!0)}}function Em(n,s,o){if(s!=null&&(s=""+hi(s),s!==n.value&&(n.value=s),o==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=o!=null?""+hi(o):""}function km(n,s,o,u){if(s==null){if(u!=null){if(o!=null)throw Error(r(92));if(O(u)){if(1<u.length)throw Error(r(93));u=u[0]}o=u}o==null&&(o=""),s=o}o=hi(s),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),pr(n)}function Us(n,s){if(s){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=s;return}}n.textContent=s}var NC=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 Mm(n,s,o){var u=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":u?n.setProperty(s,o):typeof o!="number"||o===0||NC.has(s)?s==="float"?n.cssFloat=o:n[s]=(""+o).trim():n[s]=o+"px"}function Tm(n,s,o){if(s!=null&&typeof s!="object")throw Error(r(62));if(n=n.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var p in s)u=s[p],s.hasOwnProperty(p)&&o[p]!==u&&Mm(n,p,u)}else for(var _ in s)s.hasOwnProperty(_)&&Mm(n,_,s[_])}function Bh(n){if(n.indexOf("-")===-1)return!1;switch(n){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 AC=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"]]),DC=/^[\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 Qa(n){return DC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function On(){}var Lh=null;function zh(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qs=null,Vs=null;function Nm(n){var s=ur(n);if(s&&(n=s.stateNode)){var o=n[ti]||null;e:switch(n=s.stateNode,s.type){case"input":if(es(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+fi(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var u=o[s];if(u!==n&&u.form===n.form){var p=u[ti]||null;if(!p)throw Error(r(90));es(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(s=0;s<o.length;s++)u=o[s],u.form===n.form&&Ga(u)}break e;case"textarea":Em(n,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&zn(n,!!o.multiple,s,!1)}}}var Oh=!1;function Am(n,s,o){if(Oh)return n(s,o);Oh=!0;try{var u=n(s);return u}finally{if(Oh=!1,(qs!==null||Vs!==null)&&(Pc(),qs&&(s=qs,n=Vs,Vs=qs=null,Nm(s),n)))for(s=0;s<n.length;s++)Nm(n[s])}}function Kl(n,s){var o=n.stateNode;if(o===null)return null;var u=o[ti]||null;if(u===null)return null;o=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var Hn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hh=!1;if(Hn)try{var Gl={};Object.defineProperty(Gl,"passive",{get:function(){Hh=!0}}),window.addEventListener("test",Gl,Gl),window.removeEventListener("test",Gl,Gl)}catch{Hh=!1}var gr=null,jh=null,Ja=null;function Dm(){if(Ja)return Ja;var n,s=jh,o=s.length,u,p="value"in gr?gr.value:gr.textContent,_=p.length;for(n=0;n<o&&s[n]===p[n];n++);var x=o-n;for(u=1;u<=x&&s[o-u]===p[_-u];u++);return Ja=p.slice(n,1<u?1-u:void 0)}function ec(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function tc(){return!0}function Rm(){return!1}function di(n){function s(o,u,p,_,x){this._reactName=o,this._targetInst=p,this.type=u,this.nativeEvent=_,this.target=x,this.currentTarget=null;for(var A in n)n.hasOwnProperty(A)&&(o=n[A],this[A]=o?o(_):_[A]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?tc:Rm,this.isPropagationStopped=Rm,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=tc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=tc)},persist:function(){},isPersistent:tc}),s}var ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ic=di(ts),Zl=g({},ts,{view:0,detail:0}),RC=di(Zl),Ph,Ih,Ql,nc=g({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qh,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ql&&(Ql&&n.type==="mousemove"?(Ph=n.screenX-Ql.screenX,Ih=n.screenY-Ql.screenY):Ih=Ph=0,Ql=n),Ph)},movementY:function(n){return"movementY"in n?n.movementY:Ih}}),Bm=di(nc),BC=g({},nc,{dataTransfer:0}),LC=di(BC),zC=g({},Zl,{relatedTarget:0}),Uh=di(zC),OC=g({},ts,{animationName:0,elapsedTime:0,pseudoElement:0}),HC=di(OC),jC=g({},ts,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),PC=di(jC),IC=g({},ts,{data:0}),Lm=di(IC),UC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qC={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"},VC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function FC(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=VC[n])?!!s[n]:!1}function qh(){return FC}var YC=g({},Zl,{key:function(n){if(n.key){var s=UC[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=ec(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?qC[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qh,charCode:function(n){return n.type==="keypress"?ec(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ec(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),WC=di(YC),$C=g({},nc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zm=di($C),XC=g({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qh}),KC=di(XC),GC=g({},ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),ZC=di(GC),QC=g({},nc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),JC=di(QC),e2=g({},ts,{newState:0,oldState:0}),t2=di(e2),i2=[9,13,27,32],Vh=Hn&&"CompositionEvent"in window,Jl=null;Hn&&"documentMode"in document&&(Jl=document.documentMode);var n2=Hn&&"TextEvent"in window&&!Jl,Om=Hn&&(!Vh||Jl&&8<Jl&&11>=Jl),Hm=" ",jm=!1;function Pm(n,s){switch(n){case"keyup":return i2.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Im(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Fs=!1;function r2(n,s){switch(n){case"compositionend":return Im(s);case"keypress":return s.which!==32?null:(jm=!0,Hm);case"textInput":return n=s.data,n===Hm&&jm?null:n;default:return null}}function s2(n,s){if(Fs)return n==="compositionend"||!Vh&&Pm(n,s)?(n=Dm(),Ja=jh=gr=null,Fs=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Om&&s.locale!=="ko"?null:s.data;default:return null}}var l2={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 Um(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!l2[n.type]:s==="textarea"}function qm(n,s,o,u){qs?Vs?Vs.push(u):Vs=[u]:qs=u,s=Wc(s,"onChange"),0<s.length&&(o=new ic("onChange","change",null,o,u),n.push({event:o,listeners:s}))}var eo=null,to=null;function o2(n){Cv(n,0)}function rc(n){var s=hr(n);if(Ga(s))return n}function Vm(n,s){if(n==="change")return s}var Fm=!1;if(Hn){var Fh;if(Hn){var Yh="oninput"in document;if(!Yh){var Ym=document.createElement("div");Ym.setAttribute("oninput","return;"),Yh=typeof Ym.oninput=="function"}Fh=Yh}else Fh=!1;Fm=Fh&&(!document.documentMode||9<document.documentMode)}function Wm(){eo&&(eo.detachEvent("onpropertychange",$m),to=eo=null)}function $m(n){if(n.propertyName==="value"&&rc(to)){var s=[];qm(s,to,n,zh(n)),Am(o2,s)}}function a2(n,s,o){n==="focusin"?(Wm(),eo=s,to=o,eo.attachEvent("onpropertychange",$m)):n==="focusout"&&Wm()}function c2(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return rc(to)}function u2(n,s){if(n==="click")return rc(s)}function h2(n,s){if(n==="input"||n==="change")return rc(s)}function f2(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var ki=typeof Object.is=="function"?Object.is:f2;function io(n,s){if(ki(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var o=Object.keys(n),u=Object.keys(s);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var p=o[u];if(!Jt.call(s,p)||!ki(n[p],s[p]))return!1}return!0}function Xm(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Km(n,s){var o=Xm(n);n=0;for(var u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=s&&u>=s)return{node:o,offset:s-n};n=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Xm(o)}}function Gm(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Gm(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Zm(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=Jr(n.document);s instanceof n.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)n=s.contentWindow;else break;s=Jr(n.document)}return s}function Wh(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var d2=Hn&&"documentMode"in document&&11>=document.documentMode,Ys=null,$h=null,no=null,Xh=!1;function Qm(n,s,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Xh||Ys==null||Ys!==Jr(u)||(u=Ys,"selectionStart"in u&&Wh(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),no&&io(no,u)||(no=u,u=Wc($h,"onSelect"),0<u.length&&(s=new ic("onSelect","select",null,s,o),n.push({event:s,listeners:u}),s.target=Ys)))}function is(n,s){var o={};return o[n.toLowerCase()]=s.toLowerCase(),o["Webkit"+n]="webkit"+s,o["Moz"+n]="moz"+s,o}var Ws={animationend:is("Animation","AnimationEnd"),animationiteration:is("Animation","AnimationIteration"),animationstart:is("Animation","AnimationStart"),transitionrun:is("Transition","TransitionRun"),transitionstart:is("Transition","TransitionStart"),transitioncancel:is("Transition","TransitionCancel"),transitionend:is("Transition","TransitionEnd")},Kh={},Jm={};Hn&&(Jm=document.createElement("div").style,"AnimationEvent"in window||(delete Ws.animationend.animation,delete Ws.animationiteration.animation,delete Ws.animationstart.animation),"TransitionEvent"in window||delete Ws.transitionend.transition);function ns(n){if(Kh[n])return Kh[n];if(!Ws[n])return n;var s=Ws[n],o;for(o in s)if(s.hasOwnProperty(o)&&o in Jm)return Kh[n]=s[o];return n}var e_=ns("animationend"),t_=ns("animationiteration"),i_=ns("animationstart"),p2=ns("transitionrun"),g2=ns("transitionstart"),m2=ns("transitioncancel"),n_=ns("transitionend"),r_=new Map,Gh="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(" ");Gh.push("scrollEnd");function tn(n,s){r_.set(n,s),Ln(s,[n])}var sc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Pi=[],$s=0,Zh=0;function lc(){for(var n=$s,s=Zh=$s=0;s<n;){var o=Pi[s];Pi[s++]=null;var u=Pi[s];Pi[s++]=null;var p=Pi[s];Pi[s++]=null;var _=Pi[s];if(Pi[s++]=null,u!==null&&p!==null){var x=u.pending;x===null?p.next=p:(p.next=x.next,x.next=p),u.pending=p}_!==0&&s_(o,p,_)}}function oc(n,s,o,u){Pi[$s++]=n,Pi[$s++]=s,Pi[$s++]=o,Pi[$s++]=u,Zh|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Qh(n,s,o,u){return oc(n,s,o,u),ac(n)}function rs(n,s){return oc(n,null,null,s),ac(n)}function s_(n,s,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var p=!1,_=n.return;_!==null;)_.childLanes|=o,u=_.alternate,u!==null&&(u.childLanes|=o),_.tag===22&&(n=_.stateNode,n===null||n._visibility&1||(p=!0)),n=_,_=_.return;return n.tag===3?(_=n.stateNode,p&&s!==null&&(p=31-Ze(o),n=_.hiddenUpdates,u=n[p],u===null?n[p]=[s]:u.push(s),s.lane=o|536870912),_):null}function ac(n){if(50<ko)throw ko=0,ad=null,Error(r(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var Xs={};function _2(n,s,o,u){this.tag=n,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mi(n,s,o,u){return new _2(n,s,o,u)}function Jh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function jn(n,s){var o=n.alternate;return o===null?(o=Mi(n.tag,s,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=s,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,s=n.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function l_(n,s){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,s=o.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function cc(n,s,o,u,p,_){var x=0;if(u=n,typeof n=="function")Jh(n)&&(x=1);else if(typeof n=="string")x=xE(n,o,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case G:return n=Mi(31,o,s,p),n.elementType=G,n.lanes=_,n;case b:return ss(o.children,p,_,s);case E:x=8,p|=24;break;case C:return n=Mi(12,o,s,p|2),n.elementType=C,n.lanes=_,n;case I:return n=Mi(13,o,s,p),n.elementType=I,n.lanes=_,n;case B:return n=Mi(19,o,s,p),n.elementType=B,n.lanes=_,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case k:x=10;break e;case L:x=9;break e;case D:x=11;break e;case U:x=14;break e;case X:x=16,u=null;break e}x=29,o=Error(r(130,n===null?"null":typeof n,"")),u=null}return s=Mi(x,o,s,p),s.elementType=n,s.type=u,s.lanes=_,s}function ss(n,s,o,u){return n=Mi(7,n,u,s),n.lanes=o,n}function ef(n,s,o){return n=Mi(6,n,null,s),n.lanes=o,n}function o_(n){var s=Mi(18,null,null,0);return s.stateNode=n,s}function tf(n,s,o){return s=Mi(4,n.children!==null?n.children:[],n.key,s),s.lanes=o,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var a_=new WeakMap;function Ii(n,s){if(typeof n=="object"&&n!==null){var o=a_.get(n);return o!==void 0?o:(s={value:n,source:s,stack:Ci(s)},a_.set(n,s),s)}return{value:n,source:s,stack:Ci(s)}}var Ks=[],Gs=0,uc=null,ro=0,Ui=[],qi=0,mr=null,dn=1,pn="";function Pn(n,s){Ks[Gs++]=ro,Ks[Gs++]=uc,uc=n,ro=s}function c_(n,s,o){Ui[qi++]=dn,Ui[qi++]=pn,Ui[qi++]=mr,mr=n;var u=dn;n=pn;var p=32-Ze(u)-1;u&=~(1<<p),o+=1;var _=32-Ze(s)+p;if(30<_){var x=p-p%5;_=(u&(1<<x)-1).toString(32),u>>=x,p-=x,dn=1<<32-Ze(s)+p|o<<p|u,pn=_+n}else dn=1<<_|o<<p|u,pn=n}function nf(n){n.return!==null&&(Pn(n,1),c_(n,1,0))}function rf(n){for(;n===uc;)uc=Ks[--Gs],Ks[Gs]=null,ro=Ks[--Gs],Ks[Gs]=null;for(;n===mr;)mr=Ui[--qi],Ui[qi]=null,pn=Ui[--qi],Ui[qi]=null,dn=Ui[--qi],Ui[qi]=null}function u_(n,s){Ui[qi++]=dn,Ui[qi++]=pn,Ui[qi++]=mr,dn=s.id,pn=s.overflow,mr=n}var $t=null,ot=null,Ve=!1,_r=null,Vi=!1,sf=Error(r(519));function vr(n){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw so(Ii(s,n)),sf}function h_(n){var s=n.stateNode,o=n.type,u=n.memoizedProps;switch(s[zt]=n,s[ti]=u,o){case"dialog":Ie("cancel",s),Ie("close",s);break;case"iframe":case"object":case"embed":Ie("load",s);break;case"video":case"audio":for(o=0;o<To.length;o++)Ie(To[o],s);break;case"source":Ie("error",s);break;case"img":case"image":case"link":Ie("error",s),Ie("load",s);break;case"details":Ie("toggle",s);break;case"input":Ie("invalid",s),Za(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ie("invalid",s);break;case"textarea":Ie("invalid",s),km(s,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||u.suppressHydrationWarning===!0||Tv(s.textContent,o)?(u.popover!=null&&(Ie("beforetoggle",s),Ie("toggle",s)),u.onScroll!=null&&Ie("scroll",s),u.onScrollEnd!=null&&Ie("scrollend",s),u.onClick!=null&&(s.onclick=On),s=!0):s=!1,s||vr(n,!0)}function f_(n){for($t=n.return;$t;)switch($t.tag){case 5:case 31:case 13:Vi=!1;return;case 27:case 3:Vi=!0;return;default:$t=$t.return}}function Zs(n){if(n!==$t)return!1;if(!Ve)return f_(n),Ve=!0,!1;var s=n.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||wd(n.type,n.memoizedProps)),o=!o),o&&ot&&vr(n),f_(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));ot=Hv(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));ot=Hv(n)}else s===27?(s=ot,Rr(n.type)?(n=Td,Td=null,ot=n):ot=s):ot=$t?Yi(n.stateNode.nextSibling):null;return!0}function ls(){ot=$t=null,Ve=!1}function lf(){var n=_r;return n!==null&&(_i===null?_i=n:_i.push.apply(_i,n),_r=null),n}function so(n){_r===null?_r=[n]:_r.push(n)}var of=z(null),os=null,In=null;function yr(n,s,o){N(of,s._currentValue),s._currentValue=o}function Un(n){n._currentValue=of.current,W(of)}function af(n,s,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),n===o)break;n=n.return}}function cf(n,s,o,u){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var _=p.dependencies;if(_!==null){var x=p.child;_=_.firstContext;e:for(;_!==null;){var A=_;_=p;for(var $=0;$<s.length;$++)if(A.context===s[$]){_.lanes|=o,A=_.alternate,A!==null&&(A.lanes|=o),af(_.return,o,n),u||(x=null);break e}_=A.next}}else if(p.tag===18){if(x=p.return,x===null)throw Error(r(341));x.lanes|=o,_=x.alternate,_!==null&&(_.lanes|=o),af(x,o,n),x=null}else x=p.child;if(x!==null)x.return=p;else for(x=p;x!==null;){if(x===n){x=null;break}if(p=x.sibling,p!==null){p.return=x.return,x=p;break}x=x.return}p=x}}function Qs(n,s,o,u){n=null;for(var p=s,_=!1;p!==null;){if(!_){if((p.flags&524288)!==0)_=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var x=p.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var A=p.type;ki(p.pendingProps.value,x.value)||(n!==null?n.push(A):n=[A])}}else if(p===fe.current){if(x=p.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(Bo):n=[Bo])}p=p.return}n!==null&&cf(s,n,o,u),s.flags|=262144}function hc(n){for(n=n.firstContext;n!==null;){if(!ki(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function as(n){os=n,In=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Xt(n){return d_(os,n)}function fc(n,s){return os===null&&as(n),d_(n,s)}function d_(n,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},In===null){if(n===null)throw Error(r(308));In=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else In=In.next=s;return o}var v2=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){s.aborted=!0,n.forEach(function(o){return o()})}},y2=e.unstable_scheduleCallback,S2=e.unstable_NormalPriority,kt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function uf(){return{controller:new v2,data:new Map,refCount:0}}function lo(n){n.refCount--,n.refCount===0&&y2(S2,function(){n.controller.abort()})}var oo=null,hf=0,Js=0,el=null;function b2(n,s){if(oo===null){var o=oo=[];hf=0,Js=pd(),el={status:"pending",value:void 0,then:function(u){o.push(u)}}}return hf++,s.then(p_,p_),s}function p_(){if(--hf===0&&oo!==null){el!==null&&(el.status="fulfilled");var n=oo;oo=null,Js=0,el=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function x2(n,s){var o=[],u={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){u.status="fulfilled",u.value=s;for(var p=0;p<o.length;p++)(0,o[p])(s)},function(p){for(u.status="rejected",u.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),u}var g_=M.S;M.S=function(n,s){Q0=Lt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&b2(n,s),g_!==null&&g_(n,s)};var cs=z(null);function ff(){var n=cs.current;return n!==null?n:rt.pooledCache}function dc(n,s){s===null?N(cs,cs.current):N(cs,s.pool)}function m_(){var n=ff();return n===null?null:{parent:kt._currentValue,pool:n}}var tl=Error(r(460)),df=Error(r(474)),pc=Error(r(542)),gc={then:function(){}};function __(n){return n=n.status,n==="fulfilled"||n==="rejected"}function v_(n,s,o){switch(o=n[o],o===void 0?n.push(s):o!==s&&(s.then(On,On),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,S_(n),n;default:if(typeof s.status=="string")s.then(On,On);else{if(n=rt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=s,n.status="pending",n.then(function(u){if(s.status==="pending"){var p=s;p.status="fulfilled",p.value=u}},function(u){if(s.status==="pending"){var p=s;p.status="rejected",p.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,S_(n),n}throw hs=s,tl}}function us(n){try{var s=n._init;return s(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(hs=o,tl):o}}var hs=null;function y_(){if(hs===null)throw Error(r(459));var n=hs;return hs=null,n}function S_(n){if(n===tl||n===pc)throw Error(r(483))}var il=null,ao=0;function mc(n){var s=ao;return ao+=1,il===null&&(il=[]),v_(il,n,s)}function co(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function _c(n,s){throw s.$$typeof===v?Error(r(525)):(n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function b_(n){function s(Z,K){if(n){var Q=Z.deletions;Q===null?(Z.deletions=[K],Z.flags|=16):Q.push(K)}}function o(Z,K){if(!n)return null;for(;K!==null;)s(Z,K),K=K.sibling;return null}function u(Z){for(var K=new Map;Z!==null;)Z.key!==null?K.set(Z.key,Z):K.set(Z.index,Z),Z=Z.sibling;return K}function p(Z,K){return Z=jn(Z,K),Z.index=0,Z.sibling=null,Z}function _(Z,K,Q){return Z.index=Q,n?(Q=Z.alternate,Q!==null?(Q=Q.index,Q<K?(Z.flags|=67108866,K):Q):(Z.flags|=67108866,K)):(Z.flags|=1048576,K)}function x(Z){return n&&Z.alternate===null&&(Z.flags|=67108866),Z}function A(Z,K,Q,le){return K===null||K.tag!==6?(K=ef(Q,Z.mode,le),K.return=Z,K):(K=p(K,Q),K.return=Z,K)}function $(Z,K,Q,le){var Ee=Q.type;return Ee===b?se(Z,K,Q.props.children,le,Q.key):K!==null&&(K.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===X&&us(Ee)===K.type)?(K=p(K,Q.props),co(K,Q),K.return=Z,K):(K=cc(Q.type,Q.key,Q.props,null,Z.mode,le),co(K,Q),K.return=Z,K)}function J(Z,K,Q,le){return K===null||K.tag!==4||K.stateNode.containerInfo!==Q.containerInfo||K.stateNode.implementation!==Q.implementation?(K=tf(Q,Z.mode,le),K.return=Z,K):(K=p(K,Q.children||[]),K.return=Z,K)}function se(Z,K,Q,le,Ee){return K===null||K.tag!==7?(K=ss(Q,Z.mode,le,Ee),K.return=Z,K):(K=p(K,Q),K.return=Z,K)}function ae(Z,K,Q){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=ef(""+K,Z.mode,Q),K.return=Z,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case y:return Q=cc(K.type,K.key,K.props,null,Z.mode,Q),co(Q,K),Q.return=Z,Q;case S:return K=tf(K,Z.mode,Q),K.return=Z,K;case X:return K=us(K),ae(Z,K,Q)}if(O(K)||P(K))return K=ss(K,Z.mode,Q,null),K.return=Z,K;if(typeof K.then=="function")return ae(Z,mc(K),Q);if(K.$$typeof===k)return ae(Z,fc(Z,K),Q);_c(Z,K)}return null}function te(Z,K,Q,le){var Ee=K!==null?K.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Ee!==null?null:A(Z,K,""+Q,le);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return Q.key===Ee?$(Z,K,Q,le):null;case S:return Q.key===Ee?J(Z,K,Q,le):null;case X:return Q=us(Q),te(Z,K,Q,le)}if(O(Q)||P(Q))return Ee!==null?null:se(Z,K,Q,le,null);if(typeof Q.then=="function")return te(Z,K,mc(Q),le);if(Q.$$typeof===k)return te(Z,K,fc(Z,Q),le);_c(Z,Q)}return null}function ie(Z,K,Q,le,Ee){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return Z=Z.get(Q)||null,A(K,Z,""+le,Ee);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return Z=Z.get(le.key===null?Q:le.key)||null,$(K,Z,le,Ee);case S:return Z=Z.get(le.key===null?Q:le.key)||null,J(K,Z,le,Ee);case X:return le=us(le),ie(Z,K,Q,le,Ee)}if(O(le)||P(le))return Z=Z.get(Q)||null,se(K,Z,le,Ee,null);if(typeof le.then=="function")return ie(Z,K,Q,mc(le),Ee);if(le.$$typeof===k)return ie(Z,K,Q,fc(K,le),Ee);_c(K,le)}return null}function ye(Z,K,Q,le){for(var Ee=null,$e=null,be=K,Be=K=0,qe=null;be!==null&&Be<Q.length;Be++){be.index>Be?(qe=be,be=null):qe=be.sibling;var Xe=te(Z,be,Q[Be],le);if(Xe===null){be===null&&(be=qe);break}n&&be&&Xe.alternate===null&&s(Z,be),K=_(Xe,K,Be),$e===null?Ee=Xe:$e.sibling=Xe,$e=Xe,be=qe}if(Be===Q.length)return o(Z,be),Ve&&Pn(Z,Be),Ee;if(be===null){for(;Be<Q.length;Be++)be=ae(Z,Q[Be],le),be!==null&&(K=_(be,K,Be),$e===null?Ee=be:$e.sibling=be,$e=be);return Ve&&Pn(Z,Be),Ee}for(be=u(be);Be<Q.length;Be++)qe=ie(be,Z,Be,Q[Be],le),qe!==null&&(n&&qe.alternate!==null&&be.delete(qe.key===null?Be:qe.key),K=_(qe,K,Be),$e===null?Ee=qe:$e.sibling=qe,$e=qe);return n&&be.forEach(function(Hr){return s(Z,Hr)}),Ve&&Pn(Z,Be),Ee}function Me(Z,K,Q,le){if(Q==null)throw Error(r(151));for(var Ee=null,$e=null,be=K,Be=K=0,qe=null,Xe=Q.next();be!==null&&!Xe.done;Be++,Xe=Q.next()){be.index>Be?(qe=be,be=null):qe=be.sibling;var Hr=te(Z,be,Xe.value,le);if(Hr===null){be===null&&(be=qe);break}n&&be&&Hr.alternate===null&&s(Z,be),K=_(Hr,K,Be),$e===null?Ee=Hr:$e.sibling=Hr,$e=Hr,be=qe}if(Xe.done)return o(Z,be),Ve&&Pn(Z,Be),Ee;if(be===null){for(;!Xe.done;Be++,Xe=Q.next())Xe=ae(Z,Xe.value,le),Xe!==null&&(K=_(Xe,K,Be),$e===null?Ee=Xe:$e.sibling=Xe,$e=Xe);return Ve&&Pn(Z,Be),Ee}for(be=u(be);!Xe.done;Be++,Xe=Q.next())Xe=ie(be,Z,Be,Xe.value,le),Xe!==null&&(n&&Xe.alternate!==null&&be.delete(Xe.key===null?Be:Xe.key),K=_(Xe,K,Be),$e===null?Ee=Xe:$e.sibling=Xe,$e=Xe);return n&&be.forEach(function(BE){return s(Z,BE)}),Ve&&Pn(Z,Be),Ee}function it(Z,K,Q,le){if(typeof Q=="object"&&Q!==null&&Q.type===b&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:e:{for(var Ee=Q.key;K!==null;){if(K.key===Ee){if(Ee=Q.type,Ee===b){if(K.tag===7){o(Z,K.sibling),le=p(K,Q.props.children),le.return=Z,Z=le;break e}}else if(K.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===X&&us(Ee)===K.type){o(Z,K.sibling),le=p(K,Q.props),co(le,Q),le.return=Z,Z=le;break e}o(Z,K);break}else s(Z,K);K=K.sibling}Q.type===b?(le=ss(Q.props.children,Z.mode,le,Q.key),le.return=Z,Z=le):(le=cc(Q.type,Q.key,Q.props,null,Z.mode,le),co(le,Q),le.return=Z,Z=le)}return x(Z);case S:e:{for(Ee=Q.key;K!==null;){if(K.key===Ee)if(K.tag===4&&K.stateNode.containerInfo===Q.containerInfo&&K.stateNode.implementation===Q.implementation){o(Z,K.sibling),le=p(K,Q.children||[]),le.return=Z,Z=le;break e}else{o(Z,K);break}else s(Z,K);K=K.sibling}le=tf(Q,Z.mode,le),le.return=Z,Z=le}return x(Z);case X:return Q=us(Q),it(Z,K,Q,le)}if(O(Q))return ye(Z,K,Q,le);if(P(Q)){if(Ee=P(Q),typeof Ee!="function")throw Error(r(150));return Q=Ee.call(Q),Me(Z,K,Q,le)}if(typeof Q.then=="function")return it(Z,K,mc(Q),le);if(Q.$$typeof===k)return it(Z,K,fc(Z,Q),le);_c(Z,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,K!==null&&K.tag===6?(o(Z,K.sibling),le=p(K,Q),le.return=Z,Z=le):(o(Z,K),le=ef(Q,Z.mode,le),le.return=Z,Z=le),x(Z)):o(Z,K)}return function(Z,K,Q,le){try{ao=0;var Ee=it(Z,K,Q,le);return il=null,Ee}catch(be){if(be===tl||be===pc)throw be;var $e=Mi(29,be,null,Z.mode);return $e.lanes=le,$e.return=Z,$e}finally{}}}var fs=b_(!0),x_=b_(!1),Sr=!1;function pf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function gf(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function br(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function xr(n,s,o){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(Ke&2)!==0){var p=u.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),u.pending=s,s=ac(n),s_(n,null,o),s}return oc(n,u,s,o),ac(n)}function uo(n,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var u=s.lanes;u&=n.pendingLanes,o|=u,s.lanes=o,Ia(n,o)}}function mf(n,s){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,_=null;if(o=o.firstBaseUpdate,o!==null){do{var x={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};_===null?p=_=x:_=_.next=x,o=o.next}while(o!==null);_===null?p=_=s:_=_.next=s}else p=_=s;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:_,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=s:n.next=s,o.lastBaseUpdate=s}var _f=!1;function ho(){if(_f){var n=el;if(n!==null)throw n}}function fo(n,s,o,u){_f=!1;var p=n.updateQueue;Sr=!1;var _=p.firstBaseUpdate,x=p.lastBaseUpdate,A=p.shared.pending;if(A!==null){p.shared.pending=null;var $=A,J=$.next;$.next=null,x===null?_=J:x.next=J,x=$;var se=n.alternate;se!==null&&(se=se.updateQueue,A=se.lastBaseUpdate,A!==x&&(A===null?se.firstBaseUpdate=J:A.next=J,se.lastBaseUpdate=$))}if(_!==null){var ae=p.baseState;x=0,se=J=$=null,A=_;do{var te=A.lane&-536870913,ie=te!==A.lane;if(ie?(Ue&te)===te:(u&te)===te){te!==0&&te===Js&&(_f=!0),se!==null&&(se=se.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var ye=n,Me=A;te=s;var it=o;switch(Me.tag){case 1:if(ye=Me.payload,typeof ye=="function"){ae=ye.call(it,ae,te);break e}ae=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Me.payload,te=typeof ye=="function"?ye.call(it,ae,te):ye,te==null)break e;ae=g({},ae,te);break e;case 2:Sr=!0}}te=A.callback,te!==null&&(n.flags|=64,ie&&(n.flags|=8192),ie=p.callbacks,ie===null?p.callbacks=[te]:ie.push(te))}else ie={lane:te,tag:A.tag,payload:A.payload,callback:A.callback,next:null},se===null?(J=se=ie,$=ae):se=se.next=ie,x|=te;if(A=A.next,A===null){if(A=p.shared.pending,A===null)break;ie=A,A=ie.next,ie.next=null,p.lastBaseUpdate=ie,p.shared.pending=null}}while(!0);se===null&&($=ae),p.baseState=$,p.firstBaseUpdate=J,p.lastBaseUpdate=se,_===null&&(p.shared.lanes=0),Mr|=x,n.lanes=x,n.memoizedState=ae}}function w_(n,s){if(typeof n!="function")throw Error(r(191,n));n.call(s)}function C_(n,s){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)w_(o[n],s)}var nl=z(null),vc=z(0);function E_(n,s){n=Gn,N(vc,n),N(nl,s),Gn=n|s.baseLanes}function vf(){N(vc,Gn),N(nl,nl.current)}function yf(){Gn=vc.current,W(nl),W(vc)}var Ti=z(null),Fi=null;function wr(n){var s=n.alternate;N(xt,xt.current&1),N(Ti,n),Fi===null&&(s===null||nl.current!==null||s.memoizedState!==null)&&(Fi=n)}function Sf(n){N(xt,xt.current),N(Ti,n),Fi===null&&(Fi=n)}function k_(n){n.tag===22?(N(xt,xt.current),N(Ti,n),Fi===null&&(Fi=n)):Cr()}function Cr(){N(xt,xt.current),N(Ti,Ti.current)}function Ni(n){W(Ti),Fi===n&&(Fi=null),W(xt)}var xt=z(0);function yc(n){for(var s=n;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||kd(o)||Md(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var qn=0,Re=null,et=null,Mt=null,Sc=!1,rl=!1,ds=!1,bc=0,po=0,sl=null,w2=0;function mt(){throw Error(r(321))}function bf(n,s){if(s===null)return!1;for(var o=0;o<s.length&&o<n.length;o++)if(!ki(n[o],s[o]))return!1;return!0}function xf(n,s,o,u,p,_){return qn=_,Re=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=n===null||n.memoizedState===null?c0:Hf,ds=!1,_=o(u,p),ds=!1,rl&&(_=T_(s,o,u,p)),M_(n),_}function M_(n){M.H=_o;var s=et!==null&&et.next!==null;if(qn=0,Mt=et=Re=null,Sc=!1,po=0,sl=null,s)throw Error(r(300));n===null||Tt||(n=n.dependencies,n!==null&&hc(n)&&(Tt=!0))}function T_(n,s,o,u){Re=n;var p=0;do{if(rl&&(sl=null),po=0,rl=!1,25<=p)throw Error(r(301));if(p+=1,Mt=et=null,n.updateQueue!=null){var _=n.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}M.H=u0,_=s(o,u)}while(rl);return _}function C2(){var n=M.H,s=n.useState()[0];return s=typeof s.then=="function"?go(s):s,n=n.useState()[0],(et!==null?et.memoizedState:null)!==n&&(Re.flags|=1024),s}function wf(){var n=bc!==0;return bc=0,n}function Cf(n,s,o){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~o}function Ef(n){if(Sc){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}Sc=!1}qn=0,Mt=et=Re=null,rl=!1,po=bc=0,sl=null}function li(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Re.memoizedState=Mt=n:Mt=Mt.next=n,Mt}function wt(){if(et===null){var n=Re.alternate;n=n!==null?n.memoizedState:null}else n=et.next;var s=Mt===null?Re.memoizedState:Mt.next;if(s!==null)Mt=s,et=n;else{if(n===null)throw Re.alternate===null?Error(r(467)):Error(r(310));et=n,n={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},Mt===null?Re.memoizedState=Mt=n:Mt=Mt.next=n}return Mt}function xc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function go(n){var s=po;return po+=1,sl===null&&(sl=[]),n=v_(sl,n,s),s=Re,(Mt===null?s.memoizedState:Mt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?c0:Hf),n}function wc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return go(n);if(n.$$typeof===k)return Xt(n)}throw Error(r(438,String(n)))}function kf(n){var s=null,o=Re.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var u=Re.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(p){return p.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=xc(),Re.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(n),u=0;u<n;u++)o[u]=ne;return s.index++,o}function Vn(n,s){return typeof s=="function"?s(n):s}function Cc(n){var s=wt();return Mf(s,et,n)}function Mf(n,s,o){var u=n.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var p=n.baseQueue,_=u.pending;if(_!==null){if(p!==null){var x=p.next;p.next=_.next,_.next=x}s.baseQueue=p=_,u.pending=null}if(_=n.baseState,p===null)n.memoizedState=_;else{s=p.next;var A=x=null,$=null,J=s,se=!1;do{var ae=J.lane&-536870913;if(ae!==J.lane?(Ue&ae)===ae:(qn&ae)===ae){var te=J.revertLane;if(te===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ae===Js&&(se=!0);else if((qn&te)===te){J=J.next,te===Js&&(se=!0);continue}else ae={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},$===null?(A=$=ae,x=_):$=$.next=ae,Re.lanes|=te,Mr|=te;ae=J.action,ds&&o(_,ae),_=J.hasEagerState?J.eagerState:o(_,ae)}else te={lane:ae,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},$===null?(A=$=te,x=_):$=$.next=te,Re.lanes|=ae,Mr|=ae;J=J.next}while(J!==null&&J!==s);if($===null?x=_:$.next=A,!ki(_,n.memoizedState)&&(Tt=!0,se&&(o=el,o!==null)))throw o;n.memoizedState=_,n.baseState=x,n.baseQueue=$,u.lastRenderedState=_}return p===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function Tf(n){var s=wt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=n;var u=o.dispatch,p=o.pending,_=s.memoizedState;if(p!==null){o.pending=null;var x=p=p.next;do _=n(_,x.action),x=x.next;while(x!==p);ki(_,s.memoizedState)||(Tt=!0),s.memoizedState=_,s.baseQueue===null&&(s.baseState=_),o.lastRenderedState=_}return[_,u]}function N_(n,s,o){var u=Re,p=wt(),_=Ve;if(_){if(o===void 0)throw Error(r(407));o=o()}else o=s();var x=!ki((et||p).memoizedState,o);if(x&&(p.memoizedState=o,Tt=!0),p=p.queue,Df(R_.bind(null,u,p,n),[n]),p.getSnapshot!==s||x||Mt!==null&&Mt.memoizedState.tag&1){if(u.flags|=2048,ll(9,{destroy:void 0},D_.bind(null,u,p,o,s),null),rt===null)throw Error(r(349));_||(qn&127)!==0||A_(u,s,o)}return o}function A_(n,s,o){n.flags|=16384,n={getSnapshot:s,value:o},s=Re.updateQueue,s===null?(s=xc(),Re.updateQueue=s,s.stores=[n]):(o=s.stores,o===null?s.stores=[n]:o.push(n))}function D_(n,s,o,u){s.value=o,s.getSnapshot=u,B_(s)&&L_(n)}function R_(n,s,o){return o(function(){B_(s)&&L_(n)})}function B_(n){var s=n.getSnapshot;n=n.value;try{var o=s();return!ki(n,o)}catch{return!0}}function L_(n){var s=rs(n,2);s!==null&&vi(s,n,2)}function Nf(n){var s=li();if(typeof n=="function"){var o=n;if(n=o(),ds){ei(!0);try{o()}finally{ei(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:n},s}function z_(n,s,o,u){return n.baseState=o,Mf(n,et,typeof u=="function"?u:Vn)}function E2(n,s,o,u,p){if(Mc(n))throw Error(r(485));if(n=s.action,n!==null){var _={payload:p,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){_.listeners.push(x)}};M.T!==null?o(!0):_.isTransition=!1,u(_),o=s.pending,o===null?(_.next=s.pending=_,O_(s,_)):(_.next=o.next,s.pending=o.next=_)}}function O_(n,s){var o=s.action,u=s.payload,p=n.state;if(s.isTransition){var _=M.T,x={};M.T=x;try{var A=o(p,u),$=M.S;$!==null&&$(x,A),H_(n,s,A)}catch(J){Af(n,s,J)}finally{_!==null&&x.types!==null&&(_.types=x.types),M.T=_}}else try{_=o(p,u),H_(n,s,_)}catch(J){Af(n,s,J)}}function H_(n,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){j_(n,s,u)},function(u){return Af(n,s,u)}):j_(n,s,o)}function j_(n,s,o){s.status="fulfilled",s.value=o,P_(s),n.state=o,s=n.pending,s!==null&&(o=s.next,o===s?n.pending=null:(o=o.next,s.next=o,O_(n,o)))}function Af(n,s,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=o,P_(s),s=s.next;while(s!==u)}n.action=null}function P_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function I_(n,s){return s}function U_(n,s){if(Ve){var o=rt.formState;if(o!==null){e:{var u=Re;if(Ve){if(ot){t:{for(var p=ot,_=Vi;p.nodeType!==8;){if(!_){p=null;break t}if(p=Yi(p.nextSibling),p===null){p=null;break t}}_=p.data,p=_==="F!"||_==="F"?p:null}if(p){ot=Yi(p.nextSibling),u=p.data==="F!";break e}}vr(u)}u=!1}u&&(s=o[0])}}return o=li(),o.memoizedState=o.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:I_,lastRenderedState:s},o.queue=u,o=l0.bind(null,Re,u),u.dispatch=o,u=Nf(!1),_=Of.bind(null,Re,!1,u.queue),u=li(),p={state:s,dispatch:null,action:n,pending:null},u.queue=p,o=E2.bind(null,Re,p,_,o),p.dispatch=o,u.memoizedState=n,[s,o,!1]}function q_(n){var s=wt();return V_(s,et,n)}function V_(n,s,o){if(s=Mf(n,s,I_)[0],n=Cc(Vn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=go(s)}catch(x){throw x===tl?pc:x}else u=s;s=wt();var p=s.queue,_=p.dispatch;return o!==s.memoizedState&&(Re.flags|=2048,ll(9,{destroy:void 0},k2.bind(null,p,o),null)),[u,_,n]}function k2(n,s){n.action=s}function F_(n){var s=wt(),o=et;if(o!==null)return V_(s,o,n);wt(),s=s.memoizedState,o=wt();var u=o.queue.dispatch;return o.memoizedState=n,[s,u,!1]}function ll(n,s,o,u){return n={tag:n,create:o,deps:u,inst:s,next:null},s=Re.updateQueue,s===null&&(s=xc(),Re.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,s.lastEffect=n),n}function Y_(){return wt().memoizedState}function Ec(n,s,o,u){var p=li();Re.flags|=n,p.memoizedState=ll(1|s,{destroy:void 0},o,u===void 0?null:u)}function kc(n,s,o,u){var p=wt();u=u===void 0?null:u;var _=p.memoizedState.inst;et!==null&&u!==null&&bf(u,et.memoizedState.deps)?p.memoizedState=ll(s,_,o,u):(Re.flags|=n,p.memoizedState=ll(1|s,_,o,u))}function W_(n,s){Ec(8390656,8,n,s)}function Df(n,s){kc(2048,8,n,s)}function M2(n){Re.flags|=4;var s=Re.updateQueue;if(s===null)s=xc(),Re.updateQueue=s,s.events=[n];else{var o=s.events;o===null?s.events=[n]:o.push(n)}}function $_(n){var s=wt().memoizedState;return M2({ref:s,nextImpl:n}),function(){if((Ke&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function X_(n,s){return kc(4,2,n,s)}function K_(n,s){return kc(4,4,n,s)}function G_(n,s){if(typeof s=="function"){n=n();var o=s(n);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function Z_(n,s,o){o=o!=null?o.concat([n]):null,kc(4,4,G_.bind(null,s,n),o)}function Rf(){}function Q_(n,s){var o=wt();s=s===void 0?null:s;var u=o.memoizedState;return s!==null&&bf(s,u[1])?u[0]:(o.memoizedState=[n,s],n)}function J_(n,s){var o=wt();s=s===void 0?null:s;var u=o.memoizedState;if(s!==null&&bf(s,u[1]))return u[0];if(u=n(),ds){ei(!0);try{n()}finally{ei(!1)}}return o.memoizedState=[u,s],u}function Bf(n,s,o){return o===void 0||(qn&1073741824)!==0&&(Ue&261930)===0?n.memoizedState=s:(n.memoizedState=o,n=ev(),Re.lanes|=n,Mr|=n,o)}function e0(n,s,o,u){return ki(o,s)?o:nl.current!==null?(n=Bf(n,o,u),ki(n,s)||(Tt=!0),n):(qn&42)===0||(qn&1073741824)!==0&&(Ue&261930)===0?(Tt=!0,n.memoizedState=o):(n=ev(),Re.lanes|=n,Mr|=n,s)}function t0(n,s,o,u,p){var _=j.p;j.p=_!==0&&8>_?_:8;var x=M.T,A={};M.T=A,Of(n,!1,s,o);try{var $=p(),J=M.S;if(J!==null&&J(A,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var se=x2($,u);mo(n,s,se,Ri(n))}else mo(n,s,u,Ri(n))}catch(ae){mo(n,s,{then:function(){},status:"rejected",reason:ae},Ri())}finally{j.p=_,x!==null&&A.types!==null&&(x.types=A.types),M.T=x}}function T2(){}function Lf(n,s,o,u){if(n.tag!==5)throw Error(r(476));var p=i0(n).queue;t0(n,p,s,H,o===null?T2:function(){return n0(n),o(u)})}function i0(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:H},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vn,lastRenderedState:o},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function n0(n){var s=i0(n);s.next===null&&(s=n.alternate.memoizedState),mo(n,s.next.queue,{},Ri())}function zf(){return Xt(Bo)}function r0(){return wt().memoizedState}function s0(){return wt().memoizedState}function N2(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var o=Ri();n=br(o);var u=xr(s,n,o);u!==null&&(vi(u,s,o),uo(u,s,o)),s={cache:uf()},n.payload=s;return}s=s.return}}function A2(n,s,o){var u=Ri();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Mc(n)?o0(s,o):(o=Qh(n,s,o,u),o!==null&&(vi(o,n,u),a0(o,s,u)))}function l0(n,s,o){var u=Ri();mo(n,s,o,u)}function mo(n,s,o,u){var p={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Mc(n))o0(s,p);else{var _=n.alternate;if(n.lanes===0&&(_===null||_.lanes===0)&&(_=s.lastRenderedReducer,_!==null))try{var x=s.lastRenderedState,A=_(x,o);if(p.hasEagerState=!0,p.eagerState=A,ki(A,x))return oc(n,s,p,0),rt===null&&lc(),!1}catch{}finally{}if(o=Qh(n,s,p,u),o!==null)return vi(o,n,u),a0(o,s,u),!0}return!1}function Of(n,s,o,u){if(u={lane:2,revertLane:pd(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Mc(n)){if(s)throw Error(r(479))}else s=Qh(n,o,u,2),s!==null&&vi(s,n,2)}function Mc(n){var s=n.alternate;return n===Re||s!==null&&s===Re}function o0(n,s){rl=Sc=!0;var o=n.pending;o===null?s.next=s:(s.next=o.next,o.next=s),n.pending=s}function a0(n,s,o){if((o&4194048)!==0){var u=s.lanes;u&=n.pendingLanes,o|=u,s.lanes=o,Ia(n,o)}}var _o={readContext:Xt,use:wc,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useLayoutEffect:mt,useInsertionEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useSyncExternalStore:mt,useId:mt,useHostTransitionStatus:mt,useFormState:mt,useActionState:mt,useOptimistic:mt,useMemoCache:mt,useCacheRefresh:mt};_o.useEffectEvent=mt;var c0={readContext:Xt,use:wc,useCallback:function(n,s){return li().memoizedState=[n,s===void 0?null:s],n},useContext:Xt,useEffect:W_,useImperativeHandle:function(n,s,o){o=o!=null?o.concat([n]):null,Ec(4194308,4,G_.bind(null,s,n),o)},useLayoutEffect:function(n,s){return Ec(4194308,4,n,s)},useInsertionEffect:function(n,s){Ec(4,2,n,s)},useMemo:function(n,s){var o=li();s=s===void 0?null:s;var u=n();if(ds){ei(!0);try{n()}finally{ei(!1)}}return o.memoizedState=[u,s],u},useReducer:function(n,s,o){var u=li();if(o!==void 0){var p=o(s);if(ds){ei(!0);try{o(s)}finally{ei(!1)}}}else p=s;return u.memoizedState=u.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},u.queue=n,n=n.dispatch=A2.bind(null,Re,n),[u.memoizedState,n]},useRef:function(n){var s=li();return n={current:n},s.memoizedState=n},useState:function(n){n=Nf(n);var s=n.queue,o=l0.bind(null,Re,s);return s.dispatch=o,[n.memoizedState,o]},useDebugValue:Rf,useDeferredValue:function(n,s){var o=li();return Bf(o,n,s)},useTransition:function(){var n=Nf(!1);return n=t0.bind(null,Re,n.queue,!0,!1),li().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,o){var u=Re,p=li();if(Ve){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),rt===null)throw Error(r(349));(Ue&127)!==0||A_(u,s,o)}p.memoizedState=o;var _={value:o,getSnapshot:s};return p.queue=_,W_(R_.bind(null,u,_,n),[n]),u.flags|=2048,ll(9,{destroy:void 0},D_.bind(null,u,_,o,s),null),o},useId:function(){var n=li(),s=rt.identifierPrefix;if(Ve){var o=pn,u=dn;o=(u&~(1<<32-Ze(u)-1)).toString(32)+o,s="_"+s+"R_"+o,o=bc++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=w2++,s="_"+s+"r_"+o.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:zf,useFormState:U_,useActionState:U_,useOptimistic:function(n){var s=li();s.memoizedState=s.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=Of.bind(null,Re,!0,o),o.dispatch=s,[n,s]},useMemoCache:kf,useCacheRefresh:function(){return li().memoizedState=N2.bind(null,Re)},useEffectEvent:function(n){var s=li(),o={impl:n};return s.memoizedState=o,function(){if((Ke&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},Hf={readContext:Xt,use:wc,useCallback:Q_,useContext:Xt,useEffect:Df,useImperativeHandle:Z_,useInsertionEffect:X_,useLayoutEffect:K_,useMemo:J_,useReducer:Cc,useRef:Y_,useState:function(){return Cc(Vn)},useDebugValue:Rf,useDeferredValue:function(n,s){var o=wt();return e0(o,et.memoizedState,n,s)},useTransition:function(){var n=Cc(Vn)[0],s=wt().memoizedState;return[typeof n=="boolean"?n:go(n),s]},useSyncExternalStore:N_,useId:r0,useHostTransitionStatus:zf,useFormState:q_,useActionState:q_,useOptimistic:function(n,s){var o=wt();return z_(o,et,n,s)},useMemoCache:kf,useCacheRefresh:s0};Hf.useEffectEvent=$_;var u0={readContext:Xt,use:wc,useCallback:Q_,useContext:Xt,useEffect:Df,useImperativeHandle:Z_,useInsertionEffect:X_,useLayoutEffect:K_,useMemo:J_,useReducer:Tf,useRef:Y_,useState:function(){return Tf(Vn)},useDebugValue:Rf,useDeferredValue:function(n,s){var o=wt();return et===null?Bf(o,n,s):e0(o,et.memoizedState,n,s)},useTransition:function(){var n=Tf(Vn)[0],s=wt().memoizedState;return[typeof n=="boolean"?n:go(n),s]},useSyncExternalStore:N_,useId:r0,useHostTransitionStatus:zf,useFormState:F_,useActionState:F_,useOptimistic:function(n,s){var o=wt();return et!==null?z_(o,et,n,s):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:kf,useCacheRefresh:s0};u0.useEffectEvent=$_;function jf(n,s,o,u){s=n.memoizedState,o=o(u,s),o=o==null?s:g({},s,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Pf={enqueueSetState:function(n,s,o){n=n._reactInternals;var u=Ri(),p=br(u);p.payload=s,o!=null&&(p.callback=o),s=xr(n,p,u),s!==null&&(vi(s,n,u),uo(s,n,u))},enqueueReplaceState:function(n,s,o){n=n._reactInternals;var u=Ri(),p=br(u);p.tag=1,p.payload=s,o!=null&&(p.callback=o),s=xr(n,p,u),s!==null&&(vi(s,n,u),uo(s,n,u))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var o=Ri(),u=br(o);u.tag=2,s!=null&&(u.callback=s),s=xr(n,u,o),s!==null&&(vi(s,n,o),uo(s,n,o))}};function h0(n,s,o,u,p,_,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,_,x):s.prototype&&s.prototype.isPureReactComponent?!io(o,u)||!io(p,_):!0}function f0(n,s,o,u){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,u),s.state!==n&&Pf.enqueueReplaceState(s,s.state,null)}function ps(n,s){var o=s;if("ref"in s){o={};for(var u in s)u!=="ref"&&(o[u]=s[u])}if(n=n.defaultProps){o===s&&(o=g({},o));for(var p in n)o[p]===void 0&&(o[p]=n[p])}return o}function d0(n){sc(n)}function p0(n){console.error(n)}function g0(n){sc(n)}function Tc(n,s){try{var o=n.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function m0(n,s,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function If(n,s,o){return o=br(o),o.tag=3,o.payload={element:null},o.callback=function(){Tc(n,s)},o}function _0(n){return n=br(n),n.tag=3,n}function v0(n,s,o,u){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var _=u.value;n.payload=function(){return p(_)},n.callback=function(){m0(s,o,u)}}var x=o.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){m0(s,o,u),typeof p!="function"&&(Tr===null?Tr=new Set([this]):Tr.add(this));var A=u.stack;this.componentDidCatch(u.value,{componentStack:A!==null?A:""})})}function D2(n,s,o,u,p){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=o.alternate,s!==null&&Qs(s,o,p,!0),o=Ti.current,o!==null){switch(o.tag){case 31:case 13:return Fi===null?Ic():o.alternate===null&&_t===0&&(_t=3),o.flags&=-257,o.flags|=65536,o.lanes=p,u===gc?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([u]):s.add(u),hd(n,u,p)),!1;case 22:return o.flags|=65536,u===gc?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([u]):o.add(u)),hd(n,u,p)),!1}throw Error(r(435,o.tag))}return hd(n,u,p),Ic(),!1}if(Ve)return s=Ti.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=p,u!==sf&&(n=Error(r(422),{cause:u}),so(Ii(n,o)))):(u!==sf&&(s=Error(r(423),{cause:u}),so(Ii(s,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,u=Ii(u,o),p=If(n.stateNode,u,p),mf(n,p),_t!==4&&(_t=2)),!1;var _=Error(r(520),{cause:u});if(_=Ii(_,o),Eo===null?Eo=[_]:Eo.push(_),_t!==4&&(_t=2),s===null)return!0;u=Ii(u,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=If(o.stateNode,u,n),mf(o,n),!1;case 1:if(s=o.type,_=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Tr===null||!Tr.has(_))))return o.flags|=65536,p&=-p,o.lanes|=p,p=_0(p),v0(p,n,o,u),mf(o,p),!1}o=o.return}while(o!==null);return!1}var Uf=Error(r(461)),Tt=!1;function Kt(n,s,o,u){s.child=n===null?x_(s,null,o,u):fs(s,n.child,o,u)}function y0(n,s,o,u,p){o=o.render;var _=s.ref;if("ref"in u){var x={};for(var A in u)A!=="ref"&&(x[A]=u[A])}else x=u;return as(s),u=xf(n,s,o,x,_,p),A=wf(),n!==null&&!Tt?(Cf(n,s,p),Fn(n,s,p)):(Ve&&A&&nf(s),s.flags|=1,Kt(n,s,u,p),s.child)}function S0(n,s,o,u,p){if(n===null){var _=o.type;return typeof _=="function"&&!Jh(_)&&_.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=_,b0(n,s,_,u,p)):(n=cc(o.type,null,u,s,s.mode,p),n.ref=s.ref,n.return=s,s.child=n)}if(_=n.child,!Kf(n,p)){var x=_.memoizedProps;if(o=o.compare,o=o!==null?o:io,o(x,u)&&n.ref===s.ref)return Fn(n,s,p)}return s.flags|=1,n=jn(_,u),n.ref=s.ref,n.return=s,s.child=n}function b0(n,s,o,u,p){if(n!==null){var _=n.memoizedProps;if(io(_,u)&&n.ref===s.ref)if(Tt=!1,s.pendingProps=u=_,Kf(n,p))(n.flags&131072)!==0&&(Tt=!0);else return s.lanes=n.lanes,Fn(n,s,p)}return qf(n,s,o,u,p)}function x0(n,s,o,u){var p=u.children,_=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((s.flags&128)!==0){if(_=_!==null?_.baseLanes|o:o,n!==null){for(u=s.child=n.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~_}else u=0,s.child=null;return w0(n,s,_,o,u)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&dc(s,_!==null?_.cachePool:null),_!==null?E_(s,_):vf(),k_(s);else return u=s.lanes=536870912,w0(n,s,_!==null?_.baseLanes|o:o,o,u)}else _!==null?(dc(s,_.cachePool),E_(s,_),Cr(),s.memoizedState=null):(n!==null&&dc(s,null),vf(),Cr());return Kt(n,s,p,o),s.child}function vo(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function w0(n,s,o,u,p){var _=ff();return _=_===null?null:{parent:kt._currentValue,pool:_},s.memoizedState={baseLanes:o,cachePool:_},n!==null&&dc(s,null),vf(),k_(s),n!==null&&Qs(n,s,u,!0),s.childLanes=p,null}function Nc(n,s){return s=Dc({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function C0(n,s,o){return fs(s,n.child,null,o),n=Nc(s,s.pendingProps),n.flags|=2,Ni(s),s.memoizedState=null,n}function R2(n,s,o){var u=s.pendingProps,p=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Ve){if(u.mode==="hidden")return n=Nc(s,u),s.lanes=536870912,vo(null,n);if(Sf(s),(n=ot)?(n=Ov(n,Vi),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:mr!==null?{id:dn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},o=o_(n),o.return=s,s.child=o,$t=s,ot=null)):n=null,n===null)throw vr(s);return s.lanes=536870912,null}return Nc(s,u)}var _=n.memoizedState;if(_!==null){var x=_.dehydrated;if(Sf(s),p)if(s.flags&256)s.flags&=-257,s=C0(n,s,o);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(r(558));else if(Tt||Qs(n,s,o,!1),p=(o&n.childLanes)!==0,Tt||p){if(u=rt,u!==null&&(x=Ua(u,o),x!==0&&x!==_.retryLane))throw _.retryLane=x,rs(n,x),vi(u,n,x),Uf;Ic(),s=C0(n,s,o)}else n=_.treeContext,ot=Yi(x.nextSibling),$t=s,Ve=!0,_r=null,Vi=!1,n!==null&&u_(s,n),s=Nc(s,u),s.flags|=4096;return s}return n=jn(n.child,{mode:u.mode,children:u.children}),n.ref=s.ref,s.child=n,n.return=s,n}function Ac(n,s){var o=s.ref;if(o===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(n===null||n.ref!==o)&&(s.flags|=4194816)}}function qf(n,s,o,u,p){return as(s),o=xf(n,s,o,u,void 0,p),u=wf(),n!==null&&!Tt?(Cf(n,s,p),Fn(n,s,p)):(Ve&&u&&nf(s),s.flags|=1,Kt(n,s,o,p),s.child)}function E0(n,s,o,u,p,_){return as(s),s.updateQueue=null,o=T_(s,u,o,p),M_(n),u=wf(),n!==null&&!Tt?(Cf(n,s,_),Fn(n,s,_)):(Ve&&u&&nf(s),s.flags|=1,Kt(n,s,o,_),s.child)}function k0(n,s,o,u,p){if(as(s),s.stateNode===null){var _=Xs,x=o.contextType;typeof x=="object"&&x!==null&&(_=Xt(x)),_=new o(u,_),s.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Pf,s.stateNode=_,_._reactInternals=s,_=s.stateNode,_.props=u,_.state=s.memoizedState,_.refs={},pf(s),x=o.contextType,_.context=typeof x=="object"&&x!==null?Xt(x):Xs,_.state=s.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(jf(s,o,x,u),_.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(x=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),x!==_.state&&Pf.enqueueReplaceState(_,_.state,null),fo(s,u,_,p),ho(),_.state=s.memoizedState),typeof _.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(n===null){_=s.stateNode;var A=s.memoizedProps,$=ps(o,A);_.props=$;var J=_.context,se=o.contextType;x=Xs,typeof se=="object"&&se!==null&&(x=Xt(se));var ae=o.getDerivedStateFromProps;se=typeof ae=="function"||typeof _.getSnapshotBeforeUpdate=="function",A=s.pendingProps!==A,se||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(A||J!==x)&&f0(s,_,u,x),Sr=!1;var te=s.memoizedState;_.state=te,fo(s,u,_,p),ho(),J=s.memoizedState,A||te!==J||Sr?(typeof ae=="function"&&(jf(s,o,ae,u),J=s.memoizedState),($=Sr||h0(s,o,$,u,te,J,x))?(se||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(s.flags|=4194308)):(typeof _.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=J),_.props=u,_.state=J,_.context=x,u=$):(typeof _.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{_=s.stateNode,gf(n,s),x=s.memoizedProps,se=ps(o,x),_.props=se,ae=s.pendingProps,te=_.context,J=o.contextType,$=Xs,typeof J=="object"&&J!==null&&($=Xt(J)),A=o.getDerivedStateFromProps,(J=typeof A=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(x!==ae||te!==$)&&f0(s,_,u,$),Sr=!1,te=s.memoizedState,_.state=te,fo(s,u,_,p),ho();var ie=s.memoizedState;x!==ae||te!==ie||Sr||n!==null&&n.dependencies!==null&&hc(n.dependencies)?(typeof A=="function"&&(jf(s,o,A,u),ie=s.memoizedState),(se=Sr||h0(s,o,se,u,te,ie,$)||n!==null&&n.dependencies!==null&&hc(n.dependencies))?(J||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(u,ie,$),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(u,ie,$)),typeof _.componentDidUpdate=="function"&&(s.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof _.componentDidUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=ie),_.props=u,_.state=ie,_.context=$,u=se):(typeof _.componentDidUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&te===n.memoizedState||(s.flags|=1024),u=!1)}return _=u,Ac(n,s),u=(s.flags&128)!==0,_||u?(_=s.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:_.render(),s.flags|=1,n!==null&&u?(s.child=fs(s,n.child,null,p),s.child=fs(s,null,o,p)):Kt(n,s,o,p),s.memoizedState=_.state,n=s.child):n=Fn(n,s,p),n}function M0(n,s,o,u){return ls(),s.flags|=256,Kt(n,s,o,u),s.child}var Vf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ff(n){return{baseLanes:n,cachePool:m_()}}function Yf(n,s,o){return n=n!==null?n.childLanes&~o:0,s&&(n|=Di),n}function T0(n,s,o){var u=s.pendingProps,p=!1,_=(s.flags&128)!==0,x;if((x=_)||(x=n!==null&&n.memoizedState===null?!1:(xt.current&2)!==0),x&&(p=!0,s.flags&=-129),x=(s.flags&32)!==0,s.flags&=-33,n===null){if(Ve){if(p?wr(s):Cr(),(n=ot)?(n=Ov(n,Vi),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:mr!==null?{id:dn,overflow:pn}:null,retryLane:536870912,hydrationErrors:null},o=o_(n),o.return=s,s.child=o,$t=s,ot=null)):n=null,n===null)throw vr(s);return Md(n)?s.lanes=32:s.lanes=536870912,null}var A=u.children;return u=u.fallback,p?(Cr(),p=s.mode,A=Dc({mode:"hidden",children:A},p),u=ss(u,p,o,null),A.return=s,u.return=s,A.sibling=u,s.child=A,u=s.child,u.memoizedState=Ff(o),u.childLanes=Yf(n,x,o),s.memoizedState=Vf,vo(null,u)):(wr(s),Wf(s,A))}var $=n.memoizedState;if($!==null&&(A=$.dehydrated,A!==null)){if(_)s.flags&256?(wr(s),s.flags&=-257,s=$f(n,s,o)):s.memoizedState!==null?(Cr(),s.child=n.child,s.flags|=128,s=null):(Cr(),A=u.fallback,p=s.mode,u=Dc({mode:"visible",children:u.children},p),A=ss(A,p,o,null),A.flags|=2,u.return=s,A.return=s,u.sibling=A,s.child=u,fs(s,n.child,null,o),u=s.child,u.memoizedState=Ff(o),u.childLanes=Yf(n,x,o),s.memoizedState=Vf,s=vo(null,u));else if(wr(s),Md(A)){if(x=A.nextSibling&&A.nextSibling.dataset,x)var J=x.dgst;x=J,u=Error(r(419)),u.stack="",u.digest=x,so({value:u,source:null,stack:null}),s=$f(n,s,o)}else if(Tt||Qs(n,s,o,!1),x=(o&n.childLanes)!==0,Tt||x){if(x=rt,x!==null&&(u=Ua(x,o),u!==0&&u!==$.retryLane))throw $.retryLane=u,rs(n,u),vi(x,n,u),Uf;kd(A)||Ic(),s=$f(n,s,o)}else kd(A)?(s.flags|=192,s.child=n.child,s=null):(n=$.treeContext,ot=Yi(A.nextSibling),$t=s,Ve=!0,_r=null,Vi=!1,n!==null&&u_(s,n),s=Wf(s,u.children),s.flags|=4096);return s}return p?(Cr(),A=u.fallback,p=s.mode,$=n.child,J=$.sibling,u=jn($,{mode:"hidden",children:u.children}),u.subtreeFlags=$.subtreeFlags&65011712,J!==null?A=jn(J,A):(A=ss(A,p,o,null),A.flags|=2),A.return=s,u.return=s,u.sibling=A,s.child=u,vo(null,u),u=s.child,A=n.child.memoizedState,A===null?A=Ff(o):(p=A.cachePool,p!==null?($=kt._currentValue,p=p.parent!==$?{parent:$,pool:$}:p):p=m_(),A={baseLanes:A.baseLanes|o,cachePool:p}),u.memoizedState=A,u.childLanes=Yf(n,x,o),s.memoizedState=Vf,vo(n.child,u)):(wr(s),o=n.child,n=o.sibling,o=jn(o,{mode:"visible",children:u.children}),o.return=s,o.sibling=null,n!==null&&(x=s.deletions,x===null?(s.deletions=[n],s.flags|=16):x.push(n)),s.child=o,s.memoizedState=null,o)}function Wf(n,s){return s=Dc({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function Dc(n,s){return n=Mi(22,n,null,s),n.lanes=0,n}function $f(n,s,o){return fs(s,n.child,null,o),n=Wf(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function N0(n,s,o){n.lanes|=s;var u=n.alternate;u!==null&&(u.lanes|=s),af(n.return,s,o)}function Xf(n,s,o,u,p,_){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:p,treeForkCount:_}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=u,x.tail=o,x.tailMode=p,x.treeForkCount=_)}function A0(n,s,o){var u=s.pendingProps,p=u.revealOrder,_=u.tail;u=u.children;var x=xt.current,A=(x&2)!==0;if(A?(x=x&1|2,s.flags|=128):x&=1,N(xt,x),Kt(n,s,u,o),u=Ve?ro:0,!A&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&N0(n,o,s);else if(n.tag===19)N0(n,o,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(p){case"forwards":for(o=s.child,p=null;o!==null;)n=o.alternate,n!==null&&yc(n)===null&&(p=o),o=o.sibling;o=p,o===null?(p=s.child,s.child=null):(p=o.sibling,o.sibling=null),Xf(s,!1,p,o,_,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=s.child,s.child=null;p!==null;){if(n=p.alternate,n!==null&&yc(n)===null){s.child=p;break}n=p.sibling,p.sibling=o,o=p,p=n}Xf(s,!0,o,null,_,u);break;case"together":Xf(s,!1,null,null,void 0,u);break;default:s.memoizedState=null}return s.child}function Fn(n,s,o){if(n!==null&&(s.dependencies=n.dependencies),Mr|=s.lanes,(o&s.childLanes)===0)if(n!==null){if(Qs(n,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,o=jn(n,n.pendingProps),s.child=o,o.return=s;n.sibling!==null;)n=n.sibling,o=o.sibling=jn(n,n.pendingProps),o.return=s;o.sibling=null}return s.child}function Kf(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&hc(n)))}function B2(n,s,o){switch(s.tag){case 3:he(s,s.stateNode.containerInfo),yr(s,kt,n.memoizedState.cache),ls();break;case 27:case 5:Ce(s);break;case 4:he(s,s.stateNode.containerInfo);break;case 10:yr(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Sf(s),null;break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(wr(s),s.flags|=128,null):(o&s.child.childLanes)!==0?T0(n,s,o):(wr(s),n=Fn(n,s,o),n!==null?n.sibling:null);wr(s);break;case 19:var p=(n.flags&128)!==0;if(u=(o&s.childLanes)!==0,u||(Qs(n,s,o,!1),u=(o&s.childLanes)!==0),p){if(u)return A0(n,s,o);s.flags|=128}if(p=s.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),N(xt,xt.current),u)break;return null;case 22:return s.lanes=0,x0(n,s,o,s.pendingProps);case 24:yr(s,kt,n.memoizedState.cache)}return Fn(n,s,o)}function D0(n,s,o){if(n!==null)if(n.memoizedProps!==s.pendingProps)Tt=!0;else{if(!Kf(n,o)&&(s.flags&128)===0)return Tt=!1,B2(n,s,o);Tt=(n.flags&131072)!==0}else Tt=!1,Ve&&(s.flags&1048576)!==0&&c_(s,ro,s.index);switch(s.lanes=0,s.tag){case 16:e:{var u=s.pendingProps;if(n=us(s.elementType),s.type=n,typeof n=="function")Jh(n)?(u=ps(n,u),s.tag=1,s=k0(null,s,n,u,o)):(s.tag=0,s=qf(null,s,n,u,o));else{if(n!=null){var p=n.$$typeof;if(p===D){s.tag=11,s=y0(null,s,n,u,o);break e}else if(p===U){s.tag=14,s=S0(null,s,n,u,o);break e}}throw s=R(n)||n,Error(r(306,s,""))}}return s;case 0:return qf(n,s,s.type,s.pendingProps,o);case 1:return u=s.type,p=ps(u,s.pendingProps),k0(n,s,u,p,o);case 3:e:{if(he(s,s.stateNode.containerInfo),n===null)throw Error(r(387));u=s.pendingProps;var _=s.memoizedState;p=_.element,gf(n,s),fo(s,u,null,o);var x=s.memoizedState;if(u=x.cache,yr(s,kt,u),u!==_.cache&&cf(s,[kt],o,!0),ho(),u=x.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:x.cache},s.updateQueue.baseState=_,s.memoizedState=_,s.flags&256){s=M0(n,s,u,o);break e}else if(u!==p){p=Ii(Error(r(424)),s),so(p),s=M0(n,s,u,o);break e}else{switch(n=s.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(ot=Yi(n.firstChild),$t=s,Ve=!0,_r=null,Vi=!0,o=x_(s,null,u,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(ls(),u===p){s=Fn(n,s,o);break e}Kt(n,s,u,o)}s=s.child}return s;case 26:return Ac(n,s),n===null?(o=qv(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ve||(o=s.type,n=s.pendingProps,u=$c(oe.current).createElement(o),u[zt]=s,u[ti]=n,Gt(u,o,n),Et(u),s.stateNode=u):s.memoizedState=qv(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Ce(s),n===null&&Ve&&(u=s.stateNode=Pv(s.type,s.pendingProps,oe.current),$t=s,Vi=!0,p=ot,Rr(s.type)?(Td=p,ot=Yi(u.firstChild)):ot=p),Kt(n,s,s.pendingProps.children,o),Ac(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Ve&&((p=u=ot)&&(u=cE(u,s.type,s.pendingProps,Vi),u!==null?(s.stateNode=u,$t=s,ot=Yi(u.firstChild),Vi=!1,p=!0):p=!1),p||vr(s)),Ce(s),p=s.type,_=s.pendingProps,x=n!==null?n.memoizedProps:null,u=_.children,wd(p,_)?u=null:x!==null&&wd(p,x)&&(s.flags|=32),s.memoizedState!==null&&(p=xf(n,s,C2,null,null,o),Bo._currentValue=p),Ac(n,s),Kt(n,s,u,o),s.child;case 6:return n===null&&Ve&&((n=o=ot)&&(o=uE(o,s.pendingProps,Vi),o!==null?(s.stateNode=o,$t=s,ot=null,n=!0):n=!1),n||vr(s)),null;case 13:return T0(n,s,o);case 4:return he(s,s.stateNode.containerInfo),u=s.pendingProps,n===null?s.child=fs(s,null,u,o):Kt(n,s,u,o),s.child;case 11:return y0(n,s,s.type,s.pendingProps,o);case 7:return Kt(n,s,s.pendingProps,o),s.child;case 8:return Kt(n,s,s.pendingProps.children,o),s.child;case 12:return Kt(n,s,s.pendingProps.children,o),s.child;case 10:return u=s.pendingProps,yr(s,s.type,u.value),Kt(n,s,u.children,o),s.child;case 9:return p=s.type._context,u=s.pendingProps.children,as(s),p=Xt(p),u=u(p),s.flags|=1,Kt(n,s,u,o),s.child;case 14:return S0(n,s,s.type,s.pendingProps,o);case 15:return b0(n,s,s.type,s.pendingProps,o);case 19:return A0(n,s,o);case 31:return R2(n,s,o);case 22:return x0(n,s,o,s.pendingProps);case 24:return as(s),u=Xt(kt),n===null?(p=ff(),p===null&&(p=rt,_=uf(),p.pooledCache=_,_.refCount++,_!==null&&(p.pooledCacheLanes|=o),p=_),s.memoizedState={parent:u,cache:p},pf(s),yr(s,kt,p)):((n.lanes&o)!==0&&(gf(n,s),fo(s,null,null,o),ho()),p=n.memoizedState,_=s.memoizedState,p.parent!==u?(p={parent:u,cache:u},s.memoizedState=p,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=p),yr(s,kt,u)):(u=_.cache,yr(s,kt,u),u!==p.cache&&cf(s,[kt],o,!0))),Kt(n,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Yn(n){n.flags|=4}function Gf(n,s,o,u,p){if((s=(n.mode&32)!==0)&&(s=!1),s){if(n.flags|=16777216,(p&335544128)===p)if(n.stateNode.complete)n.flags|=8192;else if(rv())n.flags|=8192;else throw hs=gc,df}else n.flags&=-16777217}function R0(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!$v(s))if(rv())n.flags|=8192;else throw hs=gc,df}function Rc(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?ja():536870912,n.lanes|=s,ul|=s)}function yo(n,s){if(!Ve)switch(n.tailMode){case"hidden":s=n.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function at(n){var s=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(s)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=u,n.childLanes=o,s}function L2(n,s,o){var u=s.pendingProps;switch(rf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(s),null;case 1:return at(s),null;case 3:return o=s.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),Un(kt),pe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(Zs(s)?Yn(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,lf())),at(s),null;case 26:var p=s.type,_=s.memoizedState;return n===null?(Yn(s),_!==null?(at(s),R0(s,_)):(at(s),Gf(s,p,null,u,o))):_?_!==n.memoizedState?(Yn(s),at(s),R0(s,_)):(at(s),s.flags&=-16777217):(n=n.memoizedProps,n!==u&&Yn(s),at(s),Gf(s,p,n,u,o)),null;case 27:if(xe(s),o=oe.current,p=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==u&&Yn(s);else{if(!u){if(s.stateNode===null)throw Error(r(166));return at(s),null}n=ee.current,Zs(s)?h_(s):(n=Pv(p,u,o),s.stateNode=n,Yn(s))}return at(s),null;case 5:if(xe(s),p=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==u&&Yn(s);else{if(!u){if(s.stateNode===null)throw Error(r(166));return at(s),null}if(_=ee.current,Zs(s))h_(s);else{var x=$c(oe.current);switch(_){case 1:_=x.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:_=x.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":_=x.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":_=x.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":_=x.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof u.is=="string"?x.createElement("select",{is:u.is}):x.createElement("select"),u.multiple?_.multiple=!0:u.size&&(_.size=u.size);break;default:_=typeof u.is=="string"?x.createElement(p,{is:u.is}):x.createElement(p)}}_[zt]=s,_[ti]=u;e:for(x=s.child;x!==null;){if(x.tag===5||x.tag===6)_.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===s)break e;for(;x.sibling===null;){if(x.return===null||x.return===s)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}s.stateNode=_;e:switch(Gt(_,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Yn(s)}}return at(s),Gf(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,o),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==u&&Yn(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(r(166));if(n=oe.current,Zs(s)){if(n=s.stateNode,o=s.memoizedProps,u=null,p=$t,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}n[zt]=s,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||Tv(n.nodeValue,o)),n||vr(s,!0)}else n=$c(n).createTextNode(u),n[zt]=s,s.stateNode=n}return at(s),null;case 31:if(o=s.memoizedState,n===null||n.memoizedState!==null){if(u=Zs(s),o!==null){if(n===null){if(!u)throw Error(r(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[zt]=s}else ls(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;at(s),n=!1}else o=lf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return s.flags&256?(Ni(s),s):(Ni(s),null);if((s.flags&128)!==0)throw Error(r(558))}return at(s),null;case 13:if(u=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=Zs(s),u!==null&&u.dehydrated!==null){if(n===null){if(!p)throw Error(r(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[zt]=s}else ls(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;at(s),p=!1}else p=lf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return s.flags&256?(Ni(s),s):(Ni(s),null)}return Ni(s),(s.flags&128)!==0?(s.lanes=o,s):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=s.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==p&&(u.flags|=2048)),o!==n&&o&&(s.child.flags|=8192),Rc(s,s.updateQueue),at(s),null);case 4:return pe(),n===null&&vd(s.stateNode.containerInfo),at(s),null;case 10:return Un(s.type),at(s),null;case 19:if(W(xt),u=s.memoizedState,u===null)return at(s),null;if(p=(s.flags&128)!==0,_=u.rendering,_===null)if(p)yo(u,!1);else{if(_t!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(_=yc(n),_!==null){for(s.flags|=128,yo(u,!1),n=_.updateQueue,s.updateQueue=n,Rc(s,n),s.subtreeFlags=0,n=o,o=s.child;o!==null;)l_(o,n),o=o.sibling;return N(xt,xt.current&1|2),Ve&&Pn(s,u.treeForkCount),s.child}n=n.sibling}u.tail!==null&&Lt()>Hc&&(s.flags|=128,p=!0,yo(u,!1),s.lanes=4194304)}else{if(!p)if(n=yc(_),n!==null){if(s.flags|=128,p=!0,n=n.updateQueue,s.updateQueue=n,Rc(s,n),yo(u,!0),u.tail===null&&u.tailMode==="hidden"&&!_.alternate&&!Ve)return at(s),null}else 2*Lt()-u.renderingStartTime>Hc&&o!==536870912&&(s.flags|=128,p=!0,yo(u,!1),s.lanes=4194304);u.isBackwards?(_.sibling=s.child,s.child=_):(n=u.last,n!==null?n.sibling=_:s.child=_,u.last=_)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Lt(),n.sibling=null,o=xt.current,N(xt,p?o&1|2:o&1),Ve&&Pn(s,u.treeForkCount),n):(at(s),null);case 22:case 23:return Ni(s),yf(),u=s.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(o&536870912)!==0&&(s.flags&128)===0&&(at(s),s.subtreeFlags&6&&(s.flags|=8192)):at(s),o=s.updateQueue,o!==null&&Rc(s,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048),n!==null&&W(cs),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),Un(kt),at(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function z2(n,s){switch(rf(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return Un(kt),pe(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return xe(s),null;case 31:if(s.memoizedState!==null){if(Ni(s),s.alternate===null)throw Error(r(340));ls()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(Ni(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ls()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return W(xt),null;case 4:return pe(),null;case 10:return Un(s.type),null;case 22:case 23:return Ni(s),yf(),n!==null&&W(cs),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return Un(kt),null;case 25:return null;default:return null}}function B0(n,s){switch(rf(s),s.tag){case 3:Un(kt),pe();break;case 26:case 27:case 5:xe(s);break;case 4:pe();break;case 31:s.memoizedState!==null&&Ni(s);break;case 13:Ni(s);break;case 19:W(xt);break;case 10:Un(s.type);break;case 22:case 23:Ni(s),yf(),n!==null&&W(cs);break;case 24:Un(kt)}}function So(n,s){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&n)===n){u=void 0;var _=o.create,x=o.inst;u=_(),x.destroy=u}o=o.next}while(o!==p)}}catch(A){Je(s,s.return,A)}}function Er(n,s,o){try{var u=s.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var _=p.next;u=_;do{if((u.tag&n)===n){var x=u.inst,A=x.destroy;if(A!==void 0){x.destroy=void 0,p=s;var $=o,J=A;try{J()}catch(se){Je(p,$,se)}}}u=u.next}while(u!==_)}}catch(se){Je(s,s.return,se)}}function L0(n){var s=n.updateQueue;if(s!==null){var o=n.stateNode;try{C_(s,o)}catch(u){Je(n,n.return,u)}}}function z0(n,s,o){o.props=ps(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){Je(n,s,u)}}function bo(n,s){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(p){Je(n,s,p)}}function gn(n,s){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(p){Je(n,s,p)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){Je(n,s,p)}else o.current=null}function O0(n){var s=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(p){Je(n,n.return,p)}}function Zf(n,s,o){try{var u=n.stateNode;nE(u,n.type,o,s),u[ti]=s}catch(p){Je(n,n.return,p)}}function H0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Rr(n.type)||n.tag===4}function Qf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||H0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Rr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Jf(n,s,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(n),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=On));else if(u!==4&&(u===27&&Rr(n.type)&&(o=n.stateNode,s=null),n=n.child,n!==null))for(Jf(n,s,o),n=n.sibling;n!==null;)Jf(n,s,o),n=n.sibling}function Bc(n,s,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,s?o.insertBefore(n,s):o.appendChild(n);else if(u!==4&&(u===27&&Rr(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Bc(n,s,o),n=n.sibling;n!==null;)Bc(n,s,o),n=n.sibling}function j0(n){var s=n.stateNode,o=n.memoizedProps;try{for(var u=n.type,p=s.attributes;p.length;)s.removeAttributeNode(p[0]);Gt(s,u,o),s[zt]=n,s[ti]=o}catch(_){Je(n,n.return,_)}}var Wn=!1,Nt=!1,ed=!1,P0=typeof WeakSet=="function"?WeakSet:Set,It=null;function O2(n,s){if(n=n.containerInfo,bd=eu,n=Zm(n),Wh(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{o.nodeType,_.nodeType}catch{o=null;break e}var x=0,A=-1,$=-1,J=0,se=0,ae=n,te=null;t:for(;;){for(var ie;ae!==o||p!==0&&ae.nodeType!==3||(A=x+p),ae!==_||u!==0&&ae.nodeType!==3||($=x+u),ae.nodeType===3&&(x+=ae.nodeValue.length),(ie=ae.firstChild)!==null;)te=ae,ae=ie;for(;;){if(ae===n)break t;if(te===o&&++J===p&&(A=x),te===_&&++se===u&&($=x),(ie=ae.nextSibling)!==null)break;ae=te,te=ae.parentNode}ae=ie}o=A===-1||$===-1?null:{start:A,end:$}}else o=null}o=o||{start:0,end:0}}else o=null;for(xd={focusedElem:n,selectionRange:o},eu=!1,It=s;It!==null;)if(s=It,n=s.child,(s.subtreeFlags&1028)!==0&&n!==null)n.return=s,It=n;else for(;It!==null;){switch(s=It,_=s.alternate,n=s.flags,s.tag){case 0:if((n&4)!==0&&(n=s.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)p=n[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&_!==null){n=void 0,o=s,p=_.memoizedProps,_=_.memoizedState,u=o.stateNode;try{var ye=ps(o.type,p);n=u.getSnapshotBeforeUpdate(ye,_),u.__reactInternalSnapshotBeforeUpdate=n}catch(Me){Je(o,o.return,Me)}}break;case 3:if((n&1024)!==0){if(n=s.stateNode.containerInfo,o=n.nodeType,o===9)Ed(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Ed(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=s.sibling,n!==null){n.return=s.return,It=n;break}It=s.return}}function I0(n,s,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:Xn(n,o),u&4&&So(5,o);break;case 1:if(Xn(n,o),u&4)if(n=o.stateNode,s===null)try{n.componentDidMount()}catch(x){Je(o,o.return,x)}else{var p=ps(o.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(p,s,n.__reactInternalSnapshotBeforeUpdate)}catch(x){Je(o,o.return,x)}}u&64&&L0(o),u&512&&bo(o,o.return);break;case 3:if(Xn(n,o),u&64&&(n=o.updateQueue,n!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{C_(n,s)}catch(x){Je(o,o.return,x)}}break;case 27:s===null&&u&4&&j0(o);case 26:case 5:Xn(n,o),s===null&&u&4&&O0(o),u&512&&bo(o,o.return);break;case 12:Xn(n,o);break;case 31:Xn(n,o),u&4&&V0(n,o);break;case 13:Xn(n,o),u&4&&F0(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=Y2.bind(null,o),hE(n,o))));break;case 22:if(u=o.memoizedState!==null||Wn,!u){s=s!==null&&s.memoizedState!==null||Nt,p=Wn;var _=Nt;Wn=u,(Nt=s)&&!_?Kn(n,o,(o.subtreeFlags&8772)!==0):Xn(n,o),Wn=p,Nt=_}break;case 30:break;default:Xn(n,o)}}function U0(n){var s=n.alternate;s!==null&&(n.alternate=null,U0(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&Wl(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var ut=null,pi=!1;function $n(n,s,o){for(o=o.child;o!==null;)q0(n,s,o),o=o.sibling}function q0(n,s,o){if(bt&&typeof bt.onCommitFiberUnmount=="function")try{bt.onCommitFiberUnmount(Wt,o)}catch{}switch(o.tag){case 26:Nt||gn(o,s),$n(n,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Nt||gn(o,s);var u=ut,p=pi;Rr(o.type)&&(ut=o.stateNode,pi=!1),$n(n,s,o),Ao(o.stateNode),ut=u,pi=p;break;case 5:Nt||gn(o,s);case 6:if(u=ut,p=pi,ut=null,$n(n,s,o),ut=u,pi=p,ut!==null)if(pi)try{(ut.nodeType===9?ut.body:ut.nodeName==="HTML"?ut.ownerDocument.body:ut).removeChild(o.stateNode)}catch(_){Je(o,s,_)}else try{ut.removeChild(o.stateNode)}catch(_){Je(o,s,_)}break;case 18:ut!==null&&(pi?(n=ut,Lv(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),vl(n)):Lv(ut,o.stateNode));break;case 4:u=ut,p=pi,ut=o.stateNode.containerInfo,pi=!0,$n(n,s,o),ut=u,pi=p;break;case 0:case 11:case 14:case 15:Er(2,o,s),Nt||Er(4,o,s),$n(n,s,o);break;case 1:Nt||(gn(o,s),u=o.stateNode,typeof u.componentWillUnmount=="function"&&z0(o,s,u)),$n(n,s,o);break;case 21:$n(n,s,o);break;case 22:Nt=(u=Nt)||o.memoizedState!==null,$n(n,s,o),Nt=u;break;default:$n(n,s,o)}}function V0(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{vl(n)}catch(o){Je(s,s.return,o)}}}function F0(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{vl(n)}catch(o){Je(s,s.return,o)}}function H2(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new P0),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new P0),s;default:throw Error(r(435,n.tag))}}function Lc(n,s){var o=H2(n);s.forEach(function(u){if(!o.has(u)){o.add(u);var p=W2.bind(null,n,u);u.then(p,p)}})}function gi(n,s){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var p=o[u],_=n,x=s,A=x;e:for(;A!==null;){switch(A.tag){case 27:if(Rr(A.type)){ut=A.stateNode,pi=!1;break e}break;case 5:ut=A.stateNode,pi=!1;break e;case 3:case 4:ut=A.stateNode.containerInfo,pi=!0;break e}A=A.return}if(ut===null)throw Error(r(160));q0(_,x,p),ut=null,pi=!1,_=p.alternate,_!==null&&(_.return=null),p.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Y0(s,n),s=s.sibling}var nn=null;function Y0(n,s){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:gi(s,n),mi(n),u&4&&(Er(3,n,n.return),So(3,n),Er(5,n,n.return));break;case 1:gi(s,n),mi(n),u&512&&(Nt||o===null||gn(o,o.return)),u&64&&Wn&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var p=nn;if(gi(s,n),mi(n),u&512&&(Nt||o===null||gn(o,o.return)),u&4){var _=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":_=p.getElementsByTagName("title")[0],(!_||_[Qr]||_[zt]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=p.createElement(u),p.head.insertBefore(_,p.querySelector("head > title"))),Gt(_,u,o),_[zt]=n,Et(_),u=_;break e;case"link":var x=Yv("link","href",p).get(u+(o.href||""));if(x){for(var A=0;A<x.length;A++)if(_=x[A],_.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&_.getAttribute("rel")===(o.rel==null?null:o.rel)&&_.getAttribute("title")===(o.title==null?null:o.title)&&_.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){x.splice(A,1);break t}}_=p.createElement(u),Gt(_,u,o),p.head.appendChild(_);break;case"meta":if(x=Yv("meta","content",p).get(u+(o.content||""))){for(A=0;A<x.length;A++)if(_=x[A],_.getAttribute("content")===(o.content==null?null:""+o.content)&&_.getAttribute("name")===(o.name==null?null:o.name)&&_.getAttribute("property")===(o.property==null?null:o.property)&&_.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&_.getAttribute("charset")===(o.charSet==null?null:o.charSet)){x.splice(A,1);break t}}_=p.createElement(u),Gt(_,u,o),p.head.appendChild(_);break;default:throw Error(r(468,u))}_[zt]=n,Et(_),u=_}n.stateNode=u}else Wv(p,n.type,n.stateNode);else n.stateNode=Fv(p,u,n.memoizedProps);else _!==u?(_===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):_.count--,u===null?Wv(p,n.type,n.stateNode):Fv(p,u,n.memoizedProps)):u===null&&n.stateNode!==null&&Zf(n,n.memoizedProps,o.memoizedProps)}break;case 27:gi(s,n),mi(n),u&512&&(Nt||o===null||gn(o,o.return)),o!==null&&u&4&&Zf(n,n.memoizedProps,o.memoizedProps);break;case 5:if(gi(s,n),mi(n),u&512&&(Nt||o===null||gn(o,o.return)),n.flags&32){p=n.stateNode;try{Us(p,"")}catch(ye){Je(n,n.return,ye)}}u&4&&n.stateNode!=null&&(p=n.memoizedProps,Zf(n,p,o!==null?o.memoizedProps:p)),u&1024&&(ed=!0);break;case 6:if(gi(s,n),mi(n),u&4){if(n.stateNode===null)throw Error(r(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(ye){Je(n,n.return,ye)}}break;case 3:if(Gc=null,p=nn,nn=Xc(s.containerInfo),gi(s,n),nn=p,mi(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{vl(s.containerInfo)}catch(ye){Je(n,n.return,ye)}ed&&(ed=!1,W0(n));break;case 4:u=nn,nn=Xc(n.stateNode.containerInfo),gi(s,n),mi(n),nn=u;break;case 12:gi(s,n),mi(n);break;case 31:gi(s,n),mi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Lc(n,u)));break;case 13:gi(s,n),mi(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Oc=Lt()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Lc(n,u)));break;case 22:p=n.memoizedState!==null;var $=o!==null&&o.memoizedState!==null,J=Wn,se=Nt;if(Wn=J||p,Nt=se||$,gi(s,n),Nt=se,Wn=J,mi(n),u&8192)e:for(s=n.stateNode,s._visibility=p?s._visibility&-2:s._visibility|1,p&&(o===null||$||Wn||Nt||gs(n)),o=null,s=n;;){if(s.tag===5||s.tag===26){if(o===null){$=o=s;try{if(_=$.stateNode,p)x=_.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{A=$.stateNode;var ae=$.memoizedProps.style,te=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;A.style.display=te==null||typeof te=="boolean"?"":(""+te).trim()}}catch(ye){Je($,$.return,ye)}}}else if(s.tag===6){if(o===null){$=s;try{$.stateNode.nodeValue=p?"":$.memoizedProps}catch(ye){Je($,$.return,ye)}}}else if(s.tag===18){if(o===null){$=s;try{var ie=$.stateNode;p?zv(ie,!0):zv($.stateNode,!1)}catch(ye){Je($,$.return,ye)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===n)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break e;for(;s.sibling===null;){if(s.return===null||s.return===n)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,Lc(n,o))));break;case 19:gi(s,n),mi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,Lc(n,u)));break;case 30:break;case 21:break;default:gi(s,n),mi(n)}}function mi(n){var s=n.flags;if(s&2){try{for(var o,u=n.return;u!==null;){if(H0(u)){o=u;break}u=u.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var p=o.stateNode,_=Qf(n);Bc(n,_,p);break;case 5:var x=o.stateNode;o.flags&32&&(Us(x,""),o.flags&=-33);var A=Qf(n);Bc(n,A,x);break;case 3:case 4:var $=o.stateNode.containerInfo,J=Qf(n);Jf(n,J,$);break;default:throw Error(r(161))}}catch(se){Je(n,n.return,se)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function W0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;W0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),n=n.sibling}}function Xn(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)I0(n,s.alternate,s),s=s.sibling}function gs(n){for(n=n.child;n!==null;){var s=n;switch(s.tag){case 0:case 11:case 14:case 15:Er(4,s,s.return),gs(s);break;case 1:gn(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&z0(s,s.return,o),gs(s);break;case 27:Ao(s.stateNode);case 26:case 5:gn(s,s.return),gs(s);break;case 22:s.memoizedState===null&&gs(s);break;case 30:gs(s);break;default:gs(s)}n=n.sibling}}function Kn(n,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,p=n,_=s,x=_.flags;switch(_.tag){case 0:case 11:case 15:Kn(p,_,o),So(4,_);break;case 1:if(Kn(p,_,o),u=_,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(J){Je(u,u.return,J)}if(u=_,p=u.updateQueue,p!==null){var A=u.stateNode;try{var $=p.shared.hiddenCallbacks;if($!==null)for(p.shared.hiddenCallbacks=null,p=0;p<$.length;p++)w_($[p],A)}catch(J){Je(u,u.return,J)}}o&&x&64&&L0(_),bo(_,_.return);break;case 27:j0(_);case 26:case 5:Kn(p,_,o),o&&u===null&&x&4&&O0(_),bo(_,_.return);break;case 12:Kn(p,_,o);break;case 31:Kn(p,_,o),o&&x&4&&V0(p,_);break;case 13:Kn(p,_,o),o&&x&4&&F0(p,_);break;case 22:_.memoizedState===null&&Kn(p,_,o),bo(_,_.return);break;case 30:break;default:Kn(p,_,o)}s=s.sibling}}function td(n,s){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&lo(o))}function id(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&lo(n))}function rn(n,s,o,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)$0(n,s,o,u),s=s.sibling}function $0(n,s,o,u){var p=s.flags;switch(s.tag){case 0:case 11:case 15:rn(n,s,o,u),p&2048&&So(9,s);break;case 1:rn(n,s,o,u);break;case 3:rn(n,s,o,u),p&2048&&(n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&lo(n)));break;case 12:if(p&2048){rn(n,s,o,u),n=s.stateNode;try{var _=s.memoizedProps,x=_.id,A=_.onPostCommit;typeof A=="function"&&A(x,s.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch($){Je(s,s.return,$)}}else rn(n,s,o,u);break;case 31:rn(n,s,o,u);break;case 13:rn(n,s,o,u);break;case 23:break;case 22:_=s.stateNode,x=s.alternate,s.memoizedState!==null?_._visibility&2?rn(n,s,o,u):xo(n,s):_._visibility&2?rn(n,s,o,u):(_._visibility|=2,ol(n,s,o,u,(s.subtreeFlags&10256)!==0||!1)),p&2048&&td(x,s);break;case 24:rn(n,s,o,u),p&2048&&id(s.alternate,s);break;default:rn(n,s,o,u)}}function ol(n,s,o,u,p){for(p=p&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var _=n,x=s,A=o,$=u,J=x.flags;switch(x.tag){case 0:case 11:case 15:ol(_,x,A,$,p),So(8,x);break;case 23:break;case 22:var se=x.stateNode;x.memoizedState!==null?se._visibility&2?ol(_,x,A,$,p):xo(_,x):(se._visibility|=2,ol(_,x,A,$,p)),p&&J&2048&&td(x.alternate,x);break;case 24:ol(_,x,A,$,p),p&&J&2048&&id(x.alternate,x);break;default:ol(_,x,A,$,p)}s=s.sibling}}function xo(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=n,u=s,p=u.flags;switch(u.tag){case 22:xo(o,u),p&2048&&td(u.alternate,u);break;case 24:xo(o,u),p&2048&&id(u.alternate,u);break;default:xo(o,u)}s=s.sibling}}var wo=8192;function al(n,s,o){if(n.subtreeFlags&wo)for(n=n.child;n!==null;)X0(n,s,o),n=n.sibling}function X0(n,s,o){switch(n.tag){case 26:al(n,s,o),n.flags&wo&&n.memoizedState!==null&&wE(o,nn,n.memoizedState,n.memoizedProps);break;case 5:al(n,s,o);break;case 3:case 4:var u=nn;nn=Xc(n.stateNode.containerInfo),al(n,s,o),nn=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=wo,wo=16777216,al(n,s,o),wo=u):al(n,s,o));break;default:al(n,s,o)}}function K0(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function Co(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];It=u,Z0(u,n)}K0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)G0(n),n=n.sibling}function G0(n){switch(n.tag){case 0:case 11:case 15:Co(n),n.flags&2048&&Er(9,n,n.return);break;case 3:Co(n);break;case 12:Co(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,zc(n)):Co(n);break;default:Co(n)}}function zc(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];It=u,Z0(u,n)}K0(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:Er(8,s,s.return),zc(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,zc(s));break;default:zc(s)}n=n.sibling}}function Z0(n,s){for(;It!==null;){var o=It;switch(o.tag){case 0:case 11:case 15:Er(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:lo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,It=u;else e:for(o=n;It!==null;){u=It;var p=u.sibling,_=u.return;if(U0(u),u===o){It=null;break e}if(p!==null){p.return=_,It=p;break e}It=_}}}var j2={getCacheForType:function(n){var s=Xt(kt),o=s.data.get(n);return o===void 0&&(o=n(),s.data.set(n,o)),o},cacheSignal:function(){return Xt(kt).controller.signal}},P2=typeof WeakMap=="function"?WeakMap:Map,Ke=0,rt=null,Pe=null,Ue=0,Qe=0,Ai=null,kr=!1,cl=!1,nd=!1,Gn=0,_t=0,Mr=0,ms=0,rd=0,Di=0,ul=0,Eo=null,_i=null,sd=!1,Oc=0,Q0=0,Hc=1/0,jc=null,Tr=null,Ot=0,Nr=null,hl=null,Zn=0,ld=0,od=null,J0=null,ko=0,ad=null;function Ri(){return(Ke&2)!==0&&Ue!==0?Ue&-Ue:M.T!==null?pd():qa()}function ev(){if(Di===0)if((Ue&536870912)===0||Ve){var n=zs;zs<<=1,(zs&3932160)===0&&(zs=262144),Di=n}else Di=536870912;return n=Ti.current,n!==null&&(n.flags|=32),Di}function vi(n,s,o){(n===rt&&(Qe===2||Qe===9)||n.cancelPendingCommit!==null)&&(fl(n,0),Ar(n,Ue,Di,!1)),Zr(n,o),((Ke&2)===0||n!==rt)&&(n===rt&&((Ke&2)===0&&(ms|=o),_t===4&&Ar(n,Ue,Di,!1)),mn(n))}function tv(n,s,o){if((Ke&6)!==0)throw Error(r(327));var u=!o&&(s&127)===0&&(s&n.expiredLanes)===0||Gr(n,s),p=u?q2(n,s):ud(n,s,!0),_=u;do{if(p===0){cl&&!u&&Ar(n,s,0,!1);break}else{if(o=n.current.alternate,_&&!I2(o)){p=ud(n,s,!1),_=!1;continue}if(p===2){if(_=s,n.errorRecoveryDisabledLanes&_)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){s=x;e:{var A=n;p=Eo;var $=A.current.memoizedState.isDehydrated;if($&&(fl(A,x).flags|=256),x=ud(A,x,!1),x!==2){if(nd&&!$){A.errorRecoveryDisabledLanes|=_,ms|=_,p=4;break e}_=_i,_i=p,_!==null&&(_i===null?_i=_:_i.push.apply(_i,_))}p=x}if(_=!1,p!==2)continue}}if(p===1){fl(n,0),Ar(n,s,0,!0);break}e:{switch(u=n,_=p,_){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:Ar(u,s,Di,!kr);break e;case 2:_i=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(p=Oc+300-Lt(),10<p)){if(Ar(u,s,Di,!kr),Hs(u,0,!0)!==0)break e;Zn=s,u.timeoutHandle=Rv(iv.bind(null,u,o,_i,jc,sd,s,Di,ms,ul,kr,_,"Throttled",-0,0),p);break e}iv(u,o,_i,jc,sd,s,Di,ms,ul,kr,_,null,-0,0)}}break}while(!0);mn(n)}function iv(n,s,o,u,p,_,x,A,$,J,se,ae,te,ie){if(n.timeoutHandle=-1,ae=s.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},X0(s,_,ae);var ye=(_&62914560)===_?Oc-Lt():(_&4194048)===_?Q0-Lt():0;if(ye=CE(ae,ye),ye!==null){Zn=_,n.cancelPendingCommit=ye(uv.bind(null,n,s,_,o,u,p,x,A,$,se,ae,null,te,ie)),Ar(n,_,x,!J);return}}uv(n,s,_,o,u,p,x,A,$)}function I2(n){for(var s=n;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var p=o[u],_=p.getSnapshot;p=p.value;try{if(!ki(_(),p))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Ar(n,s,o,u){s&=~rd,s&=~ms,n.suspendedLanes|=s,n.pingedLanes&=~s,u&&(n.warmLanes|=s),u=n.expirationTimes;for(var p=s;0<p;){var _=31-Ze(p),x=1<<_;u[_]=-1,p&=~x}o!==0&&Pa(n,o,s)}function Pc(){return(Ke&6)===0?(Mo(0),!1):!0}function cd(){if(Pe!==null){if(Qe===0)var n=Pe.return;else n=Pe,In=os=null,Ef(n),il=null,ao=0,n=Pe;for(;n!==null;)B0(n.alternate,n),n=n.return;Pe=null}}function fl(n,s){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,lE(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),Zn=0,cd(),rt=n,Pe=o=jn(n.current,null),Ue=s,Qe=0,Ai=null,kr=!1,cl=Gr(n,s),nd=!1,ul=Di=rd=ms=Mr=_t=0,_i=Eo=null,sd=!1,(s&8)!==0&&(s|=s&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=s;0<u;){var p=31-Ze(u),_=1<<p;s|=n[p],u&=~_}return Gn=s,lc(),o}function nv(n,s){Re=null,M.H=_o,s===tl||s===pc?(s=y_(),Qe=3):s===df?(s=y_(),Qe=4):Qe=s===Uf?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Ai=s,Pe===null&&(_t=1,Tc(n,Ii(s,n.current)))}function rv(){var n=Ti.current;return n===null?!0:(Ue&4194048)===Ue?Fi===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?n===Fi:!1}function sv(){var n=M.H;return M.H=_o,n===null?_o:n}function lv(){var n=M.A;return M.A=j2,n}function Ic(){_t=4,kr||(Ue&4194048)!==Ue&&Ti.current!==null||(cl=!0),(Mr&134217727)===0&&(ms&134217727)===0||rt===null||Ar(rt,Ue,Di,!1)}function ud(n,s,o){var u=Ke;Ke|=2;var p=sv(),_=lv();(rt!==n||Ue!==s)&&(jc=null,fl(n,s)),s=!1;var x=_t;e:do try{if(Qe!==0&&Pe!==null){var A=Pe,$=Ai;switch(Qe){case 8:cd(),x=6;break e;case 3:case 2:case 9:case 6:Ti.current===null&&(s=!0);var J=Qe;if(Qe=0,Ai=null,dl(n,A,$,J),o&&cl){x=0;break e}break;default:J=Qe,Qe=0,Ai=null,dl(n,A,$,J)}}U2(),x=_t;break}catch(se){nv(n,se)}while(!0);return s&&n.shellSuspendCounter++,In=os=null,Ke=u,M.H=p,M.A=_,Pe===null&&(rt=null,Ue=0,lc()),x}function U2(){for(;Pe!==null;)ov(Pe)}function q2(n,s){var o=Ke;Ke|=2;var u=sv(),p=lv();rt!==n||Ue!==s?(jc=null,Hc=Lt()+500,fl(n,s)):cl=Gr(n,s);e:do try{if(Qe!==0&&Pe!==null){s=Pe;var _=Ai;t:switch(Qe){case 1:Qe=0,Ai=null,dl(n,s,_,1);break;case 2:case 9:if(__(_)){Qe=0,Ai=null,av(s);break}s=function(){Qe!==2&&Qe!==9||rt!==n||(Qe=7),mn(n)},_.then(s,s);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:__(_)?(Qe=0,Ai=null,av(s)):(Qe=0,Ai=null,dl(n,s,_,7));break;case 5:var x=null;switch(Pe.tag){case 26:x=Pe.memoizedState;case 5:case 27:var A=Pe;if(x?$v(x):A.stateNode.complete){Qe=0,Ai=null;var $=A.sibling;if($!==null)Pe=$;else{var J=A.return;J!==null?(Pe=J,Uc(J)):Pe=null}break t}}Qe=0,Ai=null,dl(n,s,_,5);break;case 6:Qe=0,Ai=null,dl(n,s,_,6);break;case 8:cd(),_t=6;break e;default:throw Error(r(462))}}V2();break}catch(se){nv(n,se)}while(!0);return In=os=null,M.H=u,M.A=p,Ke=o,Pe!==null?0:(rt=null,Ue=0,lc(),_t)}function V2(){for(;Pe!==null&&!An();)ov(Pe)}function ov(n){var s=D0(n.alternate,n,Gn);n.memoizedProps=n.pendingProps,s===null?Uc(n):Pe=s}function av(n){var s=n,o=s.alternate;switch(s.tag){case 15:case 0:s=E0(o,s,s.pendingProps,s.type,void 0,Ue);break;case 11:s=E0(o,s,s.pendingProps,s.type.render,s.ref,Ue);break;case 5:Ef(s);default:B0(o,s),s=Pe=l_(s,Gn),s=D0(o,s,Gn)}n.memoizedProps=n.pendingProps,s===null?Uc(n):Pe=s}function dl(n,s,o,u){In=os=null,Ef(s),il=null,ao=0;var p=s.return;try{if(D2(n,p,s,o,Ue)){_t=1,Tc(n,Ii(o,n.current)),Pe=null;return}}catch(_){if(p!==null)throw Pe=p,_;_t=1,Tc(n,Ii(o,n.current)),Pe=null;return}s.flags&32768?(Ve||u===1?n=!0:cl||(Ue&536870912)!==0?n=!1:(kr=n=!0,(u===2||u===9||u===3||u===6)&&(u=Ti.current,u!==null&&u.tag===13&&(u.flags|=16384))),cv(s,n)):Uc(s)}function Uc(n){var s=n;do{if((s.flags&32768)!==0){cv(s,kr);return}n=s.return;var o=L2(s.alternate,s,Gn);if(o!==null){Pe=o;return}if(s=s.sibling,s!==null){Pe=s;return}Pe=s=n}while(s!==null);_t===0&&(_t=5)}function cv(n,s){do{var o=z2(n.alternate,n);if(o!==null){o.flags&=32767,Pe=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(n=n.sibling,n!==null)){Pe=n;return}Pe=n=o}while(n!==null);_t=6,Pe=null}function uv(n,s,o,u,p,_,x,A,$){n.cancelPendingCommit=null;do qc();while(Ot!==0);if((Ke&6)!==0)throw Error(r(327));if(s!==null){if(s===n.current)throw Error(r(177));if(_=s.lanes|s.childLanes,_|=Zh,Mh(n,o,_,x,A,$),n===rt&&(Pe=rt=null,Ue=0),hl=s,Nr=n,Zn=o,ld=_,od=p,J0=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,$2(ke,function(){return gv(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=M.T,M.T=null,p=j.p,j.p=2,x=Ke,Ke|=4;try{O2(n,s,o)}finally{Ke=x,j.p=p,M.T=u}}Ot=1,hv(),fv(),dv()}}function hv(){if(Ot===1){Ot=0;var n=Nr,s=hl,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=M.T,M.T=null;var u=j.p;j.p=2;var p=Ke;Ke|=4;try{Y0(s,n);var _=xd,x=Zm(n.containerInfo),A=_.focusedElem,$=_.selectionRange;if(x!==A&&A&&A.ownerDocument&&Gm(A.ownerDocument.documentElement,A)){if($!==null&&Wh(A)){var J=$.start,se=$.end;if(se===void 0&&(se=J),"selectionStart"in A)A.selectionStart=J,A.selectionEnd=Math.min(se,A.value.length);else{var ae=A.ownerDocument||document,te=ae&&ae.defaultView||window;if(te.getSelection){var ie=te.getSelection(),ye=A.textContent.length,Me=Math.min($.start,ye),it=$.end===void 0?Me:Math.min($.end,ye);!ie.extend&&Me>it&&(x=it,it=Me,Me=x);var Z=Km(A,Me),K=Km(A,it);if(Z&&K&&(ie.rangeCount!==1||ie.anchorNode!==Z.node||ie.anchorOffset!==Z.offset||ie.focusNode!==K.node||ie.focusOffset!==K.offset)){var Q=ae.createRange();Q.setStart(Z.node,Z.offset),ie.removeAllRanges(),Me>it?(ie.addRange(Q),ie.extend(K.node,K.offset)):(Q.setEnd(K.node,K.offset),ie.addRange(Q))}}}}for(ae=[],ie=A;ie=ie.parentNode;)ie.nodeType===1&&ae.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ae.length;A++){var le=ae[A];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}eu=!!bd,xd=bd=null}finally{Ke=p,j.p=u,M.T=o}}n.current=s,Ot=2}}function fv(){if(Ot===2){Ot=0;var n=Nr,s=hl,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=M.T,M.T=null;var u=j.p;j.p=2;var p=Ke;Ke|=4;try{I0(n,s.alternate,s)}finally{Ke=p,j.p=u,M.T=o}}Ot=3}}function dv(){if(Ot===4||Ot===3){Ot=0,Dn();var n=Nr,s=hl,o=Zn,u=J0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Ot=5:(Ot=0,hl=Nr=null,pv(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(Tr=null),Yl(o),s=s.stateNode,bt&&typeof bt.onCommitFiberRoot=="function")try{bt.onCommitFiberRoot(Wt,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=M.T,p=j.p,j.p=2,M.T=null;try{for(var _=n.onRecoverableError,x=0;x<u.length;x++){var A=u[x];_(A.value,{componentStack:A.stack})}}finally{M.T=s,j.p=p}}(Zn&3)!==0&&qc(),mn(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===ad?ko++:(ko=0,ad=n):ko=0,Mo(0)}}function pv(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,lo(s)))}function qc(){return hv(),fv(),dv(),gv()}function gv(){if(Ot!==5)return!1;var n=Nr,s=ld;ld=0;var o=Yl(Zn),u=M.T,p=j.p;try{j.p=32>o?32:o,M.T=null,o=od,od=null;var _=Nr,x=Zn;if(Ot=0,hl=Nr=null,Zn=0,(Ke&6)!==0)throw Error(r(331));var A=Ke;if(Ke|=4,G0(_.current),$0(_,_.current,x,o),Ke=A,Mo(0,!1),bt&&typeof bt.onPostCommitFiberRoot=="function")try{bt.onPostCommitFiberRoot(Wt,_)}catch{}return!0}finally{j.p=p,M.T=u,pv(n,s)}}function mv(n,s,o){s=Ii(o,s),s=If(n.stateNode,s,2),n=xr(n,s,2),n!==null&&(Zr(n,2),mn(n))}function Je(n,s,o){if(n.tag===3)mv(n,n,o);else for(;s!==null;){if(s.tag===3){mv(s,n,o);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Tr===null||!Tr.has(u))){n=Ii(o,n),o=_0(2),u=xr(s,o,2),u!==null&&(v0(o,u,s,n),Zr(u,2),mn(u));break}}s=s.return}}function hd(n,s,o){var u=n.pingCache;if(u===null){u=n.pingCache=new P2;var p=new Set;u.set(s,p)}else p=u.get(s),p===void 0&&(p=new Set,u.set(s,p));p.has(o)||(nd=!0,p.add(o),n=F2.bind(null,n,s,o),s.then(n,n))}function F2(n,s,o){var u=n.pingCache;u!==null&&u.delete(s),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,rt===n&&(Ue&o)===o&&(_t===4||_t===3&&(Ue&62914560)===Ue&&300>Lt()-Oc?(Ke&2)===0&&fl(n,0):rd|=o,ul===Ue&&(ul=0)),mn(n)}function _v(n,s){s===0&&(s=ja()),n=rs(n,s),n!==null&&(Zr(n,s),mn(n))}function Y2(n){var s=n.memoizedState,o=0;s!==null&&(o=s.retryLane),_v(n,o)}function W2(n,s){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,p=n.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(s),_v(n,o)}function $2(n,s){return ui(n,s)}var Vc=null,pl=null,fd=!1,Fc=!1,dd=!1,Dr=0;function mn(n){n!==pl&&n.next===null&&(pl===null?Vc=pl=n:pl=pl.next=n),Fc=!0,fd||(fd=!0,K2())}function Mo(n,s){if(!dd&&Fc){dd=!0;do for(var o=!1,u=Vc;u!==null;){if(n!==0){var p=u.pendingLanes;if(p===0)var _=0;else{var x=u.suspendedLanes,A=u.pingedLanes;_=(1<<31-Ze(42|n)+1)-1,_&=p&~(x&~A),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(o=!0,bv(u,_))}else _=Ue,_=Hs(u,u===rt?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(_&3)===0||Gr(u,_)||(o=!0,bv(u,_));u=u.next}while(o);dd=!1}}function X2(){vv()}function vv(){Fc=fd=!1;var n=0;Dr!==0&&sE()&&(n=Dr);for(var s=Lt(),o=null,u=Vc;u!==null;){var p=u.next,_=yv(u,s);_===0?(u.next=null,o===null?Vc=p:o.next=p,p===null&&(pl=o)):(o=u,(n!==0||(_&3)!==0)&&(Fc=!0)),u=p}Ot!==0&&Ot!==5||Mo(n),Dr!==0&&(Dr=0)}function yv(n,s){for(var o=n.suspendedLanes,u=n.pingedLanes,p=n.expirationTimes,_=n.pendingLanes&-62914561;0<_;){var x=31-Ze(_),A=1<<x,$=p[x];$===-1?((A&o)===0||(A&u)!==0)&&(p[x]=kh(A,s)):$<=s&&(n.expiredLanes|=A),_&=~A}if(s=rt,o=Ue,o=Hs(n,n===s?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===s&&(Qe===2||Qe===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&Qi(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||Gr(n,o)){if(s=o&-o,s===n.callbackPriority)return s;switch(u!==null&&Qi(u),Yl(o)){case 2:case 8:o=ge;break;case 32:o=ke;break;case 268435456:o=Fe;break;default:o=ke}return u=Sv.bind(null,n),o=ui(o,u),n.callbackPriority=s,n.callbackNode=o,s}return u!==null&&u!==null&&Qi(u),n.callbackPriority=2,n.callbackNode=null,2}function Sv(n,s){if(Ot!==0&&Ot!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(qc()&&n.callbackNode!==o)return null;var u=Ue;return u=Hs(n,n===rt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(tv(n,u,s),yv(n,Lt()),n.callbackNode!=null&&n.callbackNode===o?Sv.bind(null,n):null)}function bv(n,s){if(qc())return null;tv(n,s,!0)}function K2(){oE(function(){(Ke&6)!==0?ui(re,X2):vv()})}function pd(){if(Dr===0){var n=Js;n===0&&(n=Ls,Ls<<=1,(Ls&261888)===0&&(Ls=256)),Dr=n}return Dr}function xv(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Qa(""+n)}function wv(n,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,n.id&&o.setAttribute("form",n.id),s.parentNode.insertBefore(o,s),n=new FormData(n),o.parentNode.removeChild(o),n}function G2(n,s,o,u,p){if(s==="submit"&&o&&o.stateNode===p){var _=xv((p[ti]||null).action),x=u.submitter;x&&(s=(s=x[ti]||null)?xv(s.formAction):x.getAttribute("formAction"),s!==null&&(_=s,x=null));var A=new ic("action","action",null,u,p);n.push({event:A,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Dr!==0){var $=x?wv(p,x):new FormData(p);Lf(o,{pending:!0,data:$,method:p.method,action:_},null,$)}}else typeof _=="function"&&(A.preventDefault(),$=x?wv(p,x):new FormData(p),Lf(o,{pending:!0,data:$,method:p.method,action:_},_,$))},currentTarget:p}]})}}for(var gd=0;gd<Gh.length;gd++){var md=Gh[gd],Z2=md.toLowerCase(),Q2=md[0].toUpperCase()+md.slice(1);tn(Z2,"on"+Q2)}tn(e_,"onAnimationEnd"),tn(t_,"onAnimationIteration"),tn(i_,"onAnimationStart"),tn("dblclick","onDoubleClick"),tn("focusin","onFocus"),tn("focusout","onBlur"),tn(p2,"onTransitionRun"),tn(g2,"onTransitionStart"),tn(m2,"onTransitionCancel"),tn(n_,"onTransitionEnd"),dr("onMouseEnter",["mouseout","mouseover"]),dr("onMouseLeave",["mouseout","mouseover"]),dr("onPointerEnter",["pointerout","pointerover"]),dr("onPointerLeave",["pointerout","pointerover"]),Ln("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ln("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ln("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ln("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ln("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var To="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(" "),J2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(To));function Cv(n,s){s=(s&4)!==0;for(var o=0;o<n.length;o++){var u=n[o],p=u.event;u=u.listeners;e:{var _=void 0;if(s)for(var x=u.length-1;0<=x;x--){var A=u[x],$=A.instance,J=A.currentTarget;if(A=A.listener,$!==_&&p.isPropagationStopped())break e;_=A,p.currentTarget=J;try{_(p)}catch(se){sc(se)}p.currentTarget=null,_=$}else for(x=0;x<u.length;x++){if(A=u[x],$=A.instance,J=A.currentTarget,A=A.listener,$!==_&&p.isPropagationStopped())break e;_=A,p.currentTarget=J;try{_(p)}catch(se){sc(se)}p.currentTarget=null,_=$}}}}function Ie(n,s){var o=s[js];o===void 0&&(o=s[js]=new Set);var u=n+"__bubble";o.has(u)||(Ev(s,n,2,!1),o.add(u))}function _d(n,s,o){var u=0;s&&(u|=4),Ev(o,n,u,s)}var Yc="_reactListening"+Math.random().toString(36).slice(2);function vd(n){if(!n[Yc]){n[Yc]=!0,Wa.forEach(function(o){o!=="selectionchange"&&(J2.has(o)||_d(o,!1,n),_d(o,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Yc]||(s[Yc]=!0,_d("selectionchange",!1,s))}}function Ev(n,s,o,u){switch(ey(s)){case 2:var p=ME;break;case 8:p=TE;break;default:p=Bd}o=p.bind(null,s,o,n),p=void 0,!Hh||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(p=!0),u?p!==void 0?n.addEventListener(s,o,{capture:!0,passive:p}):n.addEventListener(s,o,!0):p!==void 0?n.addEventListener(s,o,{passive:p}):n.addEventListener(s,o,!1)}function yd(n,s,o,u,p){var _=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var x=u.tag;if(x===3||x===4){var A=u.stateNode.containerInfo;if(A===p)break;if(x===4)for(x=u.return;x!==null;){var $=x.tag;if(($===3||$===4)&&x.stateNode.containerInfo===p)return;x=x.return}for(;A!==null;){if(x=cr(A),x===null)return;if($=x.tag,$===5||$===6||$===26||$===27){u=_=x;continue e}A=A.parentNode}}u=u.return}Am(function(){var J=_,se=zh(o),ae=[];e:{var te=r_.get(n);if(te!==void 0){var ie=ic,ye=n;switch(n){case"keypress":if(ec(o)===0)break e;case"keydown":case"keyup":ie=WC;break;case"focusin":ye="focus",ie=Uh;break;case"focusout":ye="blur",ie=Uh;break;case"beforeblur":case"afterblur":ie=Uh;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=Bm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=LC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=KC;break;case e_:case t_:case i_:ie=HC;break;case n_:ie=ZC;break;case"scroll":case"scrollend":ie=RC;break;case"wheel":ie=JC;break;case"copy":case"cut":case"paste":ie=PC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=zm;break;case"toggle":case"beforetoggle":ie=t2}var Me=(s&4)!==0,it=!Me&&(n==="scroll"||n==="scrollend"),Z=Me?te!==null?te+"Capture":null:te;Me=[];for(var K=J,Q;K!==null;){var le=K;if(Q=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||Q===null||Z===null||(le=Kl(K,Z),le!=null&&Me.push(No(K,le,Q))),it)break;K=K.return}0<Me.length&&(te=new ie(te,ye,null,o,se),ae.push({event:te,listeners:Me}))}}if((s&7)===0){e:{if(te=n==="mouseover"||n==="pointerover",ie=n==="mouseout"||n==="pointerout",te&&o!==Lh&&(ye=o.relatedTarget||o.fromElement)&&(cr(ye)||ye[Bn]))break e;if((ie||te)&&(te=se.window===se?se:(te=se.ownerDocument)?te.defaultView||te.parentWindow:window,ie?(ye=o.relatedTarget||o.toElement,ie=J,ye=ye?cr(ye):null,ye!==null&&(it=a(ye),Me=ye.tag,ye!==it||Me!==5&&Me!==27&&Me!==6)&&(ye=null)):(ie=null,ye=J),ie!==ye)){if(Me=Bm,le="onMouseLeave",Z="onMouseEnter",K="mouse",(n==="pointerout"||n==="pointerover")&&(Me=zm,le="onPointerLeave",Z="onPointerEnter",K="pointer"),it=ie==null?te:hr(ie),Q=ye==null?te:hr(ye),te=new Me(le,K+"leave",ie,o,se),te.target=it,te.relatedTarget=Q,le=null,cr(se)===J&&(Me=new Me(Z,K+"enter",ye,o,se),Me.target=Q,Me.relatedTarget=it,le=Me),it=le,ie&&ye)t:{for(Me=eE,Z=ie,K=ye,Q=0,le=Z;le;le=Me(le))Q++;le=0;for(var Ee=K;Ee;Ee=Me(Ee))le++;for(;0<Q-le;)Z=Me(Z),Q--;for(;0<le-Q;)K=Me(K),le--;for(;Q--;){if(Z===K||K!==null&&Z===K.alternate){Me=Z;break t}Z=Me(Z),K=Me(K)}Me=null}else Me=null;ie!==null&&kv(ae,te,ie,Me,!1),ye!==null&&it!==null&&kv(ae,it,ye,Me,!0)}}e:{if(te=J?hr(J):window,ie=te.nodeName&&te.nodeName.toLowerCase(),ie==="select"||ie==="input"&&te.type==="file")var $e=Vm;else if(Um(te))if(Fm)$e=h2;else{$e=c2;var be=a2}else ie=te.nodeName,!ie||ie.toLowerCase()!=="input"||te.type!=="checkbox"&&te.type!=="radio"?J&&Bh(J.elementType)&&($e=Vm):$e=u2;if($e&&($e=$e(n,J))){qm(ae,$e,o,se);break e}be&&be(n,te,J),n==="focusout"&&J&&te.type==="number"&&J.memoizedProps.value!=null&&Xl(te,"number",te.value)}switch(be=J?hr(J):window,n){case"focusin":(Um(be)||be.contentEditable==="true")&&(Ys=be,$h=J,no=null);break;case"focusout":no=$h=Ys=null;break;case"mousedown":Xh=!0;break;case"contextmenu":case"mouseup":case"dragend":Xh=!1,Qm(ae,o,se);break;case"selectionchange":if(d2)break;case"keydown":case"keyup":Qm(ae,o,se)}var Be;if(Vh)e:{switch(n){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Fs?Pm(n,o)&&(qe="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(qe="onCompositionStart");qe&&(Om&&o.locale!=="ko"&&(Fs||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Fs&&(Be=Dm()):(gr=se,jh="value"in gr?gr.value:gr.textContent,Fs=!0)),be=Wc(J,qe),0<be.length&&(qe=new Lm(qe,n,null,o,se),ae.push({event:qe,listeners:be}),Be?qe.data=Be:(Be=Im(o),Be!==null&&(qe.data=Be)))),(Be=n2?r2(n,o):s2(n,o))&&(qe=Wc(J,"onBeforeInput"),0<qe.length&&(be=new Lm("onBeforeInput","beforeinput",null,o,se),ae.push({event:be,listeners:qe}),be.data=Be)),G2(ae,n,J,o,se)}Cv(ae,s)})}function No(n,s,o){return{instance:n,listener:s,currentTarget:o}}function Wc(n,s){for(var o=s+"Capture",u=[];n!==null;){var p=n,_=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||_===null||(p=Kl(n,o),p!=null&&u.unshift(No(n,p,_)),p=Kl(n,s),p!=null&&u.push(No(n,p,_))),n.tag===3)return u;n=n.return}return[]}function eE(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function kv(n,s,o,u,p){for(var _=s._reactName,x=[];o!==null&&o!==u;){var A=o,$=A.alternate,J=A.stateNode;if(A=A.tag,$!==null&&$===u)break;A!==5&&A!==26&&A!==27||J===null||($=J,p?(J=Kl(o,_),J!=null&&x.unshift(No(o,J,$))):p||(J=Kl(o,_),J!=null&&x.push(No(o,J,$)))),o=o.return}x.length!==0&&n.push({event:s,listeners:x})}var tE=/\r\n?/g,iE=/\u0000|\uFFFD/g;function Mv(n){return(typeof n=="string"?n:""+n).replace(tE,`
49
+ `).replace(iE,"")}function Tv(n,s){return s=Mv(s),Mv(n)===s}function tt(n,s,o,u,p,_){switch(o){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||Us(n,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&Us(n,""+u);break;case"className":Is(n,"class",u);break;case"tabIndex":Is(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Is(n,o,u);break;case"style":Tm(n,u,_);break;case"data":if(s!=="object"){Is(n,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Qa(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(o,"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 _=="function"&&(o==="formAction"?(s!=="input"&&tt(n,s,"name",p.name,p,null),tt(n,s,"formEncType",p.formEncType,p,null),tt(n,s,"formMethod",p.formMethod,p,null),tt(n,s,"formTarget",p.formTarget,p,null)):(tt(n,s,"encType",p.encType,p,null),tt(n,s,"method",p.method,p,null),tt(n,s,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Qa(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=On);break;case"onScroll":u!=null&&Ie("scroll",n);break;case"onScrollEnd":u!=null&&Ie("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=Qa(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):n.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":Ie("beforetoggle",n),Ie("toggle",n),Ps(n,"popover",u);break;case"xlinkActuate":en(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":en(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":en(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":en(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":en(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":en(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":en(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":en(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":en(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Ps(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=AC.get(o)||o,Ps(n,o,u))}}function Sd(n,s,o,u,p,_){switch(o){case"style":Tm(n,u,_);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"children":typeof u=="string"?Us(n,u):(typeof u=="number"||typeof u=="bigint")&&Us(n,""+u);break;case"onScroll":u!=null&&Ie("scroll",n);break;case"onScrollEnd":u!=null&&Ie("scrollend",n);break;case"onClick":u!=null&&(n.onclick=On);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$a.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),s=o.slice(2,p?o.length-7:void 0),_=n[ti]||null,_=_!=null?_[o]:null,typeof _=="function"&&n.removeEventListener(s,_,p),typeof u=="function")){typeof _!="function"&&_!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(s,u,p);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):Ps(n,o,u)}}}function Gt(n,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",n),Ie("load",n);var u=!1,p=!1,_;for(_ in o)if(o.hasOwnProperty(_)){var x=o[_];if(x!=null)switch(_){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:tt(n,s,_,x,o,null)}}p&&tt(n,s,"srcSet",o.srcSet,o,null),u&&tt(n,s,"src",o.src,o,null);return;case"input":Ie("invalid",n);var A=_=x=p=null,$=null,J=null;for(u in o)if(o.hasOwnProperty(u)){var se=o[u];if(se!=null)switch(u){case"name":p=se;break;case"type":x=se;break;case"checked":$=se;break;case"defaultChecked":J=se;break;case"value":_=se;break;case"defaultValue":A=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,s));break;default:tt(n,s,u,se,o,null)}}Za(n,_,A,$,J,x,p,!1);return;case"select":Ie("invalid",n),u=x=_=null;for(p in o)if(o.hasOwnProperty(p)&&(A=o[p],A!=null))switch(p){case"value":_=A;break;case"defaultValue":x=A;break;case"multiple":u=A;default:tt(n,s,p,A,o,null)}s=_,o=x,n.multiple=!!u,s!=null?zn(n,!!u,s,!1):o!=null&&zn(n,!!u,o,!0);return;case"textarea":Ie("invalid",n),_=p=u=null;for(x in o)if(o.hasOwnProperty(x)&&(A=o[x],A!=null))switch(x){case"value":u=A;break;case"defaultValue":p=A;break;case"children":_=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:tt(n,s,x,A,o,null)}km(n,u,p,_);return;case"option":for($ in o)if(o.hasOwnProperty($)&&(u=o[$],u!=null))switch($){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:tt(n,s,$,u,o,null)}return;case"dialog":Ie("beforetoggle",n),Ie("toggle",n),Ie("cancel",n),Ie("close",n);break;case"iframe":case"object":Ie("load",n);break;case"video":case"audio":for(u=0;u<To.length;u++)Ie(To[u],n);break;case"image":Ie("error",n),Ie("load",n);break;case"details":Ie("toggle",n);break;case"embed":case"source":case"link":Ie("error",n),Ie("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in o)if(o.hasOwnProperty(J)&&(u=o[J],u!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:tt(n,s,J,u,o,null)}return;default:if(Bh(s)){for(se in o)o.hasOwnProperty(se)&&(u=o[se],u!==void 0&&Sd(n,s,se,u,o,void 0));return}}for(A in o)o.hasOwnProperty(A)&&(u=o[A],u!=null&&tt(n,s,A,u,o,null))}function nE(n,s,o,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,_=null,x=null,A=null,$=null,J=null,se=null;for(ie in o){var ae=o[ie];if(o.hasOwnProperty(ie)&&ae!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":$=ae;default:u.hasOwnProperty(ie)||tt(n,s,ie,null,u,ae)}}for(var te in u){var ie=u[te];if(ae=o[te],u.hasOwnProperty(te)&&(ie!=null||ae!=null))switch(te){case"type":_=ie;break;case"name":p=ie;break;case"checked":J=ie;break;case"defaultChecked":se=ie;break;case"value":x=ie;break;case"defaultValue":A=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,s));break;default:ie!==ae&&tt(n,s,te,ie,u,ae)}}es(n,x,A,$,J,se,_,p);return;case"select":ie=x=A=te=null;for(_ in o)if($=o[_],o.hasOwnProperty(_)&&$!=null)switch(_){case"value":break;case"multiple":ie=$;default:u.hasOwnProperty(_)||tt(n,s,_,null,u,$)}for(p in u)if(_=u[p],$=o[p],u.hasOwnProperty(p)&&(_!=null||$!=null))switch(p){case"value":te=_;break;case"defaultValue":A=_;break;case"multiple":x=_;default:_!==$&&tt(n,s,p,_,u,$)}s=A,o=x,u=ie,te!=null?zn(n,!!o,te,!1):!!u!=!!o&&(s!=null?zn(n,!!o,s,!0):zn(n,!!o,o?[]:"",!1));return;case"textarea":ie=te=null;for(A in o)if(p=o[A],o.hasOwnProperty(A)&&p!=null&&!u.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:tt(n,s,A,null,u,p)}for(x in u)if(p=u[x],_=o[x],u.hasOwnProperty(x)&&(p!=null||_!=null))switch(x){case"value":te=p;break;case"defaultValue":ie=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(r(91));break;default:p!==_&&tt(n,s,x,p,u,_)}Em(n,te,ie);return;case"option":for(var ye in o)if(te=o[ye],o.hasOwnProperty(ye)&&te!=null&&!u.hasOwnProperty(ye))switch(ye){case"selected":n.selected=!1;break;default:tt(n,s,ye,null,u,te)}for($ in u)if(te=u[$],ie=o[$],u.hasOwnProperty($)&&te!==ie&&(te!=null||ie!=null))switch($){case"selected":n.selected=te&&typeof te!="function"&&typeof te!="symbol";break;default:tt(n,s,$,te,u,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Me in o)te=o[Me],o.hasOwnProperty(Me)&&te!=null&&!u.hasOwnProperty(Me)&&tt(n,s,Me,null,u,te);for(J in u)if(te=u[J],ie=o[J],u.hasOwnProperty(J)&&te!==ie&&(te!=null||ie!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,s));break;default:tt(n,s,J,te,u,ie)}return;default:if(Bh(s)){for(var it in o)te=o[it],o.hasOwnProperty(it)&&te!==void 0&&!u.hasOwnProperty(it)&&Sd(n,s,it,void 0,u,te);for(se in u)te=u[se],ie=o[se],!u.hasOwnProperty(se)||te===ie||te===void 0&&ie===void 0||Sd(n,s,se,te,u,ie);return}}for(var Z in o)te=o[Z],o.hasOwnProperty(Z)&&te!=null&&!u.hasOwnProperty(Z)&&tt(n,s,Z,null,u,te);for(ae in u)te=u[ae],ie=o[ae],!u.hasOwnProperty(ae)||te===ie||te==null&&ie==null||tt(n,s,ae,te,u,ie)}function Nv(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function rE(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var p=o[u],_=p.transferSize,x=p.initiatorType,A=p.duration;if(_&&A&&Nv(x)){for(x=0,A=p.responseEnd,u+=1;u<o.length;u++){var $=o[u],J=$.startTime;if(J>A)break;var se=$.transferSize,ae=$.initiatorType;se&&Nv(ae)&&($=$.responseEnd,x+=se*($<A?1:(A-J)/($-J)))}if(--u,s+=8*(_+x)/(p.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var bd=null,xd=null;function $c(n){return n.nodeType===9?n:n.ownerDocument}function Av(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Dv(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function wd(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Cd=null;function sE(){var n=window.event;return n&&n.type==="popstate"?n===Cd?!1:(Cd=n,!0):(Cd=null,!1)}var Rv=typeof setTimeout=="function"?setTimeout:void 0,lE=typeof clearTimeout=="function"?clearTimeout:void 0,Bv=typeof Promise=="function"?Promise:void 0,oE=typeof queueMicrotask=="function"?queueMicrotask:typeof Bv<"u"?function(n){return Bv.resolve(null).then(n).catch(aE)}:Rv;function aE(n){setTimeout(function(){throw n})}function Rr(n){return n==="head"}function Lv(n,s){var o=s,u=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(p),vl(s);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")Ao(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,Ao(o);for(var _=o.firstChild;_;){var x=_.nextSibling,A=_.nodeName;_[Qr]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&_.rel.toLowerCase()==="stylesheet"||o.removeChild(_),_=x}}else o==="body"&&Ao(n.ownerDocument.body);o=p}while(o);vl(s)}function zv(n,s){var o=n;n=0;do{var u=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function Ed(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Ed(o),Wl(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function cE(n,s,o,u){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[Qr])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(_=n.getAttribute("rel"),_==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(_!==p.rel||n.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||n.getAttribute("title")!==(p.title==null?null:p.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(_=n.getAttribute("src"),(_!==(p.src==null?null:p.src)||n.getAttribute("type")!==(p.type==null?null:p.type)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&_&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var _=p.name==null?null:""+p.name;if(p.type==="hidden"&&n.getAttribute("name")===_)return n}else return n;if(n=Yi(n.nextSibling),n===null)break}return null}function uE(n,s,o){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Yi(n.nextSibling),n===null))return null;return n}function Ov(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=Yi(n.nextSibling),n===null))return null;return n}function kd(n){return n.data==="$?"||n.data==="$~"}function Md(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function hE(n,s){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||o.readyState!=="loading")s();else{var u=function(){s(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function Yi(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var Td=null;function Hv(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(s===0)return Yi(n.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}n=n.nextSibling}return null}function jv(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return n;s--}else o!=="/$"&&o!=="/&"||s++}n=n.previousSibling}return null}function Pv(n,s,o){switch(s=$c(o),n){case"html":if(n=s.documentElement,!n)throw Error(r(452));return n;case"head":if(n=s.head,!n)throw Error(r(453));return n;case"body":if(n=s.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function Ao(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);Wl(n)}var Wi=new Map,Iv=new Set;function Xc(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Qn=j.d;j.d={f:fE,r:dE,D:pE,C:gE,L:mE,m:_E,X:yE,S:vE,M:SE};function fE(){var n=Qn.f(),s=Pc();return n||s}function dE(n){var s=ur(n);s!==null&&s.tag===5&&s.type==="form"?n0(s):Qn.r(n)}var gl=typeof document>"u"?null:document;function Uv(n,s,o){var u=gl;if(u&&typeof s=="string"&&s){var p=fi(s);p='link[rel="'+n+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),Iv.has(p)||(Iv.add(p),n={rel:n,crossOrigin:o,href:s},u.querySelector(p)===null&&(s=u.createElement("link"),Gt(s,"link",n),Et(s),u.head.appendChild(s)))}}function pE(n){Qn.D(n),Uv("dns-prefetch",n,null)}function gE(n,s){Qn.C(n,s),Uv("preconnect",n,s)}function mE(n,s,o){Qn.L(n,s,o);var u=gl;if(u&&n&&s){var p='link[rel="preload"][as="'+fi(s)+'"]';s==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+fi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+fi(o.imageSizes)+'"]')):p+='[href="'+fi(n)+'"]';var _=p;switch(s){case"style":_=ml(n);break;case"script":_=_l(n)}Wi.has(_)||(n=g({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:n,as:s},o),Wi.set(_,n),u.querySelector(p)!==null||s==="style"&&u.querySelector(Do(_))||s==="script"&&u.querySelector(Ro(_))||(s=u.createElement("link"),Gt(s,"link",n),Et(s),u.head.appendChild(s)))}}function _E(n,s){Qn.m(n,s);var o=gl;if(o&&n){var u=s&&typeof s.as=="string"?s.as:"script",p='link[rel="modulepreload"][as="'+fi(u)+'"][href="'+fi(n)+'"]',_=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=_l(n)}if(!Wi.has(_)&&(n=g({rel:"modulepreload",href:n},s),Wi.set(_,n),o.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Ro(_)))return}u=o.createElement("link"),Gt(u,"link",n),Et(u),o.head.appendChild(u)}}}function vE(n,s,o){Qn.S(n,s,o);var u=gl;if(u&&n){var p=fr(u).hoistableStyles,_=ml(n);s=s||"default";var x=p.get(_);if(!x){var A={loading:0,preload:null};if(x=u.querySelector(Do(_)))A.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":s},o),(o=Wi.get(_))&&Nd(n,o);var $=x=u.createElement("link");Et($),Gt($,"link",n),$._p=new Promise(function(J,se){$.onload=J,$.onerror=se}),$.addEventListener("load",function(){A.loading|=1}),$.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Kc(x,s,u)}x={type:"stylesheet",instance:x,count:1,state:A},p.set(_,x)}}}function yE(n,s){Qn.X(n,s);var o=gl;if(o&&n){var u=fr(o).hoistableScripts,p=_l(n),_=u.get(p);_||(_=o.querySelector(Ro(p)),_||(n=g({src:n,async:!0},s),(s=Wi.get(p))&&Ad(n,s),_=o.createElement("script"),Et(_),Gt(_,"link",n),o.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function SE(n,s){Qn.M(n,s);var o=gl;if(o&&n){var u=fr(o).hoistableScripts,p=_l(n),_=u.get(p);_||(_=o.querySelector(Ro(p)),_||(n=g({src:n,async:!0,type:"module"},s),(s=Wi.get(p))&&Ad(n,s),_=o.createElement("script"),Et(_),Gt(_,"link",n),o.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function qv(n,s,o,u){var p=(p=oe.current)?Xc(p):null;if(!p)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=ml(o.href),o=fr(p).hoistableStyles,u=o.get(s),u||(u={type:"style",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=ml(o.href);var _=fr(p).hoistableStyles,x=_.get(n);if(x||(p=p.ownerDocument||p,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(n,x),(_=p.querySelector(Do(n)))&&!_._p&&(x.instance=_,x.state.loading=5),Wi.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Wi.set(n,o),_||bE(p,n,o,x.state))),s&&u===null)throw Error(r(528,""));return x}if(s&&u!==null)throw Error(r(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=_l(o),o=fr(p).hoistableScripts,u=o.get(s),u||(u={type:"script",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function ml(n){return'href="'+fi(n)+'"'}function Do(n){return'link[rel="stylesheet"]['+n+"]"}function Vv(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function bE(n,s,o,u){n.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=n.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),Gt(s,"link",o),Et(s),n.head.appendChild(s))}function _l(n){return'[src="'+fi(n)+'"]'}function Ro(n){return"script[async]"+n}function Fv(n,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var u=n.querySelector('style[data-href~="'+fi(o.href)+'"]');if(u)return s.instance=u,Et(u),u;var p=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Et(u),Gt(u,"style",p),Kc(u,o.precedence,n),s.instance=u;case"stylesheet":p=ml(o.href);var _=n.querySelector(Do(p));if(_)return s.state.loading|=4,s.instance=_,Et(_),_;u=Vv(o),(p=Wi.get(p))&&Nd(u,p),_=(n.ownerDocument||n).createElement("link"),Et(_);var x=_;return x._p=new Promise(function(A,$){x.onload=A,x.onerror=$}),Gt(_,"link",u),s.state.loading|=4,Kc(_,o.precedence,n),s.instance=_;case"script":return _=_l(o.src),(p=n.querySelector(Ro(_)))?(s.instance=p,Et(p),p):(u=o,(p=Wi.get(_))&&(u=g({},o),Ad(u,p)),n=n.ownerDocument||n,p=n.createElement("script"),Et(p),Gt(p,"link",u),n.head.appendChild(p),s.instance=p);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,Kc(u,o.precedence,n));return s.instance}function Kc(n,s,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,_=p,x=0;x<u.length;x++){var A=u[x];if(A.dataset.precedence===s)_=A;else if(_!==p)break}_?_.parentNode.insertBefore(n,_.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(n,s.firstChild))}function Nd(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function Ad(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Gc=null;function Yv(n,s,o){if(Gc===null){var u=new Map,p=Gc=new Map;p.set(o,u)}else p=Gc,u=p.get(o),u||(u=new Map,p.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var _=o[p];if(!(_[Qr]||_[zt]||n==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var x=_.getAttribute(s)||"";x=n+x;var A=u.get(x);A?A.push(_):u.set(x,[_])}}return u}function Wv(n,s,o){n=n.ownerDocument||n,n.head.insertBefore(o,s==="title"?n.querySelector("head > title"):null)}function xE(n,s,o){if(o===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return n=s.disabled,typeof s.precedence=="string"&&n==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function $v(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function wE(n,s,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=ml(u.href),_=s.querySelector(Do(p));if(_){s=_._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Zc.bind(n),s.then(n,n)),o.state.loading|=4,o.instance=_,Et(_);return}_=s.ownerDocument||s,u=Vv(u),(p=Wi.get(p))&&Nd(u,p),_=_.createElement("link"),Et(_);var x=_;x._p=new Promise(function(A,$){x.onload=A,x.onerror=$}),Gt(_,"link",u),o.instance=_}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=Zc.bind(n),s.addEventListener("load",o),s.addEventListener("error",o))}}var Dd=0;function CE(n,s){return n.stylesheets&&n.count===0&&Jc(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&Jc(n,n.stylesheets),n.unsuspend){var _=n.unsuspend;n.unsuspend=null,_()}},6e4+s);0<n.imgBytes&&Dd===0&&(Dd=62500*rE());var p=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Jc(n,n.stylesheets),n.unsuspend)){var _=n.unsuspend;n.unsuspend=null,_()}},(n.imgBytes>Dd?50:800)+s);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Zc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Jc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Qc=null;function Jc(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Qc=new Map,s.forEach(EE,n),Qc=null,Zc.call(n))}function EE(n,s){if(!(s.state.loading&4)){var o=Qc.get(n);if(o)var u=o.get(null);else{o=new Map,Qc.set(n,o);for(var p=n.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<p.length;_++){var x=p[_];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(o.set(x.dataset.precedence,x),u=x)}u&&o.set(null,u)}p=s.instance,x=p.getAttribute("data-precedence"),_=o.get(x)||u,_===u&&o.set(null,p),o.set(x,p),this.count++,u=Zc.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),_?_.parentNode.insertBefore(p,_.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(p,n.firstChild)),s.state.loading|=4}}var Bo={$$typeof:k,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function kE(n,s,o,u,p,_,x,A,$){this.tag=1,this.containerInfo=n,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=Vl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vl(0),this.hiddenUpdates=Vl(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=_,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function Xv(n,s,o,u,p,_,x,A,$,J,se,ae){return n=new kE(n,s,o,x,$,J,se,ae,A),s=1,_===!0&&(s|=24),_=Mi(3,null,null,s),n.current=_,_.stateNode=n,s=uf(),s.refCount++,n.pooledCache=s,s.refCount++,_.memoizedState={element:u,isDehydrated:o,cache:s},pf(_),n}function Kv(n){return n?(n=Xs,n):Xs}function Gv(n,s,o,u,p,_){p=Kv(p),u.context===null?u.context=p:u.pendingContext=p,u=br(s),u.payload={element:o},_=_===void 0?null:_,_!==null&&(u.callback=_),o=xr(n,u,s),o!==null&&(vi(o,n,s),uo(o,n,s))}function Zv(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<s?o:s}}function Rd(n,s){Zv(n,s),(n=n.alternate)&&Zv(n,s)}function Qv(n){if(n.tag===13||n.tag===31){var s=rs(n,67108864);s!==null&&vi(s,n,67108864),Rd(n,67108864)}}function Jv(n){if(n.tag===13||n.tag===31){var s=Ri();s=Fl(s);var o=rs(n,s);o!==null&&vi(o,n,s),Rd(n,s)}}var eu=!0;function ME(n,s,o,u){var p=M.T;M.T=null;var _=j.p;try{j.p=2,Bd(n,s,o,u)}finally{j.p=_,M.T=p}}function TE(n,s,o,u){var p=M.T;M.T=null;var _=j.p;try{j.p=8,Bd(n,s,o,u)}finally{j.p=_,M.T=p}}function Bd(n,s,o,u){if(eu){var p=Ld(u);if(p===null)yd(n,s,u,tu,o),ty(n,u);else if(AE(p,n,s,o,u))u.stopPropagation();else if(ty(n,u),s&4&&-1<NE.indexOf(n)){for(;p!==null;){var _=ur(p);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var x=Rn(_.pendingLanes);if(x!==0){var A=_;for(A.pendingLanes|=2,A.entangledLanes|=2;x;){var $=1<<31-Ze(x);A.entanglements[1]|=$,x&=~$}mn(_),(Ke&6)===0&&(Hc=Lt()+500,Mo(0))}}break;case 31:case 13:A=rs(_,2),A!==null&&vi(A,_,2),Pc(),Rd(_,2)}if(_=Ld(u),_===null&&yd(n,s,u,tu,o),_===p)break;p=_}p!==null&&u.stopPropagation()}else yd(n,s,u,null,o)}}function Ld(n){return n=zh(n),zd(n)}var tu=null;function zd(n){if(tu=null,n=cr(n),n!==null){var s=a(n);if(s===null)n=null;else{var o=s.tag;if(o===13){if(n=c(s),n!==null)return n;n=null}else if(o===31){if(n=h(s),n!==null)return n;n=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return tu=n,null}function ey(n){switch(n){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(ar()){case re:return 2;case ge:return 8;case ke:case Oe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Od=!1,Br=null,Lr=null,zr=null,Lo=new Map,zo=new Map,Or=[],NE="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 ty(n,s){switch(n){case"focusin":case"focusout":Br=null;break;case"dragenter":case"dragleave":Lr=null;break;case"mouseover":case"mouseout":zr=null;break;case"pointerover":case"pointerout":Lo.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":zo.delete(s.pointerId)}}function Oo(n,s,o,u,p,_){return n===null||n.nativeEvent!==_?(n={blockedOn:s,domEventName:o,eventSystemFlags:u,nativeEvent:_,targetContainers:[p]},s!==null&&(s=ur(s),s!==null&&Qv(s)),n):(n.eventSystemFlags|=u,s=n.targetContainers,p!==null&&s.indexOf(p)===-1&&s.push(p),n)}function AE(n,s,o,u,p){switch(s){case"focusin":return Br=Oo(Br,n,s,o,u,p),!0;case"dragenter":return Lr=Oo(Lr,n,s,o,u,p),!0;case"mouseover":return zr=Oo(zr,n,s,o,u,p),!0;case"pointerover":var _=p.pointerId;return Lo.set(_,Oo(Lo.get(_)||null,n,s,o,u,p)),!0;case"gotpointercapture":return _=p.pointerId,zo.set(_,Oo(zo.get(_)||null,n,s,o,u,p)),!0}return!1}function iy(n){var s=cr(n.target);if(s!==null){var o=a(s);if(o!==null){if(s=o.tag,s===13){if(s=c(o),s!==null){n.blockedOn=s,Va(n.priority,function(){Jv(o)});return}}else if(s===31){if(s=h(o),s!==null){n.blockedOn=s,Va(n.priority,function(){Jv(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function iu(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var o=Ld(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);Lh=u,o.target.dispatchEvent(u),Lh=null}else return s=ur(o),s!==null&&Qv(s),n.blockedOn=o,!1;s.shift()}return!0}function ny(n,s,o){iu(n)&&o.delete(s)}function DE(){Od=!1,Br!==null&&iu(Br)&&(Br=null),Lr!==null&&iu(Lr)&&(Lr=null),zr!==null&&iu(zr)&&(zr=null),Lo.forEach(ny),zo.forEach(ny)}function nu(n,s){n.blockedOn===s&&(n.blockedOn=null,Od||(Od=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,DE)))}var ru=null;function ry(n){ru!==n&&(ru=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ru===n&&(ru=null);for(var s=0;s<n.length;s+=3){var o=n[s],u=n[s+1],p=n[s+2];if(typeof u!="function"){if(zd(u||o)===null)continue;break}var _=ur(o);_!==null&&(n.splice(s,3),s-=3,Lf(_,{pending:!0,data:p,method:o.method,action:u},u,p))}}))}function vl(n){function s($){return nu($,n)}Br!==null&&nu(Br,n),Lr!==null&&nu(Lr,n),zr!==null&&nu(zr,n),Lo.forEach(s),zo.forEach(s);for(var o=0;o<Or.length;o++){var u=Or[o];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Or.length&&(o=Or[0],o.blockedOn===null);)iy(o),o.blockedOn===null&&Or.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var p=o[u],_=o[u+1],x=p[ti]||null;if(typeof _=="function")x||ry(o);else if(x){var A=null;if(_&&_.hasAttribute("formAction")){if(p=_,x=_[ti]||null)A=x.formAction;else if(zd(p)!==null)continue}else A=x.action;typeof A=="function"?o[u+1]=A:(o.splice(u,3),u-=3),ry(o)}}}function sy(){function n(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(x){return p=x})},focusReset:"manual",scroll:"manual"})}function s(){p!==null&&(p(),p=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),p!==null&&(p(),p=null)}}}function Hd(n){this._internalRoot=n}su.prototype.render=Hd.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));var o=s.current,u=Ri();Gv(o,u,n,s,null,null)},su.prototype.unmount=Hd.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;Gv(n.current,2,null,n,null,null),Pc(),s[Bn]=null}};function su(n){this._internalRoot=n}su.prototype.unstable_scheduleHydration=function(n){if(n){var s=qa();n={blockedOn:null,target:n,priority:s};for(var o=0;o<Or.length&&s!==0&&s<Or[o].priority;o++);Or.splice(o,0,n),o===0&&iy(n)}};var ly=t.version;if(ly!=="19.2.4")throw Error(r(527,ly,"19.2.4"));j.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=f(s),n=n!==null?m(n):null,n=n===null?null:n.stateNode,n};var RE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lu.isDisabled&&lu.supportsFiber)try{Wt=lu.inject(RE),bt=lu}catch{}}return jo.createRoot=function(n,s){if(!l(n))throw Error(r(299));var o=!1,u="",p=d0,_=p0,x=g0;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(_=s.onCaughtError),s.onRecoverableError!==void 0&&(x=s.onRecoverableError)),s=Xv(n,1,!1,null,null,o,u,null,p,_,x,sy),n[Bn]=s.current,vd(n),new Hd(s)},jo.hydrateRoot=function(n,s,o){if(!l(n))throw Error(r(299));var u=!1,p="",_=d0,x=p0,A=g0,$=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(_=o.onUncaughtError),o.onCaughtError!==void 0&&(x=o.onCaughtError),o.onRecoverableError!==void 0&&(A=o.onRecoverableError),o.formState!==void 0&&($=o.formState)),s=Xv(n,1,!0,s,o??null,u,p,$,_,x,A,sy),s.context=Kv(null),o=s.current,u=Ri(),u=Fl(u),p=br(u),p.callback=null,xr(o,p,u),o=u,s.current.lanes=o,Zr(s,o),mn(s),n[Bn]=s.current,vd(n),new su(s)},jo.version="19.2.4",jo}var my;function qE(){if(my)return Id.exports;my=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(),Id.exports=UE(),Id.exports}var VE=qE();function Bt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let i=0,r;i<e.length;i++)(r=Bt(e[i]))!==""&&(t+=(t&&" ")+r);else for(let i in e)e[i]&&(t+=(t&&" ")+i);return t}var FE={value:()=>{}};function sh(){for(var e=0,t=arguments.length,i={},r;e<t;++e){if(!(r=arguments[e]+"")||r in i||/[\s.]/.test(r))throw new Error("illegal type: "+r);i[r]=[]}return new Eu(i)}function Eu(e){this._=e}function YE(e,t){return e.trim().split(/^|\s+/).map(function(i){var r="",l=i.indexOf(".");if(l>=0&&(r=i.slice(l+1),i=i.slice(0,l)),i&&!t.hasOwnProperty(i))throw new Error("unknown type: "+i);return{type:i,name:r}})}Eu.prototype=sh.prototype={constructor:Eu,on:function(e,t){var i=this._,r=YE(e+"",i),l,a=-1,c=r.length;if(arguments.length<2){for(;++a<c;)if((l=(e=r[a]).type)&&(l=WE(i[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<c;)if(l=(e=r[a]).type)i[l]=_y(i[l],e.name,t);else if(t==null)for(l in i)i[l]=_y(i[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var i in t)e[i]=t[i].slice();return new Eu(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var i=new Array(l),r=0,l,a;r<l;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],r=0,l=a.length;r<l;++r)a[r].value.apply(t,i)},apply:function(e,t,i){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],l=0,a=r.length;l<a;++l)r[l].value.apply(t,i)}};function WE(e,t){for(var i=0,r=e.length,l;i<r;++i)if((l=e[i]).name===t)return l.value}function _y(e,t,i){for(var r=0,l=e.length;r<l;++r)if(e[r].name===t){e[r]=FE,e=e.slice(0,r).concat(e.slice(r+1));break}return i!=null&&e.push({name:t,value:i}),e}var Np="http://www.w3.org/1999/xhtml";const vy={svg:"http://www.w3.org/2000/svg",xhtml:Np,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lh(e){var t=e+="",i=t.indexOf(":");return i>=0&&(t=e.slice(0,i))!=="xmlns"&&(e=e.slice(i+1)),vy.hasOwnProperty(t)?{space:vy[t],local:e}:e}function $E(e){return function(){var t=this.ownerDocument,i=this.namespaceURI;return i===Np&&t.documentElement.namespaceURI===Np?t.createElement(e):t.createElementNS(i,e)}}function XE(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gb(e){var t=lh(e);return(t.local?XE:$E)(t)}function KE(){}function Og(e){return e==null?KE:function(){return this.querySelector(e)}}function GE(e){typeof e!="function"&&(e=Og(e));for(var t=this._groups,i=t.length,r=new Array(i),l=0;l<i;++l)for(var a=t[l],c=a.length,h=r[l]=new Array(c),d,f,m=0;m<c;++m)(d=a[m])&&(f=e.call(d,d.__data__,m,a))&&("__data__"in d&&(f.__data__=d.__data__),h[m]=f);return new ji(r,this._parents)}function ZE(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function QE(){return[]}function mb(e){return e==null?QE:function(){return this.querySelectorAll(e)}}function JE(e){return function(){return ZE(e.apply(this,arguments))}}function ek(e){typeof e=="function"?e=JE(e):e=mb(e);for(var t=this._groups,i=t.length,r=[],l=[],a=0;a<i;++a)for(var c=t[a],h=c.length,d,f=0;f<h;++f)(d=c[f])&&(r.push(e.call(d,d.__data__,f,c)),l.push(d));return new ji(r,l)}function _b(e){return function(){return this.matches(e)}}function vb(e){return function(t){return t.matches(e)}}var tk=Array.prototype.find;function ik(e){return function(){return tk.call(this.children,e)}}function nk(){return this.firstElementChild}function rk(e){return this.select(e==null?nk:ik(typeof e=="function"?e:vb(e)))}var sk=Array.prototype.filter;function lk(){return Array.from(this.children)}function ok(e){return function(){return sk.call(this.children,e)}}function ak(e){return this.selectAll(e==null?lk:ok(typeof e=="function"?e:vb(e)))}function ck(e){typeof e!="function"&&(e=_b(e));for(var t=this._groups,i=t.length,r=new Array(i),l=0;l<i;++l)for(var a=t[l],c=a.length,h=r[l]=[],d,f=0;f<c;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&h.push(d);return new ji(r,this._parents)}function yb(e){return new Array(e.length)}function uk(){return new ji(this._enter||this._groups.map(yb),this._parents)}function ju(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}ju.prototype={constructor:ju,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function hk(e){return function(){return e}}function fk(e,t,i,r,l,a){for(var c=0,h,d=t.length,f=a.length;c<f;++c)(h=t[c])?(h.__data__=a[c],r[c]=h):i[c]=new ju(e,a[c]);for(;c<d;++c)(h=t[c])&&(l[c]=h)}function dk(e,t,i,r,l,a,c){var h,d,f=new Map,m=t.length,g=a.length,v=new Array(m),y;for(h=0;h<m;++h)(d=t[h])&&(v[h]=y=c.call(d,d.__data__,h,t)+"",f.has(y)?l[h]=d:f.set(y,d));for(h=0;h<g;++h)y=c.call(e,a[h],h,a)+"",(d=f.get(y))?(r[h]=d,d.__data__=a[h],f.delete(y)):i[h]=new ju(e,a[h]);for(h=0;h<m;++h)(d=t[h])&&f.get(v[h])===d&&(l[h]=d)}function pk(e){return e.__data__}function gk(e,t){if(!arguments.length)return Array.from(this,pk);var i=t?dk:fk,r=this._parents,l=this._groups;typeof e!="function"&&(e=hk(e));for(var a=l.length,c=new Array(a),h=new Array(a),d=new Array(a),f=0;f<a;++f){var m=r[f],g=l[f],v=g.length,y=mk(e.call(m,m&&m.__data__,f,r)),S=y.length,b=h[f]=new Array(S),E=c[f]=new Array(S),C=d[f]=new Array(v);i(m,g,b,E,C,y,t);for(var L=0,k=0,D,I;L<S;++L)if(D=b[L]){for(L>=k&&(k=L+1);!(I=E[k])&&++k<S;);D._next=I||null}}return c=new ji(c,r),c._enter=h,c._exit=d,c}function mk(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function _k(){return new ji(this._exit||this._groups.map(yb),this._parents)}function vk(e,t,i){var r=this.enter(),l=this,a=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(l=t(l),l&&(l=l.selection())),i==null?a.remove():i(a),r&&l?r.merge(l).order():l}function yk(e){for(var t=e.selection?e.selection():e,i=this._groups,r=t._groups,l=i.length,a=r.length,c=Math.min(l,a),h=new Array(l),d=0;d<c;++d)for(var f=i[d],m=r[d],g=f.length,v=h[d]=new Array(g),y,S=0;S<g;++S)(y=f[S]||m[S])&&(v[S]=y);for(;d<l;++d)h[d]=i[d];return new ji(h,this._parents)}function Sk(){for(var e=this._groups,t=-1,i=e.length;++t<i;)for(var r=e[t],l=r.length-1,a=r[l],c;--l>=0;)(c=r[l])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function bk(e){e||(e=xk);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var i=this._groups,r=i.length,l=new Array(r),a=0;a<r;++a){for(var c=i[a],h=c.length,d=l[a]=new Array(h),f,m=0;m<h;++m)(f=c[m])&&(d[m]=f);d.sort(t)}return new ji(l,this._parents).order()}function xk(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function wk(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ck(){return Array.from(this)}function Ek(){for(var e=this._groups,t=0,i=e.length;t<i;++t)for(var r=e[t],l=0,a=r.length;l<a;++l){var c=r[l];if(c)return c}return null}function kk(){let e=0;for(const t of this)++e;return e}function Mk(){return!this.node()}function Tk(e){for(var t=this._groups,i=0,r=t.length;i<r;++i)for(var l=t[i],a=0,c=l.length,h;a<c;++a)(h=l[a])&&e.call(h,h.__data__,a,l);return this}function Nk(e){return function(){this.removeAttribute(e)}}function Ak(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Dk(e,t){return function(){this.setAttribute(e,t)}}function Rk(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bk(e,t){return function(){var i=t.apply(this,arguments);i==null?this.removeAttribute(e):this.setAttribute(e,i)}}function Lk(e,t){return function(){var i=t.apply(this,arguments);i==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,i)}}function zk(e,t){var i=lh(e);if(arguments.length<2){var r=this.node();return i.local?r.getAttributeNS(i.space,i.local):r.getAttribute(i)}return this.each((t==null?i.local?Ak:Nk:typeof t=="function"?i.local?Lk:Bk:i.local?Rk:Dk)(i,t))}function Sb(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ok(e){return function(){this.style.removeProperty(e)}}function Hk(e,t,i){return function(){this.style.setProperty(e,t,i)}}function jk(e,t,i){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,i)}}function Pk(e,t,i){return arguments.length>1?this.each((t==null?Ok:typeof t=="function"?jk:Hk)(e,t,i??"")):Dl(this.node(),e)}function Dl(e,t){return e.style.getPropertyValue(t)||Sb(e).getComputedStyle(e,null).getPropertyValue(t)}function Ik(e){return function(){delete this[e]}}function Uk(e,t){return function(){this[e]=t}}function qk(e,t){return function(){var i=t.apply(this,arguments);i==null?delete this[e]:this[e]=i}}function Vk(e,t){return arguments.length>1?this.each((t==null?Ik:typeof t=="function"?qk:Uk)(e,t)):this.node()[e]}function bb(e){return e.trim().split(/^|\s+/)}function Hg(e){return e.classList||new xb(e)}function xb(e){this._node=e,this._names=bb(e.getAttribute("class")||"")}xb.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wb(e,t){for(var i=Hg(e),r=-1,l=t.length;++r<l;)i.add(t[r])}function Cb(e,t){for(var i=Hg(e),r=-1,l=t.length;++r<l;)i.remove(t[r])}function Fk(e){return function(){wb(this,e)}}function Yk(e){return function(){Cb(this,e)}}function Wk(e,t){return function(){(t.apply(this,arguments)?wb:Cb)(this,e)}}function $k(e,t){var i=bb(e+"");if(arguments.length<2){for(var r=Hg(this.node()),l=-1,a=i.length;++l<a;)if(!r.contains(i[l]))return!1;return!0}return this.each((typeof t=="function"?Wk:t?Fk:Yk)(i,t))}function Xk(){this.textContent=""}function Kk(e){return function(){this.textContent=e}}function Gk(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Zk(e){return arguments.length?this.each(e==null?Xk:(typeof e=="function"?Gk:Kk)(e)):this.node().textContent}function Qk(){this.innerHTML=""}function Jk(e){return function(){this.innerHTML=e}}function e5(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function t5(e){return arguments.length?this.each(e==null?Qk:(typeof e=="function"?e5:Jk)(e)):this.node().innerHTML}function i5(){this.nextSibling&&this.parentNode.appendChild(this)}function n5(){return this.each(i5)}function r5(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function s5(){return this.each(r5)}function l5(e){var t=typeof e=="function"?e:gb(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function o5(){return null}function a5(e,t){var i=typeof e=="function"?e:gb(e),r=t==null?o5:typeof t=="function"?t:Og(t);return this.select(function(){return this.insertBefore(i.apply(this,arguments),r.apply(this,arguments)||null)})}function c5(){var e=this.parentNode;e&&e.removeChild(this)}function u5(){return this.each(c5)}function h5(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function f5(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function d5(e){return this.select(e?f5:h5)}function p5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function g5(e){return function(t){e.call(this,t,this.__data__)}}function m5(e){return e.trim().split(/^|\s+/).map(function(t){var i="",r=t.indexOf(".");return r>=0&&(i=t.slice(r+1),t=t.slice(0,r)),{type:t,name:i}})}function _5(e){return function(){var t=this.__on;if(t){for(var i=0,r=-1,l=t.length,a;i<l;++i)a=t[i],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function v5(e,t,i){return function(){var r=this.__on,l,a=g5(t);if(r){for(var c=0,h=r.length;c<h;++c)if((l=r[c]).type===e.type&&l.name===e.name){this.removeEventListener(l.type,l.listener,l.options),this.addEventListener(l.type,l.listener=a,l.options=i),l.value=t;return}}this.addEventListener(e.type,a,i),l={type:e.type,name:e.name,value:t,listener:a,options:i},r?r.push(l):this.__on=[l]}}function y5(e,t,i){var r=m5(e+""),l,a=r.length,c;if(arguments.length<2){var h=this.node().__on;if(h){for(var d=0,f=h.length,m;d<f;++d)for(l=0,m=h[d];l<a;++l)if((c=r[l]).type===m.type&&c.name===m.name)return m.value}return}for(h=t?v5:_5,l=0;l<a;++l)this.each(h(r[l],t,i));return this}function Eb(e,t,i){var r=Sb(e),l=r.CustomEvent;typeof l=="function"?l=new l(t,i):(l=r.document.createEvent("Event"),i?(l.initEvent(t,i.bubbles,i.cancelable),l.detail=i.detail):l.initEvent(t,!1,!1)),e.dispatchEvent(l)}function S5(e,t){return function(){return Eb(this,e,t)}}function b5(e,t){return function(){return Eb(this,e,t.apply(this,arguments))}}function x5(e,t){return this.each((typeof t=="function"?b5:S5)(e,t))}function*w5(){for(var e=this._groups,t=0,i=e.length;t<i;++t)for(var r=e[t],l=0,a=r.length,c;l<a;++l)(c=r[l])&&(yield c)}var kb=[null];function ji(e,t){this._groups=e,this._parents=t}function ka(){return new ji([[document.documentElement]],kb)}function C5(){return this}ji.prototype=ka.prototype={constructor:ji,select:GE,selectAll:ek,selectChild:rk,selectChildren:ak,filter:ck,data:gk,enter:uk,exit:_k,join:vk,merge:yk,selection:C5,order:Sk,sort:bk,call:wk,nodes:Ck,node:Ek,size:kk,empty:Mk,each:Tk,attr:zk,style:Pk,property:Vk,classed:$k,text:Zk,html:t5,raise:n5,lower:s5,append:l5,insert:a5,remove:u5,clone:d5,datum:p5,on:y5,dispatch:x5,[Symbol.iterator]:w5};function Oi(e){return typeof e=="string"?new ji([[document.querySelector(e)]],[document.documentElement]):new ji([[e]],kb)}function E5(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ln(e,t){if(e=E5(e),t===void 0&&(t=e.currentTarget),t){var i=t.ownerSVGElement||t;if(i.createSVGPoint){var r=i.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var l=t.getBoundingClientRect();return[e.clientX-l.left-t.clientLeft,e.clientY-l.top-t.clientTop]}}return[e.pageX,e.pageY]}const k5={passive:!1},ua={capture:!0,passive:!1};function Fd(e){e.stopImmediatePropagation()}function Ml(e){e.preventDefault(),e.stopImmediatePropagation()}function Mb(e){var t=e.document.documentElement,i=Oi(e).on("dragstart.drag",Ml,ua);"onselectstart"in t?i.on("selectstart.drag",Ml,ua):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Tb(e,t){var i=e.document.documentElement,r=Oi(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ml,ua),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in i?r.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}const ou=e=>()=>e;function Ap(e,{sourceEvent:t,subject:i,target:r,identifier:l,active:a,x:c,y:h,dx:d,dy:f,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:l,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:h,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:m}})}Ap.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function M5(e){return!e.ctrlKey&&!e.button}function T5(){return this.parentNode}function N5(e,t){return t??{x:e.x,y:e.y}}function A5(){return navigator.maxTouchPoints||"ontouchstart"in this}function Nb(){var e=M5,t=T5,i=N5,r=A5,l={},a=sh("start","drag","end"),c=0,h,d,f,m,g=0;function v(D){D.on("mousedown.drag",y).filter(r).on("touchstart.drag",E).on("touchmove.drag",C,k5).on("touchend.drag touchcancel.drag",L).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(D,I){if(!(m||!e.call(this,D,I))){var B=k(this,t.call(this,D,I),D,I,"mouse");B&&(Oi(D.view).on("mousemove.drag",S,ua).on("mouseup.drag",b,ua),Mb(D.view),Fd(D),f=!1,h=D.clientX,d=D.clientY,B("start",D))}}function S(D){if(Ml(D),!f){var I=D.clientX-h,B=D.clientY-d;f=I*I+B*B>g}l.mouse("drag",D)}function b(D){Oi(D.view).on("mousemove.drag mouseup.drag",null),Tb(D.view,f),Ml(D),l.mouse("end",D)}function E(D,I){if(e.call(this,D,I)){var B=D.changedTouches,U=t.call(this,D,I),X=B.length,G,ne;for(G=0;G<X;++G)(ne=k(this,U,D,I,B[G].identifier,B[G]))&&(Fd(D),ne("start",D,B[G]))}}function C(D){var I=D.changedTouches,B=I.length,U,X;for(U=0;U<B;++U)(X=l[I[U].identifier])&&(Ml(D),X("drag",D,I[U]))}function L(D){var I=D.changedTouches,B=I.length,U,X;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),U=0;U<B;++U)(X=l[I[U].identifier])&&(Fd(D),X("end",D,I[U]))}function k(D,I,B,U,X,G){var ne=a.copy(),q=ln(G||B,I),P,V,R;if((R=i.call(D,new Ap("beforestart",{sourceEvent:B,target:v,identifier:X,active:c,x:q[0],y:q[1],dx:0,dy:0,dispatch:ne}),U))!=null)return P=R.x-q[0]||0,V=R.y-q[1]||0,function O(M,j,H){var F=q,T;switch(M){case"start":l[X]=O,T=c++;break;case"end":delete l[X],--c;case"drag":q=ln(H||j,I),T=c;break}ne.call(M,D,new Ap(M,{sourceEvent:j,subject:R,target:v,identifier:X,active:T,x:q[0]+P,y:q[1]+V,dx:q[0]-F[0],dy:q[1]-F[1],dispatch:ne}),U)}}return v.filter=function(D){return arguments.length?(e=typeof D=="function"?D:ou(!!D),v):e},v.container=function(D){return arguments.length?(t=typeof D=="function"?D:ou(D),v):t},v.subject=function(D){return arguments.length?(i=typeof D=="function"?D:ou(D),v):i},v.touchable=function(D){return arguments.length?(r=typeof D=="function"?D:ou(!!D),v):r},v.on=function(){var D=a.on.apply(a,arguments);return D===a?v:D},v.clickDistance=function(D){return arguments.length?(g=(D=+D)*D,v):Math.sqrt(g)},v}function jg(e,t,i){e.prototype=t.prototype=i,i.constructor=e}function Ab(e,t){var i=Object.create(e.prototype);for(var r in t)i[r]=t[r];return i}function Ma(){}var ha=.7,Pu=1/ha,Tl="\\s*([+-]?\\d+)\\s*",fa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",D5=/^#([0-9a-f]{3,8})$/,R5=new RegExp(`^rgb\\(${Tl},${Tl},${Tl}\\)$`),B5=new RegExp(`^rgb\\(${Cn},${Cn},${Cn}\\)$`),L5=new RegExp(`^rgba\\(${Tl},${Tl},${Tl},${fa}\\)$`),z5=new RegExp(`^rgba\\(${Cn},${Cn},${Cn},${fa}\\)$`),O5=new RegExp(`^hsl\\(${fa},${Cn},${Cn}\\)$`),H5=new RegExp(`^hsla\\(${fa},${Cn},${Cn},${fa}\\)$`),yy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jg(Ma,ks,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Sy,formatHex:Sy,formatHex8:j5,formatHsl:P5,formatRgb:by,toString:by});function Sy(){return this.rgb().formatHex()}function j5(){return this.rgb().formatHex8()}function P5(){return Db(this).formatHsl()}function by(){return this.rgb().formatRgb()}function ks(e){var t,i;return e=(e+"").trim().toLowerCase(),(t=D5.exec(e))?(i=t[1].length,t=parseInt(t[1],16),i===6?xy(t):i===3?new bi(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):i===8?au(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):i===4?au(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=R5.exec(e))?new bi(t[1],t[2],t[3],1):(t=B5.exec(e))?new bi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=L5.exec(e))?au(t[1],t[2],t[3],t[4]):(t=z5.exec(e))?au(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=O5.exec(e))?Ey(t[1],t[2]/100,t[3]/100,1):(t=H5.exec(e))?Ey(t[1],t[2]/100,t[3]/100,t[4]):yy.hasOwnProperty(e)?xy(yy[e]):e==="transparent"?new bi(NaN,NaN,NaN,0):null}function xy(e){return new bi(e>>16&255,e>>8&255,e&255,1)}function au(e,t,i,r){return r<=0&&(e=t=i=NaN),new bi(e,t,i,r)}function I5(e){return e instanceof Ma||(e=ks(e)),e?(e=e.rgb(),new bi(e.r,e.g,e.b,e.opacity)):new bi}function Dp(e,t,i,r){return arguments.length===1?I5(e):new bi(e,t,i,r??1)}function bi(e,t,i,r){this.r=+e,this.g=+t,this.b=+i,this.opacity=+r}jg(bi,Dp,Ab(Ma,{brighter(e){return e=e==null?Pu:Math.pow(Pu,e),new bi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new bi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new bi(ws(this.r),ws(this.g),ws(this.b),Iu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wy,formatHex:wy,formatHex8:U5,formatRgb:Cy,toString:Cy}));function wy(){return`#${bs(this.r)}${bs(this.g)}${bs(this.b)}`}function U5(){return`#${bs(this.r)}${bs(this.g)}${bs(this.b)}${bs((isNaN(this.opacity)?1:this.opacity)*255)}`}function Cy(){const e=Iu(this.opacity);return`${e===1?"rgb(":"rgba("}${ws(this.r)}, ${ws(this.g)}, ${ws(this.b)}${e===1?")":`, ${e})`}`}function Iu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ws(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bs(e){return e=ws(e),(e<16?"0":"")+e.toString(16)}function Ey(e,t,i,r){return r<=0?e=t=i=NaN:i<=0||i>=1?e=t=NaN:t<=0&&(e=NaN),new on(e,t,i,r)}function Db(e){if(e instanceof on)return new on(e.h,e.s,e.l,e.opacity);if(e instanceof Ma||(e=ks(e)),!e)return new on;if(e instanceof on)return e;e=e.rgb();var t=e.r/255,i=e.g/255,r=e.b/255,l=Math.min(t,i,r),a=Math.max(t,i,r),c=NaN,h=a-l,d=(a+l)/2;return h?(t===a?c=(i-r)/h+(i<r)*6:i===a?c=(r-t)/h+2:c=(t-i)/h+4,h/=d<.5?a+l:2-a-l,c*=60):h=d>0&&d<1?0:c,new on(c,h,d,e.opacity)}function q5(e,t,i,r){return arguments.length===1?Db(e):new on(e,t,i,r??1)}function on(e,t,i,r){this.h=+e,this.s=+t,this.l=+i,this.opacity=+r}jg(on,q5,Ab(Ma,{brighter(e){return e=e==null?Pu:Math.pow(Pu,e),new on(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new on(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*t,l=2*i-r;return new bi(Yd(e>=240?e-240:e+120,l,r),Yd(e,l,r),Yd(e<120?e+240:e-120,l,r),this.opacity)},clamp(){return new on(ky(this.h),cu(this.s),cu(this.l),Iu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Iu(this.opacity);return`${e===1?"hsl(":"hsla("}${ky(this.h)}, ${cu(this.s)*100}%, ${cu(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ky(e){return e=(e||0)%360,e<0?e+360:e}function cu(e){return Math.max(0,Math.min(1,e||0))}function Yd(e,t,i){return(e<60?t+(i-t)*e/60:e<180?i:e<240?t+(i-t)*(240-e)/60:t)*255}const Pg=e=>()=>e;function V5(e,t){return function(i){return e+i*t}}function F5(e,t,i){return e=Math.pow(e,i),t=Math.pow(t,i)-e,i=1/i,function(r){return Math.pow(e+r*t,i)}}function Y5(e){return(e=+e)==1?Rb:function(t,i){return i-t?F5(t,i,e):Pg(isNaN(t)?i:t)}}function Rb(e,t){var i=t-e;return i?V5(e,i):Pg(isNaN(e)?t:e)}const Uu=(function e(t){var i=Y5(t);function r(l,a){var c=i((l=Dp(l)).r,(a=Dp(a)).r),h=i(l.g,a.g),d=i(l.b,a.b),f=Rb(l.opacity,a.opacity);return function(m){return l.r=c(m),l.g=h(m),l.b=d(m),l.opacity=f(m),l+""}}return r.gamma=e,r})(1);function W5(e,t){t||(t=[]);var i=e?Math.min(t.length,e.length):0,r=t.slice(),l;return function(a){for(l=0;l<i;++l)r[l]=e[l]*(1-a)+t[l]*a;return r}}function $5(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function X5(e,t){var i=t?t.length:0,r=e?Math.min(i,e.length):0,l=new Array(r),a=new Array(i),c;for(c=0;c<r;++c)l[c]=ra(e[c],t[c]);for(;c<i;++c)a[c]=t[c];return function(h){for(c=0;c<r;++c)a[c]=l[c](h);return a}}function K5(e,t){var i=new Date;return e=+e,t=+t,function(r){return i.setTime(e*(1-r)+t*r),i}}function bn(e,t){return e=+e,t=+t,function(i){return e*(1-i)+t*i}}function G5(e,t){var i={},r={},l;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(l in t)l in e?i[l]=ra(e[l],t[l]):r[l]=t[l];return function(a){for(l in i)r[l]=i[l](a);return r}}var Rp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wd=new RegExp(Rp.source,"g");function Z5(e){return function(){return e}}function Q5(e){return function(t){return e(t)+""}}function Bb(e,t){var i=Rp.lastIndex=Wd.lastIndex=0,r,l,a,c=-1,h=[],d=[];for(e=e+"",t=t+"";(r=Rp.exec(e))&&(l=Wd.exec(t));)(a=l.index)>i&&(a=t.slice(i,a),h[c]?h[c]+=a:h[++c]=a),(r=r[0])===(l=l[0])?h[c]?h[c]+=l:h[++c]=l:(h[++c]=null,d.push({i:c,x:bn(r,l)})),i=Wd.lastIndex;return i<t.length&&(a=t.slice(i),h[c]?h[c]+=a:h[++c]=a),h.length<2?d[0]?Q5(d[0].x):Z5(t):(t=d.length,function(f){for(var m=0,g;m<t;++m)h[(g=d[m]).i]=g.x(f);return h.join("")})}function ra(e,t){var i=typeof t,r;return t==null||i==="boolean"?Pg(t):(i==="number"?bn:i==="string"?(r=ks(t))?(t=r,Uu):Bb:t instanceof ks?Uu:t instanceof Date?K5:$5(t)?W5:Array.isArray(t)?X5:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?G5:bn)(e,t)}var My=180/Math.PI,Bp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lb(e,t,i,r,l,a){var c,h,d;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(d=e*i+t*r)&&(i-=e*d,r-=t*d),(h=Math.sqrt(i*i+r*r))&&(i/=h,r/=h,d/=h),e*r<t*i&&(e=-e,t=-t,d=-d,c=-c),{translateX:l,translateY:a,rotate:Math.atan2(t,e)*My,skewX:Math.atan(d)*My,scaleX:c,scaleY:h}}var uu;function J5(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Bp:Lb(t.a,t.b,t.c,t.d,t.e,t.f)}function eM(e){return e==null||(uu||(uu=document.createElementNS("http://www.w3.org/2000/svg","g")),uu.setAttribute("transform",e),!(e=uu.transform.baseVal.consolidate()))?Bp:(e=e.matrix,Lb(e.a,e.b,e.c,e.d,e.e,e.f))}function zb(e,t,i,r){function l(f){return f.length?f.pop()+" ":""}function a(f,m,g,v,y,S){if(f!==g||m!==v){var b=y.push("translate(",null,t,null,i);S.push({i:b-4,x:bn(f,g)},{i:b-2,x:bn(m,v)})}else(g||v)&&y.push("translate("+g+t+v+i)}function c(f,m,g,v){f!==m?(f-m>180?m+=360:m-f>180&&(f+=360),v.push({i:g.push(l(g)+"rotate(",null,r)-2,x:bn(f,m)})):m&&g.push(l(g)+"rotate("+m+r)}function h(f,m,g,v){f!==m?v.push({i:g.push(l(g)+"skewX(",null,r)-2,x:bn(f,m)}):m&&g.push(l(g)+"skewX("+m+r)}function d(f,m,g,v,y,S){if(f!==g||m!==v){var b=y.push(l(y)+"scale(",null,",",null,")");S.push({i:b-4,x:bn(f,g)},{i:b-2,x:bn(m,v)})}else(g!==1||v!==1)&&y.push(l(y)+"scale("+g+","+v+")")}return function(f,m){var g=[],v=[];return f=e(f),m=e(m),a(f.translateX,f.translateY,m.translateX,m.translateY,g,v),c(f.rotate,m.rotate,g,v),h(f.skewX,m.skewX,g,v),d(f.scaleX,f.scaleY,m.scaleX,m.scaleY,g,v),f=m=null,function(y){for(var S=-1,b=v.length,E;++S<b;)g[(E=v[S]).i]=E.x(y);return g.join("")}}}var tM=zb(J5,"px, ","px)","deg)"),iM=zb(eM,", ",")",")"),nM=1e-12;function Ty(e){return((e=Math.exp(e))+1/e)/2}function rM(e){return((e=Math.exp(e))-1/e)/2}function sM(e){return((e=Math.exp(2*e))-1)/(e+1)}const ku=(function e(t,i,r){function l(a,c){var h=a[0],d=a[1],f=a[2],m=c[0],g=c[1],v=c[2],y=m-h,S=g-d,b=y*y+S*S,E,C;if(b<nM)C=Math.log(v/f)/t,E=function(U){return[h+U*y,d+U*S,f*Math.exp(t*U*C)]};else{var L=Math.sqrt(b),k=(v*v-f*f+r*b)/(2*f*i*L),D=(v*v-f*f-r*b)/(2*v*i*L),I=Math.log(Math.sqrt(k*k+1)-k),B=Math.log(Math.sqrt(D*D+1)-D);C=(B-I)/t,E=function(U){var X=U*C,G=Ty(I),ne=f/(i*L)*(G*sM(t*X+I)-rM(I));return[h+ne*y,d+ne*S,f*G/Ty(t*X+I)]}}return E.duration=C*1e3*t/Math.SQRT2,E}return l.rho=function(a){var c=Math.max(.001,+a),h=c*c,d=h*h;return e(c,h,d)},l})(Math.SQRT2,2,4);var Rl=0,Zo=0,Po=0,Ob=1e3,qu,Qo,Vu=0,Ms=0,oh=0,da=typeof performance=="object"&&performance.now?performance:Date,Hb=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ig(){return Ms||(Hb(lM),Ms=da.now()+oh)}function lM(){Ms=0}function Fu(){this._call=this._time=this._next=null}Fu.prototype=jb.prototype={constructor:Fu,restart:function(e,t,i){if(typeof e!="function")throw new TypeError("callback is not a function");i=(i==null?Ig():+i)+(t==null?0:+t),!this._next&&Qo!==this&&(Qo?Qo._next=this:qu=this,Qo=this),this._call=e,this._time=i,Lp()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lp())}};function jb(e,t,i){var r=new Fu;return r.restart(e,t,i),r}function oM(){Ig(),++Rl;for(var e=qu,t;e;)(t=Ms-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Rl}function Ny(){Ms=(Vu=da.now())+oh,Rl=Zo=0;try{oM()}finally{Rl=0,cM(),Ms=0}}function aM(){var e=da.now(),t=e-Vu;t>Ob&&(oh-=t,Vu=e)}function cM(){for(var e,t=qu,i,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(i=t._next,t._next=null,t=e?e._next=i:qu=i);Qo=e,Lp(r)}function Lp(e){if(!Rl){Zo&&(Zo=clearTimeout(Zo));var t=e-Ms;t>24?(e<1/0&&(Zo=setTimeout(Ny,e-da.now()-oh)),Po&&(Po=clearInterval(Po))):(Po||(Vu=da.now(),Po=setInterval(aM,Ob)),Rl=1,Hb(Ny))}}function Ay(e,t,i){var r=new Fu;return t=t==null?0:+t,r.restart(l=>{r.stop(),e(l+t)},t,i),r}var uM=sh("start","end","cancel","interrupt"),hM=[],Pb=0,Dy=1,zp=2,Mu=3,Ry=4,Op=5,Tu=6;function ah(e,t,i,r,l,a){var c=e.__transition;if(!c)e.__transition={};else if(i in c)return;fM(e,i,{name:t,index:r,group:l,on:uM,tween:hM,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Pb})}function Ug(e,t){var i=un(e,t);if(i.state>Pb)throw new Error("too late; already scheduled");return i}function Nn(e,t){var i=un(e,t);if(i.state>Mu)throw new Error("too late; already running");return i}function un(e,t){var i=e.__transition;if(!i||!(i=i[t]))throw new Error("transition not found");return i}function fM(e,t,i){var r=e.__transition,l;r[t]=i,i.timer=jb(a,0,i.time);function a(f){i.state=Dy,i.timer.restart(c,i.delay,i.time),i.delay<=f&&c(f-i.delay)}function c(f){var m,g,v,y;if(i.state!==Dy)return d();for(m in r)if(y=r[m],y.name===i.name){if(y.state===Mu)return Ay(c);y.state===Ry?(y.state=Tu,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[m]):+m<t&&(y.state=Tu,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[m])}if(Ay(function(){i.state===Mu&&(i.state=Ry,i.timer.restart(h,i.delay,i.time),h(f))}),i.state=zp,i.on.call("start",e,e.__data__,i.index,i.group),i.state===zp){for(i.state=Mu,l=new Array(v=i.tween.length),m=0,g=-1;m<v;++m)(y=i.tween[m].value.call(e,e.__data__,i.index,i.group))&&(l[++g]=y);l.length=g+1}}function h(f){for(var m=f<i.duration?i.ease.call(null,f/i.duration):(i.timer.restart(d),i.state=Op,1),g=-1,v=l.length;++g<v;)l[g].call(e,m);i.state===Op&&(i.on.call("end",e,e.__data__,i.index,i.group),d())}function d(){i.state=Tu,i.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Nu(e,t){var i=e.__transition,r,l,a=!0,c;if(i){t=t==null?null:t+"";for(c in i){if((r=i[c]).name!==t){a=!1;continue}l=r.state>zp&&r.state<Op,r.state=Tu,r.timer.stop(),r.on.call(l?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete i[c]}a&&delete e.__transition}}function dM(e){return this.each(function(){Nu(this,e)})}function pM(e,t){var i,r;return function(){var l=Nn(this,e),a=l.tween;if(a!==i){r=i=a;for(var c=0,h=r.length;c<h;++c)if(r[c].name===t){r=r.slice(),r.splice(c,1);break}}l.tween=r}}function gM(e,t,i){var r,l;if(typeof i!="function")throw new Error;return function(){var a=Nn(this,e),c=a.tween;if(c!==r){l=(r=c).slice();for(var h={name:t,value:i},d=0,f=l.length;d<f;++d)if(l[d].name===t){l[d]=h;break}d===f&&l.push(h)}a.tween=l}}function mM(e,t){var i=this._id;if(e+="",arguments.length<2){for(var r=un(this.node(),i).tween,l=0,a=r.length,c;l<a;++l)if((c=r[l]).name===e)return c.value;return null}return this.each((t==null?pM:gM)(i,e,t))}function qg(e,t,i){var r=e._id;return e.each(function(){var l=Nn(this,r);(l.value||(l.value={}))[t]=i.apply(this,arguments)}),function(l){return un(l,r).value[t]}}function Ib(e,t){var i;return(typeof t=="number"?bn:t instanceof ks?Uu:(i=ks(t))?(t=i,Uu):Bb)(e,t)}function _M(e){return function(){this.removeAttribute(e)}}function vM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yM(e,t,i){var r,l=i+"",a;return function(){var c=this.getAttribute(e);return c===l?null:c===r?a:a=t(r=c,i)}}function SM(e,t,i){var r,l=i+"",a;return function(){var c=this.getAttributeNS(e.space,e.local);return c===l?null:c===r?a:a=t(r=c,i)}}function bM(e,t,i){var r,l,a;return function(){var c,h=i(this),d;return h==null?void this.removeAttribute(e):(c=this.getAttribute(e),d=h+"",c===d?null:c===r&&d===l?a:(l=d,a=t(r=c,h)))}}function xM(e,t,i){var r,l,a;return function(){var c,h=i(this),d;return h==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),d=h+"",c===d?null:c===r&&d===l?a:(l=d,a=t(r=c,h)))}}function wM(e,t){var i=lh(e),r=i==="transform"?iM:Ib;return this.attrTween(e,typeof t=="function"?(i.local?xM:bM)(i,r,qg(this,"attr."+e,t)):t==null?(i.local?vM:_M)(i):(i.local?SM:yM)(i,r,t))}function CM(e,t){return function(i){this.setAttribute(e,t.call(this,i))}}function EM(e,t){return function(i){this.setAttributeNS(e.space,e.local,t.call(this,i))}}function kM(e,t){var i,r;function l(){var a=t.apply(this,arguments);return a!==r&&(i=(r=a)&&EM(e,a)),i}return l._value=t,l}function MM(e,t){var i,r;function l(){var a=t.apply(this,arguments);return a!==r&&(i=(r=a)&&CM(e,a)),i}return l._value=t,l}function TM(e,t){var i="attr."+e;if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;var r=lh(e);return this.tween(i,(r.local?kM:MM)(r,t))}function NM(e,t){return function(){Ug(this,e).delay=+t.apply(this,arguments)}}function AM(e,t){return t=+t,function(){Ug(this,e).delay=t}}function DM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?NM:AM)(t,e)):un(this.node(),t).delay}function RM(e,t){return function(){Nn(this,e).duration=+t.apply(this,arguments)}}function BM(e,t){return t=+t,function(){Nn(this,e).duration=t}}function LM(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?RM:BM)(t,e)):un(this.node(),t).duration}function zM(e,t){if(typeof t!="function")throw new Error;return function(){Nn(this,e).ease=t}}function OM(e){var t=this._id;return arguments.length?this.each(zM(t,e)):un(this.node(),t).ease}function HM(e,t){return function(){var i=t.apply(this,arguments);if(typeof i!="function")throw new Error;Nn(this,e).ease=i}}function jM(e){if(typeof e!="function")throw new Error;return this.each(HM(this._id,e))}function PM(e){typeof e!="function"&&(e=_b(e));for(var t=this._groups,i=t.length,r=new Array(i),l=0;l<i;++l)for(var a=t[l],c=a.length,h=r[l]=[],d,f=0;f<c;++f)(d=a[f])&&e.call(d,d.__data__,f,a)&&h.push(d);return new rr(r,this._parents,this._name,this._id)}function IM(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,i=e._groups,r=t.length,l=i.length,a=Math.min(r,l),c=new Array(r),h=0;h<a;++h)for(var d=t[h],f=i[h],m=d.length,g=c[h]=new Array(m),v,y=0;y<m;++y)(v=d[y]||f[y])&&(g[y]=v);for(;h<r;++h)c[h]=t[h];return new rr(c,this._parents,this._name,this._id)}function UM(e){return(e+"").trim().split(/^|\s+/).every(function(t){var i=t.indexOf(".");return i>=0&&(t=t.slice(0,i)),!t||t==="start"})}function qM(e,t,i){var r,l,a=UM(t)?Ug:Nn;return function(){var c=a(this,e),h=c.on;h!==r&&(l=(r=h).copy()).on(t,i),c.on=l}}function VM(e,t){var i=this._id;return arguments.length<2?un(this.node(),i).on.on(e):this.each(qM(i,e,t))}function FM(e){return function(){var t=this.parentNode;for(var i in this.__transition)if(+i!==e)return;t&&t.removeChild(this)}}function YM(){return this.on("end.remove",FM(this._id))}function WM(e){var t=this._name,i=this._id;typeof e!="function"&&(e=Og(e));for(var r=this._groups,l=r.length,a=new Array(l),c=0;c<l;++c)for(var h=r[c],d=h.length,f=a[c]=new Array(d),m,g,v=0;v<d;++v)(m=h[v])&&(g=e.call(m,m.__data__,v,h))&&("__data__"in m&&(g.__data__=m.__data__),f[v]=g,ah(f[v],t,i,v,f,un(m,i)));return new rr(a,this._parents,t,i)}function $M(e){var t=this._name,i=this._id;typeof e!="function"&&(e=mb(e));for(var r=this._groups,l=r.length,a=[],c=[],h=0;h<l;++h)for(var d=r[h],f=d.length,m,g=0;g<f;++g)if(m=d[g]){for(var v=e.call(m,m.__data__,g,d),y,S=un(m,i),b=0,E=v.length;b<E;++b)(y=v[b])&&ah(y,t,i,b,v,S);a.push(v),c.push(m)}return new rr(a,c,t,i)}var XM=ka.prototype.constructor;function KM(){return new XM(this._groups,this._parents)}function GM(e,t){var i,r,l;return function(){var a=Dl(this,e),c=(this.style.removeProperty(e),Dl(this,e));return a===c?null:a===i&&c===r?l:l=t(i=a,r=c)}}function Ub(e){return function(){this.style.removeProperty(e)}}function ZM(e,t,i){var r,l=i+"",a;return function(){var c=Dl(this,e);return c===l?null:c===r?a:a=t(r=c,i)}}function QM(e,t,i){var r,l,a;return function(){var c=Dl(this,e),h=i(this),d=h+"";return h==null&&(d=h=(this.style.removeProperty(e),Dl(this,e))),c===d?null:c===r&&d===l?a:(l=d,a=t(r=c,h))}}function JM(e,t){var i,r,l,a="style."+t,c="end."+a,h;return function(){var d=Nn(this,e),f=d.on,m=d.value[a]==null?h||(h=Ub(t)):void 0;(f!==i||l!==m)&&(r=(i=f).copy()).on(c,l=m),d.on=r}}function e3(e,t,i){var r=(e+="")=="transform"?tM:Ib;return t==null?this.styleTween(e,GM(e,r)).on("end.style."+e,Ub(e)):typeof t=="function"?this.styleTween(e,QM(e,r,qg(this,"style."+e,t))).each(JM(this._id,e)):this.styleTween(e,ZM(e,r,t),i).on("end.style."+e,null)}function t3(e,t,i){return function(r){this.style.setProperty(e,t.call(this,r),i)}}function i3(e,t,i){var r,l;function a(){var c=t.apply(this,arguments);return c!==l&&(r=(l=c)&&t3(e,c,i)),r}return a._value=t,a}function n3(e,t,i){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,i3(e,t,i??""))}function r3(e){return function(){this.textContent=e}}function s3(e){return function(){var t=e(this);this.textContent=t??""}}function l3(e){return this.tween("text",typeof e=="function"?s3(qg(this,"text",e)):r3(e==null?"":e+""))}function o3(e){return function(t){this.textContent=e.call(this,t)}}function a3(e){var t,i;function r(){var l=e.apply(this,arguments);return l!==i&&(t=(i=l)&&o3(l)),t}return r._value=e,r}function c3(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,a3(e))}function u3(){for(var e=this._name,t=this._id,i=qb(),r=this._groups,l=r.length,a=0;a<l;++a)for(var c=r[a],h=c.length,d,f=0;f<h;++f)if(d=c[f]){var m=un(d,t);ah(d,e,i,f,c,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new rr(r,this._parents,e,i)}function h3(){var e,t,i=this,r=i._id,l=i.size();return new Promise(function(a,c){var h={value:c},d={value:function(){--l===0&&a()}};i.each(function(){var f=Nn(this,r),m=f.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(h),t._.interrupt.push(h),t._.end.push(d)),f.on=t}),l===0&&a()})}var f3=0;function rr(e,t,i,r){this._groups=e,this._parents=t,this._name=i,this._id=r}function qb(){return++f3}var Jn=ka.prototype;rr.prototype={constructor:rr,select:WM,selectAll:$M,selectChild:Jn.selectChild,selectChildren:Jn.selectChildren,filter:PM,merge:IM,selection:KM,transition:u3,call:Jn.call,nodes:Jn.nodes,node:Jn.node,size:Jn.size,empty:Jn.empty,each:Jn.each,on:VM,attr:wM,attrTween:TM,style:e3,styleTween:n3,text:l3,textTween:c3,remove:YM,tween:mM,delay:DM,duration:LM,ease:OM,easeVarying:jM,end:h3,[Symbol.iterator]:Jn[Symbol.iterator]};function d3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var p3={time:null,delay:0,duration:250,ease:d3};function g3(e,t){for(var i;!(i=e.__transition)||!(i=i[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return i}function m3(e){var t,i;e instanceof rr?(t=e._id,e=e._name):(t=qb(),(i=p3).time=Ig(),e=e==null?null:e+"");for(var r=this._groups,l=r.length,a=0;a<l;++a)for(var c=r[a],h=c.length,d,f=0;f<h;++f)(d=c[f])&&ah(d,e,t,f,c,i||g3(d,t));return new rr(r,this._parents,e,t)}ka.prototype.interrupt=dM;ka.prototype.transition=m3;const hu=e=>()=>e;function _3(e,{sourceEvent:t,target:i,transform:r,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:l}})}function tr(e,t,i){this.k=e,this.x=t,this.y=i}tr.prototype={constructor:tr,scale:function(e){return e===1?this:new tr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new tr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ch=new tr(1,0,0);Vb.prototype=tr.prototype;function Vb(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ch;return e.__zoom}function $d(e){e.stopImmediatePropagation()}function Io(e){e.preventDefault(),e.stopImmediatePropagation()}function v3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function y3(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function By(){return this.__zoom||ch}function S3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function b3(){return navigator.maxTouchPoints||"ontouchstart"in this}function x3(e,t,i){var r=e.invertX(t[0][0])-i[0][0],l=e.invertX(t[1][0])-i[1][0],a=e.invertY(t[0][1])-i[0][1],c=e.invertY(t[1][1])-i[1][1];return e.translate(l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function Fb(){var e=v3,t=y3,i=x3,r=S3,l=b3,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],h=250,d=ku,f=sh("start","zoom","end"),m,g,v,y=500,S=150,b=0,E=10;function C(R){R.property("__zoom",By).on("wheel.zoom",X,{passive:!1}).on("mousedown.zoom",G).on("dblclick.zoom",ne).filter(l).on("touchstart.zoom",q).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}C.transform=function(R,O,M,j){var H=R.selection?R.selection():R;H.property("__zoom",By),R!==H?I(R,O,M,j):H.interrupt().each(function(){B(this,arguments).event(j).start().zoom(null,typeof O=="function"?O.apply(this,arguments):O).end()})},C.scaleBy=function(R,O,M,j){C.scaleTo(R,function(){var H=this.__zoom.k,F=typeof O=="function"?O.apply(this,arguments):O;return H*F},M,j)},C.scaleTo=function(R,O,M,j){C.transform(R,function(){var H=t.apply(this,arguments),F=this.__zoom,T=M==null?D(H):typeof M=="function"?M.apply(this,arguments):M,z=F.invert(T),W=typeof O=="function"?O.apply(this,arguments):O;return i(k(L(F,W),T,z),H,c)},M,j)},C.translateBy=function(R,O,M,j){C.transform(R,function(){return i(this.__zoom.translate(typeof O=="function"?O.apply(this,arguments):O,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),c)},null,j)},C.translateTo=function(R,O,M,j,H){C.transform(R,function(){var F=t.apply(this,arguments),T=this.__zoom,z=j==null?D(F):typeof j=="function"?j.apply(this,arguments):j;return i(ch.translate(z[0],z[1]).scale(T.k).translate(typeof O=="function"?-O.apply(this,arguments):-O,typeof M=="function"?-M.apply(this,arguments):-M),F,c)},j,H)};function L(R,O){return O=Math.max(a[0],Math.min(a[1],O)),O===R.k?R:new tr(O,R.x,R.y)}function k(R,O,M){var j=O[0]-M[0]*R.k,H=O[1]-M[1]*R.k;return j===R.x&&H===R.y?R:new tr(R.k,j,H)}function D(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function I(R,O,M,j){R.on("start.zoom",function(){B(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event(j).end()}).tween("zoom",function(){var H=this,F=arguments,T=B(H,F).event(j),z=t.apply(H,F),W=M==null?D(z):typeof M=="function"?M.apply(H,F):M,N=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),ee=H.__zoom,ce=typeof O=="function"?O.apply(H,F):O,oe=d(ee.invert(W).concat(N/ee.k),ce.invert(W).concat(N/ce.k));return function(fe){if(fe===1)fe=ce;else{var he=oe(fe),pe=N/he[2];fe=new tr(pe,W[0]-he[0]*pe,W[1]-he[1]*pe)}T.zoom(null,fe)}})}function B(R,O,M){return!M&&R.__zooming||new U(R,O)}function U(R,O){this.that=R,this.args=O,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,O),this.taps=0}U.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,O){return this.mouse&&R!=="mouse"&&(this.mouse[1]=O.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=O.invert(this.touch0[0])),this.touch1&&R!=="touch"&&(this.touch1[1]=O.invert(this.touch1[0])),this.that.__zoom=O,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(R){var O=Oi(this.that).datum();f.call(R,this.that,new _3(R,{sourceEvent:this.sourceEvent,target:C,transform:this.that.__zoom,dispatch:f}),O)}};function X(R,...O){if(!e.apply(this,arguments))return;var M=B(this,O).event(R),j=this.__zoom,H=Math.max(a[0],Math.min(a[1],j.k*Math.pow(2,r.apply(this,arguments)))),F=ln(R);if(M.wheel)(M.mouse[0][0]!==F[0]||M.mouse[0][1]!==F[1])&&(M.mouse[1]=j.invert(M.mouse[0]=F)),clearTimeout(M.wheel);else{if(j.k===H)return;M.mouse=[F,j.invert(F)],Nu(this),M.start()}Io(R),M.wheel=setTimeout(T,S),M.zoom("mouse",i(k(L(j,H),M.mouse[0],M.mouse[1]),M.extent,c));function T(){M.wheel=null,M.end()}}function G(R,...O){if(v||!e.apply(this,arguments))return;var M=R.currentTarget,j=B(this,O,!0).event(R),H=Oi(R.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",N,!0),F=ln(R,M),T=R.clientX,z=R.clientY;Mb(R.view),$d(R),j.mouse=[F,this.__zoom.invert(F)],Nu(this),j.start();function W(ee){if(Io(ee),!j.moved){var ce=ee.clientX-T,oe=ee.clientY-z;j.moved=ce*ce+oe*oe>b}j.event(ee).zoom("mouse",i(k(j.that.__zoom,j.mouse[0]=ln(ee,M),j.mouse[1]),j.extent,c))}function N(ee){H.on("mousemove.zoom mouseup.zoom",null),Tb(ee.view,j.moved),Io(ee),j.event(ee).end()}}function ne(R,...O){if(e.apply(this,arguments)){var M=this.__zoom,j=ln(R.changedTouches?R.changedTouches[0]:R,this),H=M.invert(j),F=M.k*(R.shiftKey?.5:2),T=i(k(L(M,F),j,H),t.apply(this,O),c);Io(R),h>0?Oi(this).transition().duration(h).call(I,T,j,R):Oi(this).call(C.transform,T,j,R)}}function q(R,...O){if(e.apply(this,arguments)){var M=R.touches,j=M.length,H=B(this,O,R.changedTouches.length===j).event(R),F,T,z,W;for($d(R),T=0;T<j;++T)z=M[T],W=ln(z,this),W=[W,this.__zoom.invert(W),z.identifier],H.touch0?!H.touch1&&H.touch0[2]!==W[2]&&(H.touch1=W,H.taps=0):(H.touch0=W,F=!0,H.taps=1+!!m);m&&(m=clearTimeout(m)),F&&(H.taps<2&&(g=W[0],m=setTimeout(function(){m=null},y)),Nu(this),H.start())}}function P(R,...O){if(this.__zooming){var M=B(this,O).event(R),j=R.changedTouches,H=j.length,F,T,z,W;for(Io(R),F=0;F<H;++F)T=j[F],z=ln(T,this),M.touch0&&M.touch0[2]===T.identifier?M.touch0[0]=z:M.touch1&&M.touch1[2]===T.identifier&&(M.touch1[0]=z);if(T=M.that.__zoom,M.touch1){var N=M.touch0[0],ee=M.touch0[1],ce=M.touch1[0],oe=M.touch1[1],fe=(fe=ce[0]-N[0])*fe+(fe=ce[1]-N[1])*fe,he=(he=oe[0]-ee[0])*he+(he=oe[1]-ee[1])*he;T=L(T,Math.sqrt(fe/he)),z=[(N[0]+ce[0])/2,(N[1]+ce[1])/2],W=[(ee[0]+oe[0])/2,(ee[1]+oe[1])/2]}else if(M.touch0)z=M.touch0[0],W=M.touch0[1];else return;M.zoom("touch",i(k(T,z,W),M.extent,c))}}function V(R,...O){if(this.__zooming){var M=B(this,O).event(R),j=R.changedTouches,H=j.length,F,T;for($d(R),v&&clearTimeout(v),v=setTimeout(function(){v=null},y),F=0;F<H;++F)T=j[F],M.touch0&&M.touch0[2]===T.identifier?delete M.touch0:M.touch1&&M.touch1[2]===T.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(T=ln(T,this),Math.hypot(g[0]-T[0],g[1]-T[1])<E)){var z=Oi(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return C.wheelDelta=function(R){return arguments.length?(r=typeof R=="function"?R:hu(+R),C):r},C.filter=function(R){return arguments.length?(e=typeof R=="function"?R:hu(!!R),C):e},C.touchable=function(R){return arguments.length?(l=typeof R=="function"?R:hu(!!R),C):l},C.extent=function(R){return arguments.length?(t=typeof R=="function"?R:hu([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),C):t},C.scaleExtent=function(R){return arguments.length?(a[0]=+R[0],a[1]=+R[1],C):[a[0],a[1]]},C.translateExtent=function(R){return arguments.length?(c[0][0]=+R[0][0],c[1][0]=+R[1][0],c[0][1]=+R[0][1],c[1][1]=+R[1][1],C):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},C.constrain=function(R){return arguments.length?(i=R,C):i},C.duration=function(R){return arguments.length?(h=+R,C):h},C.interpolate=function(R){return arguments.length?(d=R,C):d},C.on=function(){var R=f.on.apply(f,arguments);return R===f?C:R},C.clickDistance=function(R){return arguments.length?(b=(R=+R)*R,C):Math.sqrt(b)},C.tapDistance=function(R){return arguments.length?(E=+R,C):E},C}const kn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:i,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?i:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pa=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Yb=["Enter"," ","Escape"],Wb={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:i})=>`Moved selected node ${e}. New position, x: ${t}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Bl;(function(e){e.Strict="strict",e.Loose="loose"})(Bl||(Bl={}));var Cs;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Cs||(Cs={}));var ga;(function(e){e.Partial="partial",e.Full="full"})(ga||(ga={}));const $b={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Yr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Yr||(Yr={}));var ma;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ma||(ma={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const Ly={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function Xb(e){return e===null?null:e?"valid":"invalid"}const Kb=e=>"id"in e&&"source"in e&&"target"in e,w3=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Vg=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ta=(e,t=[0,0])=>{const{width:i,height:r}=sr(e),l=e.origin??t,a=i*l[0],c=r*l[1];return{x:e.position.x-a,y:e.position.y-c}},C3=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const i=e.reduce((r,l)=>{const a=typeof l=="string";let c=!t.nodeLookup&&!a?l:void 0;t.nodeLookup&&(c=a?t.nodeLookup.get(l):Vg(l)?l:t.nodeLookup.get(l.id));const h=c?Yu(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return uh(r,h)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return hh(i)},Na=(e,t={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(l=>{(t.filter===void 0||t.filter(l))&&(i=uh(i,Yu(l)),r=!0)}),r?hh(i):{x:0,y:0,width:0,height:0}},Fg=(e,t,[i,r,l]=[0,0,1],a=!1,c=!1)=>{const h={...Da(t,[i,r,l]),width:t.width/l,height:t.height/l},d=[];for(const f of e.values()){const{measured:m,selectable:g=!0,hidden:v=!1}=f;if(c&&!g||v)continue;const y=m.width??f.width??f.initialWidth??null,S=m.height??f.height??f.initialHeight??null,b=_a(h,zl(f)),E=(y??0)*(S??0),C=a&&b>0;(!f.internals.handleBounds||C||b>=E||f.dragging)&&d.push(f)}return d},E3=(e,t)=>{const i=new Set;return e.forEach(r=>{i.add(r.id)}),t.filter(r=>i.has(r.source)||i.has(r.target))};function k3(e,t){const i=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(l=>l.id)):null;return e.forEach(l=>{l.measured.width&&l.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!l.hidden)&&(!r||r.has(l.id))&&i.set(l.id,l)}),i}async function M3({nodes:e,width:t,height:i,panZoom:r,minZoom:l,maxZoom:a},c){if(e.size===0)return Promise.resolve(!0);const h=k3(e,c),d=Na(h),f=Yg(d,t,i,(c==null?void 0:c.minZoom)??l,(c==null?void 0:c.maxZoom)??a,(c==null?void 0:c.padding)??.1);return await r.setViewport(f,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),Promise.resolve(!0)}function Gb({nodeId:e,nextPosition:t,nodeLookup:i,nodeOrigin:r=[0,0],nodeExtent:l,onError:a}){const c=i.get(e),h=c.parentId?i.get(c.parentId):void 0,{x:d,y:f}=h?h.internals.positionAbsolute:{x:0,y:0},m=c.origin??r;let g=c.extent||l;if(c.extent==="parent"&&!c.expandParent)if(!h)a==null||a("005",kn.error005());else{const y=h.measured.width,S=h.measured.height;y&&S&&(g=[[d,f],[d+y,f+S]])}else h&&Ol(c.extent)&&(g=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);const v=Ol(g)?Ts(t,g,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(a==null||a("015",kn.error015())),{position:{x:v.x-d+(c.measured.width??0)*m[0],y:v.y-f+(c.measured.height??0)*m[1]},positionAbsolute:v}}async function T3({nodesToRemove:e=[],edgesToRemove:t=[],nodes:i,edges:r,onBeforeDelete:l}){const a=new Set(e.map(v=>v.id)),c=[];for(const v of i){if(v.deletable===!1)continue;const y=a.has(v.id),S=!y&&v.parentId&&c.find(b=>b.id===v.parentId);(y||S)&&c.push(v)}const h=new Set(t.map(v=>v.id)),d=r.filter(v=>v.deletable!==!1),m=E3(c,d);for(const v of d)h.has(v.id)&&!m.find(S=>S.id===v.id)&&m.push(v);if(!l)return{edges:m,nodes:c};const g=await l({nodes:c,edges:m});return typeof g=="boolean"?g?{edges:m,nodes:c}:{edges:[],nodes:[]}:g}const Ll=(e,t=0,i=1)=>Math.min(Math.max(e,t),i),Ts=(e={x:0,y:0},t,i)=>({x:Ll(e.x,t[0][0],t[1][0]-((i==null?void 0:i.width)??0)),y:Ll(e.y,t[0][1],t[1][1]-((i==null?void 0:i.height)??0))});function Zb(e,t,i){const{width:r,height:l}=sr(i),{x:a,y:c}=i.internals.positionAbsolute;return Ts(e,[[a,c],[a+r,c+l]],t)}const zy=(e,t,i)=>e<t?Ll(Math.abs(e-t),1,t)/t:e>i?-Ll(Math.abs(e-i),1,t)/t:0,Qb=(e,t,i=15,r=40)=>{const l=zy(e.x,r,t.width-r)*i,a=zy(e.y,r,t.height-r)*i;return[l,a]},uh=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Hp=({x:e,y:t,width:i,height:r})=>({x:e,y:t,x2:e+i,y2:t+r}),hh=({x:e,y:t,x2:i,y2:r})=>({x:e,y:t,width:i-e,height:r-t}),zl=(e,t=[0,0])=>{var l,a;const{x:i,y:r}=Vg(e)?e.internals.positionAbsolute:Ta(e,t);return{x:i,y:r,width:((l=e.measured)==null?void 0:l.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Yu=(e,t=[0,0])=>{var l,a;const{x:i,y:r}=Vg(e)?e.internals.positionAbsolute:Ta(e,t);return{x:i,y:r,x2:i+(((l=e.measured)==null?void 0:l.width)??e.width??e.initialWidth??0),y2:r+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},Jb=(e,t)=>hh(uh(Hp(e),Hp(t))),_a=(e,t)=>{const i=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(i*r)},Oy=e=>an(e.width)&&an(e.height)&&an(e.x)&&an(e.y),an=e=>!isNaN(e)&&isFinite(e),N3=(e,t)=>{},Aa=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Da=({x:e,y:t},[i,r,l],a=!1,c=[1,1])=>{const h={x:(e-i)/l,y:(t-r)/l};return a?Aa(h,c):h},Wu=({x:e,y:t},[i,r,l])=>({x:e*l+i,y:t*l+r});function yl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(i)}if(typeof e=="string"&&e.endsWith("%")){const i=parseFloat(e);if(!Number.isNaN(i))return Math.floor(t*i*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function A3(e,t,i){if(typeof e=="string"||typeof e=="number"){const r=yl(e,i),l=yl(e,t);return{top:r,right:l,bottom:r,left:l,x:l*2,y:r*2}}if(typeof e=="object"){const r=yl(e.top??e.y??0,i),l=yl(e.bottom??e.y??0,i),a=yl(e.left??e.x??0,t),c=yl(e.right??e.x??0,t);return{top:r,right:c,bottom:l,left:a,x:a+c,y:r+l}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function D3(e,t,i,r,l,a){const{x:c,y:h}=Wu(e,[t,i,r]),{x:d,y:f}=Wu({x:e.x+e.width,y:e.y+e.height},[t,i,r]),m=l-d,g=a-f;return{left:Math.floor(c),top:Math.floor(h),right:Math.floor(m),bottom:Math.floor(g)}}const Yg=(e,t,i,r,l,a)=>{const c=A3(a,t,i),h=(t-c.x)/e.width,d=(i-c.y)/e.height,f=Math.min(h,d),m=Ll(f,r,l),g=e.x+e.width/2,v=e.y+e.height/2,y=t/2-g*m,S=i/2-v*m,b=D3(e,y,S,m,t,i),E={left:Math.min(b.left-c.left,0),top:Math.min(b.top-c.top,0),right:Math.min(b.right-c.right,0),bottom:Math.min(b.bottom-c.bottom,0)};return{x:y-E.left+E.right,y:S-E.top+E.bottom,zoom:m}},va=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ol(e){return e!=null&&e!=="parent"}function sr(e){var t,i;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}}function ex(e){var t,i;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight)!==void 0}function tx(e,t={width:0,height:0},i,r,l){const a={...e},c=r.get(i);if(c){const h=c.origin||l;a.x+=c.internals.positionAbsolute.x-(t.width??0)*h[0],a.y+=c.internals.positionAbsolute.y-(t.height??0)*h[1]}return a}function Hy(e,t){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}function R3(){let e,t;return{promise:new Promise((r,l)=>{e=r,t=l}),resolve:e,reject:t}}function B3(e){return{...Wb,...e||{}}}function sa(e,{snapGrid:t=[0,0],snapToGrid:i=!1,transform:r,containerBounds:l}){const{x:a,y:c}=cn(e),h=Da({x:a-((l==null?void 0:l.left)??0),y:c-((l==null?void 0:l.top)??0)},r),{x:d,y:f}=i?Aa(h,t):h;return{xSnapped:d,ySnapped:f,...h}}const Wg=e=>({width:e.offsetWidth,height:e.offsetHeight}),ix=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},L3=["INPUT","SELECT","TEXTAREA"];function nx(e){var r,l;const t=((l=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:l[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:L3.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const rx=e=>"clientX"in e,cn=(e,t)=>{var a,c;const i=rx(e),r=i?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,l=i?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}},jy=(e,t,i,r,l)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:l,position:c.getAttribute("data-handlepos"),x:(h.left-i.left)/r,y:(h.top-i.top)/r,...Wg(c)}})};function sx({sourceX:e,sourceY:t,targetX:i,targetY:r,sourceControlX:l,sourceControlY:a,targetControlX:c,targetControlY:h}){const d=e*.125+l*.375+c*.375+i*.125,f=t*.125+a*.375+h*.375+r*.125,m=Math.abs(d-e),g=Math.abs(f-t);return[d,f,m,g]}function fu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Py({pos:e,x1:t,y1:i,x2:r,y2:l,c:a}){switch(e){case we.Left:return[t-fu(t-r,a),i];case we.Right:return[t+fu(r-t,a),i];case we.Top:return[t,i-fu(i-l,a)];case we.Bottom:return[t,i+fu(l-i,a)]}}function $g({sourceX:e,sourceY:t,sourcePosition:i=we.Bottom,targetX:r,targetY:l,targetPosition:a=we.Top,curvature:c=.25}){const[h,d]=Py({pos:i,x1:e,y1:t,x2:r,y2:l,c}),[f,m]=Py({pos:a,x1:r,y1:l,x2:e,y2:t,c}),[g,v,y,S]=sx({sourceX:e,sourceY:t,targetX:r,targetY:l,sourceControlX:h,sourceControlY:d,targetControlX:f,targetControlY:m});return[`M${e},${t} C${h},${d} ${f},${m} ${r},${l}`,g,v,y,S]}function lx({sourceX:e,sourceY:t,targetX:i,targetY:r}){const l=Math.abs(i-e)/2,a=i<e?i+l:i-l,c=Math.abs(r-t)/2,h=r<t?r+c:r-c;return[a,h,l,c]}function z3({sourceNode:e,targetNode:t,selected:i=!1,zIndex:r=0,elevateOnSelect:l=!1,zIndexMode:a="basic"}){if(a==="manual")return r;const c=l&&i?r+1e3:r,h=Math.max(e.parentId||l&&e.selected?e.internals.z:0,t.parentId||l&&t.selected?t.internals.z:0);return c+h}function O3({sourceNode:e,targetNode:t,width:i,height:r,transform:l}){const a=uh(Yu(e),Yu(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const c={x:-l[0]/l[2],y:-l[1]/l[2],width:i/l[2],height:r/l[2]};return _a(c,hh(a))>0}const H3=({source:e,sourceHandle:t,target:i,targetHandle:r})=>`xy-edge__${e}${t||""}-${i}${r||""}`,j3=(e,t)=>t.some(i=>i.source===e.source&&i.target===e.target&&(i.sourceHandle===e.sourceHandle||!i.sourceHandle&&!e.sourceHandle)&&(i.targetHandle===e.targetHandle||!i.targetHandle&&!e.targetHandle)),P3=(e,t,i={})=>{if(!e.source||!e.target)return t;const r=i.getEdgeId||H3;let l;return Kb(e)?l={...e}:l={...e,id:r(e)},j3(l,t)?t:(l.sourceHandle===null&&delete l.sourceHandle,l.targetHandle===null&&delete l.targetHandle,t.concat(l))};function ox({sourceX:e,sourceY:t,targetX:i,targetY:r}){const[l,a,c,h]=lx({sourceX:e,sourceY:t,targetX:i,targetY:r});return[`M ${e},${t}L ${i},${r}`,l,a,c,h]}const Iy={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},I3=({source:e,sourcePosition:t=we.Bottom,target:i})=>t===we.Left||t===we.Right?e.x<i.x?{x:1,y:0}:{x:-1,y:0}:e.y<i.y?{x:0,y:1}:{x:0,y:-1},Uy=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function U3({source:e,sourcePosition:t=we.Bottom,target:i,targetPosition:r=we.Top,center:l,offset:a,stepPosition:c}){const h=Iy[t],d=Iy[r],f={x:e.x+h.x*a,y:e.y+h.y*a},m={x:i.x+d.x*a,y:i.y+d.y*a},g=I3({source:f,sourcePosition:t,target:m}),v=g.x!==0?"x":"y",y=g[v];let S=[],b,E;const C={x:0,y:0},L={x:0,y:0},[,,k,D]=lx({sourceX:e.x,sourceY:e.y,targetX:i.x,targetY:i.y});if(h[v]*d[v]===-1){v==="x"?(b=l.x??f.x+(m.x-f.x)*c,E=l.y??(f.y+m.y)/2):(b=l.x??(f.x+m.x)/2,E=l.y??f.y+(m.y-f.y)*c);const B=[{x:b,y:f.y},{x:b,y:m.y}],U=[{x:f.x,y:E},{x:m.x,y:E}];h[v]===y?S=v==="x"?B:U:S=v==="x"?U:B}else{const B=[{x:f.x,y:m.y}],U=[{x:m.x,y:f.y}];if(v==="x"?S=h.x===y?U:B:S=h.y===y?B:U,t===r){const P=Math.abs(e[v]-i[v]);if(P<=a){const V=Math.min(a-1,a-P);h[v]===y?C[v]=(f[v]>e[v]?-1:1)*V:L[v]=(m[v]>i[v]?-1:1)*V}}if(t!==r){const P=v==="x"?"y":"x",V=h[v]===d[P],R=f[P]>m[P],O=f[P]<m[P];(h[v]===1&&(!V&&R||V&&O)||h[v]!==1&&(!V&&O||V&&R))&&(S=v==="x"?B:U)}const X={x:f.x+C.x,y:f.y+C.y},G={x:m.x+L.x,y:m.y+L.y},ne=Math.max(Math.abs(X.x-S[0].x),Math.abs(G.x-S[0].x)),q=Math.max(Math.abs(X.y-S[0].y),Math.abs(G.y-S[0].y));ne>=q?(b=(X.x+G.x)/2,E=S[0].y):(b=S[0].x,E=(X.y+G.y)/2)}return[[e,{x:f.x+C.x,y:f.y+C.y},...S,{x:m.x+L.x,y:m.y+L.y},i],b,E,k,D]}function q3(e,t,i,r){const l=Math.min(Uy(e,t)/2,Uy(t,i)/2,r),{x:a,y:c}=t;if(e.x===a&&a===i.x||e.y===c&&c===i.y)return`L${a} ${c}`;if(e.y===c){const f=e.x<i.x?-1:1,m=e.y<i.y?1:-1;return`L ${a+l*f},${c}Q ${a},${c} ${a},${c+l*m}`}const h=e.x<i.x?1:-1,d=e.y<i.y?-1:1;return`L ${a},${c+l*d}Q ${a},${c} ${a+l*h},${c}`}function jp({sourceX:e,sourceY:t,sourcePosition:i=we.Bottom,targetX:r,targetY:l,targetPosition:a=we.Top,borderRadius:c=5,centerX:h,centerY:d,offset:f=20,stepPosition:m=.5}){const[g,v,y,S,b]=U3({source:{x:e,y:t},sourcePosition:i,target:{x:r,y:l},targetPosition:a,center:{x:h,y:d},offset:f,stepPosition:m});return[g.reduce((C,L,k)=>{let D="";return k>0&&k<g.length-1?D=q3(g[k-1],L,g[k+1],c):D=`${k===0?"M":"L"}${L.x} ${L.y}`,C+=D,C},""),v,y,S,b]}function qy(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function V3(e){var g;const{sourceNode:t,targetNode:i}=e;if(!qy(t)||!qy(i))return null;const r=t.internals.handleBounds||Vy(t.handles),l=i.internals.handleBounds||Vy(i.handles),a=Fy((r==null?void 0:r.source)??[],e.sourceHandle),c=Fy(e.connectionMode===Bl.Strict?(l==null?void 0:l.target)??[]:((l==null?void 0:l.target)??[]).concat((l==null?void 0:l.source)??[]),e.targetHandle);if(!a||!c)return(g=e.onError)==null||g.call(e,"008",kn.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const h=(a==null?void 0:a.position)||we.Bottom,d=(c==null?void 0:c.position)||we.Top,f=Ns(t,a,h),m=Ns(i,c,d);return{sourceX:f.x,sourceY:f.y,targetX:m.x,targetY:m.y,sourcePosition:h,targetPosition:d}}function Vy(e){if(!e)return null;const t=[],i=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&i.push(r);return{source:t,target:i}}function Ns(e,t,i=we.Left,r=!1){const l=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,a=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:c,height:h}=t??sr(e);if(r)return{x:l+c/2,y:a+h/2};switch((t==null?void 0:t.position)??i){case we.Top:return{x:l+c/2,y:a};case we.Right:return{x:l+c,y:a+h/2};case we.Bottom:return{x:l+c/2,y:a+h};case we.Left:return{x:l,y:a+h/2}}}function Fy(e,t){return e&&(t?e.find(i=>i.id===t):e[0])||null}function Pp(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function F3(e,{id:t,defaultColor:i,defaultMarkerStart:r,defaultMarkerEnd:l}){const a=new Set;return e.reduce((c,h)=>([h.markerStart||r,h.markerEnd||l].forEach(d=>{if(d&&typeof d=="object"){const f=Pp(d,t);a.has(f)||(c.push({id:f,color:d.color||i,...d}),a.add(f))}}),c),[]).sort((c,h)=>c.id.localeCompare(h.id))}const ax=1e3,Y3=10,Xg={nodeOrigin:[0,0],nodeExtent:pa,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},W3={...Xg,checkEquality:!0};function Kg(e,t){const i={...e};for(const r in t)t[r]!==void 0&&(i[r]=t[r]);return i}function $3(e,t,i){const r=Kg(Xg,i);for(const l of e.values())if(l.parentId)Zg(l,e,t,r);else{const a=Ta(l,r.nodeOrigin),c=Ol(l.extent)?l.extent:r.nodeExtent,h=Ts(a,c,sr(l));l.internals.positionAbsolute=h}}function X3(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const i=[],r=[];for(const l of e.handles){const a={id:l.id,width:l.width??1,height:l.height??1,nodeId:e.id,x:l.x,y:l.y,position:l.position,type:l.type};l.type==="source"?i.push(a):l.type==="target"&&r.push(a)}return{source:i,target:r}}function Gg(e){return e==="manual"}function Ip(e,t,i,r={}){var f,m;const l=Kg(W3,r),a={i:0},c=new Map(t),h=l!=null&&l.elevateNodesOnSelect&&!Gg(l.zIndexMode)?ax:0;let d=e.length>0;t.clear(),i.clear();for(const g of e){let v=c.get(g.id);if(l.checkEquality&&g===(v==null?void 0:v.internals.userNode))t.set(g.id,v);else{const y=Ta(g,l.nodeOrigin),S=Ol(g.extent)?g.extent:l.nodeExtent,b=Ts(y,S,sr(g));v={...l.defaults,...g,measured:{width:(f=g.measured)==null?void 0:f.width,height:(m=g.measured)==null?void 0:m.height},internals:{positionAbsolute:b,handleBounds:X3(g,v),z:cx(g,h,l.zIndexMode),userNode:g}},t.set(g.id,v)}(v.measured===void 0||v.measured.width===void 0||v.measured.height===void 0)&&!v.hidden&&(d=!1),g.parentId&&Zg(v,t,i,r,a)}return d}function K3(e,t){if(!e.parentId)return;const i=t.get(e.parentId);i?i.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Zg(e,t,i,r,l){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:h,zIndexMode:d}=Kg(Xg,r),f=e.parentId,m=t.get(f);if(!m){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}K3(e,i),l&&!m.parentId&&m.internals.rootParentIndex===void 0&&d==="auto"&&(m.internals.rootParentIndex=++l.i,m.internals.z=m.internals.z+l.i*Y3),l&&m.internals.rootParentIndex!==void 0&&(l.i=m.internals.rootParentIndex);const g=a&&!Gg(d)?ax:0,{x:v,y,z:S}=G3(e,m,c,h,g,d),{positionAbsolute:b}=e.internals,E=v!==b.x||y!==b.y;(E||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:v,y}:b,z:S}})}function cx(e,t,i){const r=an(e.zIndex)?e.zIndex:0;return Gg(i)?r:r+(e.selected?t:0)}function G3(e,t,i,r,l,a){const{x:c,y:h}=t.internals.positionAbsolute,d=sr(e),f=Ta(e,i),m=Ol(e.extent)?Ts(f,e.extent,d):f;let g=Ts({x:c+m.x,y:h+m.y},r,d);e.extent==="parent"&&(g=Zb(g,d,t));const v=cx(e,l,a),y=t.internals.z??0;return{x:g.x,y:g.y,z:y>=v?y+1:v}}function Qg(e,t,i,r=[0,0]){var c;const l=[],a=new Map;for(const h of e){const d=t.get(h.parentId);if(!d)continue;const f=((c=a.get(h.parentId))==null?void 0:c.expandedRect)??zl(d),m=Jb(f,h.rect);a.set(h.parentId,{expandedRect:m,parent:d})}return a.size>0&&a.forEach(({expandedRect:h,parent:d},f)=>{var k;const m=d.internals.positionAbsolute,g=sr(d),v=d.origin??r,y=h.x<m.x?Math.round(Math.abs(m.x-h.x)):0,S=h.y<m.y?Math.round(Math.abs(m.y-h.y)):0,b=Math.max(g.width,Math.round(h.width)),E=Math.max(g.height,Math.round(h.height)),C=(b-g.width)*v[0],L=(E-g.height)*v[1];(y>0||S>0||C||L)&&(l.push({id:f,type:"position",position:{x:d.position.x-y+C,y:d.position.y-S+L}}),(k=i.get(f))==null||k.forEach(D=>{e.some(I=>I.id===D.id)||l.push({id:D.id,type:"position",position:{x:D.position.x+y,y:D.position.y+S}})})),(g.width<h.width||g.height<h.height||y||S)&&l.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:b+(y?v[0]*y-C:0),height:E+(S?v[1]*S-L:0)}})}),l}function Z3(e,t,i,r,l,a,c){const h=r==null?void 0:r.querySelector(".xyflow__viewport");let d=!1;if(!h)return{changes:[],updatedInternals:d};const f=[],m=window.getComputedStyle(h),{m22:g}=new window.DOMMatrixReadOnly(m.transform),v=[];for(const y of e.values()){const S=t.get(y.id);if(!S)continue;if(S.hidden){t.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),d=!0;continue}const b=Wg(y.nodeElement),E=S.measured.width!==b.width||S.measured.height!==b.height;if(!!(b.width&&b.height&&(E||!S.internals.handleBounds||y.force))){const L=y.nodeElement.getBoundingClientRect(),k=Ol(S.extent)?S.extent:a;let{positionAbsolute:D}=S.internals;S.parentId&&S.extent==="parent"?D=Zb(D,b,t.get(S.parentId)):k&&(D=Ts(D,k,b));const I={...S,measured:b,internals:{...S.internals,positionAbsolute:D,handleBounds:{source:jy("source",y.nodeElement,L,g,S.id),target:jy("target",y.nodeElement,L,g,S.id)}}};t.set(S.id,I),S.parentId&&Zg(I,t,i,{nodeOrigin:l,zIndexMode:c}),d=!0,E&&(f.push({id:S.id,type:"dimensions",dimensions:b}),S.expandParent&&S.parentId&&v.push({id:S.id,parentId:S.parentId,rect:zl(I,l)}))}}if(v.length>0){const y=Qg(v,t,i,l);f.push(...y)}return{changes:f,updatedInternals:d}}async function Q3({delta:e,panZoom:t,transform:i,translateExtent:r,width:l,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const c=await t.setViewportConstrained({x:i[0]+e.x,y:i[1]+e.y,zoom:i[2]},[[0,0],[l,a]],r),h=!!c&&(c.x!==i[0]||c.y!==i[1]||c.k!==i[2]);return Promise.resolve(h)}function Yy(e,t,i,r,l,a){let c=l;const h=r.get(c)||new Map;r.set(c,h.set(i,t)),c=`${l}-${e}`;const d=r.get(c)||new Map;if(r.set(c,d.set(i,t)),a){c=`${l}-${e}-${a}`;const f=r.get(c)||new Map;r.set(c,f.set(i,t))}}function ux(e,t,i){e.clear(),t.clear();for(const r of i){const{source:l,target:a,sourceHandle:c=null,targetHandle:h=null}=r,d={edgeId:r.id,source:l,target:a,sourceHandle:c,targetHandle:h},f=`${l}-${c}--${a}-${h}`,m=`${a}-${h}--${l}-${c}`;Yy("source",d,m,e,l,c),Yy("target",d,f,e,a,h),t.set(r.id,r)}}function hx(e,t){if(!e.parentId)return!1;const i=t.get(e.parentId);return i?i.selected?!0:hx(i,t):!1}function Wy(e,t,i){var l;let r=e;do{if((l=r==null?void 0:r.matches)!=null&&l.call(r,t))return!0;if(r===i)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function J3(e,t,i,r){const l=new Map;for(const[a,c]of e)if((c.selected||c.id===r)&&(!c.parentId||!hx(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const h=e.get(a);h&&l.set(a,{id:a,position:h.position||{x:0,y:0},distance:{x:i.x-h.internals.positionAbsolute.x,y:i.y-h.internals.positionAbsolute.y},extent:h.extent,parentId:h.parentId,origin:h.origin,expandParent:h.expandParent,internals:{positionAbsolute:h.internals.positionAbsolute||{x:0,y:0}},measured:{width:h.measured.width??0,height:h.measured.height??0}})}return l}function Xd({nodeId:e,dragItems:t,nodeLookup:i,dragging:r=!0}){var c,h,d;const l=[];for(const[f,m]of t){const g=(c=i.get(f))==null?void 0:c.internals.userNode;g&&l.push({...g,position:m.position,dragging:r})}if(!e)return[l[0],l];const a=(h=i.get(e))==null?void 0:h.internals.userNode;return[a?{...a,position:((d=t.get(e))==null?void 0:d.position)||a.position,dragging:r}:l[0],l]}function eT({dragItems:e,snapGrid:t,x:i,y:r}){const l=e.values().next().value;if(!l)return null;const a={x:i-l.distance.x,y:r-l.distance.y},c=Aa(a,t);return{x:c.x-a.x,y:c.y-a.y}}function tT({onNodeMouseDown:e,getStoreItems:t,onDragStart:i,onDrag:r,onDragStop:l}){let a={x:null,y:null},c=0,h=new Map,d=!1,f={x:0,y:0},m=null,g=!1,v=null,y=!1,S=!1,b=null;function E({noDragClassName:L,handleSelector:k,domNode:D,isSelectable:I,nodeId:B,nodeClickDistance:U=0}){v=Oi(D);function X({x:P,y:V}){const{nodeLookup:R,nodeExtent:O,snapGrid:M,snapToGrid:j,nodeOrigin:H,onNodeDrag:F,onSelectionDrag:T,onError:z,updateNodePositions:W}=t();a={x:P,y:V};let N=!1;const ee=h.size>1,ce=ee&&O?Hp(Na(h)):null,oe=ee&&j?eT({dragItems:h,snapGrid:M,x:P,y:V}):null;for(const[fe,he]of h){if(!R.has(fe))continue;let pe={x:P-he.distance.x,y:V-he.distance.y};j&&(pe=oe?{x:Math.round(pe.x+oe.x),y:Math.round(pe.y+oe.y)}:Aa(pe,M));let Ce=null;if(ee&&O&&!he.extent&&ce){const{positionAbsolute:me}=he.internals,Ae=me.x-ce.x+O[0][0],We=me.x+he.measured.width-ce.x2+O[1][0],ze=me.y-ce.y+O[0][1],St=me.y+he.measured.height-ce.y2+O[1][1];Ce=[[Ae,ze],[We,St]]}const{position:xe,positionAbsolute:Se}=Gb({nodeId:fe,nextPosition:pe,nodeLookup:R,nodeExtent:Ce||O,nodeOrigin:H,onError:z});N=N||he.position.x!==xe.x||he.position.y!==xe.y,he.position=xe,he.internals.positionAbsolute=Se}if(S=S||N,!!N&&(W(h,!0),b&&(r||F||!B&&T))){const[fe,he]=Xd({nodeId:B,dragItems:h,nodeLookup:R});r==null||r(b,h,fe,he),F==null||F(b,fe,he),B||T==null||T(b,he)}}async function G(){if(!m)return;const{transform:P,panBy:V,autoPanSpeed:R,autoPanOnNodeDrag:O}=t();if(!O){d=!1,cancelAnimationFrame(c);return}const[M,j]=Qb(f,m,R);(M!==0||j!==0)&&(a.x=(a.x??0)-M/P[2],a.y=(a.y??0)-j/P[2],await V({x:M,y:j})&&X(a)),c=requestAnimationFrame(G)}function ne(P){var ee;const{nodeLookup:V,multiSelectionActive:R,nodesDraggable:O,transform:M,snapGrid:j,snapToGrid:H,selectNodesOnDrag:F,onNodeDragStart:T,onSelectionDragStart:z,unselectNodesAndEdges:W}=t();g=!0,(!F||!I)&&!R&&B&&((ee=V.get(B))!=null&&ee.selected||W()),I&&F&&B&&(e==null||e(B));const N=sa(P.sourceEvent,{transform:M,snapGrid:j,snapToGrid:H,containerBounds:m});if(a=N,h=J3(V,O,N,B),h.size>0&&(i||T||!B&&z)){const[ce,oe]=Xd({nodeId:B,dragItems:h,nodeLookup:V});i==null||i(P.sourceEvent,h,ce,oe),T==null||T(P.sourceEvent,ce,oe),B||z==null||z(P.sourceEvent,oe)}}const q=Nb().clickDistance(U).on("start",P=>{const{domNode:V,nodeDragThreshold:R,transform:O,snapGrid:M,snapToGrid:j}=t();m=(V==null?void 0:V.getBoundingClientRect())||null,y=!1,S=!1,b=P.sourceEvent,R===0&&ne(P),a=sa(P.sourceEvent,{transform:O,snapGrid:M,snapToGrid:j,containerBounds:m}),f=cn(P.sourceEvent,m)}).on("drag",P=>{const{autoPanOnNodeDrag:V,transform:R,snapGrid:O,snapToGrid:M,nodeDragThreshold:j,nodeLookup:H}=t(),F=sa(P.sourceEvent,{transform:R,snapGrid:O,snapToGrid:M,containerBounds:m});if(b=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||B&&!H.has(B))&&(y=!0),!y){if(!d&&V&&g&&(d=!0,G()),!g){const T=cn(P.sourceEvent,m),z=T.x-f.x,W=T.y-f.y;Math.sqrt(z*z+W*W)>j&&ne(P)}(a.x!==F.xSnapped||a.y!==F.ySnapped)&&h&&g&&(f=cn(P.sourceEvent,m),X(F))}}).on("end",P=>{if(!(!g||y)&&(d=!1,g=!1,cancelAnimationFrame(c),h.size>0)){const{nodeLookup:V,updateNodePositions:R,onNodeDragStop:O,onSelectionDragStop:M}=t();if(S&&(R(h,!1),S=!1),l||O||!B&&M){const[j,H]=Xd({nodeId:B,dragItems:h,nodeLookup:V,dragging:!1});l==null||l(P.sourceEvent,h,j,H),O==null||O(P.sourceEvent,j,H),B||M==null||M(P.sourceEvent,H)}}}).filter(P=>{const V=P.target;return!P.button&&(!L||!Wy(V,`.${L}`,D))&&(!k||Wy(V,k,D))});v.call(q)}function C(){v==null||v.on(".drag",null)}return{update:E,destroy:C}}function iT(e,t,i){const r=[],l={x:e.x-i,y:e.y-i,width:i*2,height:i*2};for(const a of t.values())_a(l,zl(a))>0&&r.push(a);return r}const nT=250;function rT(e,t,i,r){var h,d;let l=[],a=1/0;const c=iT(e,i,t+nT);for(const f of c){const m=[...((h=f.internals.handleBounds)==null?void 0:h.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const g of m){if(r.nodeId===g.nodeId&&r.type===g.type&&r.id===g.id)continue;const{x:v,y}=Ns(f,g,g.position,!0),S=Math.sqrt(Math.pow(v-e.x,2)+Math.pow(y-e.y,2));S>t||(S<a?(l=[{...g,x:v,y}],a=S):S===a&&l.push({...g,x:v,y}))}}if(!l.length)return null;if(l.length>1){const f=r.type==="source"?"target":"source";return l.find(m=>m.type===f)??l[0]}return l[0]}function fx(e,t,i,r,l,a=!1){var f,m,g;const c=r.get(e);if(!c)return null;const h=l==="strict"?(f=c.internals.handleBounds)==null?void 0:f[t]:[...((m=c.internals.handleBounds)==null?void 0:m.source)??[],...((g=c.internals.handleBounds)==null?void 0:g.target)??[]],d=(i?h==null?void 0:h.find(v=>v.id===i):h==null?void 0:h[0])??null;return d&&a?{...d,...Ns(c,d,d.position,!0)}:d}function dx(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function sT(e,t){let i=null;return t?i=!0:e&&!t&&(i=!1),i}const px=()=>!0;function lT(e,{connectionMode:t,connectionRadius:i,handleId:r,nodeId:l,edgeUpdaterType:a,isTarget:c,domNode:h,nodeLookup:d,lib:f,autoPanOnConnect:m,flowId:g,panBy:v,cancelConnection:y,onConnectStart:S,onConnect:b,onConnectEnd:E,isValidConnection:C=px,onReconnectEnd:L,updateConnection:k,getTransform:D,getFromHandle:I,autoPanSpeed:B,dragThreshold:U=1,handleDomNode:X}){const G=ix(e.target);let ne=0,q;const{x:P,y:V}=cn(e),R=dx(a,X),O=h==null?void 0:h.getBoundingClientRect();let M=!1;if(!O||!R)return;const j=fx(l,R,r,d,t);if(!j)return;let H=cn(e,O),F=!1,T=null,z=!1,W=null;function N(){if(!m||!O)return;const[xe,Se]=Qb(H,O,B);v({x:xe,y:Se}),ne=requestAnimationFrame(N)}const ee={...j,nodeId:l,type:R,position:j.position},ce=d.get(l);let fe={inProgress:!0,isValid:null,from:Ns(ce,ee,we.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:ce,to:H,toHandle:null,toPosition:Ly[ee.position],toNode:null,pointer:H};function he(){M=!0,k(fe),S==null||S(e,{nodeId:l,handleId:r,handleType:R})}U===0&&he();function pe(xe){if(!M){const{x:St,y:Ci}=cn(xe),Jt=St-P,ui=Ci-V;if(!(Jt*Jt+ui*ui>U*U))return;he()}if(!I()||!ee){Ce(xe);return}const Se=D();H=cn(xe,O),q=rT(Da(H,Se,!1,[1,1]),i,d,ee),F||(N(),F=!0);const me=gx(xe,{handle:q,connectionMode:t,fromNodeId:l,fromHandleId:r,fromType:c?"target":"source",isValidConnection:C,doc:G,lib:f,flowId:g,nodeLookup:d});W=me.handleDomNode,T=me.connection,z=sT(!!q,me.isValid);const Ae=d.get(l),We=Ae?Ns(Ae,ee,we.Left,!0):fe.from,ze={...fe,from:We,isValid:z,to:me.toHandle&&z?Wu({x:me.toHandle.x,y:me.toHandle.y},Se):H,toHandle:me.toHandle,toPosition:z&&me.toHandle?me.toHandle.position:Ly[ee.position],toNode:me.toHandle?d.get(me.toHandle.nodeId):null,pointer:H};k(ze),fe=ze}function Ce(xe){if(!("touches"in xe&&xe.touches.length>0)){if(M){(q||W)&&T&&z&&(b==null||b(T));const{inProgress:Se,...me}=fe,Ae={...me,toPosition:fe.toHandle?fe.toPosition:null};E==null||E(xe,Ae),a&&(L==null||L(xe,Ae))}y(),cancelAnimationFrame(ne),F=!1,z=!1,T=null,W=null,G.removeEventListener("mousemove",pe),G.removeEventListener("mouseup",Ce),G.removeEventListener("touchmove",pe),G.removeEventListener("touchend",Ce)}}G.addEventListener("mousemove",pe),G.addEventListener("mouseup",Ce),G.addEventListener("touchmove",pe),G.addEventListener("touchend",Ce)}function gx(e,{handle:t,connectionMode:i,fromNodeId:r,fromHandleId:l,fromType:a,doc:c,lib:h,flowId:d,isValidConnection:f=px,nodeLookup:m}){const g=a==="target",v=t?c.querySelector(`.${h}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:S}=cn(e),b=c.elementFromPoint(y,S),E=b!=null&&b.classList.contains(`${h}-flow__handle`)?b:v,C={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const L=dx(void 0,E),k=E.getAttribute("data-nodeid"),D=E.getAttribute("data-handleid"),I=E.classList.contains("connectable"),B=E.classList.contains("connectableend");if(!k||!L)return C;const U={source:g?k:r,sourceHandle:g?D:l,target:g?r:k,targetHandle:g?l:D};C.connection=U;const G=I&&B&&(i===Bl.Strict?g&&L==="source"||!g&&L==="target":k!==r||D!==l);C.isValid=G&&f(U),C.toHandle=fx(k,L,D,m,i,!0)}return C}const Up={onPointerDown:lT,isValid:gx};function oT({domNode:e,panZoom:t,getTransform:i,getViewScale:r}){const l=Oi(e);function a({translateExtent:h,width:d,height:f,zoomStep:m=1,pannable:g=!0,zoomable:v=!0,inversePan:y=!1}){const S=k=>{if(k.sourceEvent.type!=="wheel"||!t)return;const D=i(),I=k.sourceEvent.ctrlKey&&va()?10:1,B=-k.sourceEvent.deltaY*(k.sourceEvent.deltaMode===1?.05:k.sourceEvent.deltaMode?1:.002)*m,U=D[2]*Math.pow(2,B*I);t.scaleTo(U)};let b=[0,0];const E=k=>{(k.sourceEvent.type==="mousedown"||k.sourceEvent.type==="touchstart")&&(b=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY])},C=k=>{const D=i();if(k.sourceEvent.type!=="mousemove"&&k.sourceEvent.type!=="touchmove"||!t)return;const I=[k.sourceEvent.clientX??k.sourceEvent.touches[0].clientX,k.sourceEvent.clientY??k.sourceEvent.touches[0].clientY],B=[I[0]-b[0],I[1]-b[1]];b=I;const U=r()*Math.max(D[2],Math.log(D[2]))*(y?-1:1),X={x:D[0]-B[0]*U,y:D[1]-B[1]*U},G=[[0,0],[d,f]];t.setViewportConstrained({x:X.x,y:X.y,zoom:D[2]},G,h)},L=Fb().on("start",E).on("zoom",g?C:null).on("zoom.wheel",v?S:null);l.call(L,{})}function c(){l.on("zoom",null)}return{update:a,destroy:c,pointer:ln}}const fh=e=>({x:e.x,y:e.y,zoom:e.k}),Kd=({x:e,y:t,zoom:i})=>ch.translate(e,t).scale(i),Cl=(e,t)=>e.target.closest(`.${t}`),mx=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),aT=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Gd=(e,t=0,i=aT,r=()=>{})=>{const l=typeof t=="number"&&t>0;return l||r(),l?e.transition().duration(t).ease(i).on("end",r):e},_x=e=>{const t=e.ctrlKey&&va()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cT({zoomPanValues:e,noWheelClassName:t,d3Selection:i,d3Zoom:r,panOnScrollMode:l,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:h,onPanZoom:d,onPanZoomEnd:f}){return m=>{if(Cl(m,t))return m.ctrlKey&&m.preventDefault(),!1;m.preventDefault(),m.stopImmediatePropagation();const g=i.property("__zoom").k||1;if(m.ctrlKey&&c){const E=ln(m),C=_x(m),L=g*Math.pow(2,C);r.scaleTo(i,L,E,m);return}const v=m.deltaMode===1?20:1;let y=l===Cs.Vertical?0:m.deltaX*v,S=l===Cs.Horizontal?0:m.deltaY*v;!va()&&m.shiftKey&&l!==Cs.Vertical&&(y=m.deltaY*v,S=0),r.translateBy(i,-(y/g)*a,-(S/g)*a,{internal:!0});const b=fh(i.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(m,b),e.panScrollTimeout=setTimeout(()=>{f==null||f(m,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,h==null||h(m,b))}}function uT({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:i}){return function(r,l){const a=r.type==="wheel",c=!t&&a&&!r.ctrlKey,h=Cl(r,e);if(r.ctrlKey&&a&&h&&r.preventDefault(),c||h)return null;r.preventDefault(),i.call(this,r,l)}}function hT({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:i}){return r=>{var a,c,h;if((a=r.sourceEvent)!=null&&a.internal)return;const l=fh(r.transform);e.mouseButton=((c=r.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=l,((h=r.sourceEvent)==null?void 0:h.type)==="mousedown"&&t(!0),i&&(i==null||i(r.sourceEvent,l))}}function fT({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:i,onTransformChange:r,onPanZoom:l}){return a=>{var c,h;e.usedRightMouseButton=!!(i&&mx(t,e.mouseButton??0)),(c=a.sourceEvent)!=null&&c.sync||r([a.transform.x,a.transform.y,a.transform.k]),l&&!((h=a.sourceEvent)!=null&&h.internal)&&(l==null||l(a.sourceEvent,fh(a.transform)))}}function dT({zoomPanValues:e,panOnDrag:t,panOnScroll:i,onDraggingChange:r,onPanZoomEnd:l,onPaneContextMenu:a}){return c=>{var h;if(!((h=c.sourceEvent)!=null&&h.internal)&&(e.isZoomingOrPanning=!1,a&&mx(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),e.usedRightMouseButton=!1,r(!1),l)){const d=fh(c.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{l==null||l(c.sourceEvent,d)},i?150:0)}}}function pT({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:i,panOnDrag:r,panOnScroll:l,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:h,noPanClassName:d,lib:f,connectionInProgress:m}){return g=>{var E;const v=e||t,y=i&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Cl(g,`${f}-flow__node`)||Cl(g,`${f}-flow__edge`)))return!0;if(!r&&!v&&!l&&!a&&!i||c||m&&!S||Cl(g,h)&&S||Cl(g,d)&&(!S||l&&S&&!e)||!i&&g.ctrlKey&&S)return!1;if(!i&&g.type==="touchstart"&&((E=g.touches)==null?void 0:E.length)>1)return g.preventDefault(),!1;if(!v&&!l&&!y&&S||!r&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(r)&&!r.includes(g.button)&&g.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S)&&b}}function gT({domNode:e,minZoom:t,maxZoom:i,translateExtent:r,viewport:l,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:h,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},m=e.getBoundingClientRect(),g=Fb().scaleExtent([t,i]).translateExtent(r),v=Oi(e).call(g);L({x:l.x,y:l.y,zoom:Ll(l.zoom,t,i)},[[0,0],[m.width,m.height]],r);const y=v.on("wheel.zoom"),S=v.on("dblclick.zoom");g.wheelDelta(_x);function b(q,P){return v?new Promise(V=>{g==null||g.interpolate((P==null?void 0:P.interpolate)==="linear"?ra:ku).transform(Gd(v,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),q)}):Promise.resolve(!1)}function E({noWheelClassName:q,noPanClassName:P,onPaneContextMenu:V,userSelectionActive:R,panOnScroll:O,panOnDrag:M,panOnScrollMode:j,panOnScrollSpeed:H,preventScrolling:F,zoomOnPinch:T,zoomOnScroll:z,zoomOnDoubleClick:W,zoomActivationKeyPressed:N,lib:ee,onTransformChange:ce,connectionInProgress:oe,paneClickDistance:fe,selectionOnDrag:he}){R&&!f.isZoomingOrPanning&&C();const pe=O&&!N&&!R;g.clickDistance(he?1/0:!an(fe)||fe<0?0:fe);const Ce=pe?cT({zoomPanValues:f,noWheelClassName:q,d3Selection:v,d3Zoom:g,panOnScrollMode:j,panOnScrollSpeed:H,zoomOnPinch:T,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:h}):uT({noWheelClassName:q,preventScrolling:F,d3ZoomHandler:y});if(v.on("wheel.zoom",Ce,{passive:!1}),!R){const Se=hT({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:c});g.on("start",Se);const me=fT({zoomPanValues:f,panOnDrag:M,onPaneContextMenu:!!V,onPanZoom:a,onTransformChange:ce});g.on("zoom",me);const Ae=dT({zoomPanValues:f,panOnDrag:M,panOnScroll:O,onPaneContextMenu:V,onPanZoomEnd:h,onDraggingChange:d});g.on("end",Ae)}const xe=pT({zoomActivationKeyPressed:N,panOnDrag:M,zoomOnScroll:z,panOnScroll:O,zoomOnDoubleClick:W,zoomOnPinch:T,userSelectionActive:R,noPanClassName:P,noWheelClassName:q,lib:ee,connectionInProgress:oe});g.filter(xe),W?v.on("dblclick.zoom",S):v.on("dblclick.zoom",null)}function C(){g.on("zoom",null)}async function L(q,P,V){const R=Kd(q),O=g==null?void 0:g.constrain()(R,P,V);return O&&await b(O),new Promise(M=>M(O))}async function k(q,P){const V=Kd(q);return await b(V,P),new Promise(R=>R(V))}function D(q){if(v){const P=Kd(q),V=v.property("__zoom");(V.k!==q.zoom||V.x!==q.x||V.y!==q.y)&&(g==null||g.transform(v,P,null,{sync:!0}))}}function I(){const q=v?Vb(v.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function B(q,P){return v?new Promise(V=>{g==null||g.interpolate((P==null?void 0:P.interpolate)==="linear"?ra:ku).scaleTo(Gd(v,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),q)}):Promise.resolve(!1)}function U(q,P){return v?new Promise(V=>{g==null||g.interpolate((P==null?void 0:P.interpolate)==="linear"?ra:ku).scaleBy(Gd(v,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),q)}):Promise.resolve(!1)}function X(q){g==null||g.scaleExtent(q)}function G(q){g==null||g.translateExtent(q)}function ne(q){const P=!an(q)||q<0?0:q;g==null||g.clickDistance(P)}return{update:E,destroy:C,setViewport:k,setViewportConstrained:L,getViewport:I,scaleTo:B,scaleBy:U,setScaleExtent:X,setTranslateExtent:G,syncViewport:D,setClickDistance:ne}}var Hl;(function(e){e.Line="line",e.Handle="handle"})(Hl||(Hl={}));function mT({width:e,prevWidth:t,height:i,prevHeight:r,affectsX:l,affectsY:a}){const c=e-t,h=i-r,d=[c>0?1:c<0?-1:0,h>0?1:h<0?-1:0];return c&&l&&(d[0]=d[0]*-1),h&&a&&(d[1]=d[1]*-1),d}function $y(e){const t=e.includes("right")||e.includes("left"),i=e.includes("bottom")||e.includes("top"),r=e.includes("left"),l=e.includes("top");return{isHorizontal:t,isVertical:i,affectsX:r,affectsY:l}}function jr(e,t){return Math.max(0,t-e)}function Pr(e,t){return Math.max(0,e-t)}function du(e,t,i){return Math.max(0,t-e,e-i)}function Xy(e,t){return e?!t:t}function _T(e,t,i,r,l,a,c,h){let{affectsX:d,affectsY:f}=t;const{isHorizontal:m,isVertical:g}=t,v=m&&g,{xSnapped:y,ySnapped:S}=i,{minWidth:b,maxWidth:E,minHeight:C,maxHeight:L}=r,{x:k,y:D,width:I,height:B,aspectRatio:U}=e;let X=Math.floor(m?y-e.pointerX:0),G=Math.floor(g?S-e.pointerY:0);const ne=I+(d?-X:X),q=B+(f?-G:G),P=-a[0]*I,V=-a[1]*B;let R=du(ne,b,E),O=du(q,C,L);if(c){let H=0,F=0;d&&X<0?H=jr(k+X+P,c[0][0]):!d&&X>0&&(H=Pr(k+ne+P,c[1][0])),f&&G<0?F=jr(D+G+V,c[0][1]):!f&&G>0&&(F=Pr(D+q+V,c[1][1])),R=Math.max(R,H),O=Math.max(O,F)}if(h){let H=0,F=0;d&&X>0?H=Pr(k+X,h[0][0]):!d&&X<0&&(H=jr(k+ne,h[1][0])),f&&G>0?F=Pr(D+G,h[0][1]):!f&&G<0&&(F=jr(D+q,h[1][1])),R=Math.max(R,H),O=Math.max(O,F)}if(l){if(m){const H=du(ne/U,C,L)*U;if(R=Math.max(R,H),c){let F=0;!d&&!f||d&&!f&&v?F=Pr(D+V+ne/U,c[1][1])*U:F=jr(D+V+(d?X:-X)/U,c[0][1])*U,R=Math.max(R,F)}if(h){let F=0;!d&&!f||d&&!f&&v?F=jr(D+ne/U,h[1][1])*U:F=Pr(D+(d?X:-X)/U,h[0][1])*U,R=Math.max(R,F)}}if(g){const H=du(q*U,b,E)/U;if(O=Math.max(O,H),c){let F=0;!d&&!f||f&&!d&&v?F=Pr(k+q*U+P,c[1][0])/U:F=jr(k+(f?G:-G)*U+P,c[0][0])/U,O=Math.max(O,F)}if(h){let F=0;!d&&!f||f&&!d&&v?F=jr(k+q*U,h[1][0])/U:F=Pr(k+(f?G:-G)*U,h[0][0])/U,O=Math.max(O,F)}}}G=G+(G<0?O:-O),X=X+(X<0?R:-R),l&&(v?ne>q*U?G=(Xy(d,f)?-X:X)/U:X=(Xy(d,f)?-G:G)*U:m?(G=X/U,f=d):(X=G*U,d=f));const M=d?k+X:k,j=f?D+G:D;return{width:I+(d?-X:X),height:B+(f?-G:G),x:a[0]*X*(d?-1:1)+M,y:a[1]*G*(f?-1:1)+j}}const vx={width:0,height:0,x:0,y:0},vT={...vx,pointerX:0,pointerY:0,aspectRatio:1};function yT(e){return[[0,0],[e.measured.width,e.measured.height]]}function ST(e,t,i){const r=t.position.x+e.position.x,l=t.position.y+e.position.y,a=e.measured.width??0,c=e.measured.height??0,h=i[0]*a,d=i[1]*c;return[[r-h,l-d],[r+a-h,l+c-d]]}function bT({domNode:e,nodeId:t,getStoreItems:i,onChange:r,onEnd:l}){const a=Oi(e);let c={controlDirection:$y("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function h({controlPosition:f,boundaries:m,keepAspectRatio:g,resizeDirection:v,onResizeStart:y,onResize:S,onResizeEnd:b,shouldResize:E}){let C={...vx},L={...vT};c={boundaries:m,resizeDirection:v,keepAspectRatio:g,controlDirection:$y(f)};let k,D=null,I=[],B,U,X,G=!1;const ne=Nb().on("start",q=>{const{nodeLookup:P,transform:V,snapGrid:R,snapToGrid:O,nodeOrigin:M,paneDomNode:j}=i();if(k=P.get(t),!k)return;D=(j==null?void 0:j.getBoundingClientRect())??null;const{xSnapped:H,ySnapped:F}=sa(q.sourceEvent,{transform:V,snapGrid:R,snapToGrid:O,containerBounds:D});C={width:k.measured.width??0,height:k.measured.height??0,x:k.position.x??0,y:k.position.y??0},L={...C,pointerX:H,pointerY:F,aspectRatio:C.width/C.height},B=void 0,k.parentId&&(k.extent==="parent"||k.expandParent)&&(B=P.get(k.parentId),U=B&&k.extent==="parent"?yT(B):void 0),I=[],X=void 0;for(const[T,z]of P)if(z.parentId===t&&(I.push({id:T,position:{...z.position},extent:z.extent}),z.extent==="parent"||z.expandParent)){const W=ST(z,k,z.origin??M);X?X=[[Math.min(W[0][0],X[0][0]),Math.min(W[0][1],X[0][1])],[Math.max(W[1][0],X[1][0]),Math.max(W[1][1],X[1][1])]]:X=W}y==null||y(q,{...C})}).on("drag",q=>{const{transform:P,snapGrid:V,snapToGrid:R,nodeOrigin:O}=i(),M=sa(q.sourceEvent,{transform:P,snapGrid:V,snapToGrid:R,containerBounds:D}),j=[];if(!k)return;const{x:H,y:F,width:T,height:z}=C,W={},N=k.origin??O,{width:ee,height:ce,x:oe,y:fe}=_T(L,c.controlDirection,M,c.boundaries,c.keepAspectRatio,N,U,X),he=ee!==T,pe=ce!==z,Ce=oe!==H&&he,xe=fe!==F&&pe;if(!Ce&&!xe&&!he&&!pe)return;if((Ce||xe||N[0]===1||N[1]===1)&&(W.x=Ce?oe:C.x,W.y=xe?fe:C.y,C.x=W.x,C.y=W.y,I.length>0)){const We=oe-H,ze=fe-F;for(const St of I)St.position={x:St.position.x-We+N[0]*(ee-T),y:St.position.y-ze+N[1]*(ce-z)},j.push(St)}if((he||pe)&&(W.width=he&&(!c.resizeDirection||c.resizeDirection==="horizontal")?ee:C.width,W.height=pe&&(!c.resizeDirection||c.resizeDirection==="vertical")?ce:C.height,C.width=W.width,C.height=W.height),B&&k.expandParent){const We=N[0]*(W.width??0);W.x&&W.x<We&&(C.x=We,L.x=L.x-(W.x-We));const ze=N[1]*(W.height??0);W.y&&W.y<ze&&(C.y=ze,L.y=L.y-(W.y-ze))}const Se=mT({width:C.width,prevWidth:T,height:C.height,prevHeight:z,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),me={...C,direction:Se};(E==null?void 0:E(q,me))!==!1&&(G=!0,S==null||S(q,me),r(W,j))}).on("end",q=>{G&&(b==null||b(q,{...C}),l==null||l({...C}),G=!1)});a.call(ne)}function d(){a.on(".drag",null)}return{update:h,destroy:d}}var Zd={exports:{}},Qd={},Jd={exports:{}},ep={};/**
50
+ * @license React
51
+ * use-sync-external-store-shim.production.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */var Ky;function xT(){if(Ky)return ep;Ky=1;var e=Ea();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var i=typeof Object.is=="function"?Object.is:t,r=e.useState,l=e.useEffect,a=e.useLayoutEffect,c=e.useDebugValue;function h(g,v){var y=v(),S=r({inst:{value:y,getSnapshot:v}}),b=S[0].inst,E=S[1];return a(function(){b.value=y,b.getSnapshot=v,d(b)&&E({inst:b})},[g,y,v]),l(function(){return d(b)&&E({inst:b}),g(function(){d(b)&&E({inst:b})})},[g]),c(y),y}function d(g){var v=g.getSnapshot;g=g.value;try{var y=v();return!i(g,y)}catch{return!0}}function f(g,v){return v()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:h;return ep.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,ep}var Gy;function wT(){return Gy||(Gy=1,Jd.exports=xT()),Jd.exports}/**
58
+ * @license React
59
+ * use-sync-external-store-shim/with-selector.production.js
60
+ *
61
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */var Zy;function CT(){if(Zy)return Qd;Zy=1;var e=Ea(),t=wT();function i(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var r=typeof Object.is=="function"?Object.is:i,l=t.useSyncExternalStore,a=e.useRef,c=e.useEffect,h=e.useMemo,d=e.useDebugValue;return Qd.useSyncExternalStoreWithSelector=function(f,m,g,v,y){var S=a(null);if(S.current===null){var b={hasValue:!1,value:null};S.current=b}else b=S.current;S=h(function(){function C(B){if(!L){if(L=!0,k=B,B=v(B),y!==void 0&&b.hasValue){var U=b.value;if(y(U,B))return D=U}return D=B}if(U=D,r(k,B))return U;var X=v(B);return y!==void 0&&y(U,X)?(k=B,U):(k=B,D=X)}var L=!1,k,D,I=g===void 0?null:g;return[function(){return C(m())},I===null?void 0:function(){return C(I())}]},[m,g,v,y]);var E=l(f,S[0],S[1]);return c(function(){b.hasValue=!0,b.value=E},[E]),d(E),E},Qd}var Qy;function ET(){return Qy||(Qy=1,Zd.exports=CT()),Zd.exports}var kT=ET();const MT=rh(kT),TT={},Jy=e=>{let t;const i=new Set,r=(m,g)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),i.forEach(S=>S(t,y))}},l=()=>t,d={setState:r,getState:l,getInitialState:()=>f,subscribe:m=>(i.add(m),()=>i.delete(m)),destroy:()=>{(TT?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},f=t=e(r,l,d);return d},NT=e=>e?Jy(e):Jy,{useDebugValue:AT}=HE,{useSyncExternalStoreWithSelector:DT}=MT,RT=e=>e;function yx(e,t=RT,i){const r=DT(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,i);return AT(r),r}const e1=(e,t)=>{const i=NT(e),r=(l,a=t)=>yx(i,l,a);return Object.assign(r,i),r},BT=(e,t)=>e?e1(e,t):e1;function ht(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,l]of e)if(!Object.is(l,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const i=Object.keys(e);if(i.length!==Object.keys(t).length)return!1;for(const r of i)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}pb();const dh=Y.createContext(null),LT=dh.Provider,Sx=kn.error001();function Ye(e,t){const i=Y.useContext(dh);if(i===null)throw new Error(Sx);return yx(i,e,t)}function dt(){const e=Y.useContext(dh);if(e===null)throw new Error(Sx);return Y.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const t1={display:"none"},zT={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},bx="react-flow__node-desc",xx="react-flow__edge-desc",OT="react-flow__aria-live",HT=e=>e.ariaLiveMessage,jT=e=>e.ariaLabelConfig;function PT({rfId:e}){const t=Ye(HT);return w.jsx("div",{id:`${OT}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zT,children:t})}function IT({rfId:e,disableKeyboardA11y:t}){const i=Ye(jT);return w.jsxs(w.Fragment,{children:[w.jsx("div",{id:`${bx}-${e}`,style:t1,children:t?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),w.jsx("div",{id:`${xx}-${e}`,style:t1,children:i["edge.a11yDescription.default"]}),!t&&w.jsx(PT,{rfId:e})]})}const ph=Y.forwardRef(({position:e="top-left",children:t,className:i,style:r,...l},a)=>{const c=`${e}`.split("-");return w.jsx("div",{className:Bt(["react-flow__panel",i,...c]),style:r,ref:a,...l,children:t})});ph.displayName="Panel";function UT({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:w.jsx(ph,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:w.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const qT=e=>{const t=[],i=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&i.push(r);return{selectedNodes:t,selectedEdges:i}},pu=e=>e.id;function VT(e,t){return ht(e.selectedNodes.map(pu),t.selectedNodes.map(pu))&&ht(e.selectedEdges.map(pu),t.selectedEdges.map(pu))}function FT({onSelectionChange:e}){const t=dt(),{selectedNodes:i,selectedEdges:r}=Ye(qT,VT);return Y.useEffect(()=>{const l={nodes:i,edges:r};e==null||e(l),t.getState().onSelectionChangeHandlers.forEach(a=>a(l))},[i,r,e]),null}const YT=e=>!!e.onSelectionChangeHandlers;function WT({onSelectionChange:e}){const t=Ye(YT);return e||t?w.jsx(FT,{onSelectionChange:e}):null}const wx=[0,0],$T={x:0,y:0,zoom:1},XT=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],i1=[...XT,"rfId"],KT=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),n1={translateExtent:pa,nodeOrigin:wx,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function GT(e){const{setNodes:t,setEdges:i,setMinZoom:r,setMaxZoom:l,setTranslateExtent:a,setNodeExtent:c,reset:h,setDefaultNodesAndEdges:d}=Ye(KT,ht),f=dt();Y.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{m.current=n1,h()}),[]);const m=Y.useRef(n1);return Y.useEffect(()=>{for(const g of i1){const v=e[g],y=m.current[g];v!==y&&(typeof e[g]>"u"||(g==="nodes"?t(v):g==="edges"?i(v):g==="minZoom"?r(v):g==="maxZoom"?l(v):g==="translateExtent"?a(v):g==="nodeExtent"?c(v):g==="ariaLabelConfig"?f.setState({ariaLabelConfig:B3(v)}):g==="fitView"?f.setState({fitViewQueued:v}):g==="fitViewOptions"?f.setState({fitViewOptions:v}):f.setState({[g]:v})))}m.current=e},i1.map(g=>e[g])),null}function r1(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ZT(e){var r;const[t,i]=Y.useState(e==="system"?null:e);return Y.useEffect(()=>{if(e!=="system"){i(e);return}const l=r1(),a=()=>i(l!=null&&l.matches?"dark":"light");return a(),l==null||l.addEventListener("change",a),()=>{l==null||l.removeEventListener("change",a)}},[e]),t!==null?t:(r=r1())!=null&&r.matches?"dark":"light"}const s1=typeof document<"u"?document:null;function ya(e=null,t={target:s1,actInsideInputWithModifier:!0}){const[i,r]=Y.useState(!1),l=Y.useRef(!1),a=Y.useRef(new Set([])),[c,h]=Y.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
66
+ `).replace(`
67
+
68
+ `,`
69
+ +`).split(`
70
+ `)),m=f.reduce((g,v)=>g.concat(...v),[]);return[f,m]}return[[],[]]},[e]);return Y.useEffect(()=>{const d=(t==null?void 0:t.target)??s1,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const m=y=>{var E,C;if(l.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!l.current||l.current&&!f)&&nx(y))return!1;const b=o1(y.code,h);if(a.current.add(y[b]),l1(c,a.current,!1)){const L=((C=(E=y.composedPath)==null?void 0:E.call(y))==null?void 0:C[0])||y.target,k=(L==null?void 0:L.nodeName)==="BUTTON"||(L==null?void 0:L.nodeName)==="A";t.preventDefault!==!1&&(l.current||!k)&&y.preventDefault(),r(!0)}},g=y=>{const S=o1(y.code,h);l1(c,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(y[S]),y.key==="Meta"&&a.current.clear(),l.current=!1},v=()=>{a.current.clear(),r(!1)};return d==null||d.addEventListener("keydown",m),d==null||d.addEventListener("keyup",g),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{d==null||d.removeEventListener("keydown",m),d==null||d.removeEventListener("keyup",g),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[e,r]),i}function l1(e,t,i){return e.filter(r=>i||r.length===t.size).some(r=>r.every(l=>t.has(l)))}function o1(e,t){return t.includes(e)?"code":"key"}const QT=()=>{const e=dt();return Y.useMemo(()=>({zoomIn:t=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:i}=e.getState();return i?i.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,i)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,i)=>{const{transform:[r,l,a],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??r,y:t.y??l,zoom:t.zoom??a},i),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,i,r]=e.getState().transform;return{x:t,y:i,zoom:r}},setCenter:async(t,i,r)=>e.getState().setCenter(t,i,r),fitBounds:async(t,i)=>{const{width:r,height:l,minZoom:a,maxZoom:c,panZoom:h}=e.getState(),d=Yg(t,r,l,a,c,(i==null?void 0:i.padding)??.1);return h?(await h.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,i={})=>{const{transform:r,snapGrid:l,snapToGrid:a,domNode:c}=e.getState();if(!c)return t;const{x:h,y:d}=c.getBoundingClientRect(),f={x:t.x-h,y:t.y-d},m=i.snapGrid??l,g=i.snapToGrid??a;return Da(f,r,g,m)},flowToScreenPosition:t=>{const{transform:i,domNode:r}=e.getState();if(!r)return t;const{x:l,y:a}=r.getBoundingClientRect(),c=Wu(t,i);return{x:c.x+l,y:c.y+a}}}),[])};function Cx(e,t){const i=[],r=new Map,l=[];for(const a of e)if(a.type==="add"){l.push(a);continue}else if(a.type==="remove"||a.type==="replace")r.set(a.id,[a]);else{const c=r.get(a.id);c?c.push(a):r.set(a.id,[a])}for(const a of t){const c=r.get(a.id);if(!c){i.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){i.push({...c[0].item});continue}const h={...a};for(const d of c)JT(d,h);i.push(h)}return l.length&&l.forEach(a=>{a.index!==void 0?i.splice(a.index,0,{...a.item}):i.push({...a.item})}),i}function JT(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Ex(e,t){return Cx(e,t)}function kx(e,t){return Cx(e,t)}function vs(e,t){return{id:e,type:"select",selected:t}}function El(e,t=new Set,i=!1){const r=[];for(const[l,a]of e){const c=t.has(l);!(a.selected===void 0&&!c)&&a.selected!==c&&(i&&(a.selected=c),r.push(vs(a.id,c)))}return r}function a1({items:e=[],lookup:t}){var l;const i=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,c]of e.entries()){const h=t.get(c.id),d=((l=h==null?void 0:h.internals)==null?void 0:l.userNode)??h;d!==void 0&&d!==c&&i.push({id:c.id,item:c,type:"replace"}),d===void 0&&i.push({item:c,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&i.push({id:a,type:"remove"});return i}function c1(e){return{id:e.id,type:"remove"}}const u1=e=>w3(e),eN=e=>Kb(e);function Mx(e){return Y.forwardRef(e)}const tN=typeof window<"u"?Y.useLayoutEffect:Y.useEffect;function h1(e){const[t,i]=Y.useState(BigInt(0)),[r]=Y.useState(()=>iN(()=>i(l=>l+BigInt(1))));return tN(()=>{const l=r.get();l.length&&(e(l),r.reset())},[t]),r}function iN(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:i=>{t.push(i),e()}}}const Tx=Y.createContext(null);function nN({children:e}){const t=dt(),i=Y.useCallback(h=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:m,onNodesChange:g,nodeLookup:v,fitViewQueued:y,onNodesChangeMiddlewareMap:S}=t.getState();let b=d;for(const C of h)b=typeof C=="function"?C(b):C;let E=a1({items:b,lookup:v});for(const C of S.values())E=C(E);m&&f(b),E.length>0?g==null||g(E):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:L,setNodes:k}=t.getState();C&&k(L)})},[]),r=h1(i),l=Y.useCallback(h=>{const{edges:d=[],setEdges:f,hasDefaultEdges:m,onEdgesChange:g,edgeLookup:v}=t.getState();let y=d;for(const S of h)y=typeof S=="function"?S(y):S;m?f(y):g&&g(a1({items:y,lookup:v}))},[]),a=h1(l),c=Y.useMemo(()=>({nodeQueue:r,edgeQueue:a}),[]);return w.jsx(Tx.Provider,{value:c,children:e})}function rN(){const e=Y.useContext(Tx);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const sN=e=>!!e.panZoom;function gh(){const e=QT(),t=dt(),i=rN(),r=Ye(sN),l=Y.useMemo(()=>{const a=g=>t.getState().nodeLookup.get(g),c=g=>{i.nodeQueue.push(g)},h=g=>{i.edgeQueue.push(g)},d=g=>{var C,L;const{nodeLookup:v,nodeOrigin:y}=t.getState(),S=u1(g)?g:v.get(g.id),b=S.parentId?tx(S.position,S.measured,S.parentId,v,y):S.position,E={...S,position:b,width:((C=S.measured)==null?void 0:C.width)??S.width,height:((L=S.measured)==null?void 0:L.height)??S.height};return zl(E)},f=(g,v,y={replace:!1})=>{c(S=>S.map(b=>{if(b.id===g){const E=typeof v=="function"?v(b):v;return y.replace&&u1(E)?E:{...b,...E}}return b}))},m=(g,v,y={replace:!1})=>{h(S=>S.map(b=>{if(b.id===g){const E=typeof v=="function"?v(b):v;return y.replace&&eN(E)?E:{...b,...E}}return b}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>{var v;return(v=a(g))==null?void 0:v.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:c,setEdges:h,addNodes:g=>{const v=Array.isArray(g)?g:[g];i.nodeQueue.push(y=>[...y,...v])},addEdges:g=>{const v=Array.isArray(g)?g:[g];i.edgeQueue.push(y=>[...y,...v])},toObject:()=>{const{nodes:g=[],edges:v=[],transform:y}=t.getState(),[S,b,E]=y;return{nodes:g.map(C=>({...C})),edges:v.map(C=>({...C})),viewport:{x:S,y:b,zoom:E}}},deleteElements:async({nodes:g=[],edges:v=[]})=>{const{nodes:y,edges:S,onNodesDelete:b,onEdgesDelete:E,triggerNodeChanges:C,triggerEdgeChanges:L,onDelete:k,onBeforeDelete:D}=t.getState(),{nodes:I,edges:B}=await T3({nodesToRemove:g,edgesToRemove:v,nodes:y,edges:S,onBeforeDelete:D}),U=B.length>0,X=I.length>0;if(U){const G=B.map(c1);E==null||E(B),L(G)}if(X){const G=I.map(c1);b==null||b(I),C(G)}return(X||U)&&(k==null||k({nodes:I,edges:B})),{deletedNodes:I,deletedEdges:B}},getIntersectingNodes:(g,v=!0,y)=>{const S=Oy(g),b=S?g:d(g),E=y!==void 0;return b?(y||t.getState().nodes).filter(C=>{const L=t.getState().nodeLookup.get(C.id);if(L&&!S&&(C.id===g.id||!L.internals.positionAbsolute))return!1;const k=zl(E?C:L),D=_a(k,b);return v&&D>0||D>=k.width*k.height||D>=b.width*b.height}):[]},isNodeIntersecting:(g,v,y=!0)=>{const b=Oy(g)?g:d(g);if(!b)return!1;const E=_a(b,v);return y&&E>0||E>=v.width*v.height||E>=b.width*b.height},updateNode:f,updateNodeData:(g,v,y={replace:!1})=>{f(g,S=>{const b=typeof v=="function"?v(S):v;return y.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},y)},updateEdge:m,updateEdgeData:(g,v,y={replace:!1})=>{m(g,S=>{const b=typeof v=="function"?v(S):v;return y.replace?{...S,data:b}:{...S,data:{...S.data,...b}}},y)},getNodesBounds:g=>{const{nodeLookup:v,nodeOrigin:y}=t.getState();return C3(g,{nodeLookup:v,nodeOrigin:y})},getHandleConnections:({type:g,id:v,nodeId:y})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${y}-${g}${v?`-${v}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:v,nodeId:y})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${y}${g?v?`-${g}-${v}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const v=t.getState().fitViewResolver??R3();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:v}),i.nodeQueue.push(y=>[...y]),v.promise}}},[]);return Y.useMemo(()=>({...l,...e,viewportInitialized:r}),[r])}const f1=e=>e.selected,lN=typeof window<"u"?window:void 0;function oN({deleteKeyCode:e,multiSelectionKeyCode:t}){const i=dt(),{deleteElements:r}=gh(),l=ya(e,{actInsideInputWithModifier:!1}),a=ya(t,{target:lN});Y.useEffect(()=>{if(l){const{edges:c,nodes:h}=i.getState();r({nodes:h.filter(f1),edges:c.filter(f1)}),i.setState({nodesSelectionActive:!1})}},[l]),Y.useEffect(()=>{i.setState({multiSelectionActive:a})},[a])}function aN(e){const t=dt();Y.useEffect(()=>{const i=()=>{var l,a,c,h;if(!e.current||!(((a=(l=e.current).checkVisibility)==null?void 0:a.call(l))??!0))return!1;const r=Wg(e.current);(r.height===0||r.width===0)&&((h=(c=t.getState()).onError)==null||h.call(c,"004",kn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){i(),window.addEventListener("resize",i);const r=new ResizeObserver(()=>i());return r.observe(e.current),()=>{window.removeEventListener("resize",i),r&&e.current&&r.unobserve(e.current)}}},[])}const mh={position:"absolute",width:"100%",height:"100%",top:0,left:0},cN=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function uN({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:i=!0,panOnScroll:r=!1,panOnScrollSpeed:l=.5,panOnScrollMode:a=Cs.Free,zoomOnDoubleClick:c=!0,panOnDrag:h=!0,defaultViewport:d,translateExtent:f,minZoom:m,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:y=!0,children:S,noWheelClassName:b,noPanClassName:E,onViewportChange:C,isControlledViewport:L,paneClickDistance:k,selectionOnDrag:D}){const I=dt(),B=Y.useRef(null),{userSelectionActive:U,lib:X,connectionInProgress:G}=Ye(cN,ht),ne=ya(v),q=Y.useRef();aN(B);const P=Y.useCallback(V=>{C==null||C({x:V[0],y:V[1],zoom:V[2]}),L||I.setState({transform:V})},[C,L]);return Y.useEffect(()=>{if(B.current){q.current=gT({domNode:B.current,minZoom:m,maxZoom:g,translateExtent:f,viewport:d,onDraggingChange:M=>I.setState({paneDragging:M}),onPanZoomStart:(M,j)=>{const{onViewportChangeStart:H,onMoveStart:F}=I.getState();F==null||F(M,j),H==null||H(j)},onPanZoom:(M,j)=>{const{onViewportChange:H,onMove:F}=I.getState();F==null||F(M,j),H==null||H(j)},onPanZoomEnd:(M,j)=>{const{onViewportChangeEnd:H,onMoveEnd:F}=I.getState();F==null||F(M,j),H==null||H(j)}});const{x:V,y:R,zoom:O}=q.current.getViewport();return I.setState({panZoom:q.current,transform:[V,R,O],domNode:B.current.closest(".react-flow")}),()=>{var M;(M=q.current)==null||M.destroy()}}},[]),Y.useEffect(()=>{var V;(V=q.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:i,panOnScroll:r,panOnScrollSpeed:l,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:h,zoomActivationKeyPressed:ne,preventScrolling:y,noPanClassName:E,userSelectionActive:U,noWheelClassName:b,lib:X,onTransformChange:P,connectionInProgress:G,selectionOnDrag:D,paneClickDistance:k})},[e,t,i,r,l,a,c,h,ne,y,E,U,b,X,P,G,D,k]),w.jsx("div",{className:"react-flow__renderer",ref:B,style:mh,children:S})}const hN=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fN(){const{userSelectionActive:e,userSelectionRect:t}=Ye(hN,ht);return e&&t?w.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const tp=(e,t)=>i=>{i.target===t.current&&(e==null||e(i))},dN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function pN({isSelecting:e,selectionKeyPressed:t,selectionMode:i=ga.Full,panOnDrag:r,paneClickDistance:l,selectionOnDrag:a,onSelectionStart:c,onSelectionEnd:h,onPaneClick:d,onPaneContextMenu:f,onPaneScroll:m,onPaneMouseEnter:g,onPaneMouseMove:v,onPaneMouseLeave:y,children:S}){const b=dt(),{userSelectionActive:E,elementsSelectable:C,dragging:L,connectionInProgress:k}=Ye(dN,ht),D=C&&(e||E),I=Y.useRef(null),B=Y.useRef(),U=Y.useRef(new Set),X=Y.useRef(new Set),G=Y.useRef(!1),ne=H=>{if(G.current||k){G.current=!1;return}d==null||d(H),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},q=H=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){H.preventDefault();return}f==null||f(H)},P=m?H=>m(H):void 0,V=H=>{G.current&&(H.stopPropagation(),G.current=!1)},R=H=>{var ce,oe;const{domNode:F}=b.getState();if(B.current=F==null?void 0:F.getBoundingClientRect(),!B.current)return;const T=H.target===I.current;if(!T&&!!H.target.closest(".nokey")||!e||!(a&&T||t)||H.button!==0||!H.isPrimary)return;(oe=(ce=H.target)==null?void 0:ce.setPointerCapture)==null||oe.call(ce,H.pointerId),G.current=!1;const{x:N,y:ee}=cn(H.nativeEvent,B.current);b.setState({userSelectionRect:{width:0,height:0,startX:N,startY:ee,x:N,y:ee}}),T||(H.stopPropagation(),H.preventDefault())},O=H=>{const{userSelectionRect:F,transform:T,nodeLookup:z,edgeLookup:W,connectionLookup:N,triggerNodeChanges:ee,triggerEdgeChanges:ce,defaultEdgeOptions:oe,resetSelectedElements:fe}=b.getState();if(!B.current||!F)return;const{x:he,y:pe}=cn(H.nativeEvent,B.current),{startX:Ce,startY:xe}=F;if(!G.current){const ze=t?0:l;if(Math.hypot(he-Ce,pe-xe)<=ze)return;fe(),c==null||c(H)}G.current=!0;const Se={startX:Ce,startY:xe,x:he<Ce?he:Ce,y:pe<xe?pe:xe,width:Math.abs(he-Ce),height:Math.abs(pe-xe)},me=U.current,Ae=X.current;U.current=new Set(Fg(z,Se,T,i===ga.Partial,!0).map(ze=>ze.id)),X.current=new Set;const We=(oe==null?void 0:oe.selectable)??!0;for(const ze of U.current){const St=N.get(ze);if(St)for(const{edgeId:Ci}of St.values()){const Jt=W.get(Ci);Jt&&(Jt.selectable??We)&&X.current.add(Ci)}}if(!Hy(me,U.current)){const ze=El(z,U.current,!0);ee(ze)}if(!Hy(Ae,X.current)){const ze=El(W,X.current);ce(ze)}b.setState({userSelectionRect:Se,userSelectionActive:!0,nodesSelectionActive:!1})},M=H=>{var F,T;H.button===0&&((T=(F=H.target)==null?void 0:F.releasePointerCapture)==null||T.call(F,H.pointerId),!E&&H.target===I.current&&b.getState().userSelectionRect&&(ne==null||ne(H)),b.setState({userSelectionActive:!1,userSelectionRect:null}),G.current&&(h==null||h(H),b.setState({nodesSelectionActive:U.current.size>0})))},j=r===!0||Array.isArray(r)&&r.includes(0);return w.jsxs("div",{className:Bt(["react-flow__pane",{draggable:j,dragging:L,selection:e}]),onClick:D?void 0:tp(ne,I),onContextMenu:tp(q,I),onWheel:tp(P,I),onPointerEnter:D?void 0:g,onPointerMove:D?O:v,onPointerUp:D?M:void 0,onPointerDownCapture:D?R:void 0,onClickCapture:D?V:void 0,onPointerLeave:y,ref:I,style:mh,children:[S,w.jsx(fN,{})]})}function qp({id:e,store:t,unselect:i=!1,nodeRef:r}){const{addSelectedNodes:l,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:h,onError:d}=t.getState(),f=h.get(e);if(!f){d==null||d("012",kn.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(i||f.selected&&c)&&(a({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var m;return(m=r==null?void 0:r.current)==null?void 0:m.blur()})):l([e])}function Nx({nodeRef:e,disabled:t=!1,noDragClassName:i,handleSelector:r,nodeId:l,isSelectable:a,nodeClickDistance:c}){const h=dt(),[d,f]=Y.useState(!1),m=Y.useRef();return Y.useEffect(()=>{m.current=tT({getStoreItems:()=>h.getState(),onNodeMouseDown:g=>{qp({id:g,store:h,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),Y.useEffect(()=>{var g,v;if(t)(g=m.current)==null||g.destroy();else if(e.current)return(v=m.current)==null||v.update({noDragClassName:i,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:l,nodeClickDistance:c}),()=>{var y;(y=m.current)==null||y.destroy()}},[i,r,t,a,e,l]),d}const gN=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ax(){const e=dt();return Y.useCallback(i=>{const{nodeExtent:r,snapToGrid:l,snapGrid:a,nodesDraggable:c,onError:h,updateNodePositions:d,nodeLookup:f,nodeOrigin:m}=e.getState(),g=new Map,v=gN(c),y=l?a[0]:5,S=l?a[1]:5,b=i.direction.x*y*i.factor,E=i.direction.y*S*i.factor;for(const[,C]of f){if(!v(C))continue;let L={x:C.internals.positionAbsolute.x+b,y:C.internals.positionAbsolute.y+E};l&&(L=Aa(L,a));const{position:k,positionAbsolute:D}=Gb({nodeId:C.id,nextPosition:L,nodeLookup:f,nodeExtent:r,nodeOrigin:m,onError:h});C.position=k,C.internals.positionAbsolute=D,g.set(C.id,C)}d(g)},[])}const Jg=Y.createContext(null),mN=Jg.Provider;Jg.Consumer;const Dx=()=>Y.useContext(Jg),_N=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),vN=(e,t,i)=>r=>{const{connectionClickStartHandle:l,connectionMode:a,connection:c}=r,{fromHandle:h,toHandle:d,isValid:f}=c,m=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.type)===i;return{connectingFrom:(h==null?void 0:h.nodeId)===e&&(h==null?void 0:h.id)===t&&(h==null?void 0:h.type)===i,connectingTo:m,clickConnecting:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===i,isPossibleEndHandle:a===Bl.Strict?(h==null?void 0:h.type)!==i:e!==(h==null?void 0:h.nodeId)||t!==(h==null?void 0:h.id),connectionInProcess:!!h,clickConnectionInProcess:!!l,valid:m&&f}};function yN({type:e="source",position:t=we.Top,isValidConnection:i,isConnectable:r=!0,isConnectableStart:l=!0,isConnectableEnd:a=!0,id:c,onConnect:h,children:d,className:f,onMouseDown:m,onTouchStart:g,...v},y){var O,M;const S=c||null,b=e==="target",E=dt(),C=Dx(),{connectOnClick:L,noPanClassName:k,rfId:D}=Ye(_N,ht),{connectingFrom:I,connectingTo:B,clickConnecting:U,isPossibleEndHandle:X,connectionInProcess:G,clickConnectionInProcess:ne,valid:q}=Ye(vN(C,S,e),ht);C||(M=(O=E.getState()).onError)==null||M.call(O,"010",kn.error010());const P=j=>{const{defaultEdgeOptions:H,onConnect:F,hasDefaultEdges:T}=E.getState(),z={...H,...j};if(T){const{edges:W,setEdges:N}=E.getState();N(P3(z,W))}F==null||F(z),h==null||h(z)},V=j=>{if(!C)return;const H=rx(j.nativeEvent);if(l&&(H&&j.button===0||!H)){const F=E.getState();Up.onPointerDown(j.nativeEvent,{handleDomNode:j.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:b,handleId:S,nodeId:C,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:F.onConnectEnd,updateConnection:F.updateConnection,onConnect:P,isValidConnection:i||F.isValidConnection,getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}H?m==null||m(j):g==null||g(j)},R=j=>{const{onClickConnectStart:H,onClickConnectEnd:F,connectionClickStartHandle:T,connectionMode:z,isValidConnection:W,lib:N,rfId:ee,nodeLookup:ce,connection:oe}=E.getState();if(!C||!T&&!l)return;if(!T){H==null||H(j.nativeEvent,{nodeId:C,handleId:S,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:C,type:e,id:S}});return}const fe=ix(j.target),he=i||W,{connection:pe,isValid:Ce}=Up.isValid(j.nativeEvent,{handle:{nodeId:C,id:S,type:e},connectionMode:z,fromNodeId:T.nodeId,fromHandleId:T.id||null,fromType:T.type,isValidConnection:he,flowId:ee,doc:fe,lib:N,nodeLookup:ce});Ce&&pe&&P(pe);const xe=structuredClone(oe);delete xe.inProgress,xe.toPosition=xe.toHandle?xe.toHandle.position:null,F==null||F(j,xe),E.setState({connectionClickStartHandle:null})};return w.jsx("div",{"data-handleid":S,"data-nodeid":C,"data-handlepos":t,"data-id":`${D}-${C}-${S}-${e}`,className:Bt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",k,f,{source:!b,target:b,connectable:r,connectablestart:l,connectableend:a,clickconnecting:U,connectingfrom:I,connectingto:B,valid:q,connectionindicator:r&&(!G||X)&&(G||ne?a:l)}]),onMouseDown:V,onTouchStart:V,onClick:L?R:void 0,ref:y,...v,children:d})}const Xr=Y.memo(Mx(yN));function SN({data:e,isConnectable:t,sourcePosition:i=we.Bottom}){return w.jsxs(w.Fragment,{children:[e==null?void 0:e.label,w.jsx(Xr,{type:"source",position:i,isConnectable:t})]})}function bN({data:e,isConnectable:t,targetPosition:i=we.Top,sourcePosition:r=we.Bottom}){return w.jsxs(w.Fragment,{children:[w.jsx(Xr,{type:"target",position:i,isConnectable:t}),e==null?void 0:e.label,w.jsx(Xr,{type:"source",position:r,isConnectable:t})]})}function xN(){return null}function wN({data:e,isConnectable:t,targetPosition:i=we.Top}){return w.jsxs(w.Fragment,{children:[w.jsx(Xr,{type:"target",position:i,isConnectable:t}),e==null?void 0:e.label]})}const $u={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},d1={input:SN,default:bN,output:wN,group:xN};function CN(e){var t,i,r,l;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((i=e.style)==null?void 0:i.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((l=e.style)==null?void 0:l.height)}}const EN=e=>{const{width:t,height:i,x:r,y:l}=Na(e.nodeLookup,{filter:a=>!!a.selected});return{width:an(t)?t:null,height:an(i)?i:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${l}px)`}};function kN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:i}){const r=dt(),{width:l,height:a,transformString:c,userSelectionActive:h}=Ye(EN,ht),d=Ax(),f=Y.useRef(null);if(Y.useEffect(()=>{var v;i||(v=f.current)==null||v.focus({preventScroll:!0})},[i]),Nx({nodeRef:f}),h||!l||!a)return null;const m=e?v=>{const y=r.getState().nodes.filter(S=>S.selected);e(v,y)}:void 0,g=v=>{Object.prototype.hasOwnProperty.call($u,v.key)&&(v.preventDefault(),d({direction:$u[v.key],factor:v.shiftKey?4:1}))};return w.jsx("div",{className:Bt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:w.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:i?void 0:-1,onKeyDown:i?void 0:g,style:{width:l,height:a}})})}const p1=typeof window<"u"?window:void 0,MN=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Rx({children:e,onPaneClick:t,onPaneMouseEnter:i,onPaneMouseMove:r,onPaneMouseLeave:l,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:h,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:m,selectionMode:g,onSelectionStart:v,onSelectionEnd:y,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:L,zoomOnPinch:k,panOnScroll:D,panOnScrollSpeed:I,panOnScrollMode:B,zoomOnDoubleClick:U,panOnDrag:X,defaultViewport:G,translateExtent:ne,minZoom:q,maxZoom:P,preventScrolling:V,onSelectionContextMenu:R,noWheelClassName:O,noPanClassName:M,disableKeyboardA11y:j,onViewportChange:H,isControlledViewport:F}){const{nodesSelectionActive:T,userSelectionActive:z}=Ye(MN,ht),W=ya(f,{target:p1}),N=ya(b,{target:p1}),ee=N||X,ce=N||D,oe=m&&ee!==!0,fe=W||z||oe;return oN({deleteKeyCode:d,multiSelectionKeyCode:S}),w.jsx(uN,{onPaneContextMenu:a,elementsSelectable:C,zoomOnScroll:L,zoomOnPinch:k,panOnScroll:ce,panOnScrollSpeed:I,panOnScrollMode:B,zoomOnDoubleClick:U,panOnDrag:!W&&ee,defaultViewport:G,translateExtent:ne,minZoom:q,maxZoom:P,zoomActivationKeyCode:E,preventScrolling:V,noWheelClassName:O,noPanClassName:M,onViewportChange:H,isControlledViewport:F,paneClickDistance:h,selectionOnDrag:oe,children:w.jsxs(pN,{onSelectionStart:v,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:i,onPaneMouseMove:r,onPaneMouseLeave:l,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:ee,isSelecting:!!fe,selectionMode:g,selectionKeyPressed:W,paneClickDistance:h,selectionOnDrag:oe,children:[e,T&&w.jsx(kN,{onSelectionContextMenu:R,noPanClassName:M,disableKeyboardA11y:j})]})})}Rx.displayName="FlowRenderer";const TN=Y.memo(Rx),NN=e=>t=>e?Fg(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(i=>i.id):Array.from(t.nodeLookup.keys());function AN(e){return Ye(Y.useCallback(NN(e),[e]),ht)}const DN=e=>e.updateNodeInternals;function RN(){const e=Ye(DN),[t]=Y.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const r=new Map;i.forEach(l=>{const a=l.target.getAttribute("data-id");r.set(a,{id:a,nodeElement:l.target,force:!0})}),e(r)}));return Y.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function BN({node:e,nodeType:t,hasDimensions:i,resizeObserver:r}){const l=dt(),a=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(e.sourcePosition),d=Y.useRef(e.targetPosition),f=Y.useRef(t),m=i&&!!e.internals.handleBounds;return Y.useEffect(()=>{a.current&&!e.hidden&&(!m||c.current!==a.current)&&(c.current&&(r==null||r.unobserve(c.current)),r==null||r.observe(a.current),c.current=a.current)},[m,e.hidden]),Y.useEffect(()=>()=>{c.current&&(r==null||r.unobserve(c.current),c.current=null)},[]),Y.useEffect(()=>{if(a.current){const g=f.current!==t,v=h.current!==e.sourcePosition,y=d.current!==e.targetPosition;(g||v||y)&&(f.current=t,h.current=e.sourcePosition,d.current=e.targetPosition,l.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function LN({id:e,onClick:t,onMouseEnter:i,onMouseMove:r,onMouseLeave:l,onContextMenu:a,onDoubleClick:c,nodesDraggable:h,elementsSelectable:d,nodesConnectable:f,nodesFocusable:m,resizeObserver:g,noDragClassName:v,noPanClassName:y,disableKeyboardA11y:S,rfId:b,nodeTypes:E,nodeClickDistance:C,onError:L}){const{node:k,internals:D,isParent:I}=Ye(he=>{const pe=he.nodeLookup.get(e),Ce=he.parentLookup.has(e);return{node:pe,internals:pe.internals,isParent:Ce}},ht);let B=k.type||"default",U=(E==null?void 0:E[B])||d1[B];U===void 0&&(L==null||L("003",kn.error003(B)),B="default",U=(E==null?void 0:E.default)||d1.default);const X=!!(k.draggable||h&&typeof k.draggable>"u"),G=!!(k.selectable||d&&typeof k.selectable>"u"),ne=!!(k.connectable||f&&typeof k.connectable>"u"),q=!!(k.focusable||m&&typeof k.focusable>"u"),P=dt(),V=ex(k),R=BN({node:k,nodeType:B,hasDimensions:V,resizeObserver:g}),O=Nx({nodeRef:R,disabled:k.hidden||!X,noDragClassName:v,handleSelector:k.dragHandle,nodeId:e,isSelectable:G,nodeClickDistance:C}),M=Ax();if(k.hidden)return null;const j=sr(k),H=CN(k),F=G||X||t||i||r||l,T=i?he=>i(he,{...D.userNode}):void 0,z=r?he=>r(he,{...D.userNode}):void 0,W=l?he=>l(he,{...D.userNode}):void 0,N=a?he=>a(he,{...D.userNode}):void 0,ee=c?he=>c(he,{...D.userNode}):void 0,ce=he=>{const{selectNodesOnDrag:pe,nodeDragThreshold:Ce}=P.getState();G&&(!pe||!X||Ce>0)&&qp({id:e,store:P,nodeRef:R}),t&&t(he,{...D.userNode})},oe=he=>{if(!(nx(he.nativeEvent)||S)){if(Yb.includes(he.key)&&G){const pe=he.key==="Escape";qp({id:e,store:P,unselect:pe,nodeRef:R})}else if(X&&k.selected&&Object.prototype.hasOwnProperty.call($u,he.key)){he.preventDefault();const{ariaLabelConfig:pe}=P.getState();P.setState({ariaLiveMessage:pe["node.a11yDescription.ariaLiveMessage"]({direction:he.key.replace("Arrow","").toLowerCase(),x:~~D.positionAbsolute.x,y:~~D.positionAbsolute.y})}),M({direction:$u[he.key],factor:he.shiftKey?4:1})}}},fe=()=>{var Ae;if(S||!((Ae=R.current)!=null&&Ae.matches(":focus-visible")))return;const{transform:he,width:pe,height:Ce,autoPanOnNodeFocus:xe,setCenter:Se}=P.getState();if(!xe)return;Fg(new Map([[e,k]]),{x:0,y:0,width:pe,height:Ce},he,!0).length>0||Se(k.position.x+j.width/2,k.position.y+j.height/2,{zoom:he[2]})};return w.jsx("div",{className:Bt(["react-flow__node",`react-flow__node-${B}`,{[y]:X},k.className,{selected:k.selected,selectable:G,parent:I,draggable:X,dragging:O}]),ref:R,style:{zIndex:D.z,transform:`translate(${D.positionAbsolute.x}px,${D.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:V?"visible":"hidden",...k.style,...H},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:z,onMouseLeave:W,onContextMenu:N,onClick:ce,onDoubleClick:ee,onKeyDown:q?oe:void 0,tabIndex:q?0:void 0,onFocus:q?fe:void 0,role:k.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${bx}-${b}`,"aria-label":k.ariaLabel,...k.domAttributes,children:w.jsx(mN,{value:e,children:w.jsx(U,{id:e,data:k.data,type:B,positionAbsoluteX:D.positionAbsolute.x,positionAbsoluteY:D.positionAbsolute.y,selected:k.selected??!1,selectable:G,draggable:X,deletable:k.deletable??!0,isConnectable:ne,sourcePosition:k.sourcePosition,targetPosition:k.targetPosition,dragging:O,dragHandle:k.dragHandle,zIndex:D.z,parentId:k.parentId,...j})})})}var zN=Y.memo(LN);const ON=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Bx(e){const{nodesDraggable:t,nodesConnectable:i,nodesFocusable:r,elementsSelectable:l,onError:a}=Ye(ON,ht),c=AN(e.onlyRenderVisibleElements),h=RN();return w.jsx("div",{className:"react-flow__nodes",style:mh,children:c.map(d=>w.jsx(zN,{id:d,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:h,nodesDraggable:t,nodesConnectable:i,nodesFocusable:r,elementsSelectable:l,nodeClickDistance:e.nodeClickDistance,onError:a},d))})}Bx.displayName="NodeRenderer";const HN=Y.memo(Bx);function jN(e){return Ye(Y.useCallback(i=>{if(!e)return i.edges.map(l=>l.id);const r=[];if(i.width&&i.height)for(const l of i.edges){const a=i.nodeLookup.get(l.source),c=i.nodeLookup.get(l.target);a&&c&&O3({sourceNode:a,targetNode:c,width:i.width,height:i.height,transform:i.transform})&&r.push(l.id)}return r},[e]),ht)}const PN=({color:e="none",strokeWidth:t=1})=>{const i={strokeWidth:t,...e&&{stroke:e}};return w.jsx("polyline",{className:"arrow",style:i,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},IN=({color:e="none",strokeWidth:t=1})=>{const i={strokeWidth:t,...e&&{stroke:e,fill:e}};return w.jsx("polyline",{className:"arrowclosed",style:i,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},g1={[ma.Arrow]:PN,[ma.ArrowClosed]:IN};function UN(e){const t=dt();return Y.useMemo(()=>{var l,a;return Object.prototype.hasOwnProperty.call(g1,e)?g1[e]:((a=(l=t.getState()).onError)==null||a.call(l,"009",kn.error009(e)),null)},[e])}const qN=({id:e,type:t,color:i,width:r=12.5,height:l=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:h="auto-start-reverse"})=>{const d=UN(t);return d?w.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${l}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:h,refX:"0",refY:"0",children:w.jsx(d,{color:i,strokeWidth:c})}):null},Lx=({defaultColor:e,rfId:t})=>{const i=Ye(a=>a.edges),r=Ye(a=>a.defaultEdgeOptions),l=Y.useMemo(()=>F3(i,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[i,r,t,e]);return l.length?w.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:w.jsx("defs",{children:l.map(a=>w.jsx(qN,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};Lx.displayName="MarkerDefinitions";var VN=Y.memo(Lx);function zx({x:e,y:t,label:i,labelStyle:r,labelShowBg:l=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:h=2,children:d,className:f,...m}){const[g,v]=Y.useState({x:1,y:0,width:0,height:0}),y=Bt(["react-flow__edge-textwrapper",f]),S=Y.useRef(null);return Y.useEffect(()=>{if(S.current){const b=S.current.getBBox();v({x:b.x,y:b.y,width:b.width,height:b.height})}},[i]),i?w.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...m,children:[l&&w.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:h,ry:h}),w.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:r,children:i}),d]}):null}zx.displayName="EdgeText";const FN=Y.memo(zx);function _h({path:e,labelX:t,labelY:i,label:r,labelStyle:l,labelShowBg:a,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:d,interactionWidth:f=20,...m}){return w.jsxs(w.Fragment,{children:[w.jsx("path",{...m,d:e,fill:"none",className:Bt(["react-flow__edge-path",m.className])}),f?w.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&an(t)&&an(i)?w.jsx(FN,{x:t,y:i,label:r,labelStyle:l,labelShowBg:a,labelBgStyle:c,labelBgPadding:h,labelBgBorderRadius:d}):null]})}function m1({pos:e,x1:t,y1:i,x2:r,y2:l}){return e===we.Left||e===we.Right?[.5*(t+r),i]:[t,.5*(i+l)]}function Ox({sourceX:e,sourceY:t,sourcePosition:i=we.Bottom,targetX:r,targetY:l,targetPosition:a=we.Top}){const[c,h]=m1({pos:i,x1:e,y1:t,x2:r,y2:l}),[d,f]=m1({pos:a,x1:r,y1:l,x2:e,y2:t}),[m,g,v,y]=sx({sourceX:e,sourceY:t,targetX:r,targetY:l,sourceControlX:c,sourceControlY:h,targetControlX:d,targetControlY:f});return[`M${e},${t} C${c},${h} ${d},${f} ${r},${l}`,m,g,v,y]}function Hx(e){return Y.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,sourcePosition:c,targetPosition:h,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,interactionWidth:C})=>{const[L,k,D]=Ox({sourceX:i,sourceY:r,sourcePosition:c,targetX:l,targetY:a,targetPosition:h}),I=e.isInternal?void 0:t;return w.jsx(_h,{id:I,path:L,labelX:k,labelY:D,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,interactionWidth:C})})}const YN=Hx({isInternal:!1}),jx=Hx({isInternal:!0});YN.displayName="SimpleBezierEdge";jx.displayName="SimpleBezierEdgeInternal";function Px(e){return Y.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,sourcePosition:y=we.Bottom,targetPosition:S=we.Top,markerEnd:b,markerStart:E,pathOptions:C,interactionWidth:L})=>{const[k,D,I]=jp({sourceX:i,sourceY:r,sourcePosition:y,targetX:l,targetY:a,targetPosition:S,borderRadius:C==null?void 0:C.borderRadius,offset:C==null?void 0:C.offset,stepPosition:C==null?void 0:C.stepPosition}),B=e.isInternal?void 0:t;return w.jsx(_h,{id:B,path:k,labelX:D,labelY:I,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:E,interactionWidth:L})})}const Ix=Px({isInternal:!1}),Ux=Px({isInternal:!0});Ix.displayName="SmoothStepEdge";Ux.displayName="SmoothStepEdgeInternal";function qx(e){return Y.memo(({id:t,...i})=>{var l;const r=e.isInternal?void 0:t;return w.jsx(Ix,{...i,id:r,pathOptions:Y.useMemo(()=>{var a;return{borderRadius:0,offset:(a=i.pathOptions)==null?void 0:a.offset}},[(l=i.pathOptions)==null?void 0:l.offset])})})}const WN=qx({isInternal:!1}),Vx=qx({isInternal:!0});WN.displayName="StepEdge";Vx.displayName="StepEdgeInternal";function Fx(e){return Y.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,markerEnd:y,markerStart:S,interactionWidth:b})=>{const[E,C,L]=ox({sourceX:i,sourceY:r,targetX:l,targetY:a}),k=e.isInternal?void 0:t;return w.jsx(_h,{id:k,path:E,labelX:C,labelY:L,label:c,labelStyle:h,labelShowBg:d,labelBgStyle:f,labelBgPadding:m,labelBgBorderRadius:g,style:v,markerEnd:y,markerStart:S,interactionWidth:b})})}const $N=Fx({isInternal:!1}),Yx=Fx({isInternal:!0});$N.displayName="StraightEdge";Yx.displayName="StraightEdgeInternal";function Wx(e){return Y.memo(({id:t,sourceX:i,sourceY:r,targetX:l,targetY:a,sourcePosition:c=we.Bottom,targetPosition:h=we.Top,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,pathOptions:C,interactionWidth:L})=>{const[k,D,I]=$g({sourceX:i,sourceY:r,sourcePosition:c,targetX:l,targetY:a,targetPosition:h,curvature:C==null?void 0:C.curvature}),B=e.isInternal?void 0:t;return w.jsx(_h,{id:B,path:k,labelX:D,labelY:I,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:y,style:S,markerEnd:b,markerStart:E,interactionWidth:L})})}const XN=Wx({isInternal:!1}),$x=Wx({isInternal:!0});XN.displayName="BezierEdge";$x.displayName="BezierEdgeInternal";const _1={default:$x,straight:Yx,step:Vx,smoothstep:Ux,simplebezier:jx},v1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},KN=(e,t,i)=>i===we.Left?e-t:i===we.Right?e+t:e,GN=(e,t,i)=>i===we.Top?e-t:i===we.Bottom?e+t:e,y1="react-flow__edgeupdater";function S1({position:e,centerX:t,centerY:i,radius:r=10,onMouseDown:l,onMouseEnter:a,onMouseOut:c,type:h}){return w.jsx("circle",{onMouseDown:l,onMouseEnter:a,onMouseOut:c,className:Bt([y1,`${y1}-${h}`]),cx:KN(t,r,e),cy:GN(i,r,e),r,stroke:"transparent",fill:"transparent"})}function ZN({isReconnectable:e,reconnectRadius:t,edge:i,sourceX:r,sourceY:l,targetX:a,targetY:c,sourcePosition:h,targetPosition:d,onReconnect:f,onReconnectStart:m,onReconnectEnd:g,setReconnecting:v,setUpdateHover:y}){const S=dt(),b=(D,I)=>{if(D.button!==0)return;const{autoPanOnConnect:B,domNode:U,isValidConnection:X,connectionMode:G,connectionRadius:ne,lib:q,onConnectStart:P,onConnectEnd:V,cancelConnection:R,nodeLookup:O,rfId:M,panBy:j,updateConnection:H}=S.getState(),F=I.type==="target",T=(N,ee)=>{v(!1),g==null||g(N,i,I.type,ee)},z=N=>f==null?void 0:f(i,N),W=(N,ee)=>{v(!0),m==null||m(D,i,I.type),P==null||P(N,ee)};Up.onPointerDown(D.nativeEvent,{autoPanOnConnect:B,connectionMode:G,connectionRadius:ne,domNode:U,handleId:I.id,nodeId:I.nodeId,nodeLookup:O,isTarget:F,edgeUpdaterType:I.type,lib:q,flowId:M,cancelConnection:R,panBy:j,isValidConnection:X,onConnect:z,onConnectStart:W,onConnectEnd:V,onReconnectEnd:T,updateConnection:H,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:D.currentTarget})},E=D=>b(D,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),C=D=>b(D,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),L=()=>y(!0),k=()=>y(!1);return w.jsxs(w.Fragment,{children:[(e===!0||e==="source")&&w.jsx(S1,{position:h,centerX:r,centerY:l,radius:t,onMouseDown:E,onMouseEnter:L,onMouseOut:k,type:"source"}),(e===!0||e==="target")&&w.jsx(S1,{position:d,centerX:a,centerY:c,radius:t,onMouseDown:C,onMouseEnter:L,onMouseOut:k,type:"target"})]})}function QN({id:e,edgesFocusable:t,edgesReconnectable:i,elementsSelectable:r,onClick:l,onDoubleClick:a,onContextMenu:c,onMouseEnter:h,onMouseMove:d,onMouseLeave:f,reconnectRadius:m,onReconnect:g,onReconnectStart:v,onReconnectEnd:y,rfId:S,edgeTypes:b,noPanClassName:E,onError:C,disableKeyboardA11y:L}){let k=Ye(Se=>Se.edgeLookup.get(e));const D=Ye(Se=>Se.defaultEdgeOptions);k=D?{...D,...k}:k;let I=k.type||"default",B=(b==null?void 0:b[I])||_1[I];B===void 0&&(C==null||C("011",kn.error011(I)),I="default",B=(b==null?void 0:b.default)||_1.default);const U=!!(k.focusable||t&&typeof k.focusable>"u"),X=typeof g<"u"&&(k.reconnectable||i&&typeof k.reconnectable>"u"),G=!!(k.selectable||r&&typeof k.selectable>"u"),ne=Y.useRef(null),[q,P]=Y.useState(!1),[V,R]=Y.useState(!1),O=dt(),{zIndex:M,sourceX:j,sourceY:H,targetX:F,targetY:T,sourcePosition:z,targetPosition:W}=Ye(Y.useCallback(Se=>{const me=Se.nodeLookup.get(k.source),Ae=Se.nodeLookup.get(k.target);if(!me||!Ae)return{zIndex:k.zIndex,...v1};const We=V3({id:e,sourceNode:me,targetNode:Ae,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:Se.connectionMode,onError:C});return{zIndex:z3({selected:k.selected,zIndex:k.zIndex,sourceNode:me,targetNode:Ae,elevateOnSelect:Se.elevateEdgesOnSelect,zIndexMode:Se.zIndexMode}),...We||v1}},[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),ht),N=Y.useMemo(()=>k.markerStart?`url('#${Pp(k.markerStart,S)}')`:void 0,[k.markerStart,S]),ee=Y.useMemo(()=>k.markerEnd?`url('#${Pp(k.markerEnd,S)}')`:void 0,[k.markerEnd,S]);if(k.hidden||j===null||H===null||F===null||T===null)return null;const ce=Se=>{var ze;const{addSelectedEdges:me,unselectNodesAndEdges:Ae,multiSelectionActive:We}=O.getState();G&&(O.setState({nodesSelectionActive:!1}),k.selected&&We?(Ae({nodes:[],edges:[k]}),(ze=ne.current)==null||ze.blur()):me([e])),l&&l(Se,k)},oe=a?Se=>{a(Se,{...k})}:void 0,fe=c?Se=>{c(Se,{...k})}:void 0,he=h?Se=>{h(Se,{...k})}:void 0,pe=d?Se=>{d(Se,{...k})}:void 0,Ce=f?Se=>{f(Se,{...k})}:void 0,xe=Se=>{var me;if(!L&&Yb.includes(Se.key)&&G){const{unselectNodesAndEdges:Ae,addSelectedEdges:We}=O.getState();Se.key==="Escape"?((me=ne.current)==null||me.blur(),Ae({edges:[k]})):We([e])}};return w.jsx("svg",{style:{zIndex:M},children:w.jsxs("g",{className:Bt(["react-flow__edge",`react-flow__edge-${I}`,k.className,E,{selected:k.selected,animated:k.animated,inactive:!G&&!l,updating:q,selectable:G}]),onClick:ce,onDoubleClick:oe,onContextMenu:fe,onMouseEnter:he,onMouseMove:pe,onMouseLeave:Ce,onKeyDown:U?xe:void 0,tabIndex:U?0:void 0,role:k.ariaRole??(U?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":k.ariaLabel===null?void 0:k.ariaLabel||`Edge from ${k.source} to ${k.target}`,"aria-describedby":U?`${xx}-${S}`:void 0,ref:ne,...k.domAttributes,children:[!V&&w.jsx(B,{id:e,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,selectable:G,deletable:k.deletable??!0,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:j,sourceY:H,targetX:F,targetY:T,sourcePosition:z,targetPosition:W,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:N,markerEnd:ee,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),X&&w.jsx(ZN,{edge:k,isReconnectable:X,reconnectRadius:m,onReconnect:g,onReconnectStart:v,onReconnectEnd:y,sourceX:j,sourceY:H,targetX:F,targetY:T,sourcePosition:z,targetPosition:W,setUpdateHover:P,setReconnecting:R})]})})}var JN=Y.memo(QN);const eA=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Xx({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:i,edgeTypes:r,noPanClassName:l,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:h,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:m,reconnectRadius:g,onEdgeDoubleClick:v,onReconnectStart:y,onReconnectEnd:S,disableKeyboardA11y:b}){const{edgesFocusable:E,edgesReconnectable:C,elementsSelectable:L,onError:k}=Ye(eA,ht),D=jN(t);return w.jsxs("div",{className:"react-flow__edges",children:[w.jsx(VN,{defaultColor:e,rfId:i}),D.map(I=>w.jsx(JN,{id:I,edgesFocusable:E,edgesReconnectable:C,elementsSelectable:L,noPanClassName:l,onReconnect:a,onContextMenu:c,onMouseEnter:h,onMouseMove:d,onMouseLeave:f,onClick:m,reconnectRadius:g,onDoubleClick:v,onReconnectStart:y,onReconnectEnd:S,rfId:i,onError:k,edgeTypes:r,disableKeyboardA11y:b},I))]})}Xx.displayName="EdgeRenderer";const tA=Y.memo(Xx),iA=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function nA({children:e}){const t=Ye(iA);return w.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function rA(e){const t=gh(),i=Y.useRef(!1);Y.useEffect(()=>{!i.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),i.current=!0)},[e,t.viewportInitialized])}const sA=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function lA(e){const t=Ye(sA),i=dt();return Y.useEffect(()=>{e&&(t==null||t(e),i.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function oA(e){return e.connection.inProgress?{...e.connection,to:Da(e.connection.to,e.transform)}:{...e.connection}}function aA(e){return oA}function cA(e){const t=aA();return Ye(t,ht)}const uA=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function hA({containerStyle:e,style:t,type:i,component:r}){const{nodesConnectable:l,width:a,height:c,isValid:h,inProgress:d}=Ye(uA,ht);return!(a&&l&&d)?null:w.jsx("svg",{style:e,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:w.jsx("g",{className:Bt(["react-flow__connection",Xb(h)]),children:w.jsx(Kx,{style:t,type:i,CustomComponent:r,isValid:h})})})}const Kx=({style:e,type:t=Yr.Bezier,CustomComponent:i,isValid:r})=>{const{inProgress:l,from:a,fromNode:c,fromHandle:h,fromPosition:d,to:f,toNode:m,toHandle:g,toPosition:v,pointer:y}=cA();if(!l)return;if(i)return w.jsx(i,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:h,fromX:a.x,fromY:a.y,toX:f.x,toY:f.y,fromPosition:d,toPosition:v,connectionStatus:Xb(r),toNode:m,toHandle:g,pointer:y});let S="";const b={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:v};switch(t){case Yr.Bezier:[S]=$g(b);break;case Yr.SimpleBezier:[S]=Ox(b);break;case Yr.Step:[S]=jp({...b,borderRadius:0});break;case Yr.SmoothStep:[S]=jp(b);break;default:[S]=ox(b)}return w.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};Kx.displayName="ConnectionLine";const fA={};function b1(e=fA){Y.useRef(e),dt(),Y.useEffect(()=>{},[e])}function dA(){dt(),Y.useRef(!1),Y.useEffect(()=>{},[])}function Gx({nodeTypes:e,edgeTypes:t,onInit:i,onNodeClick:r,onEdgeClick:l,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:y,connectionLineType:S,connectionLineStyle:b,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:L,selectionOnDrag:k,selectionMode:D,multiSelectionKeyCode:I,panActivationKeyCode:B,zoomActivationKeyCode:U,deleteKeyCode:X,onlyRenderVisibleElements:G,elementsSelectable:ne,defaultViewport:q,translateExtent:P,minZoom:V,maxZoom:R,preventScrolling:O,defaultMarkerColor:M,zoomOnScroll:j,zoomOnPinch:H,panOnScroll:F,panOnScrollSpeed:T,panOnScrollMode:z,zoomOnDoubleClick:W,panOnDrag:N,onPaneClick:ee,onPaneMouseEnter:ce,onPaneMouseMove:oe,onPaneMouseLeave:fe,onPaneScroll:he,onPaneContextMenu:pe,paneClickDistance:Ce,nodeClickDistance:xe,onEdgeContextMenu:Se,onEdgeMouseEnter:me,onEdgeMouseMove:Ae,onEdgeMouseLeave:We,reconnectRadius:ze,onReconnect:St,onReconnectStart:Ci,onReconnectEnd:Jt,noDragClassName:ui,noWheelClassName:Qi,noPanClassName:An,disableKeyboardA11y:Dn,nodeExtent:Lt,rfId:ar,viewport:re,onViewportChange:ge}){return b1(e),b1(t),dA(),rA(i),lA(re),w.jsx(TN,{onPaneClick:ee,onPaneMouseEnter:ce,onPaneMouseMove:oe,onPaneMouseLeave:fe,onPaneContextMenu:pe,onPaneScroll:he,paneClickDistance:Ce,deleteKeyCode:X,selectionKeyCode:L,selectionOnDrag:k,selectionMode:D,onSelectionStart:v,onSelectionEnd:y,multiSelectionKeyCode:I,panActivationKeyCode:B,zoomActivationKeyCode:U,elementsSelectable:ne,zoomOnScroll:j,zoomOnPinch:H,zoomOnDoubleClick:W,panOnScroll:F,panOnScrollSpeed:T,panOnScrollMode:z,panOnDrag:N,defaultViewport:q,translateExtent:P,minZoom:V,maxZoom:R,onSelectionContextMenu:g,preventScrolling:O,noDragClassName:ui,noWheelClassName:Qi,noPanClassName:An,disableKeyboardA11y:Dn,onViewportChange:ge,isControlledViewport:!!re,children:w.jsxs(nA,{children:[w.jsx(tA,{edgeTypes:t,onEdgeClick:l,onEdgeDoubleClick:c,onReconnect:St,onReconnectStart:Ci,onReconnectEnd:Jt,onlyRenderVisibleElements:G,onEdgeContextMenu:Se,onEdgeMouseEnter:me,onEdgeMouseMove:Ae,onEdgeMouseLeave:We,reconnectRadius:ze,defaultMarkerColor:M,noPanClassName:An,disableKeyboardA11y:Dn,rfId:ar}),w.jsx(hA,{style:b,type:S,component:E,containerStyle:C}),w.jsx("div",{className:"react-flow__edgelabel-renderer"}),w.jsx(HN,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:h,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:m,nodeClickDistance:xe,onlyRenderVisibleElements:G,noPanClassName:An,noDragClassName:ui,disableKeyboardA11y:Dn,nodeExtent:Lt,rfId:ar}),w.jsx("div",{className:"react-flow__viewport-portal"})]})})}Gx.displayName="GraphView";const pA=Y.memo(Gx),x1=({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,width:l,height:a,fitView:c,fitViewOptions:h,minZoom:d=.5,maxZoom:f=2,nodeOrigin:m,nodeExtent:g,zIndexMode:v="basic"}={})=>{const y=new Map,S=new Map,b=new Map,E=new Map,C=r??t??[],L=i??e??[],k=m??[0,0],D=g??pa;ux(b,E,C);const I=Ip(L,y,S,{nodeOrigin:k,nodeExtent:D,zIndexMode:v});let B=[0,0,1];if(c&&l&&a){const U=Na(y,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:X,y:G,zoom:ne}=Yg(U,l,a,d,f,(h==null?void 0:h.padding)??.1);B=[X,G,ne]}return{rfId:"1",width:l??0,height:a??0,transform:B,nodes:L,nodesInitialized:I,nodeLookup:y,parentLookup:S,edges:C,edgeLookup:E,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:i!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:pa,nodeExtent:D,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Bl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:k,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:c??!1,fitViewOptions:h,fitViewResolver:null,connection:{...$b},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:N3,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Wb,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},gA=({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,width:l,height:a,fitView:c,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:m,nodeExtent:g,zIndexMode:v})=>BT((y,S)=>{async function b(){const{nodeLookup:E,panZoom:C,fitViewOptions:L,fitViewResolver:k,width:D,height:I,minZoom:B,maxZoom:U}=S();C&&(await M3({nodes:E,width:D,height:I,panZoom:C,minZoom:B,maxZoom:U},L),k==null||k.resolve(!0),y({fitViewResolver:null}))}return{...x1({nodes:e,edges:t,width:l,height:a,fitView:c,fitViewOptions:h,minZoom:d,maxZoom:f,nodeOrigin:m,nodeExtent:g,defaultNodes:i,defaultEdges:r,zIndexMode:v}),setNodes:E=>{const{nodeLookup:C,parentLookup:L,nodeOrigin:k,elevateNodesOnSelect:D,fitViewQueued:I,zIndexMode:B}=S(),U=Ip(E,C,L,{nodeOrigin:k,nodeExtent:g,elevateNodesOnSelect:D,checkEquality:!0,zIndexMode:B});I&&U?(b(),y({nodes:E,nodesInitialized:U,fitViewQueued:!1,fitViewOptions:void 0})):y({nodes:E,nodesInitialized:U})},setEdges:E=>{const{connectionLookup:C,edgeLookup:L}=S();ux(C,L,E),y({edges:E})},setDefaultNodesAndEdges:(E,C)=>{if(E){const{setNodes:L}=S();L(E),y({hasDefaultNodes:!0})}if(C){const{setEdges:L}=S();L(C),y({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:C,nodeLookup:L,parentLookup:k,domNode:D,nodeOrigin:I,nodeExtent:B,debug:U,fitViewQueued:X,zIndexMode:G}=S(),{changes:ne,updatedInternals:q}=Z3(E,L,k,D,I,B,G);q&&($3(L,k,{nodeOrigin:I,nodeExtent:B,zIndexMode:G}),X?(b(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(ne==null?void 0:ne.length)>0&&(U&&console.log("React Flow: trigger node changes",ne),C==null||C(ne)))},updateNodePositions:(E,C=!1)=>{const L=[];let k=[];const{nodeLookup:D,triggerNodeChanges:I,connection:B,updateConnection:U,onNodesChangeMiddlewareMap:X}=S();for(const[G,ne]of E){const q=D.get(G),P=!!(q!=null&&q.expandParent&&(q!=null&&q.parentId)&&(ne!=null&&ne.position)),V={id:G,type:"position",position:P?{x:Math.max(0,ne.position.x),y:Math.max(0,ne.position.y)}:ne.position,dragging:C};if(q&&B.inProgress&&B.fromNode.id===q.id){const R=Ns(q,B.fromHandle,we.Left,!0);U({...B,from:R})}P&&q.parentId&&L.push({id:G,parentId:q.parentId,rect:{...ne.internals.positionAbsolute,width:ne.measured.width??0,height:ne.measured.height??0}}),k.push(V)}if(L.length>0){const{parentLookup:G,nodeOrigin:ne}=S(),q=Qg(L,D,G,ne);k.push(...q)}for(const G of X.values())k=G(k);I(k)},triggerNodeChanges:E=>{const{onNodesChange:C,setNodes:L,nodes:k,hasDefaultNodes:D,debug:I}=S();if(E!=null&&E.length){if(D){const B=Ex(E,k);L(B)}I&&console.log("React Flow: trigger node changes",E),C==null||C(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:C,setEdges:L,edges:k,hasDefaultEdges:D,debug:I}=S();if(E!=null&&E.length){if(D){const B=kx(E,k);L(B)}I&&console.log("React Flow: trigger edge changes",E),C==null||C(E)}},addSelectedNodes:E=>{const{multiSelectionActive:C,edgeLookup:L,nodeLookup:k,triggerNodeChanges:D,triggerEdgeChanges:I}=S();if(C){const B=E.map(U=>vs(U,!0));D(B);return}D(El(k,new Set([...E]),!0)),I(El(L))},addSelectedEdges:E=>{const{multiSelectionActive:C,edgeLookup:L,nodeLookup:k,triggerNodeChanges:D,triggerEdgeChanges:I}=S();if(C){const B=E.map(U=>vs(U,!0));I(B);return}I(El(L,new Set([...E]))),D(El(k,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:C}={})=>{const{edges:L,nodes:k,nodeLookup:D,triggerNodeChanges:I,triggerEdgeChanges:B}=S(),U=E||k,X=C||L,G=U.map(q=>{const P=D.get(q.id);return P&&(P.selected=!1),vs(q.id,!1)}),ne=X.map(q=>vs(q.id,!1));I(G),B(ne)},setMinZoom:E=>{const{panZoom:C,maxZoom:L}=S();C==null||C.setScaleExtent([E,L]),y({minZoom:E})},setMaxZoom:E=>{const{panZoom:C,minZoom:L}=S();C==null||C.setScaleExtent([L,E]),y({maxZoom:E})},setTranslateExtent:E=>{var C;(C=S().panZoom)==null||C.setTranslateExtent(E),y({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:C,triggerNodeChanges:L,triggerEdgeChanges:k,elementsSelectable:D}=S();if(!D)return;const I=C.reduce((U,X)=>X.selected?[...U,vs(X.id,!1)]:U,[]),B=E.reduce((U,X)=>X.selected?[...U,vs(X.id,!1)]:U,[]);L(I),k(B)},setNodeExtent:E=>{const{nodes:C,nodeLookup:L,parentLookup:k,nodeOrigin:D,elevateNodesOnSelect:I,nodeExtent:B,zIndexMode:U}=S();E[0][0]===B[0][0]&&E[0][1]===B[0][1]&&E[1][0]===B[1][0]&&E[1][1]===B[1][1]||(Ip(C,L,k,{nodeOrigin:D,nodeExtent:E,elevateNodesOnSelect:I,checkEquality:!1,zIndexMode:U}),y({nodeExtent:E}))},panBy:E=>{const{transform:C,width:L,height:k,panZoom:D,translateExtent:I}=S();return Q3({delta:E,panZoom:D,transform:C,translateExtent:I,width:L,height:k})},setCenter:async(E,C,L)=>{const{width:k,height:D,maxZoom:I,panZoom:B}=S();if(!B)return Promise.resolve(!1);const U=typeof(L==null?void 0:L.zoom)<"u"?L.zoom:I;return await B.setViewport({x:k/2-E*U,y:D/2-C*U,zoom:U},{duration:L==null?void 0:L.duration,ease:L==null?void 0:L.ease,interpolate:L==null?void 0:L.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{y({connection:{...$b}})},updateConnection:E=>{y({connection:E})},reset:()=>y({...x1()})}},Object.is);function Zx({initialNodes:e,initialEdges:t,defaultNodes:i,defaultEdges:r,initialWidth:l,initialHeight:a,initialMinZoom:c,initialMaxZoom:h,initialFitViewOptions:d,fitView:f,nodeOrigin:m,nodeExtent:g,zIndexMode:v,children:y}){const[S]=Y.useState(()=>gA({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,width:l,height:a,fitView:f,minZoom:c,maxZoom:h,fitViewOptions:d,nodeOrigin:m,nodeExtent:g,zIndexMode:v}));return w.jsx(LT,{value:S,children:w.jsx(nN,{children:y})})}function mA({children:e,nodes:t,edges:i,defaultNodes:r,defaultEdges:l,width:a,height:c,fitView:h,fitViewOptions:d,minZoom:f,maxZoom:m,nodeOrigin:g,nodeExtent:v,zIndexMode:y}){return Y.useContext(dh)?w.jsx(w.Fragment,{children:e}):w.jsx(Zx,{initialNodes:t,initialEdges:i,defaultNodes:r,defaultEdges:l,initialWidth:a,initialHeight:c,fitView:h,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:m,nodeOrigin:g,nodeExtent:v,zIndexMode:y,children:e})}const _A={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function vA({nodes:e,edges:t,defaultNodes:i,defaultEdges:r,className:l,nodeTypes:a,edgeTypes:c,onNodeClick:h,onEdgeClick:d,onInit:f,onMove:m,onMoveStart:g,onMoveEnd:v,onConnect:y,onConnectStart:S,onConnectEnd:b,onClickConnectStart:E,onClickConnectEnd:C,onNodeMouseEnter:L,onNodeMouseMove:k,onNodeMouseLeave:D,onNodeContextMenu:I,onNodeDoubleClick:B,onNodeDragStart:U,onNodeDrag:X,onNodeDragStop:G,onNodesDelete:ne,onEdgesDelete:q,onDelete:P,onSelectionChange:V,onSelectionDragStart:R,onSelectionDrag:O,onSelectionDragStop:M,onSelectionContextMenu:j,onSelectionStart:H,onSelectionEnd:F,onBeforeDelete:T,connectionMode:z,connectionLineType:W=Yr.Bezier,connectionLineStyle:N,connectionLineComponent:ee,connectionLineContainerStyle:ce,deleteKeyCode:oe="Backspace",selectionKeyCode:fe="Shift",selectionOnDrag:he=!1,selectionMode:pe=ga.Full,panActivationKeyCode:Ce="Space",multiSelectionKeyCode:xe=va()?"Meta":"Control",zoomActivationKeyCode:Se=va()?"Meta":"Control",snapToGrid:me,snapGrid:Ae,onlyRenderVisibleElements:We=!1,selectNodesOnDrag:ze,nodesDraggable:St,autoPanOnNodeFocus:Ci,nodesConnectable:Jt,nodesFocusable:ui,nodeOrigin:Qi=wx,edgesFocusable:An,edgesReconnectable:Dn,elementsSelectable:Lt=!0,defaultViewport:ar=$T,minZoom:re=.5,maxZoom:ge=2,translateExtent:ke=pa,preventScrolling:Oe=!0,nodeExtent:Fe,defaultMarkerColor:si="#b1b1b7",zoomOnScroll:Ji=!0,zoomOnPinch:Wt=!0,panOnScroll:bt=!1,panOnScrollSpeed:ei=.5,panOnScrollMode:Ze=Cs.Free,zoomOnDoubleClick:hn=!0,panOnDrag:Ei=!0,onPaneClick:Eh,onPaneMouseEnter:Ls,onPaneMouseMove:zs,onPaneMouseLeave:Os,onPaneScroll:Rn,onPaneContextMenu:Hs,paneClickDistance:Gr=1,nodeClickDistance:kh=0,children:ja,onReconnect:Vl,onReconnectStart:Zr,onReconnectEnd:Mh,onEdgeContextMenu:Pa,onEdgeDoubleClick:Ia,onEdgeMouseEnter:Ua,onEdgeMouseMove:Fl,onEdgeMouseLeave:Yl,reconnectRadius:qa=10,onNodesChange:Va,onEdgesChange:fn,noDragClassName:zt="nodrag",noWheelClassName:ti="nowheel",noPanClassName:Bn="nopan",fitView:js,fitViewOptions:Fa,connectOnClick:Th,attributionPosition:Ya,proOptions:Qr,defaultEdgeOptions:Wl,elevateNodesOnSelect:cr=!0,elevateEdgesOnSelect:ur=!1,disableKeyboardA11y:hr=!1,autoPanOnConnect:fr,autoPanOnNodeDrag:Et,autoPanSpeed:Wa,connectionRadius:$a,isValidConnection:Ln,onError:dr,style:Nh,id:$l,nodeDragThreshold:Xa,connectionDragThreshold:Ah,viewport:Ps,onViewportChange:Is,width:en,height:hi,colorMode:Ka="light",debug:Dh,onScroll:pr,ariaLabelConfig:Ga,zIndexMode:Jr="basic",...Rh},fi){const es=$l||"1",Za=ZT(Ka),Xl=Y.useCallback(zn=>{zn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),pr==null||pr(zn)},[pr]);return w.jsx("div",{"data-testid":"rf__wrapper",...Rh,onScroll:Xl,style:{...Nh,..._A},ref:fi,className:Bt(["react-flow",l,Za]),id:$l,role:"application",children:w.jsxs(mA,{nodes:e,edges:t,width:en,height:hi,fitView:js,fitViewOptions:Fa,minZoom:re,maxZoom:ge,nodeOrigin:Qi,nodeExtent:Fe,zIndexMode:Jr,children:[w.jsx(pA,{onInit:f,onNodeClick:h,onEdgeClick:d,onNodeMouseEnter:L,onNodeMouseMove:k,onNodeMouseLeave:D,onNodeContextMenu:I,onNodeDoubleClick:B,nodeTypes:a,edgeTypes:c,connectionLineType:W,connectionLineStyle:N,connectionLineComponent:ee,connectionLineContainerStyle:ce,selectionKeyCode:fe,selectionOnDrag:he,selectionMode:pe,deleteKeyCode:oe,multiSelectionKeyCode:xe,panActivationKeyCode:Ce,zoomActivationKeyCode:Se,onlyRenderVisibleElements:We,defaultViewport:ar,translateExtent:ke,minZoom:re,maxZoom:ge,preventScrolling:Oe,zoomOnScroll:Ji,zoomOnPinch:Wt,zoomOnDoubleClick:hn,panOnScroll:bt,panOnScrollSpeed:ei,panOnScrollMode:Ze,panOnDrag:Ei,onPaneClick:Eh,onPaneMouseEnter:Ls,onPaneMouseMove:zs,onPaneMouseLeave:Os,onPaneScroll:Rn,onPaneContextMenu:Hs,paneClickDistance:Gr,nodeClickDistance:kh,onSelectionContextMenu:j,onSelectionStart:H,onSelectionEnd:F,onReconnect:Vl,onReconnectStart:Zr,onReconnectEnd:Mh,onEdgeContextMenu:Pa,onEdgeDoubleClick:Ia,onEdgeMouseEnter:Ua,onEdgeMouseMove:Fl,onEdgeMouseLeave:Yl,reconnectRadius:qa,defaultMarkerColor:si,noDragClassName:zt,noWheelClassName:ti,noPanClassName:Bn,rfId:es,disableKeyboardA11y:hr,nodeExtent:Fe,viewport:Ps,onViewportChange:Is}),w.jsx(GT,{nodes:e,edges:t,defaultNodes:i,defaultEdges:r,onConnect:y,onConnectStart:S,onConnectEnd:b,onClickConnectStart:E,onClickConnectEnd:C,nodesDraggable:St,autoPanOnNodeFocus:Ci,nodesConnectable:Jt,nodesFocusable:ui,edgesFocusable:An,edgesReconnectable:Dn,elementsSelectable:Lt,elevateNodesOnSelect:cr,elevateEdgesOnSelect:ur,minZoom:re,maxZoom:ge,nodeExtent:Fe,onNodesChange:Va,onEdgesChange:fn,snapToGrid:me,snapGrid:Ae,connectionMode:z,translateExtent:ke,connectOnClick:Th,defaultEdgeOptions:Wl,fitView:js,fitViewOptions:Fa,onNodesDelete:ne,onEdgesDelete:q,onDelete:P,onNodeDragStart:U,onNodeDrag:X,onNodeDragStop:G,onSelectionDrag:O,onSelectionDragStart:R,onSelectionDragStop:M,onMove:m,onMoveStart:g,onMoveEnd:v,noPanClassName:Bn,nodeOrigin:Qi,rfId:es,autoPanOnConnect:fr,autoPanOnNodeDrag:Et,autoPanSpeed:Wa,onError:dr,connectionRadius:$a,isValidConnection:Ln,selectNodesOnDrag:ze,nodeDragThreshold:Xa,connectionDragThreshold:Ah,onBeforeDelete:T,debug:Dh,ariaLabelConfig:Ga,zIndexMode:Jr}),w.jsx(WT,{onSelectionChange:V}),ja,w.jsx(UT,{proOptions:Qr,position:Ya}),w.jsx(IT,{rfId:es,disableKeyboardA11y:hr})]})})}var yA=Mx(vA);function SA(e){const[t,i]=Y.useState(e),r=Y.useCallback(l=>i(a=>Ex(l,a)),[]);return[t,i,r]}function bA(e){const[t,i]=Y.useState(e),r=Y.useCallback(l=>i(a=>kx(l,a)),[]);return[t,i,r]}function xA({dimensions:e,lineWidth:t,variant:i,className:r}){return w.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Bt(["react-flow__background-pattern",i,r])})}function wA({radius:e,className:t}){return w.jsx("circle",{cx:e,cy:e,r:e,className:Bt(["react-flow__background-pattern","dots",t])})}var nr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(nr||(nr={}));const CA={[nr.Dots]:1,[nr.Lines]:1,[nr.Cross]:6},EA=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Qx({id:e,variant:t=nr.Dots,gap:i=20,size:r,lineWidth:l=1,offset:a=0,color:c,bgColor:h,style:d,className:f,patternClassName:m}){const g=Y.useRef(null),{transform:v,patternId:y}=Ye(EA,ht),S=r||CA[t],b=t===nr.Dots,E=t===nr.Cross,C=Array.isArray(i)?i:[i,i],L=[C[0]*v[2]||1,C[1]*v[2]||1],k=S*v[2],D=Array.isArray(a)?a:[a,a],I=E?[k,k]:L,B=[D[0]*v[2]||1+I[0]/2,D[1]*v[2]||1+I[1]/2],U=`${y}${e||""}`;return w.jsxs("svg",{className:Bt(["react-flow__background",f]),style:{...d,...mh,"--xy-background-color-props":h,"--xy-background-pattern-color-props":c},ref:g,"data-testid":"rf__background",children:[w.jsx("pattern",{id:U,x:v[0]%L[0],y:v[1]%L[1],width:L[0],height:L[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${B[0]},-${B[1]})`,children:b?w.jsx(wA,{radius:k/2,className:m}):w.jsx(xA,{dimensions:I,lineWidth:l,variant:t,className:m})}),w.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${U})`})]})}Qx.displayName="Background";const kA=Y.memo(Qx);function MA(){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:w.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function TA(){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:w.jsx("path",{d:"M0 0h32v4.2H0z"})})}function NA(){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:w.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function AA(){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:w.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function DA(){return w.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:w.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function gu({children:e,className:t,...i}){return w.jsx("button",{type:"button",className:Bt(["react-flow__controls-button",t]),...i,children:e})}const RA=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Jx({style:e,showZoom:t=!0,showFitView:i=!0,showInteractive:r=!0,fitViewOptions:l,onZoomIn:a,onZoomOut:c,onFitView:h,onInteractiveChange:d,className:f,children:m,position:g="bottom-left",orientation:v="vertical","aria-label":y}){const S=dt(),{isInteractive:b,minZoomReached:E,maxZoomReached:C,ariaLabelConfig:L}=Ye(RA,ht),{zoomIn:k,zoomOut:D,fitView:I}=gh(),B=()=>{k(),a==null||a()},U=()=>{D(),c==null||c()},X=()=>{I(l),h==null||h()},G=()=>{S.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),d==null||d(!b)},ne=v==="horizontal"?"horizontal":"vertical";return w.jsxs(ph,{className:Bt(["react-flow__controls",ne,f]),position:g,style:e,"data-testid":"rf__controls","aria-label":y??L["controls.ariaLabel"],children:[t&&w.jsxs(w.Fragment,{children:[w.jsx(gu,{onClick:B,className:"react-flow__controls-zoomin",title:L["controls.zoomIn.ariaLabel"],"aria-label":L["controls.zoomIn.ariaLabel"],disabled:C,children:w.jsx(MA,{})}),w.jsx(gu,{onClick:U,className:"react-flow__controls-zoomout",title:L["controls.zoomOut.ariaLabel"],"aria-label":L["controls.zoomOut.ariaLabel"],disabled:E,children:w.jsx(TA,{})})]}),i&&w.jsx(gu,{className:"react-flow__controls-fitview",onClick:X,title:L["controls.fitView.ariaLabel"],"aria-label":L["controls.fitView.ariaLabel"],children:w.jsx(NA,{})}),r&&w.jsx(gu,{className:"react-flow__controls-interactive",onClick:G,title:L["controls.interactive.ariaLabel"],"aria-label":L["controls.interactive.ariaLabel"],children:b?w.jsx(DA,{}):w.jsx(AA,{})}),m]})}Jx.displayName="Controls";const BA=Y.memo(Jx);function LA({id:e,x:t,y:i,width:r,height:l,style:a,color:c,strokeColor:h,strokeWidth:d,className:f,borderRadius:m,shapeRendering:g,selected:v,onClick:y}){const{background:S,backgroundColor:b}=a||{},E=c||S||b;return w.jsx("rect",{className:Bt(["react-flow__minimap-node",{selected:v},f]),x:t,y:i,rx:m,ry:m,width:r,height:l,style:{fill:E,stroke:h,strokeWidth:d},shapeRendering:g,onClick:y?C=>y(C,e):void 0})}const zA=Y.memo(LA),OA=e=>e.nodes.map(t=>t.id),ip=e=>e instanceof Function?e:()=>e;function HA({nodeStrokeColor:e,nodeColor:t,nodeClassName:i="",nodeBorderRadius:r=5,nodeStrokeWidth:l,nodeComponent:a=zA,onClick:c}){const h=Ye(OA,ht),d=ip(t),f=ip(e),m=ip(i),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return w.jsx(w.Fragment,{children:h.map(v=>w.jsx(PA,{id:v,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:m,nodeBorderRadius:r,nodeStrokeWidth:l,NodeComponent:a,onClick:c,shapeRendering:g},v))})}function jA({id:e,nodeColorFunc:t,nodeStrokeColorFunc:i,nodeClassNameFunc:r,nodeBorderRadius:l,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:h,onClick:d}){const{node:f,x:m,y:g,width:v,height:y}=Ye(S=>{const{internals:b}=S.nodeLookup.get(e),E=b.userNode,{x:C,y:L}=b.positionAbsolute,{width:k,height:D}=sr(E);return{node:E,x:C,y:L,width:k,height:D}},ht);return!f||f.hidden||!ex(f)?null:w.jsx(h,{x:m,y:g,width:v,height:y,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:l,strokeColor:i(f),strokeWidth:a,shapeRendering:c,onClick:d,id:f.id})}const PA=Y.memo(jA);var IA=Y.memo(HA);const UA=200,qA=150,VA=e=>!e.hidden,FA=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Jb(Na(e.nodeLookup,{filter:VA}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},YA="react-flow__minimap-desc";function ew({style:e,className:t,nodeStrokeColor:i,nodeColor:r,nodeClassName:l="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:h,bgColor:d,maskColor:f,maskStrokeColor:m,maskStrokeWidth:g,position:v="bottom-right",onClick:y,onNodeClick:S,pannable:b=!1,zoomable:E=!1,ariaLabel:C,inversePan:L,zoomStep:k=1,offsetScale:D=5}){const I=dt(),B=Y.useRef(null),{boundingRect:U,viewBB:X,rfId:G,panZoom:ne,translateExtent:q,flowWidth:P,flowHeight:V,ariaLabelConfig:R}=Ye(FA,ht),O=(e==null?void 0:e.width)??UA,M=(e==null?void 0:e.height)??qA,j=U.width/O,H=U.height/M,F=Math.max(j,H),T=F*O,z=F*M,W=D*F,N=U.x-(T-U.width)/2-W,ee=U.y-(z-U.height)/2-W,ce=T+W*2,oe=z+W*2,fe=`${YA}-${G}`,he=Y.useRef(0),pe=Y.useRef();he.current=F,Y.useEffect(()=>{if(B.current&&ne)return pe.current=oT({domNode:B.current,panZoom:ne,getTransform:()=>I.getState().transform,getViewScale:()=>he.current}),()=>{var me;(me=pe.current)==null||me.destroy()}},[ne]),Y.useEffect(()=>{var me;(me=pe.current)==null||me.update({translateExtent:q,width:P,height:V,inversePan:L,pannable:b,zoomStep:k,zoomable:E})},[b,E,L,k,q,P,V]);const Ce=y?me=>{var ze;const[Ae,We]=((ze=pe.current)==null?void 0:ze.pointer(me))||[0,0];y(me,{x:Ae,y:We})}:void 0,xe=S?Y.useCallback((me,Ae)=>{const We=I.getState().nodeLookup.get(Ae).internals.userNode;S(me,We)},[]):void 0,Se=C??R["minimap.ariaLabel"];return w.jsx(ph,{position:v,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*F:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:Bt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:w.jsxs("svg",{width:O,height:M,viewBox:`${N} ${ee} ${ce} ${oe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":fe,ref:B,onClick:Ce,children:[Se&&w.jsx("title",{id:fe,children:Se}),w.jsx(IA,{onClick:xe,nodeColor:r,nodeStrokeColor:i,nodeBorderRadius:a,nodeClassName:l,nodeStrokeWidth:c,nodeComponent:h}),w.jsx("path",{className:"react-flow__minimap-mask",d:`M${N-W},${ee-W}h${ce+W*2}v${oe+W*2}h${-ce-W*2}z
71
+ M${X.x},${X.y}h${X.width}v${X.height}h${-X.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ew.displayName="MiniMap";const WA=Y.memo(ew),$A=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,XA={[Hl.Line]:"right",[Hl.Handle]:"bottom-right"};function KA({nodeId:e,position:t,variant:i=Hl.Handle,className:r,style:l=void 0,children:a,color:c,minWidth:h=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:m=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:v,autoScale:y=!0,shouldResize:S,onResizeStart:b,onResize:E,onResizeEnd:C}){const L=Dx(),k=typeof e=="string"?e:L,D=dt(),I=Y.useRef(null),B=i===Hl.Handle,U=Ye(Y.useCallback($A(B&&y),[B,y]),ht),X=Y.useRef(null),G=t??XA[i];Y.useEffect(()=>{if(!(!I.current||!k))return X.current||(X.current=bT({domNode:I.current,nodeId:k,getStoreItems:()=>{const{nodeLookup:q,transform:P,snapGrid:V,snapToGrid:R,nodeOrigin:O,domNode:M}=D.getState();return{nodeLookup:q,transform:P,snapGrid:V,snapToGrid:R,nodeOrigin:O,paneDomNode:M}},onChange:(q,P)=>{const{triggerNodeChanges:V,nodeLookup:R,parentLookup:O,nodeOrigin:M}=D.getState(),j=[],H={x:q.x,y:q.y},F=R.get(k);if(F&&F.expandParent&&F.parentId){const T=F.origin??M,z=q.width??F.measured.width??0,W=q.height??F.measured.height??0,N={id:F.id,parentId:F.parentId,rect:{width:z,height:W,...tx({x:q.x??F.position.x,y:q.y??F.position.y},{width:z,height:W},F.parentId,R,T)}},ee=Qg([N],R,O,M);j.push(...ee),H.x=q.x?Math.max(T[0]*z,q.x):void 0,H.y=q.y?Math.max(T[1]*W,q.y):void 0}if(H.x!==void 0&&H.y!==void 0){const T={id:k,type:"position",position:{...H}};j.push(T)}if(q.width!==void 0&&q.height!==void 0){const z={id:k,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};j.push(z)}for(const T of P){const z={...T,type:"position"};j.push(z)}V(j)},onEnd:({width:q,height:P})=>{const V={id:k,type:"dimensions",resizing:!1,dimensions:{width:q,height:P}};D.getState().triggerNodeChanges([V])}})),X.current.update({controlPosition:G,boundaries:{minWidth:h,minHeight:d,maxWidth:f,maxHeight:m},keepAspectRatio:g,resizeDirection:v,onResizeStart:b,onResize:E,onResizeEnd:C,shouldResize:S}),()=>{var q;(q=X.current)==null||q.destroy()}},[G,h,d,f,m,g,b,E,C,S]);const ne=G.split("-");return w.jsx("div",{className:Bt(["react-flow__resize-control","nodrag",...ne,i,r]),ref:I,style:{...l,scale:U,...c&&{[B?"backgroundColor":"borderColor"]:c}},children:a})}Y.memo(KA);const GA=1e3,ZA=1e4;function QA(){const[e,t]=Y.useState({workflows:[],parseErrors:[]}),[i,r]=Y.useState(!1),l=Y.useRef(0),a=Y.useRef(null),c=Y.useRef(new EventTarget),h=Y.useCallback(f=>{const m=a.current;m&&m.readyState===WebSocket.OPEN&&m.send(JSON.stringify(f))},[]),d=Y.useCallback(()=>{const f=window.location.protocol==="https:"?"wss:":"ws:",m=new WebSocket(`${f}//${window.location.host}`);a.current=m,m.onopen=()=>{r(!0),l.current=0},m.onclose=()=>{r(!1),a.current=null;const g=Math.min(GA*2**l.current,ZA);l.current++,setTimeout(d,g)},m.onerror=()=>{m.close()},m.onmessage=g=>{try{const v=JSON.parse(g.data);switch(v.type){case"full-sync":t(v.data);break;case"workflow-updated":t(y=>{const S=y.workflows.filter(E=>E.filePath!==v.data.filePath||E.workflowName!==v.data.workflowName);S.push(v.data);const b=y.parseErrors.filter(E=>E.filePath!==v.data.filePath);return{workflows:S,parseErrors:b}});break;case"workflow-removed":t(y=>({workflows:y.workflows.filter(S=>S.filePath!==v.data.filePath),parseErrors:y.parseErrors.filter(S=>S.filePath!==v.data.filePath)}));break;case"parse-error":t(y=>{const S=y.workflows.filter(E=>E.filePath!==v.data.filePath),b=y.parseErrors.filter(E=>E.filePath!==v.data.filePath);return b.push(v.data),{workflows:S,parseErrors:b}});break;case"pty-data":c.current.dispatchEvent(new CustomEvent("data",{detail:v.data}));break;case"pty-exit":c.current.dispatchEvent(new CustomEvent("exit",{detail:v.data.code}));break;case"pty-spawned":c.current.dispatchEvent(new CustomEvent("spawned",{detail:v.data.pid}));break}}catch{}}},[]);return Y.useEffect(()=>(d(),()=>{var f;(f=a.current)==null||f.close()}),[d]),{state:e,connected:i,sendMessage:h,ptyEvents:c.current}}function JA(){const[e,t]=Y.useState([]),[i,r]=Y.useState(!0),[l,a]=Y.useState(0),c=Y.useCallback(async()=>{try{const m=await fetch("/api/connections");m.ok&&t(await m.json())}catch{}finally{r(!1)}},[]);Y.useEffect(()=>{c()},[c]);const h=Y.useCallback(async m=>{await fetch("/api/connections",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),await c(),a(g=>g+1)},[c]),d=Y.useCallback(async(m,g,v)=>{await fetch("/api/connections",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow_name:m,node_name:g,integration_id:v})}),await c(),a(y=>y+1)},[c]),f=Y.useCallback((m,g,v)=>e.find(y=>y.workflow_name===m&&y.node_name===g&&y.integration_id===v)??e.find(y=>y.workflow_name==="*"&&y.node_name==="*"&&y.integration_id===v)??null,[e]);return{connections:e,loading:i,upsert:h,remove:d,getForNode:f,refetch:c,mutationVersion:l}}function eD(){const[e,t]=Y.useState([]),[i,r]=Y.useState(!0);return Y.useEffect(()=>{(async()=>{try{const l=await fetch("/api/nango/integrations");l.ok&&t(await l.json())}catch{}finally{r(!1)}})()},[]),{integrations:e,loading:i}}function tD(e,t=0){const[i,r]=Y.useState([]),[l,a]=Y.useState(!1),c=Y.useCallback(async()=>{if(!e)return[];a(!0);try{const h=await fetch(`/api/nango/connections/${encodeURIComponent(e)}`);if(h.ok){const d=await h.json();return r(d),d}}catch{}finally{a(!1)}return[]},[e]);return Y.useEffect(()=>{c()},[c,t]),{nangoConnections:i,loading:l,refetch:c}}const iD=5e3;function nD(e){const[t,i]=Y.useState([]),[r,l]=Y.useState(!0),[a,c]=Y.useState(!0),[h,d]=Y.useState(null),[f,m]=Y.useState(null),[g,v]=Y.useState(!1),y=Y.useRef(void 0),S=Y.useCallback(async()=>{try{const E=new URLSearchParams;e&&E.set("workflow",e),E.set("limit","50");const C=await fetch(`/api/runs?${E}`);C.ok?(i(await C.json()),c(!0)):c(!1)}catch{c(!1)}finally{l(!1)}},[e]);Y.useEffect(()=>(l(!0),S(),y.current=setInterval(S,iD),()=>clearInterval(y.current)),[S]);const b=Y.useCallback(async E=>{if(d(E),!E){m(null);return}v(!0);try{const C=await fetch(`/api/runs/${E}/trace`);C.ok&&m(await C.json())}catch{}finally{v(!1)}},[]);return{runs:t,loading:r,available:a,selectedRunId:h,trace:f,traceLoading:g,selectRun:b,refresh:S}}/**
72
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
73
+ * @license MIT
74
+ *
75
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
76
+ * @license MIT
77
+ *
78
+ * Originally forked from (with the author's permission):
79
+ * Fabrice Bellard's javascript vt100 for jslinux:
80
+ * http://bellard.org/jslinux/
81
+ * Copyright (c) 2011 Fabrice Bellard
82
+ */var tw=Object.defineProperty,rD=Object.getOwnPropertyDescriptor,sD=(e,t)=>{for(var i in t)tw(e,i,{get:t[i],enumerable:!0})},yt=(e,t,i,r)=>{for(var l=r>1?void 0:r?rD(t,i):t,a=e.length-1,c;a>=0;a--)(c=e[a])&&(l=(r?c(t,i,l):c(l))||l);return r&&l&&tw(t,i,l),l},ve=(e,t)=>(i,r)=>t(i,r,e),w1="Terminal input",Vp={get:()=>w1,set:e=>w1=e},C1="Too much output to announce, navigate to rows manually to read",Fp={get:()=>C1,set:e=>C1=e};function lD(e){return e.replace(/\r?\n/g,"\r")}function oD(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function aD(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function cD(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let l=e.clipboardData.getData("text/plain");iw(l,t,i,r)}}function iw(e,t,i,r){e=lD(e),e=oD(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function nw(e,t,i){let r=i.getBoundingClientRect(),l=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${l}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function E1(e,t,i,r,l){nw(e,t,i),l&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Fr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function vh(e,t=0,i=e.length){let r="";for(let l=t;l<i;++l){let a=e[l];a>65535?(a-=65536,r+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):r+=String.fromCharCode(a)}return r}var uD=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,l=0;if(this._interim){let a=e.charCodeAt(l++);56320<=a&&a<=57343?t[r++]=(this._interim-55296)*1024+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0}for(let a=l;a<i;++a){let c=e.charCodeAt(a);if(55296<=c&&c<=56319){if(++a>=i)return this._interim=c,r;let h=e.charCodeAt(a);56320<=h&&h<=57343?t[r++]=(c-55296)*1024+h-56320+65536:(t[r++]=c,t[r++]=h);continue}c!==65279&&(t[r++]=c)}return r}},hD=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r=0,l,a,c,h,d=0,f=0;if(this.interim[0]){let v=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let S=0,b;for(;(b=this.interim[++S]&63)&&S<4;)y<<=6,y|=b;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,C=E-S;for(;f<C;){if(f>=i)return 0;if(b=e[f++],(b&192)!==128){f--,v=!0;break}else this.interim[S++]=b,y<<=6,y|=b&63}v||(E===2?y<128?f--:t[r++]=y:E===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let m=i-4,g=f;for(;g<i;){for(;g<m&&!((l=e[g])&128)&&!((a=e[g+1])&128)&&!((c=e[g+2])&128)&&!((h=e[g+3])&128);)t[r++]=l,t[r++]=a,t[r++]=c,t[r++]=h,g+=4;if(l=e[g++],l<128)t[r++]=l;else if((l&224)===192){if(g>=i)return this.interim[0]=l,r;if(a=e[g++],(a&192)!==128){g--;continue}if(d=(l&31)<<6|a&63,d<128){g--;continue}t[r++]=d}else if((l&240)===224){if(g>=i)return this.interim[0]=l,r;if(a=e[g++],(a&192)!==128){g--;continue}if(g>=i)return this.interim[0]=l,this.interim[1]=a,r;if(c=e[g++],(c&192)!==128){g--;continue}if(d=(l&15)<<12|(a&63)<<6|c&63,d<2048||d>=55296&&d<=57343||d===65279)continue;t[r++]=d}else if((l&248)===240){if(g>=i)return this.interim[0]=l,r;if(a=e[g++],(a&192)!==128){g--;continue}if(g>=i)return this.interim[0]=l,this.interim[1]=a,r;if(c=e[g++],(c&192)!==128){g--;continue}if(g>=i)return this.interim[0]=l,this.interim[1]=a,this.interim[2]=c,r;if(h=e[g++],(h&192)!==128){g--;continue}if(d=(l&7)<<18|(a&63)<<12|(c&63)<<6|h&63,d<65536||d>1114111)continue;t[r++]=d}}return r}},rw="",Wr=" ",Ra=class sw{constructor(){this.fg=0,this.bg=0,this.extended=new Xu}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 sw;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}},Xu=class lw{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}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 lw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Zi=class ow extends Ra{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Xu,this.combinedData=""}static fromCharData(t){let i=new ow;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Fr(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 i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let l=t[1].charCodeAt(1);56320<=l&&l<=57343?this.content=(r-55296)*1024+l-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},k1="di$target",Yp="di$dependencies",np=new Map;function fD(e){return e[Yp]||[]}function Yt(e){if(np.has(e))return np.get(e);let t=function(i,r,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");dD(t,i,l)};return t._id=e,np.set(e,t),t}function dD(e,t,i){t[k1]===t?t[Yp].push({id:e,index:i}):(t[Yp]=[{id:e,index:i}],t[k1]=t)}var ai=Yt("BufferService"),aw=Yt("CoreMouseService"),Rs=Yt("CoreService"),pD=Yt("CharsetService"),em=Yt("InstantiationService"),cw=Yt("LogService"),ci=Yt("OptionsService"),uw=Yt("OscLinkService"),gD=Yt("UnicodeService"),Ba=Yt("DecorationService"),Wp=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var m;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let r=[],l=this._optionsService.rawOptions.linkHandler,a=new Zi,c=i.getTrimmedLength(),h=-1,d=-1,f=!1;for(let g=0;g<c;g++)if(!(d===-1&&!i.hasContent(g))){if(i.loadCell(g,a),a.hasExtendedAttrs()&&a.extended.urlId)if(d===-1){d=g,h=a.extended.urlId;continue}else f=a.extended.urlId!==h;else d!==-1&&(f=!0);if(f||d!==-1&&g===c-1){let v=(m=this._oscLinkService.getLinkData(h))==null?void 0:m.uri;if(v){let y={start:{x:d+1,y:e},end:{x:g+(!f&&g===c-1?1:0),y:e}},S=!1;if(!(l!=null&&l.allowNonHttpProtocols))try{let b=new URL(v);["http:","https:"].includes(b.protocol)||(S=!0)}catch{S=!0}S||r.push({text:v,range:y,activate:(b,E)=>l?l.activate(b,E,y):mD(b,E),hover:(b,E)=>{var C;return(C=l==null?void 0:l.hover)==null?void 0:C.call(l,b,E,y)},leave:(b,E)=>{var C;return(C=l==null?void 0:l.leave)==null?void 0:C.call(l,b,E,y)}})}f=!1,a.hasExtendedAttrs()&&a.extended.urlId?(d=g,h=a.extended.urlId):(d=-1,h=-1)}}t(r)}};Wp=yt([ve(0,ai),ve(1,ci),ve(2,uw)],Wp);function mD(e,t){if(confirm(`Do you want to navigate to ${t}?
83
+
84
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var yh=Yt("CharSizeService"),lr=Yt("CoreBrowserService"),tm=Yt("MouseService"),or=Yt("RenderService"),_D=Yt("SelectionService"),hw=Yt("CharacterJoinerService"),Pl=Yt("ThemeService"),fw=Yt("LinkProviderService"),vD=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M1.isErrorNoTelemetry(e)?new M1(e.message+`
85
+
86
+ `+e.stack):new Error(e.message+`
87
+
88
+ `+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)}},yD=new vD;function Au(e){SD(e)||yD.onUnexpectedError(e)}var $p="Canceled";function SD(e){return e instanceof bD?!0:e instanceof Error&&e.name===$p&&e.message===$p}var bD=class extends Error{constructor(){super($p),this.name=this.message}};function xD(e){return new Error(`Illegal argument: ${e}`)}var M1=class Xp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Xp)return t;let i=new Xp;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Kp=class dw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,dw.prototype)}};function Bi(e,t=0){return e[e.length-(1+t)]}var wD;(e=>{function t(a){return a<0}e.isLessThan=t;function i(a){return a<=0}e.isLessThanOrEqual=i;function r(a){return a>0}e.isGreaterThan=r;function l(a){return a===0}e.isNeitherLessOrGreaterThan=l,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(wD||(wD={}));function CD(e,t){let i=this,r=!1,l;return function(){return r||(r=!0,t||(l=e.apply(i,arguments))),l}}var pw;(e=>{function t(D){return D&&typeof D=="object"&&typeof D[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*l(D){yield D}e.single=l;function a(D){return t(D)?D:l(D)}e.wrap=a;function c(D){return D||i}e.from=c;function*h(D){for(let I=D.length-1;I>=0;I--)yield D[I]}e.reverse=h;function d(D){return!D||D[Symbol.iterator]().next().done===!0}e.isEmpty=d;function f(D){return D[Symbol.iterator]().next().value}e.first=f;function m(D,I){let B=0;for(let U of D)if(I(U,B++))return!0;return!1}e.some=m;function g(D,I){for(let B of D)if(I(B))return B}e.find=g;function*v(D,I){for(let B of D)I(B)&&(yield B)}e.filter=v;function*y(D,I){let B=0;for(let U of D)yield I(U,B++)}e.map=y;function*S(D,I){let B=0;for(let U of D)yield*I(U,B++)}e.flatMap=S;function*b(...D){for(let I of D)yield*I}e.concat=b;function E(D,I,B){let U=B;for(let X of D)U=I(U,X);return U}e.reduce=E;function*C(D,I,B=D.length){for(I<0&&(I+=D.length),B<0?B+=D.length:B>D.length&&(B=D.length);I<B;I++)yield D[I]}e.slice=C;function L(D,I=Number.POSITIVE_INFINITY){let B=[];if(I===0)return[B,D];let U=D[Symbol.iterator]();for(let X=0;X<I;X++){let G=U.next();if(G.done)return[B,e.empty()];B.push(G.value)}return[B,{[Symbol.iterator](){return U}}]}e.consume=L;async function k(D){let I=[];for await(let B of D)I.push(B);return Promise.resolve(I)}e.asyncToArray=k})(pw||(pw={}));function As(e){if(pw.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}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 ED(...e){return ft(()=>As(e))}function ft(e){return{dispose:CD(()=>{e()})}}var gw=class mw{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{As(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?mw.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)}};gw.DISABLE_DISPOSED_WARNING=!1;var $r=gw,je=class{constructor(){this._store=new $r,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)}};je.None=Object.freeze({dispose(){}});var jl=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}},ir=typeof window=="object"?window:globalThis,Gp=class Zp{constructor(t){this.element=t,this.next=Zp.Undefined,this.prev=Zp.Undefined}};Gp.Undefined=new Gp(void 0);var pt=Gp,T1=class{constructor(){this._first=pt.Undefined,this._last=pt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===pt.Undefined}clear(){let e=this._first;for(;e!==pt.Undefined;){let t=e.next;e.prev=pt.Undefined,e.next=pt.Undefined,e=t}this._first=pt.Undefined,this._last=pt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new pt(e);if(this._first===pt.Undefined)this._first=i,this._last=i;else if(t){let l=this._last;this._last=i,i.prev=l,l.next=i}else{let l=this._first;this._first=i,i.next=l,l.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==pt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==pt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==pt.Undefined&&e.next!==pt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===pt.Undefined&&e.next===pt.Undefined?(this._first=pt.Undefined,this._last=pt.Undefined):e.next===pt.Undefined?(this._last=this._last.prev,this._last.next=pt.Undefined):e.prev===pt.Undefined&&(this._first=this._first.next,this._first.prev=pt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==pt.Undefined;)yield e.element,e=e.next}},kD=globalThis.performance&&typeof globalThis.performance.now=="function",MD=class _w{static create(t){return new _w(t)}constructor(t){this._now=kD&&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}},Qt;(e=>{e.None=()=>je.None;function t(P,V){return g(P,()=>{},0,void 0,!0,void 0,V)}e.defer=t;function i(P){return(V,R=null,O)=>{let M=!1,j;return j=P(H=>{if(!M)return j?j.dispose():M=!0,V.call(R,H)},null,O),M&&j.dispose(),j}}e.once=i;function r(P,V,R){return f((O,M=null,j)=>P(H=>O.call(M,V(H)),null,j),R)}e.map=r;function l(P,V,R){return f((O,M=null,j)=>P(H=>{V(H),O.call(M,H)},null,j),R)}e.forEach=l;function a(P,V,R){return f((O,M=null,j)=>P(H=>V(H)&&O.call(M,H),null,j),R)}e.filter=a;function c(P){return P}e.signal=c;function h(...P){return(V,R=null,O)=>{let M=ED(...P.map(j=>j(H=>V.call(R,H))));return m(M,O)}}e.any=h;function d(P,V,R,O){let M=R;return r(P,j=>(M=V(M,j),M),O)}e.reduce=d;function f(P,V){let R,O={onWillAddFirstListener(){R=P(M.fire,M)},onDidRemoveLastListener(){R==null||R.dispose()}},M=new _e(O);return V==null||V.add(M),M.event}function m(P,V){return V instanceof Array?V.push(P):V&&V.add(P),P}function g(P,V,R=100,O=!1,M=!1,j,H){let F,T,z,W=0,N,ee={leakWarningThreshold:j,onWillAddFirstListener(){F=P(oe=>{W++,T=V(T,oe),O&&!z&&(ce.fire(T),T=void 0),N=()=>{let fe=T;T=void 0,z=void 0,(!O||W>1)&&ce.fire(fe),W=0},typeof R=="number"?(clearTimeout(z),z=setTimeout(N,R)):z===void 0&&(z=0,queueMicrotask(N))})},onWillRemoveListener(){M&&W>0&&(N==null||N())},onDidRemoveLastListener(){N=void 0,F.dispose()}},ce=new _e(ee);return H==null||H.add(ce),ce.event}e.debounce=g;function v(P,V=0,R){return e.debounce(P,(O,M)=>O?(O.push(M),O):[M],V,void 0,!0,void 0,R)}e.accumulate=v;function y(P,V=(O,M)=>O===M,R){let O=!0,M;return a(P,j=>{let H=O||!V(j,M);return O=!1,M=j,H},R)}e.latch=y;function S(P,V,R){return[e.filter(P,V,R),e.filter(P,O=>!V(O),R)]}e.split=S;function b(P,V=!1,R=[],O){let M=R.slice(),j=P(T=>{M?M.push(T):F.fire(T)});O&&O.add(j);let H=()=>{M==null||M.forEach(T=>F.fire(T)),M=null},F=new _e({onWillAddFirstListener(){j||(j=P(T=>F.fire(T)),O&&O.add(j))},onDidAddFirstListener(){M&&(V?setTimeout(H):H())},onDidRemoveLastListener(){j&&j.dispose(),j=null}});return O&&O.add(F),F.event}e.buffer=b;function E(P,V){return(R,O,M)=>{let j=V(new L);return P(function(H){let F=j.evaluate(H);F!==C&&R.call(O,F)},void 0,M)}}e.chain=E;let C=Symbol("HaltChainable");class L{constructor(){this.steps=[]}map(V){return this.steps.push(V),this}forEach(V){return this.steps.push(R=>(V(R),R)),this}filter(V){return this.steps.push(R=>V(R)?R:C),this}reduce(V,R){let O=R;return this.steps.push(M=>(O=V(O,M),O)),this}latch(V=(R,O)=>R===O){let R=!0,O;return this.steps.push(M=>{let j=R||!V(M,O);return R=!1,O=M,j?M:C}),this}evaluate(V){for(let R of this.steps)if(V=R(V),V===C)break;return V}}function k(P,V,R=O=>O){let O=(...F)=>H.fire(R(...F)),M=()=>P.on(V,O),j=()=>P.removeListener(V,O),H=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:j});return H.event}e.fromNodeEventEmitter=k;function D(P,V,R=O=>O){let O=(...F)=>H.fire(R(...F)),M=()=>P.addEventListener(V,O),j=()=>P.removeEventListener(V,O),H=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:j});return H.event}e.fromDOMEventEmitter=D;function I(P){return new Promise(V=>i(P)(V))}e.toPromise=I;function B(P){let V=new _e;return P.then(R=>{V.fire(R)},()=>{V.fire(void 0)}).finally(()=>{V.dispose()}),V.event}e.fromPromise=B;function U(P,V){return P(R=>V.fire(R))}e.forward=U;function X(P,V,R){return V(R),P(O=>V(O))}e.runAndSubscribe=X;class G{constructor(V,R){this._observable=V,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{V.addObserver(this)},onDidRemoveLastListener:()=>{V.removeObserver(this)}};this.emitter=new _e(O),R&&R.add(this.emitter)}beginUpdate(V){this._counter++}handlePossibleChange(V){}handleChange(V,R){this._hasChanged=!0}endUpdate(V){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ne(P,V){return new G(P,V).emitter.event}e.fromObservable=ne;function q(P){return(V,R,O)=>{let M=0,j=!1,H={beginUpdate(){M++},endUpdate(){M--,M===0&&(P.reportChanges(),j&&(j=!1,V.call(R)))},handlePossibleChange(){},handleChange(){j=!0}};P.addObserver(H),P.reportChanges();let F={dispose(){P.removeObserver(H)}};return O instanceof $r?O.add(F):Array.isArray(O)&&O.push(F),F}}e.fromObservableLight=q})(Qt||(Qt={}));var Qp=class Jp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Jp._idPool++}`,Jp.all.add(this)}start(t){this._stopWatch=new MD,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}}};Qp.all=new Set,Qp._idPool=0;var TD=Qp,ND=-1,vw=class yw{constructor(t,i,r=(yw._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let l=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,l+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[a,c]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${c}):`;console.warn(h),console.warn(a);let d=new RD(h,a);this._errorHandler(d)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,l]of this._stacks)(!t||i<l)&&(t=[r,l],i=l);return t}};vw._idPool=1;var AD=vw,DD=class Sw{constructor(t){this.value=t}static create(){let t=new Error;return new Sw(t.stack??"")}print(){console.warn(this.value.split(`
89
+ `).slice(2).join(`
90
+ `))}},RD=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},BD=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},LD=0,rp=class{constructor(e){this.value=e,this.id=LD++}},zD=2,OD,_e=class{constructor(t){var i,r,l,a;this._size=0,this._options=t,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new AD((t==null?void 0:t.onListenerError)??Au,((r=this._options)==null?void 0:r.leakWarningThreshold)??ND):void 0,this._perfMon=(l=this._options)!=null&&l._profName?new TD(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var t,i,r,l;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),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(l=this._leakageMon)==null||l.dispose())}get event(){return this._event??(this._event=(t,i,r)=>{var h,d,f,m,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let v=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(v);let y=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new BD(`${v}. HINT: Stack shows most frequent listener (${y[1]}-times)`,y[0]);return(((h=this._options)==null?void 0:h.onListenerError)||Au)(S),je.None}if(this._disposed)return je.None;i&&(t=t.bind(i));let l=new rp(t),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(l.stack=DD.create(),a=this._leakageMon.check(l.stack,this._size+1)),this._listeners?this._listeners instanceof rp?(this._deliveryQueue??(this._deliveryQueue=new HD),this._listeners=[this._listeners,l]):this._listeners.push(l):((f=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||f.call(d,this),this._listeners=l,(g=(m=this._options)==null?void 0:m.onDidAddFirstListener)==null||g.call(m,this)),this._size++;let c=ft(()=>{a==null||a(),this._removeListener(l)});return r instanceof $r?r.add(c):Array.isArray(r)&&r.push(c),c}),this._event}_removeListener(t){var a,c,h,d;if((c=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||c.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h,this),this._size=0;return}let i=this._listeners,r=i.indexOf(t);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--,i[r]=void 0;let l=this._deliveryQueue.current===this;if(this._size*zD<=i.length){let f=0;for(let m=0;m<i.length;m++)i[m]?i[f++]=i[m]:l&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=f}}_deliver(t,i){var l;if(!t)return;let r=((l=this._options)==null?void 0:l.onListenerError)||Au;if(!r){t.value(i);return}try{t.value(i)}catch(a){r(a)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){var i,r,l,a;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(l=this._perfMon)==null||l.start(this._size),this._listeners)if(this._listeners instanceof rp)this._deliver(this._listeners,t);else{let c=this._deliveryQueue;c.enqueue(this,t,this._listeners.length),this._deliverQueue(c)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},HD=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};eg.INSTANCE=new eg;var im=eg;function jD(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}im.INSTANCE.onDidChangeZoomLevel;function PD(e){return im.INSTANCE.getZoomFactor(e)}im.INSTANCE.onDidChangeFullscreen;var Il=typeof navigator=="object"?navigator.userAgent:"",tg=Il.indexOf("Firefox")>=0,ID=Il.indexOf("AppleWebKit")>=0,nm=Il.indexOf("Chrome")>=0,UD=!nm&&Il.indexOf("Safari")>=0;Il.indexOf("Electron/")>=0;Il.indexOf("Android")>=0;var sp=!1;if(typeof ir.matchMedia=="function"){let e=ir.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ir.matchMedia("(display-mode: fullscreen)");sp=e.matches,jD(ir,e,({matches:i})=>{sp&&t.matches||(sp=i)})}var kl="en",ig=!1,ng=!1,Du=!1,bw=!1,mu,Ru=kl,N1=kl,qD,sn,Es=globalThis,Zt,hb;typeof Es.vscode<"u"&&typeof Es.vscode.process<"u"?Zt=Es.vscode.process:typeof process<"u"&&typeof((hb=process==null?void 0:process.versions)==null?void 0:hb.node)=="string"&&(Zt=process);var fb,VD=typeof((fb=Zt==null?void 0:Zt.versions)==null?void 0:fb.electron)=="string",FD=VD&&(Zt==null?void 0:Zt.type)==="renderer",db;if(typeof Zt=="object"){ig=Zt.platform==="win32",ng=Zt.platform==="darwin",Du=Zt.platform==="linux",Du&&Zt.env.SNAP&&Zt.env.SNAP_REVISION,Zt.env.CI||Zt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,mu=kl,Ru=kl;let e=Zt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);mu=t.userLocale,N1=t.osLocale,Ru=t.resolvedLanguage||kl,qD=(db=t.languagePack)==null?void 0:db.translationsConfigFile}catch{}bw=!0}else typeof navigator=="object"&&!FD?(sn=navigator.userAgent,ig=sn.indexOf("Windows")>=0,ng=sn.indexOf("Macintosh")>=0,(sn.indexOf("Macintosh")>=0||sn.indexOf("iPad")>=0||sn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Du=sn.indexOf("Linux")>=0,(sn==null?void 0:sn.indexOf("Mobi"))>=0,Ru=globalThis._VSCODE_NLS_LANGUAGE||kl,mu=navigator.language.toLowerCase(),N1=mu):console.error("Unable to resolve platform.");var xw=ig,En=ng,YD=Du,A1=bw,Mn=sn,Ir=Ru,WD;(e=>{function t(){return Ir}e.value=t;function i(){return Ir.length===2?Ir==="en":Ir.length>=3?Ir[0]==="e"&&Ir[1]==="n"&&Ir[2]==="-":!1}e.isDefaultVariant=i;function r(){return Ir==="en"}e.isDefault=r})(WD||(WD={}));var $D=typeof Es.postMessage=="function"&&!Es.importScripts;(()=>{if($D){let e=[];Es.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,l=e.length;r<l;r++){let a=e[r];if(a.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),a.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Es.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var XD=!!(Mn&&Mn.indexOf("Chrome")>=0);Mn&&Mn.indexOf("Firefox")>=0;!XD&&Mn&&Mn.indexOf("Safari")>=0;Mn&&Mn.indexOf("Edg/")>=0;Mn&&Mn.indexOf("Android")>=0;var Sl=typeof navigator=="object"?navigator:{};A1||document.queryCommandSupported&&document.queryCommandSupported("copy")||Sl&&Sl.clipboard&&Sl.clipboard.writeText,A1||Sl&&Sl.clipboard&&Sl.clipboard.readText;var rm=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}},lp=new rm,D1=new rm,R1=new rm,KD=new Array(230),ww;(e=>{function t(h){return lp.keyCodeToStr(h)}e.toString=t;function i(h){return lp.strToKeyCode(h)}e.fromString=i;function r(h){return D1.keyCodeToStr(h)}e.toUserSettingsUS=r;function l(h){return R1.keyCodeToStr(h)}e.toUserSettingsGeneral=l;function a(h){return D1.strToKeyCode(h)||R1.strToKeyCode(h)}e.fromUserSettings=a;function c(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return lp.keyCodeToStr(h)}e.toElectronAccelerator=c})(ww||(ww={}));var GD=class Cw{constructor(t,i,r,l,a){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=l,this.keyCode=a}equals(t){return t instanceof Cw&&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",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",l=this.metaKey?"1":"0";return`K${t}${i}${r}${l}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ZD([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ZD=class{constructor(e){if(e.length===0)throw xD("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 QD(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return ww.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(tg)switch(t){case 59:return 85;case 60:if(YD)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(En)return 57;break}else if(ID&&(En&&t===93||!En&&t===92))return 57;return KD[t]||0}var JD=En?256:2048,e4=512,t4=1024,i4=En?2048:256,B1=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=QD(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|=JD),this.altKey&&(t|=e4),this.shiftKey&&(t|=t4),this.metaKey&&(t|=i4),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new GD(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},L1=new WeakMap;function n4(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var r4=class{static getSameOriginWindowChain(e){let t=L1.get(e);if(!t){t=[],L1.set(e,t);let i=e,r;do r=n4(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,l=this.getSameOriginWindowChain(e);for(let a of l){let c=a.window.deref();if(i+=(c==null?void 0:c.scrollY)??0,r+=(c==null?void 0:c.scrollX)??0,c===t||!a.iframeElement)break;let h=a.iframeElement.getBoundingClientRect();i+=h.top,r+=h.left}return{top:i,left:r}}},_u=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 i=r4.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},z1=class{constructor(e,t=0,i=0){var l;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(nm){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,c=e,h=((l=e.view)==null?void 0:l.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*h):this.deltaY=a.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 d=e;d.deltaMode===d.DOM_DELTA_LINE?tg&&!En?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")UD&&xw?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*h):this.deltaX=a.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 d=e;d.deltaMode===d.DOM_DELTA_LINE?tg&&!En?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Ew=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),s4;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof l4?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Qt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ew})})(s4||(s4={}));var l4=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?Ew:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},sm=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 Kp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Kp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},o4=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,i=globalThis){if(this.isDisposed)throw new Kp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=ft(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},a4;(e=>{async function t(r){let l,a=await Promise.all(r.map(c=>c.then(h=>h,h=>{l||(l=h)})));if(typeof l<"u")throw l;return a}e.settled=t;function i(r){return new Promise(async(l,a)=>{try{await r(l,a)}catch(c){a(c)}})}e.withAsyncBody=i})(a4||(a4={}));var O1=class Xi{static fromArray(t){return new Xi(i=>{i.emitMany(t)})}static fromPromise(t){return new Xi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Xi(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new Xi(async i=>{await Promise.all(t.map(async r=>{for await(let l of r)i.emitOne(l)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new _e,queueMicrotask(async()=>{let r={emitOne:l=>this.emitOne(l),emitMany:l=>this.emitMany(l),reject:l=>this.reject(l)};try{await Promise.resolve(t(r)),this.resolve()}catch(l){this.reject(l)}finally{r.emitOne=void 0,r.emitMany=void 0,r.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 Qt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new Xi(async r=>{for await(let l of t)r.emitOne(i(l))})}map(t){return Xi.map(this,t)}static filter(t,i){return new Xi(async r=>{for await(let l of t)i(l)&&r.emitOne(l)})}filter(t){return Xi.filter(this,t)}static coalesce(t){return Xi.filter(t,i=>!!i)}coalesce(){return Xi.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}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())}};O1.EMPTY=O1.fromArray([]);var{getWindow:wn,getWindowId:c4,onDidRegisterWindow:u4}=(function(){let e=new Map,t={window:ir,disposables:new $r};e.set(ir.vscodeWindowId,t);let i=new _e,r=new _e,l=new _e;function a(c,h){return(typeof c=="number"?e.get(c):void 0)??(h?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:r.event,registerWindow(c){if(e.has(c.vscodeWindowId))return je.None;let h=new $r,d={window:c,disposables:h.add(new $r)};return e.set(c.vscodeWindowId,d),h.add(ft(()=>{e.delete(c.vscodeWindowId),r.fire(c)})),h.add(Te(c,Ut.BEFORE_UNLOAD,()=>{l.fire(c)})),i.fire(d),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(c){return c.vscodeWindowId},hasWindow(c){return e.has(c)},getWindowById:a,getWindow(c){var f;let h=c;if((f=h==null?void 0:h.ownerDocument)!=null&&f.defaultView)return h.ownerDocument.defaultView.window;let d=c;return d!=null&&d.view?d.view.window:ir},getDocument(c){return wn(c).document}}})(),h4=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!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 Te(e,t,i,r){return new h4(e,t,i,r)}var H1=function(e,t,i,r){return Te(e,t,i,r)},lm,f4=class extends o4{constructor(e){super(),this.defaultTarget=e&&wn(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},j1=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){Au(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,l=a=>{i.set(a,!1);let c=e.get(a)??[];for(t.set(a,c),e.set(a,[]),r.set(a,!0);c.length>0;)c.sort(j1.sort),c.shift().execute();r.set(a,!1)};lm=(a,c,h=0)=>{let d=c4(a),f=new j1(c,h),m=e.get(d);return m||(m=[],e.set(d,m)),m.push(f),i.get(d)||(i.set(d,!0),a.requestAnimationFrame(()=>l(d))),f}})();function d4(e){let t=e.getBoundingClientRect(),i=wn(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Ut={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"},p4=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=yi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=yi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=yi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=yi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=yi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=yi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=yi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=yi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=yi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=yi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=yi(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=yi(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=yi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=yi(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 yi(e){return typeof e=="number"?`${e}px`:e}function la(e){return new p4(e)}var kw=class{constructor(){this._hooks=new $r,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=l;let a=e;try{e.setPointerCapture(t),this._hooks.add(ft(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=wn(e)}this._hooks.add(Te(a,Ut.POINTER_MOVE,c=>{if(c.buttons!==i){this.stopMonitoring(!0);return}c.preventDefault(),this._pointerMoveCallback(c)})),this._hooks.add(Te(a,Ut.POINTER_UP,c=>this.stopMonitoring(!0)))}};function g4(e,t,i){let r=null,l=null;if(typeof i.value=="function"?(r="value",l=i.value,l.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",l=i.get),!l)throw new Error("not supported");let a=`$memoize$${t}`;i[r]=function(...c){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:l.apply(this,c)}),this[a]}}var yn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(yn||(yn={}));var Jo=class ni extends je{constructor(){super(),this.dispatched=!1,this.targets=new T1,this.ignoreTargets=new T1,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Qt.runAndSubscribe(u4,({window:t,disposables:i})=>{i.add(Te(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Te(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(Te(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:ir,disposables:this._store}))}static addTarget(t){if(!ni.isTouchDevice())return je.None;ni.INSTANCE||(ni.INSTANCE=new ni);let i=ni.INSTANCE.targets.push(t);return ft(i)}static ignoreTarget(t){if(!ni.isTouchDevice())return je.None;ni.INSTANCE||(ni.INSTANCE=new ni);let i=ni.INSTANCE.ignoreTargets.push(t);return ft(i)}static isTouchDevice(){return"ontouchstart"in ir||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,l=t.targetTouches.length;r<l;r++){let a=t.targetTouches.item(r);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:i,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[i],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let c=this.newGestureEvent(yn.Start,a.target);c.pageX=a.pageX,c.pageY=a.pageY,this.dispatchEvent(c)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),l=Object.keys(this.activeTouches).length;for(let a=0,c=i.changedTouches.length;a<c;a++){let h=i.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],f=Date.now()-d.initialTimeStamp;if(f<ni.HOLD_DELAY&&Math.abs(d.initialPageX-Bi(d.rollingPageX))<30&&Math.abs(d.initialPageY-Bi(d.rollingPageY))<30){let m=this.newGestureEvent(yn.Tap,d.initialTarget);m.pageX=Bi(d.rollingPageX),m.pageY=Bi(d.rollingPageY),this.dispatchEvent(m)}else if(f>=ni.HOLD_DELAY&&Math.abs(d.initialPageX-Bi(d.rollingPageX))<30&&Math.abs(d.initialPageY-Bi(d.rollingPageY))<30){let m=this.newGestureEvent(yn.Contextmenu,d.initialTarget);m.pageX=Bi(d.rollingPageX),m.pageY=Bi(d.rollingPageY),this.dispatchEvent(m)}else if(l===1){let m=Bi(d.rollingPageX),g=Bi(d.rollingPageY),v=Bi(d.rollingTimestamps)-d.rollingTimestamps[0],y=m-d.rollingPageX[0],S=g-d.rollingPageY[0],b=[...this.targets].filter(E=>d.initialTarget instanceof Node&&E.contains(d.initialTarget));this.inertia(t,b,r,Math.abs(y)/v,y>0?1:-1,m,Math.abs(S)/v,S>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(yn.End,d.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===yn.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ni.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===yn.Change||t.type===yn.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let l=0,a=t.initialTarget;for(;a&&a!==r;)l++,a=a.parentElement;i.push([l,r])}i.sort((r,l)=>r[0]-l[0]);for(let[r,l]of i)l.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,l,a,c,h,d,f){this.handle=lm(t,()=>{let m=Date.now(),g=m-r,v=0,y=0,S=!0;l+=ni.SCROLL_FRICTION*g,h+=ni.SCROLL_FRICTION*g,l>0&&(S=!1,v=a*l*g),h>0&&(S=!1,y=d*h*g);let b=this.newGestureEvent(yn.Change);b.translationX=v,b.translationY=y,i.forEach(E=>E.dispatchEvent(b)),S||this.inertia(t,i,m,l,a,c+v,h,d,f+y)})}onTouchMove(t){let i=Date.now();for(let r=0,l=t.changedTouches.length;r<l;r++){let a=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let c=this.activeTouches[a.identifier],h=this.newGestureEvent(yn.Change,c.initialTarget);h.translationX=a.pageX-Bi(c.rollingPageX),h.translationY=a.pageY-Bi(c.rollingPageY),h.pageX=a.pageX,h.pageY=a.pageY,this.dispatchEvent(h),c.rollingPageX.length>3&&(c.rollingPageX.shift(),c.rollingPageY.shift(),c.rollingTimestamps.shift()),c.rollingPageX.push(a.pageX),c.rollingPageY.push(a.pageY),c.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Jo.SCROLL_FRICTION=-.005,Jo.HOLD_DELAY=700,Jo.CLEAR_TAP_COUNT_TIME=400,yt([g4],Jo,"isTouchDevice",1);var m4=Jo,om=class extends je{onclick(e,t){this._register(Te(e,Ut.CLICK,i=>t(new _u(wn(e),i))))}onmousedown(e,t){this._register(Te(e,Ut.MOUSE_DOWN,i=>t(new _u(wn(e),i))))}onmouseover(e,t){this._register(Te(e,Ut.MOUSE_OVER,i=>t(new _u(wn(e),i))))}onmouseleave(e,t){this._register(Te(e,Ut.MOUSE_LEAVE,i=>t(new _u(wn(e),i))))}onkeydown(e,t){this._register(Te(e,Ut.KEY_DOWN,i=>t(new B1(i))))}onkeyup(e,t){this._register(Te(e,Ut.KEY_UP,i=>t(new B1(i))))}oninput(e,t){this._register(Te(e,Ut.INPUT,t))}onblur(e,t){this._register(Te(e,Ut.BLUR,t))}onfocus(e,t){this._register(Te(e,Ut.FOCUS,t))}onchange(e,t){this._register(Te(e,Ut.CHANGE,t))}ignoreGesture(e){return m4.ignoreTarget(e)}},P1=11,_4=class extends om{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=P1+"px",this.domNode.style.height=P1+"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 kw),this._register(H1(this.bgDomNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(H1(this.domNode,Ut.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new f4),this._pointerdownScheduleRepeatTimer=this._register(new sm)}_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,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},v4=class rg{constructor(t,i,r,l,a,c,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,l=l|0,a=a|0,c=c|0,h=h|0),this.rawScrollLeft=l,this.rawScrollTop=h,i<0&&(i=0),l+i>r&&(l=r-i),l<0&&(l=0),a<0&&(a=0),h+a>c&&(h=c-a),h<0&&(h=0),this.width=i,this.scrollWidth=r,this.scrollLeft=l,this.height=a,this.scrollHeight=c,this.scrollTop=h}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,i){return new rg(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new rg(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,i){let r=this.width!==t.width,l=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,c=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,d=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,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:r,scrollWidthChanged:l,scrollLeftChanged:a,heightChanged:c,scrollHeightChanged:h,scrollTopChanged:d}}},y4=class extends je{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new v4(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 r;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new U1(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=U1.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},I1=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function op(e,t){let i=t-e;return function(r){return e+i*x4(r)}}function S4(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var U1=class sg{constructor(t,i,r,l){this.from=t,this.to=i,this.duration=l,this.startTime=r,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,i,r){if(Math.abs(t-i)>2.5*r){let l,a;return t<i?(l=t+.75*r,a=i-.75*r):(l=t-.75*r,a=i+.75*r),S4(op(t,l),op(a,i),.33)}return op(t,i)}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 i=(t-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),l=this.scrollTop(i);return new I1(r,l,!1)}return new I1(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return sg.start(t,i,r)}static start(t,i,r){r=r+10;let l=Date.now()-10;return new sg(t,i,l,r)}};function b4(e){return Math.pow(e,3)}function x4(e){return 1-b4(1-e)}var w4=class extends je{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new sm)}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":"")))}},C4=140,Mw=class extends om{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 w4(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new kw),this._shouldRender=!0,this.domNode=la(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(Te(this.domNode.domNode,Ut.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new _4(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=la(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,Ut.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.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,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);i<=l&&l<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let l=d4(this.domNode.domNode);t=e.pageX-l.left,i=e.pageY-l.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let a=this._sliderOrthogonalPointerPosition(l),c=Math.abs(a-i);if(xw&&c>C4){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let h=this._sliderPointerPosition(l)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(h))},()=>{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()}},Tw=class lg{constructor(t,i,r,l,a,c){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=l,this._scrollSize=a,this._scrollPosition=c,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new lg(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,r,l,a){let c=Math.max(0,r-t),h=Math.max(0,c-2*i),d=l>0&&l>r;if(!d)return{computedAvailableSize:Math.round(c),computedIsNeeded:d,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(r*h/l))),m=(h-f)/(l-r),g=a*m;return{computedAvailableSize:Math.round(c),computedIsNeeded:d,computedSliderSize:Math.round(f),computedSliderRatio:m,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=lg._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 i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},E4=class extends Mw{constructor(e,t,i){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Tw(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,l.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}},k4=class extends Mw{constructor(e,t,i){let r=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Tw(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,l.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}},M4=500,q1=50,T4=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},og=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,i=0,r=1,l=this._rear;do{let a=l===this._front?t:Math.pow(2,-r);if(t-=a,i+=this._memory[l].score*a,l===this._front)break;l=(this._capacity+l-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(nm){let i=wn(t.browserEvent),r=PD(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let l=null,a=new T4(t,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(l=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]=a),a.score=this._computeScore(a,l)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let l=Math.abs(t.deltaX),a=Math.abs(t.deltaY),c=Math.abs(i.deltaX),h=Math.abs(i.deltaY),d=Math.max(Math.min(l,c),1),f=Math.max(Math.min(a,h),1),m=Math.max(l,c),g=Math.max(a,h);m%d===0&&g%f===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};og.INSTANCE=new og;var N4=og,A4=class extends om{constructor(e,t,i){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=R4(t),this._scrollable=i,this._register(this._scrollable.onScroll(l=>{this._onWillScroll.fire(l),this._onDidScroll(l),this._onScroll.fire(l)}));let r={onMouseWheel:l=>this._onMouseWheel(l),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new k4(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new E4(this._scrollable,this._options,r)),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=la(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=la(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=la(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,l=>this._onMouseOver(l)),this.onmouseleave(this._listenOnDomNode,l=>this._onMouseLeave(l)),this._hideTimeout=this._register(new sm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=As(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,En&&(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 z1(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=As(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new z1(i))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Ut.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var l;if((l=e.browserEvent)!=null&&l.defaultPrevented)return;let t=N4.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+a===0?c=a=0:Math.abs(a)>=Math.abs(c)?c=0:a=0),this._options.flipAxes&&([a,c]=[c,a]);let h=!En&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),f={};if(a){let m=q1*a,g=d.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(f,g)}if(c){let m=q1*c,g=d.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(f,g)}f=this._scrollable.validateScrollPosition(f),(d.scrollLeft!==f.scrollLeft||d.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(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,i=e.scrollLeft>0,r=i?" left":"",l=t?" top":"",a=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${l}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${l}${r}`)}}_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(),M4)}},D4=class extends A4{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function R4(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,En&&(t.className+=" mac"),t}var ag=class extends je{constructor(e,t,i,r,l,a,c,h){super(),this._bufferService=i,this._optionsService=c,this._renderService=h,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let d=this._register(new y4({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>lm(r.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new D4(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Qt.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(ft(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(ft(()=>this._styleElement.remove())),this._register(Qt.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
91
+ `)})),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(f=>this._handleScroll(f)))}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),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};ag=yt([ve(2,ai),ve(3,lr),ve(4,aw),ve(5,Pl),ve(6,ci),ve(7,or)],ag);var cg=class extends je{constructor(e,t,i,r,l){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=l,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(a=>this._removeDecoration(a))),this._register(ft(()=>{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 r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*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()}};cg=yt([ve(1,ai),ve(2,lr),ve(3,Ba),ve(4,or)],cg);var B4=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},_n={full:0,left:0,center:0,right:0},Ur={full:0,left:0,center:0,right:0},Uo={full:0,left:0,center:0,right:0},Ku=class extends je{constructor(e,t,i,r,l,a,c,h){var f;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=l,this._optionsService=a,this._themeService=c,this._coreBrowserService=h,this._colorZoneStore=new B4,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(),(f=this._viewportElement.parentElement)==null||f.insertBefore(this._canvas,this._viewportElement),this._register(ft(()=>{var m;return(m=this._canvas)==null?void 0:m.remove()}));let d=this._canvas.getContext("2d");if(d)this._ctx=d;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);Ur.full=this._canvas.width,Ur.left=e,Ur.center=t,Ur.right=e,this._refreshDrawHeightConstants(),Uo.full=1,Uo.left=1,Uo.center=1+Ur.left,Uo.right=1+Ur.left+Ur.center}_refreshDrawHeightConstants(){_n.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);_n.left=t,_n.center=t,_n.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_n.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(Uo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-_n[e.position||"full"]/2),Ur[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+_n[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}))}};Ku=yt([ve(2,ai),ve(3,Ba),ve(4,or),ve(5,ci),ve(6,Pl),ve(7,lr)],Ku);var ue;(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=`
92
+ `,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=""))(ue||(ue={}));var Bu;(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="Ÿ"))(Bu||(Bu={}));var Nw;(e=>e.ST=`${ue.ESC}\\`)(Nw||(Nw={}));var ug=class{constructor(e,t,i,r,l,a){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=l,this._renderService=a,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 i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ue.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),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ug=yt([ve(2,ai),ve(3,ci),ve(4,Rs),ve(5,or)],ug);var qt=0,Vt=0,Ft=0,vt=0,V1={css:"#00000000",rgba:0},Rt;(e=>{function t(l,a,c,h){return h!==void 0?`#${_s(l)}${_s(a)}${_s(c)}${_s(h)}`:`#${_s(l)}${_s(a)}${_s(c)}`}e.toCss=t;function i(l,a,c,h=255){return(l<<24|a<<16|c<<8|h)>>>0}e.toRgba=i;function r(l,a,c,h){return{css:e.toCss(l,a,c,h),rgba:e.toRgba(l,a,c,h)}}e.toColor=r})(Rt||(Rt={}));var ct;(e=>{function t(d,f){if(vt=(f.rgba&255)/255,vt===1)return{css:f.css,rgba:f.rgba};let m=f.rgba>>24&255,g=f.rgba>>16&255,v=f.rgba>>8&255,y=d.rgba>>24&255,S=d.rgba>>16&255,b=d.rgba>>8&255;qt=y+Math.round((m-y)*vt),Vt=S+Math.round((g-S)*vt),Ft=b+Math.round((v-b)*vt);let E=Rt.toCss(qt,Vt,Ft),C=Rt.toRgba(qt,Vt,Ft);return{css:E,rgba:C}}e.blend=t;function i(d){return(d.rgba&255)===255}e.isOpaque=i;function r(d,f,m){let g=Lu.ensureContrastRatio(d.rgba,f.rgba,m);if(g)return Rt.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=r;function l(d){let f=(d.rgba|255)>>>0;return[qt,Vt,Ft]=Lu.toChannels(f),{css:Rt.toCss(qt,Vt,Ft),rgba:f}}e.opaque=l;function a(d,f){return vt=Math.round(f*255),[qt,Vt,Ft]=Lu.toChannels(d.rgba),{css:Rt.toCss(qt,Vt,Ft,vt),rgba:Rt.toRgba(qt,Vt,Ft,vt)}}e.opacity=a;function c(d,f){return vt=d.rgba&255,a(d,vt*f/255)}e.multiplyOpacity=c;function h(d){return[d.rgba>>24&255,d.rgba>>16&255,d.rgba>>8&255]}e.toColorRGB=h})(ct||(ct={}));var gt;(e=>{let t,i;try{let l=document.createElement("canvas");l.width=1,l.height=1;let a=l.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(l){if(l.match(/#[\da-f]{3,8}/i))switch(l.length){case 4:return qt=parseInt(l.slice(1,2).repeat(2),16),Vt=parseInt(l.slice(2,3).repeat(2),16),Ft=parseInt(l.slice(3,4).repeat(2),16),Rt.toColor(qt,Vt,Ft);case 5:return qt=parseInt(l.slice(1,2).repeat(2),16),Vt=parseInt(l.slice(2,3).repeat(2),16),Ft=parseInt(l.slice(3,4).repeat(2),16),vt=parseInt(l.slice(4,5).repeat(2),16),Rt.toColor(qt,Vt,Ft,vt);case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}let a=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return qt=parseInt(a[1]),Vt=parseInt(a[2]),Ft=parseInt(a[3]),vt=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Rt.toColor(qt,Vt,Ft,vt);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=l,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[qt,Vt,Ft,vt]=t.getImageData(0,0,1,1).data,vt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Rt.toRgba(qt,Vt,Ft,vt),css:l}}e.toColor=r})(gt||(gt={}));var oi;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,l,a){let c=r/255,h=l/255,d=a/255,f=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4);return f*.2126+m*.7152+g*.0722}e.relativeLuminance2=i})(oi||(oi={}));var Lu;(e=>{function t(c,h){if(vt=(h&255)/255,vt===1)return h;let d=h>>24&255,f=h>>16&255,m=h>>8&255,g=c>>24&255,v=c>>16&255,y=c>>8&255;return qt=g+Math.round((d-g)*vt),Vt=v+Math.round((f-v)*vt),Ft=y+Math.round((m-y)*vt),Rt.toRgba(qt,Vt,Ft)}e.blend=t;function i(c,h,d){let f=oi.relativeLuminance(c>>8),m=oi.relativeLuminance(h>>8);if(er(f,m)<d){if(m<f){let y=r(c,h,d),S=er(f,oi.relativeLuminance(y>>8));if(S<d){let b=l(c,h,d),E=er(f,oi.relativeLuminance(b>>8));return S>E?y:b}return y}let g=l(c,h,d),v=er(f,oi.relativeLuminance(g>>8));if(v<d){let y=r(c,h,d),S=er(f,oi.relativeLuminance(y>>8));return v>S?g:y}return g}}e.ensureContrastRatio=i;function r(c,h,d){let f=c>>24&255,m=c>>16&255,g=c>>8&255,v=h>>24&255,y=h>>16&255,S=h>>8&255,b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));for(;b<d&&(v>0||y>0||S>0);)v-=Math.max(0,Math.ceil(v*.1)),y-=Math.max(0,Math.ceil(y*.1)),S-=Math.max(0,Math.ceil(S*.1)),b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));return(v<<24|y<<16|S<<8|255)>>>0}e.reduceLuminance=r;function l(c,h,d){let f=c>>24&255,m=c>>16&255,g=c>>8&255,v=h>>24&255,y=h>>16&255,S=h>>8&255,b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));for(;b<d&&(v<255||y<255||S<255);)v=Math.min(255,v+Math.ceil((255-v)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),b=er(oi.relativeLuminance2(v,y,S),oi.relativeLuminance2(f,m,g));return(v<<24|y<<16|S<<8|255)>>>0}e.increaseLuminance=l;function a(c){return[c>>24&255,c>>16&255,c>>8&255,c&255]}e.toChannels=a})(Lu||(Lu={}));function _s(e){let t=e.toString(16);return t.length<2?"0"+t:t}function er(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var L4=class extends Ra{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},Gu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Zi}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 i=[],r=t.translateToString(!0),l=0,a=0,c=0,h=t.getFg(0),d=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==d){if(f-l>1){let m=this._getJoinedRanges(r,c,a,t,l);for(let g=0;g<m.length;g++)i.push(m[g])}l=f,c=a,h=this._workCell.fg,d=this._workCell.bg}a+=this._workCell.getChars().length||Wr.length}if(this._bufferService.cols-l>1){let f=this._getJoinedRanges(r,c,a,t,l);for(let m=0;m<f.length;m++)i.push(f[m])}return i}_getJoinedRanges(e,t,i,r,l){let a=e.substring(t,i),c=[];try{c=this._characterJoiners[0].handler(a)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let d=this._characterJoiners[h].handler(a);for(let f=0;f<d.length;f++)Gu._mergeRanges(c,d[f])}catch(d){console.error(d)}return this._stringRangesToCellRanges(c,r,l),c}_stringRangesToCellRanges(e,t,i){let r=0,l=!1,a=0,c=e[r];if(c){for(let h=i;h<this._bufferService.cols;h++){let d=t.getWidth(h),f=t.getString(h).length||Wr.length;if(d!==0){if(!l&&c[0]<=a&&(c[0]=h,l=!0),c[1]<=a){if(c[1]=h,c=e[++r],!c)break;c[0]<=a?(c[0]=h,l=!0):l=!1}a+=f}}c&&(c[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let l=e[r];if(i){if(t[1]<=l[0])return e[r-1][1]=t[1],e;if(t[1]<=l[1])return e[r-1][1]=Math.max(t[1],l[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=l[0])return e.splice(r,0,t),e;if(t[1]<=l[1])return l[0]=Math.min(t[0],l[0]),e;t[0]<l[1]&&(l[0]=Math.min(t[0],l[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Gu=yt([ve(0,ai)],Gu);function z4(e){return 57508<=e&&e<=57558}function O4(e){return 9472<=e&&e<=9631}function H4(e){return z4(e)||O4(e)}function j4(){return{css:{canvas:vu(),cell:vu()},device:{canvas:vu(),cell:vu(),char:{width:0,height:0,left:0,top:0}}}}function vu(){return{width:0,height:0}}var hg=class{constructor(e,t,i,r,l,a,c){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=l,this._decorationService=a,this._themeService=c,this._workCell=new Zi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,l,a,c,h,d,f,m){let g=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,S=e.getNoBgTrimmedLength();i&&S<a+1&&(S=a+1);let b,E=0,C="",L=0,k=0,D=0,I=0,B=!1,U=0,X=!1,G=0,ne=0,q=[],P=f!==-1&&m!==-1;for(let V=0;V<S;V++){e.loadCell(V,this._workCell);let R=this._workCell.getWidth();if(R===0)continue;let O=!1,M=V>=ne,j=V,H=this._workCell;if(v.length>0&&V===v[0][0]&&M){let me=v.shift(),Ae=this._isCellInSelection(me[0],t);for(L=me[0]+1;L<me[1];L++)M&&(M=Ae===this._isCellInSelection(L,t));M&&(M=!i||a<me[0]||a>=me[1]),M?(O=!0,H=new L4(this._workCell,e.translateToString(!0,me[0],me[1]),me[1]-me[0]),j=me[1]-1,R=H.getWidth()):ne=me[1]}let F=this._isCellInSelection(V,t),T=i&&V===a,z=P&&V>=f&&V<=m,W=!1;this._decorationService.forEachDecorationAtCell(V,t,void 0,me=>{W=!0});let N=H.getChars()||Wr;if(N===" "&&(H.isUnderline()||H.isOverline())&&(N=" "),G=R*h-d.get(N,H.isBold(),H.isItalic()),!b)b=this._document.createElement("span");else if(E&&(F&&X||!F&&!X&&H.bg===k)&&(F&&X&&y.selectionForeground||H.fg===D)&&H.extended.ext===I&&z===B&&G===U&&!T&&!O&&!W&&M){H.isInvisible()?C+=Wr:C+=N,E++;continue}else E&&(b.textContent=C),b=this._document.createElement("span"),E=0,C="";if(k=H.bg,D=H.fg,I=H.extended.ext,B=z,U=G,X=F,O&&a>=V&&a<=j&&(a=V),!this._coreService.isCursorHidden&&T&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)c&&q.push("xterm-cursor-blink"),q.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){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(H.isBold()&&q.push("xterm-bold"),H.isItalic()&&q.push("xterm-italic"),H.isDim()&&q.push("xterm-dim"),H.isInvisible()?C=Wr:C=H.getChars()||Wr,H.isUnderline()&&(q.push(`xterm-underline-${H.extended.underlineStyle}`),C===" "&&(C=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${Ra.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let me=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&me<8&&(me+=8),b.style.textDecorationColor=y.ansi[me].css}H.isOverline()&&(q.push("xterm-overline"),C===" "&&(C=" ")),H.isStrikethrough()&&q.push("xterm-strikethrough"),z&&(b.style.textDecoration="underline");let ee=H.getFgColor(),ce=H.getFgColorMode(),oe=H.getBgColor(),fe=H.getBgColorMode(),he=!!H.isInverse();if(he){let me=ee;ee=oe,oe=me;let Ae=ce;ce=fe,fe=Ae}let pe,Ce,xe=!1;this._decorationService.forEachDecorationAtCell(V,t,void 0,me=>{me.options.layer!=="top"&&xe||(me.backgroundColorRGB&&(fe=50331648,oe=me.backgroundColorRGB.rgba>>8&16777215,pe=me.backgroundColorRGB),me.foregroundColorRGB&&(ce=50331648,ee=me.foregroundColorRGB.rgba>>8&16777215,Ce=me.foregroundColorRGB),xe=me.options.layer==="top")}),!xe&&F&&(pe=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,oe=pe.rgba>>8&16777215,fe=50331648,xe=!0,y.selectionForeground&&(ce=50331648,ee=y.selectionForeground.rgba>>8&16777215,Ce=y.selectionForeground)),xe&&q.push("xterm-decoration-top");let Se;switch(fe){case 16777216:case 33554432:Se=y.ansi[oe],q.push(`xterm-bg-${oe}`);break;case 50331648:Se=Rt.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(b,`background-color:#${F1((oe>>>0).toString(16),"0",6)}`);break;case 0:default:he?(Se=y.foreground,q.push("xterm-bg-257")):Se=y.background}switch(pe||H.isDim()&&(pe=ct.multiplyOpacity(Se,.5)),ce){case 16777216:case 33554432:H.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(b,Se,y.ansi[ee],H,pe,void 0)||q.push(`xterm-fg-${ee}`);break;case 50331648:let me=Rt.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(b,Se,me,H,pe,Ce)||this._addStyle(b,`color:#${F1(ee.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,Se,y.foreground,H,pe,Ce)||he&&q.push("xterm-fg-257")}q.length&&(b.className=q.join(" "),q.length=0),!T&&!O&&!W&&M?E++:b.textContent=C,G!==this.defaultSpacing&&(b.style.letterSpacing=`${G}px`),g.push(b),V=j}return b&&E&&(b.textContent=C),g}_applyMinimumContrast(e,t,i,r,l,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||H4(r.getCode()))return!1;let c=this._getContrastCache(r),h;if(!l&&!a&&(h=c.getColor(t.rgba,i.rgba)),h===void 0){let d=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=ct.ensureContrastRatio(l||t,a||i,d),c.setColor((l||t).rgba,(a||i).rgba,h??null)}return h?(this._addStyle(e,`color:${h.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 i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};hg=yt([ve(1,hw),ve(2,ci),ve(3,lr),ve(4,Rs),ve(5,Ba),ve(6,Pl)],hg);function F1(e,t,i){for(;e.length<i;)e=t+e;return e}var P4=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[i,r,l,a],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(l),this._container.appendChild(a),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,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let c=this._measure(e,0);return c>0&&(this._flat[r]=c),c}let l=e;t&&(l+="B"),i&&(l+="I");let a=this._holey.get(l);if(a===void 0){let c=0;t&&(c|=1),i&&(c|=2),a=this._measure(e,c),a>0&&this._holey.set(l,a)}return a}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},I4=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,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let l=e.buffers.active.ydisp,a=t[1]-l,c=i[1]-l,h=Math.max(a,0),d=Math.min(c,e.rows-1);if(h>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=c,this.viewportCappedStartRow=h,this.viewportCappedEndRow=d,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function U4(){return new I4}var ap="xterm-dom-renderer-owner-",$i="xterm-rows",yu="xterm-fg-",Y1="xterm-bg-",qo="xterm-focus",Su="xterm-selection",q4=1,fg=class extends je{constructor(e,t,i,r,l,a,c,h,d,f,m,g,v,y){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=l,this._helperContainer=a,this._linkifier2=c,this._charSizeService=d,this._optionsService=f,this._bufferService=m,this._coreService=g,this._coreBrowserService=v,this._themeService=y,this._terminalClass=q4++,this._rowElements=[],this._selectionRenderModel=U4(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add($i),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(Su),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=j4(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(hg,document),this._element.classList.add(ap+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(ft(()=>{this._element.classList.remove(ap+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new P4(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${$i} 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} .${$i} { 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} .${$i} .xterm-dim { color: ${ct.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 i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${$i}.${qo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${$i}.${qo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${$i}.${qo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${$i} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${$i} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${$i} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${$i} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${$i} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Su} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Su} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Su} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,c]of e.ansi.entries())t+=`${this._terminalSelector} .${yu}${a} { color: ${c.css}; }${this._terminalSelector} .${yu}${a}.xterm-dim { color: ${ct.multiplyOpacity(c,.5).css}; }${this._terminalSelector} .${Y1}${a} { background-color: ${c.css}; }`;t+=`${this._terminalSelector} .${yu}257 { color: ${ct.opaque(e.background).css}; }${this._terminalSelector} .${yu}257.xterm-dim { color: ${ct.multiplyOpacity(ct.opaque(e.background),.5).css}; }${this._terminalSelector} .${Y1}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 i=this._rowElements.length;i<=t;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}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(qo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(qo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,c=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(i){let d=e[0]>t[0];h.appendChild(this._createSelectionElement(a,d?t[0]:e[0],d?e[0]:t[0],c-a+1))}else{let d=r===a?e[0]:0,f=a===l?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(a,d,f));let m=c-a-1;if(h.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,m)),a!==c){let g=l===c?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(c,0,g))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,i,r=1){let l=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,c=this.dimensions.css.cell.width*(i-t);return a+c>this.dimensions.css.canvas.width&&(c=this.dimensions.css.canvas.width-a),l.style.height=`${r*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${a}px`,l.style.width=`${c}px`,l}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 i=this._bufferService.buffer,r=i.ybase+i.y,l=Math.min(i.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,c=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=t;d++){let f=d+i.ydisp,m=this._rowElements[d],g=i.lines.get(f);if(!m||!g)break;m.replaceChildren(...this._rowFactory.createRow(g,f,f===r,c,h,l,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ap}${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,i,r,l,a){i<0&&(e=0),r<0&&(t=0);let c=this._bufferService.rows-1;i=Math.max(Math.min(i,c),0),r=Math.max(Math.min(r,c),0),l=Math.min(l,this._bufferService.cols);let h=this._bufferService.buffer,d=h.ybase+h.y,f=Math.min(h.x,l-1),m=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,v=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=i;y<=r;++y){let S=y+h.ydisp,b=this._rowElements[y],E=h.lines.get(S);if(!b||!E)break;b.replaceChildren(...this._rowFactory.createRow(E,S,S===d,g,v,f,m,this.dimensions.css.cell.width,this._widthCache,a?y===i?e:0:-1,a?(y===r?t:l)-1:-1))}}};fg=yt([ve(7,em),ve(8,yh),ve(9,ci),ve(10,ai),ve(11,Rs),ve(12,lr),ve(13,Pl)],fg);var dg=class extends je{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new F4(this._optionsService))}catch{this._measureStrategy=this._register(new V4(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())}};dg=yt([ve(2,ci)],dg);var Aw=class extends je{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)}},V4=class extends Aw{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},F4=class extends Aw{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}},Y4=class extends je{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new W4(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Qt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(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}},W4=class extends je{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new jl),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ft(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(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)}},$4=class extends je{constructor(){super(),this.linkProviders=[],this._register(ft(()=>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 am(e,t,i){let r=i.getBoundingClientRect(),l=e.getComputedStyle(i),a=parseInt(l.getPropertyValue("padding-left")),c=parseInt(l.getPropertyValue("padding-top"));return[t.clientX-r.left-a,t.clientY-r.top-c]}function X4(e,t,i,r,l,a,c,h,d){if(!a)return;let f=am(e,t,i);if(f)return f[0]=Math.ceil((f[0]+(d?c/2:0))/c),f[1]=Math.ceil(f[1]/h),f[0]=Math.min(Math.max(f[0],1),r+(d?1:0)),f[1]=Math.min(Math.max(f[1],1),l),f}var pg=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,l){return X4(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,t){let i=am(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};pg=yt([ve(0,or),ve(1,yh)],pg);var K4=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,i){this._rowCount=i,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=[]}},Dw={};sD(Dw,{getSafariVersion:()=>Z4,isChromeOS:()=>zw,isFirefox:()=>Rw,isIpad:()=>Q4,isIphone:()=>J4,isLegacyEdge:()=>G4,isLinux:()=>cm,isMac:()=>Zu,isNode:()=>Sh,isSafari:()=>Bw,isWindows:()=>Lw});var Sh=typeof process<"u"&&"title"in process,La=Sh?"node":navigator.userAgent,za=Sh?"node":navigator.platform,Rw=La.includes("Firefox"),G4=La.includes("Edge"),Bw=/^((?!chrome|android).)*safari/i.test(La);function Z4(){if(!Bw)return 0;let e=La.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Zu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(za),Q4=za==="iPad",J4=za==="iPhone",Lw=["Windows","Win16","Win32","WinCE"].includes(za),cm=za.indexOf("Linux")>=0,zw=/\bCrOS\b/.test(La),Ow=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,i=0,r=e.timeRemaining(),l=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),l=e.timeRemaining(),i*1.5>l){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=l}this.clear()}},eR=class extends Ow{_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())}}},tR=class extends Ow{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Qu=!Sh&&"requestIdleCallback"in window?tR:eR,iR=class{constructor(){this._queue=new Qu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},gg=class extends je{constructor(e,t,i,r,l,a,c,h,d){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=l,this._coreBrowserService=h,this._renderer=this._register(new jl),this._pausedResizeTask=new iR,this._observerDisposable=this._register(new jl),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 _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new K4((f,m)=>this._renderRows(f,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new nR(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ft(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(c.onResize(()=>this._fullRefresh())),this._register(c.buffers.onBufferActivate(()=>{var f;return(f=this._renderer.value)==null?void 0:f.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.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(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=ft(()=>i.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,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),i||(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 i;return(i=this._renderer.value)==null?void 0:i.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,i){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};gg=yt([ve(2,ci),ve(3,yh),ve(4,Rs),ve(5,Ba),ve(6,ai),ve(7,lr),ve(8,Pl)],gg);var nR=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 rR(e,t,i,r){let l=i.buffer.x,a=i.buffer.y;if(!i.buffer.hasScrollback)return oR(l,a,e,t,i,r)+bh(a,t,i,r)+aR(l,a,e,t,i,r);let c;if(a===t)return c=l>e?"D":"C",ba(Math.abs(l-e),Sa(c,r));c=a>t?"D":"C";let h=Math.abs(a-t),d=lR(a>t?e:l,i)+(h-1)*i.cols+1+sR(a>t?l:e);return ba(d,Sa(c,r))}function sR(e,t){return e-1}function lR(e,t){return t.cols-e}function oR(e,t,i,r,l,a){return bh(t,r,l,a).length===0?"":ba(jw(e,t,e,t-Ds(t,l),!1,l).length,Sa("D",a))}function bh(e,t,i,r){let l=e-Ds(e,i),a=t-Ds(t,i),c=Math.abs(l-a)-cR(e,t,i);return ba(c,Sa(Hw(e,t),r))}function aR(e,t,i,r,l,a){let c;bh(t,r,l,a).length>0?c=r-Ds(r,l):c=t;let h=r,d=uR(e,t,i,r,l,a);return ba(jw(e,c,i,h,d==="C",l).length,Sa(d,a))}function cR(e,t,i){var c;let r=0,l=e-Ds(e,i),a=t-Ds(t,i);for(let h=0;h<Math.abs(l-a);h++){let d=Hw(e,t)==="A"?-1:1;(c=i.buffer.lines.get(l+d*h))!=null&&c.isWrapped&&r++}return r}function Ds(e,t){let i=0,r=t.buffer.lines.get(e),l=r==null?void 0:r.isWrapped;for(;l&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),l=r==null?void 0:r.isWrapped;return i}function uR(e,t,i,r,l,a){let c;return bh(i,r,l,a).length>0?c=r-Ds(r,l):c=t,e<i&&c<=r||e>=i&&c<r?"C":"D"}function Hw(e,t){return e>t?"A":"B"}function jw(e,t,i,r,l,a){let c=e,h=t,d="";for(;(c!==i||h!==r)&&h>=0&&h<a.buffer.lines.length;)c+=l?1:-1,l&&c>a.cols-1?(d+=a.buffer.translateBufferLineToString(h,!1,e,c),c=0,e=0,h++):!l&&c<0&&(d+=a.buffer.translateBufferLineToString(h,!1,0,e+1),c=a.cols-1,e=c,h--);return d+a.buffer.translateBufferLineToString(h,!1,e,c)}function Sa(e,t){let i=t?"O":"[";return ue.ESC+i+e}function ba(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var hR=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 W1(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 cp=50,fR=15,dR=50,pR=500,gR=" ",mR=new RegExp(gR,"g"),mg=class extends je{constructor(e,t,i,r,l,a,c,h,d){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=l,this._mouseService=a,this._optionsService=c,this._renderService=h,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Zi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new hR(this._bufferService),this._activeSelectionMode=0,this._register(ft(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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 i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let l=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let c=e[1];c<=t[1];c++){let h=i.translateBufferLineToString(c,!0,l,a);r.push(h)}}else{let l=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],l));for(let a=e[1]+1;a<=t[1]-1;a++){let c=i.lines.get(a),h=i.translateBufferLineToString(a,!0);c!=null&&c.isWrapped?r[r.length-1]+=h:r.push(h)}if(e[1]!==t[1]){let a=i.lines.get(t[1]),c=i.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?r[r.length-1]+=c:r.push(c)}}return r.map(l=>l.replace(mR," ")).join(Lw?`\r
93
+ `:`
94
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),cm&&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),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var l,a;let i=(a=(l=this._linkifier.currentLink)==null?void 0:l.link)==null?void 0:a.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=W1(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,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=am(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-cp),cp),t/=cp,t/Math.abs(t)+Math.round(t*(fR-1)))}shouldForceSelection(e){return Zu?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(),dR)}_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&&!(Zu&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.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<pR&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=rR(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let l=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:l>1&&t!==r&&(i+=l-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,a=l.lines.get(e[1]);if(!a)return;let c=l.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(a,e[0]),d=h,f=e[0]-h,m=0,g=0,v=0,y=0;if(c.charAt(h)===" "){for(;h>0&&c.charAt(h-1)===" ";)h--;for(;d<c.length&&c.charAt(d+1)===" ";)d++}else{let E=e[0],C=e[0];a.getWidth(E)===0&&(m++,E--),a.getWidth(C)===2&&(g++,C++);let L=a.getString(C).length;for(L>1&&(y+=L-1,d+=L-1);E>0&&h>0&&!this._isCharWordSeparator(a.loadCell(E-1,this._workCell));){a.loadCell(E-1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,E--):k>1&&(v+=k-1,h-=k-1),h--,E--}for(;C<a.length&&d+1<c.length&&!this._isCharWordSeparator(a.loadCell(C+1,this._workCell));){a.loadCell(C+1,this._workCell);let k=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,C++):k>1&&(y+=k-1,d+=k-1),d++,C++}}d++;let S=h+f-m+v,b=Math.min(this._bufferService.cols,d-h+m+g-v-y);if(!(!t&&c.slice(h,d).trim()==="")){if(i&&S===0&&a.getCodePoint(0)!==32){let E=l.lines.get(e[1]-1);if(E&&a.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let L=this._bufferService.cols-C.start;S-=L,b+=L}}}if(r&&S+b===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let E=l.lines.get(e[1]+1);if(E!=null&&E.isWrapped&&E.getCodePoint(0)!==32){let C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(b+=C.length)}}return{start:S,length:b}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=W1(i,this._bufferService.cols)}};mg=yt([ve(3,ai),ve(4,Rs),ve(5,tm),ve(6,ci),ve(7,or),ve(8,lr)],mg);var $1=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},X1=class{constructor(){this._color=new $1,this._css=new $1}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ht=Object.freeze((()=>{let e=[gt.toColor("#2e3436"),gt.toColor("#cc0000"),gt.toColor("#4e9a06"),gt.toColor("#c4a000"),gt.toColor("#3465a4"),gt.toColor("#75507b"),gt.toColor("#06989a"),gt.toColor("#d3d7cf"),gt.toColor("#555753"),gt.toColor("#ef2929"),gt.toColor("#8ae234"),gt.toColor("#fce94f"),gt.toColor("#729fcf"),gt.toColor("#ad7fa8"),gt.toColor("#34e2e2"),gt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],l=t[i/6%6|0],a=t[i%6];e.push({css:Rt.toCss(r,l,a),rgba:Rt.toRgba(r,l,a)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Rt.toCss(r,r,r),rgba:Rt.toRgba(r,r,r)})}return e})()),ys=gt.toColor("#ffffff"),ea=gt.toColor("#000000"),K1=gt.toColor("#ffffff"),G1=ea,Vo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},_R=ys,_g=class extends je{constructor(e){super(),this._optionsService=e,this._contrastCache=new X1,this._halfContrastCache=new X1,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ys,background:ea,cursor:K1,cursorAccent:G1,selectionForeground:void 0,selectionBackgroundTransparent:Vo,selectionBackgroundOpaque:ct.blend(ea,Vo),selectionInactiveBackgroundTransparent:Vo,selectionInactiveBackgroundOpaque:ct.blend(ea,Vo),scrollbarSliderBackground:ct.opacity(ys,.2),scrollbarSliderHoverBackground:ct.opacity(ys,.4),scrollbarSliderActiveBackground:ct.opacity(ys,.5),overviewRulerBorder:ys,ansi:Ht.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=nt(e.foreground,ys),t.background=nt(e.background,ea),t.cursor=ct.blend(t.background,nt(e.cursor,K1)),t.cursorAccent=ct.blend(t.background,nt(e.cursorAccent,G1)),t.selectionBackgroundTransparent=nt(e.selectionBackground,Vo),t.selectionBackgroundOpaque=ct.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=nt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ct.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?nt(e.selectionForeground,V1):void 0,t.selectionForeground===V1&&(t.selectionForeground=void 0),ct.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ct.opacity(t.selectionBackgroundTransparent,.3)),ct.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ct.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=nt(e.scrollbarSliderBackground,ct.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=nt(e.scrollbarSliderHoverBackground,ct.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=nt(e.scrollbarSliderActiveBackground,ct.opacity(t.foreground,.5)),t.overviewRulerBorder=nt(e.overviewRulerBorder,_R),t.ansi=Ht.slice(),t.ansi[0]=nt(e.black,Ht[0]),t.ansi[1]=nt(e.red,Ht[1]),t.ansi[2]=nt(e.green,Ht[2]),t.ansi[3]=nt(e.yellow,Ht[3]),t.ansi[4]=nt(e.blue,Ht[4]),t.ansi[5]=nt(e.magenta,Ht[5]),t.ansi[6]=nt(e.cyan,Ht[6]),t.ansi[7]=nt(e.white,Ht[7]),t.ansi[8]=nt(e.brightBlack,Ht[8]),t.ansi[9]=nt(e.brightRed,Ht[9]),t.ansi[10]=nt(e.brightGreen,Ht[10]),t.ansi[11]=nt(e.brightYellow,Ht[11]),t.ansi[12]=nt(e.brightBlue,Ht[12]),t.ansi[13]=nt(e.brightMagenta,Ht[13]),t.ansi[14]=nt(e.brightCyan,Ht[14]),t.ansi[15]=nt(e.brightWhite,Ht[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=nt(e.extendedAnsi[r],Ht[r+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()}}};_g=yt([ve(0,ci)],_g);function nt(e,t){if(e!==void 0)try{return gt.toColor(e)}catch{}return t}var vR=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},yR=class{constructor(){this._services=new vR,this._services.set(em,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=fD(e).sort((a,c)=>a.index-c.index),r=[];for(let a of i){let c=this._services.get(a.id);if(!c)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);r.push(c)}let l=i.length>0?i[0].index:t.length;if(t.length!==l)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${l+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},SR={trace:0,debug:1,info:2,warn:3,error:4,off:5},bR="xterm.js: ",vg=class extends je{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=SR[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":bR)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};vg=yt([ve(0,ci)],vg);var Z1=class extends je{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let l=t-1;l>=0;l--)this.set(e+l+i,this.get(e+l));let r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},He=3,Dt=Object.freeze(new Ra),bu=0,up=2,ta=class Pw{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*He);let l=i||Zi.fromCharData([0,rw,1,0]);for(let a=0;a<t;++a)this.setCell(a,l);this.length=t}get(t){let i=this._data[t*He+0],r=i&2097151;return[this._data[t*He+1],i&2097152?this._combined[t]:r?Fr(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*He+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*He+0]=t|2097152|i[2]<<22):this._data[t*He+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*He+0]>>22}hasWidth(t){return this._data[t*He+0]&12582912}getFg(t){return this._data[t*He+1]}getBg(t){return this._data[t*He+2]}hasContent(t){return this._data[t*He+0]&4194303}getCodePoint(t){let i=this._data[t*He+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*He+0]&2097152}getString(t){let i=this._data[t*He+0];return i&2097152?this._combined[t]:i&2097151?Fr(i&2097151):""}isProtected(t){return this._data[t*He+2]&536870912}loadCell(t,i){return bu=t*He,i.content=this._data[bu+0],i.fg=this._data[bu+1],i.bg=this._data[bu+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*He+0]=i.content,this._data[t*He+1]=i.fg,this._data[t*He+2]=i.bg}setCellFromCodepoint(t,i,r,l){l.bg&268435456&&(this._extendedAttrs[t]=l.extended),this._data[t*He+0]=i|r<<22,this._data[t*He+1]=l.fg,this._data[t*He+2]=l.bg}addCodepointToCell(t,i,r){let l=this._data[t*He+0];l&2097152?this._combined[t]+=Fr(i):l&2097151?(this._combined[t]=Fr(l&2097151)+Fr(i),l&=-2097152,l|=2097152):l=i|1<<22,r&&(l&=-12582913,l|=r<<22),this._data[t*He+0]=l}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let l=new Zi;for(let a=this.length-t-i-1;a>=0;--a)this.setCell(t+i+a,this.loadCell(t+a,l));for(let a=0;a<i;++a)this.setCell(t+a,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let l=new Zi;for(let a=0;a<this.length-t-i;++a)this.setCell(t+a,this.loadCell(t+i+a,l));for(let a=this.length-i;a<this.length;++a)this.setCell(a,r)}else for(let l=t;l<this.length;++l)this.setCell(l,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,l=!1){if(l){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*up<this._data.buffer.byteLength;let r=t*He;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let l=new Uint32Array(r);l.set(this._data),this._data=l}for(let l=this.length;l<t;++l)this.setCell(l,i)}else{this._data=this._data.subarray(0,r);let l=Object.keys(this._combined);for(let c=0;c<l.length;c++){let h=parseInt(l[c],10);h>=t&&delete this._combined[h]}let a=Object.keys(this._extendedAttrs);for(let c=0;c<a.length;c++){let h=parseInt(a[c],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,r*4*up<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*up<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,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 i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new Pw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303)return t+(this._data[t*He+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*He+0]&4194303||this._data[t*He+2]&50331648)return t+(this._data[t*He+0]>>22);return 0}copyCellsFrom(t,i,r,l,a){let c=t._data;if(a)for(let d=l-1;d>=0;d--){for(let f=0;f<He;f++)this._data[(r+d)*He+f]=c[(i+d)*He+f];c[(i+d)*He+2]&268435456&&(this._extendedAttrs[r+d]=t._extendedAttrs[i+d])}else for(let d=0;d<l;d++){for(let f=0;f<He;f++)this._data[(r+d)*He+f]=c[(i+d)*He+f];c[(i+d)*He+2]&268435456&&(this._extendedAttrs[r+d]=t._extendedAttrs[i+d])}let h=Object.keys(t._combined);for(let d=0;d<h.length;d++){let f=parseInt(h[d],10);f>=i&&(this._combined[f-i+r]=t._combined[f])}}translateToString(t,i,r,l){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),l&&(l.length=0);let a="";for(;i<r;){let c=this._data[i*He+0],h=c&2097151,d=c&2097152?this._combined[i]:h?Fr(h):Wr;if(a+=d,l)for(let f=0;f<d.length;++f)l.push(i);i+=c>>22||1}return l&&l.push(i),a}};function xR(e,t,i,r,l,a){let c=[];for(let h=0;h<e.length-1;h++){let d=h,f=e.get(++d);if(!f.isWrapped)continue;let m=[e.get(h)];for(;d<e.length&&f.isWrapped;)m.push(f),f=e.get(++d);if(!a&&r>=h&&r<d){h+=m.length-1;continue}let g=0,v=xa(m,g,t),y=1,S=0;for(;y<m.length;){let E=xa(m,y,t),C=E-S,L=i-v,k=Math.min(C,L);m[g].copyCellsFrom(m[y],S,v,k,!1),v+=k,v===i&&(g++,v=0),S+=k,S===E&&(y++,S=0),v===0&&g!==0&&m[g-1].getWidth(i-1)===2&&(m[g].copyCellsFrom(m[g-1],i-1,v++,1,!1),m[g-1].setCell(i-1,l))}m[g].replaceCells(v,i,l);let b=0;for(let E=m.length-1;E>0&&(E>g||m[E].getTrimmedLength()===0);E--)b++;b>0&&(c.push(h+m.length-b),c.push(b)),h+=m.length-1}return c}function wR(e,t){let i=[],r=0,l=t[r],a=0;for(let c=0;c<e.length;c++)if(l===c){let h=t[++r];e.onDeleteEmitter.fire({index:c-a,amount:h}),c+=h-1,a+=h,l=t[++r]}else i.push(c);return{layout:i,countRemoved:a}}function CR(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function ER(e,t,i){let r=[],l=e.map((d,f)=>xa(e,f,t)).reduce((d,f)=>d+f),a=0,c=0,h=0;for(;h<l;){if(l-h<i){r.push(l-h);break}a+=i;let d=xa(e,c,t);a>d&&(a-=d,c++);let f=e[c].getWidth(a-1)===2;f&&a--;let m=f?i-1:i;r.push(m),h+=m}return r}function xa(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,l=e[t+1].getWidth(0)===2;return r&&l?i-1:i}var Iw=class Uw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Uw._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),As(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Iw._nextId=1;var kR=Iw,Pt={},Ss=Pt.B;Pt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Pt.A={"#":"£"};Pt.B=void 0;Pt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Pt.C=Pt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Pt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Pt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Pt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Pt.E=Pt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Pt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Pt.H=Pt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Pt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Q1=4294967295,J1=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Dt.clone(),this.savedCharset=Ss,this.markers=[],this._nullCell=Zi.fromCharData([0,rw,1,0]),this._whitespaceCell=Zi.fromCharData([0,Wr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Qu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Z1(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 Xu),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 Xu),this._whitespaceCell}getBlankLine(e,t){return new ta(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>Q1?Q1:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Dt);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 Z1(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Dt),r=0,l=this._getCorrectBufferLength(t);if(l>this.lines.maxLength&&(this.lines.maxLength=l),this.lines.length>0){if(this._cols<e)for(let c=0;c<this.lines.length;c++)r+=+this.lines.get(c).resize(e,i);let a=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 ta(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new ta(e,i)));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(l<this.lines.maxLength){let c=this.lines.length-l;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=l}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),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 a=0;a<this.lines.length;a++)r+=+this.lines.get(a).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.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 i=this._optionsService.rawOptions.reflowCursorLine,r=xR(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Dt),i);if(r.length>0){let l=wR(this.lines,r);CR(this.lines,l.layout),this._reflowLargerAdjustViewport(e,t,l.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(Dt),l=i;for(;l-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ta(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Dt),l=[],a=0;for(let c=this.lines.length-1;c>=0;c--){let h=this.lines.get(c);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let d=[h];for(;h.isWrapped&&c>0;)h=this.lines.get(--c),d.unshift(h);if(!i){let k=this.ybase+this.y;if(k>=c&&k<c+d.length)continue}let f=d[d.length-1].getTrimmedLength(),m=ER(d,this._cols,e),g=m.length-d.length,v;this.ybase===0&&this.y!==this.lines.length-1?v=Math.max(0,this.y-this.lines.maxLength+g):v=Math.max(0,this.lines.length-this.lines.maxLength+g);let y=[];for(let k=0;k<g;k++){let D=this.getBlankLine(Dt,!0);y.push(D)}y.length>0&&(l.push({start:c+d.length+a,newLines:y}),a+=y.length),d.push(...y);let S=m.length-1,b=m[S];b===0&&(S--,b=m[S]);let E=d.length-g-1,C=f;for(;E>=0;){let k=Math.min(C,b);if(d[S]===void 0)break;if(d[S].copyCellsFrom(d[E],C-k,b-k,k,!0),b-=k,b===0&&(S--,b=m[S]),C-=k,C===0){E--;let D=Math.max(E,0);C=xa(d,D,this._cols)}}for(let k=0;k<d.length;k++)m[k]<e&&d[k].setCell(m[k],r);let L=g-v;for(;L-- >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+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(l.length>0){let c=[],h=[];for(let b=0;b<this.lines.length;b++)h.push(this.lines.get(b));let d=this.lines.length,f=d-1,m=0,g=l[m];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let v=0;for(let b=Math.min(this.lines.maxLength-1,d+a-1);b>=0;b--)if(g&&g.start>f+v){for(let E=g.newLines.length-1;E>=0;E--)this.lines.set(b--,g.newLines[E]);b++,c.push({index:f+1,amount:g.newLines.length}),v+=g.newLines.length,g=l[++m]}else this.lines.set(b,h[f--]);let y=0;for(let b=c.length-1;b>=0;b--)c[b].index+=y,this.lines.onInsertEmitter.fire(c[b]),y+=c[b].amount;let S=Math.max(0,d+a-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,i=0,r){let l=this.lines.get(e);return l?l.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 kR(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},MR=class extends je{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),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 J1(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new J1(!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)}},qw=2,Vw=1,yg=class extends je{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,qw),this.rows=Math.max(e.rawOptions.rows||0,Vw),this.buffers=this._register(new MR(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let l=i.ybase+i.scrollTop,a=i.ybase+i.scrollBottom;if(i.scrollTop===0){let c=i.lines.isFull;a===i.lines.length-1?c?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(a+1,0,r.clone()),c?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let c=a-l+1;i.lines.shiftElements(l+1,c-1,-1),i.lines.set(a,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};yg=yt([ve(0,ci)],yg);var bl={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:Zu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},TR=["normal","bold","100","200","300","400","500","600","700","800","900"],NR=class extends je{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...bl};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(ft(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in bl))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in bl))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=bl[e]),!AR(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=bl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=TR.includes(t)?t:bl[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 AR(e){return e==="block"||e==="underline"||e==="bar"}function ia(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&ia(e[r],t-1);return i}var eS=Object.freeze({insertMode:!1}),tS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Sg=class extends je{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ia(eS),this.decPrivateModes=ia(tS)}reset(){this.modes=ia(eS),this.decPrivateModes=ia(tS)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.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))}};Sg=yt([ve(0,ai),ve(1,cw),ve(2,ci)],Sg);var iS={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 hp(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var fp=String.fromCharCode,nS={DEFAULT:e=>{let t=[hp(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${fp(t[0])}${fp(t[1])}${fp(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${hp(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${hp(e,!0)};${e.x};${e.y}${t}`}},bg=class extends je{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(iS))this.addProtocol(r,iS[r]);for(let r of Object.keys(nS))this.addEncoding(r,nS[r]);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,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let r=t/i,l=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(l/=r+0,Math.abs(e.deltaY)<50&&(l*=.3),this._wheelPartialScroll+=l,l=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(l*=this._bufferService.rows),l}_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,i){if(i){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)}};bg=yt([ve(0,ai),ve(1,Rs),ve(2,ci)],bg);var dp=[[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]],DR=[[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]],jt;function RR(e,t){let i=0,r=t.length-1,l;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(l=i+r>>1,e>t[l][1])i=l+1;else if(e<t[l][0])r=l-1;else return!0;return!1}var BR=class{constructor(){if(this.version="6",!jt){jt=new Uint8Array(65536),jt.fill(1),jt[0]=0,jt.fill(0,1,32),jt.fill(0,127,160),jt.fill(2,4352,4448),jt[9001]=2,jt[9002]=2,jt.fill(2,11904,42192),jt[12351]=1,jt.fill(2,44032,55204),jt.fill(2,63744,64256),jt.fill(2,65040,65050),jt.fill(2,65072,65136),jt.fill(2,65280,65377),jt.fill(2,65504,65511);for(let e=0;e<dp.length;++e)jt.fill(0,dp[e][0],dp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?jt[e]:RR(e,DR)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let l=xs.extractWidth(t);l===0?r=!1:l>i&&(i=l)}return xs.createPropertyValue(0,i,r)}},xs=class zu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new BR;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,i,r=!1){return(t&16777215)<<3|(i&3)<<1|(r?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 i=0,r=0,l=t.length;for(let a=0;a<l;++a){let c=t.charCodeAt(a);if(55296<=c&&c<=56319){if(++a>=l)return i+this.wcwidth(c);let f=t.charCodeAt(a);56320<=f&&f<=57343?c=(c-55296)*1024+f-56320+65536:i+=this.wcwidth(f)}let h=this.charProperties(c,r),d=zu.extractWidth(h);zu.extractShouldJoin(h)&&(d-=zu.extractWidth(r)),i+=d,r=h}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},LR=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 rS(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Fo=2147483647,zR=256,Fw=class xg{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>zR)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new xg;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let l=t[r];if(Array.isArray(l))for(let a=0;a<l.length;++a)i.addSubParam(l[a]);else i.addParam(l)}return i}clone(){let t=new xg(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 i=0;i<this.length;++i){t.push(this.params[i]);let r=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;l-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,l))}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>Fo?Fo: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>Fo?Fo:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;l-r>0&&(t[i]=this._subParams.slice(r,l))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,l=r[i-1];r[i-1]=~l?Math.min(l*10+t,Fo):t}},Yo=[],OR=class{constructor(){this._state=0,this._active=Yo,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=Yo}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=Yo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Yo,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",vh(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Yo,this._id=-1,this._state=0}}},Li=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=vh(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},Wo=[],HR=class{constructor(){this._handlers=Object.create(null),this._active=Wo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Wo}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=Wo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Wo,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",vh(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,l=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,l=this._stack.fallThrough,this._stack.paused=!1),!l&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Wo,this._ident=0}},na=new Fw;na.addParam(0);var sS=class{constructor(e){this._handler=e,this._data="",this._params=na,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():na,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=vh(e,t,i),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(i=>(this._params=na,this._data="",this._hitLimit=!1,i));return this._params=na,this._data="",this._hitLimit=!1,t}},jR=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let l=0;l<e.length;l++)this.table[t<<8|e[l]]=i<<4|r}},Ki=160,PR=(function(){let e=new jR(4095),t=Array.apply(null,Array(256)).map((h,d)=>d),i=(h,d)=>t.slice(h,d),r=i(32,127),l=i(0,24);l.push(25),l.push.apply(l,i(28,32));let a=i(0,14),c;e.setDefault(1,0),e.addMany(r,0,2,0);for(c in a)e.addMany([24,26,153,154],c,3,0),e.addMany(i(128,144),c,3,0),e.addMany(i(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(l,0,3,0),e.addMany(l,1,3,1),e.add(127,1,0,1),e.addMany(l,8,0,8),e.addMany(l,3,3,3),e.add(127,3,0,3),e.addMany(l,4,3,4),e.add(127,4,0,4),e.addMany(l,6,3,6),e.addMany(l,5,3,5),e.add(127,5,0,5),e.addMany(l,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(l,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(l,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(l,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(l,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(l,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(l,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Ki,0,2,0),e.add(Ki,8,5,8),e.add(Ki,6,0,6),e.add(Ki,11,0,11),e.add(Ki,13,13,13),e})(),IR=class extends je{constructor(e=PR){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 Fw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},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(ft(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new OR),this._dcsParser=this._register(new HR),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>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 l=0;l<e.intermediates.length;++l){let a=e.intermediates.charCodeAt(l);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let l=r.indexOf(t);l!==-1&&r.splice(l,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,i,r,l){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=l}parse(e,t,i){let r=0,l=0,a=0,c;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&d>-1){for(;d>=0&&(c=h[d](this._params),c!==!0);d--)if(c instanceof Promise)return this._parseStack.handlerPos=d,c}this._parseStack.handlers=[];break;case 4:if(i===!1&&d>-1){for(;d>=0&&(c=h[d](),c!==!0);d--)if(c instanceof Promise)return this._parseStack.handlerPos=d,c}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],c=this._dcsParser.unhook(r!==24&&r!==26,i),c)return c;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],c=this._oscParser.end(r!==24&&r!==26,i),c)return c;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=a;h<t;++h){switch(r=e[h],l=this._transitions.table[this.currentState<<8|(r<160?r:Ki)],l>>4){case 2:for(let v=h+1;;++v){if(v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}if(++v>=t||(r=e[v])<32||r>126&&r<Ki){this._printHandler(e,h,v),h=v-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let d=this._csiHandlers[this._collect<<8|r],f=d?d.length-1:-1;for(;f>=0&&(c=d[f](this._params),c!==!0);f--)if(c instanceof Promise)return this._preserveStack(3,d,f,l,h),c;f<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++h<t&&(r=e[h])>47&&r<60);h--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let m=this._escHandlers[this._collect<<8|r],g=m?m.length-1:-1;for(;g>=0&&(c=m[g](),c!==!0);g--)if(c instanceof Promise)return this._preserveStack(4,m,g,l,h),c;g<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let v=h+1;;++v)if(v>=t||(r=e[v])===24||r===26||r===27||r>127&&r<Ki){this._dcsParser.put(e,h,v),h=v-1;break}break;case 14:if(c=this._dcsParser.unhook(r!==24&&r!==26),c)return this._preserveStack(6,[],0,l,h),c;r===27&&(l|=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 v=h+1;;v++)if(v>=t||(r=e[v])<32||r>127&&r<Ki){this._oscParser.put(e,h,v),h=v-1;break}break;case 6:if(c=this._oscParser.end(r!==24&&r!==26),c)return this._preserveStack(5,[],0,l,h),c;r===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},UR=/^([\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})$/,qR=/^[\da-f]+$/;function lS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=UR.exec(t);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),qR.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let l=0;l<3;++l){let a=parseInt(t.slice(i*l,i*l+i),16);r[l]=i===1?a<<4:i===2?a:i===3?a>>4:a>>8}return r}}function pp(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function VR(e,t=16){let[i,r,l]=e;return`rgb:${pp(i,t)}/${pp(r,t)}/${pp(l,t)}`}var FR={"(":0,")":1,"*":2,"+":3,"-":1,".":2},qr=131072,oS=10;function aS(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 cS=5e3,uS=0,YR=class extends je{constructor(e,t,i,r,l,a,c,h,d=new IR){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=l,this._oscLinkService=a,this._coreMouseService=c,this._unicodeService=h,this._parser=d,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new uD,this._utf8Decoder=new hD,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Dt.clone(),this._eraseAttrDataInternal=Dt.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),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 wg(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,m)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:m.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,m,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:m,data:g})}),this._parser.setDcsHandlerFallback((f,m,g)=>{m==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:m,payload:g})}),this._parser.setPrintHandler((f,m,g)=>this.print(f,m,g)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Bu.IND,()=>this.index()),this._parser.setExecuteHandler(Bu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Bu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Li(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Li(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Li(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Li(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Li(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Li(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Li(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Li(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Li(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Li(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Li(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Li(f=>this.restoreCursorColor(f))),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 f in Pt)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new sS((f,m)=>this.requestStatusString(f,m)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),cS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${cS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,l=this._activeBuffer.y,a=0,c=this._parseStack.paused;if(c){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,l=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>qr&&(a=this._parseStack.position+qr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<qr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,qr))),c||this._dirtyRowTracker.clearRange(),e.length>qr)for(let f=a;f<e.length;f+=qr){let m=f+qr<e.length?f+qr:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(f,m),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,m),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,g))return this._preserveStack(r,l,g,f),this._logSlowResolvingAsync(i),i}else if(!c){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,f))return this._preserveStack(r,l,f,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==l)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),d=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);d<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(d,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,i){let r,l,a=this._charsetService.charset,c=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,d=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,m=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let v=this._parser.precedingJoinState;for(let y=t;y<i;++y){if(r=e[y],r<127&&a){let C=a[String.fromCharCode(r)];C&&(r=C.charCodeAt(0))}let S=this._unicodeService.charProperties(r,v);l=xs.extractWidth(S);let b=xs.extractShouldJoin(S),E=b?xs.extractWidth(v):0;if(v=S,c&&this._onA11yChar.fire(Fr(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+l-E>h){if(d){let C=g,L=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),E>0&&g instanceof ta&&g.copyCellsFrom(C,L,0,E,!1);L<h;)C.setCellFromCodepoint(L++,0,1,m)}else if(this._activeBuffer.x=h-1,l===2)continue}if(b&&this._activeBuffer.x){let C=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-C,r,l);for(let L=l-E;--L>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(f&&(g.insertCells(this._activeBuffer.x,l-E,this._activeBuffer.getNullCell(m)),g.getWidth(h-1)===2&&g.setCellFromCodepoint(h-1,0,1,m)),g.setCellFromCodepoint(this._activeBuffer.x++,r,l,m),l>0)for(;--l;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=v,this._activeBuffer.x<h&&i-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,m),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>aS(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new sS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Li(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,i,r=!1,l=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),l),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,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 i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(l-1,1),this._activeBuffer.lines.splice(i,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 i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(i,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}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(Dt));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.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 i=e.params[0]||1,r=xs.extractWidth(t),l=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(l),c=new Uint32Array(a.length*i),h=0;for(let f=0;f<a.length;){let m=a.codePointAt(f)||0;c[h++]=m,f+=m>65535?2:1}let d=h;for(let f=1;f<i;++f)c.copyWithin(d,0,h),d+=h;return this.print(c,0,d),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.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,Ss),this._charsetService.setgCharset(1,Ss),this._charsetService.setgCharset(2,Ss),this._charsetService.setgCharset(3,Ss);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){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:a}=this._coreMouseService,c=this._coreService,{buffers:h,cols:d}=this._bufferService,{active:f,alt:m}=h,g=this._optionsService.rawOptions,v=(b,E)=>(c.triggerDataEvent(`${ue.ESC}[${t?"":"?"}${b};${E}$y`),!0),y=b=>b?1:2,S=e.params[0];return t?S===2?v(S,4):S===4?v(S,y(c.modes.insertMode)):S===12?v(S,3):S===20?v(S,y(g.convertEol)):v(S,0):S===1?v(S,y(r.applicationCursorKeys)):S===3?v(S,g.windowOptions.setWinLines?d===80?2:d===132?1:0:0):S===6?v(S,y(r.origin)):S===7?v(S,y(r.wraparound)):S===8?v(S,3):S===9?v(S,y(l==="X10")):S===12?v(S,y(g.cursorBlink)):S===25?v(S,y(!c.isCursorHidden)):S===45?v(S,y(r.reverseWraparound)):S===66?v(S,y(r.applicationKeypad)):S===67?v(S,4):S===1e3?v(S,y(l==="VT200")):S===1002?v(S,y(l==="DRAG")):S===1003?v(S,y(l==="ANY")):S===1004?v(S,y(r.sendFocus)):S===1005?v(S,4):S===1006?v(S,y(a==="SGR")):S===1015?v(S,4):S===1016?v(S,y(a==="SGR_PIXELS")):S===1048?v(S,1):S===47||S===1047||S===1049?v(S,y(f===m)):S===2004?v(S,y(r.bracketedPasteMode)):S===2026?v(S,y(r.synchronizedOutput)):v(S,0)}_updateAttrColor(e,t,i,r,l){return t===2?(e|=50331648,e&=-16777216,e|=Ra.fromColorRGB([i,r,l])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],l=0,a=0;do{if(r[a+l]=e.params[t+a],e.hasSubParams(t+a)){let c=e.getSubParams(t+a),h=0;do r[1]===5&&(l=1),r[a+h+1+l]=c[h];while(++h<c.length&&h+a+1+l<r.length);break}if(r[1]===5&&a+l>=2||r[1]===2&&a+l>=5)break;r[1]&&(l=1)}while(++a+t<e.length&&a+l<r.length);for(let c=2;c<r.length;++c)r[c]===-1&&(r[c]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_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=Dt.fg,e.bg=Dt.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,i,r=this._curAttrData;for(let l=0;l<t;l++)i=e.params[l],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(l)?e.getSubParams(l)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=Dt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Dt.bg&16777215):i===38||i===48||i===58?l+=this._extractColor(e,l,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=Dt.fg&16777215,r.bg&=-67108864,r.bg|=Dt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.ESC}[?${t};${i}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=Dt.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!aS(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(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>oS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>oS&&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=[],i=e.split(";");for(;i.length>1;){let r=i.shift(),l=i.shift();if(/^\d+$/.exec(r)){let a=parseInt(r);if(hS(a))if(l==="?")t.push({type:0,index:a});else{let c=lS(l);c&&t.push({type:1,index:a,color:c})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),r,l=i.findIndex(a=>a.startsWith("id="));return l!==-1&&(r=i[l].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,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 i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let l=lS(i[r]);l&&this._onColor.fire([{type:1,index:this._specialColors[t],color:l}])}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=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let l=parseInt(i[r]);hS(l)&&t.push({type:2,index:l})}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,Ss),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(FR[e[0]],Pt[e[1]]||Ss),!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=Dt.clone(),this._eraseAttrDataInternal=Dt.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 Zi;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 i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=c=>(this._coreService.triggerDataEvent(`${ue.ESC}${c}${ue.ESC}\\`),!0),r=this._bufferService.buffer,l=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[l.cursorStyle]-(l.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},wg=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&&(uS=e,e=t,t=uS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};wg=yt([ve(0,ai)],wg);function hS(e){return 0<=e&&e<256}var WR=5e7,fS=12,$R=50,XR=class extends je{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 _e),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>WR)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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],l=this._action(r,t);if(l){let c=h=>performance.now()-i>=fS?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(i,h);l.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(c);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=fS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>$R&&(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()}},Cg=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 h=t.addMarker(t.ybase+t.y),d={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._dataByLinkId.set(d.id,d),d.id}let i=e,r=this._getEntryIdKey(i),l=this._entriesWithId.get(r);if(l)return this.addLineToLink(l.id,t.ybase+t.y),l.id;let a=t.addMarker(t.ybase+t.y),c={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(c,a)),this._entriesWithId.set(c.key,c),this._dataByLinkId.set(c.id,c),c.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}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 i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Cg=yt([ve(0,ai)],Cg);var dS=!1,KR=class extends je{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new jl),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new yR,this.optionsService=this._register(new NR(e)),this._instantiationService.setService(ci,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(yg)),this._instantiationService.setService(ai,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(vg)),this._instantiationService.setService(cw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Sg)),this._instantiationService.setService(Rs,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(bg)),this._instantiationService.setService(aw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(xs)),this._instantiationService.setService(gD,this.unicodeService),this._charsetService=this._instantiationService.createInstance(LR),this._instantiationService.setService(pD,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Cg),this._instantiationService.setService(uw,this._oscLinkService),this._inputHandler=this._register(new YR(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Qt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Qt.forward(this._bufferService.onResize,this._onResize)),this._register(Qt.forward(this.coreService.onData,this._onData)),this._register(Qt.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 XR((t,i)=>this._inputHandler.parse(t,i))),this._register(Qt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),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&&!dS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),dS=!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,qw),t=Math.max(t,Vw),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(rS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(rS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ft(()=>{for(let t of e)t.dispose()})}}},GR={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 ZR(e,t,i,r){var c;let l={type:0,cancel:!1,key:void 0},a=(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?l.key=ue.ESC+"OA":l.key=ue.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?l.key=ue.ESC+"OD":l.key=ue.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?l.key=ue.ESC+"OC":l.key=ue.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?l.key=ue.ESC+"OB":l.key=ue.ESC+"[B");break;case 8:l.key=e.ctrlKey?"\b":ue.DEL,e.altKey&&(l.key=ue.ESC+l.key);break;case 9:if(e.shiftKey){l.key=ue.ESC+"[Z";break}l.key=ue.HT,l.cancel=!0;break;case 13:l.key=e.altKey?ue.ESC+ue.CR:ue.CR,l.cancel=!0;break;case 27:l.key=ue.ESC,e.altKey&&(l.key=ue.ESC+ue.ESC),l.cancel=!0;break;case 37:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"D":t?l.key=ue.ESC+"OD":l.key=ue.ESC+"[D";break;case 39:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"C":t?l.key=ue.ESC+"OC":l.key=ue.ESC+"[C";break;case 38:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"A":t?l.key=ue.ESC+"OA":l.key=ue.ESC+"[A";break;case 40:if(e.metaKey)break;a?l.key=ue.ESC+"[1;"+(a+1)+"B":t?l.key=ue.ESC+"OB":l.key=ue.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(l.key=ue.ESC+"[2~");break;case 46:a?l.key=ue.ESC+"[3;"+(a+1)+"~":l.key=ue.ESC+"[3~";break;case 36:a?l.key=ue.ESC+"[1;"+(a+1)+"H":t?l.key=ue.ESC+"OH":l.key=ue.ESC+"[H";break;case 35:a?l.key=ue.ESC+"[1;"+(a+1)+"F":t?l.key=ue.ESC+"OF":l.key=ue.ESC+"[F";break;case 33:e.shiftKey?l.type=2:e.ctrlKey?l.key=ue.ESC+"[5;"+(a+1)+"~":l.key=ue.ESC+"[5~";break;case 34:e.shiftKey?l.type=3:e.ctrlKey?l.key=ue.ESC+"[6;"+(a+1)+"~":l.key=ue.ESC+"[6~";break;case 112:a?l.key=ue.ESC+"[1;"+(a+1)+"P":l.key=ue.ESC+"OP";break;case 113:a?l.key=ue.ESC+"[1;"+(a+1)+"Q":l.key=ue.ESC+"OQ";break;case 114:a?l.key=ue.ESC+"[1;"+(a+1)+"R":l.key=ue.ESC+"OR";break;case 115:a?l.key=ue.ESC+"[1;"+(a+1)+"S":l.key=ue.ESC+"OS";break;case 116:a?l.key=ue.ESC+"[15;"+(a+1)+"~":l.key=ue.ESC+"[15~";break;case 117:a?l.key=ue.ESC+"[17;"+(a+1)+"~":l.key=ue.ESC+"[17~";break;case 118:a?l.key=ue.ESC+"[18;"+(a+1)+"~":l.key=ue.ESC+"[18~";break;case 119:a?l.key=ue.ESC+"[19;"+(a+1)+"~":l.key=ue.ESC+"[19~";break;case 120:a?l.key=ue.ESC+"[20;"+(a+1)+"~":l.key=ue.ESC+"[20~";break;case 121:a?l.key=ue.ESC+"[21;"+(a+1)+"~":l.key=ue.ESC+"[21~";break;case 122:a?l.key=ue.ESC+"[23;"+(a+1)+"~":l.key=ue.ESC+"[23~";break;case 123:a?l.key=ue.ESC+"[24;"+(a+1)+"~":l.key=ue.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?l.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?l.key=ue.NUL:e.keyCode>=51&&e.keyCode<=55?l.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?l.key=ue.DEL:e.keyCode===219?l.key=ue.ESC:e.keyCode===220?l.key=ue.FS:e.keyCode===221&&(l.key=ue.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let h=(c=GR[e.keyCode])==null?void 0:c[e.shiftKey?1:0];if(h)l.key=ue.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let d=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(d);e.shiftKey&&(f=f.toUpperCase()),l.key=ue.ESC+f}else if(e.keyCode===32)l.key=ue.ESC+(e.ctrlKey?ue.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),l.key=ue.ESC+d,l.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(l.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?l.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(l.key=ue.US),e.key==="@"&&(l.key=ue.NUL));break}return l}var Ct=0,QR=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Qu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Qu,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((l,a)=>this._getKey(l)-this._getKey(a)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<r.length;l++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[l]=e[t],t++):r[l]=this._array[i++];this._array=r,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||(Ct=this._search(t),Ct===-1)||this._getKey(this._array[Ct])!==t)return!1;do if(this._array[Ct]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ct),!0;while(++Ct<this._array.length&&this._getKey(this._array[Ct])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,a)=>l-a),t=0,i=new Array(this._array.length-e.length),r=0;for(let l=0;l<this._array.length;l++)e[t]===l?t++:i[r++]=this._array[l];this._array=i,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&&(Ct=this._search(e),!(Ct<0||Ct>=this._array.length)&&this._getKey(this._array[Ct])===e))do yield this._array[Ct];while(++Ct<this._array.length&&this._getKey(this._array[Ct])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ct=this._search(e),!(Ct<0||Ct>=this._array.length)&&this._getKey(this._array[Ct])===e))do t(this._array[Ct]);while(++Ct<this._array.length&&this._getKey(this._array[Ct])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,l=this._getKey(this._array[r]);if(l>e)i=r-1;else if(l<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},gp=0,pS=0,JR=class extends je{constructor(){super(),this._decorations=new QR(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ft(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new eB(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let r=0,l=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,l=r+(a.options.width??1),e>=r&&e<l&&(!i||(a.options.layer??"bottom")===i)&&(yield a)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,l=>{gp=l.options.x??0,pS=gp+(l.options.width??1),e>=gp&&e<pS&&(!i||(l.options.layer??"bottom")===i)&&r(l)})}},eB=class extends $r{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),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=gt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=gt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},tB=1e3,iB=class{constructor(e,t=tB){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,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 r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=r-this._lastRefreshMs,a=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_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)}},gS=20,Ju=class extends je{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let l=this._coreBrowserService.mainDocument;this._accessibilityContainer=l.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=l.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,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=l.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new iB(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(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
95
+ `))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(l,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ft(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<gS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
96
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===gS+1&&(this._liveRegion.textContent+=Fp.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 i=this._terminal.buffer,r=i.lines.length.toString();for(let l=e;l<=t;l++){let a=i.lines.get(i.ydisp+l),c=[],h=(a==null?void 0:a.translateToString(!0,void 0,void 0,c))||"",d=(i.ydisp+l+1).toString(),f=this._rowElements[l];f&&(h.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=h,this._rowColumns.set(f,c)),f.setAttribute("aria-posinset",d),f.setAttribute("aria-setsize",r),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],l=i.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(l===a||e.relatedTarget!==r)return;let c,h;if(t===0?(c=i,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(c=this._rowElements.shift(),h=i,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let d=this._createAccessibilityTreeNode();this._rowElements.unshift(d),this._rowContainer.insertAdjacentElement("afterbegin",d)}else{let d=this._createAccessibilityTreeNode();this._rowElements.push(d),this._rowContainer.appendChild(d)}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 h;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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((h=r.textContent)==null?void 0:h.length)??0}),!this._rowContainer.contains(i.node))return;let l=({node:d,offset:f})=>{let m=d instanceof Text?d.parentNode:d,g=parseInt(m==null?void 0:m.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(m);if(!v)return console.warn("columns is null. Race condition?"),null;let y=f<v.length?v[f]:v.slice(-1)[0]+1;return y>=this._terminal.cols&&(++g,y=0),{row:g,column:y}},a=l(t),c=l(i);if(!(!a||!c)){if(a.row>c.row||a.row===c.row&&a.column>=c.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(c.row-a.row)*this._terminal.cols-a.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 l,a;e.style.transform="";let t=e.getBoundingClientRect().width,i=(a=(l=this._rowColumns.get(e))==null?void 0:l.slice(-1))==null?void 0:a[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Ju=yt([ve(1,em),ve(2,lr),ve(3,or)],Ju);var Eg=class extends je{constructor(e,t,i,r,l){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=l,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ft(()=>{var a;As(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(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 i=e.composedPath();for(let r=0;r<i.length;r++){let l=i[r];if(l.classList.contains("xterm"))break;if(l.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 r,l;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(a=>{a==null||a.forEach(c=>{c.link.dispose&&c.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[a,c]of this._linkProviderService.linkProviders.entries())t?(l=this._activeProviderReplies)!=null&&l.get(a)&&(i=this._checkLinkProviderResult(a,e,i)):c.provideLinks(e.y,h=>{var f,m;if(this._isMouseOut)return;let d=h==null?void 0:h.map(g=>({link:g}));(f=this._activeProviderReplies)==null||f.set(a,d),i=this._checkLinkProviderResult(a,e,i),((m=this._activeProviderReplies)==null?void 0:m.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let l=t.get(r);if(l)for(let a=0;a<l.length;a++){let c=l[a],h=c.link.range.start.y<e?0:c.link.range.start.x,d=c.link.range.end.y>e?this._bufferService.cols:c.link.range.end.x;for(let f=h;f<=d;f++){if(i.has(f)){l.splice(a--,1);break}i.add(f)}}}}_checkLinkProviderResult(e,t,i){var a;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),l=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(l=!0);if(!l&&r){let c=r.find(h=>this._linkAtPosition(h.link,t));c&&(i=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let c=0;c<this._activeProviderReplies.size;c++){let h=(a=this._activeProviderReplies.get(c))==null?void 0:a.find(d=>this._linkAtPosition(d.link,t));if(h){i=!0,this._handleNewLink(h);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&nB(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,As(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 i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,l,a;(r=this._currentLink)!=null&&r.state&&((a=(l=this._currentLink)==null?void 0:l.state)==null?void 0:a.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,l=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=l&&(this._clearCurrentLink(r,l),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,i){var r;(r=this._currentLink)!=null&&r.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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,r=this._bufferService.buffer.ydisp,l=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(l)}_linkLeave(e,t,i){var r;(r=this._currentLink)!=null&&r.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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,l=t.y*this._bufferService.cols+t.x;return i<=l&&l<=r}_positionFromMouseEvent(e,t,i){let r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,r,l){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:l}}};Eg=yt([ve(1,tm),ve(2,or),ve(3,ai),ve(4,fw)],Eg);function nB(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 rB=class extends KR{constructor(e={}){super(e),this._linkifier=this._register(new jl),this.browser=Dw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new jl),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(JR),this._instantiationService.setService(Ba,this._decorationService),this._linkProviderService=this._instantiationService.createInstance($4),this._instantiationService.setService(fw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Wp)),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(Qt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Qt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Qt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Qt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(ft(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let l=ct.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${ue.ESC}]${r};${VR(l)}${Nw.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=Rt.toColor(...t.color));else{let a=i;this._themeService.modifyColors(c=>c[a]=Rt.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(Ju,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.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(ue.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 i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,l=t.getWidth(i),a=this._renderService.dimensions.css.cell.width*l,c=this.buffer.y*this._renderService.dimensions.css.cell.height,h=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=c+"px",this.textarea.style.width=a+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&aD(t,this._selectionService)}));let e=t=>cD(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),Rw?this._register(Te(this.element,"mousedown",t=>{t.button===2&&E1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{E1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),cm&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&nw(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var l;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"),((l=this.element)==null?void 0:l.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(Te(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Vp.get()),zw||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Y4,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(lr,this._coreBrowserService),this._register(Te(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(dg,this._document,this._helperContainer),this._instantiationService.setService(yh,this._charSizeService),this._themeService=this._instantiationService.createInstance(_g),this._instantiationService.setService(Pl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Gu),this._instantiationService.setService(hw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(gg,this.rows,this.screenElement)),this._instantiationService.setService(or,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ug,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(pg),this._instantiationService.setService(tm,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Eg,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(ag,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(mg,this.element,this.screenElement,r)),this._instantiationService.setService(_D,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Qt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(cg,this.screenElement)),this._register(Te(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Ju,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ku,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ku,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(fg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(a){var f,m,g,v,y;let c=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!c)return!1;let h,d;switch(a.overrideType||a.type){case"mousemove":d=32,a.buttons===void 0?(h=3,a.button!==void 0&&(h=a.button<3?a.button:3)):h=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":d=0,h=a.button<3?a.button:3;break;case"mousedown":d=1,h=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let S=a.deltaY;if(S===0||e.coreMouseService.consumeWheelEvent(a,(v=(g=(m=(f=e._renderService)==null?void 0:f.dimensions)==null?void 0:m.device)==null?void 0:g.cell)==null?void 0:v.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;d=S<0?0:1,h=4;break;default:return!1}return d===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:c.col,row:c.row,x:c.x,y:c.y,button:h,action:d,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:a=>(i(a),a.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(a)),wheel:a=>(i(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&i(a)},mousemove:a=>{a.buttons||i(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),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()),a&8?r.mousemove||(t.addEventListener("mousemove",l.mousemove),r.mousemove=l.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),a&16?r.wheel||(t.addEventListener("wheel",l.wheel,{passive:!1}),r.wheel=l.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),a&2?r.mouseup||(r.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),a&4?r.mousedrag||(r.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return i(a),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(a)})),this._register(Te(t,"wheel",a=>{var c,h,d,f,m;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(f=(d=(h=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:h.device)==null?void 0:d.cell)==null?void 0:f.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return this.cancel(a,!0);let g=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.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){iw(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,i){this._selectionService.setSelection(e,t,i)}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 i;(i=this._selectionService)==null||i.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 i=ZR(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===ue.ETX||i.key===ue.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(sB(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 i;(i=this._charSizeService)==null||i.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(Dt));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(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ue.ESC}[4;${i};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ue.ESC}[6;${l};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function sB(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var lB=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;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)}},oB=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 Zi)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},mS=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 oB(t)}getNullCell(){return new Zi}},aB=class extends je{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new mS(this._core.buffers.normal,"normal"),this._alternate=new mS(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)}},cB=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,r)=>t(i,r.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)}},uB=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}},hB=["cols","rows"],vn=0,fB=class extends je{constructor(e){super(),this._core=this._register(new rB(e)),this._addonManager=this._register(new lB),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],i=(r,l)=>{this._checkReadonlyOptions(r),this._core.options[r]=l};for(let r in this._core.options){let l={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,l)}}_checkReadonlyOptions(e){if(hB.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 cB(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new uB(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 aB(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
97
+ `,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 Vp.get()},set promptLabel(e){Vp.set(e)},get tooMuchOutput(){return Fp.get()},set tooMuchOutput(e){Fp.set(e)}}}_verifyIntegers(...e){for(vn of e)if(vn===1/0||isNaN(vn)||vn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(vn of e)if(vn&&(vn===1/0||isNaN(vn)||vn%1!==0||vn<0))throw new Error("This API only accepts positive integers")}};/**
98
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
99
+ * @license MIT
100
+ *
101
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
102
+ * @license MIT
103
+ *
104
+ * Originally forked from (with the author's permission):
105
+ * Fabrice Bellard's javascript vt100 for jslinux:
106
+ * http://bellard.org/jslinux/
107
+ * Copyright (c) 2011 Fabrice Bellard
108
+ */var dB=2,pB=1,gB=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,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),l=Math.max(0,parseInt(i.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),c={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},h=c.top+c.bottom,d=c.right+c.left,f=r-h,m=l-d-t;return{cols:Math.max(dB,Math.floor(m/e.css.cell.width)),rows:Math.max(pB,Math.floor(f/e.css.cell.height))}}};/**
109
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
110
+ * @license MIT
111
+ *
112
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
113
+ * @license MIT
114
+ *
115
+ * Originally forked from (with the author's permission):
116
+ * Fabrice Bellard's javascript vt100 for jslinux:
117
+ * http://bellard.org/jslinux/
118
+ * Copyright (c) 2011 Fabrice Bellard
119
+ */var mB=class{constructor(e,t,i,r={}){this._terminal=e,this._regex=t,this._handler=i,this._options=r}provideLinks(e,t){let i=vB.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(t=>(t.leave=this._options.leave,t.hover=(i,r)=>{if(this._options.hover){let{range:l}=t;this._options.hover(i,r,l)}},t))}};function _B(e){try{let t=new URL(e),i=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(i.toLocaleLowerCase())}catch{return!1}}var vB=class Ou{static computeLink(t,i,r,l){let a=new RegExp(i.source,(i.flags||"")+"g"),[c,h]=Ou._getWindowedLineStrings(t-1,r),d=c.join(""),f,m=[];for(;f=a.exec(d);){let g=f[0];if(!_B(g))continue;let[v,y]=Ou._mapStrIdx(r,h,0,f.index),[S,b]=Ou._mapStrIdx(r,v,y,g.length);if(v===-1||y===-1||S===-1||b===-1)continue;let E={start:{x:y+1,y:v+1},end:{x:b,y:S+1}};m.push({range:E,text:g,activate:l})}return m}static _getWindowedLineStrings(t,i){let r,l=t,a=t,c=0,h="",d=[];if(r=i.buffer.active.getLine(t)){let f=r.translateToString(!0);if(r.isWrapped&&f[0]!==" "){for(c=0;(r=i.buffer.active.getLine(--l))&&c<2048&&(h=r.translateToString(!0),c+=h.length,d.push(h),!(!r.isWrapped||h.indexOf(" ")!==-1)););d.reverse()}for(d.push(f),c=0;(r=i.buffer.active.getLine(++a))&&r.isWrapped&&c<2048&&(h=r.translateToString(!0),c+=h.length,d.push(h),h.indexOf(" ")===-1););}return[d,l]}static _mapStrIdx(t,i,r,l){let a=t.buffer.active,c=a.getNullCell(),h=r;for(;l;){let d=a.getLine(i);if(!d)return[-1,-1];for(let f=h;f<d.length;++f){d.getCell(f,c);let m=c.getChars();if(c.getWidth()&&(l-=m.length||1,f===d.length-1&&m==="")){let g=a.getLine(i+1);g&&g.isWrapped&&(g.getCell(0,c),c.getWidth()===2&&(l+=1))}if(l<0)return[i,f]}i++,h=0}return[i,h]}},yB=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function SB(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var bB=class{constructor(e=SB,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||yB;this._linkProvider=this._terminal.registerLinkProvider(new mB(this._terminal,i,this._handler,t))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};function xB(e){const t=new fB({fontFamily:"'SF Mono', Menlo, Monaco, 'Courier New', monospace",fontSize:12,lineHeight:1.2,theme:{background:"#1a1a1a",foreground:"#e8e4df",cursor:"#1a1a1a",cursorAccent:"#1a1a1a",selectionBackground:"rgba(255, 255, 255, 0.15)",black:"#1a1a1a",brightBlack:"#787068",white:"#e8e4df",brightWhite:"#faf9f7",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee"},cursorBlink:!1,cursorInactiveStyle:"none",scrollback:1e4,convertEol:!0}),i=new gB;return t.loadAddon(i),t.loadAddon(new bB),t.onData(r=>{e.current({type:"pty-input",data:r})}),{term:t,fitAddon:i}}function wB({sendMessage:e,ptyEvents:t}){const[i,r]=Y.useState(!1),[l,a]=Y.useState(!1),c=Y.useRef(e);c.current=e;const h=Y.useRef(null);h.current||(h.current=xB(c));const{term:d,fitAddon:f}=h.current,m=Y.useRef(!1),g=Y.useRef([]);Y.useEffect(()=>()=>{d.dispose(),h.current=null},[d]),Y.useEffect(()=>{const b=L=>{const k=L.detail;m.current?(d.write(k),a(!0)):g.current.push(k)},E=L=>{r(!1);const k=`\r
120
+ \x1B[90m[Process exited with code ${L.detail}. Press Enter to restart.]\x1B[0m`;m.current?d.writeln(k):g.current.push(k+`\r
121
+ `)},C=()=>{r(!0)};return t.addEventListener("data",b),t.addEventListener("exit",E),t.addEventListener("spawned",C),()=>{t.removeEventListener("data",b),t.removeEventListener("exit",E),t.removeEventListener("spawned",C)}},[t,d]);const v=Y.useCallback(b=>{if(b){if(m.current)d.element&&b.appendChild(d.element);else if(d.open(b),m.current=!0,g.current.length>0){for(const E of g.current)d.write(E);g.current=[],a(!0)}f.fit(),d.focus(),c.current({type:"pty-resize",data:{cols:d.cols,rows:d.rows}})}},[d,f]),y=Y.useCallback(()=>{f.fit(),c.current({type:"pty-resize",data:{cols:d.cols,rows:d.rows}})},[d,f]),S=Y.useCallback(()=>{d.clear(),c.current({type:"pty-spawn"})},[d]);return{attachTo:v,fit:y,ptyAlive:i,hasData:l,restart:S}}function CB({defaultWidth:e,minWidth:t,maxWidth:i,side:r}){const[l,a]=Y.useState(e),c=Y.useRef(!1),h=Y.useRef(0),d=Y.useRef(0),f=Y.useCallback(m=>{m.preventDefault(),c.current=!0,h.current=m.clientX,d.current=l},[l]);return Y.useEffect(()=>{const m=v=>{if(!c.current)return;const y=v.clientX-h.current,S=d.current-y;a(Math.max(t,Math.min(i,S)))},g=()=>{c.current=!1};return window.addEventListener("mousemove",m),window.addEventListener("mouseup",g),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",g)}},[t,i,r]),{width:l,onDragStart:f}}function _S(){const e=window.location.hash.replace(/^#\/?/,"");return e==="dashboard"?{page:"dashboard",workflow:null}:e?e==="credentials"?{page:"credentials",workflow:null}:e==="canvas"?{page:"canvas",workflow:null}:e.startsWith("canvas/")?{page:"canvas",workflow:decodeURIComponent(e.slice(7))||null}:{page:"canvas",workflow:null}:{page:"canvas",workflow:null}}function vS(e,t){return e==="dashboard"?"#/dashboard":e==="credentials"?"#/credentials":e==="canvas"&&t?`#/canvas/${encodeURIComponent(t)}`:"#/canvas"}function EB(){const[e,t]=Y.useState(_S);Y.useEffect(()=>{const l=()=>t(_S());return window.addEventListener("popstate",l),()=>window.removeEventListener("popstate",l)},[]);const i=Y.useCallback((l,a)=>{const c=a!==void 0?a:e.workflow,h=vS(l,l==="canvas"?c:null);h!==window.location.hash&&window.history.pushState(null,"",h),t({page:l,workflow:l==="canvas"?c:e.workflow})},[e.workflow]),r=Y.useCallback(l=>{const a=vS("canvas",l);window.history.pushState(null,"",a),t({page:"canvas",workflow:l})},[]);return{page:e.page,selectedWorkflow:e.workflow,navigate:i,selectWorkflow:r}}const yS="0pflow-sidebar-collapsed";function kB(){const[e,t]=Y.useState(()=>{try{return localStorage.getItem(yS)==="true"}catch{return!1}}),i=Y.useCallback(()=>{t(r=>{const l=!r;try{localStorage.setItem(yS,String(l))}catch{}return l})},[]);return{collapsed:e,toggle:i}}const MB={node:"<>",agent:"AI",workflow:"wf",input:"IN",output:"OUT",condition:"?"},TB={node:"CUSTOM CODE",agent:"AI AGENT",workflow:"WORKFLOW",input:"INPUT",output:"OUTPUT",condition:"CONDITION"},NB={node:"#d1fae5",agent:"#ede9fe",workflow:"#d1fae5",input:"#e8e4df",output:"#e8e4df",condition:"#fef3c7"},AB={node:"#ecfdf5",agent:"#f5f3ff",workflow:"#ecfdf5",input:"#f0ece7",output:"#f0ece7",condition:"#fffbeb"},DB={node:"#10b981",agent:"#8b5cf6",workflow:"#10b981",input:"#a8a099",output:"#a8a099",condition:"#f59e0b"},RB={node:"#10b981",agent:"#8b5cf6",workflow:"#10b981",input:"#a8a099",output:"#a8a099",condition:"#f59e0b"};function BB({data:e}){const t=e.type??"node",i=e.label??"",r=e.fields??void 0,l=MB[t]??"<>",a=t==="input"||t==="output";return w.jsxs("div",{className:"bg-white rounded-lg border",style:{borderColor:NB[t],minWidth:a?120:160,maxWidth:260,boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[w.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[w.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:AB[t]},children:w.jsx("span",{className:"text-[11px] font-bold",style:{color:DB[t]},children:l})}),w.jsxs("div",{className:"min-w-0",children:[w.jsx("div",{className:`font-medium truncate ${a?"text-[13px] text-gray-500":"text-sm text-gray-800"}`,children:i}),w.jsx("div",{className:"text-[10px] font-semibold tracking-wider",style:{color:RB[t]},children:TB[t]})]})]}),a&&r&&r.length>0&&w.jsx("div",{className:"border-t border-gray-100 px-3 py-1.5 flex flex-wrap gap-x-2 gap-y-0.5",children:r.map(c=>w.jsx("span",{className:"text-[11px] text-gray-400",children:c},c))}),t!=="input"&&w.jsx(Xr,{type:"target",position:we.Left,className:"!w-[6px] !h-[6px] !bg-gray-300 !border !border-gray-200 !opacity-60"}),t!=="output"&&w.jsx(Xr,{type:"source",position:we.Right,className:"!w-[6px] !h-[6px] !bg-gray-300 !border !border-gray-200 !opacity-60"})]})}function LB({data:e}){const t=e.label??"",i=e.width,r=e.height;return w.jsxs("div",{className:"relative rounded-xl",style:{width:i,height:r,border:"1.5px dashed #d1d5db",background:"rgba(249, 250, 251, 0.5)"},children:[w.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 border-b border-gray-200",children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:"shrink-0 text-gray-400",children:[w.jsx("path",{d:"M3 4C2 4 1 5 1 6.5C1 8 2 9 3 9H11C12 9 13 8 13 6.5C13 5 12 4 11 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),w.jsx("path",{d:"M9.5 3L11 4L9.5 5",fill:"currentColor"})]}),w.jsx("span",{className:"text-[12px] font-semibold text-gray-500 truncate",children:t})]}),w.jsx(Xr,{type:"target",position:we.Left,className:"!bg-transparent !w-0 !h-0 !border-0"}),w.jsx(Xr,{type:"source",position:we.Right,className:"!bg-transparent !w-0 !h-0 !border-0"})]})}function zB(e){const{sourceX:t,sourceY:i,sourcePosition:r,targetX:l,targetY:a,targetPosition:c,markerEnd:h,label:d,style:f}=e,[m,g,v]=$g({sourceX:t,sourceY:i,sourcePosition:r,targetX:l,targetY:a,targetPosition:c});return w.jsxs("g",{children:[w.jsx("path",{d:m,fill:"none",strokeWidth:20,stroke:"transparent",className:"react-flow__edge-interaction"}),w.jsx("path",{d:m,fill:"none",stroke:(f==null?void 0:f.stroke)??"#d1d5db",strokeWidth:(f==null?void 0:f.strokeWidth)??1.5,markerEnd:h}),d&&w.jsx("text",{x:g,y:v,textAnchor:"middle",dominantBaseline:"central",className:"react-flow__edge-text",children:d})]})}function OB(e,t){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const HB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PB={};function SS(e,t){return(PB.jsx?jB:HB).test(e)}const IB=/[ \t\n\f\r]/g;function UB(e){return typeof e=="object"?e.type==="text"?bS(e.value):!1:bS(e)}function bS(e){return e.replace(IB,"")===""}class Oa{constructor(t,i,r){this.normal=i,this.property=t,r&&(this.space=r)}}Oa.prototype.normal={};Oa.prototype.property={};Oa.prototype.space=void 0;function Yw(e,t){const i={},r={};for(const l of e)Object.assign(i,l.property),Object.assign(r,l.normal);return new Oa(i,r,t)}function kg(e){return e.toLowerCase()}class wi{constructor(t,i){this.attribute=i,this.property=t}}wi.prototype.attribute="";wi.prototype.booleanish=!1;wi.prototype.boolean=!1;wi.prototype.commaOrSpaceSeparated=!1;wi.prototype.commaSeparated=!1;wi.prototype.defined=!1;wi.prototype.mustUseProperty=!1;wi.prototype.number=!1;wi.prototype.overloadedBoolean=!1;wi.prototype.property="";wi.prototype.spaceSeparated=!1;wi.prototype.space=void 0;let qB=0;const Le=Bs(),At=Bs(),Mg=Bs(),de=Bs(),st=Bs(),Nl=Bs(),zi=Bs();function Bs(){return 2**++qB}const Tg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:At,commaOrSpaceSeparated:zi,commaSeparated:Nl,number:de,overloadedBoolean:Mg,spaceSeparated:st},Symbol.toStringTag,{value:"Module"})),mp=Object.keys(Tg);class um extends wi{constructor(t,i,r,l){let a=-1;if(super(t,i),xS(this,"space",l),typeof r=="number")for(;++a<mp.length;){const c=mp[a];xS(this,mp[a],(r&Tg[c])===Tg[c])}}}um.prototype.defined=!0;function xS(e,t,i){i&&(e[t]=i)}function Ul(e){const t={},i={};for(const[r,l]of Object.entries(e.properties)){const a=new um(r,e.transform(e.attributes||{},r),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,i[kg(r)]=r,i[kg(a.attribute)]=r}return new Oa(t,i,e.space)}const Ww=Ul({properties:{ariaActiveDescendant:null,ariaAtomic:At,ariaAutoComplete:null,ariaBusy:At,ariaChecked:At,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:st,ariaCurrent:null,ariaDescribedBy:st,ariaDetails:null,ariaDisabled:At,ariaDropEffect:st,ariaErrorMessage:null,ariaExpanded:At,ariaFlowTo:st,ariaGrabbed:At,ariaHasPopup:null,ariaHidden:At,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:st,ariaLevel:de,ariaLive:null,ariaModal:At,ariaMultiLine:At,ariaMultiSelectable:At,ariaOrientation:null,ariaOwns:st,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:At,ariaReadOnly:At,ariaRelevant:null,ariaRequired:At,ariaRoleDescription:st,ariaRowCount:de,ariaRowIndex:de,ariaRowSpan:de,ariaSelected:At,ariaSetSize:de,ariaSort:null,ariaValueMax:de,ariaValueMin:de,ariaValueNow:de,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $w(e,t){return t in e?e[t]:t}function Xw(e,t){return $w(e,t.toLowerCase())}const VB=Ul({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Nl,acceptCharset:st,accessKey:st,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:st,autoFocus:Le,autoPlay:Le,blocking:st,capture:null,charSet:null,checked:Le,cite:null,className:st,cols:de,colSpan:null,content:null,contentEditable:At,controls:Le,controlsList:st,coords:de|Nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:Mg,draggable:At,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:st,height:de,hidden:Mg,high:de,href:null,hrefLang:null,htmlFor:st,httpEquiv:st,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:st,itemRef:st,itemScope:Le,itemType:st,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:de,manifest:null,max:null,maxLength:de,media:null,method:null,min:null,minLength:de,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Le,optimum:de,pattern:null,ping:st,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:st,required:Le,reversed:Le,rows:de,rowSpan:de,sandbox:st,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:de,sizes:null,slot:null,span:de,spellCheck:At,src:null,srcDoc:null,srcLang:null,srcSet:null,start:de,step:null,style:null,tabIndex:de,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:At,width:de,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:st,axis:null,background:null,bgColor:null,border:de,borderColor:null,bottomMargin:de,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:de,leftMargin:de,link:null,longDesc:null,lowSrc:null,marginHeight:de,marginWidth:de,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:de,rules:null,scheme:null,scrolling:At,standby:null,summary:null,text:null,topMargin:de,valueType:null,version:null,vAlign:null,vLink:null,vSpace:de,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:Xw}),FB=Ul({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zi,accentHeight:de,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:de,amplitude:de,arabicForm:null,ascent:de,attributeName:null,attributeType:null,azimuth:de,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:de,by:null,calcMode:null,capHeight:de,className:st,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:de,diffuseConstant:de,direction:null,display:null,dur:null,divisor:de,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:de,enableBackground:null,end:null,event:null,exponent:de,externalResourcesRequired:null,fill:null,fillOpacity:de,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Nl,g2:Nl,glyphName:Nl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:de,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:de,horizOriginX:de,horizOriginY:de,id:null,ideographic:de,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:de,k:de,k1:de,k2:de,k3:de,k4:de,kernelMatrix:zi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:de,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:de,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:de,overlineThickness:de,paintOrder:null,panose1:null,path:null,pathLength:de,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:st,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zi,rev:zi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zi,requiredFeatures:zi,requiredFonts:zi,requiredFormats:zi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:de,specularExponent:de,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:de,strikethroughThickness:de,string:null,stroke:null,strokeDashArray:zi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:de,strokeOpacity:de,strokeWidth:null,style:null,surfaceScale:de,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zi,tabIndex:de,tableValues:null,target:null,targetX:de,targetY:de,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:de,underlineThickness:de,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:de,values:null,vAlphabetic:de,vMathematical:de,vectorEffect:null,vHanging:de,vIdeographic:de,version:null,vertAdvY:de,vertOriginX:de,vertOriginY:de,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:de,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$w}),Kw=Ul({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Gw=Ul({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Xw}),Zw=Ul({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),YB={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},WB=/[A-Z]/g,wS=/-[a-z]/g,$B=/^data[-\w.:]+$/i;function XB(e,t){const i=kg(t);let r=t,l=wi;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&$B.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(wS,GB);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!wS.test(a)){let c=a.replace(WB,KB);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}l=um}return new l(r,t)}function KB(e){return"-"+e.toLowerCase()}function GB(e){return e.charAt(1).toUpperCase()}const ZB=Yw([Ww,VB,Kw,Gw,Zw],"html"),hm=Yw([Ww,FB,Kw,Gw,Zw],"svg");function QB(e){return e.join(" ").trim()}var xl={},_p,CS;function JB(){if(CS)return _p;CS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,i=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,h=/^\s+|\s+$/g,d=`
122
+ `,f="/",m="*",g="",v="comment",y="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var L=1,k=1;function D(R){var O=R.match(t);O&&(L+=O.length);var M=R.lastIndexOf(d);k=~M?R.length-M:k+R.length}function I(){var R={line:L,column:k};return function(O){return O.position=new B(R),G(),O}}function B(R){this.start=R,this.end={line:L,column:k},this.source=C.source}B.prototype.content=E;function U(R){var O=new Error(C.source+":"+L+":"+k+": "+R);if(O.reason=R,O.filename=C.source,O.line=L,O.column=k,O.source=E,!C.silent)throw O}function X(R){var O=R.exec(E);if(O){var M=O[0];return D(M),E=E.slice(M.length),O}}function G(){X(i)}function ne(R){var O;for(R=R||[];O=q();)O!==!1&&R.push(O);return R}function q(){var R=I();if(!(f!=E.charAt(0)||m!=E.charAt(1))){for(var O=2;g!=E.charAt(O)&&(m!=E.charAt(O)||f!=E.charAt(O+1));)++O;if(O+=2,g===E.charAt(O-1))return U("End of comment missing");var M=E.slice(2,O-2);return k+=2,D(M),E=E.slice(O),k+=2,R({type:v,comment:M})}}function P(){var R=I(),O=X(r);if(O){if(q(),!X(l))return U("property missing ':'");var M=X(a),j=R({type:y,property:b(O[0].replace(e,g)),value:M?b(M[0].replace(e,g)):g});return X(c),j}}function V(){var R=[];ne(R);for(var O;O=P();)O!==!1&&(R.push(O),ne(R));return R}return G(),V()}function b(E){return E?E.replace(h,g):g}return _p=S,_p}var ES;function e6(){if(ES)return xl;ES=1;var e=xl&&xl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xl,"__esModule",{value:!0}),xl.default=i;const t=e(JB());function i(r,l){let a=null;if(!r||typeof r!="string")return a;const c=(0,t.default)(r),h=typeof l=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:m}=d;h?l(f,m,d):m&&(a=a||{},a[f]=m)}),a}return xl}var $o={},kS;function t6(){if(kS)return $o;kS=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,i=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,a=function(f){return!f||i.test(f)||e.test(f)},c=function(f,m){return m.toUpperCase()},h=function(f,m){return"".concat(m,"-")},d=function(f,m){return m===void 0&&(m={}),a(f)?f:(f=f.toLowerCase(),m.reactCompat?f=f.replace(l,h):f=f.replace(r,h),f.replace(t,c))};return $o.camelCase=d,$o}var Xo,MS;function i6(){if(MS)return Xo;MS=1;var e=Xo&&Xo.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},t=e(e6()),i=t6();function r(l,a){var c={};return!l||typeof l!="string"||(0,t.default)(l,function(h,d){h&&d&&(c[(0,i.camelCase)(h,a)]=d)}),c}return r.default=r,Xo=r,Xo}var n6=i6();const r6=rh(n6),Qw=Jw("end"),fm=Jw("start");function Jw(e){return t;function t(i){const r=i&&i.position&&i.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function s6(e){const t=fm(e),i=Qw(e);if(t&&i)return{start:t,end:i}}function oa(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?TS(e.position):"start"in e||"end"in e?TS(e):"line"in e||"column"in e?Ng(e):""}function Ng(e){return NS(e&&e.line)+":"+NS(e&&e.column)}function TS(e){return Ng(e&&e.start)+"-"+Ng(e&&e.end)}function NS(e){return e&&typeof e=="number"?e:1}class ri extends Error{constructor(t,i,r){super(),typeof i=="string"&&(r=i,i=void 0);let l="",a={},c=!1;if(i&&("line"in i&&"column"in i?a={place:i}:"start"in i&&"end"in i?a={place:i}:"type"in i?a={ancestors:[i],place:i.position}:a={...i}),typeof t=="string"?l=t:!a.cause&&t&&(c=!0,l=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const h=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=h?h.line:void 0,this.name=oa(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=c&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ri.prototype.file="";ri.prototype.name="";ri.prototype.reason="";ri.prototype.message="";ri.prototype.stack="";ri.prototype.column=void 0;ri.prototype.line=void 0;ri.prototype.ancestors=void 0;ri.prototype.cause=void 0;ri.prototype.fatal=void 0;ri.prototype.place=void 0;ri.prototype.ruleId=void 0;ri.prototype.source=void 0;const dm={}.hasOwnProperty,l6=new Map,o6=/[A-Z]/g,a6=new Set(["table","tbody","thead","tfoot","tr"]),c6=new Set(["td","th"]),eC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function u6(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=v6(i,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=_6(i,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?hm:ZB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=tC(l,e,void 0);return a&&typeof a!="string"?a:l.create(e,l.Fragment,{children:a||void 0},void 0)}function tC(e,t,i){if(t.type==="element")return h6(e,t,i);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return f6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return p6(e,t,i);if(t.type==="mdxjsEsm")return d6(e,t);if(t.type==="root")return g6(e,t,i);if(t.type==="text")return m6(e,t)}function h6(e,t,i){const r=e.schema;let l=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(l=hm,e.schema=l),e.ancestors.push(t);const a=nC(e,t.tagName,!1),c=y6(e,t);let h=gm(e,t);return a6.has(t.tagName)&&(h=h.filter(function(d){return typeof d=="string"?!UB(d):!0})),iC(e,c,a,t),pm(c,h),e.ancestors.pop(),e.schema=r,e.create(t,a,c,i)}function f6(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}wa(e,t.position)}function d6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wa(e,t.position)}function p6(e,t,i){const r=e.schema;let l=r;t.name==="svg"&&r.space==="html"&&(l=hm,e.schema=l),e.ancestors.push(t);const a=t.name===null?e.Fragment:nC(e,t.name,!0),c=S6(e,t),h=gm(e,t);return iC(e,c,a,t),pm(c,h),e.ancestors.pop(),e.schema=r,e.create(t,a,c,i)}function g6(e,t,i){const r={};return pm(r,gm(e,t)),e.create(t,e.Fragment,r,i)}function m6(e,t){return t.value}function iC(e,t,i,r){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(t.node=r)}function pm(e,t){if(t.length>0){const i=t.length>1?t:t[0];i&&(e.children=i)}}function _6(e,t,i){return r;function r(l,a,c,h){const f=Array.isArray(c.children)?i:t;return h?f(a,c,h):f(a,c)}}function v6(e,t){return i;function i(r,l,a,c){const h=Array.isArray(a.children),d=fm(r);return t(l,a,c,h,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function y6(e,t){const i={};let r,l;for(l in t.properties)if(l!=="children"&&dm.call(t.properties,l)){const a=b6(e,l,t.properties[l]);if(a){const[c,h]=a;e.tableCellAlignToStyle&&c==="align"&&typeof h=="string"&&c6.has(t.tagName)?r=h:i[c]=h}}if(r){const a=i.style||(i.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return i}function S6(e,t){const i={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const c=a.expression;c.type;const h=c.properties[0];h.type,Object.assign(i,e.evaluater.evaluateExpression(h.argument))}else wa(e,t.position);else{const l=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const h=r.value.data.estree.body[0];h.type,a=e.evaluater.evaluateExpression(h.expression)}else wa(e,t.position);else a=r.value===null?!0:r.value;i[l]=a}return i}function gm(e,t){const i=[];let r=-1;const l=e.passKeys?new Map:l6;for(;++r<t.children.length;){const a=t.children[r];let c;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const f=l.get(d)||0;c=d+"-"+f,l.set(d,f+1)}}const h=tC(e,a,c);h!==void 0&&i.push(h)}return i}function b6(e,t,i){const r=XB(e.schema,t);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=r.commaSeparated?OB(i):QB(i)),r.property==="style"){let l=typeof i=="object"?i:x6(e,String(i));return e.stylePropertyNameCase==="css"&&(l=w6(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&r.space?YB[r.property]||r.property:r.attribute,i]}}function x6(e,t){try{return r6(t,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const r=i,l=new ri("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=eC+"#cannot-parse-style-attribute",l}}function nC(e,t,i){let r;if(!i)r={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let a=-1,c;for(;++a<l.length;){const h=SS(l[a])?{type:"Identifier",name:l[a]}:{type:"Literal",value:l[a]};c=c?{type:"MemberExpression",object:c,property:h,computed:!!(a&&h.type==="Literal"),optional:!1}:h}r=c}else r=SS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const l=r.value;return dm.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(r);wa(e)}function wa(e,t){const i=new ri("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=eC+"#cannot-handle-mdx-estrees-without-createevaluater",i}function w6(e){const t={};let i;for(i in e)dm.call(e,i)&&(t[C6(i)]=e[i]);return t}function C6(e){let t=e.replace(o6,E6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function E6(e){return"-"+e.toLowerCase()}const vp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},k6={};function M6(e,t){const i=k6,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,l=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return rC(e,r,l)}function rC(e,t,i){if(T6(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return AS(e.children,t,i)}return Array.isArray(e)?AS(e,t,i):""}function AS(e,t,i){const r=[];let l=-1;for(;++l<e.length;)r[l]=rC(e[l],t,i);return r.join("")}function T6(e){return!!(e&&typeof e=="object")}const DS=document.createElement("i");function mm(e){const t="&"+e+";";DS.innerHTML=t;const i=DS.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===t?!1:i}function Tn(e,t,i,r){const l=e.length;let a=0,c;if(t<0?t=-t>l?0:l+t:t=t>l?l:t,i=i>0?i:0,r.length<1e4)c=Array.from(r),c.unshift(t,i),e.splice(...c);else for(i&&e.splice(t,i);a<r.length;)c=r.slice(a,a+1e4),c.unshift(t,0),e.splice(...c),a+=1e4,t+=1e4}function Gi(e,t){return e.length>0?(Tn(e,e.length,0,t),e):t}const RS={}.hasOwnProperty;function N6(e){const t={};let i=-1;for(;++i<e.length;)A6(t,e[i]);return t}function A6(e,t){let i;for(i in t){const l=(RS.call(e,i)?e[i]:void 0)||(e[i]={}),a=t[i];let c;if(a)for(c in a){RS.call(l,c)||(l[c]=[]);const h=a[c];D6(l[c],Array.isArray(h)?h:h?[h]:[])}}}function D6(e,t){let i=-1;const r=[];for(;++i<t.length;)(t[i].add==="after"?e:r).push(t[i]);Tn(e,0,0,r)}function sC(e,t){const i=Number.parseInt(e,t);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Al(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xn=Kr(/[A-Za-z]/),Hi=Kr(/[\dA-Za-z]/),R6=Kr(/[#-'*+\--9=?A-Z^-~]/);function Ag(e){return e!==null&&(e<32||e===127)}const Dg=Kr(/\d/),B6=Kr(/[\dA-Fa-f]/),L6=Kr(/[!-/:-@[-`{-~]/);function Ne(e){return e!==null&&e<-2}function xi(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const z6=Kr(new RegExp("\\p{P}|\\p{S}","u")),O6=Kr(/\s/);function Kr(e){return t;function t(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function ql(e){const t=[];let i=-1,r=0,l=0;for(;++i<e.length;){const a=e.charCodeAt(i);let c="";if(a===37&&Hi(e.charCodeAt(i+1))&&Hi(e.charCodeAt(i+2)))l=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(c=String.fromCharCode(a));else if(a>55295&&a<57344){const h=e.charCodeAt(i+1);a<56320&&h>56319&&h<57344?(c=String.fromCharCode(a,h),l=1):c="�"}else c=String.fromCharCode(a);c&&(t.push(e.slice(r,i),encodeURIComponent(c)),r=i+l+1,c=""),l&&(i+=l,l=0)}return t.join("")+e.slice(r)}function lt(e,t,i,r){const l=r?r-1:Number.POSITIVE_INFINITY;let a=0;return c;function c(d){return Ge(d)?(e.enter(i),h(d)):t(d)}function h(d){return Ge(d)&&a++<l?(e.consume(d),h):(e.exit(i),t(d))}}const H6={tokenize:j6};function j6(e){const t=e.attempt(this.parser.constructs.contentInitial,r,l);let i;return t;function r(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),lt(e,t,"linePrefix")}function l(h){return e.enter("paragraph"),a(h)}function a(h){const d=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=d),i=d,c(h)}function c(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ne(h)?(e.consume(h),e.exit("chunkText"),a):(e.consume(h),c)}}const P6={tokenize:I6},BS={tokenize:U6};function I6(e){const t=this,i=[];let r=0,l,a,c;return h;function h(k){if(r<i.length){const D=i[r];return t.containerState=D[1],e.attempt(D[0].continuation,d,f)(k)}return f(k)}function d(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,l&&L();const D=t.events.length;let I=D,B;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){B=t.events[I][1].end;break}C(r);let U=D;for(;U<t.events.length;)t.events[U][1].end={...B},U++;return Tn(t.events,I+1,0,t.events.slice(D)),t.events.length=U,f(k)}return h(k)}function f(k){if(r===i.length){if(!l)return v(k);if(l.currentConstruct&&l.currentConstruct.concrete)return S(k);t.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(BS,m,g)(k)}function m(k){return l&&L(),C(r),v(k)}function g(k){return t.parser.lazy[t.now().line]=r!==i.length,c=t.now().offset,S(k)}function v(k){return t.containerState={},e.attempt(BS,y,S)(k)}function y(k){return r++,i.push([t.currentConstruct,t.containerState]),v(k)}function S(k){if(k===null){l&&L(),C(0),e.consume(k);return}return l=l||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:a}),b(k)}function b(k){if(k===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(k);return}return Ne(k)?(e.consume(k),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,h):(e.consume(k),b)}function E(k,D){const I=t.sliceStream(k);if(D&&I.push(null),k.previous=a,a&&(a.next=k),a=k,l.defineSkip(k.start),l.write(I),t.parser.lazy[k.start.line]){let B=l.events.length;for(;B--;)if(l.events[B][1].start.offset<c&&(!l.events[B][1].end||l.events[B][1].end.offset>c))return;const U=t.events.length;let X=U,G,ne;for(;X--;)if(t.events[X][0]==="exit"&&t.events[X][1].type==="chunkFlow"){if(G){ne=t.events[X][1].end;break}G=!0}for(C(r),B=U;B<t.events.length;)t.events[B][1].end={...ne},B++;Tn(t.events,X+1,0,t.events.slice(U)),t.events.length=B}}function C(k){let D=i.length;for(;D-- >k;){const I=i[D];t.containerState=I[1],I[0].exit.call(t,e)}i.length=k}function L(){l.write([null]),a=void 0,l=void 0,t.containerState._closeFlow=void 0}}function U6(e,t,i){return lt(e,e.attempt(this.parser.constructs.document,t,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function LS(e){if(e===null||xi(e)||O6(e))return 1;if(z6(e))return 2}function _m(e,t,i){const r=[];let l=-1;for(;++l<e.length;){const a=e[l].resolveAll;a&&!r.includes(a)&&(t=a(t,i),r.push(a))}return t}const Rg={name:"attention",resolveAll:q6,tokenize:V6};function q6(e,t){let i=-1,r,l,a,c,h,d,f,m;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(r=i;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[r][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const g={...e[r][1].end},v={...e[i][1].start};zS(g,-d),zS(v,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},h={type:d>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:v},a={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[i][1].start}},l={type:d>1?"strong":"emphasis",start:{...c.start},end:{...h.end}},e[r][1].end={...c.start},e[i][1].start={...h.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Gi(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Gi(f,[["enter",l,t],["enter",c,t],["exit",c,t],["enter",a,t]]),f=Gi(f,_m(t.parser.constructs.insideSpan.null,e.slice(r+1,i),t)),f=Gi(f,[["exit",a,t],["enter",h,t],["exit",h,t],["exit",l,t]]),e[i][1].end.offset-e[i][1].start.offset?(m=2,f=Gi(f,[["enter",e[i][1],t],["exit",e[i][1],t]])):m=0,Tn(e,r-1,i-r+3,f),i=r+f.length-m-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function V6(e,t){const i=this.parser.constructs.attentionMarkers.null,r=this.previous,l=LS(r);let a;return c;function c(d){return a=d,e.enter("attentionSequence"),h(d)}function h(d){if(d===a)return e.consume(d),h;const f=e.exit("attentionSequence"),m=LS(d),g=!m||m===2&&l||i.includes(d),v=!l||l===2&&m||i.includes(r);return f._open=!!(a===42?g:g&&(l||!v)),f._close=!!(a===42?v:v&&(m||!g)),t(d)}}function zS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const F6={name:"autolink",tokenize:Y6};function Y6(e,t,i){let r=0;return l;function l(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(y){return xn(y)?(e.consume(y),c):y===64?i(y):f(y)}function c(y){return y===43||y===45||y===46||Hi(y)?(r=1,h(y)):f(y)}function h(y){return y===58?(e.consume(y),r=0,d):(y===43||y===45||y===46||Hi(y))&&r++<32?(e.consume(y),h):(r=0,f(y))}function d(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Ag(y)?i(y):(e.consume(y),d)}function f(y){return y===64?(e.consume(y),m):R6(y)?(e.consume(y),f):i(y)}function m(y){return Hi(y)?g(y):i(y)}function g(y){return y===46?(e.consume(y),r=0,m):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):v(y)}function v(y){if((y===45||Hi(y))&&r++<63){const S=y===45?v:g;return e.consume(y),S}return i(y)}}const xh={partial:!0,tokenize:W6};function W6(e,t,i){return r;function r(a){return Ge(a)?lt(e,l,"linePrefix")(a):l(a)}function l(a){return a===null||Ne(a)?t(a):i(a)}}const lC={continuation:{tokenize:X6},exit:K6,name:"blockQuote",tokenize:$6};function $6(e,t,i){const r=this;return l;function l(c){if(c===62){const h=r.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),a}return i(c)}function a(c){return Ge(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function X6(e,t,i){const r=this;return l;function l(c){return Ge(c)?lt(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):a(c)}function a(c){return e.attempt(lC,t,i)(c)}}function K6(e){e.exit("blockQuote")}const oC={name:"characterEscape",tokenize:G6};function G6(e,t,i){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),l}function l(a){return L6(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):i(a)}}const aC={name:"characterReference",tokenize:Z6};function Z6(e,t,i){const r=this;let l=0,a,c;return h;function h(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),a=31,c=Hi,m(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,c=B6,m):(e.enter("characterReferenceValue"),a=7,c=Dg,m(g))}function m(g){if(g===59&&l){const v=e.exit("characterReferenceValue");return c===Hi&&!mm(r.sliceSerialize(v))?i(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&l++<a?(e.consume(g),m):i(g)}}const OS={partial:!0,tokenize:J6},HS={concrete:!0,name:"codeFenced",tokenize:Q6};function Q6(e,t,i){const r=this,l={partial:!0,tokenize:I};let a=0,c=0,h;return d;function d(B){return f(B)}function f(B){const U=r.events[r.events.length-1];return a=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,h=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(B)}function m(B){return B===h?(c++,e.consume(B),m):c<3?i(B):(e.exit("codeFencedFenceSequence"),Ge(B)?lt(e,g,"whitespace")(B):g(B))}function g(B){return B===null||Ne(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(OS,b,D)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(B))}function v(B){return B===null||Ne(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(B)):Ge(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),lt(e,y,"whitespace")(B)):B===96&&B===h?i(B):(e.consume(B),v)}function y(B){return B===null||Ne(B)?g(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(B))}function S(B){return B===null||Ne(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(B)):B===96&&B===h?i(B):(e.consume(B),S)}function b(B){return e.attempt(l,D,E)(B)}function E(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),C}function C(B){return a>0&&Ge(B)?lt(e,L,"linePrefix",a+1)(B):L(B)}function L(B){return B===null||Ne(B)?e.check(OS,b,D)(B):(e.enter("codeFlowValue"),k(B))}function k(B){return B===null||Ne(B)?(e.exit("codeFlowValue"),L(B)):(e.consume(B),k)}function D(B){return e.exit("codeFenced"),t(B)}function I(B,U,X){let G=0;return ne;function ne(O){return B.enter("lineEnding"),B.consume(O),B.exit("lineEnding"),q}function q(O){return B.enter("codeFencedFence"),Ge(O)?lt(B,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):P(O)}function P(O){return O===h?(B.enter("codeFencedFenceSequence"),V(O)):X(O)}function V(O){return O===h?(G++,B.consume(O),V):G>=c?(B.exit("codeFencedFenceSequence"),Ge(O)?lt(B,R,"whitespace")(O):R(O)):X(O)}function R(O){return O===null||Ne(O)?(B.exit("codeFencedFence"),U(O)):X(O)}}}function J6(e,t,i){const r=this;return l;function l(c){return c===null?i(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a)}function a(c){return r.parser.lazy[r.now().line]?i(c):t(c)}}const yp={name:"codeIndented",tokenize:tL},eL={partial:!0,tokenize:iL};function tL(e,t,i){const r=this;return l;function l(f){return e.enter("codeIndented"),lt(e,a,"linePrefix",5)(f)}function a(f){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?c(f):i(f)}function c(f){return f===null?d(f):Ne(f)?e.attempt(eL,c,d)(f):(e.enter("codeFlowValue"),h(f))}function h(f){return f===null||Ne(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),h)}function d(f){return e.exit("codeIndented"),t(f)}}function iL(e,t,i){const r=this;return l;function l(c){return r.parser.lazy[r.now().line]?i(c):Ne(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):lt(e,a,"linePrefix",5)(c)}function a(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(c):Ne(c)?l(c):i(c)}}const nL={name:"codeText",previous:sL,resolve:rL,tokenize:lL};function rL(e){let t=e.length-4,i=3,r,l;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=i;++r<t;)if(e[r][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[t][1].type="codeTextPadding",i+=2,t-=2;break}}for(r=i-1,t++;++r<=t;)l===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(l=r):(r===t||e[r][1].type==="lineEnding")&&(e[l][1].type="codeTextData",r!==l+2&&(e[l][1].end=e[r-1][1].end,e.splice(l+2,r-l-2),t-=r-l-2,r=l+2),l=void 0);return e}function sL(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lL(e,t,i){let r=0,l,a;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),h(g)}function h(g){return g===96?(e.consume(g),r++,h):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?i(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(a=e.enter("codeTextSequence"),l=0,m(g)):Ne(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Ne(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),f)}function m(g){return g===96?(e.consume(g),l++,m):l===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(a.type="codeTextData",f(g))}}class oL{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,i){const r=i??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,i,r){const l=i||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return r&&Ko(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ko(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ko(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const i=this.left.splice(t,Number.POSITIVE_INFINITY);Ko(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ko(this.left,i.reverse())}}}function Ko(e,t){let i=0;if(t.length<1e4)e.push(...t);else for(;i<t.length;)e.push(...t.slice(i,i+1e4)),i+=1e4}function cC(e){const t={};let i=-1,r,l,a,c,h,d,f;const m=new oL(e);for(;++i<m.length;){for(;i in t;)i=t[i];if(r=m.get(i),i&&r[1].type==="chunkFlow"&&m.get(i-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,aL(m,i)),i=t[i],f=!0);else if(r[1]._container){for(a=i,l=void 0;a--;)if(c=m.get(a),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(l&&(m.get(l)[1].type="lineEndingBlank"),c[1].type="lineEnding",l=a);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;l&&(r[1].end={...m.get(l)[1].start},h=m.slice(l,i),h.unshift(r),m.splice(l,i-l+1,h))}}return Tn(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!f}function aL(e,t){const i=e.get(t)[1],r=e.get(t)[2];let l=t-1;const a=[];let c=i._tokenizer;c||(c=r.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const h=c.events,d=[],f={};let m,g,v=-1,y=i,S=0,b=0;const E=[b];for(;y;){for(;e.get(++l)[1]!==y;);a.push(l),y._tokenizer||(m=r.sliceStream(y),y.next||m.push(null),g&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(m),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=i;++v<h.length;)h[v][0]==="exit"&&h[v-1][0]==="enter"&&h[v][1].type===h[v-1][1].type&&h[v][1].start.line!==h[v][1].end.line&&(b=v+1,E.push(b),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):E.pop(),v=E.length;v--;){const C=h.slice(E[v],E[v+1]),L=a.pop();d.push([L,L+C.length-1]),e.splice(L,2,C)}for(d.reverse(),v=-1;++v<d.length;)f[S+d[v][0]]=S+d[v][1],S+=d[v][1]-d[v][0]-1;return f}const cL={resolve:hL,tokenize:fL},uL={partial:!0,tokenize:dL};function hL(e){return cC(e),e}function fL(e,t){let i;return r;function r(h){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),l(h)}function l(h){return h===null?a(h):Ne(h)?e.check(uL,c,a)(h):(e.consume(h),l)}function a(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function c(h){return e.consume(h),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,l}}function dL(e,t,i){const r=this;return l;function l(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),lt(e,a,"linePrefix")}function a(c){if(c===null||Ne(c))return i(c);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(c):e.interrupt(r.parser.constructs.flow,i,t)(c)}}function uC(e,t,i,r,l,a,c,h,d){const f=d||Number.POSITIVE_INFINITY;let m=0;return g;function g(C){return C===60?(e.enter(r),e.enter(l),e.enter(a),e.consume(C),e.exit(a),v):C===null||C===32||C===41||Ag(C)?i(C):(e.enter(r),e.enter(c),e.enter(h),e.enter("chunkString",{contentType:"string"}),b(C))}function v(C){return C===62?(e.enter(a),e.consume(C),e.exit(a),e.exit(l),e.exit(r),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===62?(e.exit("chunkString"),e.exit(h),v(C)):C===null||C===60||Ne(C)?i(C):(e.consume(C),C===92?S:y)}function S(C){return C===60||C===62||C===92?(e.consume(C),y):y(C)}function b(C){return!m&&(C===null||C===41||xi(C))?(e.exit("chunkString"),e.exit(h),e.exit(c),e.exit(r),t(C)):m<f&&C===40?(e.consume(C),m++,b):C===41?(e.consume(C),m--,b):C===null||C===32||C===40||Ag(C)?i(C):(e.consume(C),C===92?E:b)}function E(C){return C===40||C===41||C===92?(e.consume(C),b):b(C)}}function hC(e,t,i,r,l,a){const c=this;let h=0,d;return f;function f(y){return e.enter(r),e.enter(l),e.consume(y),e.exit(l),e.enter(a),m}function m(y){return h>999||y===null||y===91||y===93&&!d||y===94&&!h&&"_hiddenFootnoteSupport"in c.parser.constructs?i(y):y===93?(e.exit(a),e.enter(l),e.consume(y),e.exit(l),e.exit(r),t):Ne(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Ne(y)||h++>999?(e.exit("chunkString"),m(y)):(e.consume(y),d||(d=!Ge(y)),y===92?v:g)}function v(y){return y===91||y===92||y===93?(e.consume(y),h++,g):g(y)}}function fC(e,t,i,r,l,a){let c;return h;function h(v){return v===34||v===39||v===40?(e.enter(r),e.enter(l),e.consume(v),e.exit(l),c=v===40?41:v,d):i(v)}function d(v){return v===c?(e.enter(l),e.consume(v),e.exit(l),e.exit(r),t):(e.enter(a),f(v))}function f(v){return v===c?(e.exit(a),d(c)):v===null?i(v):Ne(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),lt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===c||v===null||Ne(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?g:m)}function g(v){return v===c||v===92?(e.consume(v),m):m(v)}}function aa(e,t){let i;return r;function r(l){return Ne(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i=!0,r):Ge(l)?lt(e,r,i?"linePrefix":"lineSuffix")(l):t(l)}}const pL={name:"definition",tokenize:mL},gL={partial:!0,tokenize:_L};function mL(e,t,i){const r=this;let l;return a;function a(y){return e.enter("definition"),c(y)}function c(y){return hC.call(r,e,h,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return l=Al(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):i(y)}function d(y){return xi(y)?aa(e,f)(y):f(y)}function f(y){return uC(e,m,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(gL,g,g)(y)}function g(y){return Ge(y)?lt(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Ne(y)?(e.exit("definition"),r.parser.defined.push(l),t(y)):i(y)}}function _L(e,t,i){return r;function r(h){return xi(h)?aa(e,l)(h):i(h)}function l(h){return fC(e,a,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function a(h){return Ge(h)?lt(e,c,"whitespace")(h):c(h)}function c(h){return h===null||Ne(h)?t(h):i(h)}}const vL={name:"hardBreakEscape",tokenize:yL};function yL(e,t,i){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),l}function l(a){return Ne(a)?(e.exit("hardBreakEscape"),t(a)):i(a)}}const SL={name:"headingAtx",resolve:bL,tokenize:xL};function bL(e,t){let i=e.length-2,r=3,l,a;return e[r][1].type==="whitespace"&&(r+=2),i-2>r&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(r===i-1||i-4>r&&e[i-2][1].type==="whitespace")&&(i-=r+1===i?2:4),i>r&&(l={type:"atxHeadingText",start:e[r][1].start,end:e[i][1].end},a={type:"chunkText",start:e[r][1].start,end:e[i][1].end,contentType:"text"},Tn(e,r,i-r+1,[["enter",l,t],["enter",a,t],["exit",a,t],["exit",l,t]])),e}function xL(e,t,i){let r=0;return l;function l(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),c(m)}function c(m){return m===35&&r++<6?(e.consume(m),c):m===null||xi(m)?(e.exit("atxHeadingSequence"),h(m)):i(m)}function h(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||Ne(m)?(e.exit("atxHeading"),t(m)):Ge(m)?lt(e,h,"whitespace")(m):(e.enter("atxHeadingText"),f(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),h(m))}function f(m){return m===null||m===35||xi(m)?(e.exit("atxHeadingText"),h(m)):(e.consume(m),f)}}const wL=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],jS=["pre","script","style","textarea"],CL={concrete:!0,name:"htmlFlow",resolveTo:ML,tokenize:TL},EL={partial:!0,tokenize:AL},kL={partial:!0,tokenize:NL};function ML(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function TL(e,t,i){const r=this;let l,a,c,h,d;return f;function f(N){return m(N)}function m(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),g}function g(N){return N===33?(e.consume(N),v):N===47?(e.consume(N),a=!0,b):N===63?(e.consume(N),l=3,r.interrupt?t:T):xn(N)?(e.consume(N),c=String.fromCharCode(N),E):i(N)}function v(N){return N===45?(e.consume(N),l=2,y):N===91?(e.consume(N),l=5,h=0,S):xn(N)?(e.consume(N),l=4,r.interrupt?t:T):i(N)}function y(N){return N===45?(e.consume(N),r.interrupt?t:T):i(N)}function S(N){const ee="CDATA[";return N===ee.charCodeAt(h++)?(e.consume(N),h===ee.length?r.interrupt?t:P:S):i(N)}function b(N){return xn(N)?(e.consume(N),c=String.fromCharCode(N),E):i(N)}function E(N){if(N===null||N===47||N===62||xi(N)){const ee=N===47,ce=c.toLowerCase();return!ee&&!a&&jS.includes(ce)?(l=1,r.interrupt?t(N):P(N)):wL.includes(c.toLowerCase())?(l=6,ee?(e.consume(N),C):r.interrupt?t(N):P(N)):(l=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(N):a?L(N):k(N))}return N===45||Hi(N)?(e.consume(N),c+=String.fromCharCode(N),E):i(N)}function C(N){return N===62?(e.consume(N),r.interrupt?t:P):i(N)}function L(N){return Ge(N)?(e.consume(N),L):ne(N)}function k(N){return N===47?(e.consume(N),ne):N===58||N===95||xn(N)?(e.consume(N),D):Ge(N)?(e.consume(N),k):ne(N)}function D(N){return N===45||N===46||N===58||N===95||Hi(N)?(e.consume(N),D):I(N)}function I(N){return N===61?(e.consume(N),B):Ge(N)?(e.consume(N),I):k(N)}function B(N){return N===null||N===60||N===61||N===62||N===96?i(N):N===34||N===39?(e.consume(N),d=N,U):Ge(N)?(e.consume(N),B):X(N)}function U(N){return N===d?(e.consume(N),d=null,G):N===null||Ne(N)?i(N):(e.consume(N),U)}function X(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||xi(N)?I(N):(e.consume(N),X)}function G(N){return N===47||N===62||Ge(N)?k(N):i(N)}function ne(N){return N===62?(e.consume(N),q):i(N)}function q(N){return N===null||Ne(N)?P(N):Ge(N)?(e.consume(N),q):i(N)}function P(N){return N===45&&l===2?(e.consume(N),M):N===60&&l===1?(e.consume(N),j):N===62&&l===4?(e.consume(N),z):N===63&&l===3?(e.consume(N),T):N===93&&l===5?(e.consume(N),F):Ne(N)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(EL,W,V)(N)):N===null||Ne(N)?(e.exit("htmlFlowData"),V(N)):(e.consume(N),P)}function V(N){return e.check(kL,R,W)(N)}function R(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),O}function O(N){return N===null||Ne(N)?V(N):(e.enter("htmlFlowData"),P(N))}function M(N){return N===45?(e.consume(N),T):P(N)}function j(N){return N===47?(e.consume(N),c="",H):P(N)}function H(N){if(N===62){const ee=c.toLowerCase();return jS.includes(ee)?(e.consume(N),z):P(N)}return xn(N)&&c.length<8?(e.consume(N),c+=String.fromCharCode(N),H):P(N)}function F(N){return N===93?(e.consume(N),T):P(N)}function T(N){return N===62?(e.consume(N),z):N===45&&l===2?(e.consume(N),T):P(N)}function z(N){return N===null||Ne(N)?(e.exit("htmlFlowData"),W(N)):(e.consume(N),z)}function W(N){return e.exit("htmlFlow"),t(N)}}function NL(e,t,i){const r=this;return l;function l(c){return Ne(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):i(c)}function a(c){return r.parser.lazy[r.now().line]?i(c):t(c)}}function AL(e,t,i){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(xh,t,i)}}const DL={name:"htmlText",tokenize:RL};function RL(e,t,i){const r=this;let l,a,c;return h;function h(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),I):T===63?(e.consume(T),k):xn(T)?(e.consume(T),X):i(T)}function f(T){return T===45?(e.consume(T),m):T===91?(e.consume(T),a=0,S):xn(T)?(e.consume(T),L):i(T)}function m(T){return T===45?(e.consume(T),y):i(T)}function g(T){return T===null?i(T):T===45?(e.consume(T),v):Ne(T)?(c=g,j(T)):(e.consume(T),g)}function v(T){return T===45?(e.consume(T),y):g(T)}function y(T){return T===62?M(T):T===45?v(T):g(T)}function S(T){const z="CDATA[";return T===z.charCodeAt(a++)?(e.consume(T),a===z.length?b:S):i(T)}function b(T){return T===null?i(T):T===93?(e.consume(T),E):Ne(T)?(c=b,j(T)):(e.consume(T),b)}function E(T){return T===93?(e.consume(T),C):b(T)}function C(T){return T===62?M(T):T===93?(e.consume(T),C):b(T)}function L(T){return T===null||T===62?M(T):Ne(T)?(c=L,j(T)):(e.consume(T),L)}function k(T){return T===null?i(T):T===63?(e.consume(T),D):Ne(T)?(c=k,j(T)):(e.consume(T),k)}function D(T){return T===62?M(T):k(T)}function I(T){return xn(T)?(e.consume(T),B):i(T)}function B(T){return T===45||Hi(T)?(e.consume(T),B):U(T)}function U(T){return Ne(T)?(c=U,j(T)):Ge(T)?(e.consume(T),U):M(T)}function X(T){return T===45||Hi(T)?(e.consume(T),X):T===47||T===62||xi(T)?G(T):i(T)}function G(T){return T===47?(e.consume(T),M):T===58||T===95||xn(T)?(e.consume(T),ne):Ne(T)?(c=G,j(T)):Ge(T)?(e.consume(T),G):M(T)}function ne(T){return T===45||T===46||T===58||T===95||Hi(T)?(e.consume(T),ne):q(T)}function q(T){return T===61?(e.consume(T),P):Ne(T)?(c=q,j(T)):Ge(T)?(e.consume(T),q):G(T)}function P(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(e.consume(T),l=T,V):Ne(T)?(c=P,j(T)):Ge(T)?(e.consume(T),P):(e.consume(T),R)}function V(T){return T===l?(e.consume(T),l=void 0,O):T===null?i(T):Ne(T)?(c=V,j(T)):(e.consume(T),V)}function R(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||xi(T)?G(T):(e.consume(T),R)}function O(T){return T===47||T===62||xi(T)?G(T):i(T)}function M(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):i(T)}function j(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),H}function H(T){return Ge(T)?lt(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):F(T)}function F(T){return e.enter("htmlTextData"),c(T)}}const vm={name:"labelEnd",resolveAll:OL,resolveTo:HL,tokenize:jL},BL={tokenize:PL},LL={tokenize:IL},zL={tokenize:UL};function OL(e){let t=-1;const i=[];for(;++t<e.length;){const r=e[t][1];if(i.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const l=r.type==="labelImage"?4:2;r.type="data",t+=l}}return e.length!==i.length&&Tn(e,0,e.length,i),e}function HL(e,t){let i=e.length,r=0,l,a,c,h;for(;i--;)if(l=e[i][1],a){if(l.type==="link"||l.type==="labelLink"&&l._inactive)break;e[i][0]==="enter"&&l.type==="labelLink"&&(l._inactive=!0)}else if(c){if(e[i][0]==="enter"&&(l.type==="labelImage"||l.type==="labelLink")&&!l._balanced&&(a=i,l.type!=="labelLink")){r=2;break}}else l.type==="labelEnd"&&(c=i);const d={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[c][1].end}},m={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[c-2][1].start}};return h=[["enter",d,t],["enter",f,t]],h=Gi(h,e.slice(a+1,a+r+3)),h=Gi(h,[["enter",m,t]]),h=Gi(h,_m(t.parser.constructs.insideSpan.null,e.slice(a+r+4,c-3),t)),h=Gi(h,[["exit",m,t],e[c-2],e[c-1],["exit",f,t]]),h=Gi(h,e.slice(c+1)),h=Gi(h,[["exit",d,t]]),Tn(e,a,e.length,h),e}function jL(e,t,i){const r=this;let l=r.events.length,a,c;for(;l--;)if((r.events[l][1].type==="labelImage"||r.events[l][1].type==="labelLink")&&!r.events[l][1]._balanced){a=r.events[l][1];break}return h;function h(v){return a?a._inactive?g(v):(c=r.parser.defined.includes(Al(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):i(v)}function d(v){return v===40?e.attempt(BL,m,c?m:g)(v):v===91?e.attempt(LL,m,c?f:g)(v):c?m(v):g(v)}function f(v){return e.attempt(zL,m,g)(v)}function m(v){return t(v)}function g(v){return a._balanced=!0,i(v)}}function PL(e,t,i){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),l}function l(g){return xi(g)?aa(e,a)(g):a(g)}function a(g){return g===41?m(g):uC(e,c,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return xi(g)?aa(e,d)(g):m(g)}function h(g){return i(g)}function d(g){return g===34||g===39||g===40?fC(e,f,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function f(g){return xi(g)?aa(e,m)(g):m(g)}function m(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):i(g)}}function IL(e,t,i){const r=this;return l;function l(h){return hC.call(r,e,a,c,"reference","referenceMarker","referenceString")(h)}function a(h){return r.parser.defined.includes(Al(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(h):i(h)}function c(h){return i(h)}}function UL(e,t,i){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),l}function l(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):i(a)}}const qL={name:"labelStartImage",resolveAll:vm.resolveAll,tokenize:VL};function VL(e,t,i){const r=this;return l;function l(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),a}function a(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),c):i(h)}function c(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(h):t(h)}}const FL={name:"labelStartLink",resolveAll:vm.resolveAll,tokenize:YL};function YL(e,t,i){const r=this;return l;function l(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),a}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(c):t(c)}}const Sp={name:"lineEnding",tokenize:WL};function WL(e,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),lt(e,t,"linePrefix")}}const Hu={name:"thematicBreak",tokenize:$L};function $L(e,t,i){let r=0,l;return a;function a(f){return e.enter("thematicBreak"),c(f)}function c(f){return l=f,h(f)}function h(f){return f===l?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Ne(f))?(e.exit("thematicBreak"),t(f)):i(f)}function d(f){return f===l?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Ge(f)?lt(e,h,"whitespace")(f):h(f))}}const Si={continuation:{tokenize:ZL},exit:JL,name:"list",tokenize:GL},XL={partial:!0,tokenize:ez},KL={partial:!0,tokenize:QL};function GL(e,t,i){const r=this,l=r.events[r.events.length-1];let a=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,c=0;return h;function h(y){const S=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Dg(y)){if(r.containerState.type||(r.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Hu,i,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return i(y)}function d(y){return Dg(y)&&++c<10?(e.consume(y),d):(!r.interrupt||c<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):i(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(xh,r.interrupt?i:m,e.attempt(XL,v,g))}function m(y){return r.containerState.initialBlankLine=!0,a++,v(y)}function g(y){return Ge(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):i(y)}function v(y){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function ZL(e,t,i){const r=this;return r.containerState._closeFlow=void 0,e.check(xh,l,a);function l(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,lt(e,t,"listItemIndent",r.containerState.size+1)(h)}function a(h){return r.containerState.furtherBlankLines||!Ge(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(KL,t,c)(h))}function c(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,lt(e,e.attempt(Si,t,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function QL(e,t,i){const r=this;return lt(e,l,"listItemIndent",r.containerState.size+1);function l(a){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(a):i(a)}}function JL(e){e.exit(this.containerState.type)}function ez(e,t,i){const r=this;return lt(e,l,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(a){const c=r.events[r.events.length-1];return!Ge(a)&&c&&c[1].type==="listItemPrefixWhitespace"?t(a):i(a)}}const PS={name:"setextUnderline",resolveTo:tz,tokenize:iz};function tz(e,t){let i=e.length,r,l,a;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){r=i;break}e[i][1].type==="paragraph"&&(l=i)}else e[i][1].type==="content"&&e.splice(i,1),!a&&e[i][1].type==="definition"&&(a=i);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[l][1].type="setextHeadingText",a?(e.splice(l,0,["enter",c,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function iz(e,t,i){const r=this;let l;return a;function a(f){let m=r.events.length,g;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){g=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),l=f,c(f)):i(f)}function c(f){return e.enter("setextHeadingLineSequence"),h(f)}function h(f){return f===l?(e.consume(f),h):(e.exit("setextHeadingLineSequence"),Ge(f)?lt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Ne(f)?(e.exit("setextHeadingLine"),t(f)):i(f)}}const nz={tokenize:rz};function rz(e){const t=this,i=e.attempt(xh,r,e.attempt(this.parser.constructs.flowInitial,l,lt(e,e.attempt(this.parser.constructs.flow,l,e.attempt(cL,l)),"linePrefix")));return i;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,i}function l(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,i}}const sz={resolveAll:pC()},lz=dC("string"),oz=dC("text");function dC(e){return{resolveAll:pC(e==="text"?az:void 0),tokenize:t};function t(i){const r=this,l=this.parser.constructs[e],a=i.attempt(l,c,h);return c;function c(m){return f(m)?a(m):h(m)}function h(m){if(m===null){i.consume(m);return}return i.enter("data"),i.consume(m),d}function d(m){return f(m)?(i.exit("data"),a(m)):(i.consume(m),d)}function f(m){if(m===null)return!0;const g=l[m];let v=-1;if(g)for(;++v<g.length;){const y=g[v];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function pC(e){return t;function t(i,r){let l=-1,a;for(;++l<=i.length;)a===void 0?i[l]&&i[l][1].type==="data"&&(a=l,l++):(!i[l]||i[l][1].type!=="data")&&(l!==a+2&&(i[a][1].end=i[l-1][1].end,i.splice(a+2,l-a-2),l=a+2),a=void 0);return e?e(i,r):i}}function az(e,t){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const r=e[i-1][1],l=t.sliceStream(r);let a=l.length,c=-1,h=0,d;for(;a--;){const f=l[a];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)h++,c--;if(c)break;c=-1}else if(f===-2)d=!0,h++;else if(f!==-1){a++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(h=0),h){const f={type:i===e.length||d||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?c:r.start._bufferIndex+c,_index:r.start._index+a,line:r.end.line,column:r.end.column-h,offset:r.end.offset-h},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(i,0,["enter",f,t],["exit",f,t]),i+=2)}i++}return e}const cz={42:Si,43:Si,45:Si,48:Si,49:Si,50:Si,51:Si,52:Si,53:Si,54:Si,55:Si,56:Si,57:Si,62:lC},uz={91:pL},hz={[-2]:yp,[-1]:yp,32:yp},fz={35:SL,42:Hu,45:[PS,Hu],60:CL,61:PS,95:Hu,96:HS,126:HS},dz={38:aC,92:oC},pz={[-5]:Sp,[-4]:Sp,[-3]:Sp,33:qL,38:aC,42:Rg,60:[F6,DL],91:FL,92:[vL,oC],93:vm,95:Rg,96:nL},gz={null:[Rg,sz]},mz={null:[42,95]},_z={null:[]},vz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mz,contentInitial:uz,disable:_z,document:cz,flow:fz,flowInitial:hz,insideSpan:gz,string:dz,text:pz},Symbol.toStringTag,{value:"Module"}));function yz(e,t,i){let r={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const l={},a=[];let c=[],h=[];const d={attempt:U(I),check:U(B),consume:L,enter:k,exit:D,interrupt:U(B,{interrupt:!0})},f={code:null,containerState:{},defineSkip:b,events:[],now:S,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:g};let m=t.tokenize.call(f,d);return t.resolveAll&&a.push(t),f;function g(q){return c=Gi(c,q),E(),c[c.length-1]!==null?[]:(X(t,0),f.events=_m(a,f.events,f),f.events)}function v(q,P){return bz(y(q),P)}function y(q){return Sz(c,q)}function S(){const{_bufferIndex:q,_index:P,line:V,column:R,offset:O}=r;return{_bufferIndex:q,_index:P,line:V,column:R,offset:O}}function b(q){l[q.line]=q.column,ne()}function E(){let q;for(;r._index<c.length;){const P=c[r._index];if(typeof P=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<P.length;)C(P.charCodeAt(r._bufferIndex));else C(P)}}function C(q){m=m(q)}function L(q){Ne(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,ne()):q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=q}function k(q,P){const V=P||{};return V.type=q,V.start=S(),f.events.push(["enter",V,f]),h.push(V),V}function D(q){const P=h.pop();return P.end=S(),f.events.push(["exit",P,f]),P}function I(q,P){X(q,P.from)}function B(q,P){P.restore()}function U(q,P){return V;function V(R,O,M){let j,H,F,T;return Array.isArray(R)?W(R):"tokenize"in R?W([R]):z(R);function z(oe){return fe;function fe(he){const pe=he!==null&&oe[he],Ce=he!==null&&oe.null,xe=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return W(xe)(he)}}function W(oe){return j=oe,H=0,oe.length===0?M:N(oe[H])}function N(oe){return fe;function fe(he){return T=G(),F=oe,oe.partial||(f.currentConstruct=oe),oe.name&&f.parser.constructs.disable.null.includes(oe.name)?ce():oe.tokenize.call(P?Object.assign(Object.create(f),P):f,d,ee,ce)(he)}}function ee(oe){return q(F,T),O}function ce(oe){return T.restore(),++H<j.length?N(j[H]):M}}}function X(q,P){q.resolveAll&&!a.includes(q)&&a.push(q),q.resolve&&Tn(f.events,P,f.events.length-P,q.resolve(f.events.slice(P),f)),q.resolveTo&&(f.events=q.resolveTo(f.events,f))}function G(){const q=S(),P=f.previous,V=f.currentConstruct,R=f.events.length,O=Array.from(h);return{from:R,restore:M};function M(){r=q,f.previous=P,f.currentConstruct=V,f.events.length=R,h=O,ne()}}function ne(){r.line in l&&r.column<2&&(r.column=l[r.line],r.offset+=l[r.line]-1)}}function Sz(e,t){const i=t.start._index,r=t.start._bufferIndex,l=t.end._index,a=t.end._bufferIndex;let c;if(i===l)c=[e[i].slice(r,a)];else{if(c=e.slice(i,l),r>-1){const h=c[0];typeof h=="string"?c[0]=h.slice(r):c.shift()}a>0&&c.push(e[l].slice(0,a))}return c}function bz(e,t){let i=-1;const r=[];let l;for(;++i<e.length;){const a=e[i];let c;if(typeof a=="string")c=a;else switch(a){case-5:{c="\r";break}case-4:{c=`
123
+ `;break}case-3:{c=`\r
124
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&l)continue;c=" ";break}default:c=String.fromCharCode(a)}l=a===-2,r.push(c)}return r.join("")}function xz(e){const r={constructs:N6([vz,...(e||{}).extensions||[]]),content:l(H6),defined:[],document:l(P6),flow:l(nz),lazy:{},string:l(lz),text:l(oz)};return r;function l(a){return c;function c(h){return yz(r,a,h)}}}function wz(e){for(;!cC(e););return e}const IS=/[\0\t\n\r]/g;function Cz(){let e=1,t="",i=!0,r;return l;function l(a,c,h){const d=[];let f,m,g,v,y;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(c||void 0).decode(a)),g=0,t="",i&&(a.charCodeAt(0)===65279&&g++,i=void 0);g<a.length;){if(IS.lastIndex=g,f=IS.exec(a),v=f&&f.index!==void 0?f.index:a.length,y=a.charCodeAt(v),!f){t=a.slice(g);break}if(y===10&&g===v&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),g<v&&(d.push(a.slice(g,v)),e+=v-g),y){case 0:{d.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,d.push(-2);e++<m;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}g=v+1}return h&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Ez=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function kz(e){return e.replace(Ez,Mz)}function Mz(e,t,i){if(t)return t;if(i.charCodeAt(0)===35){const l=i.charCodeAt(1),a=l===120||l===88;return sC(i.slice(a?2:1),a?16:10)}return mm(i)||e}const gC={}.hasOwnProperty;function Tz(e,t,i){return t&&typeof t=="object"&&(i=t,t=void 0),Nz(i)(wz(xz(i).document().write(Cz()(e,t,!0))))}function Nz(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Jt),autolinkProtocol:G,autolinkEmail:G,atxHeading:a(We),blockQuote:a(Ce),characterEscape:G,characterReference:G,codeFenced:a(xe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:a(xe,c),codeText:a(Se,c),codeTextData:G,data:G,codeFlowValue:G,definition:a(me),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:a(Ae),hardBreakEscape:a(ze),hardBreakTrailing:a(ze),htmlFlow:a(St,c),htmlFlowData:G,htmlText:a(St,c),htmlTextData:G,image:a(Ci),label:c,link:a(Jt),listItem:a(Qi),listItemValue:v,listOrdered:a(ui,g),listUnordered:a(ui),paragraph:a(An),reference:N,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:a(We),strong:a(Dn),thematicBreak:a(ar)},exit:{atxHeading:d(),atxHeadingSequence:I,autolink:d(),autolinkEmail:pe,autolinkProtocol:he,blockQuote:d(),characterEscapeValue:ne,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:oe,characterReference:fe,codeFenced:d(E),codeFencedFence:b,codeFencedFenceInfo:y,codeFencedFenceMeta:S,codeFlowValue:ne,codeIndented:d(C),codeText:d(O),codeTextData:ne,data:ne,definition:d(),definitionDestinationString:D,definitionLabelString:L,definitionTitleString:k,emphasis:d(),hardBreakEscape:d(P),hardBreakTrailing:d(P),htmlFlow:d(V),htmlFlowData:ne,htmlText:d(R),htmlTextData:ne,image:d(j),label:F,labelText:H,lineEnding:q,link:d(M),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ee,resourceDestinationString:T,resourceTitleString:z,resource:W,setextHeading:d(X),setextHeadingLineSequence:U,setextHeadingText:B,strong:d(),thematicBreak:d()}};mC(t,(e||{}).mdastExtensions||[]);const i={};return r;function r(re){let ge={type:"root",children:[]};const ke={stack:[ge],tokenStack:[],config:t,enter:h,exit:f,buffer:c,resume:m,data:i},Oe=[];let Fe=-1;for(;++Fe<re.length;)if(re[Fe][1].type==="listOrdered"||re[Fe][1].type==="listUnordered")if(re[Fe][0]==="enter")Oe.push(Fe);else{const si=Oe.pop();Fe=l(re,si,Fe)}for(Fe=-1;++Fe<re.length;){const si=t[re[Fe][0]];gC.call(si,re[Fe][1].type)&&si[re[Fe][1].type].call(Object.assign({sliceSerialize:re[Fe][2].sliceSerialize},ke),re[Fe][1])}if(ke.tokenStack.length>0){const si=ke.tokenStack[ke.tokenStack.length-1];(si[1]||US).call(ke,void 0,si[0])}for(ge.position={start:Vr(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Vr(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<t.transforms.length;)ge=t.transforms[Fe](ge)||ge;return ge}function l(re,ge,ke){let Oe=ge-1,Fe=-1,si=!1,Ji,Wt,bt,ei;for(;++Oe<=ke;){const Ze=re[Oe];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Fe++:Fe--,ei=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(Ji&&!ei&&!Fe&&!bt&&(bt=Oe),ei=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ei=void 0}if(!Fe&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Fe===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(Ji){let hn=Oe;for(Wt=void 0;hn--;){const Ei=re[hn];if(Ei[1].type==="lineEnding"||Ei[1].type==="lineEndingBlank"){if(Ei[0]==="exit")continue;Wt&&(re[Wt][1].type="lineEndingBlank",si=!0),Ei[1].type="lineEnding",Wt=hn}else if(!(Ei[1].type==="linePrefix"||Ei[1].type==="blockQuotePrefix"||Ei[1].type==="blockQuotePrefixWhitespace"||Ei[1].type==="blockQuoteMarker"||Ei[1].type==="listItemIndent"))break}bt&&(!Wt||bt<Wt)&&(Ji._spread=!0),Ji.end=Object.assign({},Wt?re[Wt][1].start:Ze[1].end),re.splice(Wt||Oe,0,["exit",Ji,Ze[2]]),Oe++,ke++}if(Ze[1].type==="listItemPrefix"){const hn={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};Ji=hn,re.splice(Oe,0,["enter",hn,Ze[2]]),Oe++,ke++,bt=void 0,ei=!0}}}return re[ge][1]._spread=si,ke}function a(re,ge){return ke;function ke(Oe){h.call(this,re(Oe),Oe),ge&&ge.call(this,Oe)}}function c(){this.stack.push({type:"fragment",children:[]})}function h(re,ge,ke){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ge,ke||void 0]),re.position={start:Vr(ge.start),end:void 0}}function d(re){return ge;function ge(ke){re&&re.call(this,ke),f.call(this,ke)}}function f(re,ge){const ke=this.stack.pop(),Oe=this.tokenStack.pop();if(Oe)Oe[0].type!==re.type&&(ge?ge.call(this,re,Oe[0]):(Oe[1]||US).call(this,re,Oe[0]));else throw new Error("Cannot close `"+re.type+"` ("+oa({start:re.start,end:re.end})+"): it’s not open");ke.position.end=Vr(re.end)}function m(){return M6(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function v(re){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function y(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=re}function S(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=re}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re.replace(/(\r?\n|\r)$/g,"")}function L(re){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=Al(this.sliceSerialize(re)).toLowerCase()}function k(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.title=re}function D(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.url=re}function I(re){const ge=this.stack[this.stack.length-1];if(!ge.depth){const ke=this.sliceSerialize(re).length;ge.depth=ke}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function U(re){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function G(re){const ke=this.stack[this.stack.length-1].children;let Oe=ke[ke.length-1];(!Oe||Oe.type!=="text")&&(Oe=Lt(),Oe.position={start:Vr(re.start),end:void 0},ke.push(Oe)),this.stack.push(Oe)}function ne(re){const ge=this.stack.pop();ge.value+=this.sliceSerialize(re),ge.position.end=Vr(re.end)}function q(re){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=ge.children[ge.children.length-1];ke.position.end=Vr(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(G.call(this,re),ne.call(this,re))}function P(){this.data.atHardBreak=!0}function V(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re}function R(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re}function O(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.value=re}function M(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ge,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function j(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ge,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function H(re){const ge=this.sliceSerialize(re),ke=this.stack[this.stack.length-2];ke.label=kz(ge),ke.identifier=Al(ge).toLowerCase()}function F(){const re=this.stack[this.stack.length-1],ge=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const Oe=re.children;ke.children=Oe}else ke.alt=ge}function T(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.url=re}function z(){const re=this.resume(),ge=this.stack[this.stack.length-1];ge.title=re}function W(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function ee(re){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=Al(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function ce(re){this.data.characterReferenceType=re.type}function oe(re){const ge=this.sliceSerialize(re),ke=this.data.characterReferenceType;let Oe;ke?(Oe=sC(ge,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=mm(ge);const Fe=this.stack[this.stack.length-1];Fe.value+=Oe}function fe(re){const ge=this.stack.pop();ge.position.end=Vr(re.end)}function he(re){ne.call(this,re);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(re)}function pe(re){ne.call(this,re);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(re)}function Ce(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ae(){return{type:"emphasis",children:[]}}function We(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function St(){return{type:"html",value:""}}function Ci(){return{type:"image",title:null,url:"",alt:null}}function Jt(){return{type:"link",title:null,url:"",children:[]}}function ui(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[]}}function Qi(re){return{type:"listItem",spread:re._spread,checked:null,children:[]}}function An(){return{type:"paragraph",children:[]}}function Dn(){return{type:"strong",children:[]}}function Lt(){return{type:"text",value:""}}function ar(){return{type:"thematicBreak"}}}function Vr(e){return{line:e.line,column:e.column,offset:e.offset}}function mC(e,t){let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)?mC(e,r):Az(e,r)}}function Az(e,t){let i;for(i in t)if(gC.call(t,i))switch(i){case"canContainEols":{const r=t[i];r&&e[i].push(...r);break}case"transforms":{const r=t[i];r&&e[i].push(...r);break}case"enter":case"exit":{const r=t[i];r&&Object.assign(e[i],r);break}}}function US(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+oa({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+oa({start:t.start,end:t.end})+") is still open")}function Dz(e){const t=this;t.parser=i;function i(r){return Tz(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Rz(e,t){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,i),e.applyData(t,i)}function Bz(e,t){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,i),[e.applyData(t,i),{type:"text",value:`
125
+ `}]}function Lz(e,t){const i=t.value?t.value+`
126
+ `:"",r={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(r.className=["language-"+l[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:i}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function zz(e,t){const i={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Oz(e,t){const i={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Hz(e,t){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),l=ql(r.toLowerCase()),a=e.footnoteOrder.indexOf(r);let c,h=e.footnoteCounts.get(r);h===void 0?(h=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=a+1,h+=1,e.footnoteCounts.set(r,h);const d={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+l,id:i+"fnref-"+l+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function jz(e,t){const i={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Pz(e,t){if(e.options.allowDangerousHtml){const i={type:"raw",value:t.value};return e.patch(t,i),e.applyData(t,i)}}function _C(e,t){const i=t.referenceType;let r="]";if(i==="collapsed"?r+="[]":i==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const l=e.all(t),a=l[0];a&&a.type==="text"?a.value="["+a.value:l.unshift({type:"text",value:"["});const c=l[l.length-1];return c&&c.type==="text"?c.value+=r:l.push({type:"text",value:r}),l}function Iz(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return _C(e,t);const l={src:ql(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(l.title=r.title);const a={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,a),e.applyData(t,a)}function Uz(e,t){const i={src:ql(t.url)};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),t.title!==null&&t.title!==void 0&&(i.title=t.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function qz(e,t){const i={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,i);const r={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(t,r),e.applyData(t,r)}function Vz(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return _C(e,t);const l={href:ql(r.url||"")};r.title!==null&&r.title!==void 0&&(l.title=r.title);const a={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Fz(e,t){const i={href:ql(t.url)};t.title!==null&&t.title!==void 0&&(i.title=t.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Yz(e,t,i){const r=e.all(t),l=i?Wz(i):vC(t),a={},c=[];if(typeof t.checked=="boolean"){const m=r[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let h=-1;for(;++h<r.length;){const m=r[h];(l||h!==0||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
127
+ `}),m.type==="element"&&m.tagName==="p"&&!l?c.push(...m.children):c.push(m)}const d=r[r.length-1];d&&(l||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
128
+ `});const f={type:"element",tagName:"li",properties:a,children:c};return e.patch(t,f),e.applyData(t,f)}function Wz(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const i=e.children;let r=-1;for(;!t&&++r<i.length;)t=vC(i[r])}return t}function vC(e){const t=e.spread;return t??e.children.length>1}function $z(e,t){const i={},r=e.all(t);let l=-1;for(typeof t.start=="number"&&t.start!==1&&(i.start=t.start);++l<r.length;){const c=r[l];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:i,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Xz(e,t){const i={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Kz(e,t){const i={type:"root",children:e.wrap(e.all(t))};return e.patch(t,i),e.applyData(t,i)}function Gz(e,t){const i={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Zz(e,t){const i=e.all(t),r=i.shift(),l=[];if(r){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],c),l.push(c)}if(i.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},h=fm(t.children[1]),d=Qw(t.children[t.children.length-1]);h&&d&&(c.position={start:h,end:d}),l.push(c)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(t,a),e.applyData(t,a)}function Qz(e,t,i){const r=i?i.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",c=i&&i.type==="table"?i.align:void 0,h=c?c.length:t.children.length;let d=-1;const f=[];for(;++d<h;){const g=t.children[d],v={},y=c?c[d]:void 0;y&&(v.align=y);let S={type:"element",tagName:a,properties:v,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),f.push(S)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,m),e.applyData(t,m)}function Jz(e,t){const i={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}const qS=9,VS=32;function eO(e){const t=String(e),i=/\r?\n|\r/g;let r=i.exec(t),l=0;const a=[];for(;r;)a.push(FS(t.slice(l,r.index),l>0,!0),r[0]),l=r.index+r[0].length,r=i.exec(t);return a.push(FS(t.slice(l),l>0,!1)),a.join("")}function FS(e,t,i){let r=0,l=e.length;if(t){let a=e.codePointAt(r);for(;a===qS||a===VS;)r++,a=e.codePointAt(r)}if(i){let a=e.codePointAt(l-1);for(;a===qS||a===VS;)l--,a=e.codePointAt(l-1)}return l>r?e.slice(r,l):""}function tO(e,t){const i={type:"text",value:eO(String(t.value))};return e.patch(t,i),e.applyData(t,i)}function iO(e,t){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,i),e.applyData(t,i)}const nO={blockquote:Rz,break:Bz,code:Lz,delete:zz,emphasis:Oz,footnoteReference:Hz,heading:jz,html:Pz,imageReference:Iz,image:Uz,inlineCode:qz,linkReference:Vz,link:Fz,listItem:Yz,list:$z,paragraph:Xz,root:Kz,strong:Gz,table:Zz,tableCell:Jz,tableRow:Qz,text:tO,thematicBreak:iO,toml:xu,yaml:xu,definition:xu,footnoteDefinition:xu};function xu(){}const yC=-1,wh=0,ca=1,eh=2,ym=3,Sm=4,bm=5,xm=6,SC=7,bC=8,YS=typeof self=="object"?self:globalThis,rO=(e,t)=>{const i=(l,a)=>(e.set(a,l),l),r=l=>{if(e.has(l))return e.get(l);const[a,c]=t[l];switch(a){case wh:case yC:return i(c,l);case ca:{const h=i([],l);for(const d of c)h.push(r(d));return h}case eh:{const h=i({},l);for(const[d,f]of c)h[r(d)]=r(f);return h}case ym:return i(new Date(c),l);case Sm:{const{source:h,flags:d}=c;return i(new RegExp(h,d),l)}case bm:{const h=i(new Map,l);for(const[d,f]of c)h.set(r(d),r(f));return h}case xm:{const h=i(new Set,l);for(const d of c)h.add(r(d));return h}case SC:{const{name:h,message:d}=c;return i(new YS[h](d),l)}case bC:return i(BigInt(c),l);case"BigInt":return i(Object(BigInt(c)),l);case"ArrayBuffer":return i(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:h}=new Uint8Array(c);return i(new DataView(h),c)}}return i(new YS[a](c),l)};return r},WS=e=>rO(new Map,e)(0),wl="",{toString:sO}={},{keys:lO}=Object,Go=e=>{const t=typeof e;if(t!=="object"||!e)return[wh,t];const i=sO.call(e).slice(8,-1);switch(i){case"Array":return[ca,wl];case"Object":return[eh,wl];case"Date":return[ym,wl];case"RegExp":return[Sm,wl];case"Map":return[bm,wl];case"Set":return[xm,wl];case"DataView":return[ca,i]}return i.includes("Array")?[ca,i]:i.includes("Error")?[SC,i]:[eh,i]},wu=([e,t])=>e===wh&&(t==="function"||t==="symbol"),oO=(e,t,i,r)=>{const l=(c,h)=>{const d=r.push(c)-1;return i.set(h,d),d},a=c=>{if(i.has(c))return i.get(c);let[h,d]=Go(c);switch(h){case wh:{let m=c;switch(d){case"bigint":h=bC,m=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return l([yC],c)}return l([h,m],c)}case ca:{if(d){let v=c;return d==="DataView"?v=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(v=new Uint8Array(c)),l([d,[...v]],c)}const m=[],g=l([h,m],c);for(const v of c)m.push(a(v));return g}case eh:{if(d)switch(d){case"BigInt":return l([d,c.toString()],c);case"Boolean":case"Number":case"String":return l([d,c.valueOf()],c)}if(t&&"toJSON"in c)return a(c.toJSON());const m=[],g=l([h,m],c);for(const v of lO(c))(e||!wu(Go(c[v])))&&m.push([a(v),a(c[v])]);return g}case ym:return l([h,c.toISOString()],c);case Sm:{const{source:m,flags:g}=c;return l([h,{source:m,flags:g}],c)}case bm:{const m=[],g=l([h,m],c);for(const[v,y]of c)(e||!(wu(Go(v))||wu(Go(y))))&&m.push([a(v),a(y)]);return g}case xm:{const m=[],g=l([h,m],c);for(const v of c)(e||!wu(Go(v)))&&m.push(a(v));return g}}const{message:f}=c;return l([h,{name:d,message:f}],c)};return a},$S=(e,{json:t,lossy:i}={})=>{const r=[];return oO(!(t||i),!!t,new Map,r)(e),r},th=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?WS($S(e,t)):structuredClone(e):(e,t)=>WS($S(e,t));function aO(e,t){const i=[{type:"text",value:"↩"}];return t>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),i}function cO(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function uO(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||aO,r=e.options.footnoteBackLabel||cO,l=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const m=e.all(f),g=String(f.identifier).toUpperCase(),v=ql(g.toLowerCase());let y=0;const S=[],b=e.footnoteCounts.get(g);for(;b!==void 0&&++y<=b;){S.length>0&&S.push({type:"text",value:" "});let L=typeof i=="string"?i:i(d,y);typeof L=="string"&&(L={type:"text",value:L}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,y),className:["data-footnote-backref"]},children:Array.isArray(L)?L:[L]})}const E=m[m.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const L=E.children[E.children.length-1];L&&L.type==="text"?L.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...S)}else m.push(...S);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(m,!0)};e.patch(f,C),h.push(C)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...th(c),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
129
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
130
+ `}]}}const xC=(function(e){if(e==null)return pO;if(typeof e=="function")return Ch(e);if(typeof e=="object")return Array.isArray(e)?hO(e):fO(e);if(typeof e=="string")return dO(e);throw new Error("Expected function, string, or object as test")});function hO(e){const t=[];let i=-1;for(;++i<e.length;)t[i]=xC(e[i]);return Ch(r);function r(...l){let a=-1;for(;++a<t.length;)if(t[a].apply(this,l))return!0;return!1}}function fO(e){const t=e;return Ch(i);function i(r){const l=r;let a;for(a in e)if(l[a]!==t[a])return!1;return!0}}function dO(e){return Ch(t);function t(i){return i&&i.type===e}}function Ch(e){return t;function t(i,r,l){return!!(gO(i)&&e.call(this,i,typeof r=="number"?r:void 0,l||void 0))}}function pO(){return!0}function gO(e){return e!==null&&typeof e=="object"&&"type"in e}const wC=[],mO=!0,XS=!1,_O="skip";function vO(e,t,i,r){let l;typeof t=="function"&&typeof i!="function"?(r=i,i=t):l=t;const a=xC(l),c=r?-1:1;h(e,void 0,[])();function h(d,f,m){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=wC,S,b,E;if((!t||a(d,f,m[m.length-1]||void 0))&&(y=yO(i(d,m)),y[0]===XS))return y;if("children"in d&&d.children){const C=d;if(C.children&&y[0]!==_O)for(b=(r?C.children.length:-1)+c,E=m.concat(C);b>-1&&b<C.children.length;){const L=C.children[b];if(S=h(L,b,E)(),S[0]===XS)return S;b=typeof S[1]=="number"?S[1]:b+c}}return y}}}function yO(e){return Array.isArray(e)?e:typeof e=="number"?[mO,e]:e==null?wC:[e]}function CC(e,t,i,r){let l,a,c;typeof t=="function"&&typeof i!="function"?(a=void 0,c=t,l=i):(a=t,c=i,l=r),vO(e,a,h,l);function h(d,f){const m=f[f.length-1],g=m?m.children.indexOf(d):void 0;return c(d,g,m)}}const Bg={}.hasOwnProperty,SO={};function bO(e,t){const i=t||SO,r=new Map,l=new Map,a=new Map,c={...nO,...i.handlers},h={all:f,applyData:wO,definitionById:r,footnoteById:l,footnoteCounts:a,footnoteOrder:[],handlers:c,one:d,options:i,patch:xO,wrap:EO};return CC(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const g=m.type==="definition"?r:l,v=String(m.identifier).toUpperCase();g.has(v)||g.set(v,m)}}),h;function d(m,g){const v=m.type,y=h.handlers[v];if(Bg.call(h.handlers,v)&&y)return y(h,m,g);if(h.options.passThrough&&h.options.passThrough.includes(v)){if("children"in m){const{children:b,...E}=m,C=th(E);return C.children=h.all(m),C}return th(m)}return(h.options.unknownHandler||CO)(h,m,g)}function f(m){const g=[];if("children"in m){const v=m.children;let y=-1;for(;++y<v.length;){const S=h.one(v[y],m);if(S){if(y&&v[y-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=KS(S.value)),!Array.isArray(S)&&S.type==="element")){const b=S.children[0];b&&b.type==="text"&&(b.value=KS(b.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function xO(e,t){e.position&&(t.position=s6(e))}function wO(e,t){let i=t;if(e&&e.data){const r=e.data.hName,l=e.data.hChildren,a=e.data.hProperties;if(typeof r=="string")if(i.type==="element")i.tagName=r;else{const c="children"in i?i.children:[i];i={type:"element",tagName:r,properties:{},children:c}}i.type==="element"&&a&&Object.assign(i.properties,th(a)),"children"in i&&i.children&&l!==null&&l!==void 0&&(i.children=l)}return i}function CO(e,t){const i=t.data||{},r="value"in t&&!(Bg.call(i,"hProperties")||Bg.call(i,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function EO(e,t){const i=[];let r=-1;for(t&&i.push({type:"text",value:`
131
+ `});++r<e.length;)r&&i.push({type:"text",value:`
132
+ `}),i.push(e[r]);return t&&e.length>0&&i.push({type:"text",value:`
133
+ `}),i}function KS(e){let t=0,i=e.charCodeAt(t);for(;i===9||i===32;)t++,i=e.charCodeAt(t);return e.slice(t)}function GS(e,t){const i=bO(e,t),r=i.one(e,void 0),l=uO(i),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return l&&a.children.push({type:"text",value:`
134
+ `},l),a}function kO(e,t){return e&&"run"in e?async function(i,r){const l=GS(i,{file:r,...t});await e.run(l,r)}:function(i,r){return GS(i,{file:r,...e||t})}}function ZS(e){if(e)throw e}var bp,QS;function MO(){if(QS)return bp;QS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,i=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},a=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!g)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},c=function(f,m){i&&m.name==="__proto__"?i(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},h=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(r)return r(f,m).value}else return;return f[m]};return bp=function d(){var f,m,g,v,y,S,b=arguments[0],E=1,C=arguments.length,L=!1;for(typeof b=="boolean"&&(L=b,b=arguments[1]||{},E=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});E<C;++E)if(f=arguments[E],f!=null)for(m in f)g=h(b,m),v=h(f,m),b!==v&&(L&&v&&(a(v)||(y=l(v)))?(y?(y=!1,S=g&&l(g)?g:[]):S=g&&a(g)?g:{},c(b,{name:m,newValue:d(L,S,v)})):typeof v<"u"&&c(b,{name:m,newValue:v}));return b},bp}var TO=MO();const xp=rh(TO);function Lg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function NO(){const e=[],t={run:i,use:r};return t;function i(...l){let a=-1;const c=l.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);h(null,...l);function h(d,...f){const m=e[++a];let g=-1;if(d){c(d);return}for(;++g<l.length;)(f[g]===null||f[g]===void 0)&&(f[g]=l[g]);l=f,m?AO(m,h)(...f):c(null,...f)}}function r(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),t}}function AO(e,t){let i;return r;function r(...c){const h=e.length>c.length;let d;h&&c.push(l);try{d=e.apply(this,c)}catch(f){const m=f;if(h&&i)throw m;return l(m)}h||(d&&d.then&&typeof d.then=="function"?d.then(a,l):d instanceof Error?l(d):a(d))}function l(c,...h){i||(i=!0,t(c,...h))}function a(c){l(null,c)}}const Sn={basename:DO,dirname:RO,extname:BO,join:LO,sep:"/"};function DO(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ha(e);let i=0,r=-1,l=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(a){i=l+1;break}}else r<0&&(a=!0,r=l+1);return r<0?"":e.slice(i,r)}if(t===e)return"";let c=-1,h=t.length-1;for(;l--;)if(e.codePointAt(l)===47){if(a){i=l+1;break}}else c<0&&(a=!0,c=l+1),h>-1&&(e.codePointAt(l)===t.codePointAt(h--)?h<0&&(r=l):(h=-1,r=c));return i===r?r=c:r<0&&(r=e.length),e.slice(i,r)}function RO(e){if(Ha(e),e.length===0)return".";let t=-1,i=e.length,r;for(;--i;)if(e.codePointAt(i)===47){if(r){t=i;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function BO(e){Ha(e);let t=e.length,i=-1,r=0,l=-1,a=0,c;for(;t--;){const h=e.codePointAt(t);if(h===47){if(c){r=t+1;break}continue}i<0&&(c=!0,i=t+1),h===46?l<0?l=t:a!==1&&(a=1):l>-1&&(a=-1)}return l<0||i<0||a===0||a===1&&l===i-1&&l===r+1?"":e.slice(l,i)}function LO(...e){let t=-1,i;for(;++t<e.length;)Ha(e[t]),e[t]&&(i=i===void 0?e[t]:i+"/"+e[t]);return i===void 0?".":zO(i)}function zO(e){Ha(e);const t=e.codePointAt(0)===47;let i=OO(e,!t);return i.length===0&&!t&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),t?"/"+i:i}function OO(e,t){let i="",r=0,l=-1,a=0,c=-1,h,d;for(;++c<=e.length;){if(c<e.length)h=e.codePointAt(c);else{if(h===47)break;h=47}if(h===47){if(!(l===c-1||a===1))if(l!==c-1&&a===2){if(i.length<2||r!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(d=i.lastIndexOf("/"),d!==i.length-1){d<0?(i="",r=0):(i=i.slice(0,d),r=i.length-1-i.lastIndexOf("/")),l=c,a=0;continue}}else if(i.length>0){i="",r=0,l=c,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",r=2)}else i.length>0?i+="/"+e.slice(l+1,c):i=e.slice(l+1,c),r=c-l-1;l=c,a=0}else h===46&&a>-1?a++:a=-1}return i}function Ha(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const HO={cwd:jO};function jO(){return"/"}function zg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PO(e){if(typeof e=="string")e=new URL(e);else if(!zg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return IO(e)}function IO(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let i=-1;for(;++i<t.length;)if(t.codePointAt(i)===37&&t.codePointAt(i+1)===50){const r=t.codePointAt(i+2);if(r===70||r===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(t)}const wp=["history","path","basename","stem","extname","dirname"];class EC{constructor(t){let i;t?zg(t)?i={path:t}:typeof t=="string"||UO(t)?i={value:t}:i=t:i={},this.cwd="cwd"in i?"":HO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wp.length;){const a=wp[r];a in i&&i[a]!==void 0&&i[a]!==null&&(this[a]=a==="history"?[...i[a]]:i[a])}let l;for(l in i)wp.includes(l)||(this[l]=i[l])}get basename(){return typeof this.path=="string"?Sn.basename(this.path):void 0}set basename(t){Ep(t,"basename"),Cp(t,"basename"),this.path=Sn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Sn.dirname(this.path):void 0}set dirname(t){JS(this.basename,"dirname"),this.path=Sn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Sn.extname(this.path):void 0}set extname(t){if(Cp(t,"extname"),JS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Sn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){zg(t)&&(t=PO(t)),Ep(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Sn.basename(this.path,this.extname):void 0}set stem(t){Ep(t,"stem"),Cp(t,"stem"),this.path=Sn.join(this.dirname||"",t+(this.extname||""))}fail(t,i,r){const l=this.message(t,i,r);throw l.fatal=!0,l}info(t,i,r){const l=this.message(t,i,r);return l.fatal=void 0,l}message(t,i,r){const l=new ri(t,i,r);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Cp(e,t){if(e&&e.includes(Sn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Sn.sep+"`")}function Ep(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function JS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function UO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qO=(function(e){const r=this.constructor.prototype,l=r[e],a=function(){return l.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),VO={}.hasOwnProperty;class wm extends qO{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=NO()}copy(){const t=new wm;let i=-1;for(;++i<this.attachers.length;){const r=this.attachers[i];t.use(...r)}return t.data(xp(!0,{},this.namespace)),t}data(t,i){return typeof t=="string"?arguments.length===2?(Tp("data",this.frozen),this.namespace[t]=i,this):VO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Tp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const l=i.call(t,...r);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const i=Cu(t),r=this.parser||this.Parser;return kp("parse",r),r(String(i),i)}process(t,i){const r=this;return this.freeze(),kp("process",this.parser||this.Parser),Mp("process",this.compiler||this.Compiler),i?l(void 0,i):new Promise(l);function l(a,c){const h=Cu(t),d=r.parse(h);r.run(d,h,function(m,g,v){if(m||!g||!v)return f(m);const y=g,S=r.stringify(y,v);WO(S)?v.value=S:v.result=S,f(m,v)});function f(m,g){m||!g?c(m):a?a(g):i(void 0,g)}}}processSync(t){let i=!1,r;return this.freeze(),kp("processSync",this.parser||this.Parser),Mp("processSync",this.compiler||this.Compiler),this.process(t,l),tb("processSync","process",i),r;function l(a,c){i=!0,ZS(a),r=c}}run(t,i,r){eb(t),this.freeze();const l=this.transformers;return!r&&typeof i=="function"&&(r=i,i=void 0),r?a(void 0,r):new Promise(a);function a(c,h){const d=Cu(i);l.run(t,d,f);function f(m,g,v){const y=g||t;m?h(m):c?c(y):r(void 0,y,v)}}}runSync(t,i){let r=!1,l;return this.run(t,i,a),tb("runSync","run",r),l;function a(c,h){ZS(c),l=h,r=!0}}stringify(t,i){this.freeze();const r=Cu(i),l=this.compiler||this.Compiler;return Mp("stringify",l),eb(t),l(t,r)}use(t,...i){const r=this.attachers,l=this.namespace;if(Tp("use",this.frozen),t!=null)if(typeof t=="function")d(t,i);else if(typeof t=="object")Array.isArray(t)?h(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...g]=f;d(m,g)}else c(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function c(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(f.plugins),f.settings&&(l.settings=xp(!0,l.settings,f.settings))}function h(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const g=f[m];a(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,m){let g=-1,v=-1;for(;++g<r.length;)if(r[g][0]===f){v=g;break}if(v===-1)r.push([f,...m]);else if(m.length>0){let[y,...S]=m;const b=r[v][1];Lg(b)&&Lg(y)&&(y=xp(!0,b,y)),r[v]=[f,y,...S]}}}}const FO=new wm().freeze();function kp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Mp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Tp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function eb(e){if(!Lg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function tb(e,t,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Cu(e){return YO(e)?e:new EC(e)}function YO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function WO(e){return typeof e=="string"||$O(e)}function $O(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const XO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",ib=[],nb={allowDangerousHtml:!0},KO=/^(https?|ircs?|mailto|xmpp)$/i,GO=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function ZO(e){const t=QO(e),i=JO(e);return e8(t.runSync(t.parse(i),i),e)}function QO(e){const t=e.rehypePlugins||ib,i=e.remarkPlugins||ib,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nb}:nb;return FO().use(Dz).use(i).use(kO,r).use(t)}function JO(e){const t=e.children||"",i=new EC;return typeof t=="string"&&(i.value=t),i}function e8(e,t){const i=t.allowedElements,r=t.allowElement,l=t.components,a=t.disallowedElements,c=t.skipHtml,h=t.unwrapDisallowed,d=t.urlTransform||t8;for(const m of GO)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+XO+m.id,void 0);return CC(e,f),u6(e,{Fragment:w.Fragment,components:l,ignoreInvalidStyle:!0,jsx:w.jsx,jsxs:w.jsxs,passKeys:!0,passNode:!0});function f(m,g,v){if(m.type==="raw"&&v&&typeof g=="number")return c?v.children.splice(g,1):v.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let y;for(y in vp)if(Object.hasOwn(vp,y)&&Object.hasOwn(m.properties,y)){const S=m.properties[y],b=vp[y];(b===null||b.includes(m.tagName))&&(m.properties[y]=d(String(S||""),y,m))}}if(m.type==="element"){let y=i?!i.includes(m.tagName):a?a.includes(m.tagName):!1;if(!y&&r&&typeof g=="number"&&(y=!r(m,g,v)),y&&v&&typeof g=="number")return h&&m.children?v.children.splice(g,1,...m.children):v.children.splice(g,1),g}}}function t8(e){const t=e.indexOf(":"),i=e.indexOf("?"),r=e.indexOf("#"),l=e.indexOf("/");return t===-1||l!==-1&&t>l||i!==-1&&t>i||r!==-1&&t>r||KO.test(e.slice(0,t))?e:""}const i8="modulepreload",n8=function(e){return"/"+e},rb={},r8=function(t,i,r){let l=Promise.resolve();if(i&&i.length>0){let c=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),d=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));l=c(i.map(f=>{if(f=n8(f),f in rb)return;rb[f]=!0;const m=f.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const v=document.createElement("link");if(v.rel=m?"stylesheet":i8,m||(v.as="script"),v.crossOrigin="",v.href=f,d&&v.setAttribute("nonce",d),document.head.appendChild(v),m)return new Promise((y,S)=>{v.addEventListener("load",y),v.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function a(c){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=c,window.dispatchEvent(h),!h.defaultPrevented)throw c}return l.then(c=>{for(const h of c||[])h.status==="rejected"&&a(h.reason);return t().catch(a)})};function kC({integrationId:e,workflowName:t,nodeName:i,connectionsApi:r}){const{nangoConnections:l,loading:a,refetch:c}=tD(e,r.mutationVersion),[h,d]=Y.useState(!1),f=r.getForNode(t,i,e),m=Y.useCallback(async v=>{await r.upsert({workflow_name:t,node_name:i,integration_id:e,connection_id:v})},[r,t,i,e]),g=Y.useCallback(async()=>{d(!0);try{const v=await fetch("/api/nango/connect-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integration_id:e})});if(!v.ok)return;const{token:y}=await v.json(),b=(await r8(()=>import("./index-DAKTQEvj.js"),[])).default;new b().openConnectUI({sessionToken:y,onEvent:async C=>{if(C.type==="connect"){c();const L=C.payload.connectionId;L&&(await m(L),t!=="*"&&await r.upsert({workflow_name:"*",node_name:"*",integration_id:e,connection_id:L}))}else C.type==="close"&&c()}})}catch{}finally{d(!1)}},[e,c,m,t,r]);return w.jsxs("div",{className:"flex flex-col gap-1.5",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("span",{className:"text-[12px] font-medium text-popover-foreground capitalize",children:e}),w.jsx("button",{onClick:g,disabled:h,className:"text-[10px] px-2.5 py-0.5 rounded-full bg-[#e8e4df] text-[#787068] hover:bg-[#d4cfc8] transition-colors cursor-pointer disabled:opacity-50",children:h?"...":"Connect"})]}),a?w.jsx("p",{className:"text-[11px] text-[#a8a099] italic",children:"Loading connections..."}):l.length===0?w.jsx("p",{className:"text-[11px] text-[#a8a099] italic",children:"No connections. Click Connect to add one."}):w.jsxs("select",{value:(f==null?void 0:f.connection_id)??"",onChange:v=>m(v.target.value),className:"text-[12px] px-2 py-1 rounded-md border border-border bg-background text-foreground",children:[w.jsx("option",{value:"",children:"Select a connection..."}),l.map(v=>w.jsx("option",{value:v.connection_id,children:v.display_name},v.connection_id))]})]})}const s8={node:"fn",agent:"AI",workflow:"wf",input:"IN",output:"OUT",condition:"?"},sb={node:{iconBg:"bg-emerald-50 text-emerald-600"},agent:{iconBg:"bg-purple-50 text-purple-600"},workflow:{iconBg:"bg-emerald-50 text-emerald-600"},input:{iconBg:"bg-[#f5f3f0] text-[#a8a099]"},output:{iconBg:"bg-[#f5f3f0] text-[#a8a099]"},condition:{iconBg:"bg-amber-50 text-amber-600"}},l8={node:"Node",agent:"Agent",workflow:"Workflow",input:"Input",output:"Output",condition:"Condition"};function o8({node:e,position:t,onClose:i,workflowName:r,connectionsApi:l}){const a=Y.useRef(null),c=s8[e.type]??"fn",h=sb[e.type]??sb.node,d=l8[e.type]??e.type;Y.useEffect(()=>{const b=E=>{E.key==="Escape"&&i()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[i]),Y.useEffect(()=>{const b=C=>{a.current&&!a.current.contains(C.target)&&i()},E=setTimeout(()=>{document.addEventListener("mousedown",b)},0);return()=>{clearTimeout(E),document.removeEventListener("mousedown",b)}},[i]);const f=300,m=400,g=12,[v,y]=Y.useState({left:t.x+12,top:t.y-20});Y.useLayoutEffect(()=>{const b=a.current;if(!b)return;const E=b.offsetParent,C=(E==null?void 0:E.clientWidth)??window.innerWidth,L=(E==null?void 0:E.clientHeight)??window.innerHeight;y({left:Math.max(g,Math.min(t.x+12,C-f-g)),top:Math.max(g,Math.min(t.y-20,L-m-g))})},[t.x,t.y]);const S=e.integrations&&e.integrations.length>0&&e.nodeName&&r&&l;return w.jsxs("div",{ref:a,style:{left:v.left,top:v.top},className:"absolute z-50 w-[300px] bg-popover rounded-xl border border-border shadow-lg",children:[w.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-accent",children:[w.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[w.jsx("div",{className:`w-7 h-7 rounded-md flex items-center justify-center shrink-0 ${h.iconBg}`,children:w.jsx("span",{className:"text-[10px] font-bold",children:c})}),w.jsxs("div",{className:"min-w-0",children:[w.jsx("p",{className:"text-[13px] font-medium text-popover-foreground truncate",children:e.label}),w.jsx("p",{className:"text-[10px] text-[#a8a099] uppercase tracking-wide",children:d})]})]}),w.jsx("button",{onClick:i,"aria-label":"Close node details",className:"p-1 rounded-md text-[#a8a099] hover:text-popover-foreground hover:bg-accent transition-colors cursor-pointer",children:w.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:w.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),w.jsxs("div",{className:"px-4 py-3",children:[w.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-1.5",children:"Description"}),e.description?w.jsx("div",{className:"text-[13px] text-muted-foreground leading-relaxed prose-sm",children:w.jsx(ZO,{components:{p:({children:b})=>w.jsx("p",{className:"mb-2 last:mb-0",children:b}),strong:({children:b})=>w.jsx("strong",{className:"font-semibold text-popover-foreground",children:b}),blockquote:({children:b})=>w.jsx("blockquote",{className:"border-l-2 border-border pl-2.5 my-2 text-muted-foreground italic",children:b}),ul:({children:b})=>w.jsx("ul",{className:"list-disc pl-4 mb-2",children:b}),ol:({children:b})=>w.jsx("ol",{className:"list-decimal pl-4 mb-2",children:b}),li:({children:b})=>w.jsx("li",{className:"mb-0.5",children:b}),code:({children:b})=>w.jsx("code",{className:"text-[12px] bg-muted px-1 py-0.5 rounded",children:b})},children:e.description})}):w.jsx("p",{className:"text-[13px] text-[#a8a099] italic",children:"No description available"})]}),S&&w.jsxs("div",{className:"px-4 py-3 border-t border-accent",children:[w.jsx("p",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] mb-2",children:"Integrations"}),w.jsx("div",{className:"flex flex-col gap-3",children:e.integrations.map(b=>w.jsx(kC,{integrationId:b,workflowName:r,nodeName:e.nodeName,connectionsApi:l},b))})]})]})}const ih=220,Ca=50,a8=80,lb=40,ob=20,ab=16,cb=28;function c8(e,t){if(e.length===0)return new Map;const i=new Map,r=new Map,l=new Set(e);for(const f of e)i.set(f,[]),r.set(f,[]);for(const f of t)l.has(f.source)&&l.has(f.target)&&(i.get(f.source).push(f.target),r.get(f.target).push(f.source));const a=u8(e,i,r),c=new Map;for(const[f,m]of a)c.has(m)||c.set(m,[]),c.get(m).push(f);h8(c,a,i);const h=Math.max(...c.keys()),d=new Map;for(let f=0;f<=h;f++){const m=c.get(f)||[],v=-(m.length*Ca+(m.length-1)*lb)/2;for(let y=0;y<m.length;y++)d.set(m[y],{x:Math.round(f*(ih+a8)),y:Math.round(v+y*(Ca+lb))})}return d}function u8(e,t,i){const r=new Map,l=e.filter(h=>i.get(h).length===0),a=l.length>0?l:[e[0]],c=[...a];for(const h of a)r.set(h,0);for(const h of e)r.has(h)||(r.set(h,0),c.push(h));for(;c.length>0;){const h=c.shift(),d=r.get(h);for(const f of t.get(h)||[]){const m=r.get(f),g=d+1;(m===void 0||g>m)&&(r.set(f,g),c.push(f))}}return r}function h8(e,t,i){const r=Math.max(...e.keys()),l=new Map;for(const[a,c]of i)for(const h of c)l.has(h)||l.set(h,[]),l.get(h).push(a);for(let a=1;a<=r;a++){const c=e.get(a);if(!c||c.length<=1)continue;const h=e.get(a-1)||[],d=new Map;h.forEach((f,m)=>d.set(f,m)),c.sort((f,m)=>{const g=(l.get(f)||[]).filter(b=>t.get(b)===a-1),v=(l.get(m)||[]).filter(b=>t.get(b)===a-1),y=g.length>0?g.reduce((b,E)=>b+(d.get(E)||0),0)/g.length:0,S=v.length>0?v.reduce((b,E)=>b+(d.get(E)||0),0)/v.length:0;return y-S}),e.set(a,c)}}function f8(e,t){const i=[];for(const r of t){const l=new Map;let a=1/0,c=1/0,h=-1/0,d=-1/0;for(const y of r.nodeIds){const S=e.get(y);S&&(a=Math.min(a,S.x),c=Math.min(c,S.y),h=Math.max(h,S.x+ih),d=Math.max(d,S.y+Ca))}if(a===1/0)continue;const f=a-ob,m=c-cb-ab,g=h-a+2*ob,v=d-c+cb+2*ab;for(const y of r.nodeIds){const S=e.get(y);S&&l.set(y,{x:S.x-f,y:S.y-m})}i.push({id:r.id,position:{x:f,y:m},width:g,height:v,childPositions:l})}return i}const d8={workflowNode:BB,loopGroup:LB},p8={clean:zB};function g8({dag:e,connectionsApi:t}){const{fitView:i}=gh(),[r,l]=Y.useState(null),[a,c]=Y.useState(null),{flowNodes:h,flowEdges:d}=Y.useMemo(()=>{const L=c8(e.nodes.map(X=>X.id),e.edges.map(X=>({source:X.source,target:X.target}))),k=e.loopGroups??[],D=f8(L,k),I=new Map;for(const X of D){const G=k.find(ne=>ne.id===X.id);if(G)for(const ne of G.nodeIds)I.set(ne,X)}const B=[];for(const X of D){const G=k.find(ne=>ne.id===X.id);B.push({id:X.id,type:"loopGroup",position:X.position,data:{label:(G==null?void 0:G.label)??"",width:X.width,height:X.height},draggable:!0,style:{width:X.width,height:X.height}})}for(const X of e.nodes){const G=I.get(X.id);if(G){const ne=G.childPositions.get(X.id)??{x:0,y:0};B.push({id:X.id,type:"workflowNode",position:ne,parentId:G.id,extent:"parent",data:{...X},draggable:!0,width:ih,height:Ca})}else{const ne=L.get(X.id)??{x:0,y:0};B.push({id:X.id,type:"workflowNode",position:ne,data:{...X},draggable:!0,width:ih,height:Ca})}}const U=e.edges.map(X=>({id:X.id,source:X.source,target:X.target,label:X.label,type:"clean",animated:!1,style:{stroke:"#c4bfb8",strokeWidth:1.5},labelStyle:{fontSize:12,fill:"#787068"},markerEnd:{type:ma.ArrowClosed,width:12,height:12,color:"#c4bfb8"}}));return{flowNodes:B,flowEdges:U}},[e]),[f,m,g]=SA(h),[v,y,S]=bA(d);Y.useEffect(()=>{m(h),y(d),setTimeout(()=>i({padding:.2,duration:300}),50)},[h,d,m,y,i]);const b=Y.useCallback((L,k)=>{const D=k.data;if(D.type==="input"||D.type==="output"||D.type==="condition")return;const B=L.currentTarget.closest(".react-flow"),U=(B==null?void 0:B.getBoundingClientRect())??{left:0,top:0};l(D),c({x:L.clientX-U.left,y:L.clientY-U.top})},[]),E=Y.useCallback(()=>{l(null),c(null)},[]),C=Y.useCallback(()=>{setTimeout(()=>i({padding:.2,duration:200}),50)},[i]);return w.jsxs("div",{className:"relative w-full h-full",children:[w.jsxs(yA,{nodes:f,edges:v,onNodesChange:g,onEdgesChange:S,nodeTypes:d8,edgeTypes:p8,onInit:C,onNodeClick:b,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,proOptions:{hideAttribution:!0},children:[w.jsx(kA,{variant:nr.Cross,color:"#d4cfc8",gap:24,size:1.5}),w.jsx(BA,{showInteractive:!1}),w.jsx(WA,{nodeStrokeWidth:3,pannable:!0,zoomable:!0,style:{width:120,height:80},maskColor:"rgba(240, 235, 227, 0.7)"})]}),r&&a&&w.jsx(o8,{node:r,position:a,onClose:E,workflowName:e.workflowName,connectionsApi:t})]})}function m8({onClose:e}){const t=Y.useRef(null);Y.useEffect(()=>{const r=setTimeout(e,4500);return()=>clearTimeout(r)},[e]);const i=Y.useCallback(r=>{r.target===t.current&&e()},[e]);return w.jsxs("div",{ref:t,onClick:i,className:"fixed inset-0 z-50 flex items-center justify-center",style:{animation:"ssh-backdrop 4.5s ease both"},children:[w.jsxs("div",{className:"relative w-[480px] h-[300px] rounded-xl border-2 border-foreground/20 bg-card shadow-2xl overflow-hidden",style:{animation:"ssh-screen 4.5s ease both"},children:[w.jsxs("div",{className:"absolute inset-y-0 left-0 w-1/2 flex flex-col items-center justify-center gap-3",style:{animation:"ssh-pane-left 4.5s ease both"},children:[w.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#1a1a1a] flex items-center justify-center",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#e8e4df",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("polyline",{points:"4 17 10 11 4 5"}),w.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),w.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Claude Code"}),w.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Your terminal"})]}),w.jsx("div",{className:"absolute top-0 left-1/2 w-[2px] h-full bg-foreground/15 -translate-x-1/2",style:{animation:"ssh-divider 4.5s ease both"}}),w.jsxs("div",{className:"absolute inset-y-0 right-0 w-1/2 flex flex-col items-center justify-center gap-3",style:{animation:"ssh-pane-right 4.5s ease both"},children:[w.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#f5f3f0] border border-border flex items-center justify-center",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-foreground",children:[w.jsx("rect",{x:"3",y:"3",width:"7",height:"5",rx:"1.5"}),w.jsx("rect",{x:"14",y:"3",width:"7",height:"5",rx:"1.5"}),w.jsx("rect",{x:"8.5",y:"16",width:"7",height:"5",rx:"1.5"}),w.jsx("path",{d:"M6.5 8v3.5a2 2 0 002 2h7a2 2 0 002-2V8"}),w.jsx("path",{d:"M12 13.5V16"})]})}),w.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Mache"}),w.jsx("span",{className:"text-[10px] text-muted-foreground",children:"This browser"})]}),w.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-foreground text-background text-[11px] font-medium px-3 py-1 rounded-full",style:{animation:"ssh-banner 4.5s ease both"},children:"Copied to clipboard"})]}),w.jsx("style",{children:`
135
+ @keyframes ssh-backdrop {
136
+ 0% { background: rgba(0,0,0,0); }
137
+ 5% { background: rgba(0,0,0,0.2); }
138
+ 88% { background: rgba(0,0,0,0.2); }
139
+ 100% { background: rgba(0,0,0,0); }
140
+ }
141
+ @keyframes ssh-screen {
142
+ 0% { opacity: 0; transform: scale(0.95); }
143
+ 5% { opacity: 1; transform: scale(1); }
144
+ 88% { opacity: 1; transform: scale(1); }
145
+ 100% { opacity: 0; transform: scale(0.97); }
146
+ }
147
+ @keyframes ssh-divider {
148
+ 0%, 7% { transform: translateX(-50%) scaleY(0); }
149
+ 17% { transform: translateX(-50%) scaleY(1); }
150
+ 88% { opacity: 1; }
151
+ 100% { opacity: 0; }
152
+ }
153
+ @keyframes ssh-pane-left {
154
+ 0%, 15% { opacity: 0; }
155
+ 25% { opacity: 1; }
156
+ 88% { opacity: 1; }
157
+ 100% { opacity: 0; }
158
+ }
159
+ @keyframes ssh-pane-right {
160
+ 0%, 20% { opacity: 0; }
161
+ 30% { opacity: 1; }
162
+ 88% { opacity: 1; }
163
+ 100% { opacity: 0; }
164
+ }
165
+ @keyframes ssh-banner {
166
+ 0%, 5% { opacity: 0; transform: translateX(-50%) translateY(8px); }
167
+ 12% { opacity: 1; transform: translateX(-50%) translateY(0); }
168
+ 75% { opacity: 1; }
169
+ 88% { opacity: 0; }
170
+ 100% { opacity: 0; }
171
+ }
172
+ `})]})}const _8=150,v8=400;function y8({tabs:e,defaultTab:t,onClose:i}){var k,D;const[r,l]=Y.useState(t??((k=e[0])==null?void 0:k.id)??""),[a,c]=Y.useState(v8),[h,d]=Y.useState(null),[f,m]=Y.useState(!1),[g,v]=Y.useState(!1),y=Y.useRef(!1),S=Y.useRef(0),b=Y.useRef(0),E=Y.useCallback(I=>{I.preventDefault(),y.current=!0,S.current=I.clientY,b.current=a},[a]);Y.useEffect(()=>{const I=U=>{if(!y.current)return;const X=window.innerHeight*.6,G=S.current-U.clientY;c(Math.max(_8,Math.min(X,b.current+G)))},B=()=>{y.current=!1};return window.addEventListener("mousemove",I),window.addEventListener("mouseup",B),()=>{window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",B)}},[]),Y.useEffect(()=>{fetch("/api/claude-command").then(I=>I.ok?I.json():null).then(I=>{I!=null&&I.isCloud?d("0pflow cloud claude --continue"):I!=null&&I.projectRoot&&d(`cd ${I.projectRoot} && claude --continue`)}).catch(()=>{})},[]);const C=Y.useCallback(()=>{h&&navigator.clipboard.writeText(h).then(()=>{m(!0),v(!0),setTimeout(()=>m(!1),1500)})},[h]),L=(D=e.find(I=>I.id===r))==null?void 0:D.content;return w.jsxs("div",{className:"border-t border-border flex flex-col bg-background",style:{height:a},children:[w.jsx("div",{onMouseDown:E,className:"h-1 cursor-ns-resize hover:bg-accent shrink-0"}),w.jsxs("div",{className:"shrink-0 px-3 flex items-center gap-0 border-b border-border",children:[e.map(I=>w.jsxs("button",{onClick:()=>l(I.id),className:`relative text-[12px] tracking-wide px-3 py-2 cursor-pointer transition-colors ${r===I.id?"text-foreground":"text-muted-foreground hover:text-foreground/70"}`,children:[I.label,r===I.id&&w.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-[1.5px] bg-[#a8a099] rounded-full"})]},I.id)),w.jsx("div",{className:"flex-1"}),h&&w.jsxs("button",{onClick:C,className:"flex items-center gap-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors cursor-pointer mr-2 max-w-[50%] group",title:"Copy to open in your terminal",children:[w.jsx("span",{className:"shrink-0",children:"Prefer your own terminal?"}),w.jsx("span",{className:"truncate font-mono",children:h}),f?w.jsx("span",{className:"text-[10px] text-emerald-600 shrink-0",children:"Copied!"}):w.jsxs("svg",{className:"w-3 h-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[w.jsx("rect",{x:"5",y:"5",width:"9",height:"9",rx:"1.5"}),w.jsx("path",{d:"M5 11H3.5A1.5 1.5 0 012 9.5v-7A1.5 1.5 0 013.5 1h7A1.5 1.5 0 0112 2.5V5"})]})]}),w.jsx("button",{onClick:i,className:"text-muted-foreground hover:text-foreground text-sm px-1.5 py-0.5 cursor-pointer",title:"Close panel",children:"×"})]}),w.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:L}),g&&w.jsx(m8,{onClose:()=>v(!1)})]})}const S8={SUCCESS:{bg:"bg-emerald-50",text:"text-emerald-700",label:"Success"},ERROR:{bg:"bg-red-50",text:"text-red-700",label:"Failed"},PENDING:{bg:"bg-blue-50",text:"text-blue-700",label:"Running",pulse:!0},RETRIES_EXCEEDED:{bg:"bg-red-50",text:"text-red-700",label:"Retries Exceeded"}};function MC({className:e}){return w.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"9 18 15 12 9 6"})})}function TC({className:e}){return w.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"6 9 12 15 18 9"})})}function b8({className:e}){return w.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),w.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]})}function ub({className:e}){return w.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"10"}),w.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),w.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}function x8({className:e}){return w.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),w.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),w.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),w.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),w.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),w.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),w.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),w.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]})}const nh={SUCCESS:{Icon:b8,className:"text-emerald-500"},ERROR:{Icon:ub,className:"text-red-500"},PENDING:{Icon:x8,className:"text-blue-500 animate-spin"},RETRIES_EXCEEDED:{Icon:ub,className:"text-red-500"}};function w8({runs:e,loading:t,selectedRunId:i,trace:r,traceLoading:l,selectRun:a,refresh:c}){return t&&e.length===0?w.jsx("div",{className:"flex items-center justify-center h-full text-[#a8a099] text-sm",children:"Loading runs..."}):e.length===0?w.jsx("div",{className:"flex items-center justify-center h-full",children:w.jsxs("div",{className:"flex flex-col items-center text-center px-6",children:[w.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#f0ece7] flex items-center justify-center mb-3",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#a8a099",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"10"}),w.jsx("polyline",{points:"12 6 12 12 16 14"})]})}),w.jsx("p",{className:"text-[13px] text-[#1a1a1a] font-medium",children:"No runs yet"}),w.jsx("p",{className:"text-[11px] text-[#a8a099] mt-1 leading-relaxed max-w-[220px]",children:"Run your workflow to see execution history with status and trace details."})]})}):w.jsx("div",{className:"h-full overflow-auto",children:w.jsxs("div",{className:"p-3",children:[w.jsxs("div",{className:"flex items-center justify-between mb-3",children:[w.jsxs("span",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] font-medium",children:[e.length," run",e.length!==1?"s":""]}),w.jsx("button",{onClick:c,className:"text-[11px] text-[#a8a099] hover:text-[#1a1a1a] cursor-pointer transition-colors",children:"Refresh"})]}),w.jsx("div",{className:"space-y-1.5",children:e.map(h=>w.jsx(C8,{run:h,isExpanded:i===h.workflow_uuid,trace:i===h.workflow_uuid?r:null,traceLoading:i===h.workflow_uuid&&l,onToggle:()=>a(i===h.workflow_uuid?null:h.workflow_uuid)},h.workflow_uuid))})]})})}function C8({run:e,isExpanded:t,trace:i,traceLoading:r,onToggle:l}){var d;const a=S8[e.status]??{bg:"bg-[#f0ece7]",text:"text-[#787068]",label:e.status},c=(d=i==null?void 0:i.workflow)==null?void 0:d.duration_ms,h=M8(e.created_at);return w.jsxs("div",{className:`rounded-lg border transition-colors bg-white ${e.status==="PENDING"?"border-blue-200":"border-[#e8e4df]"}`,children:[w.jsxs("button",{onClick:l,className:"w-full flex items-center gap-2 px-3 py-2.5 text-left cursor-pointer",children:[t?w.jsx(TC,{className:"w-3 h-3 text-[#a8a099] shrink-0"}):w.jsx(MC,{className:"w-3 h-3 text-[#a8a099] shrink-0"}),w.jsx("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium ${a.bg} ${a.text} ${a.pulse?"animate-pulse":""}`,children:a.label}),w.jsx("div",{className:"flex-1"}),c!=null&&w.jsx("span",{className:"text-[11px] font-mono text-[#a8a099] shrink-0",children:Cm(c)}),w.jsx("span",{className:"text-[11px] text-[#a8a099] shrink-0",children:T8(h)})]}),t&&w.jsxs("div",{className:"border-t border-[#e8e4df] px-3 py-2.5",children:[r?w.jsx("p",{className:"text-[11px] text-[#a8a099] text-center py-3",children:"Loading trace..."}):i&&i.operations.length>0?w.jsx(E8,{operations:i.operations,rootWorkflowId:e.workflow_uuid}):w.jsx("p",{className:"text-[11px] text-[#a8a099] text-center py-3 italic",children:"No operations recorded."}),e.error&&w.jsxs("div",{className:"mt-2 space-y-1",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wider text-red-500 font-medium",children:"Error"}),w.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded p-1.5 whitespace-pre-wrap break-all",children:e.error})]})]})]})}function E8({operations:e,rootWorkflowId:t}){const[i,r]=Y.useState(new Set),l=Y.useCallback(f=>{r(m=>{const g=new Set(m);return g.has(f)?g.delete(f):g.add(f),g})},[]),a=new Map;for(const f of e){const m=a.get(f.workflow_uuid)??[];m.push(f),a.set(f.workflow_uuid,m)}const c=a.get(t)??[],h=new Set;for(const f of c)f.function_name==="DBOS.getResult"&&f.child_workflow_id&&h.add(f.child_workflow_id);const d=c.filter(f=>!f.child_workflow_id||f.function_name==="DBOS.getResult"?!0:!h.has(f.child_workflow_id));return w.jsx("div",{className:"space-y-1",children:d.map(f=>{let m=f.function_name;if(f.function_name==="DBOS.getResult"&&f.child_workflow_id){const C=c.find(L=>L.child_workflow_id===f.child_workflow_id&&L.function_name!=="DBOS.getResult");C&&(m=C.function_name)}const g=!!(f.output_preview||f.error||f.child_workflow_id),v=`${f.workflow_uuid}-${f.function_id}`,y=i.has(v),S=f.child_workflow_id?a.get(f.child_workflow_id)??[]:[],b=f.error?"ERROR":f.duration_ms!=null?"SUCCESS":"PENDING",E=nh[b]??nh.PENDING;return w.jsxs("div",{className:`rounded-md border transition-colors ${f.error?"border-red-200 bg-red-50/30":"border-[#e8e4df] bg-[#faf9f7]"}`,children:[w.jsxs("button",{onClick:()=>g&&l(v),className:`w-full flex items-center gap-2 px-2.5 py-2 text-left transition-colors ${g?"cursor-pointer":"cursor-default"}`,children:[g?y?w.jsx(TC,{className:"w-2.5 h-2.5 text-[#a8a099] shrink-0"}):w.jsx(MC,{className:"w-2.5 h-2.5 text-[#a8a099] shrink-0"}):w.jsx("span",{className:"w-2.5 shrink-0"}),w.jsx(E.Icon,{className:`w-3.5 h-3.5 shrink-0 ${E.className}`}),w.jsx("span",{className:`text-[12px] font-medium truncate flex-1 ${f.error?"text-red-700":"text-[#1a1a1a]"}`,children:m}),f.duration_ms!=null&&w.jsx("span",{className:"text-[10px] font-mono text-[#a8a099] shrink-0",children:Cm(f.duration_ms)})]}),y&&w.jsxs("div",{className:"px-2.5 pb-2.5 pt-0 border-t border-[#e8e4df] mx-2.5 space-y-2",children:[f.error&&w.jsxs("div",{className:"mt-2 space-y-1",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wider text-red-500 font-medium",children:"Error"}),w.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded p-1.5 whitespace-pre-wrap break-all",children:f.error})]}),S.length>0&&w.jsx("div",{className:"mt-2 space-y-1 border-l-2 border-[#e8e4df] pl-2",children:S.map(C=>w.jsx(k8,{op:C},`${C.workflow_uuid}-${C.function_id}`))}),f.output_preview&&!f.error&&w.jsxs("div",{className:"mt-2 space-y-1",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wider text-[#a8a099] font-medium",children:"Output"}),w.jsx("pre",{className:"text-[10px] font-mono text-[#787068] bg-white rounded p-1.5 whitespace-pre-wrap break-all max-h-[150px] overflow-auto",children:N8(f.output_preview)})]})]})]},v)})})}function k8({op:e}){const t=e.error?"ERROR":e.duration_ms!=null?"SUCCESS":"PENDING",i=nh[t]??nh.PENDING;return w.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded-md text-[11px] ${e.error?"bg-red-50/30":""}`,children:[w.jsx(i.Icon,{className:`w-3 h-3 shrink-0 ${i.className}`}),w.jsx("span",{className:`truncate flex-1 ${e.error?"text-red-700":"text-[#787068]"}`,children:e.function_name}),e.duration_ms!=null&&w.jsx("span",{className:"text-[10px] font-mono text-[#a8a099] shrink-0",children:Cm(e.duration_ms)})]})}function M8(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^\d+$/.test(e))return parseInt(e,10);const t=new Date(e).getTime();if(!isNaN(t))return t}return Date.now()}function Cm(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),i=Math.floor(e%6e4/1e3);return`${t}m ${i}s`}function T8(e){const t=Date.now()-e;return t<0?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:t<6048e5?`${Math.floor(t/864e5)}d ago`:new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function N8(e){if(!e)return"";try{const t=JSON.parse(e),i=JSON.stringify(t,null,2);return i.length>200?i.slice(0,197)+"...":i}catch{return e.length>200?e.slice(0,197)+"...":e}}function A8({dag:e,onSuccess:t}){const i=e.nodes.find(E=>E.type==="input"),r=(i==null?void 0:i.fields)??[],[l,a]=Y.useState(()=>Object.fromEntries(r.map(E=>[E,""]))),[c,h]=Y.useState("{}"),[d,f]=Y.useState(r.length===0),[m,g]=Y.useState(!1),[v,y]=Y.useState(null),S=Y.useCallback(()=>{if(d)return JSON.parse(c);const E={};for(const[C,L]of Object.entries(l))if(L!=="")try{E[C]=JSON.parse(L)}catch{E[C]=L}return E},[d,c,l]),b=Y.useCallback(async()=>{y(null);let E;try{E=S()}catch(C){y(`Invalid JSON: ${C instanceof Error?C.message:String(C)}`);return}g(!0);try{const L=await(await fetch(`/api/workflows/${encodeURIComponent(e.workflowName)}/run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:E})})).json();if(L.status==="ERROR"){y(L.error??"Workflow failed"),g(!1);return}g(!1),t()}catch(C){y(C instanceof Error?C.message:"Request failed"),g(!1)}},[e.workflowName,S,t]);return w.jsxs("div",{children:[w.jsx("h3",{className:"text-[11px] uppercase tracking-wider text-[#a8a099] font-medium mb-3",children:"Test Input"}),w.jsxs("div",{className:"space-y-3",children:[r.length>0&&w.jsxs("label",{className:"flex items-center gap-2 text-[11px] text-[#a8a099] cursor-pointer select-none",children:[w.jsx("input",{type:"checkbox",checked:d,onChange:E=>f(E.target.checked),className:"accent-[#1a1a1a]"}),"Raw JSON"]}),d?w.jsx("div",{className:"rounded-lg border border-[#e8e4df] bg-[#faf9f7] overflow-hidden",children:w.jsx("textarea",{value:c,onChange:E=>h(E.target.value),spellCheck:!1,className:"w-full p-3 text-[13px] font-mono text-[#1a1a1a] bg-transparent resize-none outline-none placeholder:text-[#d4cfc8]",rows:4,placeholder:'{"key": "value"}'})}):r.length>0?w.jsx("div",{className:"space-y-2",children:r.map(E=>w.jsxs("div",{children:[w.jsx("label",{className:"block text-[11px] font-medium text-[#1a1a1a] mb-1",children:E}),w.jsx("input",{type:"text",value:l[E]??"",onChange:C=>a(L=>({...L,[E]:C.target.value})),onKeyDown:C=>{C.key==="Enter"&&!m&&b()},className:"w-full text-[13px] bg-[#faf9f7] border border-[#e8e4df] rounded-lg px-3 py-2 focus:outline-none focus:ring-1 focus:ring-[#1a1a1a]/20 placeholder:text-[#d4cfc8]",placeholder:`Enter ${E}`})]},E))}):w.jsx("div",{className:"rounded-lg border border-[#e8e4df] bg-[#faf9f7] overflow-hidden",children:w.jsx("textarea",{value:c,onChange:E=>h(E.target.value),spellCheck:!1,className:"w-full p-3 text-[13px] font-mono text-[#1a1a1a] bg-transparent resize-none outline-none placeholder:text-[#d4cfc8]",rows:3,placeholder:'{"key": "value"}'})}),v&&w.jsx("pre",{className:"text-[10px] font-mono text-red-600 bg-red-50 rounded-lg p-2 whitespace-pre-wrap break-all max-h-24 overflow-auto",children:v}),w.jsx("button",{onClick:b,disabled:m,className:"w-full bg-[#1a1a1a] text-white hover:bg-[#2a2a2a] text-[13px] h-9 rounded-lg transition-colors cursor-pointer disabled:opacity-60 flex items-center justify-center gap-2",children:m?w.jsxs(w.Fragment,{children:[w.jsxs("svg",{className:"animate-spin h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",children:[w.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),w.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Running..."]}):w.jsxs(w.Fragment,{children:[w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:w.jsx("path",{d:"M6 4l15 8-15 8V4z"})}),"Run Test"]})})]})]})}function D8({attachTo:e,fit:t,ptyAlive:i,hasData:r,restart:l}){const a=Y.useRef(null);return Y.useEffect(()=>(a.current&&e(a.current),()=>e(null)),[e]),Y.useEffect(()=>{if(!a.current)return;const c=new ResizeObserver(()=>{requestAnimationFrame(t)});return c.observe(a.current),()=>c.disconnect()},[t]),Y.useEffect(()=>{const c=setTimeout(t,50);return()=>clearTimeout(c)},[t]),Y.useEffect(()=>{if(i)return;const c=a.current;if(!c)return;const h=d=>{d.key==="Enter"&&l()};return c.addEventListener("keydown",h),()=>c.removeEventListener("keydown",h)},[i,l]),w.jsxs("div",{className:"relative h-full w-full overflow-hidden bg-[#1a1a1a] px-4 py-2",children:[w.jsx("div",{ref:a,className:"h-full w-full"}),!r&&w.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:w.jsxs("div",{className:"flex items-center gap-3 text-zinc-500",children:[w.jsxs("svg",{className:"h-5 w-5 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[w.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),w.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),w.jsx("span",{children:"Starting Claude Code..."})]})})]})}function R8({workflows:e,connectionsApi:t,onBack:i}){const{integrations:r,loading:l}=eD(),a=Y.useMemo(()=>{const h=new Set;for(const d of e)for(const f of d.nodes)if(f.integrations)for(const m of f.integrations)h.add(m);return h},[e]),c=Y.useMemo(()=>{const h=new Set(a);for(const d of r)h.add(d.id);return Array.from(h).sort((d,f)=>{const m=a.has(d)?0:1,g=a.has(f)?0:1;return m-g||d.localeCompare(f)})},[r,a]);return w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsxs("div",{className:"p-8 max-w-[700px]",children:[w.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[12px] text-[#787068] hover:text-[#1a1a1a] transition-colors cursor-pointer mb-6",children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M19 12H5"}),w.jsx("path",{d:"M12 19l-7-7 7-7"})]}),"Back"]}),w.jsx("h1",{className:"text-2xl font-light tracking-tight text-[#1a1a1a]",style:{fontFamily:"Georgia, 'Times New Roman', serif"},children:"Credentials"}),w.jsx("p",{className:"text-sm text-[#787068] mt-1 tracking-wide",children:"Manage OAuth connections and credentials for your workflows."}),w.jsx("div",{className:"h-px bg-[#e8e4df] my-6"}),w.jsxs("div",{children:[w.jsx("div",{className:"flex items-start justify-between mb-4",children:w.jsxs("div",{children:[w.jsx("h2",{className:"text-[15px] font-medium text-[#1a1a1a]",children:"Connections"}),w.jsx("p",{className:"text-[11px] text-[#a8a099] mt-0.5",children:"Configure global OAuth connections shared across all workflows."})]})}),l?w.jsx("div",{className:"rounded-lg border border-[#e8e4df] bg-white p-4",children:w.jsx("div",{className:"flex flex-col gap-4",children:[1,2].map(h=>w.jsxs("div",{className:"flex items-center gap-3",children:[w.jsx("div",{className:"w-8 h-8 rounded-md bg-[#f0ece7] animate-pulse"}),w.jsxs("div",{className:"flex-1",children:[w.jsx("div",{className:"h-3.5 w-24 bg-[#f0ece7] rounded animate-pulse"}),w.jsx("div",{className:"h-3 w-40 bg-[#f0ece7] rounded animate-pulse mt-1.5"})]})]},h))})}):c.length===0?w.jsxs("div",{className:"rounded-lg border border-[#e8e4df] bg-white p-8 flex flex-col items-center text-center",children:[w.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#f0ece7] flex items-center justify-center mb-3",children:w.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#a8a099",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),w.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),w.jsx("p",{className:"text-[13px] text-[#1a1a1a] font-medium",children:"No connections available"}),w.jsx("p",{className:"text-[11px] text-[#a8a099] mt-1",children:"Add integrations to your workflow nodes to configure connections here."})]}):w.jsx("div",{className:"rounded-lg border border-[#e8e4df] bg-white divide-y divide-[#e8e4df]",children:c.map(h=>w.jsx("div",{className:"px-4 py-3.5",children:w.jsx(kC,{integrationId:h,workflowName:"*",nodeName:"*",connectionsApi:t})},h))})]})]})})}function B8({workflows:e,parseErrors:t,onSelectWorkflow:i}){return w.jsx("div",{className:"flex-1 overflow-y-auto",children:w.jsxs("div",{className:"p-8 max-w-[1200px]",children:[w.jsx("h1",{className:"text-2xl font-light tracking-tight text-[#1a1a1a]",style:{fontFamily:"Georgia, 'Times New Roman', serif"},children:"Workflows"}),w.jsx("p",{className:"text-sm text-[#787068] mt-1 tracking-wide",children:"Manage and monitor your automation workflows."}),w.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[w.jsxs("div",{className:"bg-white rounded-xl border border-[#e8e4df] px-5 py-4 shadow-sm",children:[w.jsxs("div",{className:"flex items-center gap-2 text-[#a8a099] mb-1",children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),w.jsx("polyline",{points:"2 17 12 22 22 17"}),w.jsx("polyline",{points:"2 12 12 17 22 12"})]}),w.jsx("span",{className:"text-[11px] uppercase tracking-wider font-medium",children:"Total"})]}),w.jsx("span",{className:"text-2xl font-light tracking-tight text-[#1a1a1a]",children:e.length})]}),w.jsxs("div",{className:"bg-white rounded-xl border border-[#e8e4df] px-5 py-4 shadow-sm",children:[w.jsxs("div",{className:"flex items-center gap-2 text-[#a8a099] mb-1",children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("circle",{cx:"12",cy:"12",r:"10"}),w.jsx("polyline",{points:"12 6 12 12 16 14"})]}),w.jsx("span",{className:"text-[11px] uppercase tracking-wider font-medium",children:"Nodes"})]}),w.jsx("span",{className:"text-2xl font-light tracking-tight text-[#1a1a1a]",children:e.reduce((r,l)=>r+l.nodes.filter(a=>a.type!=="input"&&a.type!=="output").length,0)})]}),w.jsxs("div",{className:"bg-white rounded-xl border border-[#e8e4df] px-5 py-4 shadow-sm",children:[w.jsxs("div",{className:"flex items-center gap-2 text-[#a8a099] mb-1",children:[w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),w.jsx("polyline",{points:"14 2 14 8 20 8"})]}),w.jsx("span",{className:"text-[11px] uppercase tracking-wider font-medium",children:"Files"})]}),w.jsx("span",{className:"text-2xl font-light tracking-tight text-[#1a1a1a]",children:new Set(e.map(r=>r.filePath)).size})]})]}),e.length===0&&t.length===0?w.jsxs("div",{className:"mt-8 rounded-xl border border-[#e8e4df] bg-white p-12 flex flex-col items-center text-center",children:[w.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#f0ece7] flex items-center justify-center mb-4",children:w.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#a8a099",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),w.jsx("polyline",{points:"2 17 12 22 22 17"}),w.jsx("polyline",{points:"2 12 12 17 22 12"})]})}),w.jsx("p",{className:"text-[15px] text-[#1a1a1a] font-medium",children:"No workflows yet"}),w.jsx("p",{className:"text-[13px] text-[#a8a099] mt-1.5 max-w-sm",children:"Create a workflow file in your project to get started. Use Claude Code to generate one."})]}):w.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 mt-6",children:e.map(r=>w.jsxs("button",{onClick:()=>i(r.workflowName),className:"text-left bg-white rounded-xl border border-[#e8e4df] p-5 shadow-sm hover:shadow-md hover:border-[#d4cfc8] transition-all duration-200 cursor-pointer",children:[w.jsxs("div",{className:"flex items-start justify-between gap-2",children:[w.jsx("h3",{className:"text-[15px] font-medium text-[#1a1a1a] tracking-tight truncate",children:r.workflowName}),w.jsxs("span",{className:"text-[11px] px-2 py-0.5 rounded-full border border-emerald-200 bg-emerald-50 text-emerald-700 shrink-0",children:["v",r.version]})]}),w.jsxs("p",{className:"text-sm text-[#787068] mt-2 leading-relaxed line-clamp-2",children:[r.nodes.filter(l=>l.type!=="input"&&l.type!=="output").length," nodes",r.nodes.some(l=>l.type==="agent")&&" including AI agents"]}),w.jsx("div",{className:"flex items-center justify-between mt-4 pt-3 border-t border-[#f0ece7]",children:w.jsx("span",{className:"text-xs text-[#a8a099] truncate",children:r.filePath})})]},`${r.filePath}:${r.workflowName}`))}),t.length>0&&w.jsxs("div",{className:"mt-6",children:[w.jsx("h2",{className:"text-[15px] font-medium text-amber-700 mb-3",children:"Parse Errors"}),w.jsx("div",{className:"flex flex-col gap-2",children:t.map(r=>w.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 px-5 py-3",children:[w.jsx("p",{className:"text-[13px] font-medium text-amber-800 truncate",children:r.filePath}),w.jsx("p",{className:"text-[12px] text-amber-600 mt-0.5 truncate",children:r.error})]},r.filePath))})]})]})})}function L8(){const{state:e,connected:t,sendMessage:i,ptyEvents:r}=QA(),l=wB({sendMessage:i,ptyEvents:r}),a=JA(),c=EB(),h=kB(),[d,f]=Y.useState(!0),[m,g]=Y.useState(!0),[v,y]=Y.useState("test"),S=CB({defaultWidth:288,minWidth:200,maxWidth:500,side:"left"});Y.useEffect(()=>{c.page==="canvas"&&!c.selectedWorkflow&&e.workflows.length>0&&c.selectWorkflow(e.workflows[e.workflows.length-1].workflowName)},[c.page,c.selectedWorkflow,e.workflows,c.selectWorkflow]);const b=nD(c.selectedWorkflow),E=e.workflows.find(k=>k.workflowName===c.selectedWorkflow),C=Y.useMemo(()=>[{id:"terminal",label:"Terminal",content:w.jsx(D8,{attachTo:l.attachTo,fit:l.fit,ptyAlive:l.ptyAlive,hasData:l.hasData,restart:l.restart})}],[l]),L=[{id:"dashboard",label:"Dashboard",icon:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),w.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),w.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),w.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})},{id:"canvas",label:c.selectedWorkflow??"Canvas",icon:w.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),w.jsx("path",{d:"M8 21h8"}),w.jsx("path",{d:"M12 17v4"})]})},{id:"credentials",label:"Credentials",icon:w.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})})}];return w.jsxs("div",{className:"h-screen w-screen flex bg-background",children:[w.jsxs("aside",{className:`${h.collapsed?"w-16":"w-[240px]"} shrink-0 flex flex-col border-r border-border bg-[#f5f3f0] transition-[width] duration-200 overflow-hidden`,children:[h.collapsed?w.jsxs("div",{className:"pt-3 pb-1 flex flex-col items-center gap-1.5",children:[w.jsx("button",{onClick:()=>c.navigate("dashboard"),className:"text-sm font-bold text-foreground font-serif tracking-wide cursor-pointer hover:opacity-70 transition-opacity",children:"0p"}),w.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${t?"bg-green-400":"bg-red-400"}`,title:t?"Connected":"Disconnected"})]}):w.jsxs("div",{className:"px-5 pt-5 pb-4 flex items-center justify-between",children:[w.jsx("button",{onClick:()=>c.navigate("dashboard"),className:"text-sm font-bold text-foreground font-serif tracking-wide cursor-pointer hover:opacity-70 transition-opacity",children:"Mache"}),w.jsx("span",{className:`w-2 h-2 rounded-full ${t?"bg-green-400":"bg-red-400"}`,title:t?"Connected":"Disconnected"})]}),w.jsxs("div",{className:`${h.collapsed?"mx-3 mt-1":"mx-5"} flex items-center gap-0`,children:[w.jsx("div",{className:"flex-1 h-px bg-[#e8e4df]"}),w.jsx("button",{onClick:h.toggle,className:"p-1 rounded-md text-[#a8a099] hover:text-[#1a1a1a] hover:bg-[#f0ece7] transition-colors shrink-0 cursor-pointer",title:h.collapsed?"Expand sidebar":"Collapse sidebar",children:h.collapsed?w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("polyline",{points:"13 17 18 12 13 7"}),w.jsx("polyline",{points:"6 17 11 12 6 7"})]}):w.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[w.jsx("polyline",{points:"11 17 6 12 11 7"}),w.jsx("polyline",{points:"18 17 13 12 18 7"})]})})]}),w.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:w.jsx("div",{className:"flex flex-col gap-0.5",children:L.map(k=>w.jsxs("button",{onClick:()=>c.navigate(k.id),title:h.collapsed?k.label:void 0,className:`flex items-center ${h.collapsed?"justify-center":"gap-2.5"} w-full px-3 py-2 rounded-lg text-sm transition-colors duration-150 cursor-pointer ${c.page===k.id?"bg-[#f0ece7] text-[#1a1a1a] font-medium":"text-[#787068] hover:bg-[#f0ece7]/60 hover:text-[#1a1a1a]"}`,children:[w.jsx("span",{className:"shrink-0",children:k.icon}),!h.collapsed&&w.jsx("span",{className:"truncate",children:k.label})]},k.id))})})]}),w.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:c.page==="dashboard"?w.jsx(B8,{workflows:e.workflows,parseErrors:e.parseErrors,onSelectWorkflow:c.selectWorkflow}):c.page==="credentials"?w.jsx(R8,{workflows:e.workflows,connectionsApi:a,onBack:()=>c.navigate("dashboard")}):w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"flex-1 relative min-h-0",children:[E?w.jsxs(Zx,{children:[w.jsx("div",{className:"absolute inset-0 shadow-[inset_0_0_20px_rgba(0,0,0,0.03)]",children:w.jsx(g8,{dag:E,connectionsApi:a})}),w.jsx("div",{className:"absolute top-3 left-3",children:w.jsxs("div",{className:"bg-card/80 backdrop-blur-sm px-3 py-1.5 rounded-lg shadow-[0_1px_4px_rgba(0,0,0,0.04)] border border-border",children:[w.jsx("span",{className:"text-[15px] font-semibold text-foreground",children:E.workflowName}),w.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["v",E.version]})]})})]},E.workflowName):w.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Waiting for workflow files..."}),E&&!m&&w.jsx("button",{onClick:()=>g(!0),className:"absolute top-1/2 -translate-y-1/2 right-0 w-6 h-12 flex items-center justify-center bg-white border border-[#e8e4df] border-r-0 rounded-l-md shadow-sm cursor-pointer text-[#a8a099] hover:text-[#1a1a1a] transition-colors",title:"Open test panel",children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"15 18 9 12 15 6"})})}),!d&&w.jsx("button",{onClick:()=>f(!0),className:"absolute bottom-0 left-1/2 -translate-x-1/2 h-6 w-12 flex items-center justify-center bg-white border border-[#e8e4df] border-b-0 rounded-t-md shadow-sm cursor-pointer text-[#a8a099] hover:text-[#1a1a1a] transition-colors",title:"Open terminal",children:w.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:w.jsx("polyline",{points:"18 15 12 9 6 15"})})})]}),d&&w.jsx(y8,{tabs:C,defaultTab:"terminal",onClose:()=>f(!1)})]})}),m&&E&&w.jsxs("div",{className:"flex flex-col bg-white shrink-0 relative border-l border-[#e8e4df]",style:{width:S.width},children:[w.jsx("div",{onMouseDown:S.onDragStart,className:"absolute top-0 left-0 w-1 h-full cursor-ew-resize hover:bg-accent z-20"}),w.jsxs("div",{className:"shrink-0 px-4 pt-3 pb-0 border-b border-[#e8e4df] flex items-center justify-between",children:[w.jsx("div",{className:"flex gap-0",children:["test","runs"].map(k=>w.jsxs("button",{onClick:()=>y(k),className:`relative text-[12px] tracking-wide px-3 pb-2.5 cursor-pointer transition-colors ${v===k?"text-[#1a1a1a]":"text-[#a8a099] hover:text-[#787068]"}`,children:[k==="test"?"Test":"Runs",v===k&&w.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-[1.5px] bg-[#1a1a1a]"})]},k))}),w.jsx("button",{onClick:()=>g(!1),className:"text-[#a8a099] hover:text-[#1a1a1a] text-sm px-1 pb-2 cursor-pointer transition-colors",title:"Close",children:"×"})]}),w.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:v==="test"?w.jsx("div",{className:"p-4",children:w.jsx(A8,{dag:E,onSuccess:()=>{b.refresh(),y("runs")}})}):w.jsx(w8,{runs:b.runs,loading:b.loading,selectedRunId:b.selectedRunId,trace:b.trace,traceLoading:b.traceLoading,selectRun:b.selectRun,refresh:b.refresh})})]})]})}VE.createRoot(document.getElementById("root")).render(w.jsx(Y.StrictMode,{children:w.jsx(L8,{})}));